alitnk / monopay

💳 A node.js package for making payment transactions with different payment gateways
https://monopay.js.org
MIT License
114 stars 19 forks source link

Zarinpal refrenceId is wrong!! #47

Closed everythinginjs closed 1 year ago

everythinginjs commented 1 year ago

in verifyPayment method of zarinpal in the docx. it is suggested to pass referenceId but when read your code figured out it must be Authority.

https://github.com/alitnk/monopay/blob/c0b45c40719fb7b9d2ccd169ba5fbff4445b26ec/src/drivers/zarinpal/index.ts#L44

I have had spent an hour scratching my head why my endpoint return 404.

import { getPaymentDriver } from "monopay";

const driver = getPaymentDriver("zarinpal", {
  merchantId: "zarinpal-merchant",
});

const receipt = await driver.verifyPayment(
  {
    amount: 5000,
    referenceId: 1234,
  },
  { ...request.query }
);
Keivan-sf commented 1 year ago

Thanks for reporting, there is indeed a problem with referenceId since it simply doesn't exist in zarinpal verification type

But note that authority is not passed along options, it's passed in the second parameter (considered to be in req.query in this example which I think we could improve that as well)

alitnk commented 1 year ago

Thanks @Keivan-sf!