public class ProcessPaymentAction : IProcessPaymentAction {
public Task<ProcessPaymentResponse> ProcessPaymentAsync(
ProcessPaymentRequest request,
AvailableConnectorConfiguration configuration,
CancellationToken cancellationToken)
{
//Third party is advised to create their custom validation request.
var request = ValidateAndMapRequest(request, configuration);
try
{
var result = await <Call-payment-function>
//ToProcessPaymentResponse is a custom implementation.
//The third party are advised to map the response returned
//from the payment function to the ProcessPaymentResponse model
return result.ToProcessPaymentResponse();
}
catch (CustomException e)
{
//ToConnectorException is a custom exception handling.
//The third party is also advised to handle the exception handling
//according to their implementation.
throw e.ToConnectorException();
}
}
}