Skip to content

fix: update Pix check and simulatePayment to use id query param (#41)#47

Closed
Gustavonobregab wants to merge 1 commit intoAbacatePay:developfrom
Gustavonobregab:fix/pix-check-query-id
Closed

fix: update Pix check and simulatePayment to use id query param (#41)#47
Gustavonobregab wants to merge 1 commit intoAbacatePay:developfrom
Gustavonobregab:fix/pix-check-query-id

Conversation

@Gustavonobregab
Copy link
Contributor

@Gustavonobregab Gustavonobregab commented Jun 3, 2025

Closes #41

This PR updates the check and simulatePayment methods in the pixQrCode module to follow the correct API usage.

What was changed:
-check now uses GET /pixQrCode/check?id=... instead of POST with full payload
-simulatePayment now uses POST /pixQrCode/simulate-payment?id=... with a minimal body { metadata: {} }
-Added a new type PixIdParams to standardize usage with only the id field

Notes:
-Existing tests fail because they expect the old request format. Test mocks should be updated to match the new signature and method type.
-This change aligns the SDK with the current Pix QRCode API behavior.

**This is my first time contributing to and interacting with an open source project. Please feel free to review and let me know if anything needs to be improved , I’ll be happy to adjust.

@LeoSSpecht
Copy link

Hello Gustavo!
Congrats on your first PR. (I am also new here, I just saw your PR and thought I could give you a heads up before the maintainer team reviews it)

The main point that I believe you will need to fix before proceeding is fixing the unit tests. You can check them by clicking on the check itself, and see why and which tests are failing (let me know if you need help fixing them!)
Screenshot 2025-06-04 at 5 27 14 PM

I also left a small question on the code itself.

Again, great job!

return request(`/pixQrCode/simulate-payment?id=${data.id}`, {
method: 'POST',
body: JSON.stringify(data),
body: JSON.stringify({ metadata: {} }),

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here originally they were passing in the data parameter. I agree with you change of not sending in the original data.

However, it might valid to pass in an additional (optional) argument so the user can pass in metadata that could later be passed into the response.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants