Giter Club home page Giter Club logo

Comments (9)

judgej avatar judgej commented on September 14, 2024

If the billing and shipping address are the same, then you could pass the same address in twice - no need to create separate models if they are identical. I haven't looked at the code to remind me, but I'm sure if you set just the billing or shipping address, then the other one will automatically be set to be the same.

The emails are set on the addresses, since SagePay will accept both a shipping email and a billing email. $billing_addr->setField('Email', $data['email']); should do it.

Was it just the email that was the problem, or am I missing something else?

from sagepay.

losttheplot avatar losttheplot commented on September 14, 2024

Thanks. I thought I'd tried unsuccessfully to pass the email address as you explained - I will try again.

With the addresses, I get that they can be the same but in this instance I need to store two different sets of contact details as the customer is sometimes a child and the card-payer is often a parent. The records need to show that distinction.

from sagepay.

judgej avatar judgej commented on September 14, 2024

I just took your example code as production code, so my bad for assuming :-)

Best of luck. I'm going to come back to finishing off this module properly before the end of the year - there are a number of lose ends and not enough tests. If you find any holes in the functionality or any improvements that you think may help, then feel free to raise them as issues and it will go on the list. Would be nice (before the end of the year too) to write a connection for Omnipay, so this package can be used as an Omnipay driver, as well as standalone.

from sagepay.

losttheplot avatar losttheplot commented on September 14, 2024

I'm an OOP novice but I will try and work out what is going on - or not. Would I be correct in assuming that in your current production use, you are always using the same address for billing and delivery, and are not passing the email address?

from sagepay.

 avatar commented on September 14, 2024

Hmm, I might be wrong there. Try $server->setField('CustomerEMail', $data['email']); rather than on the $customer_details.

I'll need to go through the SagePay documentation again. It changes quite a log between point releases (several times a year) from protocol V3. The customer details, the shipping details and the billing details can all refer to completely different people.

(posted by @judgej)

from sagepay.

losttheplot avatar losttheplot commented on September 14, 2024

Brilliant, thanks - that works a treat for all the fields :)

I didn't realise one could set a field so simply...

$server->setField('BillingSurname', $data['c_surname']); // 20 chars
$server->setField('BillingFirstnames', $data['c_firstname']); // 20 chars
$server->setField('BillingAddress1', $data['c_add1']); // 100 chars
$server->setField('BillingAddress2', $data['c_add2']); // 100 chars
$server->setField('BillingCity', $data['c_town']); // 40 chars
$server->setField('BillingPostCode', $data['c_postcode']); // 10 chars
$server->setField('BillingCountry', 'GB'); //2 chars, ISO 3166 e.g. GB, DE
$server->setField('CustomerEMail', $data['email']); // 255 chars
$server->setField('DeliverySurname', $data['surname']); // 20 chars
$server->setField('DeliveryFirstnames', $data['firstname']); // 20 chars
$server->setField('DeliveryAddress1', $data['add1']); // 100 chars
$server->setField('DeliveryAddress2', $data['add2']); // 100 chars
$server->setField('DeliveryCity', $data['town']); // 40 chars
$server->setField('DeliveryPostCode', $data['postcode']); // 10 chars
$server->setField('DeliveryCountry', 'GB'); //2 chars, ISO 3166 e.g. GB, DE

from sagepay.

judgej avatar judgej commented on September 14, 2024

Ideally you whould be able to do $server->CustomerEMail = $data['email'] but I've not put the magic methods in for that yet.

SagePay takes all the fields in one big, flat, list. The classes such as the Address and Customer are just there for convenience, as a way of grouping fields together in your code and abstracting them slightly from the fields that SagePay names, and adding some validation and a way to transform some of the fields (e.g. a basket is turned into XML or CSV data). But if you want to use the raw SagePay fields, then set them all manually as you have done above, and it should work fine.

from sagepay.

losttheplot avatar losttheplot commented on September 14, 2024

Thanks. What you're doing is great, but for now, with my current project, the simple approach works well :)

from sagepay.

judgej avatar judgej commented on September 14, 2024

Cool. I'll close this ticket. Please re-open if still not working, or raise another ticket if there are further issues.

from sagepay.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.