Coder Social home page Coder Social logo

Comments (5)

jeffsmohan avatar jeffsmohan commented on August 19, 2024

I'd be happy to investigate, but you appear to be using your own user-defined functions. I can't reproduce the issue because I don't know what things like preauth(...) and refund(...) are doing.

Can you either provide a full list of steps to reproduce or a failing test for me to work against?

from authorizesauce.

salsakran avatar salsakran commented on August 19, 2024

Oops. You're right. See below:
client = AuthorizeClient('285tUPuS', '58JKJ4T95uee75wd')
cc = CreditCard('4111111111111111', 2018, '01', '911', 'Joe', 'Blow')
card = client.card(cc)
saved_card = card.save()
saved_card_id = saved_card.uid

retrieved_card = client.saved_card(saved_card_id)
transaction = retrieved_card.auth(200)

recreated_transaction = client.transaction(transaction.uid)
recreated_transaction.settle()

second_recreated_transaction = client.transaction(recreated_transaction.uid)
second_recreated_transaction.credit('1111')

from authorizesauce.

jeffsmohan avatar jeffsmohan commented on August 19, 2024

Thanks! I was able to reproduce the issue... I'll take a look tonight and hopefully have a fix for you shortly.

from authorizesauce.

jeffsmohan avatar jeffsmohan commented on August 19, 2024

There are three issues at play here. The first is how the Authorize API handles credit amounts. The second is the difference between linked and unlinked credits. The third is the way Authorize handles transactions submitted for settlement.

Credits, Part One

I'm honestly not sure where I first got the idea that the amount field is optional for credit transactions. (It makes sense, but I can longer find any reference to it in the docs.) So I'm changing the AuthorizeSauce package and docs to reflect that the amount is required. If you need to refund the full amount of a transaction, it will be your app's responsibility to remember the amount of the original charge. (This is probably something you're doing anyway.)

Credits, Part Two

Authorize.net's API supports two flavors of credit transactions: linked credits and unlinked credits. Linked credits are linked to a previous transaction processed through Authorize.net and must meet a number of amount and timing restrictions. Unlinked credits are not linked to a previous transaction and skirt the restrictions on linked credits. However, before you can accept unlinked credits, you must apply for the ability on your account. Since this is not functionality I personally need and is likely less common, I plan to drop support for it. I'm updating the AuthorizeSauce method call and docs to reflect that the transaction id will be required for credit transactions. (If you want to see support for unlinked credits, pull requests are welcome!)

Settlement

Credits can only be issued for settled transactions in Authorize.net. However, simply telling the API to settle a previous charge authorization does not mean the charge is truly settled; it merely means the charge has been submitted for settlement. In production, Authorize.net settles the charges you submit for settlement once a day. In the testing sandbox, you apparently need to ask for special permission just to get your charges to settle, as described in this support thread. And even in the sandbox, it takes about 10 minutes for the charge to be truly settled. This makes running an automated test suite for credit transactions impractical, but once the AuthorizeSauce test account has been set up to settle charges, I will test the functionality by hand.

Wrap-Up

Sorry for all the detail, but payments have the nasty tendency to get really complicated. I've tried to hide as much of the complication as possible behind a relatively simple and straightforward AuthorizeSauce API, but sometimes stuff leaks through. Hopefully these updates to Sauce's API and docs make credits a bit easier and more clear. Once I've been given the power in the test sandbox and verified that settlements and credits work, I can put an updated version on PyPI. Thanks for the report! Let me know if you run into any further issues.

from authorizesauce.

jeffsmohan avatar jeffsmohan commented on August 19, 2024

Unfortunately, it appears it isn't possible to add credits to the automated test suite. Here's a portion of the email I received from Authorize.net about it:

Unfortunately it is not possible to force a batch on both test and live accounts. You will need to wait for your transactions to settle which happens once every 24 hours in able to run a refund against them.

from authorizesauce.

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.