feat: Control the payment method from invoice form

This commit is contained in:
Ahmed Bouhuolia
2024-09-22 21:23:02 +02:00
parent 9827a84857
commit eb5fdbf4ee
11 changed files with 295 additions and 20 deletions

View File

@@ -260,8 +260,8 @@ export default class SaleInvoicesController extends BaseController {
check('pdf_template_id').optional({ nullable: true }).isNumeric().toInt(),
// Payment methods.
check('payment_methods').optional({ nullable: true }).isArray({ min: 1 }),
check('payment_methods.*.payment_integration_id').exists(),
check('payment_methods').optional({ nullable: true }).isArray(),
check('payment_methods.*.payment_integration_id').exists().toInt(),
check('payment_methods.*.enable').exists().isBoolean(),
];
}

View File

@@ -21,7 +21,7 @@ export class GetPaymentServicesSpecificInvoice {
const { PaymentIntegration } = this.tenancy.models(tenantId);
const paymentGateways = await PaymentIntegration.query()
.where('enable', true)
.where('active', true)
.orderBy('name', 'ASC');
return this.transform.transform(

View File

@@ -8,4 +8,12 @@ export class GetPaymentServicesSpecificInvoiceTransformer extends Transformer {
public excludeAttributes = (): string[] => {
return ['accountId'];
};
public includeAttributes = (): string[] => {
return ['serviceFormatted'];
};
public serviceFormatted(method) {
return 'Stripe';
}
}