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

[WEB-1757] Handle new backend error codes that may show in the redemption endpoint #4592

Merged
merged 1 commit into from
Dec 16, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion Sources/Error Handling/BackendErrorCode.swift
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,13 @@ enum BackendErrorCode: Int, Error {
case playStoreGenericError = 7231
case userIneligibleForPromoOffer = 7232
case invalidAppleSubscriptionKey = 7234
case couldNotCreateAlias = 7255
case invalidAppUserId = 7256
case subscriptionNotFoundForCustomer = 7259
case invalidSubscriberAttributes = 7263
case invalidSubscriberAttributesBody = 7264
case requestAlreadyInProgress = 7638
case subscriberAttributesAreBeingUpdated = 7629
case purchasedProductMissingInAppleReceipt = 7712
case invalidWebRedemptionToken = 7849
case purchaseBelongsToOtherUser = 7852
Expand Down Expand Up @@ -103,7 +107,8 @@ extension BackendErrorCode {
case .invalidPaymentModeOrIntroPriceNotProvided,
.productIdForGoogleReceiptNotProvided:
return .purchaseInvalidError
case .emptyAppUserId:
case .emptyAppUserId,
.invalidAppUserId:
return .invalidAppUserIdError
case .invalidAppleSubscriptionKey:
return .invalidAppleSubscriptionKeyError
Expand All @@ -112,6 +117,11 @@ extension BackendErrorCode {
case .invalidSubscriberAttributes,
.invalidSubscriberAttributesBody:
return .invalidSubscriberAttributesError
case .couldNotCreateAlias:
return .configurationError
tonidero marked this conversation as resolved.
Show resolved Hide resolved
case .requestAlreadyInProgress,
.subscriberAttributesAreBeingUpdated:
return .operationAlreadyInProgressForProductError
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Note that this error matches android's OperationAlreadyInProgressError without the ForProduct part... I think I prefer Android's naming but I didn't want to cause a breaking change due to this so I just reused the current naming.

case .unknownBackendError,
.playStoreInvalidPackageName,
.playStoreQuotaExceeded,
Expand Down