Skip to content

Commit aa8fd20

Browse files
adarsh-spreedlyAlma Malambo
authored and
Alma Malambo
committed
redorax: Add Sender Birth Date for AFT
Remote: 56 tests, 192 assertions, 9 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications 83.9286% passed
1 parent 86be1eb commit aa8fd20

File tree

4 files changed

+76
-2
lines changed

4 files changed

+76
-2
lines changed

CHANGELOG

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,7 @@
156156
* Credorax: Add optional crypto currency type field [yunnydang] #5460
157157
* CommerceHub: Map ecommerce_indicator value based on three_d_secure.eci [mjdonga] #5461
158158
* StripePI: Add the optional kana and kanji descriptor suffix fields [yunnydang] #5466
159+
* Credorax: Add Sender Birth Date for AFT [adarsh-spreedly] #5469
159160

160161
== Version 1.137.0 (August 2, 2024)
161162
* Unlock dependency on `rexml` to allow fixing a CVE (#5181).

lib/active_merchant/billing/gateways/credorax.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,7 @@ def add_email(post, options)
366366
end
367367

368368
def add_sender(post, options)
369-
return unless options[:sender_ref_number] || options[:sender_fund_source] || options[:sender_country_code] || options[:sender_street_address] || options[:sender_city] || options[:sender_state] || options[:sender_first_name] || options[:sender_last_name]
369+
return unless options[:sender_ref_number] || options[:sender_fund_source] || options[:sender_country_code] || options[:sender_street_address] || options[:sender_city] || options[:sender_state] || options[:sender_first_name] || options[:sender_last_name] || options[:sender_birth_date]
370370

371371
sender_country_code = options[:sender_country_code]&.length == 3 ? options[:sender_country_code] : Country.find(options[:sender_country_code]).code(:alpha3).value if options[:sender_country_code]
372372
post[:s15] = sender_country_code
@@ -377,6 +377,7 @@ def add_sender(post, options)
377377
post[:s12] = options[:sender_street_address] if options[:sender_street_address]
378378
post[:s13] = options[:sender_city] if options[:sender_city]
379379
post[:s14] = options[:sender_state] if options[:sender_state]
380+
post[:s19] = options[:sender_birth_date] if options[:sender_birth_date]
380381
end
381382

382383
def add_recipient(post, options)

test/remote/gateways/remote_credorax_test.rb

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ def setup
66

77
@amount = 100
88
@adviser_amount = 1000001
9-
@credit_card = credit_card('4012001038443335', verification_value: '512', month: '12')
9+
@credit_card = credit_card('4018810000100036', verification_value: '123', month: '12', year: 2034)
1010
@fully_auth_card = credit_card('5223450000000007', brand: 'mastercard', verification_value: '090', month: '12')
1111
@declined_card = credit_card('4176661000001111', verification_value: '681', month: '12')
1212
@three_ds_card = credit_card('5455330200000016', verification_value: '737', month: '10', year: Time.now.year + 2)
@@ -728,6 +728,33 @@ def test_purchase_passes_d2_field
728728
assert_equal 'Echo Parameter', response.params['D2']
729729
end
730730

731+
def test_successful_aft_purchase_with_sender_birth_date
732+
aft_options = @options.merge(
733+
aft: true,
734+
sender_ref_number: 'test',
735+
sender_fund_source: '01',
736+
sender_country_code: 'USA',
737+
sender_street_address: 'sender street',
738+
sender_city: 'city',
739+
sender_state: 'NY',
740+
sender_first_name: 'george',
741+
sender_last_name: 'smith',
742+
sender_birth_date: '12121212',
743+
recipient_street_address: 'street',
744+
recipient_postal_code: '12345',
745+
recipient_city: 'chicago',
746+
recipient_province_code: '312',
747+
recipient_country_code: 'USA',
748+
recipient_first_name: 'logan',
749+
recipient_last_name: 'bill'
750+
)
751+
752+
response = @gateway.purchase(@amount, @credit_card, aft_options)
753+
assert_success response
754+
assert_equal '1', response.params['H9']
755+
assert_equal 'Succeeded', response.message
756+
end
757+
731758
# #########################################################################
732759
# # CERTIFICATION SPECIFIC REMOTE TESTS
733760
# #########################################################################

test/unit/gateways/credorax_test.rb

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1169,6 +1169,51 @@ def test_successful_purchase_with_other_than_network_token
11691169
assert_success response
11701170
end
11711171

1172+
def test_purchase_adds_aft_fields_along_with_sender_birth_date
1173+
aft_options = @options.merge(
1174+
aft: true,
1175+
sender_ref_number: 'test',
1176+
sender_fund_source: '01',
1177+
sender_country_code: 'USA',
1178+
sender_street_address: 'sender street',
1179+
sender_city: 'city',
1180+
sender_state: 'NY',
1181+
sender_first_name: 'george',
1182+
sender_last_name: 'smith',
1183+
sender_birth_date: '12121212',
1184+
recipient_street_address: 'street',
1185+
recipient_city: 'chicago',
1186+
recipient_province_code: '312',
1187+
recipient_postal_code: '12345',
1188+
recipient_country_code: 'USA',
1189+
recipient_first_name: 'logan',
1190+
recipient_last_name: 'bill'
1191+
)
1192+
1193+
stub_comms do
1194+
@gateway.purchase(@amount, @credit_card, aft_options)
1195+
end.check_request do |_endpoint, data, _headers|
1196+
# recipient fields
1197+
assert_match(/j5=logan/, data)
1198+
assert_match(/j6=street/, data)
1199+
assert_match(/j7=chicago/, data)
1200+
assert_match(/j8=312/, data)
1201+
assert_match(/j9=USA/, data)
1202+
assert_match(/j13=bill/, data)
1203+
assert_match(/j12=12345/, data)
1204+
# sender fields
1205+
assert_match(/s10=george/, data)
1206+
assert_match(/s11=smith/, data)
1207+
assert_match(/s12=sender\+street/, data)
1208+
assert_match(/s13=city/, data)
1209+
assert_match(/s14=NY/, data)
1210+
assert_match(/s15=USA/, data)
1211+
assert_match(/s17=test/, data)
1212+
assert_match(/s18=01/, data)
1213+
assert_match(/s19=12121212/, data)
1214+
end.respond_with(successful_purchase_response)
1215+
end
1216+
11721217
private
11731218

11741219
def stored_credential_options(*args, id: nil)

0 commit comments

Comments
 (0)