-
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.
BP-3020 Add payment method "Multibanco" (#148)
* BP-3020 Add payment method "Multibanco" * fix tests --------- Co-authored-by: Ivascu Madalin <[email protected]>
- Loading branch information
Showing
4 changed files
with
108 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,21 @@ | ||
<?php | ||
|
||
require('../bootstrap.php'); | ||
|
||
use Buckaroo\BuckarooClient; | ||
|
||
$buckaroo = new BuckarooClient($_ENV['BPE_WEBSITE_KEY'], $_ENV['BPE_SECRET_KEY']); | ||
|
||
//Also accepts json | ||
//Pay | ||
$response = $buckaroo->method('multibanco')->pay([ | ||
'invoice' => uniqid(), | ||
'amountDebit' => 10.10, | ||
]); | ||
|
||
//Refund | ||
$response = $buckaroo->method('multibanco')->refund([ | ||
'invoice' => '', //Set invoice number of the transaction to refund | ||
'originalTransactionKey' => '', //Set transaction key of the transaction to refund | ||
'amountCredit' => 10.10, | ||
]); |
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,30 @@ | ||
<?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\Multibanco; | ||
|
||
use Buckaroo\PaymentMethods\PayablePaymentMethod; | ||
|
||
class Multibanco extends PayablePaymentMethod | ||
{ | ||
protected string $paymentName = 'Multibanco'; | ||
} |
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,55 @@ | ||
<?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 MultibancoTest extends BuckarooTestCase | ||
{ | ||
/** | ||
* @return void | ||
* @test | ||
*/ | ||
public function it_creates_a_multibanco_payment() | ||
{ | ||
$response = $this->buckaroo->method('multibanco')->pay([ | ||
'invoice' => uniqid(), | ||
'amountDebit' => 10.10, | ||
]); | ||
|
||
$this->assertTrue($response->isPendingProcessing()); | ||
} | ||
|
||
/** | ||
* @test | ||
*/ | ||
public function it_creates_a_multibanco_refund() | ||
{ | ||
$response = $this->buckaroo->method('multibanco')->refund([ | ||
'amountCredit' => 10, | ||
'invoice' => 'testinvoice 123', | ||
'description' => 'refund', | ||
'originalTransactionKey' => '2D04704995B74D679AACC59F87XXXXXX', | ||
]); | ||
|
||
$this->assertTrue($response->isFailed()); | ||
} | ||
} |