mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-18 22:00:31 +00:00
refactor: subscriptions to nestjs
This commit is contained in:
@@ -10,6 +10,7 @@ import { Inject, Injectable } from '@nestjs/common';
|
||||
import { events } from '@/common/events/events';
|
||||
import { PaymentIntegration } from '../models/PaymentIntegration.model';
|
||||
import { TenantModelProxy } from '@/modules/System/models/TenantBaseModel';
|
||||
import { TenantModel } from '@/modules/System/models/TenantModel';
|
||||
|
||||
@Injectable()
|
||||
export class StripeWebhooksSubscriber {
|
||||
@@ -20,6 +21,9 @@ export class StripeWebhooksSubscriber {
|
||||
private readonly paymentIntegrationModel: TenantModelProxy<
|
||||
typeof PaymentIntegration
|
||||
>,
|
||||
|
||||
@Inject(TenantModel.name)
|
||||
private readonly tenantModel: typeof TenantModel
|
||||
) {}
|
||||
|
||||
/**
|
||||
@@ -34,6 +38,8 @@ export class StripeWebhooksSubscriber {
|
||||
const tenantId = parseInt(metadata.tenantId, 10);
|
||||
const saleInvoiceId = parseInt(metadata.saleInvoiceId, 10);
|
||||
|
||||
|
||||
|
||||
// await initalizeTenantServices(tenantId);
|
||||
// await initializeTenantSettings(tenantId);
|
||||
|
||||
@@ -63,7 +69,7 @@ export class StripeWebhooksSubscriber {
|
||||
if (!metadata?.paymentIntegrationId || !metadata.tenantId) return;
|
||||
|
||||
// Find the tenant or throw not found error.
|
||||
// await Tenant.query().findById(tenantId).throwIfNotFound();
|
||||
await this.tenantModel.query().findById(tenantId).throwIfNotFound();
|
||||
|
||||
// Check if the account capabilities are active
|
||||
if (account.capabilities.card_payments === 'active') {
|
||||
|
||||
Reference in New Issue
Block a user