dooboolab-community / flutter_inapp_purchase

(Sun Rised!) Flutter plugin for In App Purchase.
MIT License
549 stars 235 forks source link

Upgrade to billing 5.1 (reverse compatible) #392

Closed SamBergeron closed 1 year ago

SamBergeron commented 1 year ago

This is build off of @youssefali424 #387 PR because that one had a couple issues. It didn't pass back the prices properly for items that were created in android billing 4.0 amongst other issues.

I created two new dart objects that reflect android 5.0 billing objects SubscriptionOffer and PricingPhase that pass back all the information associated with a play store item, so you can navigate those to extract introductory offers and discounted subscriptions as opposed to just having a single offer price.

I've also kept the price, currency and localizedPrice values and made them backwards compatible with items that were updated from billing 4.0 if your app relies on those (ours did)

Note that the tests fail because of ios and android receipt validation only, which appears to not point to a valid URL anymore.

All tests are passing and extra code coverage has been added

codecov[bot] commented 1 year ago

Codecov Report

Merging #392 (e12fe7b) into main (2ed8e1d) will increase coverage by 5.51%. The diff coverage is 96.77%.

@@            Coverage Diff             @@
##             main     #392      +/-   ##
==========================================
+ Coverage   42.18%   47.69%   +5.51%     
==========================================
  Files           4        4              
  Lines         467      478      +11     
==========================================
+ Hits          197      228      +31     
+ Misses        270      250      -20     
Impacted Files Coverage Δ
lib/flutter_inapp_purchase.dart 46.95% <87.50%> (ø)
lib/modules.dart 46.96% <100.00%> (+15.19%) :arrow_up:

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

nizwar commented 1 year ago

Hi, i've try your PR and i got what i expected, but there is one issue in this PR and i believe its from native side image

Also for minors, add toJson() and toString() on SubscriptionOfferAndroid and PricingPhaseAndroid will be much appreciated

SamBergeron commented 1 year ago

@nizwar gotcha, I didn't manually re-test all the methods I didn't modify but that error makes sense to me, I'll try and fix it today and do a bit more hands-on testing

SamBergeron commented 1 year ago

Any chance we can get a timeline on this? Would be great to be able to not have to use a forked plugin in production

SamBergeron commented 1 year ago

@hyochan what's missing for this to be merged in? We've been using it in production for over a month without issue.

hyochan commented 1 year ago

@SamBergeron @xPutnikx @nizwar shipped as 5.4.0 🚀

deakjahn commented 1 year ago

@SamBergeron Is this still the reason why I can't see my price after upgrading to 5.4.0? I get introductoryPrice all right but nothing else, no price or localizedPrice. All Android libraries are up-to-date, price is set correctly in Google Play, it still works all right with my current release version out there, just not with the upgraded plugin here. Do I need to make changes in my code or is it just a regression of some sort?

(No subscription, just a single in-app product.)

deakjahn commented 1 year ago

By the way, small error, toString() of IAPItem has an error, it displays two items with the label introductoryPricePaymentModeIOS, the first one is superfluous, it's a repeated display of introductoryPrice.