Skip to content

Commit

Permalink
Litle: Omit checkNum when nil
Browse files Browse the repository at this point in the history
ACH transactions in which the `checkNum` was `nil` were previously
sending an empty `checkNum` node, which caused failures against the
Litle gateway.

This adds a check so that the `checkNum` node is created only when there
is a value for this field.

ECS-1350

Unit:
46 tests, 201 assertions, 0 failures, 0 errors, 0 pendings, 0 omissions,
0 notifications
100% passed

Remote:
43 tests, 188 assertions, 13 failures, 0 errors, 0 pendings, 0
omissions, 0 notifications
69.7674% passed

Many remote tests are currently failing [due to previously noted
changes to the gateway's responses](#3618).

All unit tests:
4544 tests, 72251 assertions, 0 failures, 0 errors, 0 pendings, 0
omissions, 0 notifications
100% passed
  • Loading branch information
leila-alderman committed Aug 12, 2020
1 parent 812c28c commit 06873c2
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
* Cybersource: add `maestro` and `diners_club` eci brand mapping [bbraschi] #3708
* Cybersource: Ensure Partner Solution Id placement conforms to schema [britth] #3715
* Adyen: Adyen: Pass `subMerchantId` as `additionalData` [naashton] #3714
* Litle: Omit checkNum when nil [leila-alderman] #3719

== Version 1.111.0
* Fat Zebra: standardized 3DS fields and card on file extra data for Visa scheme rules [montdidier] #3409
Expand Down
2 changes: 1 addition & 1 deletion lib/active_merchant/billing/gateways/litle.rb
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ def add_payment_method(doc, payment_method, options)
doc.accType(payment_method.account_type.capitalize)
doc.accNum(payment_method.account_number)
doc.routingNum(payment_method.routing_number)
doc.checkNum(payment_method.number)
doc.checkNum(payment_method.number) if payment_method.number
end
else
doc.card do
Expand Down
15 changes: 15 additions & 0 deletions test/unit/gateways/litle_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,21 @@ def test_passing_basis_date
end.respond_with(successful_purchase_response)
end

def test_does_not_pass_empty_checknum
check = check(
name: 'Tom Black',
routing_number: '011075150',
account_number: '4099999992',
number: nil,
account_type: 'checking'
)
stub_comms do
@gateway.purchase(@amount, check)
end.check_request do |endpoint, data, headers|
assert_not_match(/<checkNum\/>/m, data)
end.respond_with(successful_purchase_response)
end

def test_add_applepay_order_source
stub_comms do
@gateway.purchase(@amount, @decrypted_apple_pay)
Expand Down

0 comments on commit 06873c2

Please sign in to comment.