Versions Compared

Key

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

...

If you need specific values in your original transaction structures, an example will be provided below.

It is to be noted that our implementation of the original transaction structure differs in the TransactionIdentification section.

...

we decided to put the transactionReference and transactionDateTime directly in the OriginalTransaction DO to avoid unnecessary complexity.

Besides that, the same structure has been implemented and an example as mentioned above will be found below.

Code Block
public static  void createOriginalTransaction(PaymentParams params, String transactionReference, PaymentServiceID serviceID){
        TlvTree originalTrx = params.paramTree.AddChild(ArkosTags.OriginalTransaction);
        originalTrx.AddAscii(ArkosTags.SaleReferenceIdentification,"saleReferenceIdentification");

        //Date //Time //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);

        originalTrx.AddEMVDate(TransactionIdentificationID.Date, cal.get(Calendar.YEAR) % 100, cal.get(Calendar.MONTH) + 1, cal.get(Calendar.DAY_OF_MONTH));
        originalTrx.AddEMVTime(TransactionIdentificationID.Time, cal.get(Calendar.HOUR), cal.get(Calendar.MINUTE), cal.get(Calendar.SECOND));
        originalTrx.SetBin(ArkosTags.LocalTimezone, utcOffset);
        originalTrx.AddAscii(TransactionIdentificationID.ReferenceData, transactionReference);

        TlvTree poiIdentification = originalTrx.AddChild(ArkosTags.PoiIdentification);
        poiIdentification.AddAscii(POIIdentificationID.TerminalIdentification,"Terminal1");
        poiIdentification.AddEnum(POIIdentificationID.Type, POIIdentificationTypeID.ACCP);
        poiIdentification.AddEnum(POIIdentificationID.Issuer, POIIdentificationIssuerID.ACCP);
        poiIdentification.AddAscii(POIIdentificationID.ShortName,"Term");

        originalTrx.AddAscii(ArkosTags.InitiatorTransactionIdentification,"InitiatorTransactionIdentification");
        originalTrx.AddAscii(ArkosTags.RecipientTransactionIdentification,"RecipientTransactionIdentification");

        originalTrx.AddEnum(ArkosTags.SelectedService, serviceID);
        originalTrx.AddEnum(ArkosTags.TechnologySelected, SelectedTechnologyID.MagneticStripe);
//      originalTrx.AddBin(ArkosTags.CashbackPresent, new byte[]{0x01});
//      originalTrx.AddBin(ArkosTags.SupplementaryAmountPresent, new byte[]{0x01});


        TlvTree transactionResult = originalTrx.AddChild(ArkosTags.TransactionResult);
        TlvTree authorisationEntity = transactionResult.AddChild(TransactionResultID.AuthorisationEntity);
        authorisationEntity.AddAscii(AuthorisationEntityID.AuthorisationEntityIdentification,"Identification");
        authorisationEntity.AddEnum(AuthorisationEntityID.AuthorisationEntityType, AuthorisationEntityTypeID.ACCP);
        authorisationEntity.AddEnum(AuthorisationEntityID.AuthorisationEntityIssuer, AuthorisationEntityIssuerID.ACCP);
        authorisationEntity.AddAscii(AuthorisationEntityID.AuthorisationEntityCountry,"Cou");
        authorisationEntity.AddAscii(AuthorisationEntityID.AuthorisationEntityShortName,"ShortName");

        TlvTree responseToAuthorisation = transactionResult.AddChild(TransactionResultID.ResponseToAuthorisation);
        responseToAuthorisation.AddEnum(ResponseToAuthorisationID.Response, ResponseID.APPR);
        responseToAuthorisation.AddAscii(ResponseToAuthorisationID.ResponseReason,"Reason");
        responseToAuthorisation.AddAscii(ResponseToAuthorisationID.AdditionalResponseInformation,"AdditionalInformation");

        transactionResult.AddAscii(TransactionResultID.AuthorisationCode,"000001");


    }

NOTE: If your original transaction is of type payment, you can add those two tags.

Code Block
//        originalTrx.AddBin(ArkosTags.CashbackPresent, new byte[]{0x01});
//        originalTrx.AddBin(ArkosTags.SupplementaryAmountPresent, new byte[]{0x01});

How to use this with Cancellation, Update-pre auth, and Payment Completion?

Code Block
    public static PaymentParams createPaymentCompletion(String transactionReference, int amount) {
        PaymentParams params = new PaymentParams();
        setTerminalInfo(params);

        //service
        params.paramTree.AddEnum(ArkosTags.SelectedService, PaymentServiceID.PaymentCompletion);
        createOriginalTransaction(params,transactionReference,PaymentServiceID.Preauth);
        
        //Amount
        byte[] bcdAmount = IntToBCD(amount);
        if (bcdAmount == null) {
            return null;
        }
        params.paramTree.AddBin(TransactionAmount, bcdAmount);
        params.paramTree.AddBin(AmountAuthorised, bcdAmount);
        params.paramTree.AddBin(TransactionAmountBeforeAdjustment, bcdAmount);

        return params;
    }

Code Block
    public static PaymentParams createUpdatePreAuth(String transactionReference, int amount, AmountQualifierID amountQualifier) {
        PaymentParams params = new PaymentParams();
        setTerminalInfo(params);

        //service
        params.paramTree.AddEnum(ArkosTags.SelectedService, PaymentServiceID.UpdatePreauth);
        params.paramTree.AddEnum(ArkosTags.UpdatePreAuthAmountQualifier,amountQualifier);
        createOriginalTransaction(params,transactionReference,PaymentServiceID.Preauth);
      
        //Amount
        byte[] bcdAmount = IntToBCD(amount);
        if (bcdAmount == null) {
            return null;
        }
        params.paramTree.AddBin(TransactionAmount, bcdAmount);
        params.paramTree.AddBin(AmountAuthorised, bcdAmount);
        params.paramTree.AddBin(TransactionAmountBeforeAdjustment, bcdAmount);

        return params;
    }

Code Block
    public static PaymentParams CreateReversal(String transactionReference) {
        PaymentParams params = new PaymentParams();
        setTerminalInfo(params);

        //service
        params.paramTree.AddEnum(ArkosTags.SelectedService, PaymentServiceID.Cancellation);
        createOriginalTransaction(params,transactionReference,PaymentServiceID.Payment);
       
        return params;
    }