Skip to content

Commit

Permalink
TransFirst Express: Fix blank address2 values
Browse files Browse the repository at this point in the history
If a user passes in an empty string for the address2 field, their 
transaction will fail on this gateway. This PR ensures that address2 
only gets passed through if it is present and not blank. Additionally 
it cleans up some remote test failures. test_successful_verify still 
fails in the remote tests, but failure is unrelated to change.

Unit:
21 tests, 103 assertions, 0 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications
100% passed

Remote:
33 tests, 107 assertions, 1 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications
96.9697% passed

Closes #3231
  • Loading branch information
britth committed May 28, 2019
1 parent ab2a09d commit b69fcad
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
* Cybersource: Send tokenization data when card is :master [pi3r] #3230
* Bluesnap: Omit state codes for unsupported countries [therufs] #3229
* Adyen: Pass updateShopperStatement, industryUsage [curiousepic] #3233
* TransFirst Transaction Express: Fix blank address2 values [britth] #3231

== Version 1.94.0 (May 21, 2019)
* Mundipagg: Fix number lengths for both VR and Sodexo [dtykocki] #3195
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -544,7 +544,7 @@ def add_contact(doc, fullname, options)
end
end
doc['v1'].addrLn1 billing_address[:address1] if billing_address[:address1]
doc['v1'].addrLn2 billing_address[:address2] if billing_address[:address2]
doc['v1'].addrLn2 billing_address[:address2] unless billing_address[:address2].blank?
doc['v1'].city billing_address[:city] if billing_address[:city]
doc['v1'].state billing_address[:state] if billing_address[:state]
doc['v1'].zipCode billing_address[:zip] if billing_address[:zip]
Expand All @@ -559,7 +559,7 @@ def add_contact(doc, fullname, options)
doc['v1'].ship do
doc['v1'].fullName fullname unless fullname.blank?
doc['v1'].addrLn1 shipping_address[:address1] if shipping_address[:address1]
doc['v1'].addrLn2 shipping_address[:address2] if shipping_address[:address2]
doc['v1'].addrLn2 shipping_address[:address2] unless shipping_address[:address2].blank?
doc['v1'].city shipping_address[:city] if shipping_address[:city]
doc['v1'].state shipping_address[:state] if shipping_address[:state]
doc['v1'].zipCode shipping_address[:zip] if shipping_address[:zip]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ def setup

@amount = 100
@declined_amount = 21
@credit_card = credit_card('4485896261017708')
@credit_card = credit_card('4485896261017708', verification_value: 999)
@check = check

billing_address = address({
Expand Down Expand Up @@ -76,6 +76,26 @@ def test_successful_purchase_with_only_required
assert_equal 'CVV matches', response.cvv_result['message']
end

def test_successful_purchase_without_address2
# Test that empty string in `address2` doesn't cause transaction failure
options = @options.dup
options[:shipping_address] = {
address1: '450 Main',
address2: '',
zip: '85284',
}

options[:billing_address] = {
address1: '450 Main',
address2: '',
zip: '85284',
}

response = @gateway.purchase(@amount, @credit_card, options)
assert_success response
assert_equal 'Succeeded', response.message
end

def test_successful_purchase_without_cvv
credit_card_opts = {
:number => 4485896261017708,
Expand Down

0 comments on commit b69fcad

Please sign in to comment.