moss_generator 0.2.0 → 0.3.0

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: 94864f353514bae1dc92e750adda259be65c3834431a20e3cc20a1316585dec9
4
- data.tar.gz: 2d829fd20c5fa6e1c3a62041f279d04b60a8c4815b090fcf35ab9c3cf0a5904f
3
+ metadata.gz: b2b6449aa374fa85522e28aa9675f7bfd45b0b4a5ce390c6d0e912d079175ea1
4
+ data.tar.gz: 5c8dceae90fc3910fd31e575a131f35a8cda3641a5804757201f900ab6f65ea6
5
5
  SHA512:
6
- metadata.gz: ca4ffc090bfd23e9f33498f030f0094dcaa02dbf8f4790c62ad6a320b608dd8166a7c65d866877f4c923cbe16f44abdac10ac198e0b81b153e806adefa40fe87
7
- data.tar.gz: 7a7702bd3cbe463060d88c9e7973ce015a1079dc288467500a9b17fb26d970142791d491f3d6a02f5b0235e2df1ad8fcce0d9b9c091bdb6976dfe241b265b83d
6
+ metadata.gz: ad5637afa82ebf7b60ed543eb685ae8790d332b2062c360ff7ead5a2b714ffb6ec44719dea021f2496cb19dfe1eb75123bfb6a755ec9c4d6f682570fbca4a8dc
7
+ data.tar.gz: 6db1366ba400e33e5f4e25458d4008fb4a01377950ad07775e454a3f251591fbefe7e1fe91bee589d809595cf9bd74b80e31d13b369f511bc7ebbf0ae98ddcdd
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- moss_generator (0.2.0)
4
+ moss_generator (0.3.0)
5
5
  money (~> 6.14)
6
6
  valvat (~> 1.1)
7
7
 
@@ -6,6 +6,6 @@ require_relative 'moss_generator/stripe'
6
6
 
7
7
  # Generate CSV-formatted string for MOSS report
8
8
  module MossGenerator
9
- Money.default_currency = Money::Currency.new('SEK')
9
+ Money.default_currency = Money::Currency.new('EUR')
10
10
  Money.rounding_mode = BigDecimal::ROUND_HALF_UP
11
11
  end
@@ -11,7 +11,7 @@ module MossGenerator
11
11
 
12
12
  class NoVatRateForCountryError < StandardError; end
13
13
 
14
- class NotInSwedishKronorError < StandardError; end
14
+ class NotInEuroError < StandardError; end
15
15
 
16
16
  attr_reader :charge
17
17
 
@@ -26,11 +26,11 @@ module MossGenerator
26
26
  end
27
27
 
28
28
  def amount_without_vat
29
- Money.new(amount_with_vat * percent_without_vat, 'SEK').dollars.to_f
29
+ Money.new(amount_with_vat * percent_without_vat).dollars.to_f
30
30
  end
31
31
 
32
32
  def amount_without_vat_cents
33
- Money.new(amount_with_vat * percent_without_vat, 'SEK').cents
33
+ Money.new(amount_with_vat * percent_without_vat).cents
34
34
  end
35
35
 
36
36
  def vat_rate
@@ -38,7 +38,7 @@ module MossGenerator
38
38
  end
39
39
 
40
40
  def vat_amount
41
- Money.new(amount_without_vat_cents * vat_rate_calculatable_percent, 'SEK')
41
+ Money.new(amount_without_vat_cents * vat_rate_calculatable_percent)
42
42
  .dollars
43
43
  .to_f
44
44
  end
@@ -64,12 +64,10 @@ module MossGenerator
64
64
  end
65
65
 
66
66
  def amount_with_vat
67
- balance_transaction = charge['balance_transaction']
68
- currency = balance_transaction['currency']
69
- return balance_transaction['amount'] if currency == 'sek'
67
+ return charge['amount'] if charge['currency'].casecmp?('eur')
68
+ return if skippable?
70
69
 
71
- raise NotInSwedishKronorError,
72
- "balance_transaction: #{balance_transaction}"
70
+ raise NotInEuroError, "charge: #{charge}"
73
71
  end
74
72
 
75
73
  def percent_without_vat
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module MossGenerator
4
- VERSION = '0.2.0'
4
+ VERSION = '0.3.0'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: moss_generator
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - frdrkolsson
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-01-18 00:00:00.000000000 Z
11
+ date: 2021-01-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: money