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

Fix invalid refund endpoint call #86

Closed
wants to merge 3 commits into from

Conversation

Noah-Silvera
Copy link
Member

@Noah-Silvera Noah-Silvera commented Jun 23, 2021

What is the goal of this PR?

The refund endpoint is meant to be used to post a transaction that represents the delta of changes to the order. This means that the amounts for the order total and sales tax passed should be negative.

An example can be found in the taxjar API

https://developers.taxjar.com/api/reference/?shell#post-create-a-refund-transaction

How do you manually test these changes? (if applicable)

  1. Manually trigger the create_refund_for endpoint on the extension
    • Ensure a refund with the appropriate negative values is created on your taxjar account

Merge Checklist

  • Run the manual tests
  • Update the changelog
  • Run a sandbox app and verify taxes are being calculated

@Noah-Silvera
Copy link
Member Author

Before updating the changelog, we should release the current changes we have on TaxJar, as they are currently non-breaking.

This is a breaking change we should do a separate version release for.

@Noah-Silvera Noah-Silvera linked an issue Jun 25, 2021 that may be closed by this pull request
@Noah-Silvera
Copy link
Member Author

I found a conflicting KB article posted in 2021 that says we should use positive values positing a refund :(

Will need to reach out to the taxjar team to check which pattern is actually the correct pattern

https://support.taxjar.com/article/351-handling-refunds-with-api

@nvandoorn
Copy link
Member

Thanks @Noah-Silvera! Should I start a thread with the TaxJar folks over email?

@Noah-Silvera
Copy link
Member Author

Thanks @Noah-Silvera! Should I start a thread with the TaxJar folks over email?

It's probably worth it just to be sure! I found one more piece of information that strengthens the case for negative values

In the taxjar API docs for create order, it says this

Screen Shot 2021-06-25 at 15 20 45PDT

And in the taxjar API docs for create refund, it says this

Screen Shot 2021-06-25 at 15 20 38PDT

I am 80% confident the KB article I linked is wrong, and would be comfortable merging this for now, but waiting to release this change until we have gotten 100% confidence from them that we should use negative values.

Noah-Silvera and others added 3 commits July 26, 2021 15:54
This variable is only used in one spec, so it should be moved into the
spec context.
Refunds in taxjar are transactions that have a negative delta against
the original order. Our API was incorrectly using TaxJar's refund
API by calling it with positive numbers, which would represent the
customer getting paid more, not getting refunded.
Co-authored-by: Noah Silvera <[email protected]>
@nvandoorn nvandoorn force-pushed the fix-invalid-refund-endpoint-call branch from 907cf0b to e38fec0 Compare July 26, 2021 23:01
@Noah-Silvera
Copy link
Member Author

We are deprecating this refund endpoint in favour of one that refunds based on a taxjar transaction and not a reimbursement, so we can close this PR.

@Noah-Silvera Noah-Silvera deleted the fix-invalid-refund-endpoint-call branch November 1, 2021 20:52
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.

Update refund API call to take into account line items
5 participants