Skip to content

Latest commit

 

History

History
98 lines (69 loc) · 3.29 KB

File metadata and controls

98 lines (69 loc) · 3.29 KB

Create an Authorisation Code via an account identifier

Here, createAuthorisationCode(Identifiers identifiers) creates a POST request to /accounts/{identifierType}/{identifier}/authorisationcodes

This endpoint allows allows a mobile money payer or payee to generate a code which when presented to the other party, can be redeemed for an amount set by the payer or payee, depending upon the use case.

Mobile money payer/payee submits the request to generate a code which when presented to the other party, can be redeemed for an amount set by the payer/payee, depending on the use case. The MMP returns the request state object to indicate the request is pending. The payer/payee communicate the code to respective parties verabally or by a QR code.

Usage/Examples

Declare the Authorization code object

private AuthorisationCodeRequest authorisationCodeRequest;

Initialise the authorization code with amount,date and currency

       authorisationCodeRequest = new AuthorisationCodeRequest();
       authorisationCodeRequest.setAmount("Place your amount here"); // eg:200.00
       authorisationCodeRequest.setRequestDate("Place your date here"); //sample format 2021-10-18T10:43:27.405Z
       authorisationCodeRequest.setCurrency("Place your currency"); //eg:RWF

Obtain Authorization code to perform merchant payment,These scenario can be achieved by passing account identifiers to a function

private void createAccountIdentifier(){

        identifierArrayList=new ArrayList<>();
        identifierArrayList.clear();

        Identifier identifierAccount=new Identifier();
        identifierAccount.setKey("accountid");
        identifierAccount.setValue("2000");
        identifierArrayList.add(identifierAccount);

    }
     SDKManager.merchantPayment.createAuthorisationCode(identifierArrayList,NotificationMethod,"CALLBACK URL", authorisationCodeRequest, new RequestStateInterface() {
            @Override
            public void onValidationError(ErrorObject errorObject) {
               
            }

            @Override
            public void onRequestStateSuccess(RequestStateObject requestStateObject) {
            
            }

            @Override
            public void onRequestStateFailure(GSMAError gsmaError) {
             
            }
             @Override
            public void getCorrelationId(String correlationID) {
               
            }

        });

Example Output - Callback

202
{
  "serverCorrelationId": "dae8ef64-4340-40b4-863e-ddbe9d63374b",
  "status": "pending",
  "notificationMethod": "callback",
  "objectReference": "1056",
  "pollLimit": 100
}

Example Output - Polling

202
{
  "serverCorrelationId": "679b684e-9b2f-4140-b0b8-dc53d183ffaf",
  "status": "pending",
  "notificationMethod": "polling",
  "objectReference": "1707",
  "pollLimit": 100
}

NOTE

In asynchronous flows, a callback mechanism or polling mechanism is utilised to allow the client to determine the request's final state. Use the viewRequestState() function for the polling mechanism to receive the status of a request, and the viewAuthorisationCode() function to acquire the final representation of the Transaction object.