payPump method

Future<Response> payPump(
  1. String authCode,
  2. String volume,
  3. String volumeMeasure,
  4. String amount,
  5. String amountCurrency,
  6. String pumpId,
)

Implementation

Future<http.Response> payPump(
    String authCode,
    String volume,
    String volumeMeasure,
    String amount,
    String amountCurrency,
    String pumpId) async {
  var jsonBody = amount == ''
      ? {
          "pump_id": pumpId,
          "volume": volume,
          "volume_measure": volumeMeasure,
          "auth_code": authCode,
        }
      : {
          "pump_id": pumpId,
          "amount": amount,
          "amount_currency": amountCurrency,
          "auth_code": authCode,
        };

  var url = Uri.parse(APIConst.payPump);
  log("URL ::: $url=====json_body:$jsonBody");

  Map<String, String> headers = {
    "Content-type": "application/x-www-form-urlencoded",
    'Accept': 'application/json'
  };

  //print('REQUEST ::: ' + json_body.toString());

  return await http
      .post(url, headers: headers, body: jsonBody)
      .timeout(Duration(seconds: timeOutSecond));
}