Commit c8f34345 by G

- add order_id to IOrangeResponse

- interface for paymentStatus - getTransactions status function
parent 69210286
......@@ -15,7 +15,20 @@ export interface IOrangeResponse {
message : string,
pay_token : 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
}
}
......@@ -27,4 +40,17 @@ export const getTransactionsData = async (payload : IorangePaymentStarter) => {
data: payload
});
};
\ No newline at end of file
};
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