Commit e24faff6 by Arjun Jhukal

updated the new fix for payment

parent f22c11c5
......@@ -100,24 +100,25 @@ export default function CheckoutPage({ amount, slug, bonus }: {
<Button type='submit' variant='contained' color='primary' className='!mt-3' onClick={async () => {
try {
if (currentPaymentMode === "crypto") {
const response = await getPaymentLink({
id: slug,
amount,
}).unwrap();
router.replace(response?.data?.payment_url)
}
else if (currentPaymentMode === "idem") {
console.log("payment mode is idem");
}
else {
dispatch(
showToast({
message: "Please select prefered mode of payment.",
variant: ToastVariant.INFO
})
)
}
const response = await getPaymentLink({
id: slug,
amount,
type: currentPaymentMode as PaymentModeProps
}).unwrap();
router.replace(response?.data?.payment_url)
// if (currentPaymentMode === "crypto") {
// }
// else if (currentPaymentMode === "idem") {
// console.log("payment mode is idem");
// }
// else {
// dispatch(
// showToast({
// message: "Please select prefered mode of payment.",
// variant: ToastVariant.INFO
// })
// )
// }
}
catch (e: any) {
......
......@@ -10,7 +10,7 @@ export const transactionApi = createApi({
tagTypes: ["Deposit", "Withdrawl"],
endpoints: (builder) => ({
deposit: builder.mutation<DepositResponseProps, DepositProps>({
query: ({ id, amount, type = "crypto" }) => ({
query: ({ id, amount, type }) => ({
url: `/api/payment/${id}`,
method: "POST",
body: { amount: amount, type: type }
......
......@@ -5,7 +5,7 @@ type TransactionStatus = "SUCCESS" | "UNSUCCESSFUL" | "PENDING";
export interface DepositProps {
id: string;
amount: number;
type?: "crypto" | "bank"
type?: "crypto" | "idem"
}
export interface DepositUrlProps {
......
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