Skip to content

Commit

Permalink
Trans First Express: Don't pass blank name field
Browse files Browse the repository at this point in the history
Closes #3133

Remote (Failures probably due to changes to sandbox, relevant remote
test does pass):
34 tests, 83 assertions, 9 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications
71.875% passed

Unit:
21 tests, 103 assertions, 0 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications
100% passed
  • Loading branch information
curiousepic committed Feb 1, 2019
1 parent 2999543 commit 6725972
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 3 deletions.
1 change: 1 addition & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
* Cecabank: Append error text to message [therufs] #3127
* Adyen: Extend AVS code mappings [therufs] #3119
* NMI: Add customer id to authorization on store [curiousepic] #3130
* Trans First Express: Don't pass blank name field [curiousepic] #3133

== Version 1.90.0 (January 8, 2019)
* Mercado Pago: Support "gateway" processing mode [curiousepic] #3087
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -532,7 +532,7 @@ def add_pan(doc, payment_method)

def add_contact(doc, fullname, options)
doc['v1'].contact do
doc['v1'].fullName fullname
doc['v1'].fullName fullname unless fullname.blank?
doc['v1'].coName options[:company_name] if options[:company_name]
doc['v1'].title options[:title] if options[:title]

Expand All @@ -557,7 +557,7 @@ def add_contact(doc, fullname, options)

if (shipping_address = options[:shipping_address])
doc['v1'].ship do
doc['v1'].fullName fullname
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'].city shipping_address[:city] if shipping_address[:city]
Expand All @@ -572,7 +572,7 @@ def add_contact(doc, fullname, options)

def add_name(doc, payment_method)
doc['v1'].contact do
doc['v1'].fullName payment_method.name
doc['v1'].fullName payment_method.name unless payment_method.name.blank?
end
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,32 @@ def test_successful_purchase_with_empty_string_cvv
assert_equal 'Succeeded', response.message
end

def test_successful_purchase_without_name
credit_card_opts = {
:number => 4485896261017708,
:month => Date.new((Time.now.year + 1), 9, 30).month,
:year => Date.new((Time.now.year + 1), 9, 30).year,
:first_name => '',
:last_name => ''
}

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

credit_card_opts = {
:number => 4485896261017708,
:month => Date.new((Time.now.year + 1), 9, 30).month,
:year => Date.new((Time.now.year + 1), 9, 30).year
}

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

def test_successful_purchase_with_echeck
assert response = @gateway.purchase(@amount, @check, @options)
assert_success response
Expand Down

0 comments on commit 6725972

Please sign in to comment.