Skip to content

Commit

Permalink
v1.6.0 (#115)
Browse files Browse the repository at this point in the history
* Request To Pay Payment method removed (#77)

* Fixed an issue with getting issuers for iDeal (#78)

Co-authored-by: Shu Chen <[email protected]>

* Adding missing subscriptions parameters (#79)

* Add missing parameters

* Add docblock

* Bancontact update & fixes (#80)

* Add missing parameters

* Add docblock

* Add bancontact alias

* Fix wrong naming to payrecurring and add payoneclick method

* Return null when response data is not set (#81)

* BP-2345 add return and push url in the i deal qr request in the php sdk (#83)

* Return null when response data is not set

* Add missing parameters

* Update test and example

* 1.3.1

* Changing the version

* Merge conflict

* Update changelog

* Update changelog

* Return string instead of int in subcode code (#88)

* [Bugfixes] outdated subscription example (#90)

* Return string instead of int in subcode code

* Update subscription examples

* Update Paypal test

* GitHub/action psr12 and phplint validation (#92)

* 1.4.0 (#86)

* Request To Pay Payment method removed (#77)

* Fixed an issue with getting issuers for iDeal (#78)

Co-authored-by: Shu Chen <[email protected]>

* Adding missing subscriptions parameters (#79)

* Add missing parameters

* Add docblock

* Bancontact update & fixes (#80)

* Add missing parameters

* Add docblock

* Add bancontact alias

* Fix wrong naming to payrecurring and add payoneclick method

* Return null when response data is not set (#81)

* BP-2345 add return and push url in the i deal qr request in the php sdk (#83)

* Return null when response data is not set

* Add missing parameters

* Update test and example

* 1.3.1

* Changing the version

* Merge conflict

* Update changelog

* Update changelog

---------

Co-authored-by: reflie-nxte <[email protected]>

* Added action

* Added comment to trigger github action

---------

Co-authored-by: Shu Chen <[email protected]>
Co-authored-by: reflie-nxte <[email protected]>

* Update ideal qr test (#94)

* BP-2404 Feature/8.2 support (#95)

* Update ideal qr test

* Add group reference

* Move tests folder

* wip

* Conform phpcs

* Remove comments

* Release 1.5.0 (#97)

* BP-2441 Added support for transaction requests without specifying a service code (#102)

* Update Transaction Comment (#103)

* 1.4.0 (#86)

* Request To Pay Payment method removed (#77)

* Fixed an issue with getting issuers for iDeal (#78)

Co-authored-by: Shu Chen <[email protected]>

* Adding missing subscriptions parameters (#79)

* Add missing parameters

* Add docblock

* Bancontact update & fixes (#80)

* Add missing parameters

* Add docblock

* Add bancontact alias

* Fix wrong naming to payrecurring and add payoneclick method

* Return null when response data is not set (#81)

* BP-2345 add return and push url in the i deal qr request in the php sdk (#83)

* Return null when response data is not set

* Add missing parameters

* Update test and example

* 1.3.1

* Changing the version

* Merge conflict

* Update changelog

* Update changelog

---------

Co-authored-by: reflie-nxte <[email protected]>

* 1.5.0 (#98)

* Request To Pay Payment method removed (#77)

* Fixed an issue with getting issuers for iDeal (#78)

Co-authored-by: Shu Chen <[email protected]>

* Adding missing subscriptions parameters (#79)

* Add missing parameters

* Add docblock

* Bancontact update & fixes (#80)

* Add missing parameters

* Add docblock

* Add bancontact alias

* Fix wrong naming to payrecurring and add payoneclick method

* Return null when response data is not set (#81)

* BP-2345 add return and push url in the i deal qr request in the php sdk (#83)

* Return null when response data is not set

* Add missing parameters

* Update test and example

* 1.3.1

* Changing the version

* Merge conflict

* Update changelog

* Update changelog

* Return string instead of int in subcode code (#88)

* [Bugfixes] outdated subscription example (#90)

* Return string instead of int in subcode code

* Update subscription examples

* Update Paypal test

* GitHub/action psr12 and phplint validation (#92)

* 1.4.0 (#86)

* Request To Pay Payment method removed (#77)

* Fixed an issue with getting issuers for iDeal (#78)

Co-authored-by: Shu Chen <[email protected]>

* Adding missing subscriptions parameters (#79)

* Add missing parameters

* Add docblock

* Bancontact update & fixes (#80)

* Add missing parameters

* Add docblock

* Add bancontact alias

* Fix wrong naming to payrecurring and add payoneclick method

* Return null when response data is not set (#81)

* BP-2345 add return and push url in the i deal qr request in the php sdk (#83)

* Return null when response data is not set

* Add missing parameters

* Update test and example

* 1.3.1

* Changing the version

* Merge conflict

* Update changelog

* Update changelog

---------

Co-authored-by: reflie-nxte <[email protected]>

* Added action

* Added comment to trigger github action

---------

Co-authored-by: Shu Chen <[email protected]>
Co-authored-by: reflie-nxte <[email protected]>

* Update ideal qr test (#94)

* BP-2404 Feature/8.2 support (#95)

* Update ideal qr test

* Add group reference

* Move tests folder

* wip

* Conform phpcs

* Remove comments

* Release 1.5.0 (#97)

---------

Co-authored-by: reflie-nxte <[email protected]>
Co-authored-by: avido <[email protected]>

* Update Transaction Comment

---------

Co-authored-by: Shu Chen <[email protected]>
Co-authored-by: reflie-nxte <[email protected]>
Co-authored-by: avido <[email protected]>

* created new PayablePaymentMethod for when no service is specified

* fix style

* Minor fixes

* update phpdoc, and fix Line exceeds 120 characters

* Remove method paynoservice

* Inlcude monolog version 3

* Include ramsey version 4

* Add missing property

* Add PayRemainder in KlarnaPay (#112)

* Pay remainder missing for some methods (#113)

* Add PayRemainder to Alipay

* Add PayRemainder to Paypal

* Add PayRemainder to Payconiq

* Add PayRemainder to Afterpay

* Add PayRemainder to Trustly

* Add PayRemainder to Przelewy24

* Add PayRemainder to Belfius

* Add PayRemainder to EPS

* Revert Belfius

* Revert EPS

* Revert Payconiq

* BP-2509 Add Instant refunds,no service payment refactor (#109)

* BP-2527 Batch functionality (#114)

* WIP

* Batch finished

* Update php-cs-fixer

* php cs fixer

* PHPcs

* Add transaction batch endpoint

* phpcs fix

* V1.6.0

---------

Co-authored-by: reflie-nxte <[email protected]>
Co-authored-by: avido <[email protected]>
Co-authored-by: Sander H <[email protected]>
Co-authored-by: Muneeb Shoukat <[email protected]>
Co-authored-by: vegim carkaxhija <[email protected]>
Co-authored-by: Lucian Turiac <[email protected]>
Co-authored-by: Rinor12010 <[email protected]>
  • Loading branch information
8 people authored May 23, 2023
1 parent dc6195a commit 1d4e925
Show file tree
Hide file tree
Showing 30 changed files with 464 additions and 25 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,5 @@ example/logs
.phpunit.result.cache

logs/

.php-cs-fixer.cache
1 change: 0 additions & 1 deletion .php-cs-fixer.cache

This file was deleted.

4 changes: 4 additions & 0 deletions .php-cs-fixer.dist.php → .php-cs-fixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@
'position_after_anonymous_constructs' => 'next',
'position_after_control_structures' => 'next',
],
'curly_braces_position' => [
'classes_opening_brace' => 'next_line_unless_newline_at_signature_end',
'control_structures_opening_brace' => 'next_line_unless_newline_at_signature_end'
],
'phpdoc_single_line_var_spacing' => true,
'phpdoc_var_without_name' => true,
'method_argument_space' => [
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ $buckaroo->method('creditcard') // Input the desire payment method.

After you create a transaction, you can retrieve several transaction information on demand.
```php
# Create a new payment
# Retrieve transaction information
$transaction = $buckaroo->transaction('YOUR-TRANSACTION-KEY')

$transaction->status(); // Retrieve transaction status
Expand Down
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@
"name": "buckaroo/sdk",
"description": "Buckaroo payment SDK",
"license": "MIT",
"version": "1.5.2",
"version": "1.6.0",
"type": "library",
"require": {
"php": ">=7.4|^8.0",
"ext-json": "*",
"ext-pcre": "*",
"ext-fileinfo": "*",
"monolog/monolog": "^2.2",
"monolog/monolog": "^2.2|^3",
"guzzlehttp/guzzle": "^7.0",
"composer/ca-bundle": "^1.3",
"ramsey/uuid": "^3.9.7"
"ramsey/uuid": "^3.9.7|^4"
},
"require-dev": {
"squizlabs/php_codesniffer": "3.*",
Expand Down
27 changes: 27 additions & 0 deletions example/transactions/noservicespecified.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php

require('../bootstrap.php');

use Buckaroo\BuckarooClient;

$buckaroo = new BuckarooClient($_ENV['BPE_WEBSITE_KEY'], $_ENV['BPE_SECRET_KEY']);

//Also accepts json
//Pay
//continueOnIncomplete is mandatory for a no service specified payment.
//With the settings below the merchant can chose Bancontact or PayPal on the checkout page.
$response = $buckaroo->method(null)->pay([
'invoice' => uniqid(),
'amountDebit' => 10.10,
'servicesSelectableByClient' => 'ideal,bancontactmrcash,paypal',
'servicesExcludedForClient' => 'ideal',
'continueOnIncomplete' => '1',
]);


//Refund
$response = $buckaroo->method(null)->refund([
'invoice' => '', //Set invoice number of the transaction to refund
'originalTransactionKey' => '', //Set transaction key of the transaction to refund
'amountCredit' => 10.10,
]);
15 changes: 14 additions & 1 deletion src/BuckarooClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,14 @@
use Buckaroo\Exceptions\BuckarooException;
use Buckaroo\Handlers\Credentials;
use Buckaroo\Handlers\Logging\Observer as LoggingObserver;
use Buckaroo\PaymentMethods\BatchTransactions;
use Buckaroo\PaymentMethods\PaymentFacade;
use Buckaroo\Services\TransactionService;
use Buckaroo\Transaction\Client;

/**
*
*/
class BuckarooClient
{
/**
Expand Down Expand Up @@ -56,11 +60,20 @@ public function __construct(string $websiteKey, string $secretKey, string $mode
* @param string $method
* @return PaymentFacade
*/
public function method(string $method): PaymentFacade
public function method(string $method = null): PaymentFacade
{
return new PaymentFacade($this->client, $method);
}

/**
* @param array $transactions
* @return BatchTransactions
*/
public function batch(array $transactions): BatchTransactions
{
return new BatchTransactions($this->client, $transactions);
}

/**
* @param string $transactionKey
* @return TransactionService
Expand Down
3 changes: 3 additions & 0 deletions src/Exceptions/BuckarooException.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ class BuckarooException extends Exception
* @param int $code
* @param Throwable|null $previous
*/

protected ?Subject $logger;

public function __construct(?Subject $logger, string $message = "", int $code = 0, Throwable $previous = null)
{
$message = $this->message($message);
Expand Down
3 changes: 2 additions & 1 deletion src/Handlers/Credentials.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,8 @@ public function confirm(): bool

try {
$response = $this->client->specification($request, 'ideal', 2);
} catch (BuckarooException $e) {
} catch (BuckarooException $e)
{
return false;
}

Expand Down
9 changes: 9 additions & 0 deletions src/PaymentMethods/Afterpay/Afterpay.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,4 +94,13 @@ public function refund(?Model $model = null): TransactionResponse
{
return parent::refund($model ?? new Refund($this->payload));
}

/**
* @param Model|null $model
* @return TransactionResponse
*/
public function payRemainder(?Model $model = null): TransactionResponse
{
return parent::payRemainder($model ?? new Pay($this->payload));
}
}
9 changes: 9 additions & 0 deletions src/PaymentMethods/Alipay/Alipay.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,4 +40,13 @@ public function pay(?Model $model = null): TransactionResponse
{
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));
}
}
41 changes: 41 additions & 0 deletions src/PaymentMethods/BatchTransactions.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<?php

namespace Buckaroo\PaymentMethods;

use Buckaroo\Transaction\Client;
use Buckaroo\Transaction\Request\BatchRequest;

/**
*
*/
class BatchTransactions
{
/**
* @var Client
*/
protected Client $client;
/**
* @var BatchRequest
*/
protected BatchRequest $batch_transactions;

/**
* @param Client $client
* @param array $transactions
*/
public function __construct(Client $client, array $transactions)
{
$this->client = $client;

$this->batch_transactions = new BatchRequest($transactions);
}

/**
* @return mixed
* @throws \Buckaroo\Exceptions\BuckarooException
*/
public function execute()
{
return $this->client->dataBatchRequest($this->batch_transactions);
}
}
9 changes: 9 additions & 0 deletions src/PaymentMethods/KlarnaPay/KlarnaPay.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,4 +59,13 @@ public function payInInstallments(): TransactionResponse

return $this->postRequest();
}

/**
* @param Model|null $model
* @return TransactionResponse
*/
public function payRemainder(?Model $model = null): TransactionResponse
{
return parent::payRemainder($model ?? new Pay($this->payload));
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<?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\NoServiceSpecifiedPayment;

use Buckaroo\Models\Model;
use Buckaroo\PaymentMethods\Interfaces\Combinable;
use Buckaroo\PaymentMethods\PayablePaymentMethod;
use Buckaroo\PaymentMethods\PaymentMethod;

/**
*
*/
class NoServiceSpecifiedPayment extends PayablePaymentMethod implements Combinable
{
/**
* @var string
*/
protected string $paymentName = 'noservice';

/**
* @param string|null $action
* @param Model|null $model
* @return PaymentMethod
*/
protected function setServiceList(?string $action, ?Model $model = null): PaymentMethod
{
return $this;
}
}
1 change: 0 additions & 1 deletion src/PaymentMethods/PayablePaymentMethod.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ public function pay(?Model $model = null)
//TODO
//Create validator class that validates specific request
//$request->validate();

return $this->postRequest();
}

Expand Down
15 changes: 15 additions & 0 deletions src/PaymentMethods/Payconiq/Payconiq.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,25 @@

namespace Buckaroo\PaymentMethods\Payconiq;

use Buckaroo\Models\Model;
use Buckaroo\PaymentMethods\Interfaces\Combinable;
use Buckaroo\PaymentMethods\PayablePaymentMethod;
use Buckaroo\Transaction\Response\TransactionResponse;

class Payconiq extends PayablePaymentMethod implements Combinable
{
protected string $paymentName = 'payconiq';

/**
* @param Model|null $model
* @return TransactionResponse
*/
public function instantRefund(?Model $model = null):TransactionResponse
{
$this->setRefundPayload();

$this->setServiceList('instantRefund', $model);

return $this->postRequest();
}
}
4 changes: 2 additions & 2 deletions src/PaymentMethods/PaymentFacade.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ class PaymentFacade
* @param Client $client
* @param string $method
*/
public function __construct(Client $client, string $method)
public function __construct(Client $client, ?string $method)
{
$this->client = $client;

Expand Down Expand Up @@ -163,7 +163,7 @@ public function paymentMethod(): PaymentMethod
* @return mixed
* @throws BuckarooException
*/
public function __call(string $name, array $arguments)
public function __call(?string $name, array $arguments)
{
if (method_exists($this->paymentMethod, $name))
{
Expand Down
7 changes: 6 additions & 1 deletion src/PaymentMethods/PaymentMethod.php
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ protected function dataRequest()
* @param Model|null $model
* @return $this
*/
protected function setServiceList(string $action, ?Model $model = null)
protected function setServiceList(?string $action, ?Model $model = null): PaymentMethod
{
$serviceList = new ServiceList($this->paymentName(), $this->serviceVersion(), $action, $model);

Expand Down Expand Up @@ -209,4 +209,9 @@ public function combinePayment(Combinable $combinablePayment)

return $this;
}

public function request(): TransactionRequest
{
return $this->request;
}
}
Loading

0 comments on commit 1d4e925

Please sign in to comment.