Here, createReversal(String transactionReference) creates a POST request to /transactions/{transactionReference}/reversals
Provided with a valid object representation, this endpoint allows for a new reversal to be created.
Reversal reversalObject = new Reversal();
reversalObject.setReversal("reversal");Call the reversal function with reference Id of the transaction obtained.
SDKManager.agentService.createReversal(NotificationMethod,"CALLBACK URL","PLACE YOUR REFERENCE ID HERE", reversalObject, new RequestStateInterface() {
@Override
public void onRequestStateSuccess(RequestStateObject requestStateObject) {
serverCorrelationId = requestStateObject.getServerCorrelationId();
}
@Override
public void onRequestStateFailure(GSMAError gsmaError) {
}
@Override
public void onValidationError(ErrorObject errorObject) {
}
@Override
public void getCorrelationId(String correlationID) {
}
});202
{
"serverCorrelationId": "66b3e91a-1d36-41a6-8f4a-833ef1f9d125",
"status": "pending",
"notificationMethod": "callback",
"objectReference": "8287",
"pollLimit": 100
}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 viewTransaction() function to acquire the final representation of the Transaction object.