workarea-afterpay 2.1.1 → 2.1.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7f170109c4e7aadf5517d681dae21220ff6cbe1e35126ab58aa54180cd02884d
4
- data.tar.gz: 900b3992335bbf4f70be4b1a521d6aa484b9a1a319fced02a44b257aa490f951
3
+ metadata.gz: 1d55ac37dc33ec6051c925f6964e5a65eacf7bed2aa21d73bbcc0923c88e668d
4
+ data.tar.gz: 0cdba1f66ba8968182b81bb0c0f084798cf96ccea1e54e6dcee4610297c2c003
5
5
  SHA512:
6
- metadata.gz: 92464c1f313772dfe084620492874c17fe712f957cdd0591da6a5fa3615e583e95a537f3fe10e75a600e03d2a5348818c88416408ee94c926198ecfbb729ee7f
7
- data.tar.gz: 45a8347a3823439093570d7c8f85388b0a89ee685f79131a4bf15e3df00eec4f6a7366ab033a9674c213f71388b037087e2afd244a9ab77210611bd59d9b07a3
6
+ metadata.gz: 8c76bd1947fba5535f98bd2d85d08b8d37f727e1caaeff6154f053b8854fbee2e2eae4a0898fbc106e9d9dc7c2908207f3abf9b700c0c8fafa39e1226034ce53
7
+ data.tar.gz: a946e31b8fe386d5b5725635600880c69d0cd4b4ce977b929bc4cca928ed185efc2706562f43e9c834a9d5150edfde5925a86bfcd5cca63edfe83e7af9c503dd
data/CHANGELOG.md CHANGED
@@ -1,3 +1,13 @@
1
+ Workarea Afterpay 2.1.2 (2020-05-06)
2
+ --------------------------------------------------------------------------------
3
+
4
+ * Fix error showing admin config panel
5
+
6
+
7
+ Ben Crouse
8
+
9
+
10
+
1
11
  Workarea Afterpay 2.1.1 (2020-05-04)
2
12
  --------------------------------------------------------------------------------
3
13
 
@@ -5,7 +5,7 @@ module Workarea
5
5
 
6
6
  def au_limits
7
7
  return unless Workarea::Afterpay.merchant_id(:au).present?
8
- limits = afterpay_configuration(:au).first
8
+ limits = afterpay_configuration(:au)
9
9
  {
10
10
  min: min_price(limits),
11
11
  max: max_price(limits)
@@ -14,7 +14,7 @@ module Workarea
14
14
 
15
15
  def us_limits
16
16
  return unless Workarea::Afterpay.merchant_id(:us).present?
17
- limits = afterpay_configuration(:us).first
17
+ limits = afterpay_configuration(:us)
18
18
  {
19
19
  min: min_price(limits),
20
20
  max: max_price(limits)
@@ -24,11 +24,12 @@ module Workarea
24
24
  private
25
25
 
26
26
  def min_price(limits)
27
- return 0.to_m unless limits["minimumAmount"].present?
27
+ return 0.to_m unless limits.present? && limits["minimumAmount"].present?
28
28
  limits["minimumAmount"]["amount"].to_m
29
29
  end
30
30
 
31
31
  def max_price(limits)
32
+ return unless limits.present?
32
33
  limits["maximumAmount"]["amount"].to_m
33
34
  end
34
35
  end
@@ -1,5 +1,5 @@
1
1
  module Workarea
2
2
  module Afterpay
3
- VERSION = '2.1.1'.freeze
3
+ VERSION = '2.1.2'.freeze
4
4
  end
5
5
  end
@@ -0,0 +1,19 @@
1
+ require 'test_helper'
2
+
3
+ module Workarea
4
+ module Admin
5
+ class AfterpayConfigurationViewModelTest < TestCase
6
+ def test_limits
7
+ Workarea::Afterpay
8
+ .stubs(:credentials)
9
+ .returns(us: { merchant_id: 'foo' }, au: { merchant_id: 'bar' })
10
+
11
+ model = Workarea::Afterpay::Configuration.current
12
+ view_model = AfterpayConfigurationViewModel.new(model)
13
+
14
+ assert_equal({ min: 0.to_m, max: nil }, view_model.au_limits)
15
+ assert_equal({ min: 0.to_m, max: nil }, view_model.us_limits)
16
+ end
17
+ end
18
+ end
19
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: workarea-afterpay
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.1
4
+ version: 2.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jeff Yucis
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-05-04 00:00:00.000000000 Z
11
+ date: 2020-05-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: workarea
@@ -161,6 +161,7 @@ files:
161
161
  - test/system/workarea/storefront/logged_in_checkout_system_test.decorator
162
162
  - test/teaspoon_env.rb
163
163
  - test/test_helper.rb
164
+ - test/view_models/workarea/admin/afterpay_configuration_view_model_test.rb
164
165
  - test/view_models/workarea/storefront/afterpay_view_model_test.rb
165
166
  - test/view_models/workarea/storefront/product_view_model_afterpay_test.rb
166
167
  - workarea-afterpay.gemspec