Pinelab-studio / pinelab-vendure-plugins

Monorepo for different Vendure plugins developed by Pinelab
111 stars 49 forks source link

Xero duplicate contacts #505

Closed martijnvdbrug closed 3 months ago

martijnvdbrug commented 3 months ago

Sometimes the Xero integration (in Invoices plugin) throws an error when creating a new contact: The contact name Adam B is already assigned to another contact. The contact name must be unique across all active contacts

What the Xero integration is doing is the following:

  1. Find a contact by email, if it exists, add the invoice to that contact's ID
  2. If not, create a new contact with the email Address.

What we should do

  1. Try to find by contact name
  2. If not exists, find by email

Make sure to normalize the contact name. Trim, remove duplicate spaces etc

martijnvdbrug commented 3 months ago

Xero duplicate Contacts

martijnvdbrug commented 3 months ago

Close by https://github.com/Pinelab-studio/pinelab-vendure-plugins/pull/506