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

1.10.0 #160

Merged
merged 84 commits into from
Dec 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
84 commits
Select commit Hold shift + click to select a range
955a13a
Request To Pay Payment method removed (#77)
ShuCh3n Feb 2, 2023
9dd7662
Fixed an issue with getting issuers for iDeal (#78)
reflie-nxte Feb 7, 2023
8587f8f
Adding missing subscriptions parameters (#79)
ShuCh3n Feb 9, 2023
593041b
Bancontact update & fixes (#80)
ShuCh3n Feb 9, 2023
6ab62c0
Return null when response data is not set (#81)
ShuCh3n Feb 15, 2023
4a0276c
BP-2345 add return and push url in the i deal qr request in the php s…
ShuCh3n Feb 21, 2023
eaad599
1.3.1
ShuCh3n Feb 21, 2023
3c11eaf
Changing the version
ShuCh3n Feb 21, 2023
5a9e46b
Merge branch 'master' into develop
ShuCh3n Feb 21, 2023
353ee21
Merge conflict
ShuCh3n Feb 21, 2023
1c5523d
Update changelog
ShuCh3n Feb 21, 2023
5103252
Update changelog
ShuCh3n Feb 21, 2023
79e0e55
Return string instead of int in subcode code (#88)
ShuCh3n Feb 23, 2023
ad8b3c5
[Bugfixes] outdated subscription example (#90)
ShuCh3n Feb 24, 2023
831c158
GitHub/action psr12 and phplint validation (#92)
avido Mar 2, 2023
af834dc
Update ideal qr test (#94)
ShuCh3n Mar 13, 2023
e6fa220
BP-2404 Feature/8.2 support (#95)
ShuCh3n Mar 23, 2023
cd9f4c4
Release 1.5.0 (#97)
ShuCh3n Mar 23, 2023
d3ef257
BP-2441 Added support for transaction requests without specifying a s…
SandervdHulst Apr 7, 2023
5bf7acc
Update Transaction Comment (#103)
Muneeb60coder Apr 7, 2023
0b1871a
created new PayablePaymentMethod for when no service is specified
vegimcarkaxhija Apr 12, 2023
8ed0bdc
fix style
vegimcarkaxhija Apr 12, 2023
9db28b9
Minor fixes
ShuCh3n Apr 12, 2023
dee3b3d
Merge branch 'hotfix/PaymentMethod_setServiceList' into hotfix/Improv…
ShuCh3n Apr 12, 2023
be8e919
update phpdoc, and fix Line exceeds 120 characters
vegimcarkaxhija Apr 12, 2023
4e67787
Remove method paynoservice
ShuCh3n Apr 12, 2023
48e3408
Merge branch 'hotfix/ImprovementsNoServicePayment' into hotfix/Paymen…
ShuCh3n Apr 12, 2023
b401e6b
Merge pull request #104 from buckaroo-it/hotfix/PaymentMethod_setServ…
vegimcarkaxhija Apr 12, 2023
699a9bc
Merge branch 'master' into develop
ShuCh3n Apr 14, 2023
8758d53
Inlcude monolog version 3
ShuCh3n Apr 14, 2023
6871cab
Include ramsey version 4
ShuCh3n Apr 14, 2023
786fa98
Merge branch 'master' into feature/BP-2527
ShuCh3n Apr 26, 2023
5ea6d83
Add missing property
ShuCh3n Apr 28, 2023
a8d4002
Merge pull request #108 from buckaroo-it/bugfix/missing-property
LucianTuriacArnia Apr 28, 2023
a6763d7
Add PayRemainder in KlarnaPay (#112)
LucianTuriacArnia May 16, 2023
07e0c70
Pay remainder missing for some methods (#113)
LucianTuriacArnia May 23, 2023
91426e3
BP-2509 Add Instant refunds,no service payment refactor (#109)
Rinor12010 May 23, 2023
c6c0765
BP-2527 Batch functionality (#114)
ShuCh3n May 23, 2023
405ee48
V1.6.0
ShuCh3n May 23, 2023
f3b21df
BP-2511 Removed Ippies (#117)
SandervdHulst May 26, 2023
6ae9189
BP-2417 Added Thunes (#111)
SandervdHulst May 26, 2023
667eb39
BP-2543 - Add (Bancontact) Deferred Sales (#116)
ShuCh3n May 31, 2023
cc98799
BP-2617 - Allow CustomParameters (#118)
ShuCh3n May 31, 2023
76ccd36
Bugfix/addition parameter (#119)
ShuCh3n Jun 15, 2023
c3ee4c2
Retain float in json_encode (#121)
ShuCh3n Jun 19, 2023
60266b8
Version change
ShuCh3n Jun 19, 2023
62e7730
BP-2507 Add Payment initiation (#110)
Rinor12010 Jun 20, 2023
2af90ef
Add missing shipping cost to refund in afterpay (#124)
ShuCh3n Jun 20, 2023
6a5be58
Bp 2688 update readme file (#125)
Buckaroo-Rene Jun 21, 2023
a0feca4
BP-2461 - Add the correct ModuleVersion and PlatformName (#120)
ShuCh3n Jun 21, 2023
5e00369
BP-2650 - Culture was not working correctly (#126)
SandervdHulst Jun 26, 2023
8e3ddc9
Prepare v1.7.0
ShuCh3n Jun 27, 2023
3955511
Merge branch 'master' into develop
ShuCh3n Jun 27, 2023
ef80095
Merge conflict resolved
ShuCh3n Jun 27, 2023
1791528
Remove head merge conflict
ShuCh3n Jun 27, 2023
2749d55
Comment removal
ShuCh3n Jun 27, 2023
a2bbb2c
Comment removal
ShuCh3n Jun 27, 2023
ed29924
Add pay by bank example (#128)
ShuCh3n Jul 6, 2023
bd12c3e
Merge branch 'master' into develop
ShuCh3n Jul 12, 2023
7204cc3
BP-2797 Add possibility to change Channel header (#134)
SandervdHulst Aug 10, 2023
e8654fb
Features/in3new (#138)
SandervdHulst Aug 30, 2023
7a08354
Prepare release 1.8.0
ShuCh3n Aug 30, 2023
ab7d7bc
Merge branch 'master' into develop
ShuCh3n Aug 30, 2023
69a4d2f
BP-2873
Rinor12010 Sep 5, 2023
20fd724
Merge pull request #140 from buckaroo-it/BP-2873-add-email-and-lastna…
Rinor12010 Sep 6, 2023
3755554
BP-2912 rename IDin to iDin (#145)
SandervdHulst Oct 13, 2023
eefdf3e
BP-3034 Add payment method "MB WAY" (#147)
harli91 Oct 20, 2023
568ff22
BP-3020 Add payment method "Multibanco" (#148)
harli91 Oct 20, 2023
344d7fd
Add GitHub action file
Rinor12010 Oct 25, 2023
bb0c4b8
Merge pull request #150 from buckaroo-it/sonarqube
Rinor12010 Oct 25, 2023
96c957b
Phone number fixes (#144)
LucianTuriacArnia Nov 13, 2023
8885205
add method to get issuers for PayByBank (#152)
vildanbina Nov 13, 2023
3dde3e0
BP-3009 Resolve SonarQube bugs and update README.md (#151)
SandervdHulst Nov 15, 2023
1512e7b
1.9.0 (#154)
ShuCh3n Nov 15, 2023
2911ab8
Merge branch 'master' into develop
ShuCh3n Nov 15, 2023
3d3c2c7
Merge conflict
ShuCh3n Nov 15, 2023
2edf890
created a Factory to determine which guzzlehttp version is used
vegimcarkaxhija Nov 23, 2023
2f6d960
fix
vegimcarkaxhija Nov 23, 2023
f8271d3
BP-3189-add-get-active-subscription-to-retrieve-all-buckaroo-subscrip…
harli91 Nov 28, 2023
eb6ff94
BP-3179 Add support for "External Payments" (#158)
harli91 Dec 5, 2023
f270a86
Merge pull request #159 from buckaroo-it/add-support-for-guzzlehttp-v5
vegimcarkaxhija Dec 18, 2023
55dec4f
Prepare release 1.9.1
ShuCh3n Dec 18, 2023
0092be9
Merge branch 'master' into develop
ShuCh3n Dec 18, 2023
e4b3744
1.9.1
ShuCh3n Dec 18, 2023
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
2 changes: 1 addition & 1 deletion 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.9.0",
"version": "1.9.1",
"type": "library",
"require": {
"php": ">=7.4|^8.0",
Expand Down
17 changes: 17 additions & 0 deletions example/additional_services/getActiveSubscriptions.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?php

require_once __DIR__ . '/../bootstrap.php';

use Buckaroo\BuckarooClient;

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

try {
foreach ($buckaroo->getActiveSubscriptions() as $subscription) {
$availableCurrencies = implode(",", $subscription['currencies']);
echo "serviceCode: " . $subscription['serviceCode'] . "\n";
echo "- available currencies: " . $availableCurrencies . "\n";
}
} catch (\Throwable $th) {
var_dump($th);
}
19 changes: 19 additions & 0 deletions example/transactions/externalPayment.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php

require_once __DIR__.'/../bootstrap.php';

use Buckaroo\BuckarooClient;

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

$response = $buckaroo->method('externalPayment')->pay([
'invoice' => uniqid(),
'amountDebit' => 10.10,
'channel' => 'BackOffice'
]);

$buckaroo->method('externalPayment')->refund([
'amountCredit' => 10,
'invoice' => 'testinvoice 123',
'originalTransactionKey' => $response->getTransactionKey(),
]);
7 changes: 7 additions & 0 deletions src/BuckarooClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
use Buckaroo\Handlers\Logging\Observer as LoggingObserver;
use Buckaroo\PaymentMethods\BatchTransactions;
use Buckaroo\PaymentMethods\PaymentFacade;
use Buckaroo\Services\ActiveSubscriptions;
use Buckaroo\Services\TransactionService;
use Buckaroo\Transaction\Client;

Expand Down Expand Up @@ -73,6 +74,12 @@ public function method(string $method = null): PaymentFacade
return new PaymentFacade($this->client, $method);
}


public function getActiveSubscriptions(): array
{
return (new ActiveSubscriptions($this->client))->get();
}

/**
* @param array $transactions
* @return BatchTransactions
Expand Down
30 changes: 30 additions & 0 deletions src/PaymentMethods/ExternalPayment/ExternalPayment.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\ExternalPayment;

use Buckaroo\PaymentMethods\PayablePaymentMethod;

class ExternalPayment extends PayablePaymentMethod
{
protected string $paymentName = 'ExternalPayment';
}
68 changes: 35 additions & 33 deletions src/PaymentMethods/PaymentMethodFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,51 +20,52 @@

namespace Buckaroo\PaymentMethods;

use Buckaroo\Transaction\Client;
use Buckaroo\PaymentMethods\EPS\EPS;
use Buckaroo\PaymentMethods\In3\In3;
use Buckaroo\PaymentMethods\KBC\KBC;
use Buckaroo\PaymentMethods\iDin\iDin;
use Buckaroo\PaymentMethods\SEPA\SEPA;
use Buckaroo\PaymentMethods\iDeal\iDeal;
use Buckaroo\PaymentMethods\MBWay\MBWay;
use Buckaroo\PaymentMethods\Tinka\Tinka;
use Buckaroo\Exceptions\BuckarooException;
use Buckaroo\PaymentMethods\Afterpay\Afterpay;
use Buckaroo\PaymentMethods\AfterpayDigiAccept\AfterpayDigiAccept;
use Buckaroo\PaymentMethods\Alipay\Alipay;
use Buckaroo\PaymentMethods\ApplePay\ApplePay;
use Buckaroo\PaymentMethods\Bancontact\Bancontact;
use Buckaroo\PaymentMethods\BankTransfer\BankTransfer;
use Buckaroo\PaymentMethods\In3Old\In3Old;
use Buckaroo\PaymentMethods\Paypal\Paypal;
use Buckaroo\PaymentMethods\Sofort\Sofort;
use Buckaroo\PaymentMethods\Thunes\Thunes;
use Buckaroo\PaymentMethods\Belfius\Belfius;
use Buckaroo\PaymentMethods\Billink\Billink;
use Buckaroo\PaymentMethods\BuckarooVoucher\BuckarooVoucher;
use Buckaroo\PaymentMethods\BuckarooWallet\BuckarooWallet;
use Buckaroo\PaymentMethods\CreditCard\CreditCard;
use Buckaroo\PaymentMethods\CreditClick\CreditClick;
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;
use Buckaroo\PaymentMethods\iDealQR\iDealQR;
use Buckaroo\PaymentMethods\iDin\iDin;
use Buckaroo\PaymentMethods\In3\In3;
use Buckaroo\PaymentMethods\In3Old\In3Old;
use Buckaroo\PaymentMethods\KBC\KBC;
use Buckaroo\PaymentMethods\Surepay\Surepay;
use Buckaroo\PaymentMethods\Trustly\Trustly;
use Buckaroo\PaymentMethods\Afterpay\Afterpay;
use Buckaroo\PaymentMethods\ApplePay\ApplePay;
use Buckaroo\PaymentMethods\GiftCard\GiftCard;
use Buckaroo\PaymentMethods\KlarnaKP\KlarnaKP;
use Buckaroo\PaymentMethods\Payconiq\Payconiq;
use Buckaroo\PaymentMethods\Emandates\Emandates;
use Buckaroo\PaymentMethods\KlarnaPay\KlarnaPay;
use Buckaroo\PaymentMethods\Marketplaces\Marketplaces;
use Buckaroo\PaymentMethods\WeChatPay\WeChatPay;
use Buckaroo\PaymentMethods\Bancontact\Bancontact;
use Buckaroo\PaymentMethods\CreditCard\CreditCard;
use Buckaroo\PaymentMethods\Multibanco\Multibanco;
use Buckaroo\PaymentMethods\NoServiceSpecifiedPayment\NoServiceSpecifiedPayment;
use Buckaroo\PaymentMethods\Payconiq\Payconiq;
use Buckaroo\PaymentMethods\PaymentInitiation\PaymentInitiation;
use Buckaroo\PaymentMethods\Paypal\Paypal;
use Buckaroo\PaymentMethods\Przelewy24\Przelewy24;
use Buckaroo\PaymentMethods\CreditClick\CreditClick;
use Buckaroo\PaymentMethods\PayPerEmail\PayPerEmail;
use Buckaroo\PaymentMethods\PointOfSale\PointOfSale;
use Buckaroo\PaymentMethods\Przelewy24\Przelewy24;
use Buckaroo\PaymentMethods\SEPA\SEPA;
use Buckaroo\PaymentMethods\Sofort\Sofort;
use Buckaroo\PaymentMethods\BankTransfer\BankTransfer;
use Buckaroo\PaymentMethods\Marketplaces\Marketplaces;
use Buckaroo\PaymentMethods\Subscriptions\Subscriptions;
use Buckaroo\PaymentMethods\Surepay\Surepay;
use Buckaroo\PaymentMethods\Thunes\Thunes;
use Buckaroo\PaymentMethods\Tinka\Tinka;
use Buckaroo\PaymentMethods\Trustly\Trustly;
use Buckaroo\PaymentMethods\WeChatPay\WeChatPay;
use Buckaroo\Transaction\Client;
use Buckaroo\PaymentMethods\BuckarooWallet\BuckarooWallet;
use Buckaroo\PaymentMethods\BuckarooVoucher\BuckarooVoucher;
use Buckaroo\PaymentMethods\ExternalPayment\ExternalPayment;
use Buckaroo\PaymentMethods\CreditManagement\CreditManagement;
use Buckaroo\PaymentMethods\PaymentInitiation\PaymentInitiation;
use Buckaroo\PaymentMethods\AfterpayDigiAccept\AfterpayDigiAccept;
use Buckaroo\PaymentMethods\NoServiceSpecifiedPayment\NoServiceSpecifiedPayment;

class PaymentMethodFactory
{
Expand Down Expand Up @@ -107,6 +108,7 @@ class PaymentMethodFactory
PayPerEmail::class => ['payperemail'],
PaymentInitiation::class => ['paymentinitiation','paybybank'],
EPS::class => ['eps'],
ExternalPayment::class => ['externalpayment'],
Emandates::class => ['emandates'],
Sofort::class => ['sofort', 'sofortueberweisung'],
Tinka::class => ['tinka'],
Expand Down
120 changes: 120 additions & 0 deletions src/Services/ActiveSubscriptions.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,120 @@
<?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 Buckaroo\Services;

use Exception;
use SimpleXMLElement;
use Buckaroo\Models\ServiceList;
use Buckaroo\Transaction\Client;
use Buckaroo\Transaction\Request\TransactionRequest;

class ActiveSubscriptions
{

private const SERVICE_CODE_AND_ACTION = 'GetActiveSubscriptions';

private const VERSION_ZERO = 0;

private const SERVICE_PARAM_KEY = 'activesubscriptions';

private Client $client;

public function __construct(Client $client)
{
$this->client = $client;
}

public function get(): array
{
try {
$xmlString = $this->client
->dataRequest($this->buildTransaction())
->getServiceParameters()[self::SERVICE_PARAM_KEY] ?? null;

if (!is_string($xmlString)) {
return [];
}

$xml = new SimpleXMLElement($xmlString, LIBXML_NOCDATA);

return $this->format(
$xml->xpath('/ArrayOfServiceCurrencies/ServiceCurrencies')
);
} catch (Exception $e) {
return [];
}
}

private function buildTransaction(): TransactionRequest
{
$transaction = new TransactionRequest();

$transaction
->getServices()
->pushServiceList(
new ServiceList(
self::SERVICE_CODE_AND_ACTION,
self::VERSION_ZERO,
self::SERVICE_CODE_AND_ACTION
)
);
return $transaction;
}

private function format($data): array
{
$decoded = json_decode(json_encode($data), true);
if (!is_array($decoded)) {
return [];
}

$formated = [];
foreach ($decoded as $subscription) {
$formatedSubscription = [];
foreach ($subscription as $key => $subscriptionData) {
$camelKey = lcfirst($key);
$formatedSubscription[$camelKey] = $this->formatValue($camelKey, $subscriptionData);
}
$formated[] = $formatedSubscription;
}
return $formated;
}

/**
* Format value for currency
*
* @param string $key
* @param string|array $value
*
* @return string|array
*/
private function formatValue($key, $value)
{
if ($key === 'currencies') {
$value = $value["string"];
if (is_string($value)) {
$value = [$value];
}
}

return $value;
}
}
6 changes: 3 additions & 3 deletions src/Transaction/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
use Buckaroo\Services\TransactionHeaders\DefaultHeader;
use Buckaroo\Services\TransactionHeaders\HmacHeader;
use Buckaroo\Services\TransactionHeaders\SoftwareHeader;
use Buckaroo\Transaction\Request\HttpClient\HttpClientGuzzle;
use Buckaroo\Transaction\Request\HttpClient\HttpClientFactory;
use Buckaroo\Transaction\Request\HttpClient\HttpClientInterface;
use Buckaroo\Transaction\Request\Request;
use Buckaroo\Transaction\Response\Response;
Expand All @@ -43,7 +43,7 @@ class Client
private const METHOD_POST = 'POST';

/**
* @var HttpClientInterface|HttpClientGuzzle
* @var HttpClientInterface
*/
protected HttpClientInterface $httpClient;
/**
Expand All @@ -61,7 +61,7 @@ class Client
public function __construct(?Config $config)
{
$this->config = $config;
$this->httpClient = new HttpClientGuzzle($config->getLogger());
$this->httpClient = HttpClientFactory::createClient($config->getLogger());
}

/**
Expand Down
Loading