Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Verifying notification #10

Open
arminhupka opened this issue Oct 31, 2021 · 5 comments
Open

Verifying notification #10

arminhupka opened this issue Oct 31, 2021 · 5 comments
Labels
documentation Improvements or additions to documentation

Comments

@arminhupka
Copy link

During notification verifying getting error. Header openpayu-signature exist in incoming header data.

TypeError: Cannot read property 'split' of undefined
    at PayU.parseHeaderToJson (/Users/arminhupka/PhpstormProjects/untitled/node_modules/@ingameltd/payu/dist/PayU.js:182:28)
    at PayU.verifyNotification (/Users/arminhupka/PhpstormProjects/untitled/node_modules/@ingameltd/payu/dist/PayU.js:199:29)
    at notify (file:///Users/arminhupka/PhpstormProjects/untitled/server.js:40:26)
    at Layer.handle [as handle_request] (/Users/arminhupka/PhpstormProjects/untitled/node_modules/express/lib/router/layer.js:95:5)
    at next (/Users/arminhupka/PhpstormProjects/untitled/node_modules/express/lib/router/route.js:137:13)
    at Route.dispatch (/Users/arminhupka/PhpstormProjects/untitled/node_modules/express/lib/router/route.js:112:3)
    at Layer.handle [as handle_request] (/Users/arminhupka/PhpstormProjects/untitled/node_modules/express/lib/router/layer.js:95:5)
    at /Users/arminhupka/PhpstormProjects/untitled/node_modules/express/lib/router/index.js:281:22
    at Function.process_params (/Users/arminhupka/PhpstormProjects/untitled/node_modules/express/lib/router/index.js:335:12)
    at next (/Users/arminhupka/PhpstormProjects/untitled/node_modules/express/lib/router/index.js:275:10)```
@kasvith
Copy link
Member

kasvith commented Oct 31, 2021

Would you like to create a PR for this?

@kasvith kasvith added the bug Something isn't working label Oct 31, 2021
@t-soltysiak
Copy link

t-soltysiak commented Jun 29, 2024

Hello, and thanks for library ;-) Maybe someone have simillar problem with verifications, for SvelteKit I discovered where there is problem (propably stringify function added some slashes that generate wrong md5 checksum:

export const POST: RequestHandler = async ({ request }): Promise<Response> => {
   const bodyText = await request.text();
   const isValid1 = payU.verifyNotification(signature, bodyText); // WORKS correctly
   const isValid2 = payU.verifyNotification(signature, JSON.stringify(bodyText)); // Does NOT WORKING

Documentation explains this in https://developers.payu.com/europe/docs/payment-flows/lifecycle/#signature-verification
where there is no information that body should be strigified, so maybe it would be nice to update readme. Greetings!

@kasvith
Copy link
Member

kasvith commented Jun 30, 2024

Hey @t-soltysiak would you mind opening a PR for documentation change?

@kasvith kasvith added documentation Improvements or additions to documentation and removed bug Something isn't working labels Jun 30, 2024
@kasvith
Copy link
Member

kasvith commented Jun 30, 2024

This is mainly happening because of the JSON parsers alters the original body, so using the original request body as it is with verification(like in stripe) is the way

@t-soltysiak
Copy link

Hey @t-soltysiak would you mind opening a PR for documentation change?

sure: #17

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

3 participants