Skip to content

Commit

Permalink
1.5.0 (#98)
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)

---------

Co-authored-by: reflie-nxte <[email protected]>
Co-authored-by: avido <[email protected]>
  • Loading branch information
3 people authored Mar 23, 2023
1 parent 09495e2 commit 94bb8e3
Show file tree
Hide file tree
Showing 70 changed files with 275 additions and 173 deletions.
22 changes: 11 additions & 11 deletions .env.example
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
BPE_WEBSITE = "Example.com"
BPE_WEBSITE_KEY = "KEY"
BPE_SECRET_KEY = "SECRET"
BPE_MODE = "test"
BPE_DEBUG = true
BPE_REPORT_ERROR = true
BPE_WEBSITE="Example.com"
BPE_WEBSITE_KEY="KEY"
BPE_SECRET_KEY="SECRET"
BPE_MODE="test"
BPE_DEBUG=true
BPE_REPORT_ERROR=true

BPE_EXAMPLE_BASE_URL = "https://example.com/buckaroo/"
BPE_EXAMPLE_RETURN_URL = "${BPE_EXAMPLE_BASE_URL}return"
BPE_EXAMPLE_PUSH_URL = "${BPE_EXAMPLE_BASE_URL}push"
BPE_EXAMPLE_IP = "127.0.0.1"
BPE_EXAMPLE_CURRENCY_CODE = "EUR"
BPE_EXAMPLE_BASE_URL="https://example.com/buckaroo/"
BPE_EXAMPLE_RETURN_URL="${BPE_EXAMPLE_BASE_URL}return"
BPE_EXAMPLE_PUSH_URL="${BPE_EXAMPLE_BASE_URL}push"
BPE_EXAMPLE_IP="127.0.0.1"
BPE_EXAMPLE_CURRENCY_CODE="EUR"
35 changes: 35 additions & 0 deletions .github/workflows/codestyle.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
name: CheckStyleAndLint

on:
pull_request:
paths:
- "src/**.php"
- "example/**.php"

jobs:
phpcs:
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
php: [7.4, 8.1, 8.2]
stability: [prefer-stable]

name: PHP ${{ matrix.php }} - ${{ matrix.stability }} - ${{ matrix.os }}

steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
tools: cs2pr, phplint, phpcs

- name: Run phplint
run: phplint --no-configuration --no-cache --no-interaction ./src/* ./example/*

- name: Run phpcs
run: phpcs -q --report=checkstyle --extensions=php ./src/* | cs2pr
2 changes: 1 addition & 1 deletion .php-cs-fixer.cache

Large diffs are not rendered by default.

7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@ All notable changes to this project will be documented in this file.

## [Released]

## [1.5.0]
- BP-2351 Bugfix in transaction response in sub status code
- Subscription example updated.
- Github action added for PSR12 and PHPlint validation. Contributed by @avido
- iDeal QR Test updated.
- BP-2404 PHP 8.2 support

## [1.4.0]
- Fixed an issue with getting issuers for iDEAL. Reported by @reflie-nxte
- Add Bancontact alias and fixing typo in method name
Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "buckaroo/sdk",
"description": "Buckaroo payment SDK",
"license": "MIT",
"version": "1.4.0",
"version": "1.5.0",
"type": "library",
"require": {
"php": ">=7.4|^8.0",
Expand Down Expand Up @@ -33,7 +33,7 @@
},
"autoload-dev": {
"psr-4": {
"BuckarooTests\\": "Tests/"
"Tests\\": "tests/"
}
}
}
56 changes: 36 additions & 20 deletions example/additional_services/subscriptions.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,28 +9,36 @@

//** START Create Duo Combined */
$subscriptions = $buckaroo->method('subscriptions')->manually()->createCombined([
'pushURL' => 'https://buckaroo.dev/push',
'includeTransaction' => false,
'transactionVatPercentage' => 5,
'configurationCode' => 'xxxxx',
'configurationCode' => 'gfyh9fe4',
'email' => '[email protected]',
'rate_plans' => [
'ratePlans' => [
'add' => [
'startDate' => date('Y-m-d'),
'ratePlanCode' => 'xxxxxx',
'startDate' => '2033-01-01',
'ratePlanCode' => '9863hdcj',
],
],
'phone' => [
'mobile' => '0612345678',
],
'debtor' => [
'code' => 'xxxxxx',
'code' => 'johnsmith4',
],
'person' => [
'firstName' => 'John',
'lastName' => 'Do',
'gender' => Gender::FEMALE,
// 'person' => [
// 'firstName' => 'John',
// 'lastName' => 'Do',
// 'gender' => Gender::FEMALE,
// 'culture' => 'nl-NL',
// 'birthDate' => '1990-01-01'
// ],
'company' => [
'culture' => 'nl-NL',
'birthDate' => date('Y-m-d'),
'companyName' => 'My Company Coporation',
'vatApplicable' => true,
'vatNumber' => 'NL140619562B01',
'chamberOfCommerce' => '20091741',
],
'address' => [
'street' => 'Hoofdstraat',
Expand All @@ -50,28 +58,36 @@

//** START Create Triple Combined */
$subscriptions = $buckaroo->method('subscriptions')->manually()->createCombined([
'pushURL' => 'https://buckaroo.dev/push',
'includeTransaction' => false,
'transactionVatPercentage' => 5,
'configurationCode' => 'xxxxx',
'configurationCode' => 'gfyh9fe4',
'email' => '[email protected]',
'rate_plans' => [
'ratePlans' => [
'add' => [
'startDate' => date('Y-m-d'),
'ratePlanCode' => 'xxxxxx',
'startDate' => '2033-01-01',
'ratePlanCode' => '9863hdcj',
],
],
'phone' => [
'mobile' => '0612345678',
],
'debtor' => [
'code' => 'xxxxxx',
'code' => 'johnsmith4',
],
'person' => [
'firstName' => 'John',
'lastName' => 'Do',
'gender' => Gender::FEMALE,
// 'person' => [
// 'firstName' => 'John',
// 'lastName' => 'Do',
// 'gender' => Gender::FEMALE,
// 'culture' => 'nl-NL',
// 'birthDate' => '1990-01-01'
// ],
'company' => [
'culture' => 'nl-NL',
'birthDate' => date('Y-m-d'),
'companyName' => 'My Company Coporation',
'vatApplicable' => true,
'vatNumber' => 'NL140619562B01',
'chamberOfCommerce' => '20091741',
],
'address' => [
'street' => 'Hoofdstraat',
Expand Down
1 change: 1 addition & 0 deletions example/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@

require_once __DIR__ . "/../vendor/autoload.php";

// Load env
$dotenv = Dotenv::createImmutable(__DIR__ . "/../");
$dotenv->load();
2 changes: 1 addition & 1 deletion example/responses/push.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
//START JSON PUSH
$auth_header = 'IBjihN7Fhp:0YvyjYAzDQ28W+hQi80f2nhe0Z1QFJLbz7IH//6LsAU=:cad1832100784f57a6e6de835d9f3638:1658227572';
$post_data = '{"Transaction":{"Key":"5340604668D74435AA344E1428ED1292","Invoice":"62d68b6c8ab0c","ServiceCode":"ideal","Status":{"Code":{"Code":190,"Description":"Success"},"SubCode":{"Code":"S001","Description":"Transaction successfully processed"},"DateTime":"2022-07-19T12:46:12"},"IsTest":true,"Order":"ORDER_NO_62d68b6ca2df3","Currency":"EUR","AmountDebit":10.1,"TransactionType":"C021","Services":[{"Name":"ideal","Action":null,"Parameters":[{"Name":"consumerIssuer","Value":"ABN AMRO"},{"Name":"transactionId","Value":"0000000000000001"},{"Name":"consumerName","Value":"J. de Tèster"},{"Name":"consumerIBAN","Value":"NL44RABO0123456789"},{"Name":"consumerBIC","Value":"RABONL2U"}],"VersionAsProperty":2}],"CustomParameters":null,"AdditionalParameters":{"List":[{"Name":"initiated_by_magento","Value":"1"},{"Name":"service_action","Value":"something"}]},"MutationType":1,"RelatedTransactions":null,"IsCancelable":false,"IssuingCountry":null,"StartRecurrent":false,"Recurring":false,"CustomerName":"J. de Tèster","PayerHash":"2d26d34584a4eafeeaa97eed10cfdae22ae64cdce1649a80a55fafca8850e3e22cb32eb7c8fc95ef0c6f96669a21651d4734cc568816f9bd59c2092911e6c0da","PaymentKey":"AEC974D455FF4A4B9B4C21E437A04838","Description":null}}';
$uri = 'https://buckaroo.nextto.dev/push';
$uri = 'https://buckaroo.dev/push';

$reply_handler = new ReplyHandler($buckaroo->client()->config(), $post_data, $auth_header, $uri);
$reply_handler->validate();
Expand Down
1 change: 1 addition & 0 deletions example/transactions/klarna.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

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

use Buckaroo\BuckarooClient;
Expand Down
20 changes: 20 additions & 0 deletions phpcs.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?xml version="1.0"?>
<ruleset name="Buckaroo_Coding_Standard">
<description>Buckaroo SDK coding standard.</description>

<file>src</file>

<rule ref="PSR2"/>

<rule ref="Squiz.ControlStructures.ControlSignature.SpaceAfterCloseParenthesis">
<exclude-pattern>*.php</exclude-pattern>
</rule>

<rule ref="Squiz.Classes.ValidClassName.NotCamelCaps">
<exclude-pattern>src/PaymentMethods/iDeal/iDeal.php</exclude-pattern>
<exclude-pattern>src/PaymentMethods/iDealQR/iDealQR.php</exclude-pattern>
</rule>

<exclude name="Squiz.ControlStructures.ControlSignature.SpaceAfterKeyword">src</exclude>

</ruleset>
4 changes: 2 additions & 2 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<phpunit bootstrap="./vendor/autoload.php" colors="true">
<testsuites>
<testsuite name="BuckarooSDK">
<directory>src/Tests/</directory>
<testsuite name="Unit tests">
<directory>tests</directory>
</testsuite>
</testsuites>

Expand Down
3 changes: 1 addition & 2 deletions src/Config/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -194,8 +194,7 @@ private function filterNonUpdatableKeys($payload)
{
$filter = ['websiteKey', 'secretKey'];

return array_filter($payload, function ($k) use ($filter)
{
return array_filter($payload, function ($k) use ($filter) {
return ! in_array($k, $filter);
}, ARRAY_FILTER_USE_KEY);
}
Expand Down
7 changes: 2 additions & 5 deletions src/Handlers/Credentials.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,12 +58,9 @@ public function confirm(): bool

$request = new TransactionRequest;

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

Expand Down
3 changes: 1 addition & 2 deletions src/Handlers/Logging/DefaultLogger.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,7 @@ public function attach($observer)
*/
public function detach(Observer $observer)
{
$this->observers = array_filter($this->observers, function ($value) use ($observer)
{
$this->observers = array_filter($this->observers, function ($value) use ($observer) {
return get_class($value) != get_class($observer);
});

Expand Down
3 changes: 3 additions & 0 deletions src/Handlers/Logging/Observers/Monolog.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,12 @@
use Buckaroo\Handlers\Logging\Observer;
use Monolog\Handler\StreamHandler;
use Monolog\Logger;
use Psr\Log\LoggerInterface;

class Monolog implements Observer
{
protected LoggerInterface $log;

public function __construct()
{
$this->log = new Logger('Buckaroo log');
Expand Down
6 changes: 2 additions & 4 deletions src/Handlers/Reply/HttpPost.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,7 @@ public function __construct(Config $config, array $data)
public function validate(): bool
{
//Remove brq_signature from the equation
$data = array_filter($this->data, function ($key)
{
$data = array_filter($this->data, function ($key) {
$acceptable_top_level = ['brq', 'add', 'cust', 'BRQ', 'ADD', 'CUST'];

return (
Expand All @@ -61,8 +60,7 @@ public function validate(): bool
}, ARRAY_FILTER_USE_KEY);

//Combine the array keys with value
$data = array_map(function ($value, $key)
{
$data = array_map(function ($value, $key) {
return $key . '=' . html_entity_decode($value);
}, $data, array_keys($data));

Expand Down
4 changes: 2 additions & 2 deletions src/Handlers/Reply/ReplyHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,12 +118,12 @@ private function contains(string $needle, array $data, bool $strict = false): bo
{
foreach (array_keys($data) as $key)
{
if($strict && $key == $needle)
if ($strict && $key == $needle)
{
return true;
}

if(!$strict && str_contains($key, $needle))
if (! $strict && str_contains($key, $needle))
{
return true;
}
Expand Down
2 changes: 2 additions & 0 deletions src/PaymentMethods/BuckarooVoucher/Models/Create.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@

class Create extends ServiceParameter
{
protected string $groupReference;

protected string $usageType;

protected string $validFrom;
Expand Down
5 changes: 5 additions & 0 deletions src/PaymentMethods/PaymentFacade.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,11 @@ class PaymentFacade
*/
private bool $isManually = false;

/**
* @var Client
*/
protected Client $client;

/**
* @param Client $client
* @param string $method
Expand Down
11 changes: 9 additions & 2 deletions src/PaymentMethods/PaymentMethod.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@
use Buckaroo\Transaction\Response\TransactionResponse;
use Psr\Log\LoggerInterface;

/**
*
*/
abstract class PaymentMethod implements PaymentInterface
{
/**
Expand Down Expand Up @@ -74,6 +77,11 @@ abstract class PaymentMethod implements PaymentInterface
*/
protected bool $isManually = false;

/**
* @var string|null
*/
protected ?string $serviceCode;

/**
* @param Client $client
* @param string|null $serviceCode
Expand Down Expand Up @@ -185,8 +193,7 @@ public function combinePayment(Combinable $combinablePayment)
{
$this->combinablePayment = $combinablePayment;

$payload_data = array_filter($combinablePayment->request->data(), function ($key)
{
$payload_data = array_filter($combinablePayment->request->data(), function ($key) {
return ! in_array($key, ['Services']);
}, ARRAY_FILTER_USE_KEY);

Expand Down
2 changes: 1 addition & 1 deletion src/PaymentMethods/Subscriptions/Models/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,4 @@ class Configuration extends ServiceParameter
* @var bool
*/
protected bool $skipPayPerEmail;
}
}
2 changes: 1 addition & 1 deletion src/PaymentMethods/Subscriptions/Models/RatePlanCharge.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,4 +74,4 @@ class RatePlanCharge extends ServiceParameter
* @var string
*/
protected string $ratePlanChargeType;
}
}
2 changes: 1 addition & 1 deletion src/PaymentMethods/Subscriptions/Models/Subscription.php
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ class Subscription extends ServiceParameter
'groupType' => 'AddRatePlan',
],
'configuration' => [
'groupType' => 'AddConfiguration'
'groupType' => 'AddConfiguration',
],
'updateRatePlan' => [
'groupType' => 'UpdateRatePlan',
Expand Down
Loading

0 comments on commit 94bb8e3

Please sign in to comment.