Skip to content

Commit

Permalink
revert giropay from vendor
Browse files Browse the repository at this point in the history
  • Loading branch information
gentiprenaj committed Sep 19, 2024
1 parent bd4b7ea commit 2ec0353
Show file tree
Hide file tree
Showing 5 changed files with 160 additions and 0 deletions.
22 changes: 22 additions & 0 deletions vendor/buckaroo/sdk/example/transactions/giropay.php
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 vendor/buckaroo/sdk/src/PaymentMethods/Giropay/Giropay.php
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 vendor/buckaroo/sdk/src/PaymentMethods/Giropay/Models/Pay.php
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;
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
use Buckaroo\PaymentMethods\Thunes\Thunes;
use Buckaroo\PaymentMethods\Belfius\Belfius;
use Buckaroo\PaymentMethods\Billink\Billink;
use Buckaroo\PaymentMethods\Giropay\Giropay;
use Buckaroo\PaymentMethods\iDealQR\iDealQR;
use Buckaroo\PaymentMethods\Surepay\Surepay;
use Buckaroo\PaymentMethods\Trustly\Trustly;
Expand Down Expand Up @@ -120,6 +121,7 @@ class PaymentMethodFactory
Payconiq::class => ['payconiq'],
Przelewy24::class => ['przelewy24'],
PointOfSale::class => ['pospayment'],
Giropay::class => ['giropay'],
NoServiceSpecifiedPayment::class => ['noservice'],
GiftCard::class => [
'giftcard', 'westlandbon', 'babygiftcard', 'babyparkgiftcard',
Expand Down
57 changes: 57 additions & 0 deletions vendor/buckaroo/sdk/tests/Buckaroo/Payments/GiropayTest.php
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());
}
}

0 comments on commit 2ec0353

Please sign in to comment.