stripe_invoice 1.3.0 → 1.3.1

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
  SHA1:
3
- metadata.gz: 3ad53fd68f8da537d3b3c8678665e7bc9d54e7bd
4
- data.tar.gz: df9c890143329314f5feed0dbcdcb0791725f6be
3
+ metadata.gz: 58497c0c2b4f31c6ccc71c26123fd1fece4169a0
4
+ data.tar.gz: 7b7bcdc36f4c3c19addf45ae0ede10b9dedd9506
5
5
  SHA512:
6
- metadata.gz: 8130919e62dbfe5a315297d1bec62b961661a6872111f5a35cf4fe408b441b65c797eac57483070b101a851fecc41695f5eb2af24694ce40d22d8b0c8c93b9c3
7
- data.tar.gz: 407af7e36edaa23db23b90f7f7796e140a85d41c4b6e234089b2e56b92ec5e5a750cd7fe4f0c39665a060c27636ab63ea2da63514d47e78fcdd5042b4636c6d1
6
+ metadata.gz: 1ece442b6a15b3319b55407d3fa097b794ff8cd1b8b229bcad0ed5305510873e8fb4794db401d29d10e215f9ad0801fb61779707830e4c59738d4478d3fd0f82
7
+ data.tar.gz: 0b3a450a42739c43a61ba0e4eed906acad2f1f6b2792086cd77858a47533ca6a6b4730ee88215269e7715c6b837cd5a9d41c223302713bc2e5dae04027f9cd22
@@ -84,7 +84,7 @@ module StripeInvoice
84
84
  next if key.blank?
85
85
 
86
86
  result << {
87
- amount: charges[key].sum{|char| char[:total] - char.sum{|ref| ref[:amount]}},
87
+ amount: charges[key].sum{|char| char.total_less_refunds},
88
88
  currency: charges[key].first[:currency],
89
89
  tax_number: key
90
90
  }
@@ -41,6 +41,10 @@ module StripeInvoice
41
41
  refunds.inject(0){ |total,refund| total + refund[:amount]}
42
42
  end
43
43
 
44
+ def total_less_refunds
45
+ total - total_refund
46
+ end
47
+
44
48
  # builds the invoice from the stripe CHARGE object
45
49
  # OR updates the existing invoice if an invoice for that id exists
46
50
  def self.create_from_stripe(stripe_charge)
@@ -1,3 +1,3 @@
1
1
  module StripeInvoice
2
- VERSION = "1.3.0"
2
+ VERSION = "1.3.1"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stripe_invoice
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
4
+ version: 1.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Christoph Engelhardt
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-07-07 00:00:00.000000000 Z
11
+ date: 2016-07-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails