Skip to content

Commit

Permalink
Add support for plan paymentFrequency
Browse files Browse the repository at this point in the history
  • Loading branch information
TatianaFomina committed Jan 11, 2025
1 parent 8a7936d commit 443c1a0
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 2 deletions.
3 changes: 3 additions & 0 deletions schema.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -827,6 +827,9 @@ type Plan {
"""Monthly charge currency for plan"""
monthlyChargeCurrency: String!

"""How often to charge payment for the plan"""
paymentFrequency: String

"""Events limit for plan"""
eventsLimit: Int!

Expand Down
1 change: 1 addition & 0 deletions src/api/fragments.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@ export const WORKSPACE_PLAN = `
monthlyCharge
monthlyChargeCurrency
eventsLimit
paymentFrequency
}
}
`;
1 change: 1 addition & 0 deletions src/api/plans/queries.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export const QUERY_PLANS = `
monthlyCharge
monthlyChargeCurrency
eventsLimit
paymentFrequency
}
}
`;
10 changes: 8 additions & 2 deletions src/components/modals/PaymentDetailsDialog.vue
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,11 @@ export default Vue.extend({
* Otherwise, we will debit money when the tariff plan expires
*/
if (this.isTariffPlanExpired) {
date.setMonth(date.getMonth() + 1);
if (this.plan.paymentFrequency === 'daily') {
date.setDate(date.getDate() + 1);
} else {
date.setMonth(date.getMonth() + 1);
}

return date.toDateString();
}
Expand Down Expand Up @@ -567,10 +571,12 @@ export default Vue.extend({
checksum: data.checksum,
};

const interval = this.plan.paymentFrequency === 'daily' ? 'Day' : 'Month';

if (this.isRecurrent) {
paymentData.cloudPayments = {
recurrent: {
interval: 'Month',
interval,
period: 1,
},
};
Expand Down
6 changes: 6 additions & 0 deletions src/types/plan.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,4 +31,10 @@ export interface Plan {
* Is plan default
*/
isDefault?: boolean;

/**
* How often to charge payment for the plan.
* Monthly by default.
*/
paymentFrequency?: 'monthly' | 'daily'
}

0 comments on commit 443c1a0

Please sign in to comment.