stripe_invoice 1.3.1 → 1.3.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
  SHA1:
3
- metadata.gz: 58497c0c2b4f31c6ccc71c26123fd1fece4169a0
4
- data.tar.gz: 7b7bcdc36f4c3c19addf45ae0ede10b9dedd9506
3
+ metadata.gz: df644f3ed96fa4252f80eed1698a5d5281cc484a
4
+ data.tar.gz: 90a0dd31292726cd2c018fcd893f8a418fd0af17
5
5
  SHA512:
6
- metadata.gz: 1ece442b6a15b3319b55407d3fa097b794ff8cd1b8b229bcad0ed5305510873e8fb4794db401d29d10e215f9ad0801fb61779707830e4c59738d4478d3fd0f82
7
- data.tar.gz: 0b3a450a42739c43a61ba0e4eed906acad2f1f6b2792086cd77858a47533ca6a6b4730ee88215269e7715c6b837cd5a9d41c223302713bc2e5dae04027f9cd22
6
+ metadata.gz: 75e3bc64405cf840b164b385a4cad26ebd2164c7120d42e65862960a4af6d00d302b97103c64e846802d24db17437f80e12013c0453f857ba939b995d69d04cf
7
+ data.tar.gz: cde4bd6bf66f8490b7f9048e1e124524de4f2f729a4191548c0f3e0eaf059902ac54c56c6f169a293cc9d766c7ebd5c34ea03f031330dd19ffe01e966036c9d7
@@ -84,8 +84,8 @@ module StripeInvoice
84
84
  next if key.blank?
85
85
 
86
86
  result << {
87
- amount: charges[key].sum{|char| char.total_less_refunds},
88
- currency: charges[key].first[:currency],
87
+ amount: charges[key].sum{|char| char[:charge].total_less_refunds},
88
+ currency: charges[key].first[:charge].currency,
89
89
  tax_number: key
90
90
  }
91
91
  end
@@ -130,5 +130,10 @@ module StripeInvoice
130
130
  Country[charge.country] ? charge.country :
131
131
  ((country = Country.find_country_by_name(charge.country)) ? country.alpha2 : 'Unkown Country')
132
132
  end
133
+
134
+ def total_less_refunds(hash_sic)
135
+ total = hash_sic[:charge].total
136
+ total -= hash_sic[:refunds].sum {|refund| refund[:refund][:amount]} unless hash_sic[:refunds].blank?
137
+ end
133
138
  end
134
139
  end
@@ -1,3 +1,3 @@
1
1
  module StripeInvoice
2
- VERSION = "1.3.1"
2
+ VERSION = "1.3.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stripe_invoice
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.1
4
+ version: 1.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Christoph Engelhardt