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 2 Current »

As example, we will be demonstrating a Sale to POI payment request and validate the input request on the sale terminal. Note that required functions were added in ASL and is available in ASL-2.8.10a.aar.

  1. payment request sent to POI terminal from Sale terminal.

<?xml version="1.0"?>
<SaleToPOIRequest>
    <MessageHeader MessageClass="Service" MessageCategory="Payment" MessageType="Request" ServiceID="2" SaleID="ArkosSales" POIID="PreCertificationAmadis1" />
    <PaymentRequest>
        <SaleData SaleReferenceID="ArkosSale42">
            <SaleTransactionID TransactionID="1" TimeStamp="2019-08-21T14:48:05+05:00" />
        </SaleData>
        <PaymentTransaction>
            <AmountsReq Currency="EUR" RequestedAmount="250.00" />
        </PaymentTransaction>
        <PaymentData PaymentType="Normal" />
    </PaymentRequest>
</SaleToPOIRequest>

  1. We chose to use Merchant confirmation of a partially approved transaction as example to validate the input request (Merchant confirmation of a partially approved transaction ).

  1. When it's time for the merchant to confirm partial transaction approval, the Point of Interaction (POI) will send an input request to the sales terminal. Here is the code that fulfills this requirement:

    public boolean merchantConfirmPartiallyApprovedTransaction(DisplayParams displayParams, byte[] bytes) {
        Log.d(LOG_TAG, "merchantConfirmPartiallyApprovedTransaction");

        ArkosContext arkosContext = new ArkosContext(bytes);
        String amount = CurrencyFormat.format(arkosContext.getAmount());
        String requestedAmount = CurrencyFormat.format(arkosContext.getRequestedAmount());
        String leftToPay = CurrencyFormat.format(arkosContext.getLeftToPay());

        String prompt = getString(R.string.confirm_partial_approval);
        return PaymentSystem.getRetailHandler().SendInputRequest(prompt);
    }

  1. Typically you simply need to add a SendInputRequest() method similar to the one below in the RetailHandlerclass which can be found in the \Arkos\workspaces\android-demo-fixed\app\src\main\java\ca\amadis\arkospay\RetailHandler.java file:

    public synchronized boolean SendInputRequest(String display) {
        if (bConnected) {
            Log.d(LOG_TAG, "POI input request: " + display);
            InputResponse resp = retailModule.requestInput(OutgoingInputRequest.BasicConfirmation(display, 60));
            if(resp.wrap().getResult().equals("Success")){
                return resp.wrap().getConfirmation();
            }
        }
        return false;
    }

The getResult() function checks if result is a success. A success means we were able to receive a response.

As a reminder, the requestInput() function used in the SendInputRequest() method (above) has been added in ASL and is available in ASL-2.8.10a.aar.

Also add the following extra import statements to that same \Arkos\workspaces\android-demo-fixed\app\src\main\java\ca\amadis\arkospay\RetailHandler.java file.

import ca.amadis.asl.retail.request.InputResponse;
import ca.amadis.asl.retail.request.OutgoingInputRequest;

An example of a response you can send with the confirmation can be found below:

<?xml version="1.0"?>
<SaleToPOIResponse>
	<MessageHeader MessageClass="Device" MessageCategory="Input" MessageType="Response" DeviceID="1374" SaleID="ArkosSales" POIID="PreCertificationAmadis1"/>
	<InputResponse>
		<InputResult Device="CashierInput" InfoQualify="Input">
			<Response Result="Success"/>
			<Input InputCommand="GetConfirmation">
			<ConfirmedFlag>true</ConfirmedFlag>
			</Input>
		</InputResult>
	</InputResponse>
</SaleToPOIResponse>

  • No labels