Commit c8f34345 by G

- add order_id to IOrangeResponse

- interface for paymentStatus - getTransactions status function
parent 69210286
...@@ -15,7 +15,20 @@ export interface IOrangeResponse { ...@@ -15,7 +15,20 @@ export interface IOrangeResponse {
message : string, message : string,
pay_token : string, pay_token : string,
payment_url : string, payment_url : string,
notif_token : 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
}
} }
...@@ -28,3 +41,16 @@ export const getTransactionsData = async (payload : IorangePaymentStarter) => { ...@@ -28,3 +41,16 @@ export const getTransactionsData = async (payload : IorangePaymentStarter) => {
}); });
}; };
export const getTransactionStatus = async(orderId : string) => {
let response = await axiosRequest<IorangePaymentStatus>({
url: `/api/TransactionCheckStatus/${orderId}/`,
method: "GET",
})
if (response.status === "INITIATED"){
throw new Error("Payment is still in progress");
} else {
return response
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment