Worldpay / hybris

Worldpay SAP Hybris Addon
25 stars 32 forks source link

Use addressService for cloning an address to ensure duplicate flag is properly set #16

Closed pimnijssen closed 6 years ago

pimnijssen commented 6 years ago

The AbstractWorldpayOrderService class has a method cloneAndSetBillingAddressFromCart to clone an Address which will be assigned to a PaymentInfo. However, using the clone method of the ModelService doesn't guarantee that the duplicate flag on the cloned Address is set to true. If this flag isn't set correctly it will cause problems, for example when importing Addresses using the Data Hub. By using the cloneAddressForOwner method of the AddressService instead, we guarantee that the clone is properly created and the relevant attributes (duplicate, original) are all set.

Eusebiotrigo commented 6 years ago

Hi Pim! Thanks for submitting this PR. We'll integrate your changes and add unit tests, otherwise they will fail.