Comments (9)
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.
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.
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.
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.
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.
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.
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.
Thanks. What you're doing is great, but for now, with my current project, the simple approach works well :)
from sagepay.
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)
- Create Omnipay Wrapper
- Make sure typehints are interfaces, not abstracts
- Token field may not be send in server-notification HOT 4
- Helper::formatAmount silently sets Amount to Zero HOT 9
- Fields for Refund not picked out HOT 6
- Switch to PSR-4 autoloading HOT 1
- Surcharge XML is too long HOT 9
- Start using constructor injection
- Use Data Mapper model rather than up-side-down Active Record HOT 1
- possible misleading information on comment section HOT 10
- Support discounts in basket HOT 17
- Sagepay callback function is not taking sagepay tx_model HOT 2
- Create Omnipay connector
- Is VPSSignature utilised? HOT 4
- VendorTxCode not guaranteed to be unique or unpredictable HOT 3
- MD5 signature - change from Pending to OK for PPRO payments HOT 3
- Handle duplicate notification callbacks HOT 2
- Second CardType does not contain tamper: true HOT 1
- Support 3d Secure v2 HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sagepay.