Allow running Credit transactions by referencing a Gateway Txn ID #91
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I submitted a project for certification by Heartland only to have it rejected because the Refund test case did not reference the original transaction. As the SDK did not allow these reference transactions, this patch adds support for it.
Although no additional data is required beyond the transactionId, the PaymentMethods/Credit class is protected so we needed to either remove the 'protected' keyword or create a new (empty) sub-class; I went with the latter and created PaymentMethods/CreditCardReference.
ITokenizable needed to be removed from PaymentMethods/Credit as otherwise Portico rejected the transaction due to
<CardData><TokenRequest>N</TokenRequest></CardData>
not being allowed when running transactions by the Gateway Txn ID without card data. ITokenizable was then added to PaymentMethods/CreditCardData and PaymentMethods/CreditTrackData so it's still sent when card data is present.A new interface IReferencable was then created so we don't send
<GatewayTxnId>
with every transaction.The withTransactionId() function in Builders/AuthorizationBuilder not only did not set $transactionId correctly, it also clobbered paymentMethod. This has been fixed.
To use, first either set
$card = new CreditCardReference();
if you only have the Gateway Txn ID, or set$card = new CreditCardData();
and fill out the card data if you want to also pass the card number to the gateway. Then just->withTransactionId( $gatewayTxnId )
. Test case example: