From 4f7e9c27b71b8b86828314d5eb1284c0e2808490 Mon Sep 17 00:00:00 2001 From: "m.abdou" Date: Fri, 5 Jul 2024 12:52:53 +0200 Subject: [PATCH 1/3] Feat: Add support for industry practice transaction indicators --- src/Json/JsonGenerator.php | 4 ++++ src/Transaction/Base/IndicatorInterface.php | 16 +++++++++++++ src/Transaction/Base/IndicatorTrait.php | 26 +++++++++++++++++++++ 3 files changed, 46 insertions(+) diff --git a/src/Json/JsonGenerator.php b/src/Json/JsonGenerator.php index 8ccfdcc..fc092bb 100644 --- a/src/Json/JsonGenerator.php +++ b/src/Json/JsonGenerator.php @@ -164,6 +164,7 @@ protected function createDebit($transaction, $language){ 'splits' => $this->createSplits($transaction->getTransactionSplits()), 'withRegister' => $transaction->isWithRegister(), 'transactionIndicator' => $transaction->getTransactionIndicator(), + 'industryPractice' => $transaction->getIndustryPractice(), 'customer' => $this->createCustomer($transaction->getCustomer()), 'schedule' => $this->createSchedule($transaction->getSchedule()), 'customerProfileData' => $this->createAddToCustomerProfile($transaction->getCustomerProfileData()), @@ -217,6 +218,7 @@ protected function createIncrementalAuthorization($transaction, $language) { 'description' => $transaction->getDescription(), 'items' => $this->createItems($transaction->getItems()), 'transactionIndicator' => $transaction->getTransactionIndicator(), + 'industryPractice' => $transaction->getIndustryPractice(), 'language' => $language, ]; @@ -292,6 +294,7 @@ protected function createRegister($transaction, $language){ 'transactionToken' => $transaction->getTransactionToken(), 'description' => $transaction->getDescription(), 'transactionIndicator' => $transaction->getTransactionIndicator(), + 'industryPractice' => $transaction->getIndustryPractice(), 'customer' => $this->createCustomer($transaction->getCustomer()), 'schedule' => $this->createSchedule($transaction->getSchedule()), 'customerProfileData' => $this->createAddToCustomerProfile($transaction->getCustomerProfileData()), @@ -378,6 +381,7 @@ protected function createPayout($transaction, $language){ 'customer' => $this->createCustomer($transaction->getCustomer()), 'language' => $language, 'transactionIndicator' => $transaction->getTransactionIndicator(), + 'industryPractice' => $transaction->getIndustryPractice(), ]; if ($transaction->getL2L3Data()) { diff --git a/src/Transaction/Base/IndicatorInterface.php b/src/Transaction/Base/IndicatorInterface.php index 5a36cf4..479b3e4 100644 --- a/src/Transaction/Base/IndicatorInterface.php +++ b/src/Transaction/Base/IndicatorInterface.php @@ -15,4 +15,20 @@ public function getTransactionIndicator(); * @return $this */ public function setTransactionIndicator($transactionIndicator); + + + /** + * Get the industry practice indicator. + * + * @return string|null + */ + public function getIndustryPractice(); + + /** + * Set the industry practice indicator. + * + * @param string|null $industryPractice + * @return $this + */ + public function setIndustryPractice( $industryPractice); } diff --git a/src/Transaction/Base/IndicatorTrait.php b/src/Transaction/Base/IndicatorTrait.php index 12cfb4c..4769604 100644 --- a/src/Transaction/Base/IndicatorTrait.php +++ b/src/Transaction/Base/IndicatorTrait.php @@ -9,6 +9,11 @@ trait IndicatorTrait */ protected $transactionIndicator; + /** + * @var string + */ + private $industryPractice; + /** * @return string */ @@ -26,4 +31,25 @@ public function setTransactionIndicator($transactionIndicator) return $this; } + + /** + * Get the industry practice indicator. + * + * @return string|null + */ + public function getIndustryPractice() + { + return $this->industryPractice; + } + + /** + * Set the industry practice indicator. + * + * @param string|null $industryPractice + * @return void + */ + public function setIndustryPractice( $industryPractice) + { + $this->industryPractice = $industryPractice; + } } From c85d7e691d5682c2f7c531825b5c94edd7e5a37b Mon Sep 17 00:00:00 2001 From: "m.abdou" Date: Thu, 18 Jul 2024 13:48:18 +0200 Subject: [PATCH 2/3] Feat: add industy trait & interface --- src/Transaction/Base/IndicatorInterface.php | 15 ------- src/Transaction/Base/IndicatorTrait.php | 25 ------------ .../Base/IndustryPracticeInterface.php | 21 ++++++++++ .../Base/IndustryPracticeTrait.php | 33 +++++++++++++++ src/Transaction/Debit.php | 38 ++++++++++-------- src/Transaction/IncrementalAuthorization.php | 17 +++++--- src/Transaction/Payout.php | 18 +++++---- src/Transaction/Preauthorize.php | 40 +++++++++++-------- src/Transaction/Register.php | 19 +++++---- 9 files changed, 133 insertions(+), 93 deletions(-) create mode 100644 src/Transaction/Base/IndustryPracticeInterface.php create mode 100644 src/Transaction/Base/IndustryPracticeTrait.php diff --git a/src/Transaction/Base/IndicatorInterface.php b/src/Transaction/Base/IndicatorInterface.php index 479b3e4..86887a8 100644 --- a/src/Transaction/Base/IndicatorInterface.php +++ b/src/Transaction/Base/IndicatorInterface.php @@ -16,19 +16,4 @@ public function getTransactionIndicator(); */ public function setTransactionIndicator($transactionIndicator); - - /** - * Get the industry practice indicator. - * - * @return string|null - */ - public function getIndustryPractice(); - - /** - * Set the industry practice indicator. - * - * @param string|null $industryPractice - * @return $this - */ - public function setIndustryPractice( $industryPractice); } diff --git a/src/Transaction/Base/IndicatorTrait.php b/src/Transaction/Base/IndicatorTrait.php index 4769604..51f69f4 100644 --- a/src/Transaction/Base/IndicatorTrait.php +++ b/src/Transaction/Base/IndicatorTrait.php @@ -9,11 +9,6 @@ trait IndicatorTrait */ protected $transactionIndicator; - /** - * @var string - */ - private $industryPractice; - /** * @return string */ @@ -32,24 +27,4 @@ public function setTransactionIndicator($transactionIndicator) return $this; } - /** - * Get the industry practice indicator. - * - * @return string|null - */ - public function getIndustryPractice() - { - return $this->industryPractice; - } - - /** - * Set the industry practice indicator. - * - * @param string|null $industryPractice - * @return void - */ - public function setIndustryPractice( $industryPractice) - { - $this->industryPractice = $industryPractice; - } } diff --git a/src/Transaction/Base/IndustryPracticeInterface.php b/src/Transaction/Base/IndustryPracticeInterface.php new file mode 100644 index 0000000..b4c0f06 --- /dev/null +++ b/src/Transaction/Base/IndustryPracticeInterface.php @@ -0,0 +1,21 @@ +industryPractice; + } + + /** + * Set the industry practice indicator. + * + * @param string|null $industryPractice + * @return void + */ + public function setIndustryPractice($industryPractice) + { + $this->industryPractice = $industryPractice; + } +} diff --git a/src/Transaction/Debit.php b/src/Transaction/Debit.php index d3fea84..f86ef5a 100644 --- a/src/Transaction/Debit.php +++ b/src/Transaction/Debit.php @@ -11,6 +11,8 @@ use Ixopay\Client\Transaction\Base\CustomerTrait; use Ixopay\Client\Transaction\Base\IndicatorInterface; use Ixopay\Client\Transaction\Base\IndicatorTrait; +use Ixopay\Client\Transaction\Base\industryPracticeInterface; +use Ixopay\Client\Transaction\Base\industryPracticeTrait; use Ixopay\Client\Transaction\Base\ItemsInterface; use Ixopay\Client\Transaction\Base\ItemsTrait; use Ixopay\Client\Transaction\Base\LevelTwoAndThreeDataInterface; @@ -39,20 +41,21 @@ * @package Ixopay\Client\Transaction */ class Debit extends AbstractTransactionWithReference - implements AddToCustomerProfileInterface, - AmountableInterface, - CustomerInterface, - ItemsInterface, - TransactionSplitsInterface, - OffsiteInterface, - ScheduleInterface, - ThreeDSecureInterface, - IndicatorInterface, - DccDataInterface, - SurchargeInterface, - ReferenceSchemeTransactionIdentifierInterface, - RecipientAccountPanInterface, - LevelTwoAndThreeDataInterface + implements AddToCustomerProfileInterface, + AmountableInterface, + CustomerInterface, + ItemsInterface, + TransactionSplitsInterface, + OffsiteInterface, + ScheduleInterface, + ThreeDSecureInterface, + IndicatorInterface, + DccDataInterface, + SurchargeInterface, + ReferenceSchemeTransactionIdentifierInterface, + RecipientAccountPanInterface, + LevelTwoAndThreeDataInterface, + industryPracticeInterface { use AddToCustomerProfileTrait; use AmountableTrait; @@ -69,6 +72,7 @@ class Debit extends AbstractTransactionWithReference use ReferenceSchemeTransactionIdentifierTrait; use RecipientAccountPanTrait; use LevelTwoAndThreeDataTrait; + use industryPracticeTrait; const TRANSACTION_INDICATOR_SINGLE = 'SINGLE'; const TRANSACTION_INDICATOR_INITIAL = 'INITIAL'; @@ -105,7 +109,8 @@ public function setTransactionToken($transactionToken) /** * @return boolean */ - public function isWithRegister() { + public function isWithRegister() + { return $this->withRegister; } @@ -116,7 +121,8 @@ public function isWithRegister() { * * @return $this */ - public function setWithRegister($withRegister) { + public function setWithRegister($withRegister) + { $this->withRegister = $withRegister; return $this; } diff --git a/src/Transaction/IncrementalAuthorization.php b/src/Transaction/IncrementalAuthorization.php index f950b5d..66f295e 100644 --- a/src/Transaction/IncrementalAuthorization.php +++ b/src/Transaction/IncrementalAuthorization.php @@ -7,6 +7,8 @@ use Ixopay\Client\Transaction\Base\AmountableTrait; use Ixopay\Client\Transaction\Base\IndicatorInterface; use Ixopay\Client\Transaction\Base\IndicatorTrait; +use Ixopay\Client\Transaction\Base\industryPracticeInterface; +use Ixopay\Client\Transaction\Base\industryPracticeTrait; use Ixopay\Client\Transaction\Base\ItemsInterface; use Ixopay\Client\Transaction\Base\ItemsTrait; use Ixopay\Client\Transaction\Base\LevelTwoAndThreeDataInterface; @@ -19,22 +21,25 @@ * @package IxopayV2\Transaction */ class IncrementalAuthorization extends AbstractTransactionWithReference - implements AmountableInterface, - OffsiteInterface, - ItemsInterface, - IndicatorInterface, - LevelTwoAndThreeDataInterface + implements AmountableInterface, + OffsiteInterface, + ItemsInterface, + IndicatorInterface, + LevelTwoAndThreeDataInterface, + industryPracticeInterface { use OffsiteTrait; use AmountableTrait; use ItemsTrait; use IndicatorTrait; use LevelTwoAndThreeDataTrait; + use industryPracticeTrait; /** * @return string */ - public function getTransactionMethod() { + public function getTransactionMethod() + { return self::TRANSACTION_METHOD_INCREMENTAL_AUTHORIZATION; } } diff --git a/src/Transaction/Payout.php b/src/Transaction/Payout.php index 46be38d..95fb36d 100644 --- a/src/Transaction/Payout.php +++ b/src/Transaction/Payout.php @@ -8,6 +8,8 @@ use Ixopay\Client\Transaction\Base\CustomerInterface; use Ixopay\Client\Transaction\Base\CustomerTrait; use Ixopay\Client\Transaction\Base\IndicatorInterface; +use Ixopay\Client\Transaction\Base\IndustryPracticeInterface; +use Ixopay\Client\Transaction\Base\IndustryPracticeTrait; use Ixopay\Client\Transaction\Base\ItemsInterface; use Ixopay\Client\Transaction\Base\ItemsTrait; use Ixopay\Client\Transaction\Base\LevelTwoAndThreeDataInterface; @@ -25,13 +27,14 @@ * @package Ixopay\Client\Transaction */ class Payout extends AbstractTransactionWithReference - implements AmountableInterface, - CustomerInterface, - ItemsInterface, - OffsiteInterface, - TransactionSplitsInterface, - IndicatorInterface, - LevelTwoAndThreeDataInterface + implements AmountableInterface, + CustomerInterface, + ItemsInterface, + OffsiteInterface, + TransactionSplitsInterface, + IndicatorInterface, + LevelTwoAndThreeDataInterface, + IndustryPracticeInterface { use AmountableTrait; @@ -42,6 +45,7 @@ class Payout extends AbstractTransactionWithReference use PayByLinkTrait; use IndicatorTrait; use LevelTwoAndThreeDataTrait; + use IndustryPracticeTrait; /** @var string */ protected $transactionToken; diff --git a/src/Transaction/Preauthorize.php b/src/Transaction/Preauthorize.php index 78c09ce..cd3dc5b 100644 --- a/src/Transaction/Preauthorize.php +++ b/src/Transaction/Preauthorize.php @@ -11,6 +11,8 @@ use Ixopay\Client\Transaction\Base\CustomerTrait; use Ixopay\Client\Transaction\Base\IndicatorInterface; use Ixopay\Client\Transaction\Base\IndicatorTrait; +use Ixopay\Client\Transaction\Base\industryPracticeInterface; +use Ixopay\Client\Transaction\Base\industryPracticeTrait; use Ixopay\Client\Transaction\Base\ItemsInterface; use Ixopay\Client\Transaction\Base\ItemsTrait; use Ixopay\Client\Transaction\Base\LevelTwoAndThreeDataInterface; @@ -39,20 +41,21 @@ * @package Ixopay\Client\Transaction */ class Preauthorize extends AbstractTransactionWithReference - implements AddToCustomerProfileInterface, - AmountableInterface, - CustomerInterface, - ItemsInterface, - TransactionSplitsInterface, - OffsiteInterface, - ScheduleInterface, - ThreeDSecureInterface, - IndicatorInterface, - DccDataInterface, - SurchargeInterface, - ReferenceSchemeTransactionIdentifierInterface, - RecipientAccountPanInterface, - LevelTwoAndThreeDataInterface + implements AddToCustomerProfileInterface, + AmountableInterface, + CustomerInterface, + ItemsInterface, + TransactionSplitsInterface, + OffsiteInterface, + ScheduleInterface, + ThreeDSecureInterface, + IndicatorInterface, + DccDataInterface, + SurchargeInterface, + ReferenceSchemeTransactionIdentifierInterface, + RecipientAccountPanInterface, + LevelTwoAndThreeDataInterface, + industryPracticeInterface { use AddToCustomerProfileTrait; @@ -70,6 +73,7 @@ class Preauthorize extends AbstractTransactionWithReference use ReferenceSchemeTransactionIdentifierTrait; use RecipientAccountPanTrait; use LevelTwoAndThreeDataTrait; + use industryPracticeTrait; const TRANSACTION_INDICATOR_SINGLE = 'SINGLE'; const TRANSACTION_INDICATOR_INITIAL = 'INITIAL'; @@ -108,7 +112,8 @@ public function setTransactionToken($transactionToken) /** * @return boolean */ - public function isWithRegister() { + public function isWithRegister() + { return $this->withRegister; } @@ -119,7 +124,8 @@ public function isWithRegister() { * * @return $this */ - public function setWithRegister($withRegister) { + public function setWithRegister($withRegister) + { $this->withRegister = $withRegister; return $this; } @@ -160,7 +166,7 @@ public function getCaptureInMinutes() * A value greater zero, requests the gateway to schedule a capture * automatically after n minutes. * - * @param int $captureInMinutes + * @param int $captureInMinutes * @return Preauthorize */ public function setCaptureInMinutes($captureInMinutes) diff --git a/src/Transaction/Register.php b/src/Transaction/Register.php index 0790dbe..6db507d 100644 --- a/src/Transaction/Register.php +++ b/src/Transaction/Register.php @@ -9,6 +9,8 @@ use Ixopay\Client\Transaction\Base\CustomerTrait; use Ixopay\Client\Transaction\Base\IndicatorInterface; use Ixopay\Client\Transaction\Base\IndicatorTrait; +use Ixopay\Client\Transaction\Base\IndustryPracticeInterface; +use Ixopay\Client\Transaction\Base\IndustryPracticeTrait; use Ixopay\Client\Transaction\Base\LevelTwoAndThreeDataInterface; use Ixopay\Client\Transaction\Base\LevelTwoAndThreeDataTrait; use Ixopay\Client\Transaction\Base\OffsiteInterface; @@ -27,13 +29,14 @@ * @package Ixopay\Client\Transaction */ class Register extends AbstractTransaction - implements AddToCustomerProfileInterface, - CustomerInterface, - OffsiteInterface, - ScheduleInterface, - ThreeDSecureInterface, - IndicatorInterface, - LevelTwoAndThreeDataInterface + implements AddToCustomerProfileInterface, + CustomerInterface, + OffsiteInterface, + ScheduleInterface, + ThreeDSecureInterface, + IndicatorInterface, + LevelTwoAndThreeDataInterface, + IndustryPracticeInterface { use AddToCustomerProfileTrait; @@ -44,6 +47,7 @@ class Register extends AbstractTransaction use PayByLinkTrait; use IndicatorTrait; use LevelTwoAndThreeDataTrait; + use IndustryPracticeTrait; /** @var string */ protected $language; @@ -87,4 +91,5 @@ public function setLanguage($language) { $this->language = $language; } + } From 124d06c60dea3fa2ef1715350f0e2213c8beffc9 Mon Sep 17 00:00:00 2001 From: "m.abdou" Date: Thu, 18 Jul 2024 15:57:21 +0200 Subject: [PATCH 3/3] Feat: add industy trait & interface --- src/Transaction/Debit.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Transaction/Debit.php b/src/Transaction/Debit.php index f86ef5a..6662fb9 100644 --- a/src/Transaction/Debit.php +++ b/src/Transaction/Debit.php @@ -11,8 +11,8 @@ use Ixopay\Client\Transaction\Base\CustomerTrait; use Ixopay\Client\Transaction\Base\IndicatorInterface; use Ixopay\Client\Transaction\Base\IndicatorTrait; -use Ixopay\Client\Transaction\Base\industryPracticeInterface; -use Ixopay\Client\Transaction\Base\industryPracticeTrait; +use Ixopay\Client\Transaction\Base\IndustryPracticeInterface; +use Ixopay\Client\Transaction\Base\IndustryPracticeTrait; use Ixopay\Client\Transaction\Base\ItemsInterface; use Ixopay\Client\Transaction\Base\ItemsTrait; use Ixopay\Client\Transaction\Base\LevelTwoAndThreeDataInterface; @@ -55,7 +55,7 @@ class Debit extends AbstractTransactionWithReference ReferenceSchemeTransactionIdentifierInterface, RecipientAccountPanInterface, LevelTwoAndThreeDataInterface, - industryPracticeInterface + IndustryPracticeInterface { use AddToCustomerProfileTrait; use AmountableTrait; @@ -72,7 +72,7 @@ class Debit extends AbstractTransactionWithReference use ReferenceSchemeTransactionIdentifierTrait; use RecipientAccountPanTrait; use LevelTwoAndThreeDataTrait; - use industryPracticeTrait; + use IndustryPracticeTrait; const TRANSACTION_INDICATOR_SINGLE = 'SINGLE'; const TRANSACTION_INDICATOR_INITIAL = 'INITIAL';