workarea-gift_cards 3.4.6 → 3.4.7

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 85bedd6f500731678e2c050c46e704f525aab7ef23b95a4add2a5ad7d3b3d93b
4
- data.tar.gz: a171040ed02ede5b78ee40e650fce8ef54d82770b4040da63f111cecaa8a9869
3
+ metadata.gz: 9d7de57c4a153c5b92900c297f42786294dd6f220a3076882b07438e5188cf8d
4
+ data.tar.gz: 81d907ede71b16a26ec40ddc7825669f53f8561a29e9d5c15441651e1f97df58
5
5
  SHA512:
6
- metadata.gz: '09d1311c1a3225e01179c34b2b8b11ccb53376d5adcb60b1de0434516c4f1afbf28f390d622b2ecc0b9421ef9fe571436667372910de15df0d070d83aa6ac29f'
7
- data.tar.gz: 290b5ed9ff6d394579b17104f1b8d3c8298ab0aa2632a932c76e7cf837ce120a8ed46cc0cc65a74fc6e49640aa37c635d13474f946bb2dac15fa6636680cf9b2
6
+ metadata.gz: 0f9b7167699bd327d84804eb7bddb785e503d58431ccfc72bc0a8957714907190d13ddfe6e1f85be11ff49967daa7c9f4cc82019d5f23e86c61e8c2fc54f8109
7
+ data.tar.gz: 3664b302fb5174171372e9143ccd25e1beffe5d05eb64e3c86de18997d4c03156a10e145622e0203f2f3c307679377916d57ea04a855c9369763ea36099b0bfa
data/CHANGELOG.md CHANGED
@@ -1,3 +1,14 @@
1
+ Workarea Gift Cards 3.4.7 (2019-09-04)
2
+ --------------------------------------------------------------------------------
3
+
4
+ * Always Use Configured Currency For Default Values (#1)
5
+
6
+ When specifying a `default:` for a Mongoid `Money` field, use an Integer
7
+ type like `0` instead of converting it to a Money type, as this will get
8
+ evaluated at compile-time rather than at runtime. Doing so preserves
9
+ the currency configuration specified by the application at runtime.
10
+
11
+
1
12
  Workarea Gift Cards 3.4.6 (2019-08-21)
2
13
  --------------------------------------------------------------------------------
3
14
 
@@ -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.to_m
20
- field :used, type: Money, default: 0.to_m
21
- field :balance, type: Money, default: 0.to_m
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
 
@@ -1,5 +1,5 @@
1
1
  module Workarea
2
2
  module GiftCards
3
- VERSION = '3.4.6'.freeze
3
+ VERSION = '3.4.7'.freeze
4
4
  end
5
5
  end
@@ -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)
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.6
4
+ version: 3.4.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - bcrouse
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-08-21 00:00:00.000000000 Z
11
+ date: 2019-09-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: workarea
@@ -220,7 +220,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
220
220
  - !ruby/object:Gem::Version
221
221
  version: '0'
222
222
  requirements: []
223
- rubygems_version: 3.0.4
223
+ rubygems_version: 3.0.6
224
224
  signing_key:
225
225
  specification_version: 4
226
226
  summary: Gift Cards plugin for the Workarea commerce platform