jnbt / candy_check

Check and verify in-app receipts
MIT License
125 stars 70 forks source link

Subscription support #6

Closed klaseskilson closed 8 years ago

klaseskilson commented 8 years ago

This adds support for both the App Store's and Play Store's subscriptions. By using the verifiers' verify_subscription methods, you can verify subscriptions much like you can verify subscriptions much like you can verify single purchases.

Hit me with your feedback! I'd love to hear your thoughts on what I've done. 👍

coveralls commented 8 years ago

Coverage Status

Coverage increased (+0.04%) to 99.879% when pulling 0a5c7c9e66fbd4c9940d556f14d3dad4874fcf74 on fishbrain:feature/subscription-support into 5068611020116756f65e9fa14166b15ab93a5322 on jnbt:master.

coveralls commented 8 years ago

Coverage Status

Coverage increased (+0.04%) to 99.879% when pulling a643100a8fd3f3954b1540b835cb4260f8e27c44 on fishbrain:feature/subscription-support into 5068611020116756f65e9fa14166b15ab93a5322 on jnbt:master.

jnbt commented 8 years ago

@klaseskilson Big 👏 ! This is really an awesome contribution. I'm happy to merge it soon. Especially as I haven't used the subscriptions yet!

Could you have a look at some of my annotations?

And another question: Do you have an Idea how to test it against the real APIs? I think the subscription verification is still lacking CLI support lib/cli/app.rb, but I'm more then willing to implement this myself. I think to test iOS we need to find / generate some receipt data for a subscription. For Android a valid subscription?

klaseskilson commented 8 years ago

@jnbt Sounds great, I'll take a look at your comments asap. I left out CLI support for now, yes. If you don't mind implementing it yourself, go ahead. 👍

coveralls commented 8 years ago

Coverage Status

Coverage increased (+0.04%) to 99.88% when pulling 8b67dfbba9e990bf02dcf33b8a18622500a78cff on fishbrain:feature/subscription-support into 5068611020116756f65e9fa14166b15ab93a5322 on jnbt:master.

klaseskilson commented 8 years ago

@jnbt Pushed some changes now.

Regarding testing against the real APIs, I'm not sure either. I guess you would need some sort of real data or subscription info and the corresponding authorization keys. That might be semi-tricky to get a hold of, since it might contain sensitive information.

I guess some information could be stored in a CI environment to allow for tests that way, but that will create a tricky situation when it comes to local testing. Also in a CI situation, storing the P12 file securely is kind of tricky and keeping auth keys to Google up to date is a hassle.

jnbt commented 8 years ago

The same holds for all PlayStore verifications as they also require a secret. At least I did some local testing on my machine for these cases.

I think I try to setup an iOS and PlayStore test app and configure at least one product and one subscription. We might even use Travis to test it, as we could encrypt these data.

jnbt commented 8 years ago

Addition: For obvious reasons we could only test against sandbox... (but this is more than nothing.)

klaseskilson commented 8 years ago

Oh right, Travis supports encryption!

Is this something you want me to look at before merging this PR?

jnbt commented 8 years ago

I'll merge it in the current state. Thanks for all the work. Do you have an urgent use case? Otherwise I'd prefer to do the CLI part before publishing a new gem version. This would also allow some manual integration testing. Have you performed any real interactions against the subscription API while developing the extension?

klaseskilson commented 8 years ago

I tottaly agree that a way to test subscriptions manually should be made possible before publishing a new version. I'm fine waiting, I can pull it through git meanwhile.

Awesome work on the gem, thanks for merging! 👌

jnbt commented 8 years ago

I'll try to have a look at CLI this or next week.

klaseskilson commented 8 years ago

Awesome, let me know if you need any help regarding subscriptions!

jnbt commented 8 years ago

Thanks, I've already invited you to be a collaborator.

klaseskilson commented 8 years ago

Thank you! Looking forward to contributing with subscriptions! 🍻