getTransactionForPaymentProcess method
Future<void>
getTransactionForPaymentProcess(
{ - required String url,
- required String token,
})
Implementation
Future<void> getTransactionForPaymentProcess(
{required String url, required String token}) async {
try {
Map<String, String> headers = {
"mb-token": token,
};
_spinnerController.add(true);
final resp = await getWithDio(url, headers: headers);
// debugPrint("---> $resp");
var response = IBinoxusRequestResponse.fromJson(resp);
if (response.binStatus == EApiResponseStatusCode.bIN000) {
debugPrint("---> ");
_paymentProcessInfoController.add(response);
debugPrint(
"---> : ${_paymentProcessInfoController.value.paymentInfo.paymentInfo.directPayRedirectUrl}");
_paymentScreenController
.add(ELocalScreenNavigator.initControllerScreen);
} else {
_paymentMessageController
.add(IResponseMessage(title: 'Oups !', message: response.message));
_paymentScreenController.add(ELocalScreenNavigator.errorScreen);
}
_spinnerController.add(false);
} catch (e, stack) {
_spinnerController.add(false);
debugPrint('Error during fetch operations: $e');
debugPrint('Stack trace: $stack');
_paymentMessageController.add(IResponseMessage(
title: 'Oups !',
message:
"Une erreur est survenue lors de cette opération, veuillez réessayer",
));
_paymentScreenController.add(ELocalScreenNavigator.errorScreen);
}
}