Skip to content

Commit fc81e40

Browse files
committed
fix: expect contact phone to be a number as well
1 parent c1dafd8 commit fc81e40

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/imports/data/process.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,7 @@ export async function processGeneric({ document, name, data, contextUser }) {
156156
success: true,
157157
processData: {},
158158
errors: [],
159+
changes: {},
159160
};
160161

161162
const createRequest = {
@@ -195,6 +196,7 @@ export async function processCampaignTarget({ data, contextUser }) {
195196
success: true,
196197
processData: {},
197198
errors: [],
199+
changes: {},
198200
};
199201

200202
if (MetaObject.Namespace.skipCampaignTargetForActiveOpportunities === true) {
@@ -260,6 +262,7 @@ export async function processOpportunity({ data, contextUser }) {
260262
success: true,
261263
processData: {},
262264
errors: [],
265+
changes: {},
263266
};
264267

265268
let record = await find({
@@ -594,6 +597,7 @@ export async function processMessage({ data, contextUser }) {
594597
success: true,
595598
processData: {},
596599
errors: [],
600+
changes: {}
597601
};
598602

599603
const campaign = await findCampaign(data.campaign, contextUser);
@@ -642,6 +646,7 @@ export async function processActivity({ data, contextUser }) {
642646
success: true,
643647
processData: {},
644648
errors: [],
649+
changes: {},
645650
};
646651

647652
if (has(data, 'campaign.code') && !has(data, 'campaign._id')) {
@@ -759,6 +764,7 @@ export async function processContact({ data, options, contextUser }) {
759764
success: true,
760765
processData: {},
761766
errors: [],
767+
changes: {},
762768
};
763769

764770
let codeSent = false;
@@ -767,7 +773,7 @@ export async function processContact({ data, options, contextUser }) {
767773
}
768774
let phoneSent = [];
769775

770-
if (data.phone && !isEmpty(data.phone)) {
776+
if (data.phone && (!isEmpty(data.phone) || data.phone > 0)) {
771777
phoneSent = phoneSent.concat(data.phone);
772778
}
773779

@@ -779,7 +785,7 @@ export async function processContact({ data, options, contextUser }) {
779785
// validate if phone or email was passed
780786
if (codeSent === false && emailSent.length === 0 && phoneSent.length === 0) {
781787
response.success = false;
782-
response.errors = [{ meaage: 'É obrigatório o preenchimento de ao menos um dos seguintes campos: code, email e telefone.' }];
788+
response.errors = [{ message: 'É obrigatório o preenchimento de ao menos um dos seguintes campos: code, email e telefone.' }];
783789
delete response.processData;
784790
return response;
785791
}
@@ -1245,8 +1251,6 @@ export async function processContact({ data, options, contextUser }) {
12451251
delete contactData.referrerURL;
12461252
}
12471253

1248-
let operationPerformed = 'created';
1249-
12501254
// creates a contact if not found one
12511255
if (contact == null) {
12521256
const createRequest = {

0 commit comments

Comments
 (0)