2534 - Fill sage data before enable taxDataChecked #432

Merged
carlosjr merged 3 commits from 2534-sage_taxDataChecked into dev 2020-11-04 12:54:15 +00:00
3 changed files with 7 additions and 6 deletions
Showing only changes of commit 0570d83a6d - Show all commits

View File

@ -157,5 +157,5 @@
"landed": "F. entrega", "landed": "F. entrega",
"addressFk": "Consignatario", "addressFk": "Consignatario",
"companyFk": "Empresa", "companyFk": "Empresa",
"You need to fill sage information before you check verified data": "You need to fill sage information before you check verified data" "You need to fill sage information before you check verified data": "Debes rellenar la información de sage antes de marcar datos comprobados"
} }

View File

@ -2,10 +2,11 @@ const app = require('vn-loopback/server/server');
describe('Client updateFiscalData', () => { describe('Client updateFiscalData', () => {
const clientId = 101; const clientId = 101;
const employeeId = 1;
const salesAssistantId = 21; const salesAssistantId = 21;
const administrativeId = 5; const administrativeId = 5;
afterAll(async done => { afterAll(async done => {
const ctx = {req: {accessToken: {userId: 5}}}; const ctx = {req: {accessToken: {userId: administrativeId}}};
ctx.args = {postcode: 46460}; ctx.args = {postcode: 46460};
await app.models.Client.updateFiscalData(ctx, clientId); await app.models.Client.updateFiscalData(ctx, clientId);
@ -13,8 +14,8 @@ describe('Client updateFiscalData', () => {
done(); done();
}); });
it('should return an error if the user is not administrative and the isTaxDataChecked value is true', async() => { it('should return an error if the user is not salesAssistant and the isTaxDataChecked value is true', async() => {
const ctx = {req: {accessToken: {userId: 1}}}; const ctx = {req: {accessToken: {userId: employeeId}}};
ctx.args = {}; ctx.args = {};
let error; let error;
@ -26,7 +27,7 @@ describe('Client updateFiscalData', () => {
expect(error.message).toEqual(`You can't make changes on a client with verified data`); expect(error.message).toEqual(`You can't make changes on a client with verified data`);
}); });
joan marked this conversation as resolved
Review

who is d?

who is d?
it('should return an error if the user is not d and the isTaxDataChecked value is true', async() => { it('should return an error if the salesAssistant did not fill the sage data before checking verified data', async() => {
const client = await app.models.Client.findById(clientId); const client = await app.models.Client.findById(clientId);
await client.updateAttribute('isTaxDataChecked', false); await client.updateAttribute('isTaxDataChecked', false);

View File

@ -30,7 +30,7 @@
data="sageTransactionTypes" data="sageTransactionTypes"
order="transaction"> order="transaction">
</vn-crud-model> </vn-crud-model>
<form name="form" ng-submit="$ctrl.onSubmit()" class="vn-w-md" disabled="true"> <form name="form" ng-submit="$ctrl.onSubmit()" class="vn-w-md">
<vn-card class="vn-pa-lg"> <vn-card class="vn-pa-lg">
<vn-horizontal> <vn-horizontal>
<vn-textfield <vn-textfield