diff --git a/modules/web_shop_shopify/party.py b/modules/web_shop_shopify/party.py index 53bb28c7ec..df70dd1ca6 100644 --- a/modules/web_shop_shopify/party.py +++ b/modules/web_shop_shopify/party.py @@ -29,7 +29,9 @@ class Party(IdentifiersMixin, metaclass=PoolMeta): continue for contact_mechanism in contact_mechanisms: if (contact_mechanism.type in types - and contact_mechanism.value == value): + and (contact_mechanism.value_compact + == contact_mechanism.format_value_compact( + value, contact_mechanism.type))): break else: contact_mechanisms.append(ContactMechanism( diff --git a/modules/web_shop_shopify/sale.py b/modules/web_shop_shopify/sale.py index 735a277326..fdac0ee5f6 100644 --- a/modules/web_shop_shopify/sale.py +++ b/modules/web_shop_shopify/sale.py @@ -112,7 +112,9 @@ class Sale(IdentifierMixin, metaclass=PoolMeta): if order.phone: for contact_mechanism in party.contact_mechanisms: if (contact_mechanism.type in {'phone', 'mobile'} - and contact_mechanism.value == order.phone): + and (contact_mechanism.value_compact + == contact_mechanism.format_value_compact( + order.phone, contact_mechanism.type))): break else: contact_mechanism = ContactMechanism( diff --git a/modules/web_shop_shopify/tests/scenario_web_shop_shopify.rst b/modules/web_shop_shopify/tests/scenario_web_shop_shopify.rst index f7e5ddca84..d246b737f2 100644 --- a/modules/web_shop_shopify/tests/scenario_web_shop_shopify.rst +++ b/modules/web_shop_shopify/tests/scenario_web_shop_shopify.rst @@ -22,7 +22,7 @@ Imports:: >>> from trytond.modules.company.tests.tools import create_company >>> from trytond.modules.web_shop_shopify.product import Template >>> from trytond.modules.web_shop_shopify.web import Shop - >>> from trytond.tests.tools import activate_modules, assertEqual + >>> from trytond.tests.tools import activate_modules, assertEqual, assertTrue >>> FETCH_SLEEP, MAX_SLEEP = 1, 10 @@ -434,6 +434,9 @@ Create an order on Shopify:: >>> customer.email = ( ... ''.join(random.choice(string.ascii_letters) for _ in range(10)) ... + '@example.com') + >>> customer_phone = '+32-495-555-' + ( + ... ''.join(random.choice(string.digits) for _ in range(3))) + >>> customer.phone = customer_phone >>> customer.addresses = [{ ... 'address1': "Street", ... 'city': "City", @@ -507,6 +510,12 @@ Run fetch order:: >>> assertEqual(sale.carrier, carrier) >>> sale.state 'quotation' + >>> sale.party.name + 'Customer' + >>> assertTrue(sale.party.email) + >>> assertEqual(sale.party.phone.replace(' ', ''), customer_phone.replace('-', '')) + >>> len(sale.party.contact_mechanisms) + 2 Capture full amount:: @@ -529,6 +538,8 @@ Capture full amount:: 'processing' >>> len(sale.invoices) 0 + >>> len(sale.party.contact_mechanisms) + 2 Make a partial shipment::