Skip to content

Commit

Permalink
Litle: Fix commodity code placement in enhanced data fields
Browse files Browse the repository at this point in the history
  • Loading branch information
yunnydang committed May 2, 2024
1 parent 4b0ee60 commit 3ded115
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
3 changes: 2 additions & 1 deletion lib/active_merchant/billing/gateways/litle.rb
Original file line number Diff line number Diff line change
Expand Up @@ -111,13 +111,14 @@ def add_line_item_information_for_level_three_visa(doc, payment_method, level_3_
doc.lineItemData do
level_3_data[:line_items].each do |line_item|
doc.itemSequenceNumber(line_item[:item_sequence_number]) if line_item[:item_sequence_number]
doc.commodityCode(line_item[:commodity_code]) if line_item[:commodity_code]
doc.itemDescription(line_item[:item_description]) if line_item[:item_description]
doc.productCode(line_item[:product_code]) if line_item[:product_code]
doc.quantity(line_item[:quantity]) if line_item[:quantity]
doc.unitOfMeasure(line_item[:unit_of_measure]) if line_item[:unit_of_measure]
doc.taxAmount(line_item[:tax_amount]) if line_item[:tax_amount]
doc.lineItemTotal(line_item[:line_item_total]) if line_item[:line_item_total]
doc.itemDiscountAmount(line_item[:discount_per_line_item].to_i) unless line_item[:discount_per_line_item].to_i < 0
doc.commodityCode(line_item[:commodity_code]) if line_item[:commodity_code]
doc.unitCost(line_item[:unit_cost].to_i) unless line_item[:unit_cost].to_i < 0
doc.detailTax do
doc.taxIncludedInTotal(line_item[:tax_included_in_total]) if line_item[:tax_included_in_total]
Expand Down
5 changes: 3 additions & 2 deletions test/remote/gateways/remote_litle_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ def test_successful_purchase_with_level_three_data_visa
card_acceptor_tax_id: '361531321',
line_items: [{
item_sequence_number: 1,
item_commodity_code: 300,
commodity_code: '041235',
item_description: 'ramdom-object',
product_code: 'TB123',
quantity: 2,
Expand All @@ -325,7 +325,7 @@ def test_successful_purchase_with_level_three_data_visa
}]
}
)
assert response = @gateway.purchase(10010, @credit_card1, options)
assert response = @gateway.purchase(1000, @credit_card1, options)
assert_success response
assert_equal 'Approved', response.message
end
Expand All @@ -347,6 +347,7 @@ def test_successful_purchase_with_level_three_data_master
customer_code: 'PO12345',
card_acceptor_tax_id: '011234567',
tax_amount: 50,
tax_included_in_total: true,
line_items: [{
item_description: 'ramdom-object',
product_code: 'TB123',
Expand Down

0 comments on commit 3ded115

Please sign in to comment.