Wizcorp / node-iap

In-app purchase validation for Apple, Google, Amazon, Roku
262 stars 92 forks source link

Validating against last purchased item instead of first one. #60

Closed abdielou closed 5 years ago

abdielou commented 5 years ago

There's an issue when working with Grouped Subscriptions.

Suppose we have a Subscription group with 3 subscriptions: sub1, sub2 and sub3.

The code originally validated against the first item of whatever Apple returned. The problem is that the list can contain any item of the group, thus, if the first purchase is for ID sub1, that's going to be the only item picked when validating the fields. Thus, if the last subscription purchased was for ID sub3, we will get an error when validating against the parameters sent to this module since the current productId would be sub3, yet it will be validated against the first item returned by Apple, with ID sub1.

Hope this helps. It's working on my side.

ronkorving commented 5 years ago

Thanks, I like it 👍 I would not mind a second pair of eyes though, perhaps @superandrew213 or @justinpage?

superandrew213 commented 5 years ago

@ronkorving looks good

justinpage commented 5 years ago

LGTM 👍

ronkorving commented 5 years ago

Thanks everyone!