-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add method to get issuers for PayByBank (#152)
+ add tests for PayByBank & iDeal + create trait for reusable
- Loading branch information
1 parent
96c957b
commit 8885205
Showing
5 changed files
with
117 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
<?php | ||
/* | ||
* NOTICE OF LICENSE | ||
* | ||
* This source file is subject to the MIT License | ||
* It is available through the world-wide-web at this URL: | ||
* https://tldrlegal.com/license/mit-license | ||
* If you are unable to obtain it through the world-wide-web, please send an email | ||
* to [email protected] so we can send you a copy immediately. | ||
* | ||
* DISCLAIMER | ||
* | ||
* Do not edit or add to this file if you wish to upgrade this module to newer | ||
* versions in the future. If you wish to customize this module for your | ||
* needs please contact [email protected] for more information. | ||
* | ||
* @copyright Copyright (c) Buckaroo B.V. | ||
* @license https://tldrlegal.com/license/mit-license | ||
*/ | ||
|
||
namespace Buckaroo\Services\TraitHelpers; | ||
|
||
use Buckaroo\Exceptions\BuckarooException; | ||
use Buckaroo\Transaction\Request\TransactionRequest; | ||
|
||
trait HasIssuers | ||
{ | ||
/** | ||
* @return array | ||
* @throws BuckarooException | ||
*/ | ||
public function issuers(): array | ||
{ | ||
$request = new TransactionRequest; | ||
|
||
try | ||
{ | ||
$response = $this->client->specification($request, $this->paymentName, $this->serviceVersion()); | ||
} catch (BuckarooException $e) | ||
{ | ||
return []; | ||
} | ||
|
||
$issuerList = []; | ||
if (isset($response->data()['Actions']['0']['RequestParameters'][0]['ListItemDescriptions'])) | ||
{ | ||
$issuersData = $response->data()['Actions']['0']['RequestParameters'][0]['ListItemDescriptions']; | ||
if (count($issuersData) > 0) | ||
{ | ||
foreach ($issuersData as $issuer) | ||
{ | ||
$issuerList[] = ['id' => $issuer['Value'], 'name' => $issuer['Description']]; | ||
} | ||
} | ||
} | ||
|
||
return $issuerList; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters