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

feat: Added missing info to IAP transaction and product structures #31739

Conversation

kevinlinv
Copy link
Contributor

@kevinlinv kevinlinv commented Nov 8, 2021

Description of Change

The In-app purchase is a module that allows us to communicate with Apple's Mac App Store by using Store Kit. It allows us to get product information to be displayed to users and make purchases if users choose to do so.

There are a few missing fields in the data structures used for in-app purchase, specifically subscription information on Product and payment discount information on Transaction. Referencable from:

This PR register those missing fields to the structure definition, get and convert the data to be returned.

Resolves #31738.

⚠️ Disclaimer ⚠️

This is the first time I've ever coded in C++ or Objective-C I mostly followed prior PR: #25058. I would be happy for maintainers to take it over if it would get the PR move along faster.

Also, I wasn't able to get electron build locally (running to errors when using build-tools), is there any way for me to get a build of electron for mac from CI so that I could test the in-app purchase? The artifacts seem to be uploaded in CI, given that I can pass the build that is.

Checklist

Release Notes

Notes: feat: Added missing info to in-app purchase's transaction and product structures

@welcome
Copy link

welcome bot commented Nov 8, 2021

💖 Thanks for opening this pull request! 💖

We use semantic commit messages to streamline the release process. Before your pull request can be merged, you should update your pull request title to start with a semantic prefix.

Examples of commit messages with semantic prefixes:

  • fix: don't overwrite prevent_default if default wasn't prevented
  • feat: add app.isPackaged() method
  • docs: app.isDefaultProtocolClient is now available on Linux

Things that will help get your PR across the finish line:

  • Follow the JavaScript, C++, and Python coding style.
  • Run npm run lint locally to catch formatting errors earlier.
  • Document any user-facing changes you've made following the documentation styleguide.
  • Include tests when adding/changing behavior.
  • Include screenshots and animated GIFs whenever possible.

We get a lot of pull requests on this repo, so please be patient and we will get back to you as soon as we can.

@electron-cation electron-cation bot added the new-pr 🌱 PR opened in the last 24 hours label Nov 8, 2021
@kevinlinv
Copy link
Contributor Author

kevinlinv commented Nov 8, 2021

Would love to get this backported to v15 v16 if possible.

@codebytere
Copy link
Member

hey @kevinlinv! thanks for this - we'll start the review process as soon as we can!

@jkleinsc jkleinsc added the semver/minor backwards-compatible functionality label Nov 8, 2021
@kevinlinv kevinlinv force-pushed the kevin/iap-add-missing-info-to-transaction-and-product-structures branch from 7888617 to 164e122 Compare November 9, 2021 03:51
@kevinlinv

This comment has been minimized.

@kevinlinv kevinlinv force-pushed the kevin/iap-add-missing-info-to-transaction-and-product-structures branch 2 times, most recently from 32ff659 to 24420a2 Compare November 9, 2021 10:59
@kevinlinv

This comment has been minimized.

@kevinlinv

This comment has been minimized.

@kevinlinv kevinlinv force-pushed the kevin/iap-add-missing-info-to-transaction-and-product-structures branch from 24420a2 to cd8844b Compare January 3, 2022 23:13
@kevinlinv

This comment has been minimized.

Copy link
Contributor

@jkleinsc jkleinsc left a comment

Choose a reason for hiding this comment

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

API LGTM

@kevinlinv

This comment has been minimized.

@kevinlinv

This comment has been minimized.

shell/browser/api/electron_api_in_app_purchase.cc Outdated Show resolved Hide resolved
shell/browser/api/electron_api_in_app_purchase.cc Outdated Show resolved Hide resolved
shell/browser/api/electron_api_in_app_purchase.cc Outdated Show resolved Hide resolved
shell/browser/api/electron_api_in_app_purchase.cc Outdated Show resolved Hide resolved
shell/browser/mac/in_app_purchase_observer.mm Outdated Show resolved Hide resolved
shell/browser/mac/in_app_purchase_observer.mm Show resolved Hide resolved
shell/browser/mac/in_app_purchase_product.h Outdated Show resolved Hide resolved
shell/browser/mac/in_app_purchase_product.h Outdated Show resolved Hide resolved
shell/browser/mac/in_app_purchase_product.h Outdated Show resolved Hide resolved
@kevinlinv kevinlinv force-pushed the kevin/iap-add-missing-info-to-transaction-and-product-structures branch from cd8844b to 9a54f2a Compare January 13, 2022 03:04
@kevinlinv
Copy link
Contributor Author

kevinlinv commented Jan 13, 2022

@nornagon thank you for the review! 🙌

Quick summary of changes applied after your feedback:

  1. On exposing empty value to JS when there one from Objective C is unset — I've changed all to do as you suggested, it also follows the existing pattern of the module 👍
  2. On why nonce is commented out — I've left a comment, need some help to read UUID in Objective C.
  3. On removing nil check — I tried and found out that removing those checks actually causes the app to crash when the value is unset.

PTAL again 🙂

@kevinlinv kevinlinv force-pushed the kevin/iap-add-missing-info-to-transaction-and-product-structures branch from b8f6d1e to 1390c3c Compare January 14, 2022 06:33
@kevinlinv
Copy link
Contributor Author

@nornagon thank you for the quick feedback loop.

Apologies for the slowness, I am do not have the setup locally and not well versed with the syntax 😅
I've addressed your feedback, PTAL again 👍

@kevinlinv kevinlinv force-pushed the kevin/iap-add-missing-info-to-transaction-and-product-structures branch from 3899cb3 to 6eb849e Compare January 21, 2022 01:34
@electron-cation electron-cation bot removed the new-pr 🌱 PR opened in the last 24 hours label Jan 24, 2022
@nornagon
Copy link
Member

Changing backport labels because we don't backport new features to stable branches without @electron/wg-releases approval.

@nornagon nornagon merged commit 2fe5d0e into electron:main Jan 24, 2022
@welcome
Copy link

welcome bot commented Jan 24, 2022

Congrats on merging your first pull request! 🎉🎉🎉

@release-clerk
Copy link

release-clerk bot commented Jan 24, 2022

Release Notes Persisted

Added missing info to in-app purchase's transaction and product structures.

@trop
Copy link
Contributor

trop bot commented Jan 24, 2022

I have automatically backported this PR to "17-x-y", please check out #32602

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api-review/requested 🗳 semver/minor backwards-compatible functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature Request]: Add missing fields on Transaction and Product in-app purchase structures
4 participants