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

PostReceiptDataOperation: added initiationSource parameter #1957

Merged
merged 3 commits into from
Oct 7, 2022

Conversation

NachoSoto
Copy link
Contributor

@NachoSoto NachoSoto commented Sep 29, 2022

For TRIAGE-82.

@NachoSoto NachoSoto added the perf label Sep 29, 2022
@NachoSoto NachoSoto requested a review from a team September 29, 2022 16:36
@NachoSoto NachoSoto force-pushed the post-receipt-user-initiated branch 3 times, most recently from d5f0a90 to 57e2e33 Compare September 29, 2022 17:06
@NachoSoto NachoSoto changed the title PostReceiptDataOperation: added userInitiated parameter PostReceiptDataOperation: added initationSource parameter Sep 30, 2022
@NachoSoto NachoSoto changed the title PostReceiptDataOperation: added initationSource parameter PostReceiptDataOperation: added initiationSource parameter Sep 30, 2022
@NachoSoto NachoSoto force-pushed the post-receipt-user-initiated branch 2 times, most recently from 56088bc to e48708e Compare September 30, 2022 17:14
@NachoSoto
Copy link
Contributor Author

This is ready (just need to fix the snapshots).
Integration tests will fail until backend is deployed (cc @antoniobg no rush though)

Copy link
Contributor

@tonidero tonidero left a comment

Choose a reason for hiding this comment

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

LGTM, just a naming suggestion but NABD

@@ -20,6 +20,20 @@ import StoreKit
/// - SeeAlso: `Backend/post(receiptData:appUserID:isRestore:productData:...`
struct ProductRequestData {

/// Determins what triggered a receipt to be posted
enum InitiationSource: CaseIterable {
Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm what do you think about ReceiptPostSource? Feels like a better name to me but looks like renaming would require a backend change and I don't think it's a big deal.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We don't have to match the backend, but I can see either way.
If we don't, we can have something more "Swifty", but I think the advantage of having this match the backend is familiarity, so this term is the same across different repos.
What do you think?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Maybe another thing to realize is that this isn't just InitiationSource, it's namespaced as ProductRequestData.InitiationSource.

Sources/Purchasing/ProductRequestData.swift Outdated Show resolved Hide resolved

// MARK: - InitiationSource

extension ProductRequestData.InitiationSource: Encodable, RawRepresentable {
Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm I do wonder if this would be better placed in the ProductRequestData.swift file... If it's only needed from here, this would be ok though

Copy link
Contributor Author

Choose a reason for hiding this comment

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

My goal with this is to keep the type definition simpler. This is more of an implementation detail of how the source is posted to the backend.

NachoSoto and others added 3 commits October 7, 2022 08:02
@NachoSoto NachoSoto merged commit 46d9366 into main Oct 7, 2022
@NachoSoto NachoSoto deleted the post-receipt-user-initiated branch October 7, 2022 15:21
NachoSoto added a commit that referenced this pull request Oct 10, 2022
NachoSoto added a commit that referenced this pull request Apr 25, 2023
…e transactions (#2430)

All StoreKit 1 transactions were being sent with
`InitiationSource.purchased`.
#1957 introduced this, but it was only set correctly for SK2.

The consequence of this is that users might see "invalid receipt" errors
when posting receipts due to updated transactions from the queue, which
can only happen for `InitiationSource.purchased`.
NachoSoto added a commit that referenced this pull request Apr 26, 2023
…e transactions (#2430)

All StoreKit 1 transactions were being sent with
`InitiationSource.purchased`.
#1957 introduced this, but it was only set correctly for SK2.

The consequence of this is that users might see "invalid receipt" errors
when posting receipts due to updated transactions from the queue, which
can only happen for `InitiationSource.purchased`.
@vegaro vegaro added pr:other and removed pr:perf labels Sep 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants