stripe_invoice 1.1.2 → 1.1.3

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: f452ed8feae4a4675887cdee229dbb76d45d332e
4
- data.tar.gz: 8b09ef6e35a8de238f4fe1b5ab6385c4d201617c
3
+ metadata.gz: c305da2ef2b69b073b84bf050d0fc793494bae43
4
+ data.tar.gz: 6ff3e0fe43ecd54d2c19b13bf45f94c812dc3b6c
5
5
  SHA512:
6
- metadata.gz: e3c5985e3709e544f3cbbc49298d2597f7fcb419699d127eb23dc607109f56d17557f1f0c20e8d2add78610fae451d5bfd048e00ceb0f5069a23b3ac6dd430c5
7
- data.tar.gz: 0c0bf0241fe39f4d87b2557dbb35f3388606e9e69aa18c74709d5d2be44124d809cec375e2123efb6b0ab61029c0a140aec60341a1d18dfa6b27fd58a2aebb3b
6
+ metadata.gz: 548fff04f67664a4c25e578a4272d25c56406aadffe69bcaa362129c77085bd603e0576ddf09e21d7bd1a293f6d342e1df144bc7535432bf910ff7527f4c3adb
7
+ data.tar.gz: 3e83e38bb47783b44dc62c9982f742e7d8c07a4022508244e9bb8f7c589eeb5a67e97bbff167717944026b1a52ebda6d61e9bd094b953b539a7b34ada23fe1d3
@@ -46,14 +46,14 @@ module StripeInvoice
46
46
  def self.create_from_stripe(stripe_charge)
47
47
 
48
48
  unless stripe_charge.paid
49
- puts "ignoring unpaid charges"
50
- return
49
+ return puts "[#{self.class.name}##{__method__.to_s}] ignoring unpaid charge #{stripe_charge.id}"
51
50
  end
52
51
 
53
52
  charge = Charge.find_by_stripe_id(stripe_charge[:id])
54
53
 
55
54
  # for existing invoices just update and be done
56
55
  if charge.present?
56
+ puts "[#{self.class.name}##{__method__.to_s}] updating data for #{stripe_charge.id}"
57
57
  charge.update_attribute(:json, stripe_charge)
58
58
  return charge
59
59
  end
@@ -93,18 +93,19 @@ module StripeInvoice
93
93
 
94
94
  # we found them directly, go for it.
95
95
  unless subscription.nil?
96
+ puts "[#{self.class.name}##{__method__.to_s}] found owner directly for #{stripe_charge.id} - #{subscription.subscription_owner_email}"
96
97
  return subscription.subscription_owner
97
98
  end
98
99
 
99
100
  # koudoku does have a nasty feature/bug in that it deletes the subscription
100
101
  # from the database when it is cancelled. This makes it impossible to
101
102
  # match past charges to customers based solely on the subscription's stripe_id
102
- # instead we also try to match the email address/owner_id that was send to stripe
103
+ # instead we also try to match the email address that was send to stripe
103
104
  # when the account was created
104
105
  stripe_customer = Stripe::Customer.retrieve stripe_charge.customer
105
106
  return nil if stripe_customer[:deleted] # yes, that can happen :-(
106
- owner_id = stripe_customer.description.to_i
107
- Koudoku.owner_class.find(owner_id)
107
+ puts "[#{self.class.name}##{__method__.to_s}] found owner via email for #{stripe_charge.id} - #{stripe_customer.email}"
108
+ Koudoku.owner_class.try(:find_by_email, stripe_customer.email)
108
109
 
109
110
  end
110
111
  end
@@ -1,3 +1,3 @@
1
1
  module StripeInvoice
2
- VERSION = "1.1.2"
2
+ VERSION = "1.1.3"
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.1.2
4
+ version: 1.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Christoph Engelhardt
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-03-13 00:00:00.000000000 Z
11
+ date: 2015-03-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails