solidus_bank_transfer 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/LICENSE +26 -0
- data/README.md +63 -0
- data/Rakefile +32 -0
- data/app/assets/javascripts/spree/backend/solidus_bank_transfer.js +2 -0
- data/app/assets/javascripts/spree/frontend/solidus_bank_transfer.js +2 -0
- data/app/assets/stylesheets/spree/backend/solidus_bank_transfer.css +4 -0
- data/app/assets/stylesheets/spree/frontend/solidus_bank_transfer.css +4 -0
- data/app/models/spree/payment_method/bank_transfer.rb +46 -0
- data/app/views/spree/checkout/payment/_banktransfer.html.erb +16 -0
- data/app/views/spree/order_mailer/_bank_transfer_details.html.erb +23 -0
- data/app/views/spree/orders/_bank_transfer_details.html.erb +22 -0
- data/config/locales/en.yml +14 -0
- data/config/locales/it.yml +14 -0
- data/config/routes.rb +5 -0
- data/lib/generators/solidus_bank_transfer/install/install_generator.rb +32 -0
- data/lib/solidus_bank_transfer.rb +4 -0
- data/lib/solidus_bank_transfer/engine.rb +26 -0
- data/lib/solidus_bank_transfer/factories.rb +17 -0
- data/lib/solidus_bank_transfer/version.rb +5 -0
- data/spec/dummy/README.md +24 -0
- data/spec/dummy/Rakefile +6 -0
- data/spec/dummy/app/assets/config/manifest.js +3 -0
- data/spec/dummy/app/assets/javascripts/cable.js +13 -0
- data/spec/dummy/app/assets/stylesheets/application.css +15 -0
- data/spec/dummy/app/channels/application_cable/channel.rb +4 -0
- data/spec/dummy/app/channels/application_cable/connection.rb +4 -0
- data/spec/dummy/app/controllers/application_controller.rb +2 -0
- data/spec/dummy/app/helpers/application_helper.rb +2 -0
- data/spec/dummy/app/jobs/application_job.rb +2 -0
- data/spec/dummy/app/mailers/application_mailer.rb +4 -0
- data/spec/dummy/app/models/application_record.rb +3 -0
- data/spec/dummy/app/views/layouts/application.html.erb +15 -0
- data/spec/dummy/app/views/layouts/mailer.html.erb +13 -0
- data/spec/dummy/app/views/layouts/mailer.text.erb +1 -0
- data/spec/dummy/bin/bundle +3 -0
- data/spec/dummy/bin/rails +4 -0
- data/spec/dummy/bin/rake +4 -0
- data/spec/dummy/bin/setup +33 -0
- data/spec/dummy/bin/update +28 -0
- data/spec/dummy/config.ru +5 -0
- data/spec/dummy/config/application.rb +54 -0
- data/spec/dummy/config/boot.rb +6 -0
- data/spec/dummy/config/cable.yml +10 -0
- data/spec/dummy/config/credentials.yml.enc +1 -0
- data/spec/dummy/config/database.yml +21 -0
- data/spec/dummy/config/environment.rb +5 -0
- data/spec/dummy/config/environments/development.rb +61 -0
- data/spec/dummy/config/environments/production.rb +94 -0
- data/spec/dummy/config/environments/test.rb +33 -0
- data/spec/dummy/config/initializers/application_controller_renderer.rb +8 -0
- data/spec/dummy/config/initializers/assets.rb +12 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy/config/initializers/content_security_policy.rb +25 -0
- data/spec/dummy/config/initializers/cookies_serializer.rb +5 -0
- data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/spec/dummy/config/initializers/inflections.rb +16 -0
- data/spec/dummy/config/initializers/mime_types.rb +4 -0
- data/spec/dummy/config/initializers/spree.rb +52 -0
- data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/spec/dummy/config/locales/en.yml +33 -0
- data/spec/dummy/config/master.key +1 -0
- data/spec/dummy/config/routes.rb +9 -0
- data/spec/dummy/config/storage.yml +34 -0
- data/spec/dummy/db/migrate/20190822070920_create_active_storage_tables.active_storage.rb +27 -0
- data/spec/dummy/db/migrate/20190822070921_solidus_one_four.spree.rb +1103 -0
- data/spec/dummy/db/migrate/20190822070922_create_spree_wallet_payment_sources.spree.rb +28 -0
- data/spec/dummy/db/migrate/20190822070923_migrate_credit_cards_to_wallet_payment_sources.spree.rb +30 -0
- data/spec/dummy/db/migrate/20190822070924_remove_is_default_from_prices.spree.rb +8 -0
- data/spec/dummy/db/migrate/20190822070925_remove_currency_from_line_items.spree.rb +8 -0
- data/spec/dummy/db/migrate/20190822070926_add_available_to_columns_and_remove_display_on_from_payment_methods.spree.rb +31 -0
- data/spec/dummy/db/migrate/20190822070927_create_spree_promotion_code_batch.spree.rb +39 -0
- data/spec/dummy/db/migrate/20190822070928_add_available_to_users_and_remove_display_on_from_shipping_methods.spree.rb +23 -0
- data/spec/dummy/db/migrate/20190822070929_add_index_to_spree_payments_number.spree.rb +8 -0
- data/spec/dummy/db/migrate/20190822070930_remove_spree_store_credits_column.spree.rb +8 -0
- data/spec/dummy/db/migrate/20190822070931_add_lft_and_rgt_indexes_to_taxons.spree.rb +9 -0
- data/spec/dummy/db/migrate/20190822070932_remove_order_id_from_inventory_units.spree.rb +31 -0
- data/spec/dummy/db/migrate/20190822070933_transform_tax_rate_category_relation.spree.rb +51 -0
- data/spec/dummy/db/migrate/20190822070934_add_roles_unique_constraints.spree.rb +9 -0
- data/spec/dummy/db/migrate/20190822070935_add_time_range_to_tax_rate.spree.rb +9 -0
- data/spec/dummy/db/migrate/20190822070936_rename_bogus_gateways.spree.rb +19 -0
- data/spec/dummy/db/migrate/20190822070937_remove_default_tax_from_spree_zones.spree.rb +8 -0
- data/spec/dummy/db/migrate/20190822070938_create_promotion_rule_stores.spree.rb +13 -0
- data/spec/dummy/db/migrate/20190822070939_create_store_shipping_methods.spree.rb +13 -0
- data/spec/dummy/db/migrate/20190822070940_add_available_locales_to_stores.spree.rb +10 -0
- data/spec/dummy/db/migrate/20190822070941_add_amount_remaining_to_store_credit_events.spree.rb +62 -0
- data/spec/dummy/db/migrate/20190822070942_add_join_characters_to_promotion_code_batch.spree.rb +12 -0
- data/spec/dummy/db/migrate/20190822070943_create_spree_store_credit_reasons_table.spree.rb +56 -0
- data/spec/dummy/db/migrate/20190822070944_remove_code_from_spree_promotions.spree.rb +43 -0
- data/spec/dummy/db/migrate/20190822070945_drop_spree_store_credit_update_reasons.spree.rb +20 -0
- data/spec/dummy/db/migrate/20190822070946_add_api_key_to_spree_users.spree_api.rb +10 -0
- data/spec/dummy/db/migrate/20190822070947_resize_api_key_field.spree_api.rb +10 -0
- data/spec/dummy/db/migrate/20190822070948_rename_api_key_to_spree_api_key.spree_api.rb +10 -0
- data/spec/dummy/db/migrate/20190822070949_add_index_to_user_spree_api_key.spree_api.rb +10 -0
- data/spec/dummy/db/migrate/20190822070950_create_users.solidus_auth.rb +30 -0
- data/spec/dummy/db/migrate/20190822070951_rename_columns_for_devise.solidus_auth.rb +38 -0
- data/spec/dummy/db/migrate/20190822070952_convert_user_remember_field.solidus_auth.rb +12 -0
- data/spec/dummy/db/migrate/20190822070953_add_reset_password_sent_at_to_spree_users.solidus_auth.rb +9 -0
- data/spec/dummy/db/migrate/20190822070954_make_users_email_index_unique.solidus_auth.rb +10 -0
- data/spec/dummy/db/migrate/20190822070955_add_deleted_at_to_users.solidus_auth.rb +7 -0
- data/spec/dummy/db/migrate/20190822070956_add_confirmable_to_users.solidus_auth.rb +8 -0
- data/spec/dummy/db/schema.rb +1194 -0
- data/spec/dummy/db/seeds.rb +10 -0
- data/spec/dummy/log/test.log +1058 -0
- data/spec/dummy/public/404.html +67 -0
- data/spec/dummy/public/422.html +67 -0
- data/spec/dummy/public/500.html +66 -0
- data/spec/dummy/public/apple-touch-icon-precomposed.png +0 -0
- data/spec/dummy/public/apple-touch-icon.png +0 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/dummy/tmp/development_secret.txt +1 -0
- data/spec/dummy/vendor/assets/javascripts/spree/backend/all.js +11 -0
- data/spec/dummy/vendor/assets/javascripts/spree/frontend/all.js +11 -0
- data/spec/dummy/vendor/assets/stylesheets/spree/backend/all.css +10 -0
- data/spec/dummy/vendor/assets/stylesheets/spree/frontend/all.css +10 -0
- data/spec/models/spree/payment_method/bank_transfer_spec.rb +146 -0
- data/spec/spec_helper.rb +89 -0
- metadata +429 -0
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<title>The page you were looking for doesn't exist (404)</title>
|
|
5
|
+
<meta name="viewport" content="width=device-width,initial-scale=1">
|
|
6
|
+
<style>
|
|
7
|
+
.rails-default-error-page {
|
|
8
|
+
background-color: #EFEFEF;
|
|
9
|
+
color: #2E2F30;
|
|
10
|
+
text-align: center;
|
|
11
|
+
font-family: arial, sans-serif;
|
|
12
|
+
margin: 0;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.rails-default-error-page div.dialog {
|
|
16
|
+
width: 95%;
|
|
17
|
+
max-width: 33em;
|
|
18
|
+
margin: 4em auto 0;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.rails-default-error-page div.dialog > div {
|
|
22
|
+
border: 1px solid #CCC;
|
|
23
|
+
border-right-color: #999;
|
|
24
|
+
border-left-color: #999;
|
|
25
|
+
border-bottom-color: #BBB;
|
|
26
|
+
border-top: #B00100 solid 4px;
|
|
27
|
+
border-top-left-radius: 9px;
|
|
28
|
+
border-top-right-radius: 9px;
|
|
29
|
+
background-color: white;
|
|
30
|
+
padding: 7px 12% 0;
|
|
31
|
+
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.rails-default-error-page h1 {
|
|
35
|
+
font-size: 100%;
|
|
36
|
+
color: #730E15;
|
|
37
|
+
line-height: 1.5em;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.rails-default-error-page div.dialog > p {
|
|
41
|
+
margin: 0 0 1em;
|
|
42
|
+
padding: 1em;
|
|
43
|
+
background-color: #F7F7F7;
|
|
44
|
+
border: 1px solid #CCC;
|
|
45
|
+
border-right-color: #999;
|
|
46
|
+
border-left-color: #999;
|
|
47
|
+
border-bottom-color: #999;
|
|
48
|
+
border-bottom-left-radius: 4px;
|
|
49
|
+
border-bottom-right-radius: 4px;
|
|
50
|
+
border-top-color: #DADADA;
|
|
51
|
+
color: #666;
|
|
52
|
+
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
|
53
|
+
}
|
|
54
|
+
</style>
|
|
55
|
+
</head>
|
|
56
|
+
|
|
57
|
+
<body class="rails-default-error-page">
|
|
58
|
+
<!-- This file lives in public/404.html -->
|
|
59
|
+
<div class="dialog">
|
|
60
|
+
<div>
|
|
61
|
+
<h1>The page you were looking for doesn't exist.</h1>
|
|
62
|
+
<p>You may have mistyped the address or the page may have moved.</p>
|
|
63
|
+
</div>
|
|
64
|
+
<p>If you are the application owner check the logs for more information.</p>
|
|
65
|
+
</div>
|
|
66
|
+
</body>
|
|
67
|
+
</html>
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<title>The change you wanted was rejected (422)</title>
|
|
5
|
+
<meta name="viewport" content="width=device-width,initial-scale=1">
|
|
6
|
+
<style>
|
|
7
|
+
.rails-default-error-page {
|
|
8
|
+
background-color: #EFEFEF;
|
|
9
|
+
color: #2E2F30;
|
|
10
|
+
text-align: center;
|
|
11
|
+
font-family: arial, sans-serif;
|
|
12
|
+
margin: 0;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.rails-default-error-page div.dialog {
|
|
16
|
+
width: 95%;
|
|
17
|
+
max-width: 33em;
|
|
18
|
+
margin: 4em auto 0;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.rails-default-error-page div.dialog > div {
|
|
22
|
+
border: 1px solid #CCC;
|
|
23
|
+
border-right-color: #999;
|
|
24
|
+
border-left-color: #999;
|
|
25
|
+
border-bottom-color: #BBB;
|
|
26
|
+
border-top: #B00100 solid 4px;
|
|
27
|
+
border-top-left-radius: 9px;
|
|
28
|
+
border-top-right-radius: 9px;
|
|
29
|
+
background-color: white;
|
|
30
|
+
padding: 7px 12% 0;
|
|
31
|
+
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.rails-default-error-page h1 {
|
|
35
|
+
font-size: 100%;
|
|
36
|
+
color: #730E15;
|
|
37
|
+
line-height: 1.5em;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.rails-default-error-page div.dialog > p {
|
|
41
|
+
margin: 0 0 1em;
|
|
42
|
+
padding: 1em;
|
|
43
|
+
background-color: #F7F7F7;
|
|
44
|
+
border: 1px solid #CCC;
|
|
45
|
+
border-right-color: #999;
|
|
46
|
+
border-left-color: #999;
|
|
47
|
+
border-bottom-color: #999;
|
|
48
|
+
border-bottom-left-radius: 4px;
|
|
49
|
+
border-bottom-right-radius: 4px;
|
|
50
|
+
border-top-color: #DADADA;
|
|
51
|
+
color: #666;
|
|
52
|
+
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
|
53
|
+
}
|
|
54
|
+
</style>
|
|
55
|
+
</head>
|
|
56
|
+
|
|
57
|
+
<body class="rails-default-error-page">
|
|
58
|
+
<!-- This file lives in public/422.html -->
|
|
59
|
+
<div class="dialog">
|
|
60
|
+
<div>
|
|
61
|
+
<h1>The change you wanted was rejected.</h1>
|
|
62
|
+
<p>Maybe you tried to change something you didn't have access to.</p>
|
|
63
|
+
</div>
|
|
64
|
+
<p>If you are the application owner check the logs for more information.</p>
|
|
65
|
+
</div>
|
|
66
|
+
</body>
|
|
67
|
+
</html>
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html>
|
|
3
|
+
<head>
|
|
4
|
+
<title>We're sorry, but something went wrong (500)</title>
|
|
5
|
+
<meta name="viewport" content="width=device-width,initial-scale=1">
|
|
6
|
+
<style>
|
|
7
|
+
.rails-default-error-page {
|
|
8
|
+
background-color: #EFEFEF;
|
|
9
|
+
color: #2E2F30;
|
|
10
|
+
text-align: center;
|
|
11
|
+
font-family: arial, sans-serif;
|
|
12
|
+
margin: 0;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
.rails-default-error-page div.dialog {
|
|
16
|
+
width: 95%;
|
|
17
|
+
max-width: 33em;
|
|
18
|
+
margin: 4em auto 0;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.rails-default-error-page div.dialog > div {
|
|
22
|
+
border: 1px solid #CCC;
|
|
23
|
+
border-right-color: #999;
|
|
24
|
+
border-left-color: #999;
|
|
25
|
+
border-bottom-color: #BBB;
|
|
26
|
+
border-top: #B00100 solid 4px;
|
|
27
|
+
border-top-left-radius: 9px;
|
|
28
|
+
border-top-right-radius: 9px;
|
|
29
|
+
background-color: white;
|
|
30
|
+
padding: 7px 12% 0;
|
|
31
|
+
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
.rails-default-error-page h1 {
|
|
35
|
+
font-size: 100%;
|
|
36
|
+
color: #730E15;
|
|
37
|
+
line-height: 1.5em;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.rails-default-error-page div.dialog > p {
|
|
41
|
+
margin: 0 0 1em;
|
|
42
|
+
padding: 1em;
|
|
43
|
+
background-color: #F7F7F7;
|
|
44
|
+
border: 1px solid #CCC;
|
|
45
|
+
border-right-color: #999;
|
|
46
|
+
border-left-color: #999;
|
|
47
|
+
border-bottom-color: #999;
|
|
48
|
+
border-bottom-left-radius: 4px;
|
|
49
|
+
border-bottom-right-radius: 4px;
|
|
50
|
+
border-top-color: #DADADA;
|
|
51
|
+
color: #666;
|
|
52
|
+
box-shadow: 0 3px 8px rgba(50, 50, 50, 0.17);
|
|
53
|
+
}
|
|
54
|
+
</style>
|
|
55
|
+
</head>
|
|
56
|
+
|
|
57
|
+
<body class="rails-default-error-page">
|
|
58
|
+
<!-- This file lives in public/500.html -->
|
|
59
|
+
<div class="dialog">
|
|
60
|
+
<div>
|
|
61
|
+
<h1>We're sorry, but something went wrong.</h1>
|
|
62
|
+
</div>
|
|
63
|
+
<p>If you are the application owner check the logs for more information.</p>
|
|
64
|
+
</div>
|
|
65
|
+
</body>
|
|
66
|
+
</html>
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
38d9e78345e370e28ac8e86a264c3915bb4f7d72e5637e3b2e725d963ac9f49f27b3409304f67d2226a47516df544e84c8c2724c0105e72749cddc81b5fc0f0c
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// This is a manifest file that'll be compiled into including all the files listed below.
|
|
2
|
+
// Add new JavaScript/Coffee code in separate files in this directory and they'll automatically
|
|
3
|
+
// be included in the compiled file accessible from http://example.com/assets/application.js
|
|
4
|
+
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
|
5
|
+
// the compiled file.
|
|
6
|
+
//
|
|
7
|
+
//= require jquery
|
|
8
|
+
//= require rails-ujs
|
|
9
|
+
//= require spree/backend
|
|
10
|
+
//= require_tree .
|
|
11
|
+
//= require spree/backend/solidus_bank_transfer
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// This is a manifest file that'll be compiled into including all the files listed below.
|
|
2
|
+
// Add new JavaScript/Coffee code in separate files in this directory and they'll automatically
|
|
3
|
+
// be included in the compiled file accessible from http://example.com/assets/application.js
|
|
4
|
+
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
|
5
|
+
// the compiled file.
|
|
6
|
+
//
|
|
7
|
+
//= require jquery
|
|
8
|
+
//= require rails-ujs
|
|
9
|
+
//= require spree/frontend
|
|
10
|
+
//= require_tree .
|
|
11
|
+
//= require spree/frontend/solidus_bank_transfer
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* This is a manifest file that'll automatically include all the stylesheets available in this directory
|
|
3
|
+
* and any sub-directories. You're free to add application-wide styles to this file and they'll appear at
|
|
4
|
+
* the top of the compiled file, but it's generally better to create a new file per style scope.
|
|
5
|
+
*
|
|
6
|
+
*= require spree/backend
|
|
7
|
+
*= require_self
|
|
8
|
+
*= require_tree .
|
|
9
|
+
*= require spree/backend/solidus_bank_transfer
|
|
10
|
+
*/
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* This is a manifest file that'll automatically include all the stylesheets available in this directory
|
|
3
|
+
* and any sub-directories. You're free to add application-wide styles to this file and they'll appear at
|
|
4
|
+
* the top of the compiled file, but it's generally better to create a new file per style scope.
|
|
5
|
+
*
|
|
6
|
+
*= require spree/frontend
|
|
7
|
+
*= require_self
|
|
8
|
+
*= require_tree .
|
|
9
|
+
*= require spree/frontend/solidus_bank_transfer
|
|
10
|
+
*/
|
|
@@ -0,0 +1,146 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'spec_helper'
|
|
4
|
+
|
|
5
|
+
RSpec.describe Spree::PaymentMethod::BankTransfer, type: :model do
|
|
6
|
+
let(:order) { Spree::Order.new }
|
|
7
|
+
let(:payment_method) { described_class.create!(name: 'Bank Transfer', active: true) }
|
|
8
|
+
let(:payment) do
|
|
9
|
+
Spree::Payment.new(amount: 0.0, order: order, payment_method: payment_method)
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
before do
|
|
13
|
+
payment_method.save!
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
describe 'preferences' do
|
|
17
|
+
before do
|
|
18
|
+
payment_method.update_attributes!(
|
|
19
|
+
preferred_bank_name: 'Uncle Scrooge Bank & Partners',
|
|
20
|
+
preferred_iban: 'IT00 S000 0000 0000 0000 0123 456',
|
|
21
|
+
preferred_holder: 'Donald Duck'
|
|
22
|
+
)
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
it 'saves the preferences' do
|
|
26
|
+
aggregate_failures do
|
|
27
|
+
expect(payment_method.preferred_bank_name).to eq('Uncle Scrooge Bank & Partners')
|
|
28
|
+
expect(payment_method.preferred_iban).to eq('IT00 S000 0000 0000 0000 0123 456')
|
|
29
|
+
expect(payment_method.preferred_holder).to eq('Donald Duck')
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
describe '#actions' do
|
|
35
|
+
it 'returns actions' do
|
|
36
|
+
expect(payment_method.actions).to eq(%w[capture void credit])
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
describe '#can_capture?' do
|
|
41
|
+
context 'when payment state is checkout' do
|
|
42
|
+
before do
|
|
43
|
+
payment.update_attributes!(state: 'checkout')
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
it 'returns true' do
|
|
47
|
+
expect(payment_method.can_capture?(payment)).to be true
|
|
48
|
+
end
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
context 'when payment state is pending' do
|
|
52
|
+
before do
|
|
53
|
+
payment.update_attributes!(state: 'pending')
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
it 'returns true' do
|
|
57
|
+
expect(payment_method.can_capture?(payment)).to be true
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
context 'when payment state is not pending or checkout' do
|
|
62
|
+
before do
|
|
63
|
+
payment.update_attributes!(state: 'void')
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
it 'returns false' do
|
|
67
|
+
expect(payment_method.can_capture?(payment)).to be false
|
|
68
|
+
end
|
|
69
|
+
end
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
describe '#can_void?' do
|
|
73
|
+
context 'when payment state is not void' do
|
|
74
|
+
before do
|
|
75
|
+
payment.update_attributes!(state: 'pending')
|
|
76
|
+
end
|
|
77
|
+
|
|
78
|
+
it 'returns true' do
|
|
79
|
+
expect(payment_method.can_void?(payment)).to be true
|
|
80
|
+
end
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
context 'when payment state is void' do
|
|
84
|
+
before do
|
|
85
|
+
payment.update_attributes!(state: 'void')
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
it 'returns false' do
|
|
89
|
+
expect(payment_method.can_void?(payment)).to be false
|
|
90
|
+
end
|
|
91
|
+
end
|
|
92
|
+
end
|
|
93
|
+
|
|
94
|
+
describe '#capture' do
|
|
95
|
+
it 'creates a new active merchant billing response' do
|
|
96
|
+
allow(ActiveMerchant::Billing::Response).to receive(:new)
|
|
97
|
+
payment_method.capture
|
|
98
|
+
expect(ActiveMerchant::Billing::Response).to have_received(:new).with(true, '', {}, {})
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
it 'returns active merchant billing response' do
|
|
102
|
+
expect(payment_method.capture).to be_a(ActiveMerchant::Billing::Response)
|
|
103
|
+
end
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
describe '#void' do
|
|
107
|
+
it 'creates a new active merchant billing response' do
|
|
108
|
+
allow(ActiveMerchant::Billing::Response).to receive(:new)
|
|
109
|
+
payment_method.void
|
|
110
|
+
expect(ActiveMerchant::Billing::Response).to have_received(:new).with(true, '', {}, {})
|
|
111
|
+
end
|
|
112
|
+
|
|
113
|
+
it 'returns active merchant billing response' do
|
|
114
|
+
expect(payment_method.void).to be_a(ActiveMerchant::Billing::Response)
|
|
115
|
+
end
|
|
116
|
+
end
|
|
117
|
+
|
|
118
|
+
describe '#try_void' do
|
|
119
|
+
it 'creates a new active merchant billing response' do
|
|
120
|
+
allow(ActiveMerchant::Billing::Response).to receive(:new)
|
|
121
|
+
payment_method.try_void
|
|
122
|
+
expect(ActiveMerchant::Billing::Response).to have_received(:new).with(true, '', {}, {})
|
|
123
|
+
end
|
|
124
|
+
|
|
125
|
+
it 'returns active merchant billing response' do
|
|
126
|
+
expect(payment_method.try_void).to be_a(ActiveMerchant::Billing::Response)
|
|
127
|
+
end
|
|
128
|
+
end
|
|
129
|
+
|
|
130
|
+
describe '#credit' do
|
|
131
|
+
it 'creates a new active merchant billing response' do
|
|
132
|
+
allow(ActiveMerchant::Billing::Response).to receive(:new)
|
|
133
|
+
payment_method.credit
|
|
134
|
+
expect(ActiveMerchant::Billing::Response).to have_received(:new).with(true, '', {}, {})
|
|
135
|
+
end
|
|
136
|
+
it 'returns active merchant billing response' do
|
|
137
|
+
expect(payment_method.credit).to be_a(ActiveMerchant::Billing::Response)
|
|
138
|
+
end
|
|
139
|
+
end
|
|
140
|
+
|
|
141
|
+
describe '#source_required?' do
|
|
142
|
+
it 'returns false' do
|
|
143
|
+
expect(payment_method.source_required?).to be false
|
|
144
|
+
end
|
|
145
|
+
end
|
|
146
|
+
end
|
data/spec/spec_helper.rb
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
# Run Coverage report
|
|
4
|
+
require 'simplecov'
|
|
5
|
+
SimpleCov.start do
|
|
6
|
+
add_filter 'spec/dummy'
|
|
7
|
+
add_group 'Controllers', 'app/controllers'
|
|
8
|
+
add_group 'Helpers', 'app/helpers'
|
|
9
|
+
add_group 'Mailers', 'app/mailers'
|
|
10
|
+
add_group 'Models', 'app/models'
|
|
11
|
+
add_group 'Views', 'app/views'
|
|
12
|
+
add_group 'Libraries', 'lib'
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
# Configure Rails Environment
|
|
16
|
+
ENV['RAILS_ENV'] = 'test'
|
|
17
|
+
|
|
18
|
+
require File.expand_path('dummy/config/environment.rb', __dir__)
|
|
19
|
+
|
|
20
|
+
require 'rspec/rails'
|
|
21
|
+
require 'database_cleaner'
|
|
22
|
+
require 'ffaker'
|
|
23
|
+
|
|
24
|
+
# Requires supporting ruby files with custom matchers and macros, etc,
|
|
25
|
+
# in spec/support/ and its subdirectories.
|
|
26
|
+
Dir[File.join(File.dirname(__FILE__), 'support/**/*.rb')].each { |f| require f }
|
|
27
|
+
|
|
28
|
+
# Requires factories and other useful helpers defined in spree_core.
|
|
29
|
+
require 'spree/testing_support/authorization_helpers'
|
|
30
|
+
require 'spree/testing_support/capybara_ext'
|
|
31
|
+
require 'spree/testing_support/controller_requests'
|
|
32
|
+
require 'spree/testing_support/factories'
|
|
33
|
+
require 'spree/testing_support/url_helpers'
|
|
34
|
+
|
|
35
|
+
# Requires factories defined in lib/solidus_bank_transfer/factories.rb
|
|
36
|
+
require 'solidus_bank_transfer/factories'
|
|
37
|
+
|
|
38
|
+
RSpec.configure do |config|
|
|
39
|
+
config.include FactoryBot::Syntax::Methods
|
|
40
|
+
|
|
41
|
+
# Infer an example group's spec type from the file location.
|
|
42
|
+
config.infer_spec_type_from_file_location!
|
|
43
|
+
|
|
44
|
+
# == URL Helpers
|
|
45
|
+
#
|
|
46
|
+
# Allows access to Spree's routes in specs:
|
|
47
|
+
#
|
|
48
|
+
# visit spree.admin_path
|
|
49
|
+
# current_path.should eql(spree.products_path)
|
|
50
|
+
config.include Spree::TestingSupport::UrlHelpers
|
|
51
|
+
|
|
52
|
+
# == Mock Framework
|
|
53
|
+
#
|
|
54
|
+
# If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
|
|
55
|
+
#
|
|
56
|
+
# config.mock_with :mocha
|
|
57
|
+
# config.mock_with :flexmock
|
|
58
|
+
# config.mock_with :rr
|
|
59
|
+
config.mock_with :rspec
|
|
60
|
+
config.color = true
|
|
61
|
+
|
|
62
|
+
# Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
|
|
63
|
+
config.fixture_path = "#{::Rails.root}/spec/fixtures"
|
|
64
|
+
|
|
65
|
+
# Capybara javascript drivers require transactional fixtures set to false, and we use DatabaseCleaner
|
|
66
|
+
# to cleanup after each test instead. Without transactional fixtures set to false the records created
|
|
67
|
+
# to setup a test will be unavailable to the browser, which runs under a separate server instance.
|
|
68
|
+
config.use_transactional_fixtures = false
|
|
69
|
+
|
|
70
|
+
# Ensure Suite is set to use transactions for speed.
|
|
71
|
+
config.before :suite do
|
|
72
|
+
DatabaseCleaner.strategy = :transaction
|
|
73
|
+
DatabaseCleaner.clean_with :truncation
|
|
74
|
+
end
|
|
75
|
+
|
|
76
|
+
# Before each spec check if it is a Javascript test and switch between using database transactions or not where necessary.
|
|
77
|
+
config.before do
|
|
78
|
+
DatabaseCleaner.strategy = RSpec.current_example.metadata[:js] ? :truncation : :transaction
|
|
79
|
+
DatabaseCleaner.start
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
# After each spec clean the database.
|
|
83
|
+
config.after do
|
|
84
|
+
DatabaseCleaner.clean
|
|
85
|
+
end
|
|
86
|
+
|
|
87
|
+
config.fail_fast = ENV['FAIL_FAST'] || false
|
|
88
|
+
config.order = 'random'
|
|
89
|
+
end
|