Skip to content

Commit 443c1a0

Browse files
committed
Add support for plan paymentFrequency
1 parent 8a7936d commit 443c1a0

File tree

5 files changed

+19
-2
lines changed

5 files changed

+19
-2
lines changed

schema.graphql

+3
Original file line numberDiff line numberDiff line change
@@ -827,6 +827,9 @@ type Plan {
827827
"""Monthly charge currency for plan"""
828828
monthlyChargeCurrency: String!
829829

830+
"""How often to charge payment for the plan"""
831+
paymentFrequency: String
832+
830833
"""Events limit for plan"""
831834
eventsLimit: Int!
832835

src/api/fragments.ts

+1
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ export const WORKSPACE_PLAN = `
123123
monthlyCharge
124124
monthlyChargeCurrency
125125
eventsLimit
126+
paymentFrequency
126127
}
127128
}
128129
`;

src/api/plans/queries.ts

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ export const QUERY_PLANS = `
1010
monthlyCharge
1111
monthlyChargeCurrency
1212
eventsLimit
13+
paymentFrequency
1314
}
1415
}
1516
`;

src/components/modals/PaymentDetailsDialog.vue

+8-2
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,11 @@ export default Vue.extend({
393393
* Otherwise, we will debit money when the tariff plan expires
394394
*/
395395
if (this.isTariffPlanExpired) {
396-
date.setMonth(date.getMonth() + 1);
396+
if (this.plan.paymentFrequency === 'daily') {
397+
date.setDate(date.getDate() + 1);
398+
} else {
399+
date.setMonth(date.getMonth() + 1);
400+
}
397401
398402
return date.toDateString();
399403
}
@@ -567,10 +571,12 @@ export default Vue.extend({
567571
checksum: data.checksum,
568572
};
569573
574+
const interval = this.plan.paymentFrequency === 'daily' ? 'Day' : 'Month';
575+
570576
if (this.isRecurrent) {
571577
paymentData.cloudPayments = {
572578
recurrent: {
573-
interval: 'Month',
579+
interval,
574580
period: 1,
575581
},
576582
};

src/types/plan.d.ts

+6
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,10 @@ export interface Plan {
3131
* Is plan default
3232
*/
3333
isDefault?: boolean;
34+
35+
/**
36+
* How often to charge payment for the plan.
37+
* Monthly by default.
38+
*/
39+
paymentFrequency?: 'monthly' | 'daily'
3440
}

0 commit comments

Comments
 (0)