workarea-kount 3.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.editorconfig +20 -0
- data/.eslintrc +24 -0
- data/.github/ISSUE_TEMPLATE/bug_report.md +37 -0
- data/.github/ISSUE_TEMPLATE/documentation-request.md +17 -0
- data/.github/ISSUE_TEMPLATE/feature_request.md +20 -0
- data/.github/workflows/ci.yml +58 -0
- data/.gitignore +14 -0
- data/.rubocop.yml +2 -0
- data/CHANGELOG.md +212 -0
- data/CODE_OF_CONDUCT.md +3 -0
- data/CONTRIBUTING.md +3 -0
- data/Gemfile +17 -0
- data/LICENSE.md +3 -0
- data/README.md +98 -0
- data/Rakefile +53 -0
- data/app/controllers/workarea/admin/orders_controller.decorator +5 -0
- data/app/controllers/workarea/storefront/checkout/place_order_controller.decorator +11 -0
- data/app/controllers/workarea/storefront/kount_controller.rb +19 -0
- data/app/controllers/workarea/storefront/kount_orders_controller.rb +40 -0
- data/app/lib/active_shipping/rate_estimate.decorator +10 -0
- data/app/mailers/workarea/storefront/order_mailer.decorator +14 -0
- data/app/models/workarea/checkout.decorator +37 -0
- data/app/models/workarea/checkout/fraud/kount_analyzer.rb +71 -0
- data/app/models/workarea/kount/ens_event.rb +13 -0
- data/app/models/workarea/kount/order.rb +14 -0
- data/app/models/workarea/order.decorator +62 -0
- data/app/models/workarea/order/fraud_decision.decorator +9 -0
- data/app/models/workarea/order/item.decorator +8 -0
- data/app/models/workarea/order/status/review.rb +13 -0
- data/app/models/workarea/payment/credit_card.decorator +13 -0
- data/app/models/workarea/payment/payment.decorator +11 -0
- data/app/models/workarea/payment/status/kount_declined.rb +13 -0
- data/app/models/workarea/payment/status/kount_review.rb +13 -0
- data/app/models/workarea/payment/tender/credit_card.decorator +10 -0
- data/app/models/workarea/search/admin.decorator +12 -0
- data/app/models/workarea/search/admin/order.decorator +7 -0
- data/app/models/workarea/shipping/rate_lookup.decorator +26 -0
- data/app/models/workarea/shipping/service.decorator +9 -0
- data/app/models/workarea/shipping/service_selection.decorator +7 -0
- data/app/models/workarea/shipping_option.decorator +27 -0
- data/app/services/workarea/kount/cancel_order_under_review.rb +28 -0
- data/app/services/workarea/kount/event.rb +43 -0
- data/app/services/workarea/kount/event/dmc_event.rb +9 -0
- data/app/services/workarea/kount/event/risk_change_event.rb +21 -0
- data/app/services/workarea/kount/event/special_alert_event.rb +21 -0
- data/app/services/workarea/kount/event/workflow_event.rb +25 -0
- data/app/services/workarea/kount/event_batch.rb +37 -0
- data/app/services/workarea/kount/order_fraud_update_service.rb +42 -0
- data/app/services/workarea/kount/ris_inquiry.rb +120 -0
- data/app/services/workarea/kount/ris_inquiry/product.rb +53 -0
- data/app/services/workarea/kount/ris_request.rb +84 -0
- data/app/services/workarea/kount/ris_update.rb +39 -0
- data/app/view_models/workarea/admin/order_view_model.decorator +35 -0
- data/app/view_models/workarea/storefront/order_view_model.decorator +11 -0
- data/app/views/workarea/admin/orders/_kount.html.haml +28 -0
- data/app/views/workarea/admin/orders/kount.html.haml +46 -0
- data/app/views/workarea/storefront/checkouts/_kount_data_collector.html.haml +4 -0
- data/app/views/workarea/storefront/order_mailer/hold_denial.html.haml +14 -0
- data/app/workers/workarea/kount/process_review_order.rb +75 -0
- data/app/workers/workarea/kount/update_ris_inquiry.rb +31 -0
- data/bin/rails +18 -0
- data/config/initializers/appends.rb +11 -0
- data/config/initializers/workarea.rb +26 -0
- data/config/locales/en.yml +26 -0
- data/config/routes.rb +14 -0
- data/doc/Kount Technical Specification Guide 5.5.5.pdf +0 -0
- data/lib/workarea/kount.rb +87 -0
- data/lib/workarea/kount/address.rb +39 -0
- data/lib/workarea/kount/bogus_gateway.rb +415 -0
- data/lib/workarea/kount/engine.rb +8 -0
- data/lib/workarea/kount/errors.rb +2 -0
- data/lib/workarea/kount/gateway.rb +50 -0
- data/lib/workarea/kount/mappings.rb +195 -0
- data/lib/workarea/kount/payment_types.rb +50 -0
- data/lib/workarea/kount/response.rb +141 -0
- data/lib/workarea/kount/security_mash.rb +79 -0
- data/lib/workarea/kount/user_defined_fields.rb +16 -0
- data/lib/workarea/kount/version.rb +5 -0
- data/lib/workarea/mailer_previews/storefront/order_mailer_preview.rb +10 -0
- data/test/dummy/Rakefile +6 -0
- data/test/dummy/app/assets/config/manifest.js +4 -0
- data/test/dummy/app/assets/images/.keep +0 -0
- data/test/dummy/app/assets/javascripts/application.js +13 -0
- data/test/dummy/app/assets/stylesheets/application.css +15 -0
- data/test/dummy/app/controllers/application_controller.rb +3 -0
- data/test/dummy/app/controllers/concerns/.keep +0 -0
- data/test/dummy/app/helpers/application_helper.rb +2 -0
- data/test/dummy/app/jobs/application_job.rb +2 -0
- data/test/dummy/app/mailers/application_mailer.rb +4 -0
- data/test/dummy/app/models/concerns/.keep +0 -0
- data/test/dummy/app/views/layouts/application.html.erb +14 -0
- data/test/dummy/app/views/layouts/mailer.html.erb +13 -0
- data/test/dummy/app/views/layouts/mailer.text.erb +1 -0
- data/test/dummy/bin/bundle +3 -0
- data/test/dummy/bin/rails +4 -0
- data/test/dummy/bin/rake +4 -0
- data/test/dummy/bin/setup +34 -0
- data/test/dummy/bin/update +29 -0
- data/test/dummy/config.ru +5 -0
- data/test/dummy/config/application.rb +23 -0
- data/test/dummy/config/boot.rb +5 -0
- data/test/dummy/config/cable.yml +9 -0
- data/test/dummy/config/environment.rb +5 -0
- data/test/dummy/config/environments/development.rb +56 -0
- data/test/dummy/config/environments/production.rb +86 -0
- data/test/dummy/config/environments/test.rb +44 -0
- data/test/dummy/config/initializers/application_controller_renderer.rb +6 -0
- data/test/dummy/config/initializers/assets.rb +11 -0
- data/test/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/test/dummy/config/initializers/cookies_serializer.rb +5 -0
- data/test/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/test/dummy/config/initializers/inflections.rb +16 -0
- data/test/dummy/config/initializers/mime_types.rb +4 -0
- data/test/dummy/config/initializers/new_framework_defaults.rb +21 -0
- data/test/dummy/config/initializers/session_store.rb +3 -0
- data/test/dummy/config/initializers/workarea.rb +5 -0
- data/test/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/test/dummy/config/locales/en.yml +23 -0
- data/test/dummy/config/puma.rb +47 -0
- data/test/dummy/config/routes.rb +6 -0
- data/test/dummy/config/secrets.yml +22 -0
- data/test/dummy/config/spring.rb +6 -0
- data/test/dummy/db/seeds.rb +2 -0
- data/test/dummy/lib/assets/.keep +0 -0
- data/test/dummy/log/.keep +0 -0
- data/test/dummy/public/404.html +67 -0
- data/test/dummy/public/422.html +67 -0
- data/test/dummy/public/500.html +66 -0
- data/test/dummy/public/apple-touch-icon-precomposed.png +0 -0
- data/test/dummy/public/apple-touch-icon.png +0 -0
- data/test/dummy/public/favicon.ico +0 -0
- data/test/factories/kount.rb +164 -0
- data/test/integration/workarea/api/admin/payment_transactions_integration_test.decorator +29 -0
- data/test/integration/workarea/kount_moneris_integration_test.rb +37 -0
- data/test/integration/workarea/storefront/kount_integration_test.rb +37 -0
- data/test/integration/workarea/storefront/kount_orders_integration_test.rb +89 -0
- data/test/lib/workarea/kount/response_test.rb +95 -0
- data/test/lib/workarea/kount/security_mash_test.rb +62 -0
- data/test/models/workarea/checkout/fraud/kount_analyzer_test.rb +44 -0
- data/test/models/workarea/checkout_test.decorator +22 -0
- data/test/models/workarea/order/queries_test.decorator +28 -0
- data/test/models/workarea/order_test.decorator +25 -0
- data/test/models/workarea/payment/payment_test.rb +106 -0
- data/test/models/workarea/payment/saved_credit_card_test.rb +24 -0
- data/test/models/workarea/payment_test.decorator +54 -0
- data/test/models/workarea/shipping_option_test.rb +29 -0
- data/test/services/workarea/kount/event_batch_test.rb +95 -0
- data/test/services/workarea/kount/event_test.rb +51 -0
- data/test/services/workarea/kount/order_fraud_update_service_test.rb +48 -0
- data/test/support/workarea/kount_api_config.rb +27 -0
- data/test/system/workarea/kount_system_test.rb +72 -0
- data/test/system/workarea/storefront/kount_guest_checkout_system_test.rb +32 -0
- data/test/system/workarea/storefront/kount_logged_in_checkout_system_test.rb +102 -0
- data/test/test_helper.rb +16 -0
- data/test/vcr_cassettes/kount/basic_fraud_test.yml +43 -0
- data/test/vcr_cassettes/kount/integration/moneris_new_credit_card.yml +84 -0
- data/test/vcr_cassettes/kount/integration/moneris_saved_credit_card.yml +84 -0
- data/test/vcr_cassettes/kount/order_fraud_update.yml +82 -0
- data/test/workers/workarea/kount/clean_orders_test.rb +40 -0
- data/test/workers/workarea/kount/process_review_order_test.rb +100 -0
- data/workarea-kount.gemspec +17 -0
- metadata +238 -0
@@ -0,0 +1,51 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
module Workarea
|
4
|
+
module Kount
|
5
|
+
class EventTest < Workarea::TestCase
|
6
|
+
def test_create
|
7
|
+
assert_instance_of(Kount::DmcEvent, Event.create(dmc_xml))
|
8
|
+
assert_instance_of(Kount::WorkflowEvent, Event.create(workflow_xml))
|
9
|
+
end
|
10
|
+
|
11
|
+
private
|
12
|
+
|
13
|
+
def dmc_xml
|
14
|
+
xml = <<~XML
|
15
|
+
<event>
|
16
|
+
<name>DMC_ADDRESS_ADD</name>
|
17
|
+
<key>
|
18
|
+
<address_1>Street Address </address_1>
|
19
|
+
<address_2>Optional Address </address_2>
|
20
|
+
<city>City </city>
|
21
|
+
<state>State </state>
|
22
|
+
<postal_code>Postal Code </postal_code>
|
23
|
+
<type>Address Type </type>
|
24
|
+
</key>
|
25
|
+
<old_value>null </old_value>
|
26
|
+
<new_value>New Status </new_value>
|
27
|
+
<agent>agent@email.com </agent>
|
28
|
+
<occurred>2015-09-05 13:19:24 </occurred>
|
29
|
+
</event>
|
30
|
+
XML
|
31
|
+
|
32
|
+
Nokogiri::XML.parse(xml).children.first
|
33
|
+
end
|
34
|
+
|
35
|
+
def workflow_xml
|
36
|
+
xml = <<~XML
|
37
|
+
<event>
|
38
|
+
<name>WORKFLOW_STATUS_EDIT</name>
|
39
|
+
<key order_number="D58470FCF0" site="DEFAULT">7JG1075ML345</key>
|
40
|
+
<old_value>R</old_value>
|
41
|
+
<new_value>A</new_value>
|
42
|
+
<agent>SYSTEM@KOUNT.NET</agent>
|
43
|
+
<occurred>2018-05-18 06:47:47.413756</occurred>
|
44
|
+
</event>
|
45
|
+
XML
|
46
|
+
|
47
|
+
Nokogiri::XML.parse(xml).children.first
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
module Workarea
|
4
|
+
module Kount
|
5
|
+
class OrderFraudUpdateServiceTest < Workarea::TestCase
|
6
|
+
setup :setup_sandbox_credentials
|
7
|
+
teardown :restore_credentials
|
8
|
+
|
9
|
+
def test_update_with_auth
|
10
|
+
VCR.use_cassette('kount/order_fraud_update') do
|
11
|
+
checkout = create_purchasable_checkout(order: {
|
12
|
+
kount_session_id: '12345666',
|
13
|
+
ip_address: '170.115.187.68'
|
14
|
+
})
|
15
|
+
|
16
|
+
assert(checkout.place_order)
|
17
|
+
|
18
|
+
update_response = OrderFraudUpdateService.new(
|
19
|
+
order: checkout.order,
|
20
|
+
payment: checkout.payment
|
21
|
+
).perform!
|
22
|
+
|
23
|
+
assert(update_response.success?)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
private
|
28
|
+
|
29
|
+
def setup_sandbox_credentials
|
30
|
+
@_old_credentials = Workarea::Kount.credentials
|
31
|
+
|
32
|
+
Rails.application.secrets.kount = {
|
33
|
+
merchant_id: '200755',
|
34
|
+
version: '0630',
|
35
|
+
key: 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiIyMDA3NTUiLCJhdWQiOiJLb3VudC4xIiwiaWF0IjoxNTAwNDA3NTE1LCJzY3AiOnsia2EiOm51bGwsImtjIjpudWxsLCJhcGkiOnRydWUsInJpcyI6dHJ1ZX19.1YwTR1G8qBQ_TDK8MBYxDB2EhpUD0IlwWdvqHVOnm0o',
|
36
|
+
ksalt: '4077th hawkeye trapper radar section-8',
|
37
|
+
is_test: true
|
38
|
+
}
|
39
|
+
|
40
|
+
Workarea.config.fraud_analyzer = 'Workarea::Checkout::Fraud::KountAnalyzer'
|
41
|
+
end
|
42
|
+
|
43
|
+
def restore_credentials
|
44
|
+
Rails.application.secrets.kount = @_old_credentials
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module Workarea
|
2
|
+
module KountApiConfig
|
3
|
+
def self.included(test)
|
4
|
+
super
|
5
|
+
test.setup :set_kount_credentials
|
6
|
+
test.teardown :reset_kount_credentials
|
7
|
+
end
|
8
|
+
|
9
|
+
private
|
10
|
+
|
11
|
+
def set_kount_credentials
|
12
|
+
@_old_credentials = Workarea::Kount.credentials
|
13
|
+
|
14
|
+
Rails.application.secrets.kount = {
|
15
|
+
merchant_id: '200755',
|
16
|
+
version: '0630',
|
17
|
+
key: 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiIyMDA3NTUiLCJhdWQiOiJLb3VudC4xIiwiaWF0IjoxNTAwNDA3NTE1LCJzY3AiOnsia2EiOm51bGwsImtjIjpudWxsLCJhcGkiOnRydWUsInJpcyI6dHJ1ZX19.1YwTR1G8qBQ_TDK8MBYxDB2EhpUD0IlwWdvqHVOnm0o',
|
18
|
+
ksalt: '4077th hawkeye trapper radar section-8',
|
19
|
+
is_test: true
|
20
|
+
}
|
21
|
+
end
|
22
|
+
|
23
|
+
def reset_kount_credentials
|
24
|
+
Rails.application.secrets.kount = @_old_credentials
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,72 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
module Workarea
|
4
|
+
class KountSystemTest < Workarea::SystemTest
|
5
|
+
include Admin::IntegrationTest
|
6
|
+
|
7
|
+
def test_review_orders_are_index_in_admin_search
|
8
|
+
checkout = create_purchasable_checkout
|
9
|
+
|
10
|
+
checkout.order.update_attributes!(kount_decision: :review)
|
11
|
+
assert(checkout.handle_kount_review)
|
12
|
+
|
13
|
+
visit admin.root_path
|
14
|
+
fill_in 'q', with: checkout.order.id
|
15
|
+
click_button 'search_admin'
|
16
|
+
|
17
|
+
assert page.has_content? checkout.order.id
|
18
|
+
end
|
19
|
+
|
20
|
+
def test_decline_orders_are_index_in_admin_search
|
21
|
+
checkout = create_purchasable_checkout
|
22
|
+
|
23
|
+
checkout.order.update_attributes!(kount_decision: :decline)
|
24
|
+
|
25
|
+
visit admin.root_path
|
26
|
+
fill_in 'q', with: checkout.order.id
|
27
|
+
click_button 'search_admin'
|
28
|
+
|
29
|
+
assert page.has_content? checkout.order.id
|
30
|
+
end
|
31
|
+
|
32
|
+
def test_review_order_payments_have_kount_review_state
|
33
|
+
checkout = create_purchasable_checkout
|
34
|
+
|
35
|
+
checkout.order.update_attributes!(kount_decision: :review)
|
36
|
+
assert(checkout.handle_kount_review)
|
37
|
+
|
38
|
+
visit admin.order_path checkout.order
|
39
|
+
|
40
|
+
refute page.has_content? 'Pending'
|
41
|
+
assert page.has_content? 'Kount Review'
|
42
|
+
end
|
43
|
+
|
44
|
+
def test_decline_order_payments_have_kount_declined_state
|
45
|
+
checkout = create_purchasable_checkout
|
46
|
+
|
47
|
+
checkout.order.update_attributes!(kount_decision: :decline)
|
48
|
+
|
49
|
+
visit admin.order_path checkout.order
|
50
|
+
|
51
|
+
refute page.has_content? 'Pending'
|
52
|
+
assert page.has_content? 'Kount Declined'
|
53
|
+
end
|
54
|
+
|
55
|
+
def test_viewing_order_kount_card
|
56
|
+
checkout = create_purchasable_checkout
|
57
|
+
|
58
|
+
_kount_order = create_kount_order(id: checkout.order.id)
|
59
|
+
|
60
|
+
checkout.order.update_attributes!(kount_decision: :approve)
|
61
|
+
assert(checkout.place_order)
|
62
|
+
|
63
|
+
visit admin.kount_order_path checkout.order
|
64
|
+
|
65
|
+
assert page.has_content? t('workarea.admin.orders.cards.kount.decision')
|
66
|
+
assert page.has_content? t('workarea.admin.orders.cards.kount.score')
|
67
|
+
assert page.has_content? t('workarea.admin.orders.cards.kount.credit_cards')
|
68
|
+
assert page.has_content? t('workarea.admin.orders.cards.kount.email_addresses')
|
69
|
+
assert page.has_content? t('workarea.admin.orders.cards.kount.devices')
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
module Workarea
|
4
|
+
module Storefront
|
5
|
+
class KountGuestCheckoutSystemTest < Workarea::SystemTest
|
6
|
+
include Storefront::SystemTest
|
7
|
+
|
8
|
+
setup :setup_checkout_specs
|
9
|
+
setup :start_guest_checkout
|
10
|
+
|
11
|
+
def test_fraud_payment_failure
|
12
|
+
assert_current_path(storefront.checkout_addresses_path)
|
13
|
+
fill_in 'email', with: 'decline@workarea.com'
|
14
|
+
fill_in_shipping_address
|
15
|
+
uncheck 'same_as_shipping'
|
16
|
+
fill_in_billing_address
|
17
|
+
click_button t('workarea.storefront.checkouts.continue_to_shipping')
|
18
|
+
|
19
|
+
assert_current_path(storefront.checkout_shipping_path)
|
20
|
+
click_button t('workarea.storefront.checkouts.continue_to_payment')
|
21
|
+
|
22
|
+
assert_current_path(storefront.checkout_payment_path)
|
23
|
+
fill_in_credit_card
|
24
|
+
fill_in 'credit_card[number]', with: '1'
|
25
|
+
click_button t('workarea.storefront.checkouts.place_order')
|
26
|
+
|
27
|
+
assert_current_path(storefront.checkout_place_order_path)
|
28
|
+
assert(page.has_content?('Error'))
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,102 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
module Workarea
|
4
|
+
module Storefront
|
5
|
+
class KountLoggedInCheckoutSystemTest < Workarea::SystemTest
|
6
|
+
include Storefront::SystemTest
|
7
|
+
|
8
|
+
def test_review_orders_are_not_still_in_cart
|
9
|
+
# setup
|
10
|
+
Workarea.config.fraud_analyzer =
|
11
|
+
'Workarea::Checkout::Fraud::KountAnalyzer'
|
12
|
+
email = 'review@workarea.com'
|
13
|
+
create_supporting_data email: email
|
14
|
+
add_product_to_cart
|
15
|
+
add_user_data email: email
|
16
|
+
start_user_checkout email: email
|
17
|
+
|
18
|
+
click_button t('workarea.storefront.checkouts.place_order')
|
19
|
+
assert_current_path(storefront.checkout_confirmation_path)
|
20
|
+
assert(page.has_content?('Success'))
|
21
|
+
assert_equal(:review, Order.first.status)
|
22
|
+
|
23
|
+
visit storefront.cart_path
|
24
|
+
|
25
|
+
assert(page.has_no_content?('Integration Product'))
|
26
|
+
end
|
27
|
+
|
28
|
+
private
|
29
|
+
|
30
|
+
def create_supporting_data(email: 'bcrouse@workarea.com')
|
31
|
+
create_tax_category(
|
32
|
+
name: 'Sales Tax',
|
33
|
+
code: '001',
|
34
|
+
rates: [{ percentage: 0.07, country: 'US', region: 'PA' }]
|
35
|
+
)
|
36
|
+
|
37
|
+
create_shipping_service(
|
38
|
+
name: 'Ground',
|
39
|
+
tax_code: '001',
|
40
|
+
rates: [{ price: 7.to_m }]
|
41
|
+
)
|
42
|
+
|
43
|
+
create_inventory(id: 'SKU', policy: 'standard', available: 5)
|
44
|
+
|
45
|
+
@product = create_product(
|
46
|
+
id: 'INT_PRODUCT',
|
47
|
+
name: 'Integration Product',
|
48
|
+
variants: [{ sku: 'SKU', tax_code: '001', regular: 5.to_m }]
|
49
|
+
)
|
50
|
+
|
51
|
+
create_user(email: email, password: 'W3bl1nc!')
|
52
|
+
end
|
53
|
+
|
54
|
+
def add_user_data(email: 'bcrouse@workarea.com')
|
55
|
+
user = User.find_by_email email
|
56
|
+
|
57
|
+
user.auto_save_shipping_address(
|
58
|
+
first_name: 'Ben',
|
59
|
+
last_name: 'Crouse',
|
60
|
+
street: '22 S. 3rd St.',
|
61
|
+
city: 'Philadelphia',
|
62
|
+
region: 'PA',
|
63
|
+
postal_code: '19106',
|
64
|
+
country: 'US',
|
65
|
+
phone_number: '2159251800'
|
66
|
+
)
|
67
|
+
|
68
|
+
user.auto_save_billing_address(
|
69
|
+
first_name: 'Ben',
|
70
|
+
last_name: 'Crouse',
|
71
|
+
street: '1019 S. 47th St.',
|
72
|
+
city: 'Philadelphia',
|
73
|
+
region: 'PA',
|
74
|
+
postal_code: '19143',
|
75
|
+
country: 'US',
|
76
|
+
phone_number: '2159251800'
|
77
|
+
)
|
78
|
+
|
79
|
+
profile = Payment::Profile.lookup(PaymentReference.new(user))
|
80
|
+
profile.credit_cards.create!(
|
81
|
+
first_name: 'Ben',
|
82
|
+
last_name: 'Crouse',
|
83
|
+
number: '1',
|
84
|
+
month: 1,
|
85
|
+
year: Time.current.year + 1,
|
86
|
+
cvv: '999'
|
87
|
+
)
|
88
|
+
end
|
89
|
+
|
90
|
+
def start_user_checkout(email: 'bcrouse@workarea.com')
|
91
|
+
visit storefront.checkout_path
|
92
|
+
click_link t('workarea.storefront.checkouts.login_title')
|
93
|
+
|
94
|
+
within '#login_form' do
|
95
|
+
fill_in 'email', with: email
|
96
|
+
fill_in 'password', with: 'W3bl1nc!'
|
97
|
+
click_button t('workarea.storefront.users.login')
|
98
|
+
end
|
99
|
+
end
|
100
|
+
end
|
101
|
+
end
|
102
|
+
end
|
data/test/test_helper.rb
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
require 'simplecov'
|
2
|
+
|
3
|
+
SimpleCov.start 'rails' do
|
4
|
+
add_group 'View Models', 'app/view_models'
|
5
|
+
add_filter 'lib/workarea/kount/version.rb'
|
6
|
+
add_filter 'lib/workarea/mailer_previews/storefront/order_mailer_preview.rb'
|
7
|
+
add_filter 'lib/workarea/kount/bogus_gateway.rb'
|
8
|
+
add_filter %r{app/services/workarea/kount/event/.*\.rb}
|
9
|
+
end
|
10
|
+
|
11
|
+
ENV['RAILS_ENV'] = 'test'
|
12
|
+
require File.expand_path('../../test/dummy/config/environment.rb', __FILE__)
|
13
|
+
require 'rails/test_help'
|
14
|
+
require 'workarea/test_help'
|
15
|
+
|
16
|
+
Minitest.backtrace_filter = Minitest::BacktraceFilter.new
|
@@ -0,0 +1,43 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: https://risk.test.kount.net/
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: MACK=Y&AUTH=A&SESS=12345666&MODE=Q&SITE=DEFAULT&S2A1=22+S.+3rd+St.&S2A2=Second+Floor&S2CI=Philadelphia&S2ST=PA&S2PC=19106&S2CC=US&S2PN&B2A1=22+S.+3rd+St.&B2A2=Second+Floor&B2CI=Philadelphia&B2ST=PA&B2PC=19106&B2CC=US&B2PN&PTYP=CARD&PTOK=411111WMS5YA6FUZA1KC&PENC=KHASH&SHTP=ST&TOTL=1100&CURR=USD&EMAL=bcrouse-new%40workarea.com&NAME=Ben+Crouse&IPAD=170.115.187.68&ORDR=21405EF57F&PROD_TYPE[]=Test+Product&PROD_DESC[]=Test+Product+-+&PROD_ITEM[]=SKU&PROD_PRICE[]=500&PROD_QUANT[]=2&VERS=0630&MERC=200755&FRMT=JSON
|
9
|
+
headers:
|
10
|
+
Accept:
|
11
|
+
- "*/*"
|
12
|
+
Accept-Encoding:
|
13
|
+
- gzip, deflate
|
14
|
+
User-Agent:
|
15
|
+
- rest-client/2.0.2 (darwin17.4.0 x86_64) ruby/2.4.4p296
|
16
|
+
X-Kount-Api-Key:
|
17
|
+
- eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiIyMDA3NTUiLCJhdWQiOiJLb3VudC4xIiwiaWF0IjoxNTAwNDA3NTE1LCJzY3AiOnsia2EiOm51bGwsImtjIjpudWxsLCJhcGkiOnRydWUsInJpcyI6dHJ1ZX19.1YwTR1G8qBQ_TDK8MBYxDB2EhpUD0IlwWdvqHVOnm0o
|
18
|
+
Content-Length:
|
19
|
+
- '512'
|
20
|
+
Content-Type:
|
21
|
+
- application/x-www-form-urlencoded
|
22
|
+
Host:
|
23
|
+
- risk.test.kount.net
|
24
|
+
response:
|
25
|
+
status:
|
26
|
+
code: 200
|
27
|
+
message: OK
|
28
|
+
headers:
|
29
|
+
Date:
|
30
|
+
- Fri, 01 Jun 2018 12:44:28 GMT
|
31
|
+
Server:
|
32
|
+
- Apache
|
33
|
+
Content-Length:
|
34
|
+
- '941'
|
35
|
+
Content-Type:
|
36
|
+
- text/plain;charset=UTF-8
|
37
|
+
body:
|
38
|
+
encoding: UTF-8
|
39
|
+
string: '{"VERS":"0630","MODE":"Q","TRAN":"7J1X0DS1H8VX","MERC":"200755","SESS":"12345666","ORDR":"21405EF57F","AUTO":"A","SCOR":"34","GEOX":"US","BRND":"VISA","REGN":"US_PA","NETW":"N","KAPT":"N","CARDS":"1","DEVICES":"1","EMAILS":"1","VELO":"0","VMAX":"0","SITE":"DEFAULT","DEVICE_LAYERS":"....","FINGERPRINT":null,"TIMEZONE":null,"LOCALTIME":"
|
40
|
+
","REGION":null,"COUNTRY":null,"PROXY":null,"JAVASCRIPT":null,"FLASH":null,"COOKIES":null,"HTTP_COUNTRY":null,"LANGUAGE":null,"MOBILE_DEVICE":null,"MOBILE_TYPE":null,"MOBILE_FORWARDER":null,"VOICE_DEVICE":null,"PC_REMOTE":null,"RULES_TRIGGERED":0,"COUNTERS_TRIGGERED":0,"REASON_CODE":null,"MASTERCARD":"","DDFS":null,"DSR":null,"UAS":null,"BROWSER":null,"OS":null,"PIP_IPAD":null,"PIP_LAT":null,"PIP_LON":null,"PIP_COUNTRY":null,"PIP_REGION":null,"PIP_CITY":null,"PIP_ORG":null,"IP_IPAD":null,"IP_LAT":null,"IP_LON":null,"IP_COUNTRY":null,"IP_REGION":null,"IP_CITY":null,"IP_ORG":null,"WARNING_COUNT":0}'
|
41
|
+
http_version:
|
42
|
+
recorded_at: Fri, 01 Jun 2018 12:44:29 GMT
|
43
|
+
recorded_with: VCR 2.9.3
|
@@ -0,0 +1,84 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: https://esqa.moneris.com/gateway2/servlet/MpgRequest
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: "<request><store_id>monca02501</store_id><api_token>YSI4CKbdvgSbr6is4JMZ</api_token><res_add_cc><pan>4111111111111111</pan><expdate>2101</expdate><crypt_type>7</crypt_type></res_add_cc></request>"
|
9
|
+
headers:
|
10
|
+
Content-Type:
|
11
|
+
- application/x-www-form-urlencoded
|
12
|
+
Connection:
|
13
|
+
- close
|
14
|
+
Accept-Encoding:
|
15
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
16
|
+
Accept:
|
17
|
+
- "*/*"
|
18
|
+
User-Agent:
|
19
|
+
- Ruby
|
20
|
+
response:
|
21
|
+
status:
|
22
|
+
code: 200
|
23
|
+
message: OK
|
24
|
+
headers:
|
25
|
+
Date:
|
26
|
+
- Mon, 21 Sep 2020 18:36:53 GMT
|
27
|
+
X-Ua-Compatible:
|
28
|
+
- IE=Edge
|
29
|
+
Connection:
|
30
|
+
- close
|
31
|
+
Content-Type:
|
32
|
+
- text/html
|
33
|
+
Set-Cookie:
|
34
|
+
- TS019df888=015d06d254c8e6a1d7fac341c1d4e33abe70a8558e0ccc0b192b395eae3c6553e67eff9305bf693eec83c3b5c4a6904a092912b70d;
|
35
|
+
Path=/; Domain=.esqa.moneris.com; Secure
|
36
|
+
Transfer-Encoding:
|
37
|
+
- chunked
|
38
|
+
body:
|
39
|
+
encoding: UTF-8
|
40
|
+
string: <?xml version="1.0"?><response><receipt><DataKey>xoYWod1B0UxAR16TkhVX48yy1</DataKey><ReceiptId>null</ReceiptId><ReferenceNum>null</ReferenceNum><ResponseCode>001</ResponseCode><ISO>null</ISO><AuthCode>null</AuthCode><Message>Successfully
|
41
|
+
registered CC details.</Message><TransTime>14:36:53</TransTime><TransDate>2020-09-21</TransDate><TransType>null</TransType><Complete>true</Complete><TransAmount>null</TransAmount><CardType>null</CardType><TransID>null</TransID><TimedOut>false</TimedOut><CorporateCard>null</CorporateCard><RecurSuccess>null</RecurSuccess><AvsResultCode>null</AvsResultCode><CvdResultCode>null</CvdResultCode><ResSuccess>true</ResSuccess><PaymentType>cc</PaymentType><IsVisaDebit>null</IsVisaDebit><ResolveData><cust_id></cust_id><phone></phone><email></email><note></note><avs_street_number></avs_street_number><avs_street_name></avs_street_name><avs_zipcode></avs_zipcode><masked_pan>4111***1111</masked_pan><expdate>2101</expdate><crypt_type>7</crypt_type></ResolveData></receipt></response>
|
42
|
+
http_version:
|
43
|
+
recorded_at: Mon, 21 Sep 2020 18:36:53 GMT
|
44
|
+
- request:
|
45
|
+
method: post
|
46
|
+
uri: https://esqa.moneris.com/gateway2/servlet/MpgRequest
|
47
|
+
body:
|
48
|
+
encoding: UTF-8
|
49
|
+
string: "<request><store_id>monca02501</store_id><api_token>YSI4CKbdvgSbr6is4JMZ</api_token><res_preauth_cc><data_key>xoYWod1B0UxAR16TkhVX48yy1</data_key><order_id>10E81C2F22_2020_09_21_14_36_53</order_id><amount>11.00</amount><crypt_type>7</crypt_type></res_preauth_cc></request>"
|
50
|
+
headers:
|
51
|
+
Content-Type:
|
52
|
+
- application/x-www-form-urlencoded
|
53
|
+
Connection:
|
54
|
+
- close
|
55
|
+
Accept-Encoding:
|
56
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
57
|
+
Accept:
|
58
|
+
- "*/*"
|
59
|
+
User-Agent:
|
60
|
+
- Ruby
|
61
|
+
response:
|
62
|
+
status:
|
63
|
+
code: 200
|
64
|
+
message: OK
|
65
|
+
headers:
|
66
|
+
Date:
|
67
|
+
- Mon, 21 Sep 2020 18:36:53 GMT
|
68
|
+
X-Ua-Compatible:
|
69
|
+
- IE=Edge
|
70
|
+
Connection:
|
71
|
+
- close
|
72
|
+
Content-Type:
|
73
|
+
- text/html
|
74
|
+
Set-Cookie:
|
75
|
+
- TS019df888=015d06d254daf1e5ced1dfa9a9f751e875b1a340424965c106769e0b65f63995477863bf6c92883aeea931bb04844a8552f4a366df;
|
76
|
+
Path=/; Domain=.esqa.moneris.com; Secure
|
77
|
+
Transfer-Encoding:
|
78
|
+
- chunked
|
79
|
+
body:
|
80
|
+
encoding: UTF-8
|
81
|
+
string: <?xml version="1.0"?><response><receipt><DataKey>xoYWod1B0UxAR16TkhVX48yy1</DataKey><ReceiptId>10E81C2F22_2020_09_21_14_36_53</ReceiptId><ReferenceNum>660189810010090010</ReferenceNum><ResponseCode>027</ResponseCode><ISO>01</ISO><AuthCode>938169</AuthCode><Message>APPROVED * =</Message><TransTime>14:36:53</TransTime><TransDate>2020-09-21</TransDate><TransType>01</TransType><Complete>true</Complete><TransAmount>11.00</TransAmount><CardType>V</CardType><TransID>159-0_15</TransID><TimedOut>false</TimedOut><CorporateCard>false</CorporateCard><RecurSuccess>null</RecurSuccess><AvsResultCode>null</AvsResultCode><CvdResultCode>null</CvdResultCode><ResSuccess>true</ResSuccess><PaymentType>cc</PaymentType><IsVisaDebit>false</IsVisaDebit><ResolveData><cust_id></cust_id><phone></phone><email></email><note></note><expdate>2101</expdate><masked_pan>4111***1111</masked_pan><crypt_type>7</crypt_type><avs_street_number></avs_street_number><avs_street_name></avs_street_name><avs_zipcode></avs_zipcode></ResolveData></receipt></response>
|
82
|
+
http_version:
|
83
|
+
recorded_at: Mon, 21 Sep 2020 18:36:54 GMT
|
84
|
+
recorded_with: VCR 2.9.3
|