import axiosRequest from "../axios-request"; export interface IorangePaymentStarter { type_paiement : number, marchand : "1", service : "1", montant : number, commentaire : string, numero : string } export interface IOrangeResponse { status : number, message : string, pay_token : string, payment_url : string, notif_token : string, order_id : string, } type OrangeStatus = "INITIATED" | "SUCCESS" | "FAILED"; export interface IorangePaymentStatus { status : OrangeStatus, code : number, message : { status : OrangeStatus, order_id : string, txnid ?: string } } export const getTransactionsData = async (payload : IorangePaymentStarter) => { // const basictoken = base64.encode("admin:admin"); return await axiosRequest({ url: "/transactions/", method: "POST", data: payload }); }; export const getTransactionStatus = async(orderId : string) => { let response = await axiosRequest({ url: `/api/TransactionCheckStatus/${orderId}/`, method: "GET", }) if (response.status === "INITIATED"){ throw new Error("Payment is still in progress"); } else { return response } }