medicinePlaceOrderAPI method

Future medicinePlaceOrderAPI({
  1. dynamic medicineOrderId,
  2. dynamic packageId,
  3. dynamic walletId,
  4. dynamic context,
})

Implementation

Future medicinePlaceOrderAPI(
    {medicineOrderId, packageId, walletId, context}) async {
  var decodedResponse;
  final ApiBody = {
    "medicine_order_id": '$medicineOrderId',
    "package_id": '$packageId',
    "wallet_id": '$walletId',
    "source": Platform.isAndroid ? '1' : '2',
  };
  var body = jsonEncode(ApiBody);

  http.Response response =
      await http.post(Uri.parse('${WELLNESS_URL}api/medicine/order-medicine'),
          headers: {
            "Content-Type": "application/json",
            'Authorization': currentUserToken,
          },
          body: body);
  decodedResponse = json.decode(response.body);
  getMedicinePlaceOrderData = decodedResponse;
  getMedicineOrderID = await medicineOrderId;

  if (decodedResponse['success'] == true) {
  } else {
    Get.back();
    Validator().errorMessage(
        context: context, message: "${decodedResponse['message']}");
  }
}