getPaymentModes method

dynamic getPaymentModes(
  1. BuildContext context
)

Implementation

getPaymentModes(BuildContext context) async {
  // WidgetsBinding.instance.addPostFrameCallback((_) {
  //   Helper.progressDialog(context, "Please wait..");
  // });
  // printLogs(dio);
  await dio
      .get(
    '${ApiConstant.posBaseUrl}pos-payment-service-svc/payment-modes',
    queryParameters: {
      "sellerType": storage.read("DISTRIBUTER_LEVEL_ID"),
      "paymentCollectionEntity": "CART",
      "transactionType": "SELL_THRU",
      "contractType": "STOCK_ORDER",
    },
    options: Options(
      headers: {
        'X-User-Id': storage.read("XUSER_ID"),
      },
    ),
  )
      .then((response) {
    // Get.back();
    if (response.data != null) {
      PaymentModeModel model = PaymentModeModel();
      print('getPaymentModes${response.data}');
      Map<String, dynamic> creditData = response.data;
      model = PaymentModeModel.fromJson(creditData);
      paymentModes = model.data!;
      paymentModeList.value = paymentModes;
      getPaymentModeList();
    }
  }, onError: (error) {
    print(error.toString());
    // Get.back();
    Helper.messageDialog(Get.context!, "Try Again!!", error.toString());
  });
}