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 +4 -4
- data/Gemfile.lock +1 -1
- data/lib/moss_generator.rb +1 -1
- data/lib/moss_generator/stripe_charge_row.rb +7 -9
- data/lib/moss_generator/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b2b6449aa374fa85522e28aa9675f7bfd45b0b4a5ce390c6d0e912d079175ea1
|
4
|
+
data.tar.gz: 5c8dceae90fc3910fd31e575a131f35a8cda3641a5804757201f900ab6f65ea6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ad5637afa82ebf7b60ed543eb685ae8790d332b2062c360ff7ead5a2b714ffb6ec44719dea021f2496cb19dfe1eb75123bfb6a755ec9c4d6f682570fbca4a8dc
|
7
|
+
data.tar.gz: 6db1366ba400e33e5f4e25458d4008fb4a01377950ad07775e454a3f251591fbefe7e1fe91bee589d809595cf9bd74b80e31d13b369f511bc7ebbf0ae98ddcdd
|
data/Gemfile.lock
CHANGED
data/lib/moss_generator.rb
CHANGED
@@ -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('
|
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
|
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
|
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
|
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
|
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
|
-
|
68
|
-
|
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
|
72
|
-
"balance_transaction: #{balance_transaction}"
|
70
|
+
raise NotInEuroError, "charge: #{charge}"
|
73
71
|
end
|
74
72
|
|
75
73
|
def percent_without_vat
|
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.
|
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-
|
11
|
+
date: 2021-01-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: money
|