diff --git a/src/screens/PaymentAmountInputScreen.tsx b/src/screens/PaymentAmountInputScreen.tsx index b025236..166e4da 100644 --- a/src/screens/PaymentAmountInputScreen.tsx +++ b/src/screens/PaymentAmountInputScreen.tsx @@ -54,30 +54,20 @@ const PaymentAmountInputScreen: PaymentStackScreenComponentProps<"paymentAmountI Keyboard.dismiss(); log.info("OM so we stays on screen !!"); log.info("Calling api with amount :: ", amountToPay); + try { + const { payment_url, order_id } = + await orangeTransactionInitializerMutation.mutateAsync(amountToPay); + log.info("Url de paiement orange", payment_url); + log.info("Ouverture du navigateur sur la page de paiement..."); + await handlePaymentUsingBrowser(payment_url); + log.info("Verifying transaction status..."); + const response = await transactionsStatusMutation.mutateAsync(order_id); + log.info("result of transactions", JSON.stringify(response, null, 2)); + } catch (error) { + log.error("handlePaymentButton |", error); + //TODO : handle error + } - const { payment_url, order_id } = - await orangeTransactionInitializerMutation.mutateAsync(amountToPay); - log.info("Url de paiement orange", payment_url); - log.info("Ouverture du navigateur sur la page de paiement..."); - await handlePaymentUsingBrowser(payment_url); - log.info("Verifying transaction status..."); - const response = await transactionsStatusMutation.mutateAsync(order_id); - log.info("result of transactions", JSON.stringify(response, null, 2)); - // log.info( - // `Was the transaction initialization a success ? ${orangeTransactionInitializerMutation.isSuccess}`, - // ); - // if (orangeTransactionInitializerMutation.isSuccess) { - // log.info("initilization was a success, checking for status"); - // await transactionsStatusMutation.mutateAsync( - // orangeTransactionInitializerMutation.data.order_id, - // ); - // log.info( - // "result of transactions", - // JSON.stringify(transactionsStatusMutation.data, null, 2), - // ); - // } - - // console.log("Response transaction", response); break; } default: