mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-19 06:10:31 +00:00
refactor: e2e tests for payment received
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import { Injectable } from '@nestjs/common';
|
||||
import { Inject, Injectable } from '@nestjs/common';
|
||||
import { ERRORS } from '../constants';
|
||||
import { PaymentReceiveTransfromer } from './PaymentReceivedTransformer';
|
||||
import { PaymentReceived } from '../models/PaymentReceived';
|
||||
@@ -6,10 +6,12 @@ import { TransformerInjectable } from '../../Transformer/TransformerInjectable.s
|
||||
import { ServiceError } from '../../Items/ServiceError';
|
||||
|
||||
@Injectable()
|
||||
export class GetPaymentReceived {
|
||||
export class GetPaymentReceivedService {
|
||||
constructor(
|
||||
private readonly paymentReceiveModel: typeof PaymentReceived,
|
||||
private readonly transformer: TransformerInjectable,
|
||||
|
||||
@Inject(PaymentReceived.name)
|
||||
private readonly paymentReceiveModel: typeof PaymentReceived,
|
||||
) {}
|
||||
|
||||
/**
|
||||
|
||||
@@ -8,6 +8,10 @@ export class GetPaymentReceivedInvoices {
|
||||
constructor(
|
||||
@Inject(PaymentReceived.name)
|
||||
private paymentReceiveModel: typeof PaymentReceived,
|
||||
|
||||
@Inject(SaleInvoice.name)
|
||||
private saleInvoiceModel: typeof SaleInvoice,
|
||||
|
||||
private validators: PaymentReceivedValidators,
|
||||
) {}
|
||||
|
||||
@@ -28,10 +32,10 @@ export class GetPaymentReceivedInvoices {
|
||||
const paymentReceiveInvoicesIds = paymentReceive.entries.map(
|
||||
(entry) => entry.invoiceId,
|
||||
);
|
||||
const saleInvoices = await SaleInvoice.query().whereIn(
|
||||
'id',
|
||||
paymentReceiveInvoicesIds,
|
||||
);
|
||||
const saleInvoices = await this.saleInvoiceModel
|
||||
.query()
|
||||
.whereIn('id', paymentReceiveInvoicesIds);
|
||||
|
||||
return saleInvoices;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { Inject, Injectable } from '@nestjs/common';
|
||||
import { GetPaymentReceived } from './GetPaymentReceived.service';
|
||||
import { GetPaymentReceivedService } from './GetPaymentReceived.service';
|
||||
import { PaymentReceivedBrandingTemplate } from './PaymentReceivedBrandingTemplate.service';
|
||||
import { transformPaymentReceivedToPdfTemplate } from '../utils';
|
||||
|
||||
@@ -16,7 +16,7 @@ export default class GetPaymentReceivedPdf {
|
||||
constructor(
|
||||
private chromiumlyTenancy: ChromiumlyTenancy,
|
||||
private templateInjectable: TemplateInjectable,
|
||||
private getPaymentService: GetPaymentReceived,
|
||||
private getPaymentService: GetPaymentReceivedService,
|
||||
private paymentBrandingTemplateService: PaymentReceivedBrandingTemplate,
|
||||
private eventPublisher: EventEmitter2,
|
||||
|
||||
|
||||
@@ -1,10 +1,13 @@
|
||||
import { PdfTemplateModel } from '@/modules/PdfTemplate/models/PdfTemplate';
|
||||
import { Injectable } from '@nestjs/common';
|
||||
import { Inject, Injectable } from '@nestjs/common';
|
||||
import { IPaymentReceivedState } from '../types/PaymentReceived.types';
|
||||
|
||||
@Injectable()
|
||||
export class GetPaymentReceivedState {
|
||||
constructor(private pdfTemplateModel: typeof PdfTemplateModel) {}
|
||||
export class GetPaymentReceivedStateService {
|
||||
constructor(
|
||||
@Inject(PdfTemplateModel.name)
|
||||
private pdfTemplateModel: typeof PdfTemplateModel,
|
||||
) {}
|
||||
|
||||
/**
|
||||
* Retrieves the create/edit initial state of the payment received.
|
||||
|
||||
Reference in New Issue
Block a user