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

Failback to sandbox only on specific status #26

Merged
merged 3 commits into from
May 12, 2016

Conversation

kmitrovic
Copy link
Contributor

@kmitrovic kmitrovic commented May 11, 2016

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).

@coveralls
Copy link

coveralls commented May 11, 2016

Coverage Status

Coverage increased (+0.03%) to 89.097% when pulling 4e9b809 on kmitrovic:master into 7033d8d on youknowone:master.

@codecov-io
Copy link

codecov-io commented May 11, 2016

Current coverage is 89.10%

Merging #26 into master will increase coverage by +0.03%

@@             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          

Sunburst

Powered by Codecov. Last updated by 7033d8d...4e9b809

@@ -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
Copy link
Owner

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:

@youknowone
Copy link
Owner

youknowone commented May 11, 2016

Travis will test it when you make a PR :)
I think this is an important improvement of the reviewing behavior. But for the detail, I made a comment about it.

Thanks for a nice patch.

@coveralls
Copy link

coveralls commented May 11, 2016

Coverage Status

Coverage increased (+0.03%) to 89.097% when pulling 05a38fa on kmitrovic:master into 7033d8d on youknowone:master.

@youknowone youknowone merged commit 45a9cae into youknowone:master May 12, 2016
@youknowone
Copy link
Owner

😄

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.

None yet

4 participants