diff --git a/.github/workflows/codestyle.yml b/.github/workflows/codestyle.yml index 1ed3389e..ea849d3b 100644 --- a/.github/workflows/codestyle.yml +++ b/.github/workflows/codestyle.yml @@ -2,9 +2,6 @@ name: Code Style on: pull_request: - branches: - - master - - develop jobs: php-cs-fixer: runs-on: ubuntu-latest diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 4e63db77..84c84bcb 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -2,9 +2,6 @@ name: Tests on: pull_request: - branches: - - master - - develop jobs: tests: runs-on: ubuntu-latest diff --git a/example/additional_services/voucher.php b/example/additional_services/voucher.php index 0b9eb6c0..86e51c6e 100644 --- a/example/additional_services/voucher.php +++ b/example/additional_services/voucher.php @@ -6,7 +6,6 @@ $buckaroo = new BuckarooClient($_ENV['BPE_WEBSITE_KEY'], $_ENV['BPE_SECRET_KEY']); - //Create voucher $response = $buckaroo->method('buckaroovoucher')->create( [ @@ -26,7 +25,6 @@ ] ); - //Pay $response = $buckaroo->method('buckaroovoucher')->payRemainder( [ @@ -37,7 +35,6 @@ ] ); - //Refund $response = $buckaroo->method('buckaroovoucher')->refund( [ diff --git a/example/responses/push.php b/example/responses/push.php index 6158bd15..a71e30a4 100644 --- a/example/responses/push.php +++ b/example/responses/push.php @@ -38,7 +38,6 @@ $reply_handler->isValid(); // Return either true or false //END HTTP POST PUSH - //START JSON PUSH $auth_header = 'IBjihN7Fhp:0YvyjYAzDQ28W+hQi80f2nhe0Z1QFJLbz7IH//6LsAU=:cad1832100784f57a6e6de835d9f3638:1658227572'; $post_data = '{"Transaction":{"Key":"5340604668D74435AA344E1428ED1292","Invoice":"62d68b6c8ab0c","ServiceCode":"ideal", diff --git a/example/transactions/applepay_redirect.php b/example/transactions/applepay_redirect.php index a7ddea61..4fffab0c 100644 --- a/example/transactions/applepay_redirect.php +++ b/example/transactions/applepay_redirect.php @@ -15,7 +15,6 @@ 'continueOnIncomplete' => '1', ]); - //Refund $response = $buckaroo->method('applepay')->refund([ 'amountCredit' => 10, diff --git a/example/transactions/bancontact.php b/example/transactions/bancontact.php index 3cee7153..1855d365 100644 --- a/example/transactions/bancontact.php +++ b/example/transactions/bancontact.php @@ -35,7 +35,6 @@ 'originalTransactionKey' => '91D08EC01F414926A4CA29C059XXXXXX', ]); - //Refund $response = $buckaroo->method('bancontactmrcash')->refund([ 'invoice' => '', //Set invoice number of the transaction to refund diff --git a/example/transactions/billink.php b/example/transactions/billink.php index 38b11e24..2b50613c 100644 --- a/example/transactions/billink.php +++ b/example/transactions/billink.php @@ -78,7 +78,6 @@ ], ]); - //Refund $response = $buckaroo->method('billink')->refund([ 'amountCredit' => 10, diff --git a/example/transactions/bizum.php b/example/transactions/bizum.php index e156731c..2fa6c4e3 100644 --- a/example/transactions/bizum.php +++ b/example/transactions/bizum.php @@ -19,4 +19,4 @@ 'amountCredit' => 10, 'invoice' => 'testinvoice 123', 'originalTransactionKey' => '4E8BD922192746C3918BF4077CXXXXXX', -]); \ No newline at end of file +]); diff --git a/example/transactions/blik.php b/example/transactions/blik.php index d0b81a11..f30ba054 100644 --- a/example/transactions/blik.php +++ b/example/transactions/blik.php @@ -9,9 +9,9 @@ //Also accepts json //Pay $response = $buckaroo->method('blik')->pay([ - 'currency' => 'PLN', - 'amountDebit' => 10.00, - 'invoice' => 'Blik Test Plugins Example', - 'description' => 'Blik Test Plugins Example', - 'email' => 'test@buckar00.nl' -]); \ No newline at end of file + 'currency' => 'PLN', + 'amountDebit' => 10.00, + 'invoice' => 'Blik Test Plugins Example', + 'description' => 'Blik Test Plugins Example', + 'email' => 'test@buckar00.nl', +]); diff --git a/example/transactions/clicktopay.php b/example/transactions/clicktopay.php index 01c4358b..42b668bb 100644 --- a/example/transactions/clicktopay.php +++ b/example/transactions/clicktopay.php @@ -14,7 +14,7 @@ 'description' => "test ClickToPay", "clientIP" => [ "type" => 0, - "address" => "0.0.0.0" + "address" => "0.0.0.0", ], 'continueOnIncomplete' => "1", ]); diff --git a/example/transactions/externalPayment.php b/example/transactions/externalPayment.php index 85a881fa..5f7776ca 100644 --- a/example/transactions/externalPayment.php +++ b/example/transactions/externalPayment.php @@ -9,11 +9,11 @@ $response = $buckaroo->method('externalPayment')->pay([ 'invoice' => uniqid(), 'amountDebit' => 10.10, - 'channel' => 'BackOffice' + 'channel' => 'BackOffice', ]); $buckaroo->method('externalPayment')->refund([ 'amountCredit' => 10, 'invoice' => 'testinvoice 123', 'originalTransactionKey' => $response->getTransactionKey(), -]); \ No newline at end of file +]); diff --git a/example/transactions/giftcards_redirect.php b/example/transactions/giftcards_redirect.php index 038a411c..87d0e437 100644 --- a/example/transactions/giftcards_redirect.php +++ b/example/transactions/giftcards_redirect.php @@ -18,7 +18,6 @@ 'continueOnIncomplete' => '1', ]); - //Refund $response = $buckaroo->method('giftcard')->refund([ 'amountCredit' => 10, diff --git a/example/transactions/in3-abn-amro-achteraf-betalen.php b/example/transactions/in3-abn-amro-achteraf-betalen.php index 3d40a9e0..d2d05c63 100644 --- a/example/transactions/in3-abn-amro-achteraf-betalen.php +++ b/example/transactions/in3-abn-amro-achteraf-betalen.php @@ -7,24 +7,24 @@ $buckaroo = new BuckarooClient($_ENV['BPE_WEBSITE_KEY'], $_ENV['BPE_SECRET_KEY']); $payload = [ - 'amountDebit' => 52.30, - 'description' => 'ABN AMRO Achteraf Betalen payment via In3', - 'order' => uniqid(), - 'invoice' => uniqid(), - 'clientIP' => '127.0.0.1', - 'route' => 'abn_b2b', // This parameter routes the In3 payment to ABN AMRO Achteraf Betalen - 'billing' => [ - 'recipient' => [ - 'category' => 'B2C', - 'initials' => 'J', - 'firstName' => 'John', - 'lastName' => 'Dona', - 'birthDate' => '1990-01-01', + 'amountDebit' => 52.30, + 'description' => 'ABN AMRO Achteraf Betalen payment via In3', + 'order' => uniqid(), + 'invoice' => uniqid(), + 'clientIP' => '127.0.0.1', + 'route' => 'abn_b2b', // This parameter routes the In3 payment to ABN AMRO Achteraf Betalen + 'billing' => [ + 'recipient' => [ + 'category' => 'B2C', + 'initials' => 'J', + 'firstName' => 'John', + 'lastName' => 'Dona', + 'birthDate' => '1990-01-01', 'customerNumber' => '12345', - 'phone' => '0612345678', - 'country' => 'NL', - 'companyName' => 'My Company B.V.', - 'chamberOfCommerce' => '123456' + 'phone' => '0612345678', + 'country' => 'NL', + 'companyName' => 'My Company B.V.', + 'chamberOfCommerce' => '123456', ], 'address' => [ 'street' => 'Hoofdstraat', @@ -45,7 +45,7 @@ 'careOf' => 'John Smith', 'firstName' => 'John', 'lastName' => 'Do', - 'chamberOfCommerce' => '123456' + 'chamberOfCommerce' => '123456', ], 'address' => [ 'street' => 'Kalverstraat', @@ -84,7 +84,7 @@ 'quantity' => '1', 'price' => '2', ], - ] + ], ]; //Also accepts json @@ -96,4 +96,4 @@ 'amountCredit' => 10, 'invoice' => '10000480', 'originalTransactionKey' => '9AA4C81A08A84FA7B68E6A6A6291XXXX', -]); \ No newline at end of file +]); diff --git a/example/transactions/in3.php b/example/transactions/in3.php index 1fdbddb2..5d90789b 100644 --- a/example/transactions/in3.php +++ b/example/transactions/in3.php @@ -7,23 +7,23 @@ $buckaroo = new BuckarooClient($_ENV['BPE_WEBSITE_KEY'], $_ENV['BPE_SECRET_KEY']); $payload = [ - 'amountDebit' => 52.30, - 'description' => 'in3 pay', - 'order' => uniqid(), - 'invoice' => uniqid(), - 'clientIP' => '127.0.0.1', - 'billing' => [ - 'recipient' => [ - 'category' => 'B2C', - 'initials' => 'J', - 'firstName' => 'John', - 'lastName' => 'Dona', - 'birthDate' => '1990-01-01', - 'customerNumber' => '12345', - 'phone' => '0612345678', - 'country' => 'NL', + 'amountDebit' => 52.30, + 'description' => 'in3 pay', + 'order' => uniqid(), + 'invoice' => uniqid(), + 'clientIP' => '127.0.0.1', + 'billing' => [ + 'recipient' => [ + 'category' => 'B2C', + 'initials' => 'J', + 'firstName' => 'John', + 'lastName' => 'Dona', + 'birthDate' => '1990-01-01', + 'customerNumber' => '12345', + 'phone' => '0612345678', + 'country' => 'NL', 'companyName' => 'My Company B.V.', - 'chamberOfCommerce' => '123456' + 'chamberOfCommerce' => '123456', ], 'address' => [ 'street' => 'Hoofdstraat', @@ -44,7 +44,7 @@ 'careOf' => 'John Smith', 'firstName' => 'John', 'lastName' => 'Do', - 'chamberOfCommerce' => '123456' + 'chamberOfCommerce' => '123456', ], 'address' => [ 'street' => 'Kalverstraat', @@ -83,7 +83,7 @@ 'quantity' => '1', 'price' => '2', ], - ] + ], ]; //Also accepts json diff --git a/example/transactions/kbc.php b/example/transactions/kbc.php index 1f6ef22b..b545ca32 100644 --- a/example/transactions/kbc.php +++ b/example/transactions/kbc.php @@ -13,7 +13,6 @@ 'amountDebit' => 10.10, ]); - //Refund $response = $buckaroo->method('kbcpaymentbutton')->refund([ 'invoice' => '', //Set invoice number of the transaction to refund diff --git a/example/transactions/noservicespecified.php b/example/transactions/noservicespecified.php index 31f2c3f5..e7d09535 100644 --- a/example/transactions/noservicespecified.php +++ b/example/transactions/noservicespecified.php @@ -18,7 +18,6 @@ 'continueOnIncomplete' => '1', ]); - //Refund $response = $buckaroo->method(null)->refund([ 'invoice' => '', //Set invoice number of the transaction to refund diff --git a/example/transactions/payment_initiation.php b/example/transactions/payment_initiation.php index c003e853..9b627e82 100644 --- a/example/transactions/payment_initiation.php +++ b/example/transactions/payment_initiation.php @@ -19,4 +19,4 @@ 'invoice' => '', //Set invoice number of the transaction to refund 'originalTransactionKey' => '', //Set transaction key of the transaction to refund 'amountCredit' => 10, -]); \ No newline at end of file +]); diff --git a/example/transactions/swish.php b/example/transactions/swish.php index 2c1ff995..a9d7737a 100644 --- a/example/transactions/swish.php +++ b/example/transactions/swish.php @@ -20,4 +20,4 @@ 'amountCredit' => 10, 'invoice' => 'testinvoice 123', 'originalTransactionKey' => '4E8BD922192746C3918BF4077CXXXXXX', -]); \ No newline at end of file +]); diff --git a/example/transactions/thunes.php b/example/transactions/thunes.php index 78d94847..574a0ad6 100644 --- a/example/transactions/thunes.php +++ b/example/transactions/thunes.php @@ -3,7 +3,6 @@ require_once '../bootstrap.php'; use Buckaroo\BuckarooClient; -use Buckaroo\Resources\Constants\RecipientCategory; $buckaroo = new BuckarooClient($_ENV['BPE_WEBSITE_KEY'], $_ENV['BPE_SECRET_KEY']); diff --git a/example/transactions/twint.php b/example/transactions/twint.php index 240ceca2..6b1fd429 100644 --- a/example/transactions/twint.php +++ b/example/transactions/twint.php @@ -20,4 +20,4 @@ 'amountCredit' => 10, 'invoice' => 'testinvoice 123', 'originalTransactionKey' => '4E8BD922192746C3918BF4077CXXXXXX', -]); \ No newline at end of file +]); diff --git a/example/transactions/wero.php b/example/transactions/wero.php index b8909940..d25da329 100644 --- a/example/transactions/wero.php +++ b/example/transactions/wero.php @@ -40,4 +40,4 @@ 'amountCredit' => 10, 'invoice' => 'testinvoice 123', 'originalTransactionKey' => '4E8BD922192746C3918BF4077CXXXXXX', -]); \ No newline at end of file +]); diff --git a/src/BuckarooClient.php b/src/BuckarooClient.php index 684f8419..c8a52f12 100644 --- a/src/BuckarooClient.php +++ b/src/BuckarooClient.php @@ -53,13 +53,11 @@ class BuckarooClient */ public function __construct($websiteKey, ?string $secretKey = null, ?string $mode = null) { - if ($websiteKey instanceof Config) - { + if ($websiteKey instanceof Config) { $this->config = $websiteKey; } - if (is_string($websiteKey)) - { + if (is_string($websiteKey)) { $this->config = $this->getConfig($websiteKey, $secretKey, $mode); } @@ -75,7 +73,6 @@ public function method(?string $method = null): PaymentFacade return new PaymentFacade($this->client, $method); } - public function getActiveSubscriptions(): array { return (new ActiveSubscriptions($this->client))->get(); @@ -148,8 +145,7 @@ public function client() */ private function getConfig(string $websiteKey, string $secretKey, ?string $mode = null): ?Config { - if ($websiteKey && $secretKey) - { + if ($websiteKey && $secretKey) { return new DefaultConfig($websiteKey, $secretKey, $mode); } diff --git a/src/Config/Config.php b/src/Config/Config.php index e8b3f38f..572454c3 100644 --- a/src/Config/Config.php +++ b/src/Config/Config.php @@ -197,8 +197,7 @@ public function isLiveMode(): bool */ public function mode(?string $mode = null): string { - if ($mode && in_array($mode, [self::LIVE_MODE, self::TEST_MODE])) - { + if ($mode && in_array($mode, [self::LIVE_MODE, self::TEST_MODE])) { $this->mode = $mode; } @@ -282,8 +281,7 @@ public function moduleVersion(): string */ public function culture(): string { - if (! empty($this->culture)) - { + if (!empty($this->culture)) { return $this->culture; } @@ -295,10 +293,10 @@ public function culture(): string */ public function channel(): string { - if (! empty($this->channel)) - { + if (!empty($this->channel)) { return $this->channel; } + return 'Web'; } @@ -310,10 +308,8 @@ public function merge(array $payload) { $payload = $this->filterNonUpdatableKeys($payload); - foreach ($payload as $key => $value) - { - if (property_exists($this, $key)) - { + foreach ($payload as $key => $value) { + if (property_exists($this, $key)) { $this->$key = $value; } } @@ -330,7 +326,7 @@ private function filterNonUpdatableKeys($payload) $filter = ['websiteKey', 'secretKey']; return array_filter($payload, function ($k) use ($filter) { - return ! in_array($k, $filter); + return !in_array($k, $filter); }, ARRAY_FILTER_USE_KEY); } @@ -342,10 +338,8 @@ public function get(array $properties = []) { $values = []; - foreach ($properties as $property) - { - if (method_exists($this, $property)) - { + foreach ($properties as $property) { + if (method_exists($this, $property)) { $values[$property] = $this->$property(); } } diff --git a/src/Exceptions/BuckarooException.php b/src/Exceptions/BuckarooException.php index 9b40638d..9d28464c 100644 --- a/src/Exceptions/BuckarooException.php +++ b/src/Exceptions/BuckarooException.php @@ -51,8 +51,7 @@ public function __construct(?Subject $logger, string $message = "", int $code = */ private function log($logger, $message) { - if ($logger) - { + if ($logger) { $this->logger = $logger; $this->logger->error($message); } diff --git a/src/Handlers/Credentials.php b/src/Handlers/Credentials.php index 5fd81fe5..e367e667 100644 --- a/src/Handlers/Credentials.php +++ b/src/Handlers/Credentials.php @@ -58,16 +58,13 @@ public function confirm(): bool $request = new TransactionRequest; - try - { + try { $response = $this->client->specification('ideal', 2, $request); - } catch (BuckarooException $e) - { + } catch (BuckarooException $e) { return false; } - if ($response->getHttpResponse()->getStatusCode() == 200) - { + if ($response->getHttpResponse()->getStatusCode() == 200) { return true; } diff --git a/src/Handlers/HMAC/Hmac.php b/src/Handlers/HMAC/Hmac.php index 09d16362..ed003316 100644 --- a/src/Handlers/HMAC/Hmac.php +++ b/src/Handlers/HMAC/Hmac.php @@ -28,8 +28,7 @@ abstract class Hmac */ public function uri($uri = null) { - if ($uri) - { + if ($uri) { $uri = preg_replace("#^[^:/.]*[:/]+#i", "", $uri); $this->uri = strtolower(urlencode($uri)); @@ -46,10 +45,8 @@ public function base64Data($data = null) { $this->base64Data = ''; - if ($data) - { - if (is_array($data)) - { + if ($data) { + if (is_array($data)) { $data = mb_convert_encoding( json_encode($data, JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE | JSON_PRESERVE_ZERO_FRACTION), 'UTF-8', @@ -71,8 +68,7 @@ public function base64Data($data = null) */ public function nonce($nonce = null) { - if ($nonce) - { + if ($nonce) { $this->nonce = $nonce; } @@ -85,8 +81,7 @@ public function nonce($nonce = null) */ public function time($time = null) { - if ($time) - { + if ($time) { $this->time = $time; } diff --git a/src/Handlers/HMAC/Validator.php b/src/Handlers/HMAC/Validator.php index b3efd00b..2a60731c 100644 --- a/src/Handlers/HMAC/Validator.php +++ b/src/Handlers/HMAC/Validator.php @@ -95,8 +95,7 @@ public function validate(string $header, string $uri, string $method, $data) */ public function validateOrFail(string $header, string $uri, string $method, $data) { - if ($this->validate($header, $uri, $method, $data)) - { + if ($this->validate($header, $uri, $method, $data)) { return true; } diff --git a/src/Handlers/Logging/DefaultLogger.php b/src/Handlers/Logging/DefaultLogger.php index a0b4fccc..11c53d7b 100644 --- a/src/Handlers/Logging/DefaultLogger.php +++ b/src/Handlers/Logging/DefaultLogger.php @@ -37,13 +37,11 @@ class DefaultLogger implements Subject, LoggerInterface */ public function __construct() { - if (($_ENV['BPE_LOG'] ?? false) === 'true') - { + if (($_ENV['BPE_LOG'] ?? false) === 'true') { $this->attach(new Monolog()); } - if (($_ENV['BPE_REPORT_ERROR'] ?? false) === 'true') - { + if (($_ENV['BPE_REPORT_ERROR'] ?? false) === 'true') { $this->attach(new ErrorReporter()); } } @@ -54,18 +52,15 @@ public function __construct() */ public function attach($observer) { - if (is_array($observer)) - { - foreach ($observer as $singleObserver) - { + if (is_array($observer)) { + foreach ($observer as $singleObserver) { $this->attach($singleObserver); } return $this; } - if ($observer instanceof Observer) - { + if ($observer instanceof Observer) { $this->observers[] = $observer; } @@ -162,8 +157,7 @@ public function info($message, array $context = []): void */ public function debug($message, array $context = []): void { - if ($_ENV['BPE_DEBUG'] ?? false) - { + if ($_ENV['BPE_DEBUG'] ?? false) { $this->notify('debug', $message, $context); } } @@ -187,8 +181,7 @@ public function log($level, $message, array $context = []): void */ public function notify(string $method, string $message, array $context = []) { - foreach ($this->observers as $observer) - { + foreach ($this->observers as $observer) { $observer->handle($method, $message, $context); } diff --git a/src/Handlers/Logging/Observers/ErrorReporter.php b/src/Handlers/Logging/Observers/ErrorReporter.php index b98a7575..177cf820 100644 --- a/src/Handlers/Logging/Observers/ErrorReporter.php +++ b/src/Handlers/Logging/Observers/ErrorReporter.php @@ -14,8 +14,7 @@ class ErrorReporter implements Observer public function handle(string $method, string $message, array $context = []) { - if (in_array($method, $this->reportables)) - { + if (in_array($method, $this->reportables)) { //print("Fire off message to mail/report server/slack"); } diff --git a/src/Handlers/Reply/ReplyHandler.php b/src/Handlers/Reply/ReplyHandler.php index 6c862ad3..1cde9e24 100644 --- a/src/Handlers/Reply/ReplyHandler.php +++ b/src/Handlers/Reply/ReplyHandler.php @@ -87,23 +87,20 @@ private function setStrategy() { $data = $this->data; - if (is_string($data)) - { + if (is_string($data)) { $data = json_decode($data, true); } if (($this->contains('Transaction', $data) || $this->contains('DataRequest', $data)) && $this->auth_header && $this->uri - ) - { + ) { $this->strategy = new Json($this->config, $data, $this->auth_header, $this->uri); return $this; } - if ($this->contains('brq_', $data) || $this->contains('BRQ_', $data)) - { + if ($this->contains('brq_', $data) || $this->contains('BRQ_', $data)) { $this->strategy = new HttpPost($this->config, $data); return $this; @@ -119,15 +116,12 @@ private function setStrategy() */ private function contains(string $needle, array $data, bool $strict = false): bool { - foreach (array_keys($data) as $key) - { - if ($strict && $key == $needle) - { + foreach (array_keys($data) as $key) { + if ($strict && $key == $needle) { return true; } - if (! $strict && strpos($key, $needle) !== false) - { + if (!$strict && strpos($key, $needle) !== false) { return true; } } @@ -148,8 +142,7 @@ public function isValid() */ public function data($key = null) { - if ($key) - { + if ($key) { return $this->data[$key] ?? $this->data[strtolower($key)] ?? $this->data[strtoupper($key)] ?? null; } diff --git a/src/Models/Adapters/ServiceParametersKeysAdapter.php b/src/Models/Adapters/ServiceParametersKeysAdapter.php index 46c13e82..67c07d46 100644 --- a/src/Models/Adapters/ServiceParametersKeysAdapter.php +++ b/src/Models/Adapters/ServiceParametersKeysAdapter.php @@ -52,8 +52,7 @@ public function __construct(Model $model) */ public function __get($property) { - if (property_exists($this->model, $property)) - { + if (property_exists($this->model, $property)) { return $this->model->$property; } diff --git a/src/Models/AdditionalParameters.php b/src/Models/AdditionalParameters.php index 5d45265c..79b8c740 100644 --- a/src/Models/AdditionalParameters.php +++ b/src/Models/AdditionalParameters.php @@ -53,10 +53,8 @@ public function __construct(?array $values = null, $isDataRequest = false) */ public function setProperties(?array $data) { - foreach ($data ?? [] as $name => $value) - { - if($this->isDataRequest) - { + foreach ($data ?? [] as $name => $value) { + if ($this->isDataRequest) { $this->List[] = [ 'Value' => $value, 'Name' => $name, diff --git a/src/Models/ClientIP.php b/src/Models/ClientIP.php index 13818dcb..80c6423e 100644 --- a/src/Models/ClientIP.php +++ b/src/Models/ClientIP.php @@ -72,8 +72,7 @@ private function getRemoteIp() /** * Get the forwarded IP if it exists */ - if (isset($headers['X-Forwarded-For']) && filter_var($headers['X-Forwarded-For'], FILTER_VALIDATE_IP)) - { + if (isset($headers['X-Forwarded-For']) && filter_var($headers['X-Forwarded-For'], FILTER_VALIDATE_IP)) { return $headers['X-Forwarded-For']; } @@ -83,8 +82,7 @@ private function getRemoteIp() return $headers['HTTP_X_FORWARDED_FOR']; } - if (isset($_SERVER['REMOTE_ADDR']) && filter_var($_SERVER['REMOTE_ADDR'], FILTER_VALIDATE_IP)) - { + if (isset($_SERVER['REMOTE_ADDR']) && filter_var($_SERVER['REMOTE_ADDR'], FILTER_VALIDATE_IP)) { return $_SERVER['REMOTE_ADDR']; } diff --git a/src/Models/CustomParameters.php b/src/Models/CustomParameters.php index e33ee075..dfd2a8eb 100644 --- a/src/Models/CustomParameters.php +++ b/src/Models/CustomParameters.php @@ -33,8 +33,7 @@ class CustomParameters extends Model */ public function setProperties(?array $data) { - foreach ($data ?? [] as $name => $value) - { + foreach ($data ?? [] as $name => $value) { $this->List[] = [ 'Value' => $value, 'Name' => $name, diff --git a/src/Models/Model.php b/src/Models/Model.php index 16f2b799..4f35bee2 100644 --- a/src/Models/Model.php +++ b/src/Models/Model.php @@ -38,8 +38,7 @@ public function __construct(?array $values = null) */ public function __get($property) { - if (property_exists($this, $property) && isset($this->$property)) - { + if (property_exists($this, $property) && isset($this->$property)) { return $this->$property; } @@ -53,8 +52,7 @@ public function __get($property) */ public function __set($property, $value) { - if (property_exists($this, $property)) - { + if (property_exists($this, $property)) { $this->$property = $value; } @@ -75,10 +73,8 @@ public function getObjectVars() */ public function setProperties(?array $data) { - if ($data) - { - foreach ($data ?? [] as $property => $value) - { + if ($data) { + foreach ($data ?? [] as $property => $value) { $this->$property = $value; } } @@ -109,15 +105,12 @@ public function toArray() : array */ private function recursiveToArray(array $array) : array { - foreach ($array as $key => $value) - { - if (is_array($value)) - { + foreach ($array as $key => $value) { + if (is_array($value)) { $array[$key] = $this->recursiveToArray($value); } - if (is_a($value, Arrayable::class)) - { + if (is_a($value, Arrayable::class)) { $array[$key] = $value->toArray(); } } diff --git a/src/Models/Payload/DataRequestPayload.php b/src/Models/Payload/DataRequestPayload.php index a9c0e323..176a0399 100644 --- a/src/Models/Payload/DataRequestPayload.php +++ b/src/Models/Payload/DataRequestPayload.php @@ -33,8 +33,7 @@ class DataRequestPayload extends Payload */ public function setProperties(?array $data) { - if (isset($data['additionalParameters'])) - { + if (isset($data['additionalParameters'])) { $this->additionalParameters = new AdditionalParameters($data['additionalParameters'], true); unset($data['additionalParameters']); diff --git a/src/Models/Payload/Payload.php b/src/Models/Payload/Payload.php index 7015f926..26e3adcd 100644 --- a/src/Models/Payload/Payload.php +++ b/src/Models/Payload/Payload.php @@ -123,22 +123,19 @@ class Payload extends Model public function setProperties(?array $data) { - if (isset($data['customParameters'])) - { + if (isset($data['customParameters'])) { $this->customParameters = new CustomParameters($data['customParameters']); unset($data['customParameters']); } - if (isset($data['additionalParameters'])) - { + if (isset($data['additionalParameters'])) { $this->additionalParameters = new AdditionalParameters($data['additionalParameters']); unset($data['additionalParameters']); } - if (isset($data['clientIP'])) - { + if (isset($data['clientIP'])) { $this->clientIP = new ClientIP($data['clientIP']['address'] ?? null, $data['clientIP']['type'] ?? null); unset($data['clientIP']); diff --git a/src/Models/ServiceList.php b/src/Models/ServiceList.php index d5b28b40..ff8e0364 100644 --- a/src/Models/ServiceList.php +++ b/src/Models/ServiceList.php @@ -61,8 +61,7 @@ public function __construct(string $name, int $version, string $action, ?Model $ $this->parameterService = new DefaultParameters($this); - if ($model) - { + if ($model) { $this->decorateParameters($model); $this->parameterService->data(); } @@ -86,18 +85,15 @@ public function parameters(): array public function appendParameter($value, $key = null) { /* Check value pass multiple, iterate through it*/ - if (is_array($value) && is_array(current($value))) - { - foreach ($value as $singleValue) - { + if (is_array($value) && is_array(current($value))) { + foreach ($value as $singleValue) { $this->appendParameter($singleValue, $key); } return $this; } - if ($key) - { + if ($key) { $this->parameters[$key] = $value; return $this; @@ -131,10 +127,8 @@ protected function decorateParameters(Model $model, ?string $groupType = null, ? */ protected function iterateThroughObject(Model $model, array $array, ?string $keyName = null) { - foreach ($array as $key => $value) - { - if ($model instanceof ServiceParameter && $value instanceof Model) - { + foreach ($array as $key => $value) { + if ($model instanceof ServiceParameter && $value instanceof Model) { $this->decorateParameters( $value, $model->getGroupType($keyName ?? $key), @@ -144,8 +138,7 @@ protected function iterateThroughObject(Model $model, array $array, ?string $key continue; } - if (is_array($value) && count($value)) - { + if (is_array($value) && count($value)) { $this->iterateThroughObject($model, $value, $key); } } diff --git a/src/Models/ServiceParameter.php b/src/Models/ServiceParameter.php index 80903470..256a5835 100644 --- a/src/Models/ServiceParameter.php +++ b/src/Models/ServiceParameter.php @@ -33,10 +33,8 @@ class ServiceParameter extends Model */ public function setProperties(?array $data) { - foreach ($data ?? [] as $property => $value) - { - if (method_exists($this, $property)) - { + foreach ($data ?? [] as $property => $value) { + if (method_exists($this, $property)) { $this->$property($value); continue; diff --git a/src/PaymentMethods/Afterpay/Models/Pay.php b/src/PaymentMethods/Afterpay/Models/Pay.php index f8200e3c..16ac9ce1 100644 --- a/src/PaymentMethods/Afterpay/Models/Pay.php +++ b/src/PaymentMethods/Afterpay/Models/Pay.php @@ -87,8 +87,7 @@ class Pay extends ServiceParameter */ public function billing($billing = null) { - if (is_array($billing)) - { + if (is_array($billing)) { $this->billingRecipient = new Recipient('Billing', $billing); $this->shippingRecipient = new Recipient('Shipping', $billing); } @@ -102,8 +101,7 @@ public function billing($billing = null) */ public function shipping($shipping = null) { - if (is_array($shipping)) - { + if (is_array($shipping)) { $this->shippingRecipient = new Recipient('Shipping', $shipping); } @@ -116,10 +114,8 @@ public function shipping($shipping = null) */ public function articles(?array $articles = null) { - if (is_array($articles)) - { - foreach ($articles as $article) - { + if (is_array($articles)) { + foreach ($articles as $article) { $this->articles[] = new ArticleAdapter(new Article($article)); } } diff --git a/src/PaymentMethods/Afterpay/Models/Recipient.php b/src/PaymentMethods/Afterpay/Models/Recipient.php index 2677b3be..7b988ef0 100644 --- a/src/PaymentMethods/Afterpay/Models/Recipient.php +++ b/src/PaymentMethods/Afterpay/Models/Recipient.php @@ -73,8 +73,7 @@ public function __construct(string $type, ?array $values = null) */ public function recipient($recipient = null) { - if (is_array($recipient)) - { + if (is_array($recipient)) { $this->recipient = $this->getRecipientObject($recipient); } @@ -87,8 +86,7 @@ public function recipient($recipient = null) */ public function address($address = null) { - if (is_array($address)) - { + if (is_array($address)) { $this->address = new AddressAdapter(new Address($address)); } @@ -101,8 +99,7 @@ public function address($address = null) */ public function phone($phone = null) { - if (is_array($phone)) - { + if (is_array($phone)) { $this->phone = new PhoneAdapter(new Phone($phone)); } @@ -115,8 +112,7 @@ public function phone($phone = null) */ public function email($email = null) { - if (is_string($email)) - { + if (is_string($email)) { $this->email = new Email($email); } @@ -130,8 +126,7 @@ public function email($email = null) */ private function getRecipientObject(array $recipient) : RecipientInterface { - switch ($recipient['category']) - { + switch ($recipient['category']) { case RecipientCategory::COMPANY: return new RecipientAdapter(new Company($recipient)); case RecipientCategory::PERSON: diff --git a/src/PaymentMethods/Afterpay/Models/Refund.php b/src/PaymentMethods/Afterpay/Models/Refund.php index 8ac00a53..e701c933 100644 --- a/src/PaymentMethods/Afterpay/Models/Refund.php +++ b/src/PaymentMethods/Afterpay/Models/Refund.php @@ -45,10 +45,8 @@ class Refund extends ServiceParameter */ public function articles(?array $articles = null) { - if (is_array($articles)) - { - foreach ($articles as $article) - { + if (is_array($articles)) { + foreach ($articles as $article) { $this->articles[] = new ArticleAdapter(new Article($article)); } } diff --git a/src/PaymentMethods/Afterpay/Service/ParameterKeys/PhoneAdapter.php b/src/PaymentMethods/Afterpay/Service/ParameterKeys/PhoneAdapter.php index 6a4d52fb..5c8e9d5f 100644 --- a/src/PaymentMethods/Afterpay/Service/ParameterKeys/PhoneAdapter.php +++ b/src/PaymentMethods/Afterpay/Service/ParameterKeys/PhoneAdapter.php @@ -26,6 +26,6 @@ class PhoneAdapter extends ServiceParametersKeysAdapter { protected array $keys = [ 'landLine' => 'Phone', - 'mobile' => 'MobilePhone' + 'mobile' => 'MobilePhone', ]; } diff --git a/src/PaymentMethods/AfterpayDigiAccept/Models/Pay.php b/src/PaymentMethods/AfterpayDigiAccept/Models/Pay.php index 897d47e5..38c6c59c 100644 --- a/src/PaymentMethods/AfterpayDigiAccept/Models/Pay.php +++ b/src/PaymentMethods/AfterpayDigiAccept/Models/Pay.php @@ -96,8 +96,7 @@ class Pay extends ServiceParameter */ public function billing($billing = null) { - if (is_array($billing)) - { + if (is_array($billing)) { $this->billingRecipient = new Recipient('Billing', $billing); $this->shippingRecipient = new Recipient('Shipping', $billing); } @@ -111,8 +110,7 @@ public function billing($billing = null) */ public function shipping($shipping = null) { - if (is_array($shipping)) - { + if (is_array($shipping)) { $this->addressesDiffer = true; $this->shippingRecipient = new Recipient('Shipping', $shipping); @@ -127,10 +125,8 @@ public function shipping($shipping = null) */ public function articles(?array $articles = null) { - if (is_array($articles)) - { - foreach ($articles as $article) - { + if (is_array($articles)) { + foreach ($articles as $article) { $this->articles[] = new ArticleAdapter(new Article($article)); } } diff --git a/src/PaymentMethods/AfterpayDigiAccept/Models/Recipient.php b/src/PaymentMethods/AfterpayDigiAccept/Models/Recipient.php index 05735b86..dadc75e0 100644 --- a/src/PaymentMethods/AfterpayDigiAccept/Models/Recipient.php +++ b/src/PaymentMethods/AfterpayDigiAccept/Models/Recipient.php @@ -73,8 +73,7 @@ public function __construct(string $type, ?array $values = null) */ public function recipient($recipient = null) { - if (is_array($recipient)) - { + if (is_array($recipient)) { $this->recipient = $this->getRecipientObject($recipient); } @@ -87,8 +86,7 @@ public function recipient($recipient = null) */ public function address($address = null) { - if (is_array($address)) - { + if (is_array($address)) { $this->address = new AddressAdapter($this->type, new Address($address)); } @@ -101,8 +99,7 @@ public function address($address = null) */ public function phone($phone = null) { - if (is_array($phone)) - { + if (is_array($phone)) { $this->phone = new PhoneAdapter($this->type, new Phone($phone)); } @@ -115,8 +112,7 @@ public function phone($phone = null) */ public function email($email = null) { - if (is_string($email)) - { + if (is_string($email)) { $this->email = new EmailAdapter($this->type, new Email($email)); } diff --git a/src/PaymentMethods/AfterpayDigiAccept/Models/Refund.php b/src/PaymentMethods/AfterpayDigiAccept/Models/Refund.php index dd5a52f3..2c9b004f 100644 --- a/src/PaymentMethods/AfterpayDigiAccept/Models/Refund.php +++ b/src/PaymentMethods/AfterpayDigiAccept/Models/Refund.php @@ -52,10 +52,8 @@ class Refund extends ServiceParameter */ public function articles(?array $articles = null) { - if (is_array($articles)) - { - foreach ($articles as $article) - { + if (is_array($articles)) { + foreach ($articles as $article) { $this->articles[] = new ArticleAdapter(new Article($article)); } } diff --git a/src/PaymentMethods/AfterpayDigiAccept/Service/ParameterKeys/AddressAdapter.php b/src/PaymentMethods/AfterpayDigiAccept/Service/ParameterKeys/AddressAdapter.php index d2c0e275..542d2072 100644 --- a/src/PaymentMethods/AfterpayDigiAccept/Service/ParameterKeys/AddressAdapter.php +++ b/src/PaymentMethods/AfterpayDigiAccept/Service/ParameterKeys/AddressAdapter.php @@ -36,8 +36,7 @@ class AddressAdapter extends ServiceAdapter */ public function serviceParameterKeyOf($propertyName): string { - if ($this->prefix == 'Shipping' && $propertyName == 'country') - { + if ($this->prefix == 'Shipping' && $propertyName == 'country') { return 'ShippingCountryCode'; } diff --git a/src/PaymentMethods/AfterpayDigiAccept/Service/ParameterKeys/PhoneAdapter.php b/src/PaymentMethods/AfterpayDigiAccept/Service/ParameterKeys/PhoneAdapter.php index d8fd974d..d3fb8802 100644 --- a/src/PaymentMethods/AfterpayDigiAccept/Service/ParameterKeys/PhoneAdapter.php +++ b/src/PaymentMethods/AfterpayDigiAccept/Service/ParameterKeys/PhoneAdapter.php @@ -23,6 +23,6 @@ class PhoneAdapter extends ServiceAdapter { protected array $keys = [ - 'mobile' => 'PhoneNumber' + 'mobile' => 'PhoneNumber', ]; } diff --git a/src/PaymentMethods/AfterpayDigiAccept/Service/ParameterKeys/RecipientAdapter.php b/src/PaymentMethods/AfterpayDigiAccept/Service/ParameterKeys/RecipientAdapter.php index dd2af1c3..68ef3647 100644 --- a/src/PaymentMethods/AfterpayDigiAccept/Service/ParameterKeys/RecipientAdapter.php +++ b/src/PaymentMethods/AfterpayDigiAccept/Service/ParameterKeys/RecipientAdapter.php @@ -37,8 +37,7 @@ class RecipientAdapter extends ServiceAdapter */ public function serviceParameterKeyOf($propertyName): string { - if (in_array($propertyName, ['companyName', 'chamberOfCommerce', 'vatNumber'])) - { + if (in_array($propertyName, ['companyName', 'chamberOfCommerce', 'vatNumber'])) { return (isset($this->keys[$propertyName]))? $this->keys[$propertyName] : ucfirst($propertyName); } diff --git a/src/PaymentMethods/BankTransfer/Models/Pay.php b/src/PaymentMethods/BankTransfer/Models/Pay.php index 7b55677d..c6e2d83f 100644 --- a/src/PaymentMethods/BankTransfer/Models/Pay.php +++ b/src/PaymentMethods/BankTransfer/Models/Pay.php @@ -56,8 +56,7 @@ class Pay extends ServiceParameter */ public function customer($customer = null) { - if (is_array($customer)) - { + if (is_array($customer)) { $this->customer = new CustomerAdapter(new Person($customer)); } @@ -70,8 +69,7 @@ public function customer($customer = null) */ public function email($email = null) { - if (is_string($email)) - { + if (is_string($email)) { $this->email = new EmailAdapter(new Email($email)); } diff --git a/src/PaymentMethods/Billink/Billink.php b/src/PaymentMethods/Billink/Billink.php index d99432b9..4de7b438 100644 --- a/src/PaymentMethods/Billink/Billink.php +++ b/src/PaymentMethods/Billink/Billink.php @@ -22,7 +22,6 @@ use Buckaroo\Models\Model; use Buckaroo\PaymentMethods\Billink\Models\Pay; -use Buckaroo\PaymentMethods\Billink\Models\Refund; use Buckaroo\PaymentMethods\PayablePaymentMethod; use Buckaroo\Transaction\Response\TransactionResponse; diff --git a/src/PaymentMethods/Billink/Models/Pay.php b/src/PaymentMethods/Billink/Models/Pay.php index 2b7d661f..f0f22eb8 100644 --- a/src/PaymentMethods/Billink/Models/Pay.php +++ b/src/PaymentMethods/Billink/Models/Pay.php @@ -71,8 +71,7 @@ class Pay extends ServiceParameter */ public function billing($billing = null) { - if (is_array($billing)) - { + if (is_array($billing)) { $this->billingRecipient = new Recipient('Billing', $billing); $this->shippingRecipient = new Recipient('Billing', $billing); } @@ -86,8 +85,7 @@ public function billing($billing = null) */ public function shipping($shipping = null) { - if (is_array($shipping)) - { + if (is_array($shipping)) { $this->shippingRecipient = new Recipient('Shipping', $shipping); } @@ -100,10 +98,8 @@ public function shipping($shipping = null) */ public function articles(?array $articles = null) { - if (is_array($articles)) - { - foreach ($articles as $article) - { + if (is_array($articles)) { + foreach ($articles as $article) { $this->articles[] = new ArticleAdapter(new Article($article)); } } diff --git a/src/PaymentMethods/Billink/Models/Recipient.php b/src/PaymentMethods/Billink/Models/Recipient.php index 3d42e629..488b3a7f 100644 --- a/src/PaymentMethods/Billink/Models/Recipient.php +++ b/src/PaymentMethods/Billink/Models/Recipient.php @@ -72,8 +72,7 @@ public function __construct(string $type, ?array $values = null) */ public function recipient($recipient = null) { - if (is_array($recipient)) - { + if (is_array($recipient)) { $this->recipient = $this->getRecipientObject($recipient); } @@ -86,8 +85,7 @@ public function recipient($recipient = null) */ public function address($address = null) { - if (is_array($address)) - { + if (is_array($address)) { $this->address = new AddressAdapter(new Address($address)); } @@ -100,8 +98,7 @@ public function address($address = null) */ public function phone($phone = null) { - if (is_array($phone)) - { + if (is_array($phone)) { $this->phone = new PhoneAdapter(new Phone($phone)); } @@ -114,8 +111,7 @@ public function phone($phone = null) */ public function email($email = null) { - if (is_string($email)) - { + if (is_string($email)) { $this->email = new Email($email); } @@ -129,10 +125,8 @@ public function email($email = null) */ private function getRecipientObject(array $recipient) : RecipientInterface { - if (isset($recipient['category'])) - { - switch ($recipient['category']) - { + if (isset($recipient['category'])) { + switch ($recipient['category']) { case 'B2B': return new RecipientAdapter(new Company($recipient)); case 'B2C': diff --git a/src/PaymentMethods/Billink/Service/ParameterKeys/PhoneAdapter.php b/src/PaymentMethods/Billink/Service/ParameterKeys/PhoneAdapter.php index 98a4a3d5..ee3d9ee1 100644 --- a/src/PaymentMethods/Billink/Service/ParameterKeys/PhoneAdapter.php +++ b/src/PaymentMethods/Billink/Service/ParameterKeys/PhoneAdapter.php @@ -25,6 +25,6 @@ class PhoneAdapter extends ServiceParametersKeysAdapter { protected array $keys = [ - 'mobile' => 'MobilePhone' + 'mobile' => 'MobilePhone', ]; } diff --git a/src/PaymentMethods/BuckarooVoucher/BuckarooVoucher.php b/src/PaymentMethods/BuckarooVoucher/BuckarooVoucher.php index 7dcbacff..46db4793 100644 --- a/src/PaymentMethods/BuckarooVoucher/BuckarooVoucher.php +++ b/src/PaymentMethods/BuckarooVoucher/BuckarooVoucher.php @@ -49,7 +49,6 @@ public function pay(?Model $model = null): TransactionResponse return parent::pay($model ?? $pay); } - /** * @param Model|null $model * @return TransactionResponse diff --git a/src/PaymentMethods/BuckarooWallet/Models/Wallet.php b/src/PaymentMethods/BuckarooWallet/Models/Wallet.php index 923b6328..26606013 100644 --- a/src/PaymentMethods/BuckarooWallet/Models/Wallet.php +++ b/src/PaymentMethods/BuckarooWallet/Models/Wallet.php @@ -67,8 +67,7 @@ class Wallet extends ServiceParameter */ public function customer($customer = null) { - if (is_array($customer)) - { + if (is_array($customer)) { $this->customer = new CustomerAdapter(new Person($customer)); } @@ -81,8 +80,7 @@ public function customer($customer = null) */ public function email($email = null) { - if (is_string($email)) - { + if (is_string($email)) { $this->email = new EmailAdapter(new Email($email)); } @@ -95,8 +93,7 @@ public function email($email = null) */ public function bankAccount($bankAccount = null) { - if (is_array($bankAccount)) - { + if (is_array($bankAccount)) { $this->bankAccount = new BankAccountAdapter(new BankAccount($bankAccount)); } diff --git a/src/PaymentMethods/CreditCard/CreditCard.php b/src/PaymentMethods/CreditCard/CreditCard.php index fa5bec11..ab269f5f 100644 --- a/src/PaymentMethods/CreditCard/CreditCard.php +++ b/src/PaymentMethods/CreditCard/CreditCard.php @@ -195,8 +195,7 @@ public function cancelAuthorize(): TransactionResponse */ public function paymentName(): string { - if (isset($this->payload['name'])) - { + if (isset($this->payload['name'])) { return $this->payload['name']; } diff --git a/src/PaymentMethods/CreditManagement/CreditManagement.php b/src/PaymentMethods/CreditManagement/CreditManagement.php index 1044ed77..5c14cb3d 100644 --- a/src/PaymentMethods/CreditManagement/CreditManagement.php +++ b/src/PaymentMethods/CreditManagement/CreditManagement.php @@ -21,7 +21,6 @@ namespace Buckaroo\PaymentMethods\CreditManagement; use Buckaroo\Models\Payload\DataRequestPayload; -use Buckaroo\Models\Payload\PayPayload; use Buckaroo\PaymentMethods\CreditManagement\Models\AddOrUpdateProductLines; use Buckaroo\PaymentMethods\CreditManagement\Models\CreditNote; use Buckaroo\PaymentMethods\CreditManagement\Models\Debtor; diff --git a/src/PaymentMethods/CreditManagement/Models/AddOrUpdateProductLines.php b/src/PaymentMethods/CreditManagement/Models/AddOrUpdateProductLines.php index 2bff3a54..d2923ff1 100644 --- a/src/PaymentMethods/CreditManagement/Models/AddOrUpdateProductLines.php +++ b/src/PaymentMethods/CreditManagement/Models/AddOrUpdateProductLines.php @@ -57,10 +57,8 @@ class AddOrUpdateProductLines extends ServiceParameter */ public function articles(?array $articles = null) { - if (is_array($articles)) - { - foreach ($articles as $article) - { + if (is_array($articles)) { + foreach ($articles as $article) { $this->articles[] = new ArticleAdapter(new Article($article)); } } diff --git a/src/PaymentMethods/CreditManagement/Models/DebtorInfo.php b/src/PaymentMethods/CreditManagement/Models/DebtorInfo.php index 8c999e02..dd3c9db0 100644 --- a/src/PaymentMethods/CreditManagement/Models/DebtorInfo.php +++ b/src/PaymentMethods/CreditManagement/Models/DebtorInfo.php @@ -46,8 +46,7 @@ class DebtorInfo extends ServiceParameter */ public function debtor($debtor = null) { - if (is_array($debtor)) - { + if (is_array($debtor)) { $this->debtor = new DebtorInfoAdapter(new Debtor($debtor)); } diff --git a/src/PaymentMethods/CreditManagement/Models/Invoice.php b/src/PaymentMethods/CreditManagement/Models/Invoice.php index 412547cc..8b2af4aa 100644 --- a/src/PaymentMethods/CreditManagement/Models/Invoice.php +++ b/src/PaymentMethods/CreditManagement/Models/Invoice.php @@ -158,8 +158,7 @@ class Invoice extends ServiceParameter */ public function address($address = null) { - if (is_array($address)) - { + if (is_array($address)) { $this->address = new Address($address); } @@ -172,8 +171,7 @@ public function address($address = null) */ public function company($company = null) { - if (is_array($company)) - { + if (is_array($company)) { $this->company = new Company($company); } @@ -186,8 +184,7 @@ public function company($company = null) */ public function person($person = null) { - if (is_array($person)) - { + if (is_array($person)) { $this->person = new Person($person); } @@ -200,8 +197,7 @@ public function person($person = null) */ public function debtor($debtor = null) { - if (is_array($debtor)) - { + if (is_array($debtor)) { $this->debtor = new Debtor($debtor); } @@ -214,8 +210,7 @@ public function debtor($debtor = null) */ public function email($email = null) { - if (is_string($email)) - { + if (is_string($email)) { $this->email = new Email($email); } @@ -228,8 +223,7 @@ public function email($email = null) */ public function phone($phone = null) { - if (is_array($phone)) - { + if (is_array($phone)) { $this->phone = new Phone($phone); } @@ -242,10 +236,8 @@ public function phone($phone = null) */ public function articles(?array $articles = null) { - if (is_array($articles)) - { - foreach ($articles as $article) - { + if (is_array($articles)) { + foreach ($articles as $article) { $this->articles[] = new ArticleAdapter(new Article($article)); } } diff --git a/src/PaymentMethods/CreditManagement/Models/MultipleInvoiceInfo.php b/src/PaymentMethods/CreditManagement/Models/MultipleInvoiceInfo.php index 80f2d970..80b96056 100644 --- a/src/PaymentMethods/CreditManagement/Models/MultipleInvoiceInfo.php +++ b/src/PaymentMethods/CreditManagement/Models/MultipleInvoiceInfo.php @@ -43,10 +43,8 @@ class MultipleInvoiceInfo extends ServiceParameter */ public function invoices(?array $invoices = null) { - if (is_array($invoices)) - { - foreach ($invoices as $invoice) - { + if (is_array($invoices)) { + foreach ($invoices as $invoice) { $this->invoices[] = new Invoice($invoice); } } diff --git a/src/PaymentMethods/GiftCard/GiftCard.php b/src/PaymentMethods/GiftCard/GiftCard.php index 336d8ec5..0b456106 100644 --- a/src/PaymentMethods/GiftCard/GiftCard.php +++ b/src/PaymentMethods/GiftCard/GiftCard.php @@ -80,8 +80,7 @@ public function payRemainder(?Model $model = null) */ public function paymentName(): string { - if (isset($this->payload['name'])) - { + if (isset($this->payload['name'])) { return $this->payload['name']; } diff --git a/src/PaymentMethods/In3/In3.php b/src/PaymentMethods/In3/In3.php index 4f659a0b..11e3314d 100644 --- a/src/PaymentMethods/In3/In3.php +++ b/src/PaymentMethods/In3/In3.php @@ -22,7 +22,6 @@ use Buckaroo\Models\Model; use Buckaroo\PaymentMethods\In3\Models\Pay; -use Buckaroo\PaymentMethods\In3\Models\PayPayload; use Buckaroo\PaymentMethods\PayablePaymentMethod; use Buckaroo\Transaction\Response\TransactionResponse; diff --git a/src/PaymentMethods/In3/Models/Pay.php b/src/PaymentMethods/In3/Models/Pay.php index d45e6a5a..23823a00 100644 --- a/src/PaymentMethods/In3/Models/Pay.php +++ b/src/PaymentMethods/In3/Models/Pay.php @@ -22,7 +22,6 @@ use Buckaroo\Models\ServiceParameter; use Buckaroo\PaymentMethods\In3\Service\ParameterKeys\ArticleAdapter; -use Buckaroo\PaymentMethods\In3\Service\ParameterKeys\CompanyAdapter; use Buckaroo\PaymentMethods\Traits\CountableGroupKey; class Pay extends ServiceParameter @@ -93,8 +92,7 @@ class Pay extends ServiceParameter */ public function billing($billing = null) { - if (is_array($billing)) - { + if (is_array($billing)) { $this->billingRecipient = new Recipient('Billing', $billing); $this->shippingRecipient = new Recipient('Shipping', $billing); } @@ -108,8 +106,7 @@ public function billing($billing = null) */ public function shipping($shipping = null) { - if (is_array($shipping)) - { + if (is_array($shipping)) { $this->shippingRecipient = new Recipient('Shipping', $shipping); } @@ -122,10 +119,8 @@ public function shipping($shipping = null) */ public function articles(?array $articles = null) { - if (is_array($articles)) - { - foreach ($articles as $article) - { + if (is_array($articles)) { + foreach ($articles as $article) { $this->articles[] = new ArticleAdapter(new Article($article)); } } diff --git a/src/PaymentMethods/In3/Models/Recipient.php b/src/PaymentMethods/In3/Models/Recipient.php index fb71faf9..331ad2f2 100644 --- a/src/PaymentMethods/In3/Models/Recipient.php +++ b/src/PaymentMethods/In3/Models/Recipient.php @@ -28,7 +28,6 @@ use Buckaroo\PaymentMethods\In3\Service\ParameterKeys\AddressAdapter; use Buckaroo\PaymentMethods\In3\Service\ParameterKeys\PhoneAdapter; use Buckaroo\PaymentMethods\In3\Service\ParameterKeys\RecipientAdapter; -use Buckaroo\Resources\Constants\RecipientCategory; class Recipient extends ServiceParameter { @@ -72,8 +71,7 @@ public function __construct(string $type, ?array $values = null) */ public function recipient($recipient = null) { - if (is_array($recipient)) - { + if (is_array($recipient)) { $this->recipient = $this->getRecipientObject($recipient); } @@ -86,8 +84,7 @@ public function recipient($recipient = null) */ public function address($address = null) { - if (is_array($address)) - { + if (is_array($address)) { $this->address = new AddressAdapter(new Address($address)); } @@ -100,8 +97,7 @@ public function address($address = null) */ public function phone($phone = null) { - if (is_array($phone)) - { + if (is_array($phone)) { $this->phone = new PhoneAdapter(new Phone($phone)); } @@ -114,8 +110,7 @@ public function phone($phone = null) */ public function email($email = null) { - if (is_string($email)) - { + if (is_string($email)) { $this->email = new Email($email); } @@ -129,10 +124,8 @@ public function email($email = null) */ private function getRecipientObject(array $recipient) : RecipientInterface { - if (isset($recipient['category'])) - { - switch ($recipient['category']) - { + if (isset($recipient['category'])) { + switch ($recipient['category']) { case 'B2B': return new RecipientAdapter(new Company($recipient)); case 'B2C': diff --git a/src/PaymentMethods/In3/Models/Refund.php b/src/PaymentMethods/In3/Models/Refund.php index 4a8f0f58..663a2555 100644 --- a/src/PaymentMethods/In3/Models/Refund.php +++ b/src/PaymentMethods/In3/Models/Refund.php @@ -45,10 +45,8 @@ class Refund extends ServiceParameter */ public function articles(?array $articles = null) { - if (is_array($articles)) - { - foreach ($articles as $article) - { + if (is_array($articles)) { + foreach ($articles as $article) { $this->articles[] = new ArticleAdapter(new Article($article)); } } diff --git a/src/PaymentMethods/In3/Service/ParameterKeys/AddressAdapter.php b/src/PaymentMethods/In3/Service/ParameterKeys/AddressAdapter.php index c73ef28b..55c51fc9 100644 --- a/src/PaymentMethods/In3/Service/ParameterKeys/AddressAdapter.php +++ b/src/PaymentMethods/In3/Service/ParameterKeys/AddressAdapter.php @@ -28,6 +28,6 @@ class AddressAdapter extends ServiceParametersKeysAdapter 'houseNumber' => 'StreetNumber', 'houseNumberAdditional' => 'StreetNumberSuffix', 'zipcode' => 'PostalCode', - 'country' => 'CountryCode' + 'country' => 'CountryCode', ]; } diff --git a/src/PaymentMethods/In3/Service/ParameterKeys/PhoneAdapter.php b/src/PaymentMethods/In3/Service/ParameterKeys/PhoneAdapter.php index b14298c5..27fbe7c6 100644 --- a/src/PaymentMethods/In3/Service/ParameterKeys/PhoneAdapter.php +++ b/src/PaymentMethods/In3/Service/ParameterKeys/PhoneAdapter.php @@ -25,6 +25,6 @@ class PhoneAdapter extends ServiceParametersKeysAdapter { protected array $keys = [ - 'mobile' => 'Phone' + 'mobile' => 'Phone', ]; } diff --git a/src/PaymentMethods/In3Old/Models/Pay.php b/src/PaymentMethods/In3Old/Models/Pay.php index d542bb50..155e40bd 100644 --- a/src/PaymentMethods/In3Old/Models/Pay.php +++ b/src/PaymentMethods/In3Old/Models/Pay.php @@ -111,10 +111,8 @@ class Pay extends ServiceParameter */ public function articles(?array $articles = null) { - if (is_array($articles)) - { - foreach ($articles as $article) - { + if (is_array($articles)) { + foreach ($articles as $article) { $this->articles[] = new ArticleAdapter(new Article($article)); } } @@ -128,8 +126,7 @@ public function articles(?array $articles = null) */ public function company($company = null) { - if (is_array($company)) - { + if (is_array($company)) { $this->company = new CompanyAdapter(new Company($company)); } @@ -142,8 +139,7 @@ public function company($company = null) */ public function customer($customer = null) { - if (is_array($customer)) - { + if (is_array($customer)) { $this->customer = new Person($customer); } @@ -156,8 +152,7 @@ public function customer($customer = null) */ public function address($address = null) { - if (is_array($address)) - { + if (is_array($address)) { $this->address = new AddressAdapter(new Address($address)); } @@ -170,8 +165,7 @@ public function address($address = null) */ public function email($email = null) { - if (is_string($email)) - { + if (is_string($email)) { $this->email = new Email($email); } @@ -184,8 +178,7 @@ public function email($email = null) */ public function phone($phone = null) { - if (is_array($phone)) - { + if (is_array($phone)) { $this->phone = new PhoneAdapter(new Phone($phone)); } @@ -198,10 +191,8 @@ public function phone($phone = null) */ public function subtotals(?array $subtotals = null) { - if (is_array($subtotals)) - { - foreach ($subtotals as $subtotal) - { + if (is_array($subtotals)) { + foreach ($subtotals as $subtotal) { $this->subtotals[] = new Subtotal($subtotal); } } diff --git a/src/PaymentMethods/In3Old/Service/ParameterKeys/PhoneAdapter.php b/src/PaymentMethods/In3Old/Service/ParameterKeys/PhoneAdapter.php index 17af7e7c..14bb2750 100644 --- a/src/PaymentMethods/In3Old/Service/ParameterKeys/PhoneAdapter.php +++ b/src/PaymentMethods/In3Old/Service/ParameterKeys/PhoneAdapter.php @@ -25,6 +25,6 @@ class PhoneAdapter extends ServiceParametersKeysAdapter { protected array $keys = [ - 'mobile' => 'Phone' + 'mobile' => 'Phone', ]; } diff --git a/src/PaymentMethods/KlarnaKP/Models/Payload.php b/src/PaymentMethods/KlarnaKP/Models/Payload.php index 8d8da241..63de80e4 100644 --- a/src/PaymentMethods/KlarnaKP/Models/Payload.php +++ b/src/PaymentMethods/KlarnaKP/Models/Payload.php @@ -49,8 +49,7 @@ class Payload extends ServiceParameter public function billing($billing = null) { - if (is_array($billing)) - { + if (is_array($billing)) { $this->billingRecipient = new Recipient('Billing', $billing); $this->shippingRecipient = new Recipient('Shipping', $billing); } @@ -60,8 +59,7 @@ public function billing($billing = null) public function shipping($shipping = null) { - if (is_array($shipping)) - { + if (is_array($shipping)) { $this->shippingSameAsBilling = false; $this->shippingRecipient = new Recipient('Shipping', $shipping); @@ -72,10 +70,8 @@ public function shipping($shipping = null) public function articles(?array $articles = null) { - if (is_array($articles)) - { - foreach ($articles as $article) - { + if (is_array($articles)) { + foreach ($articles as $article) { $this->articles[] = new ArticleAdapter(new Article($article)); } } diff --git a/src/PaymentMethods/KlarnaKP/Models/Recipient.php b/src/PaymentMethods/KlarnaKP/Models/Recipient.php index 242a0836..e56d39ff 100644 --- a/src/PaymentMethods/KlarnaKP/Models/Recipient.php +++ b/src/PaymentMethods/KlarnaKP/Models/Recipient.php @@ -33,8 +33,7 @@ public function __construct(string $type, ?array $values = null) public function phone($phone = null) { - if (is_array($phone)) - { + if (is_array($phone)) { $this->phone = new PhoneAdapter(new Phone($phone), $this->type); } @@ -43,8 +42,7 @@ public function phone($phone = null) public function email($email = null) { - if (is_string($email)) - { + if (is_string($email)) { $this->email = new EmailAdapter(new Email($email), $this->type); } @@ -53,8 +51,7 @@ public function email($email = null) public function address($address = null) { - if (is_array($address)) - { + if (is_array($address)) { $this->address = new AddressAdapter(new Address($address), $this->type); } @@ -63,8 +60,7 @@ public function address($address = null) public function recipient($recipient = null) { - if (is_array($recipient)) - { + if (is_array($recipient)) { $this->recipient = new RecipientAdapter(new Person($recipient), $this->type); } diff --git a/src/PaymentMethods/KlarnaKP/Service/ParameterKeys/PhoneAdapter.php b/src/PaymentMethods/KlarnaKP/Service/ParameterKeys/PhoneAdapter.php index f345e2ad..036358ab 100644 --- a/src/PaymentMethods/KlarnaKP/Service/ParameterKeys/PhoneAdapter.php +++ b/src/PaymentMethods/KlarnaKP/Service/ParameterKeys/PhoneAdapter.php @@ -25,6 +25,6 @@ class PhoneAdapter extends RecipientAdapter { protected array $keys = [ - 'mobile' => 'CellPhoneNumber' + 'mobile' => 'CellPhoneNumber', ]; } diff --git a/src/PaymentMethods/KlarnaPay/KlarnaPay.php b/src/PaymentMethods/KlarnaPay/KlarnaPay.php index 3f0e564d..6acc01f1 100644 --- a/src/PaymentMethods/KlarnaPay/KlarnaPay.php +++ b/src/PaymentMethods/KlarnaPay/KlarnaPay.php @@ -60,10 +60,10 @@ public function payInInstallments(): TransactionResponse return $this->postRequest(); } - /** - * @param Model|null $model - * @return TransactionResponse - */ + /** + * @param Model|null $model + * @return TransactionResponse + */ public function payRemainder(?Model $model = null): TransactionResponse { return parent::payRemainder($model ?? new Pay($this->payload)); diff --git a/src/PaymentMethods/KlarnaPay/Models/Pay.php b/src/PaymentMethods/KlarnaPay/Models/Pay.php index 8697ad98..1e9c110f 100644 --- a/src/PaymentMethods/KlarnaPay/Models/Pay.php +++ b/src/PaymentMethods/KlarnaPay/Models/Pay.php @@ -63,8 +63,7 @@ class Pay extends ServiceParameter */ public function billing($billing = null) { - if (is_array($billing)) - { + if (is_array($billing)) { $this->billingRecipient = new Recipient('Billing', $billing); $this->shippingRecipient = new Recipient('Shipping', $billing); } @@ -78,8 +77,7 @@ public function billing($billing = null) */ public function shipping($shipping = null) { - if (is_array($shipping)) - { + if (is_array($shipping)) { $this->shippingRecipient = new Recipient('Shipping', $shipping); } @@ -92,10 +90,8 @@ public function shipping($shipping = null) */ public function articles(?array $articles = null) { - if (is_array($articles)) - { - foreach ($articles as $article) - { + if (is_array($articles)) { + foreach ($articles as $article) { $this->articles[] = new ArticleAdapter(new Article($article)); } } diff --git a/src/PaymentMethods/KlarnaPay/Models/Recipient.php b/src/PaymentMethods/KlarnaPay/Models/Recipient.php index 2dd3ae28..0c33fb51 100644 --- a/src/PaymentMethods/KlarnaPay/Models/Recipient.php +++ b/src/PaymentMethods/KlarnaPay/Models/Recipient.php @@ -71,8 +71,7 @@ public function __construct(string $type, ?array $values = null) */ public function recipient($recipient = null) { - if (is_array($recipient)) - { + if (is_array($recipient)) { $this->recipient = new Person($recipient); } @@ -85,8 +84,7 @@ public function recipient($recipient = null) */ public function address($address = null) { - if (is_array($address)) - { + if (is_array($address)) { $this->address = new AddressAdapter(new Address($address)); } @@ -99,8 +97,7 @@ public function address($address = null) */ public function phone($phone = null) { - if (is_array($phone)) - { + if (is_array($phone)) { $this->phone = new PhoneAdapter(new Phone($phone)); } @@ -113,8 +110,7 @@ public function phone($phone = null) */ public function email($email = null) { - if (is_string($email)) - { + if (is_string($email)) { $this->email = new Email($email); } @@ -128,8 +124,7 @@ public function email($email = null) */ private function getRecipientObject(array $recipient) : RecipientInterface { - switch ($recipient['category']) - { + switch ($recipient['category']) { case 'B2B': return new Company($recipient); case 'B2C': diff --git a/src/PaymentMethods/KlarnaPay/Service/ParameterKeys/PhoneAdapter.php b/src/PaymentMethods/KlarnaPay/Service/ParameterKeys/PhoneAdapter.php index 306bfff9..da15397f 100644 --- a/src/PaymentMethods/KlarnaPay/Service/ParameterKeys/PhoneAdapter.php +++ b/src/PaymentMethods/KlarnaPay/Service/ParameterKeys/PhoneAdapter.php @@ -25,6 +25,6 @@ class PhoneAdapter extends ServiceParametersKeysAdapter { protected array $keys = [ - 'mobile' => 'Phone' + 'mobile' => 'Phone', ]; } diff --git a/src/PaymentMethods/KnakenPay/KnakenPay.php b/src/PaymentMethods/KnakenPay/KnakenPay.php index 1ceb1559..b406f4f3 100644 --- a/src/PaymentMethods/KnakenPay/KnakenPay.php +++ b/src/PaymentMethods/KnakenPay/KnakenPay.php @@ -23,9 +23,9 @@ namespace Buckaroo\PaymentMethods\KnakenPay; use Buckaroo\Models\Model; +use Buckaroo\Models\ServiceParameter; use Buckaroo\PaymentMethods\PayablePaymentMethod; use Buckaroo\Transaction\Response\TransactionResponse; -use Buckaroo\Models\ServiceParameter; class KnakenPay extends PayablePaymentMethod { diff --git a/src/PaymentMethods/Marketplaces/Models/ServiceList.php b/src/PaymentMethods/Marketplaces/Models/ServiceList.php index 99e96293..aa31a354 100644 --- a/src/PaymentMethods/Marketplaces/Models/ServiceList.php +++ b/src/PaymentMethods/Marketplaces/Models/ServiceList.php @@ -64,8 +64,7 @@ class ServiceList extends ServiceParameter */ public function marketplace($marketplace = null) { - if (is_array($marketplace)) - { + if (is_array($marketplace)) { $this->marketplace = new Marketplace($marketplace); } @@ -78,10 +77,8 @@ public function marketplace($marketplace = null) */ public function sellers($sellers = null) { - if (is_array($sellers)) - { - foreach ($sellers as $seller) - { + if (is_array($sellers)) { + foreach ($sellers as $seller) { $this->sellers[] = new Seller($seller); } } diff --git a/src/PaymentMethods/PayPerEmail/Models/PaymentInvitation.php b/src/PaymentMethods/PayPerEmail/Models/PaymentInvitation.php index 5c37879c..34cdfe5a 100644 --- a/src/PaymentMethods/PayPerEmail/Models/PaymentInvitation.php +++ b/src/PaymentMethods/PayPerEmail/Models/PaymentInvitation.php @@ -74,8 +74,7 @@ class PaymentInvitation extends ServiceParameter */ public function customer($customer = null) { - if (is_array($customer)) - { + if (is_array($customer)) { $this->customer = new CustomerAdapter(new Person($customer)); } @@ -88,8 +87,7 @@ public function customer($customer = null) */ public function email($email = null) { - if (is_string($email)) - { + if (is_string($email)) { $this->email = new EmailAdapter(new Email($email)); } @@ -102,10 +100,8 @@ public function email($email = null) */ public function attachments(?array $attachments = null) { - if (is_array($attachments)) - { - foreach ($attachments as $attachment) - { + if (is_array($attachments)) { + foreach ($attachments as $attachment) { $this->attachments[] = new AttachmentAdapter(new Attachment($attachment)); } } diff --git a/src/PaymentMethods/PaymentFacade.php b/src/PaymentMethods/PaymentFacade.php index bf863bae..f1d2353d 100644 --- a/src/PaymentMethods/PaymentFacade.php +++ b/src/PaymentMethods/PaymentFacade.php @@ -136,18 +136,15 @@ public function manually() */ public function combine($combinablePayment) { - if (is_array($combinablePayment)) - { - foreach ($combinablePayment as $combinable_payment) - { + if (is_array($combinablePayment)) { + foreach ($combinablePayment as $combinable_payment) { $this->combine($combinable_payment); } return $this; } - if ($combinablePayment instanceof Combinable) - { + if ($combinablePayment instanceof Combinable) { $this->paymentMethod->combinePayment($combinablePayment); } @@ -171,7 +168,7 @@ public function paymentMethod(): PaymentMethod public function __call(?string $name, array $arguments) { if (method_exists($this->paymentMethod, $name)) { - if($name === 'setServiceVersion') { + if ($name === 'setServiceVersion') { $this->paymentMethod->setServiceVersion($arguments[0]); return $this; diff --git a/src/PaymentMethods/PaymentMethod.php b/src/PaymentMethods/PaymentMethod.php index 7f5e0c43..8afe7136 100644 --- a/src/PaymentMethods/PaymentMethod.php +++ b/src/PaymentMethods/PaymentMethod.php @@ -114,8 +114,7 @@ public function setPayload(array $payload) */ protected function postRequest() { - if ($this->isManually) - { + if ($this->isManually) { return $this; } @@ -130,8 +129,7 @@ protected function postRequest() */ protected function dataRequest() { - if ($this->isManually) - { + if ($this->isManually) { return $this; } @@ -187,8 +185,7 @@ public function setServiceVersion(int $serviceVersion): PaymentInterface */ public function manually(?bool $isManually = null) { - if ($isManually !== null) - { + if ($isManually !== null) { $this->isManually = $isManually; } @@ -204,16 +201,14 @@ public function combinePayment(Combinable $combinablePayment) $this->combinablePayment = $combinablePayment; $payload_data = array_filter($combinablePayment->request->data(), function ($key) { - return ! in_array($key, ['Services']); + return !in_array($key, ['Services']); }, ARRAY_FILTER_USE_KEY); - foreach ($payload_data as $key => $value) - { + foreach ($payload_data as $key => $value) { $this->request->setData($key, $value); } - foreach ($this->combinablePayment->request->getServices()->serviceList() as $serviceList) - { + foreach ($this->combinablePayment->request->getServices()->serviceList() as $serviceList) { $this->request->getServices()->pushServiceList($serviceList); } diff --git a/src/PaymentMethods/PaymentMethodFactory.php b/src/PaymentMethods/PaymentMethodFactory.php index 8db8f281..d45c1e95 100644 --- a/src/PaymentMethods/PaymentMethodFactory.php +++ b/src/PaymentMethods/PaymentMethodFactory.php @@ -20,57 +20,57 @@ 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\iDealProcessing\iDealProcessing; -use Buckaroo\PaymentMethods\MBWay\MBWay; use Buckaroo\Exceptions\BuckarooException; +use Buckaroo\PaymentMethods\Afterpay\Afterpay; +use Buckaroo\PaymentMethods\AfterpayDigiAccept\AfterpayDigiAccept; use Buckaroo\PaymentMethods\Alipay\Alipay; -use Buckaroo\PaymentMethods\In3Old\In3Old; -use Buckaroo\PaymentMethods\Paypal\Paypal; -use Buckaroo\PaymentMethods\Thunes\Thunes; +use Buckaroo\PaymentMethods\ApplePay\ApplePay; +use Buckaroo\PaymentMethods\Bancontact\Bancontact; +use Buckaroo\PaymentMethods\BankTransfer\BankTransfer; use Buckaroo\PaymentMethods\Belfius\Belfius; use Buckaroo\PaymentMethods\Billink\Billink; -use Buckaroo\PaymentMethods\iDealQR\iDealQR; -use Buckaroo\PaymentMethods\Surepay\Surepay; -use Buckaroo\PaymentMethods\Swish\Swish; -use Buckaroo\PaymentMethods\Trustly\Trustly; -use Buckaroo\PaymentMethods\Afterpay\Afterpay; -use Buckaroo\PaymentMethods\ApplePay\ApplePay; -use Buckaroo\PaymentMethods\GooglePay\GooglePay; +use Buckaroo\PaymentMethods\Bizum\Bizum; +use Buckaroo\PaymentMethods\Blik\Blik; +use Buckaroo\PaymentMethods\BuckarooVoucher\BuckarooVoucher; +use Buckaroo\PaymentMethods\BuckarooWallet\BuckarooWallet; +use Buckaroo\PaymentMethods\ClickToPay\ClickToPay; +use Buckaroo\PaymentMethods\CreditCard\CreditCard; +use Buckaroo\PaymentMethods\CreditManagement\CreditManagement; +use Buckaroo\PaymentMethods\Emandates\Emandates; +use Buckaroo\PaymentMethods\EPS\EPS; +use Buckaroo\PaymentMethods\ExternalPayment\ExternalPayment; use Buckaroo\PaymentMethods\GiftCard\GiftCard; +use Buckaroo\PaymentMethods\GooglePay\GooglePay; +use Buckaroo\PaymentMethods\iDeal\iDeal; +use Buckaroo\PaymentMethods\iDealProcessing\iDealProcessing; +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\KlarnaKP\KlarnaKP; -use Buckaroo\PaymentMethods\KnakenPay\KnakenPay; -use Buckaroo\PaymentMethods\Payconiq\Payconiq; -use Buckaroo\PaymentMethods\Emandates\Emandates; use Buckaroo\PaymentMethods\KlarnaPay\KlarnaPay; -use Buckaroo\PaymentMethods\WeChatPay\WeChatPay; -use Buckaroo\PaymentMethods\Bancontact\Bancontact; -use Buckaroo\PaymentMethods\Bizum\Bizum; -use Buckaroo\PaymentMethods\CreditCard\CreditCard; +use Buckaroo\PaymentMethods\KnakenPay\KnakenPay; +use Buckaroo\PaymentMethods\Marketplaces\Marketplaces; +use Buckaroo\PaymentMethods\MBWay\MBWay; use Buckaroo\PaymentMethods\Multibanco\Multibanco; -use Buckaroo\PaymentMethods\Przelewy24\Przelewy24; +use Buckaroo\PaymentMethods\NoServiceSpecifiedPayment\NoServiceSpecifiedPayment; +use Buckaroo\PaymentMethods\Payconiq\Payconiq; +use Buckaroo\PaymentMethods\PaymentInitiation\PaymentInitiation; +use Buckaroo\PaymentMethods\Paypal\Paypal; use Buckaroo\PaymentMethods\PayPerEmail\PayPerEmail; use Buckaroo\PaymentMethods\PointOfSale\PointOfSale; -use Buckaroo\PaymentMethods\BankTransfer\BankTransfer; -use Buckaroo\PaymentMethods\Marketplaces\Marketplaces; +use Buckaroo\PaymentMethods\Przelewy24\Przelewy24; +use Buckaroo\PaymentMethods\SEPA\SEPA; use Buckaroo\PaymentMethods\Subscriptions\Subscriptions; -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\Blik\Blik; -use Buckaroo\PaymentMethods\ClickToPay\ClickToPay; +use Buckaroo\PaymentMethods\Surepay\Surepay; +use Buckaroo\PaymentMethods\Swish\Swish; +use Buckaroo\PaymentMethods\Thunes\Thunes; +use Buckaroo\PaymentMethods\Trustly\Trustly; use Buckaroo\PaymentMethods\Twint\Twint; -use Buckaroo\PaymentMethods\NoServiceSpecifiedPayment\NoServiceSpecifiedPayment; +use Buckaroo\PaymentMethods\WeChatPay\WeChatPay; use Buckaroo\PaymentMethods\Wero\Wero; +use Buckaroo\Transaction\Client; class PaymentMethodFactory { @@ -173,12 +173,9 @@ public function __construct(Client $client, ?string $paymentMethod) */ public function getPaymentMethod(): PaymentMethod { - if ($this->paymentMethod) - { - foreach (self::$payments as $class => $alias) - { - if (in_array($this->paymentMethod, $alias)) - { + if ($this->paymentMethod) { + foreach (self::$payments as $class => $alias) { + if (in_array($this->paymentMethod, $alias)) { return new $class($this->client, $this->paymentMethod); } } diff --git a/src/PaymentMethods/Paypal/Models/ExtraInfo.php b/src/PaymentMethods/Paypal/Models/ExtraInfo.php index 96665915..ee5bf840 100644 --- a/src/PaymentMethods/Paypal/Models/ExtraInfo.php +++ b/src/PaymentMethods/Paypal/Models/ExtraInfo.php @@ -56,8 +56,7 @@ class ExtraInfo extends ServiceParameter */ public function address($address = null) { - if (is_array($address)) - { + if (is_array($address)) { $this->address = new AddressAdapter(new Address($address)); } @@ -70,8 +69,7 @@ public function address($address = null) */ public function customer($customer = null) { - if (is_array($customer)) - { + if (is_array($customer)) { $this->customer = new Person($customer); } @@ -84,8 +82,7 @@ public function customer($customer = null) */ public function phone($phone = null) { - if (is_array($phone)) - { + if (is_array($phone)) { $this->phone = new PhoneAdapter(new Phone($phone)); } diff --git a/src/PaymentMethods/Paypal/Service/ParameterKeys/PhoneAdapter.php b/src/PaymentMethods/Paypal/Service/ParameterKeys/PhoneAdapter.php index ba83d94b..c86325eb 100644 --- a/src/PaymentMethods/Paypal/Service/ParameterKeys/PhoneAdapter.php +++ b/src/PaymentMethods/Paypal/Service/ParameterKeys/PhoneAdapter.php @@ -25,6 +25,6 @@ class PhoneAdapter extends ServiceParametersKeysAdapter { protected array $keys = [ - 'mobile' => 'Phone' + 'mobile' => 'Phone', ]; } diff --git a/src/PaymentMethods/Przelewy24/Models/Pay.php b/src/PaymentMethods/Przelewy24/Models/Pay.php index c76466ff..f9453e47 100644 --- a/src/PaymentMethods/Przelewy24/Models/Pay.php +++ b/src/PaymentMethods/Przelewy24/Models/Pay.php @@ -43,8 +43,7 @@ class Pay extends ServiceParameter */ public function customer($customer = null) { - if (is_array($customer)) - { + if (is_array($customer)) { $this->customer = new CustomerAdapter(new Person($customer)); } @@ -57,8 +56,7 @@ public function customer($customer = null) */ public function email($email = null) { - if (is_string($email)) - { + if (is_string($email)) { $this->email = new EmailAdapter(new Email($email)); } diff --git a/src/PaymentMethods/SEPA/Models/ExtraInfo.php b/src/PaymentMethods/SEPA/Models/ExtraInfo.php index cd8dca24..15ee40e8 100644 --- a/src/PaymentMethods/SEPA/Models/ExtraInfo.php +++ b/src/PaymentMethods/SEPA/Models/ExtraInfo.php @@ -53,8 +53,7 @@ class ExtraInfo extends Pay */ public function address($address = null) { - if (is_array($address)) - { + if (is_array($address)) { $this->address = new AddressAdapter(new Address($address)); } diff --git a/src/PaymentMethods/SEPA/Models/Pay.php b/src/PaymentMethods/SEPA/Models/Pay.php index f56b164d..9840d0b3 100644 --- a/src/PaymentMethods/SEPA/Models/Pay.php +++ b/src/PaymentMethods/SEPA/Models/Pay.php @@ -58,8 +58,7 @@ class Pay extends ServiceParameter */ public function customer($customer = null) { - if (is_array($customer)) - { + if (is_array($customer)) { $this->customer = new CustomerAdapter(new Person($customer)); } diff --git a/src/PaymentMethods/Subscriptions/Models/Subscription.php b/src/PaymentMethods/Subscriptions/Models/Subscription.php index d5397547..eb5408e6 100644 --- a/src/PaymentMethods/Subscriptions/Models/Subscription.php +++ b/src/PaymentMethods/Subscriptions/Models/Subscription.php @@ -29,8 +29,8 @@ use Buckaroo\Models\Person; use Buckaroo\Models\Phone; use Buckaroo\Models\ServiceParameter; -use Buckaroo\PaymentMethods\Subscriptions\Service\ParameterKeys\BankAccountAdapter; use Buckaroo\PaymentMethods\Subscriptions\Service\ParameterKeys\AddressAdapter; +use Buckaroo\PaymentMethods\Subscriptions\Service\ParameterKeys\BankAccountAdapter; use Buckaroo\PaymentMethods\Subscriptions\Service\ParameterKeys\CompanyAdapter; class Subscription extends ServiceParameter @@ -207,8 +207,7 @@ class Subscription extends ServiceParameter */ public function debtor($debtor = null) { - if (is_array($debtor)) - { + if (is_array($debtor)) { $this->debtor = new Debtor($debtor); } @@ -221,8 +220,7 @@ public function debtor($debtor = null) */ public function bankAccount($bankAccount = null) { - if (is_array($bankAccount)) - { + if (is_array($bankAccount)) { $this->bankAccount = new BankAccountAdapter(new BankAccount($bankAccount)); } @@ -235,8 +233,7 @@ public function bankAccount($bankAccount = null) */ public function email($email = null) { - if (is_string($email)) - { + if (is_string($email)) { $this->email = new Email($email); } @@ -249,8 +246,7 @@ public function email($email = null) */ public function phone($phone = null) { - if (is_array($phone)) - { + if (is_array($phone)) { $this->phone = new Phone($phone); } @@ -263,8 +259,7 @@ public function phone($phone = null) */ public function address($address = null) { - if (is_array($address)) - { + if (is_array($address)) { $this->address = new AddressAdapter(new Address($address)); } @@ -277,8 +272,7 @@ public function address($address = null) */ public function person($person = null) { - if (is_array($person)) - { + if (is_array($person)) { $this->person = new Person($person); } @@ -291,8 +285,7 @@ public function person($person = null) */ public function company($company = null) { - if (is_array($company)) - { + if (is_array($company)) { $this->company = new CompanyAdapter(new Company($company)); } @@ -305,8 +298,7 @@ public function company($company = null) */ public function configuration($configuration = null) { - if (is_array($configuration)) - { + if (is_array($configuration)) { $this->configuration = new Configuration($configuration); } @@ -319,10 +311,8 @@ public function configuration($configuration = null) */ public function ratePlans($rate_plans = null) { - if (is_array($rate_plans)) - { - foreach ($rate_plans as $type => $rate_plan) - { + if (is_array($rate_plans)) { + foreach ($rate_plans as $type => $rate_plan) { $property = $type . 'RatePlan'; $this->$property = new RatePlan($rate_plan); @@ -338,10 +328,8 @@ public function ratePlans($rate_plans = null) */ public function ratePlanCharges($rate_plan_charges = null) { - if (is_array($rate_plan_charges)) - { - foreach ($rate_plan_charges as $type => $rate_plan_charge) - { + if (is_array($rate_plan_charges)) { + foreach ($rate_plan_charges as $type => $rate_plan_charge) { $property = $type . 'RatePlanCharge'; $this->$property = new RatePlanCharge($rate_plan_charge); diff --git a/src/PaymentMethods/Subscriptions/Service/ParameterKeys/BankAccountAdapter.php b/src/PaymentMethods/Subscriptions/Service/ParameterKeys/BankAccountAdapter.php index acec2739..cb7ba0bf 100644 --- a/src/PaymentMethods/Subscriptions/Service/ParameterKeys/BankAccountAdapter.php +++ b/src/PaymentMethods/Subscriptions/Service/ParameterKeys/BankAccountAdapter.php @@ -28,8 +28,8 @@ class BankAccountAdapter extends ServiceParametersKeysAdapter * @var array|string[] */ protected array $keys = [ - 'iban' => 'CustomerIBAN', - 'accountName' => 'CustomerAccountName', - 'bic' => 'CustomerBIC' + 'iban' => 'CustomerIBAN', + 'accountName' => 'CustomerAccountName', + 'bic' => 'CustomerBIC', ]; } diff --git a/src/PaymentMethods/Subscriptions/Subscriptions.php b/src/PaymentMethods/Subscriptions/Subscriptions.php index 65b09e7a..b58d013e 100644 --- a/src/PaymentMethods/Subscriptions/Subscriptions.php +++ b/src/PaymentMethods/Subscriptions/Subscriptions.php @@ -26,7 +26,6 @@ use Buckaroo\PaymentMethods\Subscriptions\Models\CombinedPayload; use Buckaroo\PaymentMethods\Subscriptions\Models\ResumeSubscription; use Buckaroo\PaymentMethods\Subscriptions\Models\Subscription; -use function Ramsey\Uuid\v1; class Subscriptions extends PaymentMethod implements Combinable { diff --git a/src/PaymentMethods/Surepay/Models/Verify.php b/src/PaymentMethods/Surepay/Models/Verify.php index 512bff6d..1350d68e 100644 --- a/src/PaymentMethods/Surepay/Models/Verify.php +++ b/src/PaymentMethods/Surepay/Models/Verify.php @@ -37,8 +37,7 @@ class Verify extends ServiceParameter */ public function bankAccount($bankAccount = null) { - if (is_array($bankAccount)) - { + if (is_array($bankAccount)) { $this->bankAccount = new BankAccountAdapter(new BankAccount($bankAccount)); } diff --git a/src/PaymentMethods/Thunes/Models/Pay.php b/src/PaymentMethods/Thunes/Models/Pay.php index 5bb06890..3feb8dd0 100644 --- a/src/PaymentMethods/Thunes/Models/Pay.php +++ b/src/PaymentMethods/Thunes/Models/Pay.php @@ -43,10 +43,8 @@ class Pay extends ServiceParameter ]; public function articles(?array $articles = null) { - if (is_array($articles)) - { - foreach ($articles as $article) - { + if (is_array($articles)) { + foreach ($articles as $article) { $this->articles[] = new ArticleAdapter(new Article($article)); } } diff --git a/src/PaymentMethods/Thunes/Thunes.php b/src/PaymentMethods/Thunes/Thunes.php index 65c6cf76..5a0805a8 100644 --- a/src/PaymentMethods/Thunes/Thunes.php +++ b/src/PaymentMethods/Thunes/Thunes.php @@ -51,8 +51,7 @@ public function pay(?Model $model = null): TransactionResponse */ public function paymentName(): string { - if (isset($this->payload['name'])) - { + if (isset($this->payload['name'])) { return $this->payload['name']; } diff --git a/src/PaymentMethods/Traits/CountableGroupKey.php b/src/PaymentMethods/Traits/CountableGroupKey.php index b2b07461..973942d9 100644 --- a/src/PaymentMethods/Traits/CountableGroupKey.php +++ b/src/PaymentMethods/Traits/CountableGroupKey.php @@ -29,8 +29,7 @@ trait CountableGroupKey */ public function getGroupKey(string $key, ?int $keyCount = 0): ?int { - if ($this->countable($key, $keyCount)) - { + if ($this->countable($key, $keyCount)) { return intval($keyCount) + 1; } diff --git a/src/PaymentMethods/Trustly/Models/Pay.php b/src/PaymentMethods/Trustly/Models/Pay.php index a9b8218a..7ead572e 100644 --- a/src/PaymentMethods/Trustly/Models/Pay.php +++ b/src/PaymentMethods/Trustly/Models/Pay.php @@ -20,8 +20,8 @@ namespace Buckaroo\PaymentMethods\Trustly\Models; -use Buckaroo\Models\Person; use Buckaroo\Models\Email; +use Buckaroo\Models\Person; use Buckaroo\Models\ServiceParameter; use Buckaroo\PaymentMethods\Trustly\Service\ParameterKeys\CustomerAdapter; use Buckaroo\PaymentMethods\Trustly\Service\ParameterKeys\EmailAdapter; @@ -49,8 +49,7 @@ class Pay extends ServiceParameter */ public function customer($customer = null) { - if (is_array($customer)) - { + if (is_array($customer)) { $this->customer = new CustomerAdapter(new Person($customer)); } @@ -63,8 +62,7 @@ public function customer($customer = null) */ public function email($email = null) { - if (is_string($email)) - { + if (is_string($email)) { $this->email = new EmailAdapter(new Email($email)); } diff --git a/src/PaymentMethods/iDin/iDin.php b/src/PaymentMethods/iDin/iDin.php index 1855a6a1..7ce9e099 100644 --- a/src/PaymentMethods/iDin/iDin.php +++ b/src/PaymentMethods/iDin/iDin.php @@ -21,7 +21,6 @@ namespace Buckaroo\PaymentMethods\iDin; use Buckaroo\Models\Payload\DataRequestPayload; -use Buckaroo\Models\Payload\PayPayload; use Buckaroo\PaymentMethods\iDin\Models\Issuer; use Buckaroo\PaymentMethods\iDin\Service\ParameterKeys\IssuerAdapter; use Buckaroo\PaymentMethods\PaymentMethod; diff --git a/src/Services/ActiveSubscriptions.php b/src/Services/ActiveSubscriptions.php index e5fb4f84..6a7f57ba 100644 --- a/src/Services/ActiveSubscriptions.php +++ b/src/Services/ActiveSubscriptions.php @@ -20,15 +20,14 @@ namespace Buckaroo\Services; -use Exception; -use SimpleXMLElement; use Buckaroo\Models\ServiceList; use Buckaroo\Transaction\Client; use Buckaroo\Transaction\Request\TransactionRequest; +use Exception; +use SimpleXMLElement; class ActiveSubscriptions { - private const SERVICE_CODE_AND_ACTION = 'GetActiveSubscriptions'; private const VERSION_ZERO = 0; @@ -76,12 +75,13 @@ private function buildTransaction(): TransactionRequest self::SERVICE_CODE_AND_ACTION ) ); + return $transaction; } private function format($data): array { - $decoded = json_decode(json_encode($data), true); + $decoded = json_decode(json_encode($data), true); if (!is_array($decoded)) { return []; } @@ -95,6 +95,7 @@ private function format($data): array } $formated[] = $formatedSubscription; } + return $formated; } diff --git a/src/Services/PayloadService.php b/src/Services/PayloadService.php index 2e83965d..4715746f 100644 --- a/src/Services/PayloadService.php +++ b/src/Services/PayloadService.php @@ -45,20 +45,17 @@ public function __construct($payload) */ protected function setPayload($payload) { - if (is_array($payload)) - { + if (is_array($payload)) { $this->payload = $payload; return $this; } - if (is_string($payload)) - { + if (is_string($payload)) { $this->payload = json_decode($payload, true); } - if ($this->payload == null) - { + if ($this->payload == null) { throw new \Exception("Invalid or empty payload. Array or json format required."); } diff --git a/src/Services/ServiceListParameters/ModelParameters.php b/src/Services/ServiceListParameters/ModelParameters.php index 63b58bf4..f43c2479 100644 --- a/src/Services/ServiceListParameters/ModelParameters.php +++ b/src/Services/ServiceListParameters/ModelParameters.php @@ -63,10 +63,8 @@ public function __construct( */ public function data(): ServiceList { - foreach ($this->model->toArray() as $key => $value) - { - if (! is_array($value)) - { + foreach ($this->model->toArray() as $key => $value) { + if (!is_array($value)) { $this->appendParameter( $this->groupKey($key), $this->groupType($key), @@ -85,8 +83,7 @@ public function data(): ServiceList */ private function groupKey($key) { - if ($this->model instanceof ServiceParameter && ! $this->groupKey) - { + if ($this->model instanceof ServiceParameter && !$this->groupKey) { return $this->model->getGroupKey($key); } @@ -99,8 +96,7 @@ private function groupKey($key) */ private function groupType($key) { - if ($this->model instanceof ServiceParameter && ! $this->groupType) - { + if ($this->model instanceof ServiceParameter && !$this->groupType) { return $this->model->getGroupType($key); } diff --git a/src/Services/ServiceListParameters/ServiceListParameter.php b/src/Services/ServiceListParameters/ServiceListParameter.php index 2345a3c4..5101569e 100644 --- a/src/Services/ServiceListParameters/ServiceListParameter.php +++ b/src/Services/ServiceListParameters/ServiceListParameter.php @@ -63,8 +63,7 @@ public function data(): ServiceList */ protected function appendParameter(?int $groupKey, ?string $groupType, string $name, $value) { - if (! is_null($value)) - { + if (!is_null($value)) { $this->serviceList->appendParameter([ "Name" => $name, "Value" => $value, diff --git a/src/Services/TraitHelpers/HasIssuers.php b/src/Services/TraitHelpers/HasIssuers.php index 0f913fab..efb1383e 100644 --- a/src/Services/TraitHelpers/HasIssuers.php +++ b/src/Services/TraitHelpers/HasIssuers.php @@ -33,22 +33,17 @@ public function issuers(): array { $request = new TransactionRequest; - try - { + try { $response = $this->client->specification($this->paymentName, $this->serviceVersion(), $request); - } catch (BuckarooException $e) - { + } catch (BuckarooException $e) { return []; } $issuerList = []; - if (isset($response->data()['Actions']['0']['RequestParameters'][0]['ListItemDescriptions'])) - { + if (isset($response->data()['Actions']['0']['RequestParameters'][0]['ListItemDescriptions'])) { $issuersData = $response->data()['Actions']['0']['RequestParameters'][0]['ListItemDescriptions']; - if (count($issuersData) > 0) - { - foreach ($issuersData as $issuer) - { + if (count($issuersData) > 0) { + foreach ($issuersData as $issuer) { $issuerList[] = ['id' => $issuer['Value'], 'name' => $issuer['Description']]; } } diff --git a/src/Transaction/Client.php b/src/Transaction/Client.php index b1e5ce3f..585c1c3e 100644 --- a/src/Transaction/Client.php +++ b/src/Transaction/Client.php @@ -26,8 +26,8 @@ use Buckaroo\Exceptions\BuckarooException; use Buckaroo\Handlers\Logging\Subject; use Buckaroo\Resources\Constants\Endpoints; -use Buckaroo\Services\TransactionHeaders\CultureHeader; use Buckaroo\Services\TransactionHeaders\ChannelHeader; +use Buckaroo\Services\TransactionHeaders\CultureHeader; use Buckaroo\Services\TransactionHeaders\DefaultHeader; use Buckaroo\Services\TransactionHeaders\HmacHeader; use Buckaroo\Services\TransactionHeaders\SoftwareHeader; @@ -202,8 +202,7 @@ protected function call($method, string $responseClass, ?Request $data = null, ? $this->config->getLogger()->info($method . ' ' . $endPoint); $this->config->getLogger()->info('HEADERS: ' . json_encode($headers)); - if ($data) - { + if ($data) { $this->config->getLogger()->info( 'PAYLOAD: ' . $data->toJson() ); @@ -228,13 +227,11 @@ protected function call($method, string $responseClass, ?Request $data = null, ? */ public function config(?Config $config = null) { - if ($config) - { + if ($config) { $this->config = $config; } - if (! $this->config) - { + if (!$this->config) { throw new BuckarooException( $this->logger, "No config has been configured. diff --git a/src/Transaction/Request/HttpClient/GuzzleHttpClientV5.php b/src/Transaction/Request/HttpClient/GuzzleHttpClientV5.php index 3593ef08..c5c6c225 100644 --- a/src/Transaction/Request/HttpClient/GuzzleHttpClientV5.php +++ b/src/Transaction/Request/HttpClient/GuzzleHttpClientV5.php @@ -53,8 +53,7 @@ public function call(string $url, array $headers, string $method, ?string $data 'body' => $data, ]); - try - { + try { $response = $this->httpClient->send($request); $result = (string) $response->getBody(); diff --git a/src/Transaction/Request/HttpClient/GuzzleHttpClientV7.php b/src/Transaction/Request/HttpClient/GuzzleHttpClientV7.php index 6ac73cdf..6c427d2a 100644 --- a/src/Transaction/Request/HttpClient/GuzzleHttpClientV7.php +++ b/src/Transaction/Request/HttpClient/GuzzleHttpClientV7.php @@ -52,8 +52,7 @@ public function call(string $url, array $headers, string $method, ?string $data $request = new Request($method, $url, $headers, $data); - try - { + try { $response = $this->httpClient->send($request, ['http_errors' => false]); $result = (string) $response->getBody(); diff --git a/src/Transaction/Request/HttpClient/HttpClientAbstract.php b/src/Transaction/Request/HttpClient/HttpClientAbstract.php index 3d70d79b..24b0f6dc 100644 --- a/src/Transaction/Request/HttpClient/HttpClientAbstract.php +++ b/src/Transaction/Request/HttpClient/HttpClientAbstract.php @@ -67,8 +67,7 @@ protected function getDecodedResult($response, $result): array { $decoded_result = json_decode($result, true); - if (is_array($decoded_result)) - { + if (is_array($decoded_result)) { return $decoded_result; } @@ -89,8 +88,7 @@ protected function convertHeadersFormat(array $headers): array { $resultHeaders = []; - foreach ($headers as $header) - { + foreach ($headers as $header) { $headerName = substr($header, 0, strpos($header, ':')); $headerValue = substr($header, strpos($header, ':') + 2); $resultHeaders[$headerName] = $headerValue; diff --git a/src/Transaction/Request/HttpClient/HttpClientFactory.php b/src/Transaction/Request/HttpClient/HttpClientFactory.php index ce0ab9cf..02f115f9 100644 --- a/src/Transaction/Request/HttpClient/HttpClientFactory.php +++ b/src/Transaction/Request/HttpClient/HttpClientFactory.php @@ -3,9 +3,9 @@ namespace Buckaroo\Transaction\Request\HttpClient; use Buckaroo\Config\Config; +use function defined; use GuzzleHttp\Client; use GuzzleHttp\ClientInterface; -use function defined; class HttpClientFactory { diff --git a/src/Transaction/Request/Request.php b/src/Transaction/Request/Request.php index 59e3e956..3eccc5ce 100644 --- a/src/Transaction/Request/Request.php +++ b/src/Transaction/Request/Request.php @@ -24,7 +24,6 @@ use ArrayAccess; use Buckaroo\Resources\Arrayable; -use Exception; use JsonSerializable; class Request implements JsonSerializable, ArrayAccess, Arrayable @@ -45,11 +44,9 @@ class Request implements JsonSerializable, ArrayAccess, Arrayable */ public function offsetSet($offset, $value): void { - if (is_null($offset)) - { + if (is_null($offset)) { $this->data[] = $value; - } else - { + } else { $this->data[$offset] = $value; } } @@ -107,8 +104,7 @@ public function setHeader($name, $value) */ public function getHeader($name) { - if (isset($this->headers[strtolower($name)])) - { + if (isset($this->headers[strtolower($name)])) { return $this->headers[strtolower($name)]; } diff --git a/src/Transaction/Request/TransactionRequest.php b/src/Transaction/Request/TransactionRequest.php index bd0bb600..f1cadac1 100644 --- a/src/Transaction/Request/TransactionRequest.php +++ b/src/Transaction/Request/TransactionRequest.php @@ -40,8 +40,7 @@ public function __construct() */ public function setPayload(Model $model) { - foreach ($model->toArray() as $key => $value) - { + foreach ($model->toArray() as $key => $value) { $this->data[$model->serviceParameterKeyOf($key)] = $value; } @@ -83,10 +82,8 @@ public function getServices() : Services */ public function toArray(): array { - foreach ($this->data as $key => $value) - { - if (is_a($value, Arrayable::class)) - { + foreach ($this->data as $key => $value) { + if (is_a($value, Arrayable::class)) { $this->data[$key] = $value->toArray(); } } diff --git a/src/Transaction/Response/Response.php b/src/Transaction/Response/Response.php index 59c464f7..863e3501 100644 --- a/src/Transaction/Response/Response.php +++ b/src/Transaction/Response/Response.php @@ -83,8 +83,7 @@ public function __call($method, $args) $param = substr($method, 3); // $arg = isset($args[0]) ? $args[0] : null; - if ($prefix === 'get') - { + if ($prefix === 'get') { return $this->offsetGet($param); } diff --git a/src/Transaction/Response/TransactionResponse.php b/src/Transaction/Response/TransactionResponse.php index 0c419593..7d16535f 100644 --- a/src/Transaction/Response/TransactionResponse.php +++ b/src/Transaction/Response/TransactionResponse.php @@ -105,10 +105,8 @@ public function isValidationFailure(): bool */ public function data(?string $key = null) { - if ($key) - { - if (isset($this->data[$key])) - { + if ($key) { + if (isset($this->data[$key])) { return $this->data[$key]; } @@ -123,7 +121,7 @@ public function data(?string $key = null) */ public function hasRedirect(): bool { - return ! empty($this->data['RequiredAction']['RedirectURL']) + return !empty($this->data['RequiredAction']['RedirectURL']) && $this->data['RequiredAction']['Name'] == 'Redirect'; } @@ -132,8 +130,7 @@ public function hasRedirect(): bool */ public function getRedirectUrl(): string { - if ($this->hasRedirect()) - { + if ($this->hasRedirect()) { return $this->data['RequiredAction']['RedirectURL']; } @@ -163,14 +160,12 @@ public function getServiceAction(): string */ public function getServiceParameters() { - if (! empty($this->data['Services'][0]['Parameters'])) - { + if (!empty($this->data['Services'][0]['Parameters'])) { $parameters = $this->data['Services'][0]['Parameters']; $params = []; - foreach ($parameters as $key => $parameter) - { + foreach ($parameters as $key => $parameter) { // key to lowercase to be consistent with PaymentResult version of getServiceParameters $params[strtolower($parameter['Name'])] = $parameter['Value']; } @@ -186,14 +181,12 @@ public function getServiceParameters() */ public function getCustomParameters(): array { - if (! empty($this->data['CustomParameters']['List'])) - { + if (!empty($this->data['CustomParameters']['List'])) { $parameters = $this->data['CustomParameters']['List']; $params = []; - foreach ($parameters as $key => $parameter) - { + foreach ($parameters as $key => $parameter) { $params[$parameter['Name']] = $parameter['Value']; } @@ -208,14 +201,12 @@ public function getCustomParameters(): array */ public function getAdditionalParameters(): array { - if (! empty($this->data['AdditionalParameters']['AdditionalParameter'])) - { + if (!empty($this->data['AdditionalParameters']['AdditionalParameter'])) { $parameters = $this->data['AdditionalParameters']['AdditionalParameter']; $params = []; - foreach ($parameters as $key => $parameter) - { + foreach ($parameters as $key => $parameter) { $params[$parameter['Name']] = $parameter['Value']; } @@ -290,8 +281,7 @@ public function getInvoice(): string */ public function getStatusCode(): ?int { - if (! empty($this->data['Status']['Code']['Code'])) - { + if (!empty($this->data['Status']['Code']['Code'])) { return $this->data['Status']['Code']['Code']; } @@ -303,8 +293,7 @@ public function getStatusCode(): ?int */ public function getSubStatusCode(): ?string { - if (! empty($this->data['Status']['SubCode']['Code'])) - { + if (!empty($this->data['Status']['SubCode']['Code'])) { return $this->data['Status']['SubCode']['Code']; } @@ -318,7 +307,7 @@ public function hasSomeError(): bool { $getError = $this->getSomeError(); - return ! empty($getError); + return !empty($getError); } /** @@ -326,25 +315,21 @@ public function hasSomeError(): bool */ public function getSomeError(): string { - if ($this->hasError()) - { + if ($this->hasError()) { $error = $this->getFirstError(); return $error['ErrorMessage']; } - if ($this->hasConsumerMessage()) - { + if ($this->hasConsumerMessage()) { return $this->getConsumerMessage(); } - if ($this->hasMessage()) - { + if ($this->hasMessage()) { return $this->getMessage(); } - if ($this->hasSubCodeMessage()) - { + if ($this->hasSubCodeMessage()) { return $this->getSubCodeMessage(); } @@ -356,12 +341,12 @@ public function getSomeError(): string */ public function hasError(): bool { - return ! empty($this->data['RequestErrors']) && ( - ! empty($this->data['RequestErrors']['ChannelErrors']) || - ! empty($this->data['RequestErrors']['ServiceErrors']) || - ! empty($this->data['RequestErrors']['ActionErrors']) || - ! empty($this->data['RequestErrors']['ParameterErrors']) || - ! empty($this->data['RequestErrors']['CustomParameterErrors']) + return !empty($this->data['RequestErrors']) && ( + !empty($this->data['RequestErrors']['ChannelErrors']) || + !empty($this->data['RequestErrors']['ServiceErrors']) || + !empty($this->data['RequestErrors']['ActionErrors']) || + !empty($this->data['RequestErrors']['ParameterErrors']) || + !empty($this->data['RequestErrors']['CustomParameterErrors']) ); } @@ -372,12 +357,9 @@ public function getFirstError(): array { $errorTypes = ['ChannelErrors', 'ServiceErrors', 'ActionErrors', 'ParameterErrors', 'CustomParameterErrors']; - if ($this->hasError()) - { - foreach ($errorTypes as $errorType) - { - if (! empty($this->data['RequestErrors'][$errorType])) - { + if ($this->hasError()) { + foreach ($errorTypes as $errorType) { + if (!empty($this->data['RequestErrors'][$errorType])) { return $this->data['RequestErrors'][$errorType][0]; } } @@ -391,7 +373,7 @@ public function getFirstError(): array */ public function hasMessage(): bool { - return ! empty($this->data['Message']); + return !empty($this->data['Message']); } /** @@ -407,7 +389,7 @@ public function getMessage(): string */ public function hasConsumerMessage(): bool { - return ! empty($this->data['ConsumerMessage']['HtmlText']); + return !empty($this->data['ConsumerMessage']['HtmlText']); } /** @@ -415,8 +397,7 @@ public function hasConsumerMessage(): bool */ public function getConsumerMessage(): string { - if ($this->hasConsumerMessage()) - { + if ($this->hasConsumerMessage()) { return $this->data['ConsumerMessage']['HtmlText']; } @@ -428,7 +409,7 @@ public function getConsumerMessage(): string */ public function hasSubCodeMessage(): bool { - return ! empty($this->data['Status']['SubCode']['Description']); + return !empty($this->data['Status']['SubCode']['Description']); } /** @@ -436,8 +417,7 @@ public function hasSubCodeMessage(): bool */ public function getSubCodeMessage(): string { - if ($this->hasSubCodeMessage()) - { + if ($this->hasSubCodeMessage()) { return $this->data['Status']['SubCode']['Description']; }