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.
feat(billing): implement promo code functionality #657
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
base: master
Are you sure you want to change the base?
Uh oh!
There was an error while loading. Please reload this page.
feat(billing): implement promo code functionality #657
Changes from all commits
9d1f51ad03e093fb4e419e85c91e0aa673872a6e60377fa6fe9260764c25dc0515a9e894001e85b2f68a0b747061197be9210de9fcad07772f8e5b5be4f3b2f5b405f10f578e7945cdbd782e2be9ed561b0ef27a627f8fbcf31f71e0af65c5693467158f2ef02d13a2910ac272e5ad2336af36d9c2e51eFile filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
There are no files selected for viewing
Check warning on line 92 in src/billing/cloudpayments.ts
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, recurrent payment notifications still go through /check.
For real subscription renewals data.promo is not passed. Renewals are resolved by SubscriptionId/AccountId, without widget Data/checksum. Promo is only present on the first widget payment when the signed checksum contains promo.id.
Check warning on line 277 in src/billing/cloudpayments.ts
Check warning on line 643 in src/billing/cloudpayments.ts
Check warning on line 831 in src/billing/cloudpayments.ts
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't understand this change. Why it was added?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was added to avoid trusting unsigned CloudPayments Data for billing intent fields.
Previously we merged verified checksum data with parsed widget Data, so client-controlled Data could override fields like workspaceId, tariffPlanId, userId, shouldSaveCard or promo after checksum verification.
Now checksumData is the source of truth. The only field we still take from Data is cloudPayments.recurrent, because it is needed for subscription settings and is validated later in /check against server-side pricing.
The isCardLinkOperation branch keeps compatibility with the card-link checksum shape: card-link operations do not have tariffPlanId/shouldSaveCard, so we normalize them to the common PaymentData shape.
Check warning on line 925 in src/billing/cloudpayments.ts
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.