Add promo codes on tariff payment - #915
Open
alisawavezen12 wants to merge 29 commits into
Open
alisawavezen12 wants to merge 29 commits into
alisawavezen12 wants to merge 29 commits into
Conversation
…w and application logic, and update related components and API integration
…e.json and yarn.lock
…nused lines, updating parameter descriptions, and enhancing styling for promo buttons and pricing display
…, updating schema and API queries to support detailed promo information
…rkspace admins and return calculated prices
…refining benefitType to align with updated promo code logic
…ponents to support promo discount display
…codes, updating schema, API, and components for improved validation and response handling
…s, modifying schema, API, and components for enhanced validation and response handling
…tatements and improving readability in calculatePromoCodePlanPrice function
…d descriptions for payment processing mutations and refining promo data interface
…ethods and promo discount application in comments
…s and emits, and improve focus handling on mount
…utdated types, enhancing interfaces, and updating related components for improved clarity and functionality
…ing modules for improved consistency and clarity
…eamline payment amount logic in PaymentDetailsDialog for improved understanding of payment processing
Co-authored-by: Cursor <cursoragent@cursor.com>
…PromoCodePlanPrice function
…promoCode and promoUtm parameters
…eters for improved clarity
…ing utility functions
neSpecc
previously approved these changes
Aug 31, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds promo-code support to the tariff purchase flow: users can verify/apply a promo code, see discounted plan prices in the plan chooser, and pass promo + UTM data into composePayment, while the payment widget charges the server-calculated chargeAmount.
Changes:
- Added promo-code verification + client-side discounted pricing calculation and UI presentation in the tariff plan chooser.
- Extended
composePaymentinput/output to include promo fields andchargeAmount, and updated the payment widget to chargechargeAmountwhile keeping recurrent renewals at full plan price. - Added GraphQL schema/types/i18n updates to support the new promo-code flow.
Reviewed changes
Copilot reviewed 15 out of 16 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| src/utils/promoCodePricing.ts | Client-side promo pricing computation aligned with API behavior. |
| src/types/promoCode.ts | Promo-code verification and pricing-related types/constants. |
| src/types/before-payment-payload.ts | Adds chargeAmount and promo price breakdown to the payment payload type. |
| src/store/modules/workspaces/index.js | Wires promo fields into COMPOSE_PAYMENT and adds VERIFY_PROMO_CODE action. |
| src/store/modules/workspaces/actionTypes.js | Adds VERIFY_PROMO_CODE action constant. |
| src/i18n/messages/ru.json | Adds promo-code UI strings and promo-related error messages (RU). |
| src/i18n/messages/en.json | Adds promo-code UI strings and promo-related error messages (EN). |
| src/components/utils/TariffPlan.vue | Displays discounted vs original plan price with optional discount label. |
| src/components/project/settings/General.vue | Refactors computed block placement (no functional change). |
| src/components/modals/PromoCodeDialog.vue | New modal for entering and applying a promo code. |
| src/components/modals/PaymentDetailsDialog.vue | Uses server chargeAmount, shows promo price breakdown + recurrent note, forwards promo fields into composePayment. |
| src/components/modals/ChooseTariffPlanPopup.vue | Adds promo entry, verification, discounted plan display, and passes promo/UTM into payment flow. |
| src/api/billing/queries.ts | Adds verifyPromoCode mutation and extends composePayment query to include promo/charge amount. |
| src/api/billing/index.ts | Adds billing API verifyPromoCode, updates composePayment signature, refactors payWithCard call. |
| schema.graphql | Adds promo-related input/types and chargeAmount in composePayment response. |
| CHANGELOG.md | Formatting cleanup. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Comment on lines
+120
to
+122
| hasDiscount() { | ||
| return this.originalPrice !== null && this.originalPrice !== this.price; | ||
| }, |
Comment on lines
+13
to
+22
| <TextFieldset | ||
| v-model="value" | ||
| name="promoCode" | ||
| class="promo-code-dialog__input" | ||
| :label="$t('billing.promoCode.inputLabel')" | ||
| :placeholder="$t('billing.promoCode.inputPlaceholder')" | ||
| :disabled="isLoading" | ||
| :is-invalid="isInvalid" | ||
| auto-complete="off" | ||
| /> |
Comment on lines
+80
to
+88
| export async function verifyPromoCode(input: PromoCodeVerifyInput): Promise<PromoCodeVerify> { | ||
| const response = await api.call<{ verifyPromoCode: PromoCodeVerify }>(MUTATION_VERIFY_PROMO_CODE, { input }); | ||
|
|
||
| if (!response.data) { | ||
| throw new Error('Empty promo code response'); | ||
| } | ||
|
|
||
| return response.data.verifyPromoCode; | ||
| } |
Comment on lines
58
to
62
| export async function payWithCard(input: PayWithCardInput): Promise<unknown> { | ||
| return (await api.callOld(MUTATION_PAY_WITH_CARD, { input })).payWithCard.record; | ||
| const response = await api.call<{ payWithCard: { record: unknown } }>(MUTATION_PAY_WITH_CARD, { input }); | ||
|
|
||
| return response.data?.payWithCard.record; | ||
| } |
Co-authored-by: Cursor <cursoragent@cursor.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.
Summary
composePayment.chargeAmount; subscription renewals still use the full plan monthly price.percent_discount,fixed_price,minFinalPrice, applicable plans).Related to codex-team/hawk.api.nodejs#679