diff --git a/apps/bank-webhook/src/index.ts b/apps/bank-webhook/src/index.ts index 46e6c6c..4172a69 100644 --- a/apps/bank-webhook/src/index.ts +++ b/apps/bank-webhook/src/index.ts @@ -14,6 +14,7 @@ app.post("/hdfcWebhook", async (req, res) => { // TODO: Add zod validation here? // TODO: HDFC bank should ideally send us a secret so we know this is sent by them // TODO: Only if it is processing we should proceed + const paymentInformation: { token: string; userId: string; @@ -27,7 +28,7 @@ app.post("/hdfcWebhook", async (req, res) => { }; try { - if (paymentInformation.paymentStatus == 'success') { + if (paymentInformation.paymentStatus === 'success') { await db.$transaction([ db.balance.updateMany({ where: { @@ -49,7 +50,7 @@ app.post("/hdfcWebhook", async (req, res) => { }) ]); } else { - db.onRampTransaction.updateMany({ + await db.onRampTransaction.updateMany({ where: { token: paymentInformation.token }, diff --git a/apps/mock-hdfc/app/lib/actions/validatePayment.ts b/apps/mock-hdfc/app/lib/actions/validatePayment.ts index 4630e8f..c73f993 100644 --- a/apps/mock-hdfc/app/lib/actions/validatePayment.ts +++ b/apps/mock-hdfc/app/lib/actions/validatePayment.ts @@ -18,7 +18,7 @@ export async function validatePayment(token: any) { const payload = { token: token, user_identifier: decodedData.userId, - amount: decodedData.amount*100, + amount: decodedData.amount, paymentStatus: 'success' } diff --git a/apps/user-app/app/lib/actions/createOnrampTransaction.ts b/apps/user-app/app/lib/actions/createOnrampTransaction.ts index 483cbfb..0b9d76c 100644 --- a/apps/user-app/app/lib/actions/createOnrampTransaction.ts +++ b/apps/user-app/app/lib/actions/createOnrampTransaction.ts @@ -19,7 +19,7 @@ export async function createOnRampTransaction(provider: string, amount: number) // this token will be sent from hdfc - for now just hardcoding it const payload = { userId: session.user.id, - amount: amount + amount: amount*100 } const token = jwt.sign(payload, process.env.JWT_SECRET as string); diff --git a/apps/user-app/components/OnRampTransactions.tsx b/apps/user-app/components/OnRampTransactions.tsx index ef8a6aa..f834149 100644 --- a/apps/user-app/components/OnRampTransactions.tsx +++ b/apps/user-app/components/OnRampTransactions.tsx @@ -18,9 +18,12 @@ export const OnRampTransactions = ({ } + + const sortedTransactions = [...transactions].sort((a,b) => b.time.getTime() - a.time.getTime() ) + return
- {transactions.map((t,index) =>
+ {sortedTransactions.map((t,index) =>
Received INR