Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
public static PaymentParams createReversal(String trxReference) {
        PaymentParams params = new PaymentParams(PaymentServiceID.Cancellation);
        
        //Date //Time //Timezone of current transaction // cancellation in our case
        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);
        params.paramTree.AddEMVDate(ArkosTags.TransactionDate, cal.get(Calendar.YEAR) % 100, cal.get(Calendar.MONTH) + 1, cal.get(Calendar.DAY_OF_MONTH));
        params.paramTree.AddEMVTime(ArkosTags.TransactionTime, cal.get(Calendar.HOUR_OF_DAY), cal.get(Calendar.MINUTE), cal.get(Calendar.SECOND));
        params.paramTree.AddBin(ArkosTags.LocalTimezone, utcOffset);
        
        params .AddBin(ArkosTags.TransactionAmount, new byte[] { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 });
        params .AddBin(ArkosTags.AmountAuthorised, new byte[] { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 });
        params .AddBin(ArkosTags.TransactionAmountBeforeAdjustment, new byte[] { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 });
        
        //Language of current transaction
        params.paramTree.AddAscii(ArkosTags.SelectedLanguage, "en");
        
        //Date //Time //Timezone of original transaction
        TlvTree originalTransaction = params.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_OF_DAY), cal.get(Calendar.MINUTE), cal.get(Calendar.SECOND));
        originalTransaction.AddAscii(ArkosTags.ReferenceData,"1234567890");
        originalTransaction.AddEnumparamTree.AddBin(ArkosTags.SelectedServiceLocalTimezone, PaymentServiceID.PaymentutcOffset);
        
        params originalTransaction.AddBinAddAscii(ArkosTags.TransactionAmount, new byte[] { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }ReferenceData, trxReference);
        params originalTransaction.AddBinAddEnum(ArkosTags.AmountAuthorised, new byte[] { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 });
        params .AddBin(ArkosTags.TransactionAmountBeforeAdjustment, new byte[] { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 });SelectedService, PaymentServiceID.Payment);
        
      
        return params;
    }

It is to be noted that, upon carrying out a cancellation/reversal, the transaction reference is now set under the TlvTree Original Transaction.

...