Comments (5)
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.
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.
Thanks! I was able to reproduce the issue... I'll take a look tonight and hopefully have a fix for you shortly.
from authorizesauce.
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.
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)
- Handle unicode characters in user details HOT 1
- Is the transaction status API supported ? HOT 1
- list index out of range in authorize->apis->transaction.py, line 26 (Parsing response) HOT 3
- from authorize import AuthorizeClient, CreditCard, Address ImportError: cannot import name AuthorizeClient HOT 2
- How to submit phone number and description when capturing card? HOT 3
- 'AuthorizeSavedCard' object has no attribute 'recurring' HOT 1
- Provide email address along with address data HOT 1
- Will these Authorize.NET changes affect this package? HOT 1
- Submitting Invoice Number with Transaction HOT 2
- Authorize.net Technical Updates
- Recurring payments on savedcard HOT 1
- User Authentication Failed HOT 1
- Re: Version of LT that also applies a modifier key #121 HOT 2
- <urlopen error [Errno -2] Name or service not known> HOT 2
- POST requests for transaction calls HOT 8
- Order Information
- AuthorizeConnectionError HOT 10
- Authorize.net error code 66 HOT 8
- Exception: (550, 'Unknown') HOT 10
- Authorize.Net error. E00027: A duplicate transaction has been submitted.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from authorizesauce.