-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
bd4b7ea
commit 2ec0353
Showing
5 changed files
with
160 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<?php | ||
|
||
require_once '../bootstrap.php'; | ||
|
||
use Buckaroo\BuckarooClient; | ||
|
||
$buckaroo = new BuckarooClient($_ENV['BPE_WEBSITE_KEY'], $_ENV['BPE_SECRET_KEY']); | ||
|
||
//Also accepts json | ||
//Pay | ||
$response = $buckaroo->method('giropay')->pay([ | ||
'invoice' => uniqid(), | ||
'bic' => 'GENODETT488', | ||
'amountDebit' => 10.10, | ||
]); | ||
|
||
//Refund | ||
$response = $buckaroo->method('giropay')->refund([ | ||
'invoice' => '', //Set invoice number of the transaction to refund | ||
'originalTransactionKey' => '', //Set transaction key of the transaction to refund | ||
'amountCredit' => 10.10, | ||
]); |
50 changes: 50 additions & 0 deletions
50
vendor/buckaroo/sdk/src/PaymentMethods/Giropay/Giropay.php
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,50 @@ | ||
<?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 | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Buckaroo\PaymentMethods\Giropay; | ||
|
||
use Buckaroo\Models\Model; | ||
use Buckaroo\PaymentMethods\Giropay\Models\Pay; | ||
use Buckaroo\PaymentMethods\Interfaces\Combinable; | ||
use Buckaroo\PaymentMethods\PayablePaymentMethod; | ||
use Buckaroo\Transaction\Response\TransactionResponse; | ||
|
||
class Giropay extends PayablePaymentMethod implements Combinable | ||
{ | ||
/** | ||
* @var int | ||
*/ | ||
protected int $serviceVersion = 2; | ||
/** | ||
* @var string | ||
*/ | ||
protected string $paymentName = 'giropay'; | ||
|
||
/** | ||
* @param Model|null $model | ||
* @return TransactionResponse | ||
*/ | ||
public function pay(?Model $model = null): TransactionResponse | ||
{ | ||
return parent::pay($model ?? new Pay($this->payload)); | ||
} | ||
} |
29 changes: 29 additions & 0 deletions
29
vendor/buckaroo/sdk/src/PaymentMethods/Giropay/Models/Pay.php
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,29 @@ | ||
<?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\PaymentMethods\Giropay\Models; | ||
|
||
use Buckaroo\Models\ServiceParameter; | ||
|
||
class Pay extends ServiceParameter | ||
{ | ||
protected string $bic; | ||
protected string $customerIBAN; | ||
} |
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
57 changes: 57 additions & 0 deletions
57
vendor/buckaroo/sdk/tests/Buckaroo/Payments/GiropayTest.php
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,57 @@ | ||
<?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 Tests\Buckaroo\Payments; | ||
|
||
use Tests\Buckaroo\BuckarooTestCase; | ||
|
||
class GiropayTest extends BuckarooTestCase | ||
{ | ||
/** | ||
* @return void | ||
* @test | ||
*/ | ||
public function it_creates_a_giropay_payment() | ||
{ | ||
$response = $this->buckaroo->method('giropay')->pay([ | ||
'invoice' => uniqid(), | ||
'bic' => 'GENODETT488', | ||
'amountDebit' => 10.10, | ||
]); | ||
|
||
$this->assertTrue($response->isPendingProcessing()); | ||
} | ||
|
||
/** | ||
* @return void | ||
* @test | ||
*/ | ||
public function it_creates_a_giropay_refund() | ||
{ | ||
$response = $this->buckaroo->method('giropay')->refund([ | ||
'amountCredit' => 10, | ||
'invoice' => 'testinvoice 123', | ||
'description' => 'refund', | ||
'originalTransactionKey' => '2D04704995B74D679AACC59F87XXXXXX', | ||
]); | ||
|
||
$this->assertTrue($response->isFailed()); | ||
} | ||
} |