When forwarded to SagePay, the first name is duplicated. For example, if I enter Bob Bobson into my site's form, after being forwarded to SagePay it says 'BobBob Bobson.' After contacting SagePay, they sent me the following log from their test. I tried looking through the module files for the billingfirstnames and deliveryfirstnames variables, but I couldn't find them:

09/04/2014 04:22:56 vpsprotocol=3.0 txtype=PAYMENT paymenttype=PAYMENT vendor=tdspares vendorname= accounttype= username= website= vendordata= vendortxcode=41545_403490102 amount=13.94 currency=GBP description=Your order from TDSpares vspterminal= address= postcode= billingpostcode=A11 1AA billingaddress= deliveryaddress= deliverypostcode=A11 1AA contactnumber= contactfax= customeremail=person@place.com basket=2:blb1097:1.00:8.29:1.66:9.95:9.95:Standard shipping (UK):1.00:3.99:0.00:3.99:3.99 allowgiftaid=0 applyavscv2=0 billingsurname=Test billingfirstnames=SagePaySagePay billingaddress1=North Park billingaddress2= billingcity=Newcastle upon Tyne billingcountry=GB billingstate= billingphone= deliverysurname=Test deliveryfirstnames=SagePaySagePay deliveryaddress1=North Park deliveryaddress2= deliverycity=Newcastle upon Tyne deliverycountry=GB deliverystate= deliveryphone= referrerid= billingagreement= token= storetoken= basketxml= customerxml= surchargexml= firecipientacctnumber= firecipientdob=

CommentFileSizeAuthor
#3 fix_first_name_duplication-2250003-3.patch921 bytesabasso

Comments

bkno’s picture

I'm experiencing this as well (Server iframe).

bkno’s picture

Also noticed this happens when the Commerce billing information address is has separate first name and last name, or a single name field.

abasso’s picture

Version: 7.x-1.0 » 7.x-1.x-dev
Status: Active » Needs review
StatusFileSize
new921 bytes

The problem is in _commerce_sagepay_format_customer_name (includes/commerce_sagepay_utils.inc). The function checks for multiple first names and concatenates them, the problem is that if there is only one value in the array, the first name is appended to itself.

Fixed issue, patch attached; please review so that it can be committed.

  • Commit b86cc51 on 7.x-1.x authored by abasso, committed by ikos:
    Issue #2250003 by Koozer: First name duplicated on submit to Sage Pay
    
ikos’s picture

Status: Needs review » Fixed

Thanks for the patch - now committed.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.