callRupayBlockorUnblockAPI method

void callRupayBlockorUnblockAPI(
  1. BuildContext context,
  2. bool online,
  3. bool pos,
  4. bool nfc,
  5. bool atm,
)

Implementation

void callRupayBlockorUnblockAPI(
    BuildContext context, bool online, bool pos, bool nfc, bool atm) {
  kglobal.getUserData().then((valuePref) async {
    Map<String, dynamic> requestBody = {
      'ReqType': AppUrl.TA_Oneapp_UpdateChannelStatus,
      "Mobilenumber": valuePref?.mobileNumber,
      "ReferenceNumber": kglobal.shared.RupayRefNum,
      // "SessionID": valuePref?.sessionID,
      "POS": pos,
      "NFC": nfc,
      "Online": online,
      "ATM": atm,
      "Date": kglobal.shared.getCurrentDateTime(),
      "Platform": kglobal.shared.kPlatform,
      "ApplicationType": kglobal.shared.applcationType,
      "EntityID": kglobal.shared.EntityID,
      "MachineID": kglobal.shared.deviceID,
    "GeoLocation": kglobal.shared.geolocation,
    };

    String bodyJson = jsonEncode(requestBody);

    auth.UpdateChannelStatusRequest(context, bodyJson).then((value2) {
      setUpdateChannelStatusValue(value2);
      if (value2.responseCode == "99723") {
        kglobal.shared.showSnack(context,true, blockUnblockResModel.value.message ?? "");
      } else if (blockUnblockResModel.value.responseCode?.length == 4) {
        //PopupAlert().showPopupWithBack(context, rupayEncryption3DESModel.value.message ?? '', false);
        //setDataAgainInSinglton
        MySingleton().ruPayCardStatusSinglton.online =
            online == true ? "True" : "False";
        MySingleton().ruPayCardStatusSinglton.pos =
            pos == true ? "True" : "False";
        MySingleton().ruPayCardStatusSinglton.nfc =
            nfc == true ? "True" : "False";
        MySingleton().ruPayCardStatusSinglton.atm =
            atm == true ? "True" : "False";
        hasUpdateStatusAPICalled.value = true;
        customList = <BlockUnblockModel>[];
        customList = <BlockUnblockModel>[].obs;
        addItemInList();
        update();
      } else {
        kglobal.shared.showSnack(context,true, blockUnblockResModel.value.message ?? "");

      }
    });
  });
}