CapturePayment method

Future CapturePayment({
  1. dynamic transaction_id,
})

Implementation

Future CapturePayment({transaction_id}) async {
  var decodedResponse;
  final ApiBody = {
    "transaction_id": "${transaction_id}",
    "diagnostic_order_id": diagnostic_order_id
  };
  print(ApiBody);
  var body = jsonEncode(ApiBody);

  http.Response response = await http.post(
      Uri.parse('${WELLNESS_URL}api/diagnostic/capture-payment-details'),
      headers: {
        "Content-Type": "application/json",
        'Authorization': currentUserToken,
      },
      body: body);
  decodedResponse = json.decode(response.body);

  if (decodedResponse['success'] == true) {
    Get.offAll(CommonThankYouPage(
        pageFrom: 'diagnostic_order', order_id: diagnostic_order_id));
    // await showDialog(
    //   barrierDismissible: false,
    //   context: commonContext,
    //   builder: (BuildContext context) {
    //     return MedicinePaymentSuccessPopup(
    //         message: " ${decodedResponse['message']}",
    //         ontap: () async {
    //           Get.offAll(MyProfileScreen());
    //           await TestOrderViewDetails(
    //               order_id: diagnostic_order_id, apiReload: true);
    //         },
    //         image: '${LottiePath}Upload_Successful.json');
    //   },
    // );
  } else {
    Validator().errorMessage(
        context: commonContext, message: "${decodedResponse['message']}");
  }
}