thephpleague / omnipay-sagepay

Sage Pay driver for the Omnipay PHP payment processing library
MIT License
54 stars 78 forks source link

SagePay Form ignores shipping fields if shipping{First|Last}Name is omitted #153

Closed agjmills closed 4 years ago

agjmills commented 4 years ago

I encountered an issue where if billingFirstName, billingLastName / shippingFirstName, shippingLastName / shippingName / billingName were omitted, then SagePay Form would ignore the shippingAddress fields entirely.

Minor documentation tweak to make it slightly clearer that the separate fields are required.

judgej commented 4 years ago

Do you have an example of how this was going wrong? Were you explicitly setting any of these fields to an empty string?

Omnipay has an hierarchy of fallbacks for the names, so missing shipping names will default to the billing names, and a missing billing names will defauly to the firstName/lastName.

I'mm merge the documentation update anyway, since it is correct, but I'm wondering if there is a data check that we are missing and should perhaps be throwing an exception before handing it off to Sage Pay.

judgej commented 4 years ago

Actually, looking at this again, Omnipay does not have that fallback from shipping to billing. I forgot my test scripts are setting 'billingForShipping' => true, and that allows me to leave the shipping address and contact details (first/last name) out completely. The driver will copy the billing details to the shipping details for you when you set that flag, so you only need to provide those details once if you only have one name and address.

I notice the billingForShipping option is not actually in the readme.