Skip to content

Add promo codes on tariff payment - #915

Open
alisawavezen12 wants to merge 29 commits into
masterfrom
feat/promo-code-v2
Open

alisawavezen12 wants to merge 29 commits into
masterfrom
feat/promo-code-v2

Conversation

@alisawavezen12

@alisawavezen12 alisawavezen12 commented Aug 31, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add promo entry on the tariff flow: verify the code, show discounted plan prices, and pass the code (plus UTM) into composePayment.
  • Widget charge uses server chargeAmount; subscription renewals still use the full plan monthly price.
  • Client pricing stays aligned with the API (percent_discount, fixed_price, minFinalPrice, applicable plans).

Related to codex-team/hawk.api.nodejs#679

Dobrunia Kostrigin and others added 27 commits June 11, 2026 19:37
…w and application logic, and update related components and API integration
…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
…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>
neSpecc
neSpecc previously approved these changes Aug 31, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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 composePayment input/output to include promo fields and chargeAmount, and updated the payment widget to charge chargeAmount while 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 thread src/components/utils/TariffPlan.vue Outdated
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 thread src/api/billing/index.ts Outdated
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 thread src/api/billing/index.ts
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;
}
Dobrunia Kostrigin and others added 2 commits September 1, 2026 12:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants