Skip to content

Commit

Permalink
fix: order-id
Browse files Browse the repository at this point in the history
  • Loading branch information
Govind Diwakar committed Jun 3, 2024
1 parent 7440714 commit e0908a0
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand Down
18 changes: 11 additions & 7 deletions src/core/razorpay-base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<Orders.RazorpayOrder>;
delete sessionOrderData.id;
delete sessionOrderData.created_at;

let sessionOrderData: Partial<Orders.RazorpayOrder> = {
currency: "INR",
};
if (id) {
sessionOrderData = (await this.razorpay_.orders.fetch(
id
)) as Partial<Orders.RazorpayOrder>;
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;
Expand Down

0 comments on commit e0908a0

Please sign in to comment.