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

Allow running Credit transactions by referencing a Gateway Txn ID #91

Open
wants to merge 1 commit into
base: master
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
6 changes: 5 additions & 1 deletion src/Builders/AuthorizationBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -1057,7 +1057,11 @@ public function withRequestMultiUseToken($requestMultiUseToken)
*/
public function withTransactionId($transactionId)
{
$this->paymentMethod = new TransactionReference($transactionId);
if ($this->paymentMethod === null)
$this->paymentMethod = new TransactionReference();

$this->paymentMethod->transactionId = $transactionId;

return $this;
}

Expand Down
4 changes: 4 additions & 0 deletions src/Gateways/PorticoConnector.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
use GlobalPayments\Api\PaymentMethods\Interfaces\IEncryptable;
use GlobalPayments\Api\PaymentMethods\Interfaces\IPaymentMethod;
use GlobalPayments\Api\PaymentMethods\Interfaces\IPinProtected;
use GlobalPayments\Api\PaymentMethods\Interfaces\IReferencable;
use GlobalPayments\Api\PaymentMethods\Interfaces\ITokenizable;
use GlobalPayments\Api\PaymentMethods\Interfaces\ITrackData;
use GlobalPayments\Api\PaymentMethods\RecurringPaymentMethod;
Expand Down Expand Up @@ -377,6 +378,9 @@ public function processAuthorization(AuthorizationBuilder $builder)
$block1->appendChild($xml->createElement('GatewayTxnId', $builder->paymentMethod->transactionId));
$block1->appendChild($xml->createElement('ClientTxnId', $builder->paymentMethod->clientTransactionId));
}
else if ($builder->paymentMethod instanceof IReferencable && !empty($builder->paymentMethod->transactionId)) {
$block1->appendChild($xml->createElement('GatewayTxnId', $builder->paymentMethod->transactionId));
}

if ($builder->paymentMethod instanceof RecurringPaymentMethod) {
$method = $builder->paymentMethod;
Expand Down
4 changes: 2 additions & 2 deletions src/PaymentMethods/Credit.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,18 @@
use GlobalPayments\Api\PaymentMethods\Interfaces\IEncryptable;
use GlobalPayments\Api\PaymentMethods\Interfaces\IPaymentMethod;
use GlobalPayments\Api\PaymentMethods\Interfaces\IPrePayable;
use GlobalPayments\Api\PaymentMethods\Interfaces\IReferencable;
use GlobalPayments\Api\PaymentMethods\Interfaces\IRefundable;
use GlobalPayments\Api\PaymentMethods\Interfaces\IReversable;
use GlobalPayments\Api\PaymentMethods\Interfaces\ISecure3d;
use GlobalPayments\Api\PaymentMethods\Interfaces\ITokenizable;
use GlobalPayments\Api\PaymentMethods\Interfaces\IVerifyable;

abstract class Credit implements
IPaymentMethod,
IEncryptable,
ITokenizable,
IChargable,
IAuthable,
IReferencable,
IRefundable,
IReversable,
IVerifyable,
Expand Down
3 changes: 2 additions & 1 deletion src/PaymentMethods/CreditCardData.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,13 @@
use GlobalPayments\Api\Entities\Enums\CvnPresenceIndicator;
use GlobalPayments\Api\Entities\Enums\TransactionType;
use GlobalPayments\Api\PaymentMethods\Interfaces\ICardData;
use GlobalPayments\Api\PaymentMethods\Interfaces\ITokenizable;
use GlobalPayments\Api\Entities\Enums\DccProcessor;
use GlobalPayments\Api\Entities\Enums\DccRateType;
use GlobalPayments\Api\Entities\DccRateData;
use GlobalPayments\Api\Entities\ThreeDSecure;

class CreditCardData extends Credit implements ICardData
class CreditCardData extends Credit implements ITokenizable, ICardData
{
/**
* Card number
Expand Down
16 changes: 16 additions & 0 deletions src/PaymentMethods/CreditCardReference.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<?php

namespace GlobalPayments\Api\PaymentMethods;

use GlobalPayments\Api\Builders\AuthorizationBuilder;
use GlobalPayments\Api\Builders\ManagementBuilder;
use GlobalPayments\Api\Entities\Enums\CvnPresenceIndicator;
use GlobalPayments\Api\Entities\Enums\TransactionType;
use GlobalPayments\Api\Entities\Enums\DccProcessor;
use GlobalPayments\Api\Entities\Enums\DccRateType;
use GlobalPayments\Api\Entities\DccRateData;
use GlobalPayments\Api\Entities\ThreeDSecure;

class CreditCardReference extends Credit
{
}
3 changes: 2 additions & 1 deletion src/PaymentMethods/CreditTrackData.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,11 @@

namespace GlobalPayments\Api\PaymentMethods;

use GlobalPayments\Api\PaymentMethods\Interfaces\ITokenizable;
use GlobalPayments\Api\PaymentMethods\Interfaces\ITrackData;
use GlobalPayments\Api\Utils\CardUtils;

class CreditTrackData extends Credit implements ITrackData
class CreditTrackData extends Credit implements ITokenizable, ITrackData
{
public $entryMethod;
public $value;
Expand Down
7 changes: 7 additions & 0 deletions src/PaymentMethods/Interfaces/IReferencable.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?php

namespace GlobalPayments\Api\PaymentMethods\Interfaces;

interface IReferencable
{
}