Giter VIP home page Giter VIP logo

Comments (3)

rwhirn avatar rwhirn commented on July 19, 2024

The call to the API in the SDK looks like this:
Array (
[query] => Array ([$include] => [documentType] => 1 [useTaxDateOverride] => true)
[body] => { "refundTransactionCode":"1320108-REFUND", "refundDate":"2021-03-27", "refundType":2, refundPercentage":null, "refundLines":null, "referenceCode":"Tax refunded"}
[auth] => Array ([0] => [1] => )
[headers] => Array ([Accept] => application/json [X-Avalara-Client] => FYPapp; 1.0; PhpRestClient; 20.1.0; localhost)
)

But the examples in the Postman collection looks like this:
https://rest.avatax.com/api/v2/companies/DEFAULT/transactions/1319742/refund {"refundTransactionCode":"1319742-REFUND","refundDate":"2021-08-16","refundType":"Full","referenceCode":"Refund for a committed transaction"}

The Postman example works, but notice "refundType":"Full"

Why does the SDK Constants.php make it an integer?

(Same as issue #106 to which there has never been a reply)

from avatax-rest-v2-php-sdk.

rwhirn avatar rwhirn commented on July 19, 2024

BTW, what values can be entered for "refundType" is not documented anywhere in the documentation, neither https://developer.avalara.com/api-reference/avatax/rest/v2/methods/Transactions/RefundTransaction/

nor Swagger https://sandbox-rest.avatax.com/swagger/ui/index.html#/Transactions/RefundTransaction

The only place I found them listed was in https://developer.avalara.com/static/pdf/AvaTaxAPIDeveloperGuide2018.pdf

You can choose to use the RefundTransaction API in a few different ways:
•• You can refund the entire transaction by setting “refundType”: “Full”.
•• You can refund specific lines from a transaction by specifying “refundType”: “Partial”, and setting a list of lines to refund using the refundLines parameter to the list of line numbers of the lines that are being refunded.
•• If your customer originally paid sales tax on the transaction, and they later provided a resale exemption certificate, you can call set the “refundType”: “TaxOnly”.
•• If you wish to give a customer a percentage refund, perhaps for a discount, you can specify “refundType”: “Percentage”.

from avatax-rest-v2-php-sdk.

svc-developer avatar svc-developer commented on July 19, 2024

After investigation we found that ENUMS/Constants work fine in PHP SDK. If we pass the ENUMS as String Constant it works and also if we pass ENUM Value as String that works as well.

So in the above example, if we pass "refundType":"2" or "refundType":"TAXONLY" then it will work as expected.

However if we pass ENUM value as INTEGER (like "refundType":2), it doesn’t work. We agree that some of the documentation needs to be more clear about this.

Closing the ticket for now.

from avatax-rest-v2-php-sdk.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.