-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Rapyd: Add fields and update stored credential method
Local: 5588 tests, 77761 assertions, 0 failures, 19 errors, 0 pendings, 0 omissions, 0 notifications 99.66% passed Unit: 27 tests, 137 assertions, 0 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications 100% passed Remote: 34 tests, 95 assertions, 0 failures, 0 errors, 0 pendings, 0 omissions, 0 notifications 100% passed
- Loading branch information
Showing
4 changed files
with
55 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,6 +19,17 @@ def setup | |
billing_address: address(name: 'Jim Reynolds'), | ||
order_id: '987654321' | ||
} | ||
@stored_credential_options = { | ||
pm_type: 'gb_visa_card', | ||
currency: 'GBP', | ||
complete_payment_url: 'https://www.rapyd.net/platform/collect/online/', | ||
error_payment_url: 'https://www.rapyd.net/platform/collect/online/', | ||
description: 'Describe this transaction', | ||
statement_descriptor: 'Statement Descriptor', | ||
email: '[email protected]', | ||
billing_address: address(name: 'Jim Reynolds'), | ||
order_id: '987654321' | ||
} | ||
@ach_options = { | ||
pm_type: 'us_ach_bank', | ||
currency: 'USD', | ||
|
@@ -81,15 +92,25 @@ def test_success_purchase_without_address_object_customer | |
end | ||
|
||
def test_successful_subsequent_purchase_with_stored_credential | ||
@options[:currency] = 'GBP' | ||
@options[:pm_type] = 'gb_visa_card' | ||
@options[:complete_payment_url] = 'https://www.rapyd.net/platform/collect/online/' | ||
@options[:error_payment_url] = 'https://www.rapyd.net/platform/collect/online/' | ||
# Rapyd requires a random int between 10 and 15 digits for NTID | ||
response = @gateway.purchase(15000, @credit_card, @stored_credential_options.merge(stored_credential: { network_transaction_id: rand.to_s[2..11], reason_type: 'recurring' })) | ||
assert_success response | ||
assert_equal 'SUCCESS', response.message | ||
end | ||
|
||
def test_successful_purchase_with_network_transaction_id_and_initiation_type_fields | ||
# Rapyd requires a random int between 10 and 15 digits for NTID | ||
response = @gateway.purchase(15000, @credit_card, @stored_credential_options.merge(network_transaction_id: rand.to_s[2..11], initiation_type: 'customer_present')) | ||
assert_success response | ||
assert_equal 'SUCCESS', response.message | ||
end | ||
|
||
def test_successful_purchase_with_network_transaction_id_and_initiation_type_fields_along_with_stored_credentials | ||
# Rapyd requires a random int between 10 and 15 digits for NTID | ||
response = @gateway.purchase(15000, @credit_card, @options.merge({ stored_credential: { network_transaction_id: rand.to_s[2..11], reason_type: 'recurring' } })) | ||
response = @gateway.purchase(15000, @credit_card, @stored_credential_options.merge(stored_credential: { network_transaction_id: rand.to_s[2..11], reason_type: 'recurring' }, network_transaction_id: rand.to_s[2..11], initiation_type: 'customer_present')) | ||
assert_success response | ||
assert_equal 'SUCCESS', response.message | ||
assert_equal 'customer_present', response.params['data']['initiation_type'] | ||
end | ||
|
||
def test_successful_purchase_with_address | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters