From e0908a0ea40f31899cd2393a4b293208dfaea2e5 Mon Sep 17 00:00:00 2001 From: Govind Diwakar Date: Mon, 3 Jun 2024 01:27:49 +0000 Subject: [PATCH] fix: order-id --- package.json | 2 +- src/core/razorpay-base.ts | 18 +++++++++++------- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/package.json b/package.json index 338ab17..94c7fd4 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "medusa-payment-razorpay", - "version": "7.2.0", + "version": "7.2.1-next-2", "description": "Razorpay Payment provider for Medusa Commerce", "main": "dist/index.js", "repository": { diff --git a/src/core/razorpay-base.ts b/src/core/razorpay-base.ts index cd49f55..30cc4f4 100644 --- a/src/core/razorpay-base.ts +++ b/src/core/razorpay-base.ts @@ -688,14 +688,18 @@ abstract class RazorpayBase extends AbstractPaymentProcessor { try { const id = paymentSessionData.id as string; - const sessionOrderData = (await this.razorpay_.orders.fetch( - id - )) as Partial; - delete sessionOrderData.id; - delete sessionOrderData.created_at; - + let sessionOrderData: Partial = { + currency: "INR", + }; + if (id) { + sessionOrderData = (await this.razorpay_.orders.fetch( + id + )) as Partial; + delete sessionOrderData.id; + delete sessionOrderData.created_at; + } context.currency_code = - currency_code?.toUpperCase() ?? sessionOrderData.currency!; + currency_code?.toUpperCase() ?? sessionOrderData?.currency ?? "INR"; const newPaymentSessionOrder = (await this.initiatePayment( context )) as PaymentProcessorSessionResponse;