2022-10-24 07:49:51 +00:00
|
|
|
module.exports = Self => {
|
|
|
|
Self.remoteMethodCtx('receiptPdf', {
|
2023-02-09 09:28:37 +00:00
|
|
|
description: 'Send the receipt pdf to client',
|
2022-10-24 07:49:51 +00:00
|
|
|
accepts: [
|
|
|
|
{
|
|
|
|
arg: 'id',
|
|
|
|
type: 'number',
|
|
|
|
required: true,
|
2023-02-09 09:26:55 +00:00
|
|
|
description: 'The receipt id',
|
2022-10-24 07:49:51 +00:00
|
|
|
http: {source: 'path'}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
arg: 'recipientId',
|
|
|
|
type: 'number',
|
|
|
|
description: 'The recipient id',
|
|
|
|
required: false
|
|
|
|
}
|
|
|
|
],
|
|
|
|
returns: [
|
|
|
|
{
|
|
|
|
arg: 'body',
|
|
|
|
type: 'file',
|
|
|
|
root: true
|
|
|
|
}, {
|
|
|
|
arg: 'Content-Type',
|
|
|
|
type: 'String',
|
|
|
|
http: {target: 'header'}
|
|
|
|
}, {
|
|
|
|
arg: 'Content-Disposition',
|
|
|
|
type: 'String',
|
|
|
|
http: {target: 'header'}
|
|
|
|
}
|
|
|
|
],
|
|
|
|
http: {
|
|
|
|
path: '/:id/receipt-pdf',
|
|
|
|
verb: 'GET'
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
2023-03-14 07:17:46 +00:00
|
|
|
Self.receiptPdf = (ctx, id) => Self.printReport(ctx, id, 'receipt');
|
2022-10-24 07:49:51 +00:00
|
|
|
};
|