Commit e24faff6 by Arjun Jhukal

updated the new fix for payment

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