This commit is contained in:
parent
fbe4441eda
commit
8dd360bf1e
|
@ -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';
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue