Closed (fixed)
Project:
Drupal Commerce SagePay Integration
Version:
7.x-1.0
Component:
Code
Priority:
Major
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
30 Jul 2014 at 20:22 UTC
Updated:
29 Sep 2016 at 11:04 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
FrancescoUK commentedComment #2
kingandyAccording to the API docs, the BillingFirstnames and BillingSurname fields have a limit of 20 chars (http://www.sagepay.co.uk/file/1166/download-document/DIRECTProtocolandIn... et al). Would it be sensible to limit the address fields to match?
I'm not sure how to handle this when the address form is using a unified "name" field. Limiting to 40 characters wouldn't really help as people would be able to enter "John Isaverylongnameindeed". Maybe some form validation would be required in that case.
Comment #3
kingandyHm, actually, implementing a #maxfield may not actually help. To me it looks like the most recent versions of Addressfield cover both bases - if the addressfield widget is set to use separate first/last name fields, it helpfully populates the "name_line" field (presumably so that the widget can be switched back and forth without loss of data). Unless I'm mistaken, this looks like _commerce_sagepay_format_customer_name() will always base its transaction data off the "$name_line" variable, regardless of what is put into the first/last name fields.
Comment #4
kingandyHow about we just truncate the values to 20 characters before we send?
Comment #5
kingandyFurther to #2378145: Duplicate first name appearing in SagePay transaction listings, I'd suggest the following as a replacement to the _commerce_sagepay_format_customer_name() function:
Comment #6
ikos commentedThe attached patch completely removes the need to the Commerce SagePay name splitting function as recommended by @kingandy.
It instead relies on AddressField doing the work.
I've tested this in both scenarios and it doesn't seem to cause any problems.
Can I have some reviews on this please?
many thanks
Richard
Comment #7
ikos commentedComment #8
willhallonlineThis appears to fix the duplicate firstname issues I had (similar to https://www.drupal.org/node/2378145), using separate first and last names from addressfield.
Comment #9
ikos commentedComment #10
kingandyTBH, while this does fix the issue in #2378145, it doesn't really touch on the "too long" issue reported here.
Comment #11
ikos commentedOK,
I did combine a couple of things in this patch - including the truncation of the names to 20 chars.
Does that do the job do you think?
R
Comment #13
kingandyAh, yeah, being an idiot, I had completely missed that. Looks good!
Comment #14
vaccinemedia commentedEDIT Ignore this re-roll I've just noticed the commit
Comment #15
ikos commented