mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-16 21:00:31 +00:00
fix: Listen to payment webhooks
This commit is contained in:
@@ -3,6 +3,10 @@ import SystemModel from '@/system/models/SystemModel';
|
||||
import { PlanSubscription } from '..';
|
||||
|
||||
export default class Plan extends mixin(SystemModel) {
|
||||
price: number;
|
||||
invoiceInternal: number;
|
||||
invoicePeriod: string;
|
||||
|
||||
/**
|
||||
* Table name.
|
||||
*/
|
||||
|
||||
@@ -198,14 +198,16 @@ export default class Tenant extends BaseModel {
|
||||
planId,
|
||||
invoiceInterval,
|
||||
invoicePeriod,
|
||||
subscriptionSlug
|
||||
subscriptionSlug,
|
||||
payload?,
|
||||
) {
|
||||
return Tenant.newSubscription(
|
||||
this.id,
|
||||
planId,
|
||||
invoiceInterval,
|
||||
invoicePeriod,
|
||||
subscriptionSlug
|
||||
subscriptionSlug,
|
||||
payload
|
||||
);
|
||||
}
|
||||
|
||||
@@ -217,7 +219,8 @@ export default class Tenant extends BaseModel {
|
||||
planId: number,
|
||||
invoiceInterval: 'month' | 'year',
|
||||
invoicePeriod: number,
|
||||
subscriptionSlug: string
|
||||
subscriptionSlug: string,
|
||||
payload?: { lemonSqueezyId: string }
|
||||
) {
|
||||
const period = new SubscriptionPeriod(invoiceInterval, invoicePeriod);
|
||||
|
||||
@@ -227,6 +230,7 @@ export default class Tenant extends BaseModel {
|
||||
planId,
|
||||
startsAt: period.getStartDate(),
|
||||
endsAt: period.getEndDate(),
|
||||
lemonSubscriptionId: payload?.lemonSqueezyId || null,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user