mirror of
https://github.com/bigcapitalhq/bigcapital.git
synced 2026-02-15 04:10:32 +00:00
feat: mail notifications of sales transactions
This commit is contained in:
@@ -4,9 +4,8 @@ import { body, check, param, query, ValidationChain } from 'express-validator';
|
||||
import {
|
||||
AbilitySubject,
|
||||
IPaymentReceiveDTO,
|
||||
IPaymentReceiveMailOpts,
|
||||
// IPaymentReceiveMailOpts,
|
||||
PaymentReceiveAction,
|
||||
PaymentReceiveMailOptsDTO,
|
||||
} from '@/interfaces';
|
||||
import BaseController from '@/api/controllers/BaseController';
|
||||
import asyncMiddleware from '@/api/middleware/asyncMiddleware';
|
||||
@@ -541,9 +540,12 @@ export default class PaymentReceivesController extends BaseController {
|
||||
) => {
|
||||
const { tenantId } = req;
|
||||
const { id: paymentReceiveId } = req.params;
|
||||
const paymentMailDTO: IPaymentReceiveMailOpts = this.matchedBodyData(req, {
|
||||
includeOptionals: false,
|
||||
});
|
||||
const paymentMailDTO: PaymentReceiveMailOptsDTO = this.matchedBodyData(
|
||||
req,
|
||||
{
|
||||
includeOptionals: false,
|
||||
}
|
||||
);
|
||||
try {
|
||||
await this.paymentReceiveApplication.notifyPaymentByMail(
|
||||
tenantId,
|
||||
@@ -574,7 +576,7 @@ export default class PaymentReceivesController extends BaseController {
|
||||
const { id: paymentReceiveId } = req.params;
|
||||
|
||||
try {
|
||||
const data = await this.paymentReceiveApplication.getPaymentDefaultMail(
|
||||
const data = await this.paymentReceiveApplication.getPaymentMailOptions(
|
||||
tenantId,
|
||||
paymentReceiveId
|
||||
);
|
||||
|
||||
@@ -5,7 +5,7 @@ import {
|
||||
AbilitySubject,
|
||||
ISaleEstimateDTO,
|
||||
SaleEstimateAction,
|
||||
SaleEstimateMailOptions,
|
||||
SaleEstimateMailOptionsDTO,
|
||||
} from '@/interfaces';
|
||||
import BaseController from '@/api/controllers/BaseController';
|
||||
import asyncMiddleware from '@/api/middleware/asyncMiddleware';
|
||||
@@ -513,10 +513,12 @@ export default class SalesEstimatesController extends BaseController {
|
||||
) => {
|
||||
const { tenantId } = req;
|
||||
const { id: invoiceId } = req.params;
|
||||
const saleEstimateDTO: SaleEstimateMailOptions = this.matchedBodyData(req, {
|
||||
includeOptionals: false,
|
||||
});
|
||||
|
||||
const saleEstimateDTO: SaleEstimateMailOptionsDTO = this.matchedBodyData(
|
||||
req,
|
||||
{
|
||||
includeOptionals: false,
|
||||
}
|
||||
);
|
||||
try {
|
||||
await this.saleEstimatesApplication.sendSaleEstimateMail(
|
||||
tenantId,
|
||||
|
||||
@@ -3,7 +3,7 @@ import { body, check, param, query } from 'express-validator';
|
||||
import { Inject, Service } from 'typedi';
|
||||
import asyncMiddleware from '@/api/middleware/asyncMiddleware';
|
||||
import BaseController from '../BaseController';
|
||||
import { ISaleReceiptDTO, SaleReceiptMailOpts } from '@/interfaces/SaleReceipt';
|
||||
import { ISaleReceiptDTO, SaleReceiptMailOpts, SaleReceiptMailOptsDTO } from '@/interfaces/SaleReceipt';
|
||||
import { ServiceError } from '@/exceptions';
|
||||
import DynamicListingService from '@/services/DynamicListing/DynamicListService';
|
||||
import CheckPolicies from '@/api/middleware/CheckPolicies';
|
||||
@@ -54,7 +54,7 @@ export default class SalesReceiptsController extends BaseController {
|
||||
body('from').isString().optional(),
|
||||
body('to').isString().optional(),
|
||||
body('body').isString().optional(),
|
||||
body('attach_invoice').optional().isBoolean().toBoolean(),
|
||||
body('attach_receipt').optional().isBoolean().toBoolean(),
|
||||
],
|
||||
this.validationResult,
|
||||
asyncMiddleware(this.sendSaleReceiptMail.bind(this)),
|
||||
@@ -439,7 +439,7 @@ export default class SalesReceiptsController extends BaseController {
|
||||
) => {
|
||||
const { tenantId } = req;
|
||||
const { id: receiptId } = req.params;
|
||||
const receiptMailDTO: SaleReceiptMailOpts = this.matchedBodyData(req, {
|
||||
const receiptMailDTO: SaleReceiptMailOptsDTO = this.matchedBodyData(req, {
|
||||
includeOptionals: false,
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user