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

PurchaseTester: improved ReceiptInspector so it accepts receipts with escape sequences #3554

Merged
merged 2 commits into from
Jan 17, 2024

Conversation

aboedo
Copy link
Member

@aboedo aboedo commented Jan 5, 2024

Receipts in logs have extra escape sequences now (forward slashes), so this updates the ReceiptInspector tool to be able to accept them for easier usage.

It also accepts extra " so that if you copied slightly incorrectly it still works.

@aboedo aboedo added the test Adding missing tests or correcting existing tests label Jan 5, 2024
@aboedo aboedo self-assigned this Jan 5, 2024
@aboedo aboedo requested a review from a team January 5, 2024 20:11
// in kibana, receipts get encoded with extra `\`s
let receiptWithoutForwardSlashes = encodedReceipt.replacingOccurrences(of: "\\", with: "")
// just in case you accidentally copied with extra double-quotations
let receiptWithoutQuotations = receiptWithoutForwardSlashes.replacingOccurrences(of: "\"", with: "")
Copy link
Contributor

Choose a reason for hiding this comment

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

FFTI, should we only remove start/end characters instead of all occurences? I think this should also work though, but in order to minify possible changes.

Copy link
Member Author

Choose a reason for hiding this comment

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

I thought about it, but I don't think we stand to gain much?

Like, the receipt won't work locally unless it's a valid receipt (save for the double-quotes), and it won't validate against /verifyReceipt unless the contents are unaltered, so it's pretty safe to just assume you can remove them all in the easiest way possible

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah... I guess if it ever could be a valid character it would be a problem, but I don't see that happening. It's fine as it is 👍

@NachoSoto NachoSoto force-pushed the andy/accept_forward_slashes_in_receipts branch from 4a0dd7c to 7116f15 Compare January 16, 2024 17:38
@NachoSoto NachoSoto enabled auto-merge (squash) January 16, 2024 17:38
@NachoSoto
Copy link
Contributor

Rebased.

@NachoSoto NachoSoto changed the title PurchaseTester: improved ReceiptInspector so it accepts receipts with escape sequences PurchaseTester: improved ReceiptInspector so it accepts receipts with escape sequences Jan 16, 2024
@NachoSoto NachoSoto enabled auto-merge (squash) January 16, 2024 18:24
Copy link

codecov bot commented Jan 17, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (6f19874) 85.98% compared to head (7116f15) 86.03%.
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3554      +/-   ##
==========================================
+ Coverage   85.98%   86.03%   +0.04%     
==========================================
  Files         242      242              
  Lines       17617    17617              
==========================================
+ Hits        15148    15156       +8     
+ Misses       2469     2461       -8     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@NachoSoto NachoSoto merged commit 43652af into main Jan 17, 2024
26 checks passed
@NachoSoto NachoSoto deleted the andy/accept_forward_slashes_in_receipts branch January 17, 2024 00:01
NachoSoto pushed a commit that referenced this pull request Jan 17, 2024
**This is an automatic release.**

### New Features
* `StoreProduct`: add localized price per period strings (#3546) via
Andy Boedo (@aboedo)
### RevenueCatUI
* `Paywalls`: new `.onPurchaseCancelled` and
`paywallViewControllerDidCancelPurchase:` (#3578) via NachoSoto
(@NachoSoto)
* `Paywalls`: improve error display (#3577) via NachoSoto (@NachoSoto)
### Dependency Updates
* Bump fastlane-plugin-revenuecat_internal from `0ddee10` to `e6ba247`
(#3575) via dependabot[bot] (@dependabot[bot])
### Other Changes
* `PurchaseTester`: improved `ReceiptInspector` so it accepts receipts
with escape sequences (#3554) via Andy Boedo (@aboedo)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
test Adding missing tests or correcting existing tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants