refs #4764 e2e solve
gitea/salix/pipeline/head This commit looks good Details

This commit is contained in:
Carlos Satorres 2023-06-19 08:46:15 +02:00
parent fbe4441eda
commit 8dd360bf1e
2 changed files with 10 additions and 4 deletions

View File

@ -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';

View File

@ -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