Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BP-3034 Add payment method "MB WAY" #147

Merged
merged 4 commits into from
Oct 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions example/transactions/mbway.php
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('mbway')->pay([
'invoice' => uniqid(),
'amountDebit' => 10.10,
]);

//Refund
$response = $buckaroo->method('mbway')->refund([
'invoice' => '', //Set invoice number of the transaction to refund
'originalTransactionKey' => '', //Set transaction key of the transaction to refund
'amountCredit' => 10.10,
]);
30 changes: 30 additions & 0 deletions src/PaymentMethods/MBWay/MBWay.php
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 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\MBWay;

use Buckaroo\PaymentMethods\PayablePaymentMethod;

class MBWay extends PayablePaymentMethod
{
protected string $paymentName = 'MBWay';
}
2 changes: 2 additions & 0 deletions src/PaymentMethods/PaymentMethodFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
use Buckaroo\PaymentMethods\CreditManagement\CreditManagement;
use Buckaroo\PaymentMethods\Emandates\Emandates;
use Buckaroo\PaymentMethods\EPS\EPS;
use Buckaroo\PaymentMethods\MBWay\MBWay;
use Buckaroo\PaymentMethods\GiftCard\GiftCard;
use Buckaroo\PaymentMethods\Giropay\Giropay;
use Buckaroo\PaymentMethods\iDeal\iDeal;
Expand Down Expand Up @@ -95,6 +96,7 @@ class PaymentMethodFactory
In3Old::class => ['in3old'],
KlarnaPay::class => ['klarna', 'klarnain'],
KlarnaKP::class => ['klarnakp'],
MBWay::class => ['mbway'],
Surepay::class => ['surepay'],
Subscriptions::class => ['subscriptions'],
SEPA::class => ['sepadirectdebit', 'sepa'],
Expand Down
55 changes: 55 additions & 0 deletions tests/Buckaroo/Payments/MBWayTest.php
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 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;

class MBWayTest extends BuckarooTestCase
{
/**
* @return void
* @test
*/
public function it_creates_a_mbway_payment()
{
$response = $this->buckaroo->method('mbway')->pay([
'invoice' => uniqid(),
'amountDebit' => 10.10,
]);

$this->assertTrue($response->isPendingProcessing());
}

/**
* @test
*/
public function it_creates_a_mbway_refund()
{
$response = $this->buckaroo->method('mbway')->refund([
'amountCredit' => 10,
'invoice' => 'testinvoice 123',
'description' => 'refund',
'originalTransactionKey' => '2D04704995B74D679AACC59F87XXXXXX',
]);

$this->assertTrue($response->isFailed());
}
}
Loading