academe / SagePay-Integration

HTTP Messages for the Sage Pay REST (Pi) gateway.
GNU General Public License v3.0
9 stars 5 forks source link

Separate person details for Customer, Billing and Shipping #27

Closed judgej closed 8 years ago

judgej commented 8 years ago

At the moment, the BillingDetails contains the billingAddress and the Customer details (name, phone, email).

In reality, the customer is not necessarily the billing person. The customer is logged into a shop and can make a purchase, but the billing person may be another party with the credit card. This needs a little more separation, so that the customer name/email/phone can be overridden from what is given to the billing details object.

judgej commented 8 years ago

I think the way to do this will be to take the Person out of the BillingDetails class, and add a new Person Customer parameter to the transaction constructor. A Person may go back into BillingDetails at a later time, if a future version of the API supports it.

What is confusing, is that there Sage Pay has a billing address, a shipping address, but no customer address. However, the Sage Pay documentation does use the term "customer" to mean the person who holds the credit card. From a shop POV, that is not necessarily the same thing.

judgej commented 8 years ago

Having said that, Sage Pay Server refers to the person holding the CC as the "customer" and then defines their details in the API a BillingFirstname, BillingLastname, BillingCity etc. There is just one entity here - the Billing person, with a name and an address.

Sage Pay Integration splits this into a Billing address, but a Customer name. The name entered into the CC form is something else altogether. I suspect the CustomerFoo fields are not used at all when authorising the card.

judgej commented 8 years ago

The Sage Pay control panel shows three addresses: Billing, Shipping (Delivery) and Card Holder address. That's different again. The card holder address is more like the billing address, and the billing address is more like the customer address.

judgej commented 8 years ago

Some BC-break stuff in that last push:

The README example has been updated to show this.

judgej commented 8 years ago

The separation is complete now.