2022-10-24 13:15:23 +00:00
|
|
|
module.exports = Self => {
|
|
|
|
Self.remoteMethodCtx('invoiceInEmail', {
|
|
|
|
description: 'Sends the invoice in email with an attached PDF',
|
|
|
|
accessType: 'WRITE',
|
|
|
|
accepts: [
|
|
|
|
{
|
|
|
|
arg: 'id',
|
|
|
|
type: 'number',
|
|
|
|
required: true,
|
|
|
|
description: 'The invoice id',
|
|
|
|
http: {source: 'path'}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
arg: 'recipient',
|
|
|
|
type: 'string',
|
|
|
|
description: 'The recipient email',
|
|
|
|
required: true,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
arg: 'recipientId',
|
|
|
|
type: 'number',
|
|
|
|
description: 'The recipient id to send to the recipient preferred language',
|
|
|
|
required: false
|
|
|
|
}
|
|
|
|
],
|
|
|
|
returns: {
|
|
|
|
type: ['object'],
|
|
|
|
root: true
|
|
|
|
},
|
|
|
|
http: {
|
|
|
|
path: '/:id/invoice-in-email',
|
|
|
|
verb: 'POST'
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2023-03-14 07:17:46 +00:00
|
|
|
Self.invoiceInEmail = ctx => Self.sendTemplate(ctx, 'invoiceIn');
|
2022-10-24 13:15:23 +00:00
|
|
|
};
|