diff --git a/src/sales/customer/customer.service.ts b/src/sales/customer/customer.service.ts index b7ed1ba..3d91445 100644 --- a/src/sales/customer/customer.service.ts +++ b/src/sales/customer/customer.service.ts @@ -360,8 +360,9 @@ export class CustomerService { newCustomer.longitude = customer.longitude; newCustomer.tipoendereco = customer.addressType; - const oldCustomer = await this.findCustomerByCpf(newCustomer.cgcent); - if (oldCustomer) { + const oldCustomers = await this.findCustomerByCpf(newCustomer.cgcent); + if (oldCustomers && oldCustomers.length > 0) { + const oldCustomer = oldCustomers[0]; console.log('Cliente localizado: ' + oldCustomer.customerId); newCustomer.codcli = oldCustomer.customerId; await this.updateCustomer(newCustomer);