Skip to content

Commit

Permalink
Merge pull request #10 from mycase/BMH-2926
Browse files Browse the repository at this point in the history
BMH-2926 Added expiration year and month to the LitleToken for expDate of enhancedData related to level3 rates
  • Loading branch information
dotcom900825 authored Feb 8, 2024
2 parents f42d591 + 26e5330 commit 7413cc9
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 3 deletions.
4 changes: 3 additions & 1 deletion lib/active_merchant/billing/gateways/litle/token.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@ module Billing
# The name parameter is allowed by Vantiv as a member of the billToAddress element.
# It is passed in here to be consistent with the rest of the Litle gateway and Activemerchant.
class LitleToken
attr_reader :litle_token, :name, :brand
attr_reader :litle_token, :name, :brand, :month, :year

def initialize(litle_token, options = {})
@litle_token = litle_token
@month = options[:month]
@year = options[:year]
@name = options[:name]
@brand = options[:brand]
end
Expand Down
2 changes: 1 addition & 1 deletion lib/active_merchant/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module ActiveMerchant
VERSION = '1.127.0'
VERSION = '1.128.0'
end
37 changes: 36 additions & 1 deletion test/unit/gateways/litle_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,9 @@ def test_passing_with_litle_token_of_level_3_rates
litle_token = ActiveMerchant::Billing::LitleToken.new(
'XkNDRGZDTGZyS2RBSTVCazJNSmdWam5T',
brand: 'visa',
name: 'Joe Payer'
name: 'Joe Payer',
month: '12',
year: '46'
)
options = @options.merge(
level_3_data: {
Expand All @@ -327,6 +329,39 @@ def test_passing_with_litle_token_of_level_3_rates
end.check_request do |_endpoint, data, _headers|
assert_match(%r(<unitCost>500</unitCost>), data)
assert_match(%r(<taxAmount>0</taxAmount>), data)
assert_match(%r(<expDate>1246</expDate>), data)
end.respond_with(successful_purchase_response)
end

def test_passing_level_3_rates_with_customer_data
options = @options.merge(
level_3_data: {
customer_code: 'fake_order_number',
card_acceptor_tax_id: 'mycase_tax_id',
total_tax_amount: 0,
line_items: [{
product_code: 'test',
item_description: 'Legal services',
quantity: 1,
unit_of_measure: 'EA',
line_item_total: 500
}]
}
)
credit_card = CreditCard.new(
first_name: 'John',
last_name: 'Smith',
month: '01',
year: '2024',
brand: 'master',
number: '5555555555554444',
verification_value: '349'
)
stub_comms do
@gateway.purchase(@amount, credit_card, options)
end.check_request do |_endpoint, data, _headers|
assert_match(%r(<customerReference>fake_order_number</customerReference>), data)
assert_match(%r(<cardAcceptorTaxId>mycase_tax_id</cardAcceptorTaxId>), data)
end.respond_with(successful_purchase_response)
end

Expand Down

0 comments on commit 7413cc9

Please sign in to comment.