Skip to content

Commit

Permalink
add binInq request
Browse files Browse the repository at this point in the history
  • Loading branch information
sportakal committed May 29, 2022
1 parent 8d006ad commit 826ebd7
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 5 deletions.
6 changes: 1 addition & 5 deletions samples/bin_inq.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,11 +74,7 @@
$result = $request->getResult();
$bin_list = $result->getBinList();

foreach ($bin_list as $bin) {
if (strpos($card->getNumber(), $bin['BINNum']) === 0) {
ddd($bin);
}
}
ddd($result->getBin());
ddd($result->getStatus(), $result->getStatusMessage(), $result->getErrorMessage());
} catch (Exception $e) {
ddd($e->getMessage());
Expand Down
13 changes: 13 additions & 0 deletions src/Results/BinInqResult.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,17 @@ public function getBinList(): array
{
return $this->getData()['Order']['BINInqResult']['BINList']['BIN'] ?? [];
}

public function getBin(): array
{
$card_bin = [];
foreach ($this->getBinList() as $bin) {
if (strpos($this->request_model->getCard()->getNumber(), $bin['BINNum']) === 0) {
$card_bin = $bin;
break;
}
}

return $card_bin;
}
}

0 comments on commit 826ebd7

Please sign in to comment.