cashfree / cashfree-sdk-nodejs

Cashfree SDK for Node js
MIT License
8 stars 21 forks source link

IMPORTANT : Fixed 'verifySignature' function in lib/payouts/services #45

Open oshinpojta opened 1 year ago

oshinpojta commented 1 year ago

-- IMPORTANT: Fixed the 'verifySignature' function in lib/payouts/services.

-- In the documentation, it was written that "postData" should be a string of concatenated values of the request-body object, which should be created by sorting keys in "descending" order, excluding the "signature" key and encryption type should be set to "base64".

But in function, it is treating the body as "object" and converting it using "toString()" then encrypting it in "hex" rather than "base64", which is now fixed.

-- Additionally, it can now beautifully handle the "typeof" body as "String" as well as "Object", which is raw request-body JSON-object, then encrypt and test it respectively, this feature was created due to the lack of information on what type of data should "postData" send to the "body" parameter of the function.