-
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 Ideal Processing as separate payment method, also removed duplica…
…te NoServiceSpecifiedPayment in $payments array
- Loading branch information
1 parent
5e9e363
commit c6e8e7b
Showing
5 changed files
with
197 additions
and
3 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?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 support@buckaroo.nl 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 support@buckaroo.nl for more information. | ||
* | ||
* @copyright Copyright (c) Buckaroo B.V. | ||
* @license https://tldrlegal.com/license/mit-license | ||
*/ | ||
|
||
namespace Buckaroo\PaymentMethods\iDealProcessing\Models; | ||
|
||
use Buckaroo\Models\ServiceParameter; | ||
|
||
class Pay extends ServiceParameter | ||
{ | ||
protected string $issuer; | ||
} |
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,75 @@ | ||
<?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 support@buckaroo.nl 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 support@buckaroo.nl for more information. | ||
* | ||
* @copyright Copyright (c) Buckaroo B.V. | ||
* @license https://tldrlegal.com/license/mit-license | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Buckaroo\PaymentMethods\iDealProcessing; | ||
|
||
use Buckaroo\Exceptions\BuckarooException; | ||
use Buckaroo\Models\Model; | ||
use Buckaroo\PaymentMethods\iDealProcessing\Models\Pay; | ||
use Buckaroo\PaymentMethods\PayablePaymentMethod; | ||
use Buckaroo\Services\TraitHelpers\HasIssuers; | ||
use Buckaroo\Transaction\Response\TransactionResponse; | ||
|
||
class iDealProcessing extends PayablePaymentMethod | ||
Check failure on line 32 in src/PaymentMethods/iDealProcessing/iDealProcessing.php GitHub Actions / PHP 7.4 - prefer-stable -
Check failure on line 32 in src/PaymentMethods/iDealProcessing/iDealProcessing.php GitHub Actions / PHP 8.2 - prefer-stable -
|
||
{ | ||
use HasIssuers { | ||
issuers as traitIssuers; | ||
} | ||
|
||
/** | ||
* @var string | ||
*/ | ||
protected string $paymentName = 'idealprocessing'; | ||
/** | ||
* @var array|string[] | ||
*/ | ||
protected array $requiredConfigFields = ['currency', 'returnURL', 'returnURLCancel', 'pushURL']; | ||
|
||
/** | ||
* @param Model|null $model | ||
* @return TransactionResponse | ||
*/ | ||
public function pay(?Model $model = null) | ||
{ | ||
return parent::pay($model ?? new Pay($this->payload)); | ||
} | ||
|
||
/** | ||
* @param Model|null $model | ||
* @return TransactionResponse | ||
*/ | ||
public function payRemainder(?Model $model = null): TransactionResponse | ||
{ | ||
return parent::payRemainder($model ?? new Pay($this->payload)); | ||
} | ||
|
||
/** | ||
* @return array | ||
* @throws BuckarooException | ||
*/ | ||
public function issuers(): array | ||
{ | ||
$this->serviceVersion = 2; | ||
|
||
return $this->traitIssuers(); | ||
} | ||
} |
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,90 @@ | ||
<?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 support@buckaroo.nl 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 support@buckaroo.nl for more information. | ||
* | ||
* @copyright Copyright (c) Buckaroo B.V. | ||
* @license https://tldrlegal.com/license/mit-license | ||
*/ | ||
|
||
namespace Tests\Buckaroo\Payments; | ||
|
||
use Tests\Buckaroo\BuckarooTestCase; | ||
use Buckaroo\Config\Config; | ||
|
||
|
||
class CustomConfig extends Config | ||
{ | ||
public function __construct() | ||
{ | ||
$websiteKey = 'Set Key'; | ||
$secretKey = 'From other resources like DB/ENV/Platform Config'; | ||
|
||
parent::__construct($websiteKey, $secretKey); | ||
} | ||
} | ||
|
||
class IdealProcessingTest extends BuckarooTestCase | ||
{ | ||
protected array $paymentPayload; | ||
protected function setUp(): void | ||
{ | ||
$this->paymentPayload = [ | ||
'invoice' => uniqid(), | ||
'amountDebit' => 10.10, | ||
'issuer' => 'ABNANL2A', | ||
'pushURL' => 'https://buckaroo.dev/push', | ||
'returnURL' => 'https://buckaroo.dev/return', | ||
'clientIP' => [ | ||
'address' => '123.456.789.123', | ||
'type' => 0, | ||
], | ||
'customParameters' => [ | ||
'CustomerBillingFirstName' => 'test' | ||
], | ||
'additionalParameters' => [ | ||
'initiated_by_magento' => 1, | ||
'service_action' => 'something', | ||
], | ||
]; | ||
} | ||
|
||
/** | ||
* @return void | ||
* @test | ||
*/ | ||
public function it_get_idealprocessing_issuers() | ||
{ | ||
$response = $this->buckaroo->method('idealprocessing')->issuers(); | ||
|
||
$this->assertIsArray($response); | ||
foreach ($response as $item) | ||
{ | ||
$this->assertIsArray($item); | ||
$this->assertArrayHasKey('id', $item); | ||
$this->assertArrayHasKey('name', $item); | ||
} | ||
} | ||
|
||
/** | ||
* @return void | ||
* @test | ||
*/ | ||
public function it_creates_a_idealprocessing_payment() | ||
{ | ||
$response = $this->buckaroo->method('idealprocessing')->pay($this->paymentPayload); | ||
|
||
$this->assertTrue($response->isPendingProcessing()); | ||
} | ||
} |
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