-
Notifications
You must be signed in to change notification settings - Fork 50
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
Failback to sandbox only on specific status #26
Conversation
Current coverage is 89.10%@@ master #26 diff @@
==========================================
Files 8 8
Lines 320 321 +1
Methods 0 0
Messages 0 0
Branches 0 0
==========================================
+ Hits 285 286 +1
Misses 35 35
Partials 0 0
|
@@ -89,7 +90,8 @@ def verify(self, **options): | |||
try: | |||
response = self.verify_from(RECEIPT_PRODUCTION_VALIDATION_URL, verify_ssl) | |||
except exceptions.InvalidReceipt: | |||
if not use_sandbox: | |||
if not use_sandbox and (response is None or |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
response
will be always None
in this case. So this patch doesn't fix the behavior of the code. (Because it is always True
)
Instead of it, InvalidReceipt
will have a property status
. So how about to try:
if not use_sandbox and e.status != STATUS_SANDBOX_RECEIPT_ERROR:
Travis will test it when you make a PR :) Thanks for a nice patch. |
😄 |
According to iTunes documentation, their production API will return specific status in case when we are sending transaction raw data from their sandbox's environment:
https://developer.apple.com/library/ios/technotes/tn2413/_index.html#//apple_ref/doc/uid/DTS40016228-CH1-RECEIPTURL
Hence, we do not need to send any other failed transactions (those which returned status other than 21007) to sandbox in case when both production and sandbox environments are used.
Note: while testing on my machine (excluding py2.6, 3.3 and pypi) I got FAIL for py27 in test_receipt, line
assert isinstance(in_app0.original_purchase_date_ms, int)
- 1432002585000L is not an int (if applicable, I'm using 32bit OS).