Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feat: Add support for industry practice transaction indicators #43

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/Json/JsonGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -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()),
Expand Down Expand Up @@ -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,
];

Expand Down Expand Up @@ -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()),
Expand Down Expand Up @@ -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()) {
Expand Down
1 change: 1 addition & 0 deletions src/Transaction/Base/IndicatorInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,5 @@ public function getTransactionIndicator();
* @return $this
*/
public function setTransactionIndicator($transactionIndicator);

}
1 change: 1 addition & 0 deletions src/Transaction/Base/IndicatorTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,5 @@ public function setTransactionIndicator($transactionIndicator)

return $this;
}

}
21 changes: 21 additions & 0 deletions src/Transaction/Base/IndustryPracticeInterface.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php

namespace Ixopay\Client\Transaction\Base;

interface IndustryPracticeInterface
{
/**
* 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);
}
33 changes: 33 additions & 0 deletions src/Transaction/Base/IndustryPracticeTrait.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?php

namespace Ixopay\Client\Transaction\Base;

trait IndustryPracticeTrait
{

/**
* @var string
*/
private $industryPractice;

/**
* 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;
}
}
38 changes: 22 additions & 16 deletions src/Transaction/Debit.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand All @@ -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';
Expand Down Expand Up @@ -105,7 +109,8 @@ public function setTransactionToken($transactionToken)
/**
* @return boolean
*/
public function isWithRegister() {
public function isWithRegister()
{
return $this->withRegister;
}

Expand All @@ -116,7 +121,8 @@ public function isWithRegister() {
*
* @return $this
*/
public function setWithRegister($withRegister) {
public function setWithRegister($withRegister)
{
$this->withRegister = $withRegister;
return $this;
}
Expand Down
17 changes: 11 additions & 6 deletions src/Transaction/IncrementalAuthorization.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
}
}
18 changes: 11 additions & 7 deletions src/Transaction/Payout.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -42,6 +45,7 @@ class Payout extends AbstractTransactionWithReference
use PayByLinkTrait;
use IndicatorTrait;
use LevelTwoAndThreeDataTrait;
use IndustryPracticeTrait;

/** @var string */
protected $transactionToken;
Expand Down
40 changes: 23 additions & 17 deletions src/Transaction/Preauthorize.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand All @@ -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';
Expand Down Expand Up @@ -108,7 +112,8 @@ public function setTransactionToken($transactionToken)
/**
* @return boolean
*/
public function isWithRegister() {
public function isWithRegister()
{
return $this->withRegister;
}

Expand All @@ -119,7 +124,8 @@ public function isWithRegister() {
*
* @return $this
*/
public function setWithRegister($withRegister) {
public function setWithRegister($withRegister)
{
$this->withRegister = $withRegister;
return $this;
}
Expand Down Expand Up @@ -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)
Expand Down
19 changes: 12 additions & 7 deletions src/Transaction/Register.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -44,6 +47,7 @@ class Register extends AbstractTransaction
use PayByLinkTrait;
use IndicatorTrait;
use LevelTwoAndThreeDataTrait;
use IndustryPracticeTrait;

/** @var string */
protected $language;
Expand Down Expand Up @@ -87,4 +91,5 @@ public function setLanguage($language)
{
$this->language = $language;
}

}