Shopify / shopify_transporter

The Transporter tool allows you to convert data from a third-party platform into a format that can be imported into Shopify.
MIT License
98 stars 43 forks source link

Bug fix - No implicit conversion of Hash into String (TypeError) #131

Closed zliu1020-zz closed 5 years ago

zliu1020-zz commented 5 years ago

What it does and why:

User's file has order address information in unexpected format. We expect the values (name, phone, fax, company, etc) to be string in the address hash, whereas in their file the value can be a nonsense hash like {"@xsi:type": "xsd:string"}.

This is most likely due to their customization of Magento allowing mandatory fields (like last name) to be empty and our XML phaser did the wrong move. However, Transporter CLI should not crash on such condition. The more elegant solution is to skip the troublesome fields and let the user know skipping happened.

This pr adds the functionality to purge the address before the conversion step happens and prints a warning informing the user some fields get skipped due to unexpected format.

Sample warning message:

Warning: Order 10003210 - telephone of the billing address is in an unexpected format. Transporter CLI expects it to be a string. Skipping telephone.
Warning: Order 10003210 - fax of the billing address is in an unexpected format. Transporter CLI expects it to be a string. Skipping fax.

Checklist:


Related issues:

Closes: https://github.com/Shopify/shopify_transporter/issues/130