parsePaymentResult method

PaymentResult parsePaymentResult(
  1. dynamic result
)

Implementation

PaymentResult parsePaymentResult(result) {
  if (result == null) {
    throw Exception('Result is null');
  }
  switch (result['status']) {
    case 'success':
      return PaymentSuccessResult(
        paymentConsentId: result['consentId'],
      );
    case 'inProgress':
      return PaymentInProgressResult();
    case 'cancelled':
      return PaymentCancelledResult();
    default:
      throw Exception('Unknown status: ${result['status']}');
  }
}