Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.

fix payment discount (iOS Promotional Offers) into being actually usable #6099

Closed

Conversation

crystalstorm
Copy link
Contributor

Make iOS Promotional Offers in in_app_purchase plugin usable

Resolves: [in-app-purchase][iOS] Promotional Offers in iOS not working

Pre-launch Checklist

  • I read the [Contributor Guide] and followed the process outlined there for submitting PRs.
  • I read the [Tree Hygiene] wiki page, which explains my responsibilities.
  • I read and followed the [relevant style guides] and ran [the auto-formatter]. (Unlike the flutter/flutter repo, the flutter/plugins repo does use dart format.)
  • I signed the [CLA].
  • The title of the PR starts with the name of the plugin surrounded by square brackets, e.g. [shared_preferences]
  • I listed at least one issue that this PR fixes in the description above.
  • I updated pubspec.yaml with an appropriate new version according to the [pub versioning philosophy], or this PR is [exempt from version changes].
  • I updated CHANGELOG.md to add a description of the change, [following repository CHANGELOG style].
  • I updated/added relevant documentation (doc comments with ///).
  • I added new tests to check the change I am making, or this PR is [test-exempt].
  • All existing and new tests are passing.

@crystalstorm crystalstorm requested a review from cyanglaz as a code owner July 13, 2022 11:40
@flutter-dashboard
Copy link

It looks like this pull request may not have tests. Please make sure to add tests before merging. If you need an exemption to this rule, contact Hixie on the #hackers channel in Chat (don't just cc him here, he won't see it! He's on Discord!).

If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix?

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing.

Copy link
Contributor

@cyanglaz cyanglaz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also needs tests

Comment on lines +84 to +86
static Future<bool> buyNonConsumableWithDiscount(
{required PurchaseParam purchaseParam, SKPaymentDiscountWrapper? discount}) async {
await _skPaymentQueueWrapper.addPayment(SKPaymentWrapper(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is it a static method while it is using an instance variable?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would imagine the discount can be part of the PurchaseParam

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cyanglaz the instance variable is also static. I agree it is not the best option. I merely wanted a working solution to open a pull request with. Then have a discussion about how to resolve it, or have it resolved by someone from the maintainers.

If it's part of PurchaseParam, this method would not be needed at all but I presume there should be also Android counterpart . In the original Pull request I saw only iOS implementation. I don't know how the Android offers work (if there are any).

@stuartmorgan-g
Copy link
Contributor

Thanks for the contribution! You’ve checked boxes in the PR checklist above that are not reflected in this PR, so I’m assuming this is a work in progress and am marking it as a Draft. Please review the checklist, updating the PR as appropriate, and when the checklist reflects the state of the PR as posted please feel free to mark it as ready for review.

Also, it would be helpful if you could provide more information in the issue about what exactly you were doing and what didn't work; it just asserts that the feature doesn't work without much detail, which makes it hard to evaluate.

@stuartmorgan-g stuartmorgan-g marked this pull request as draft July 13, 2022 16:58
@crystalstorm
Copy link
Contributor Author

@stuartmorgan indeed it's work in progress.

About missing details, will this be helpful enough:

I was trying to implement iOS Promotional offers using the in-app-purchase plug in. I did not found any example of how it could be done in the original repo or articles in the web. It seems like nobody has done it, or mentioned how it is doable. I found the Pull request where the Promotional offers were implemented in the plugin: here . But there was no example of using it either. Browsing trough the code I found out there is no direct way to use newly added SKPaymentDiscountWrapper class upon which the feature relies. There are 2 other issues related with the current implementation mentioned in my comment here

and if so, do you need it posted in the original issue body text?

@stuartmorgan-g
Copy link
Contributor

Since this is marked as a draft and hasn't been updated in several months I'm going to close it to clean out our review queue. Please don't hesitate to submit a new PR if you decide to revisit this. Thanks!

@crystalstorm
Copy link
Contributor Author

@stuartmorgan I've opened another PR here which isn't a draft. Hopefully it will be more useful than this one.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[in-app-purchase][iOS] Promotional Offers in iOS not working
3 participants