checkMobileMoneyStatusPayment method

Future<IMobileMoneyProcessingRequestResponse> checkMobileMoneyStatusPayment({
  1. required Map<String, String?> body,
  2. required String token,
})

Implementation

Future<IMobileMoneyProcessingRequestResponse> checkMobileMoneyStatusPayment(
    {required Map<String, String?> body, required String token}) async {
  try {
    Map<String, String> headers = {
      "mb-token": token,
    };
    String url = "/pay/check-mobilemoney-payment";
    _spinnerController.add(true);
    final res = await postWithIntercept(url, body: body, headers: headers);
    IMobileMoneyProcessingRequestResponse response =
        IMobileMoneyProcessingRequestResponse.fromJson(res);
    debugPrint("$response");
    if (response.binStatus == EApiResponseStatusCode.bIN000) {
      _paymentMessageController
          .add(IResponseMessage(title: 'Yeah !', message: response.message));
      _paymentScreenController.add(ELocalScreenNavigator.successScreen);
      return IMobileMoneyProcessingRequestResponse(
          binStatus: EApiResponseStatusCode.bIN001,
          extraInfo: IExtraInfo(
              pourcent: 100,
              status: "success",
              subtitle: response.message,
              success: false,
              title: "Yeah !"),
          message:
              "Une erreur est survenue lors de cette opération, veuillez réessayer",
          systemRef: '');
    } else {
      _paymentMessageController
          .add(IResponseMessage(title: 'Oups !', message: response.message));
      _paymentScreenController.add(ELocalScreenNavigator.errorScreen);
      return IMobileMoneyProcessingRequestResponse(
          binStatus: EApiResponseStatusCode.bIN001,
          extraInfo: IExtraInfo(
            pourcent: 100,
            status: "exception",
            subtitle: response.message,
            success: false,
            title: "Oups !",
          ),
          message:
              "Une erreur est survenue lors de cette opération, veuillez réessayer",
          systemRef: '');
    }
  } catch (e, stack) {
    // _spinnerController.add(false);
    debugPrint('Error during fetch operations: $e');
    debugPrint('Stack trace: $stack');
    return IMobileMoneyProcessingRequestResponse(
        binStatus: EApiResponseStatusCode.bIN001,
        extraInfo: IExtraInfo(
          pourcent: 100,
          status: "exception",
          subtitle:
              "Une erreur est survenue lors de cette opération, veuillez réessayer",
          success: false,
          title: "Oups !",
        ),
        message:
            "Une erreur est survenue lors de cette opération, veuillez réessayer",
        systemRef: '');
  }
}