OrderFunction method

Future OrderFunction({
  1. dynamic context,
  2. dynamic package_id,
  3. dynamic wallet_id,
})

Implementation

Future OrderFunction({context, package_id, wallet_id}) async {
  final ApiBody = {
    "source": Platform.isAndroid ? '1' : '2', //0:Web, 1:Android, 2:IOS
    "package_id": "${package_id}",
    "wallet_id": "${wallet_id}"
  };
  var body = jsonEncode(ApiBody);
  http.Response response = await http.post(
      Uri.parse('${WELLNESS_URL}api/diagnostic/order-diagnostic'),
      headers: {
        "Content-Type": "application/json",
        'Authorization': currentUserToken,
      },
      body: body);
  paymentorder = json.decode(response.body);
  Get.back();
  if (paymentorder['is_payable'] == 0) {
    Get.offAll(CommonThankYouPage(
        pageFrom: 'diagnostic_order',
        order_id: '${paymentorder['diagnostic_order_id']}'));
    // Get.offAll(MyProfileScreen());
    // await testOrderList(1);
    // await TestOrderViewDetails(
    //     order_id: diagnostic_order_id, apiReload: true);
    // Validator().successMessage(
    //     context: commonContext, message: "${paymentorder['message']}");
  } else {
    return null;
  }
}