workarea-gift_cards 3.4.6 → 3.4.11
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ci.yml +55 -0
- data/.gitignore +1 -0
- data/.rubocop.yml +197 -0
- data/CHANGELOG.md +71 -0
- data/Gemfile +4 -2
- data/Rakefile +4 -5
- data/app/models/workarea/payment/gift_card.rb +3 -3
- data/app/views/workarea/storefront/products/templates/_gift_card.html.haml +1 -0
- data/lib/workarea/gift_cards/version.rb +1 -1
- data/test/dummy/config/initializers/session_store.rb +1 -1
- data/test/integration/workarea/storefront/gift_card_integration_test.rb +7 -3
- data/test/models/workarea/payment/gift_card_test.rb +18 -0
- data/workarea-gift_cards.gemspec +1 -1
- metadata +11 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8fa8b21256ede5c3dcf4015777bf183d35652185cca9580d6e505bc38d95523a
|
4
|
+
data.tar.gz: 3aecca4a5c02a9d74c3dfd5be8de7e4cd74fa0f38f69258d2ba5c8f6402841cc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b4e7276cabf21febb88b8412e17b323af86efc97c86c8fd4c50f95544edcf329f11c53b21801078d182d7725170adc6853437f2afea56d795ea2d2e4f2caa7a0
|
7
|
+
data.tar.gz: 369dec138960d08588977551ac20719c2872182ffddfca3948daed033b430fea58fdc0f16fa66932da8e186ced735913f0e59bc34e81ea4499a6ec44384c222e
|
@@ -0,0 +1,55 @@
|
|
1
|
+
name: CI
|
2
|
+
on: [push]
|
3
|
+
env:
|
4
|
+
BUNDLE_GEMS__WEBLINC__COM: ${{ secrets.BUNDLE_GEMS__WEBLINC__COM }}
|
5
|
+
jobs:
|
6
|
+
static_analysis:
|
7
|
+
runs-on: ubuntu-latest
|
8
|
+
steps:
|
9
|
+
- uses: actions/checkout@v1
|
10
|
+
- uses: workarea-commerce/ci/bundler-audit@ruby-2.4
|
11
|
+
- uses: workarea-commerce/ci/rubocop@ruby-2.4
|
12
|
+
|
13
|
+
admin_tests:
|
14
|
+
runs-on: ubuntu-latest
|
15
|
+
steps:
|
16
|
+
- uses: actions/checkout@v1
|
17
|
+
- uses: actions/setup-ruby@v1
|
18
|
+
with:
|
19
|
+
ruby-version: 2.4.x
|
20
|
+
- uses: workarea-commerce/ci/test@v1
|
21
|
+
with:
|
22
|
+
command: bin/rails app:workarea:test:admin
|
23
|
+
|
24
|
+
core_tests:
|
25
|
+
runs-on: ubuntu-latest
|
26
|
+
steps:
|
27
|
+
- uses: actions/checkout@v1
|
28
|
+
- uses: actions/setup-ruby@v1
|
29
|
+
with:
|
30
|
+
ruby-version: 2.4.x
|
31
|
+
- uses: workarea-commerce/ci/test@v1
|
32
|
+
with:
|
33
|
+
command: bin/rails app:workarea:test:core
|
34
|
+
|
35
|
+
storefront_tests:
|
36
|
+
runs-on: ubuntu-latest
|
37
|
+
steps:
|
38
|
+
- uses: actions/checkout@v1
|
39
|
+
- uses: actions/setup-ruby@v1
|
40
|
+
with:
|
41
|
+
ruby-version: 2.4.x
|
42
|
+
- uses: workarea-commerce/ci/test@v1
|
43
|
+
with:
|
44
|
+
command: bin/rails app:workarea:test:storefront
|
45
|
+
|
46
|
+
plugins_tests:
|
47
|
+
runs-on: ubuntu-latest
|
48
|
+
steps:
|
49
|
+
- uses: actions/checkout@v1
|
50
|
+
- uses: actions/setup-ruby@v1
|
51
|
+
with:
|
52
|
+
ruby-version: 2.4.x
|
53
|
+
- uses: workarea-commerce/ci/test@v1
|
54
|
+
with:
|
55
|
+
command: bin/rails app:workarea:test:plugins
|
data/.gitignore
CHANGED
data/.rubocop.yml
ADDED
@@ -0,0 +1,197 @@
|
|
1
|
+
AllCops:
|
2
|
+
TargetRubyVersion: 2.4
|
3
|
+
# RuboCop has a bunch of cops enabled by default. This setting tells RuboCop
|
4
|
+
# to ignore them, so only the ones explicitly set in this file are enabled.
|
5
|
+
DisabledByDefault: true
|
6
|
+
|
7
|
+
# Prefer &&/|| over and/or.
|
8
|
+
Style/AndOr:
|
9
|
+
Enabled: true
|
10
|
+
Exclude:
|
11
|
+
- 'testing/lib/workarea/performance_test.rb'
|
12
|
+
- 'admin/app/controllers/workarea/admin/help_authorization.rb'
|
13
|
+
- 'admin/app/controllers/workarea/admin/users_controller.rb'
|
14
|
+
- 'core/app/controllers/workarea/authorization.rb'
|
15
|
+
- 'core/app/models/workarea/analytics/time_series.rb'
|
16
|
+
- 'core/app/models/workarea/payment/operation.rb'
|
17
|
+
- 'core/lib/workarea/validators/ip_address_validator.rb'
|
18
|
+
- 'script/rename'
|
19
|
+
- 'storefront/app/controllers/workarea/storefront/checkout/place_order_controller.rb'
|
20
|
+
- 'storefront/app/controllers/workarea/storefront/current_checkout.rb'
|
21
|
+
- 'storefront/app/controllers/workarea/storefront/searches_controller.rb'
|
22
|
+
- 'storefront/app/controllers/workarea/storefront/users/orders_controller.rb'
|
23
|
+
- 'storefront/app/controllers/workarea/storefront/users/passwords_controller.rb'
|
24
|
+
|
25
|
+
# Align `when` with `case`.
|
26
|
+
Layout/CaseIndentation:
|
27
|
+
Enabled: true
|
28
|
+
Exclude:
|
29
|
+
- 'admin/app/helpers/workarea/admin/dashboard_helper.rb'
|
30
|
+
|
31
|
+
# Align comments with method definitions.
|
32
|
+
Layout/CommentIndentation:
|
33
|
+
Enabled: true
|
34
|
+
|
35
|
+
Layout/EmptyLineAfterMagicComment:
|
36
|
+
Enabled: true
|
37
|
+
|
38
|
+
# In a regular class definition, no empty lines around the body.
|
39
|
+
Layout/EmptyLinesAroundClassBody:
|
40
|
+
Enabled: true
|
41
|
+
Exclude:
|
42
|
+
- 'admin/app/controllers/workarea/admin/release_sessions_controller.rb'
|
43
|
+
- 'admin/app/view_models/workarea/admin/release_calendar_view_model.rb'
|
44
|
+
- 'admin/lib/workarea/mailer_previews/admin/comment_mailer_preview.rb'
|
45
|
+
- 'admin/test/integration/workarea/admin/content_blocks_integration_test.rb'
|
46
|
+
- 'admin/test/view_models/workarea/admin/content_view_model_test.rb'
|
47
|
+
- 'core/app/models/workarea/checkout/steps/addresses.rb'
|
48
|
+
- 'core/app/models/workarea/pricing/discount/buy_some_get_some/product_application.rb'
|
49
|
+
- 'core/app/queries/workarea/metadata/catalog_category.rb'
|
50
|
+
- 'core/app/queries/workarea/metadata/content_page.rb'
|
51
|
+
- 'core/app/queries/workarea/search/facet.rb'
|
52
|
+
- 'core/app/queries/workarea/search/range_filter.rb'
|
53
|
+
- 'core/config/initializers/13_rack_attack.rb'
|
54
|
+
- 'core/lib/generators/workarea/override/override_generator.rb'
|
55
|
+
- 'core/lib/workarea/elasticsearch/query_cache.rb'
|
56
|
+
- 'core/lib/workarea/monitoring/elasticsearch_check.rb'
|
57
|
+
- 'core/lib/workarea/monitoring/mongoid_check.rb'
|
58
|
+
- 'core/lib/workarea/monitoring/sidekiq_queue_size_check.rb'
|
59
|
+
- 'core/lib/workarea/validators/email_validator.rb'
|
60
|
+
- 'core/test/lib/workarea/mail_interceptor_test.rb'
|
61
|
+
- 'core/test/models/workarea/commentable_test.rb'
|
62
|
+
- 'core/test/models/workarea/search/settings_test.rb'
|
63
|
+
- 'core/test/models/workarea/shipping/rate_lookup_test.rb'
|
64
|
+
- 'core/test/queries/workarea/find_pipeline_asset_test.rb'
|
65
|
+
- 'core/test/queries/workarea/product_primary_image_url_test.rb'
|
66
|
+
- 'core/test/queries/workarea/search/filter_test.rb'
|
67
|
+
- 'core/test/workers/workarea/bulk_index_admin_test.rb'
|
68
|
+
- 'core/test/workers/workarea/bulk_index_products_test.rb'
|
69
|
+
- 'core/vendor/active_shipping/lib/active_shipping/carriers/australia_post.rb'
|
70
|
+
- 'core/vendor/active_shipping/lib/active_shipping/carriers/canada_post_pws.rb'
|
71
|
+
- 'core/vendor/active_shipping/lib/active_shipping/carriers/usps_returns.rb'
|
72
|
+
- 'core/vendor/active_shipping/lib/active_shipping/delivery_date_estimates_response.rb'
|
73
|
+
- 'core/vendor/active_shipping/lib/active_shipping/rate_response.rb'
|
74
|
+
- 'core/vendor/active_shipping/test/remote/australia_post_test.rb'
|
75
|
+
- 'core/vendor/active_shipping/test/remote/usps_returns_test.rb'
|
76
|
+
- 'core/vendor/active_shipping/test/unit/carriers/australia_post_test.rb'
|
77
|
+
- 'core/vendor/active_shipping/test/unit/carriers/canada_post_pws_test.rb'
|
78
|
+
- 'core/vendor/active_shipping/test/unit/carriers/usps_returns_test.rb'
|
79
|
+
- 'storefront/app/view_models/workarea/storefront/content_blocks/product_list_view_model.rb'
|
80
|
+
- 'storefront/app/view_models/workarea/storefront/product_view_model.rb'
|
81
|
+
- 'storefront/lib/workarea/mailer_previews/storefront/order_mailer_preview.rb'
|
82
|
+
- 'storefront/test/performance/workarea/storefront/categories_performance_test.rb'
|
83
|
+
- 'storefront/test/performance/workarea/storefront/search_performance_test.rb'
|
84
|
+
- 'storefront/test/view_models/workarea/storefront/user_activity_view_model_test.rb'
|
85
|
+
|
86
|
+
# In a regular method definition, no empty lines around the body.
|
87
|
+
Layout/EmptyLinesAroundMethodBody:
|
88
|
+
Enabled: true
|
89
|
+
|
90
|
+
# In a regular module definition, no empty lines around the body.
|
91
|
+
Layout/EmptyLinesAroundModuleBody:
|
92
|
+
Enabled: true
|
93
|
+
Exclude:
|
94
|
+
- 'core/lib/workarea/ext/mongoid/timestamps_timeless.rb'
|
95
|
+
- 'storefront/app/view_models/workarea/storefront/search_customization_content.rb'
|
96
|
+
- 'testing/lib/workarea/testing/warning_suppressor.rb'
|
97
|
+
|
98
|
+
# Use Ruby >= 1.9 syntax for hashes. Prefer { a: :b } over { :a => :b }.
|
99
|
+
Style/HashSyntax:
|
100
|
+
Enabled: true
|
101
|
+
|
102
|
+
Layout/SpaceAfterColon:
|
103
|
+
Enabled: true
|
104
|
+
Exclude:
|
105
|
+
- 'testing/lib/workarea/testing/factories/content.rb'
|
106
|
+
- 'testing/lib/workarea/testing/factories/pricing.rb'
|
107
|
+
|
108
|
+
Layout/SpaceAfterComma:
|
109
|
+
Enabled: true
|
110
|
+
Exclude:
|
111
|
+
- 'admin/app/controllers/workarea/admin/shipping_services_controller.rb'
|
112
|
+
- 'admin/test/helpers/workarea/admin/application_helper_test.rb'
|
113
|
+
- 'core/app/models/workarea/payment/credit_card.rb'
|
114
|
+
- 'core/app/models/workarea/pricing/request.rb'
|
115
|
+
- 'core/spec/lib/workarea/swappable_list_spec.rb'
|
116
|
+
- 'core/test/models/workarea/inventory_test.rb'
|
117
|
+
- 'core/test/queries/workarea/search/range_facet_test.rb'
|
118
|
+
- 'storefront/test/view_models/workarea/storefront/package_view_model_test.rb'
|
119
|
+
|
120
|
+
Layout/SpaceAroundEqualsInParameterDefault:
|
121
|
+
Enabled: true
|
122
|
+
Exclude:
|
123
|
+
- 'admin/app/helpers/workarea/admin/content_block_icon_helper.rb'
|
124
|
+
- 'core/app/helpers/workarea/content_assets_helper.rb'
|
125
|
+
- 'core/lib/workarea/elasticsearch/query_cache.rb'
|
126
|
+
- 'testing/lib/workarea/system_test.rb'
|
127
|
+
- 'testing/lib/workarea/testing/locale_routing_fixes.rb'
|
128
|
+
|
129
|
+
|
130
|
+
Layout/SpaceAroundKeyword:
|
131
|
+
Enabled: true
|
132
|
+
|
133
|
+
Layout/SpaceAroundOperators:
|
134
|
+
Enabled: true
|
135
|
+
Exclude:
|
136
|
+
- 'admin/app/controllers/workarea/admin/content_emails_controller.rb'
|
137
|
+
- 'admin/app/controllers/workarea/admin/users_controller.rb'
|
138
|
+
- 'core/app/helpers/workarea/content_assets_helper.rb'
|
139
|
+
- 'core/vendor/active_shipping/lib/active_shipping/carriers/canada_post_pws.rb'
|
140
|
+
- 'core/vendor/active_shipping/lib/active_shipping/carriers/fedex.rb'
|
141
|
+
- 'core/vendor/active_shipping/lib/active_shipping/carriers/stamps.rb'
|
142
|
+
|
143
|
+
Layout/SpaceBeforeFirstArg:
|
144
|
+
Enabled: true
|
145
|
+
|
146
|
+
# Defining a method with parameters needs parentheses.
|
147
|
+
Style/MethodDefParentheses:
|
148
|
+
Enabled: true
|
149
|
+
|
150
|
+
# Use `foo {}` not `foo{}`.
|
151
|
+
Layout/SpaceBeforeBlockBraces:
|
152
|
+
Enabled: true
|
153
|
+
Exclude:
|
154
|
+
- 'admin/app/view_models/workarea/admin/release_calendar_view_model.rb'
|
155
|
+
|
156
|
+
# Use `foo { bar }` not `foo {bar}`.
|
157
|
+
Layout/SpaceInsideBlockBraces:
|
158
|
+
Enabled: true
|
159
|
+
|
160
|
+
# Use `{ a: 1 }` not `{a:1}`.
|
161
|
+
Layout/SpaceInsideHashLiteralBraces:
|
162
|
+
Enabled: true
|
163
|
+
Exclude:
|
164
|
+
- 'admin/test/integration/workarea/admin/pricing_sku_prices_integration_test.rb'
|
165
|
+
- 'admin/test/integration/workarea/admin/shipping_service_integration_test.rb'
|
166
|
+
- 'admin/test/integration/workarea/admin/tax_categories_integration_test.rb'
|
167
|
+
- 'admin/test/view_models/workarea/admin/changeset_view_model_test.rb'
|
168
|
+
- 'core/app/models/workarea/release/changeset.rb'
|
169
|
+
- 'core/app/queries/workarea/search/product_rules.rb'
|
170
|
+
- 'core/app/queries/workarea/search/term_filter.rb'
|
171
|
+
- 'core/lib/workarea/configuration.rb'
|
172
|
+
- 'core/spec/models/workarea/order_spec.rb'
|
173
|
+
- 'core/test/models/workarea/application_document_test.rb'
|
174
|
+
- 'core/test/models/workarea/fulfillment_test.rb'
|
175
|
+
- 'core/test/queries/workarea/search/product_rules_test.rb'
|
176
|
+
- 'core/test/workers/workarea/generate_content_metadata_test.rb'
|
177
|
+
|
178
|
+
Layout/SpaceInsideParens:
|
179
|
+
Enabled: true
|
180
|
+
Exclude:
|
181
|
+
- 'core/app/models/workarea/inventory/collection.rb'
|
182
|
+
- 'core/app/models/workarea/pricing/calculators/item_calculator.rb'
|
183
|
+
- 'core/spec/models/workarea/order/queries_spec.rb'
|
184
|
+
|
185
|
+
# Detect hard tabs, no hard tabs.
|
186
|
+
Layout/Tab:
|
187
|
+
Enabled: true
|
188
|
+
Exclude:
|
189
|
+
- 'core/vendor/active_shipping/lib/active_shipping/carriers/canada_post.rb'
|
190
|
+
|
191
|
+
# No trailing whitespace.
|
192
|
+
Layout/TrailingWhitespace:
|
193
|
+
Enabled: true
|
194
|
+
|
195
|
+
# Use my_method(my_arg) not my_method( my_arg ) or my_method my_arg.
|
196
|
+
Lint/RequireParentheses:
|
197
|
+
Enabled: true
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,74 @@
|
|
1
|
+
Workarea Gift Cards 3.4.11 (2020-12-02)
|
2
|
+
--------------------------------------------------------------------------------
|
3
|
+
|
4
|
+
* Allow v3.4 use with this gem
|
5
|
+
|
6
|
+
|
7
|
+
Ben Crouse
|
8
|
+
|
9
|
+
|
10
|
+
|
11
|
+
Workarea Gift Cards 3.4.10 (2020-02-04)
|
12
|
+
--------------------------------------------------------------------------------
|
13
|
+
|
14
|
+
* Fix the Gemfile
|
15
|
+
|
16
|
+
Tom Scott
|
17
|
+
|
18
|
+
* Remove ESLint from Gift Cards build
|
19
|
+
|
20
|
+
Tom Scott
|
21
|
+
|
22
|
+
* Fix rubocop config for 2.4
|
23
|
+
|
24
|
+
Tom Scott
|
25
|
+
|
26
|
+
* Use the same ruby version on static analysis as we use in tests
|
27
|
+
|
28
|
+
Tom Scott
|
29
|
+
|
30
|
+
* Use the same env var everywhere
|
31
|
+
|
32
|
+
Tom Scott
|
33
|
+
|
34
|
+
* Backport Missing `:via` Param
|
35
|
+
|
36
|
+
The `:via` param was not included on the gift card template, causing a
|
37
|
+
test in base to fail and subsequently block other plugin development
|
38
|
+
that depends on this gem. This change is from a later version of
|
39
|
+
Workarea, but was not backported to earlier versions. Additionally, this
|
40
|
+
commit adds the test workflow and ensures the correct version of
|
41
|
+
Workarea is being loaded to ensure accurate testing.
|
42
|
+
|
43
|
+
GIFTCARDS-7
|
44
|
+
Tom Scott
|
45
|
+
|
46
|
+
|
47
|
+
|
48
|
+
Workarea Gift Cards 3.4.9 (2020-01-21)
|
49
|
+
--------------------------------------------------------------------------------
|
50
|
+
|
51
|
+
* Fix Tests for 2020
|
52
|
+
|
53
|
+
Update all tests so that they no longer depend on the year 2020 as an
|
54
|
+
expiration year. Instead, use the method provided by Workarea.
|
55
|
+
|
56
|
+
GIFTCARDS-6
|
57
|
+
Tom Scott
|
58
|
+
|
59
|
+
|
60
|
+
|
61
|
+
Workarea Gift Cards 3.4.7 (2019-09-04)
|
62
|
+
--------------------------------------------------------------------------------
|
63
|
+
|
64
|
+
* Always Use Configured Currency For Default Values (#1)
|
65
|
+
|
66
|
+
When specifying a `default:` for a Mongoid `Money` field, use an Integer
|
67
|
+
type like `0` instead of converting it to a Money type, as this will get
|
68
|
+
evaluated at compile-time rather than at runtime. Doing so preserves
|
69
|
+
the currency configuration specified by the application at runtime.
|
70
|
+
|
71
|
+
|
1
72
|
Workarea Gift Cards 3.4.6 (2019-08-21)
|
2
73
|
--------------------------------------------------------------------------------
|
3
74
|
|
data/Gemfile
CHANGED
@@ -3,5 +3,7 @@ git_source(:github) { |repo| "git@github.com:#{repo}.git" }
|
|
3
3
|
|
4
4
|
gemspec
|
5
5
|
|
6
|
-
|
7
|
-
gem 'workarea',
|
6
|
+
source 'https://gems.weblinc.com' do
|
7
|
+
gem 'workarea', '~> 3.4.0'
|
8
|
+
gem 'workarea-api', '~> 4.3.0'
|
9
|
+
end
|
data/Rakefile
CHANGED
@@ -38,13 +38,12 @@ desc "Release version #{Workarea::GiftCards::VERSION} of the gem"
|
|
38
38
|
task :release do
|
39
39
|
host = "https://#{ENV['BUNDLE_GEMS__WEBLINC__COM']}@gems.weblinc.com"
|
40
40
|
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
#system 'git push origin HEAD'
|
41
|
+
Rake::Task['workarea:changelog'].execute
|
42
|
+
system 'git add CHANGELOG.md'
|
43
|
+
system 'git commit -m "Update CHANGELOG"'
|
45
44
|
|
46
45
|
system "git tag -a v#{Workarea::GiftCards::VERSION} -m 'Tagging #{Workarea::GiftCards::VERSION}'"
|
47
|
-
system 'git push --tags'
|
46
|
+
system 'git push origin HEAD --follow-tags'
|
48
47
|
|
49
48
|
system 'gem build workarea-gift_cards.gemspec'
|
50
49
|
system "gem push workarea-gift_cards-#{Workarea::GiftCards::VERSION}.gem"
|
@@ -16,9 +16,9 @@ module Workarea
|
|
16
16
|
# by a customer purchasing it.
|
17
17
|
field :order_id, type: String
|
18
18
|
|
19
|
-
field :amount, type: Money, default: 0
|
20
|
-
field :used, type: Money, default: 0
|
21
|
-
field :balance, type: Money, default: 0
|
19
|
+
field :amount, type: Money, default: 0
|
20
|
+
field :used, type: Money, default: 0
|
21
|
+
field :balance, type: Money, default: 0
|
22
22
|
|
23
23
|
has_many :redemptions, class_name: 'Workarea::Payment::GiftCard::Redemption'
|
24
24
|
|
@@ -16,6 +16,7 @@
|
|
16
16
|
|
17
17
|
= form_tag cart_items_path, method: 'post', class: 'product-details__add-to-cart-form', data: { dialog_form: { dialogOptions: { closeAll: true, initModules: true } }, analytics: add_to_cart_analytics_data(product).to_json } do
|
18
18
|
= hidden_field_tag :product_id, product.id, id: dom_id(product, 'product_id')
|
19
|
+
= hidden_field_tag :via, params[:via], id: dom_id(product, 'via')
|
19
20
|
|
20
21
|
- if product.sku_options.one?
|
21
22
|
= hidden_field_tag :sku, product.sku_options.first.second
|
@@ -5,6 +5,10 @@ module Workarea
|
|
5
5
|
class GiftCardIntegrationTest < Workarea::IntegrationTest
|
6
6
|
setup :tax, :product, :shipping_service, :gift_card
|
7
7
|
|
8
|
+
def next_year
|
9
|
+
1.year.from_now.year
|
10
|
+
end
|
11
|
+
|
8
12
|
def tax
|
9
13
|
@tax ||= create_tax_category(
|
10
14
|
name: 'Sales Tax',
|
@@ -80,7 +84,7 @@ module Workarea
|
|
80
84
|
credit_card: {
|
81
85
|
number: '1',
|
82
86
|
month: 1,
|
83
|
-
year:
|
87
|
+
year: next_year,
|
84
88
|
cvv: '999'
|
85
89
|
}
|
86
90
|
}
|
@@ -121,7 +125,7 @@ module Workarea
|
|
121
125
|
assert_equal('Test Card', payment.credit_card.issuer)
|
122
126
|
assert_equal('XXXX-XXXX-XXXX-1', payment.credit_card.display_number)
|
123
127
|
assert_equal(1, payment.credit_card.month)
|
124
|
-
assert_equal(
|
128
|
+
assert_equal(next_year, payment.credit_card.year)
|
125
129
|
assert_equal(13.19.to_m, payment.credit_card.amount)
|
126
130
|
assert(payment.credit_card.token.present?)
|
127
131
|
assert(payment.credit_card.saved_card_id.blank?)
|
@@ -190,7 +194,7 @@ module Workarea
|
|
190
194
|
credit_card: {
|
191
195
|
number: '1',
|
192
196
|
month: 1,
|
193
|
-
year:
|
197
|
+
year: next_year,
|
194
198
|
cvv: '999'
|
195
199
|
}
|
196
200
|
}
|
@@ -3,6 +3,24 @@ require 'test_helper'
|
|
3
3
|
module Workarea
|
4
4
|
class Payment
|
5
5
|
class GiftCardTest < TestCase
|
6
|
+
def test_currency
|
7
|
+
existing_currency = Money.default_currency
|
8
|
+
usd = Money::Currency.new('USD')
|
9
|
+
aud = Money::Currency.new('AUD')
|
10
|
+
|
11
|
+
card = GiftCard.create!(amount: 10.to_m)
|
12
|
+
Money.default_currency = usd
|
13
|
+
|
14
|
+
assert_equal(usd, card.used.currency)
|
15
|
+
|
16
|
+
Money.default_currency = aud
|
17
|
+
card = GiftCard.create!(amount: 10.to_m)
|
18
|
+
|
19
|
+
assert_equal(aud, card.used.currency)
|
20
|
+
ensure
|
21
|
+
Money.default_currency = existing_currency
|
22
|
+
end
|
23
|
+
|
6
24
|
def test_not_expired
|
7
25
|
expired = Workarea::Payment::GiftCard.create!(amount: 10.to_m, expires_at: Time.now - 1.day)
|
8
26
|
not_expired = Workarea::Payment::GiftCard.create!(amount: 10.to_m, expires_at: Time.now + 1.day)
|
data/workarea-gift_cards.gemspec
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: workarea-gift_cards
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.4.
|
4
|
+
version: 3.4.11
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- bcrouse
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-12-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: workarea
|
@@ -20,6 +20,9 @@ dependencies:
|
|
20
20
|
- - ">="
|
21
21
|
- !ruby/object:Gem::Version
|
22
22
|
version: 3.3.x
|
23
|
+
- - "<"
|
24
|
+
- !ruby/object:Gem::Version
|
25
|
+
version: 3.5.x
|
23
26
|
type: :runtime
|
24
27
|
prerelease: false
|
25
28
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -30,6 +33,9 @@ dependencies:
|
|
30
33
|
- - ">="
|
31
34
|
- !ruby/object:Gem::Version
|
32
35
|
version: 3.3.x
|
36
|
+
- - "<"
|
37
|
+
- !ruby/object:Gem::Version
|
38
|
+
version: 3.5.x
|
33
39
|
description: Adds built-in gift cards to the Workarea commerce platform.
|
34
40
|
email:
|
35
41
|
- bcrouse@weblinc.com
|
@@ -43,7 +49,9 @@ files:
|
|
43
49
|
- ".github/ISSUE_TEMPLATE/bug_report.md"
|
44
50
|
- ".github/ISSUE_TEMPLATE/documentation-request.md"
|
45
51
|
- ".github/ISSUE_TEMPLATE/feature_request.md"
|
52
|
+
- ".github/workflows/ci.yml"
|
46
53
|
- ".gitignore"
|
54
|
+
- ".rubocop.yml"
|
47
55
|
- ".scss-lint.yml"
|
48
56
|
- ".yardopts"
|
49
57
|
- CHANGELOG.md
|
@@ -220,7 +228,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
220
228
|
- !ruby/object:Gem::Version
|
221
229
|
version: '0'
|
222
230
|
requirements: []
|
223
|
-
rubygems_version: 3.0.
|
231
|
+
rubygems_version: 3.0.3
|
224
232
|
signing_key:
|
225
233
|
specification_version: 4
|
226
234
|
summary: Gift Cards plugin for the Workarea commerce platform
|