PostReceiptDataOperation: print receipt data if debug logs are enabled#1940
Merged
Conversation
For [CSDK-478]. Follow up to #1929.
PostReceiptDataOperation: print receipt data if debug logs are enabledPostReceiptDataOperation: print receipt data if debug logs are enabled
aboedo
approved these changes
Sep 27, 2022
aboedo
left a comment
Member
There was a problem hiding this comment.
this is gonna save a tooon of time when debugging
Comment on lines
+137
to
+145
| static let prettyPrinted: JSONEncoder = { | ||
| let encoder = JSONEncoder() | ||
| encoder.keyEncodingStrategy = .convertToSnakeCase | ||
| encoder.dateEncodingStrategy = .iso8601 | ||
| encoder.outputFormatting = .prettyPrinted | ||
|
|
||
| return encoder | ||
| }() | ||
|
|
Member
There was a problem hiding this comment.
👏 I just went through the terrible experience of formatting some receipts we had printed with the default format and it was terrible
NachoSoto
commented
Sep 27, 2022
| case parsing_receipt | ||
| case refreshing_empty_receipt | ||
| case unable_to_load_receipt | ||
| case posting_receipt(AppleReceipt) |
Contributor
Author
There was a problem hiding this comment.
Type-safe logging APIs FTW
aboedo
approved these changes
Sep 27, 2022
NachoSoto
commented
Sep 27, 2022
| do { | ||
| let receipt = try await Purchases.shared.fetchReceipt(.always) | ||
| let description = receipt.map { $0.description } ?? "<null>" | ||
| let description = receipt.map { $0.debugDescription } ?? "<null>" |
Contributor
Author
There was a problem hiding this comment.
Using the new code from tests as well.
NachoSoto
pushed a commit
that referenced
this pull request
Sep 28, 2022
**This is an automatic release.** ### Other Changes * `ProductsFetcherSK2`: removed now redundant caching logic (#1908) via NachoSoto (@NachoSoto) * Created `CachingProductsManager` to provide consistent caching logic when fetching products (#1907) via NachoSoto (@NachoSoto) * Refactored `ReceiptFetcher.receiptData` (#1941) via NachoSoto (@NachoSoto) * Abstracted conversion from `async` to completion-block APIs (#1943) via NachoSoto (@NachoSoto) * Moved `InAppPurchase` into `AppleReceipt` (#1942) via NachoSoto (@NachoSoto) * `Purchases+async`: combined `@available` statements into a single one (#1944) via NachoSoto (@NachoSoto) * `Integration Tests`: don't initialize `Purchases` until the `SKTestSession` has been re-created (#1946) via NachoSoto (@NachoSoto) * `PostReceiptDataOperation`: print receipt data if `debug` logs are enabled (#1940) via NachoSoto (@NachoSoto) Co-authored-by: RCGitBot <dev+RCGitBot@revenuecat.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
For CSDK-478.
Follow up to #1929.
Example: