Conversation
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 080c233. Configure here.
tanguyenvn
reviewed
Sep 21, 2026
| } | ||
|
|
||
| /** | ||
| * Returns whether the delegation has exhausted its cumulative allowance. |
Contributor
There was a problem hiding this comment.
the point "exhausted cumulative allowance" in ticket description is not valid anymore.
This branch was successfully deployed
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.

Summary
This PR adds subscription-controller support for Money Account delegation payment states, delegation rotation, and access-token refreshes.
Changes
lastInvoiceresponse data.paymentMethod.crypto.error.lastInvoice.errorCode.updatePaymentMethodrequest variant for SUB-920 rotation.triggerAccessTokenRefresh()so the Authentication service can refresh themoneyAccountPlanclaim.Error handling
The controller interprets Subscription API payment errors as follows:
insufficient_balancedelegation_not_foundexceeds_delegation_allowancedelegation_revokedrecipient_not_allowlistedinternal_server_errorinsufficient_allowanceDelegation rotation flow
Consumers can rotate an active subscription by:
SubscriptionDelegationService:prepareDelegation(request, true).delegationHashtoSubscriptionController:updatePaymentMethod.The subscription is updated in place and is not recreated.
References
https://consensyssoftware.atlassian.net/browse/SUB-885?atlOrigin=eyJpIjoiZTk1OWY4YjQ5YWJlNGRkYzkwMWEzYzdlZGU4Y2Y0ZGQiLCJwIjoiaiJ9
Checklist
Note
Medium Risk
Breaking
Subscriptiontyping and expanded payment/delegation flows affect consumers and access-token refresh timing around billing failures.Overview
Adds Money Account Plus support for crypto payment-execution failures from the Subscription API, including typed
CRYPTO_PAYMENT_ERRORS, optionalSubscription.lastInvoice, and product-scoped selectors (selectIsPaymentFailed,selectPaymentFailureReason,selectIsRenewalNeeded,selectIsDelegationExhausted) that readlastInvoice.errorCode, notpaymentMethod.crypto.error.Breaking:
Subscription.currentPeriodStart,currentPeriodEnd,cancelType, andisEligibleForSupportare now optional so paused/failed crypto subscriptions validate. Response parsing and structs accept the new invoice shape and reject unknown execution error codes.Consumers can rotate delegation payment methods via a delegation-specific
UpdatePaymentMethodCryptoRequest(cryptoAuthMethod+delegationHash).SubscriptionDelegationService:prepareDelegationaccepts optionalforceNewand, when reusing stored delegations, picks the match with the latest periodstartDateso newer replacements win over older equivalents.Subscription snapshot changes (including payment-failure updates while status stays active) still drive
triggerAccessTokenRefreshsomoneyAccountPlanclaims stay in sync; Shield behavior is covered by tests.Reviewed by Cursor Bugbot for commit 0e39b86. Bugbot is set up for automated code reviews on this repo. Configure here.