lucadeal 0.2.14 → 0.2.15

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: e1b2a723a3fc191616f5a602a58428797afe69b19f9ee7e8d78d7dd187ae9b73
4
- data.tar.gz: b45c547d86312b94b702c68b94999be576c4f14fb55258b7961aa218ff4f74ef
3
+ metadata.gz: 9d81788d16b07f572c9d07bf998cdaa5a8e55db76ea5b1b513eebaae3c783c61
4
+ data.tar.gz: d148d1079305e88354c47c3ce5699e2c656a40099228b9c1653488b451a41afb
5
5
  SHA512:
6
- metadata.gz: 9daff536435c5bcbcc9f6694b4068df22f108d667283eb48754fdda02121f3724312ca0257d7029ec09f27034112af72123e734b2262c6f91c3b93f56a099b4e
7
- data.tar.gz: bdd40230688a1080fee49472adc22e8a98e53988aa2822688efc9e8537a0095de7919ec6c2c4a810da8f82e315fa714b2507d1e417dc07140fa0f1f897a31b0e
6
+ metadata.gz: 1f41b4156fb05131e969b0490937c766076e1795a9a6c725e657e1f533333532436b34bb362f42aa9600dcb67e25f080a7a9f6b3bf8ce4a9c2f276990c69e478
7
+ data.tar.gz: ae87eae9ca9af5459e3082bf517feb98ec4a98e0af87bb52e625e4067212dd9d6743644a57383c092555d1e90fef4009871a13b6eefc17d1c0f8d5806e76f58d
@@ -97,7 +97,7 @@ module LucaDeal
97
97
  collection << stat
98
98
  end
99
99
  end
100
- puts YAML.dump(collection)
100
+ puts YAML.dump(LucaSupport::Code.readable(collection))
101
101
  end
102
102
  end
103
103
 
@@ -113,7 +113,7 @@ module LucaDeal
113
113
  invoice['customer'] = get_customer(contract.dig('customer_id'))
114
114
  invoice['due_date'] = due_date(@date)
115
115
  invoice['issue_date'] = @date
116
- invoice['sales_fee'] = contract.dig('sales_fee')
116
+ invoice['sales_fee'] = contract['sales_fee'] if contract.dig('sales_fee')
117
117
  invoice['items'] = get_products(contract['products'])
118
118
  .concat(contract['items']&.map { |i| i['qty'] ||= 1; i } || [])
119
119
  .compact
@@ -201,12 +201,12 @@ module LucaDeal
201
201
  {}.tap do |subtotal|
202
202
  items.each do |i|
203
203
  rate = i.dig('tax') || 'default'
204
- qty = i['qty'] || 1
204
+ qty = i['qty'] || BigDecimal('1')
205
205
  subtotal[rate] = { 'items' => 0, 'tax' => 0 } if subtotal.dig(rate).nil?
206
- subtotal[rate]['items'] += qty * i['price']
206
+ subtotal[rate]['items'] += i['price'] * qty
207
207
  end
208
208
  subtotal.each do |rate, amount|
209
- amount['tax'] = (amount['items'] * load_tax_rate(rate)).to_i
209
+ amount['tax'] = (amount['items'] * load_tax_rate(rate))
210
210
  end
211
211
  end
212
212
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module LucaDeal
4
- VERSION = '0.2.14'
4
+ VERSION = '0.2.15'
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lucadeal
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.14
4
+ version: 0.2.15
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chuma Takahiro