From 8dd360bf1eaebb5650fd6aab0e203a4b7697b4b3 Mon Sep 17 00:00:00 2001 From: carlossa Date: Mon, 19 Jun 2023 08:46:15 +0200 Subject: [PATCH] refs #4764 e2e solve --- e2e/paths/05-ticket/13_services.spec.js | 2 +- modules/ticket/back/methods/sale/refund.js | 12 +++++++++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/e2e/paths/05-ticket/13_services.spec.js b/e2e/paths/05-ticket/13_services.spec.js index c7bb1648e..50df23582 100644 --- a/e2e/paths/05-ticket/13_services.spec.js +++ b/e2e/paths/05-ticket/13_services.spec.js @@ -1,7 +1,7 @@ import selectors from '../../helpers/selectors.js'; import getBrowser from '../../helpers/puppeteer'; -fdescribe('Ticket services path', () => { +describe('Ticket services path', () => { let browser; let page; const invoicedTicketId = '1'; diff --git a/modules/ticket/back/methods/sale/refund.js b/modules/ticket/back/methods/sale/refund.js index 1b18467b9..ff41091a4 100644 --- a/modules/ticket/back/methods/sale/refund.js +++ b/modules/ticket/back/methods/sale/refund.js @@ -10,6 +10,11 @@ module.exports = Self => { { arg: 'servicesIds', type: ['number'] + }, + { + arg: 'withWarehouse', + type: 'boolean', + required: true } ], returns: { @@ -22,7 +27,7 @@ module.exports = Self => { } }); - Self.refund = async(ctx, salesIds, servicesIds, options) => { + Self.refund = async(ctx, salesIds, servicesIds, withWarehouse, options) => { const models = Self.app.models; const myOptions = {userId: ctx.req.accessToken.userId}; let tx; @@ -67,7 +72,7 @@ module.exports = Self => { const [firstTicketId] = ticketsIds; // eslint-disable-next-line max-len - refundTicket = await createTicketRefund(firstTicketId, now, refundAgencyMode, refoundZoneId, myOptions); + refundTicket = await createTicketRefund(firstTicketId, now, refundAgencyMode, refoundZoneId, withWarehouse, myOptions); for (const sale of sales) { const createdSale = await models.Sale.create({ @@ -130,7 +135,7 @@ module.exports = Self => { } }; - async function createTicketRefund(ticketId, now, refundAgencyMode, refoundZoneId, myOptions) { + async function createTicketRefund(ticketId, now, refundAgencyMode, refoundZoneId, withWarehouse, myOptions) { const models = Self.app.models; const filter = {include: {relation: 'address'}}; @@ -142,6 +147,7 @@ module.exports = Self => { addressFk: ticket.address().id, agencyModeFk: refundAgencyMode.id, nickname: ticket.address().nickname, + warehouseFk: withWarehouse ? ticket.warehouseFk : null, companyFk: ticket.companyFk, landed: now, zoneFk: refoundZoneId