SGFGOV / medusa-payment-phonepe

pluging to accept payments via phonepe gateway
5 stars 3 forks source link

Creating refund throws an error #4

Open AweSomeK101 opened 10 months ago

AweSomeK101 commented 10 months ago

`::ffff:127.0.0.1 - - [26/Jan/2024:05:00:36 +0000] "POST /admin/returns/ret_01HN2174DA1T4VQTG40168JAT1/receive HTTP/1.1" 500 86 "http://localhost:9000/app/a/orders/order_01HN209KR3QJG3E896BDGV8A80" "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:123.0) Gecko/20100101 Firefox/123.0" error: Cannot read properties of undefined (reading 'id')

TypeError: Cannot read properties of undefined (reading 'id')

at PhonePeProviderService.<anonymous> (D:\codd\biosap\biosap-backend\node_modules\medusa-payment-phonepe\dist\core\phonepe-base.js:403:73)

at step (D:\codd\biosap\biosap-backend\node_modules\medusa-payment-phonepe\dist\core\phonepe-base.js:73:23)

at Object.next (D:\codd\biosap\biosap-backend\node_modules\medusa-payment-phonepe\dist\core\phonepe-base.js:54:53)

at D:\codd\biosap\biosap-backend\node_modules\medusa-payment-phonepe\dist\core\phonepe-base.js:48:71

at new Promise (<anonymous>)

at __awaiter (D:\codd\biosap\biosap-backend\node_modules\medusa-payment-phonepe\dist\core\phonepe-base.js:44:12)

at PhonePeBase.refundPayment (D:\codd\biosap\biosap-backend\node_modules\medusa-payment-phonepe\dist\core\phonepe-base.js:391:16)

at PaymentProviderService.<anonymous> (D:\codd\biosap\biosap-backend\node_modules\@medusajs\medusa\dist\services\payment-provider.js:807:71)

at step (D:\codd\biosap\biosap-backend\node_modules\@medusajs\medusa\dist\services\payment-provider.js:48:23)

at Object.next (D:\codd\biosap\biosap-backend\node_modules\@medusajs\medusa\dist\services\payment-provider.js:29:53)`
SGFGOV commented 10 months ago

This is because your client isn't sending the customer information storing the customer information in the payment session data object. The payment sessiondata must have {customer:{id:string}}

BR PS: you can try this patch 1.1.46-next-v6 it throws a more sensible error

AweSomeK101 commented 10 months ago

I'm only using the refund bit from the admin panel for now and that wasn't working.

{ resolve:medusa-payment-phonepe`,

options: {
  redirectUrl: process.env.PHONEPE_REDIRECT_URL,
  callbackUrl: process.env.PHONEPE_CALLBACK_URL,
  salt: process.env.PHONEPE_SALT,
  merchantId: process.env.PHONEPE_MERCHANT_ACCOUNT,
  mode: process.env.PHONEPE_MODE,
  redirectMode: "POST",
},

}, `

and how do i use the patch you mentioned?

SGFGOV commented 10 months ago

You need to just install the patch

suganyasai1026 commented 9 months ago

hi , i have followed the documentation but not able to see any update in admin portal to include phonepe for the region