makePayment method

Future<Response> makePayment(
  1. String txnDetails,
  2. String pgDetails,
  3. String cardDetails,
  4. String custDetails,
  5. String billDetails,
  6. String shipDetails,
  7. String itemDetails,
  8. String otherDetails,
  9. String merchantId,
)

Implementation

Future<Response> makePayment(
  String txnDetails,
  String pgDetails,
  String cardDetails,
  String custDetails,
  String billDetails,
  String shipDetails,
  String itemDetails,
  String otherDetails,
  String merchantId
) async {
  final makePaymentRequestJson = jsonEncode({
    'txn_details': txnDetails,
    'pg_details': pgDetails,
    'card_details': cardDetails,
    'cust_details': custDetails,
    'bill_details': billDetails,
    'ship_details': shipDetails,
    'item_details': itemDetails,
    'other_details': otherDetails,
    'me_id': merchantId
  });

  //debugPrint('Calling api make payment ${StringConstants.makePayment} with body $makePaymentRequestJson');

  final Map<String, String> headers = <String, String>{
    'Content-Type': 'application/json',
  };

  try {
    final Response response = await http.post(
        Uri.parse(StringConstants.makePayment),
        body: makePaymentRequestJson,
        headers: headers);
    return response;
  } catch (e) {
    //debugPrint('Make Payment api exception is ${e.toString()}');
    rethrow;
  }
}