Amadis

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 14 Next »

See https://teamamadis.atlassian.net/wiki/pages/resumedraft.action?draftId=1713274934 for more information about the Refund Service.

Initiate a Refund without Reference Data and without Original Service

Example: Refund 12.00$

// Create the minimal parameter set

TlvTree paymentParams = TlvTree.Empty();

paymentParams.AddBin(ArkosTags.SelectedService, new byte[] { 0x00 });
// Amounts are in BCD. In most cases, all 3 amounts should be the same value.

paymentParams.AddBin(ArkosTags.TransactionAmount, new byte[] { 0x00, 0x00, 0x00, 0x00, 0x10, 0x00 });
paymentParams.AddBin(ArkosTags.AmountAuthorised, new byte[] { 0x00, 0x00, 0x00, 0x00, 0x10, 0x00 });
paymentParams.AddBin(ArkosTags.TransactionAmountBeforeAdjustment, new byte[] { 0x00, 0x00, 0x00, 0x00, 0x10, 0x00 });

// The system needs to provide the Date and Time of this transaction, and the local TimeZone
Calendar cal = Calendar.getInstance();
int utcOffsetMinutes = cal.getTimeZone().getOffset(cal.getTimeInMillis()) / 1000 / 60;
byte[] utcOffset = new byte[2];
utcOffset[0] = (byte) (utcOffsetMinutes / 60);
utcOffset[1] = (byte) (utcOffsetMinutes % 60);
paymentParams.AddEMVDate(ArkosTags.TransactionDate, cal.get(Calendar.YEAR) % 100, cal.get(Calendar.MONTH) + 1, cal.get(Calendar.DAY_OF_MONTH));
paymentParams.AddEMVTime(ArkosTags.TransactionTime, cal.get(Calendar.HOUR), cal.get(Calendar.MINUTE), cal.get(Calendar.SECOND));
paymentParams.AddBin(ArkosTags.LocalTimezone, utcOffset);

paymentParams.AddAscii(ArkosTags.SelectedLanguage, "en");

// Call to the doPayment API, sending the Arkos configuration, and parameters as a byte Array
PaymentResult result = arkos.doPayment(configuration, paymentParams.AsBytes());

Initiate a Refund with Original Service

// Refund 10.00$
TlvTree paymentParams = TlvTree.Empty();
paymentParams.AddBin(ArkosTags.SelectedService, new byte[] { 0x06 });
paymentParams.AddBin(ArkosTags.TransactionAmount, new byte[] { 0x00, 0x00, 0x00, 0x00, 0x10, 0x00 });
paymentParams.AddBin(ArkosTags.AmountAuthorised, new byte[] { 0x00, 0x00, 0x00, 0x00, 0x10, 0x00 });
paymentParams.AddBin(ArkosTags.TransactionAmountBeforeAdjustment, new byte[] { 0x00, 0x00, 0x00, 0x00, 0x10, 0x00 });
paymentParams.AddEMVDate(ArkosTags.TransactionDate, cal.get(Calendar.YEAR) % 100, cal.get(Calendar.MONTH) + 1, cal.get(Calendar.DAY_OF_MONTH));
paymentParams.AddEMVTime(ArkosTags.TransactionTime, cal.get(Calendar.HOUR), cal.get(Calendar.MINUTE), cal.get(Calendar.SECOND));
paymentParams.AddBin(ArkosTags.LocalTimezone, utcOffset);

// Add Original Transaction to the Refund
TlvTree originalTransaction = paymentParams.AddChild(ArkosTags.OriginalTransaction);
originalTransaction.AddEMVDate(ArkosTags.TransactionDate, cal.get(Calendar.YEAR) % 100, cal.get(Calendar.MONTH) + 1, cal.get(Calendar.DAY_OF_MONTH));
originalTransaction.AddEMVTime(ArkosTags.TransactionTime, cal.get(Calendar.HOUR), cal.get(Calendar.MINUTE), cal.get(Calendar.SECOND));
originalTransaction.AddBin(ArkosTags.LocalTimezone, utcOffset);
originalTransaction.AddEnum(ArkosTags.SelectedService, PaymentServiceID.Payment);

        <OrgnlTx>
          <TxId>
            <TxDtTm>2021-06-15T10:36:45.000+00:00</TxDtTm>
            <TxRef>1234567890</TxRef>
          </TxId>
          <TxTp>CRDP</TxTp>
          <CardDataNtryMd>DFLE</CardDataNtryMd>
        </OrgnlTx

Initiate a Refund with a Reference Data

When a Refund is performed, the sale system or the device control (eg. the MerchantApp) may provide Refund Reference Data as a reference to the original Service being refunded.

  • Refund Reference Data may be identical to the Reference Data of the original Service, but this is not mandatory and not checked.

  • Refund Reference Data is not used to retrieve the transaction data of the original Service, but it is stored in the transaction database for the Refund.

Below is an example on how to initiate a refund of 10.00$ using an Original Service Reference Data 1234567890.

// Refund 10.00$
TlvTree paymentParams = TlvTree.Empty();
paymentParams.AddBin(ArkosTags.SelectedService, new byte[] { 0x06 });
paymentParams.AddBin(ArkosTags.TransactionAmount, new byte[] { 0x00, 0x00, 0x00, 0x00, 0x10, 0x00 });
paymentParams.AddBin(ArkosTags.AmountAuthorised, new byte[] { 0x00, 0x00, 0x00, 0x00, 0x10, 0x00 });
paymentParams.AddBin(ArkosTags.TransactionAmountBeforeAdjustment, new byte[] { 0x00, 0x00, 0x00, 0x00, 0x10, 0x00 });
paymentParams.AddEMVDate(ArkosTags.TransactionDate, cal.get(Calendar.YEAR) % 100, cal.get(Calendar.MONTH) + 1, cal.get(Calendar.DAY_OF_MONTH));
paymentParams.AddEMVTime(ArkosTags.TransactionTime, cal.get(Calendar.HOUR), cal.get(Calendar.MINUTE), cal.get(Calendar.SECOND));
paymentParams.AddBin(ArkosTags.LocalTimezone, utcOffset);

// Specify ReferenceData
paymentParams.AddAscii(ArkosTags.RefundReferenceData,"1234567890");

// Call to the doPayment API, sending the Arkos configuration, and parameters as a byte Array
PaymentResult result = arkos.doPayment(configuration, paymentParams.AsBytes());

TlvTree originalTransaction = paymentParams.AddChild(ArkosTags.OriginalTransaction);
originalTransaction.AddEMVDate(ArkosTags.TransactionDate, cal.get(Calendar.YEAR) % 100, cal.get(Calendar.MONTH) + 1, cal.get(Calendar.DAY_OF_MONTH));
originalTransaction.AddEMVTime(ArkosTags.TransactionTime, cal.get(Calendar.HOUR), cal.get(Calendar.MINUTE), cal.get(Calendar.SECOND));
originalTransaction.AddBin(ArkosTags.LocalTimezone, utcOffset);
originalTransaction.AddAscii(ArkosTags.RefundReferenceData,"ABCD1234");
originalTransaction.AddEnum(ArkosTags.SelectedService, PaymentServiceID.Payment);

  • As this tag is optional, a check is done on the latter. If the Tag is absent, the original transaction section is not included.

Obtained XML :

        <OrgnlTx>
          <TxId>
            <TxDtTm>2021-06-15T10:36:45.000+00:00</TxDtTm>
            <TxRef>1234567890</TxRef>
          </TxId>
          <TxTp>CRDP</TxTp>
          <CardDataNtryMd>DFLE</CardDataNtryMd>
        </OrgnlTx

  • No labels