pay 6.8.0 → 6.8.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/pay/stripe/charge.rb +8 -4
- data/lib/pay/stripe/payment_method.rb +8 -1
- data/lib/pay/stripe/subscription.rb +8 -1
- data/lib/pay/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: bcbe66e7978f3f589514c71a54b0f7450b41b57ddcd7025ce17e93130e42e1dd
|
4
|
+
data.tar.gz: e6168b5908003c44a5bf494d93590c4eaed7e2777178e66aa3303c72e2ffea2a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3c5ed3d8be3d803c66091d647957a8dc115c298de1daa4a8f53a69aae55ff7a8df406835718feafe231437f842a1770dedadac1cf9b8ac81a9494ee31e1ccc8e
|
7
|
+
data.tar.gz: 2571ba9c847b47ad74fe3996b159bac179b553dc1bc1d673f52194fbd6a17f381a27ebace5668254f13c17dd288a6bba0d6f93d51c809d0474ac28b68f0f42b4
|
data/lib/pay/stripe/charge.rb
CHANGED
@@ -15,12 +15,16 @@ module Pay
|
|
15
15
|
def self.sync(charge_id, object: nil, stripe_account: nil, try: 0, retries: 1)
|
16
16
|
# Skip loading the latest charge details from the API if we already have it
|
17
17
|
object ||= ::Stripe::Charge.retrieve({id: charge_id, expand: ["invoice.total_discount_amounts.discount", "invoice.total_tax_amounts.tax_rate", "refunds"]}, {stripe_account: stripe_account}.compact)
|
18
|
-
|
19
|
-
|
20
|
-
|
18
|
+
if object.customer.blank?
|
19
|
+
Rails.logger.debug "Stripe Charge #{object.id} does not have a customer"
|
20
|
+
return
|
21
|
+
end
|
21
22
|
|
22
23
|
pay_customer = Pay::Customer.find_by(processor: :stripe, processor_id: object.customer)
|
23
|
-
|
24
|
+
if pay_customer.blank?
|
25
|
+
Rails.logger.debug "Pay::Customer #{object.customer} is not in the database while syncing Stripe Charge #{object.id}"
|
26
|
+
return
|
27
|
+
end
|
24
28
|
|
25
29
|
refunds = []
|
26
30
|
object.refunds.auto_paging_each { |refund| refunds << refund }
|
@@ -28,9 +28,16 @@ module Pay
|
|
28
28
|
# Syncs PaymentMethod objects from Stripe
|
29
29
|
def self.sync(id, object: nil, stripe_account: nil, try: 0, retries: 1)
|
30
30
|
object ||= ::Stripe::PaymentMethod.retrieve(id, {stripe_account: stripe_account}.compact)
|
31
|
+
if object.customer.blank?
|
32
|
+
Rails.logger.debug "Stripe PaymentMethod #{object.id} does not have a customer"
|
33
|
+
return
|
34
|
+
end
|
31
35
|
|
32
36
|
pay_customer = Pay::Customer.find_by(processor: :stripe, processor_id: object.customer)
|
33
|
-
|
37
|
+
if pay_customer.blank?
|
38
|
+
Rails.logger.debug "Pay::Customer #{object.customer} is not in the database while syncing Stripe PaymentMethod #{object.id}"
|
39
|
+
return
|
40
|
+
end
|
34
41
|
|
35
42
|
default_payment_method_id = pay_customer.customer.invoice_settings.default_payment_method
|
36
43
|
default = (id == default_payment_method_id)
|
@@ -31,9 +31,16 @@ module Pay
|
|
31
31
|
def self.sync(subscription_id, object: nil, name: nil, stripe_account: nil, try: 0, retries: 1)
|
32
32
|
# Skip loading the latest subscription details from the API if we already have it
|
33
33
|
object ||= ::Stripe::Subscription.retrieve({id: subscription_id}.merge(expand_options), {stripe_account: stripe_account}.compact)
|
34
|
+
if object.customer.blank?
|
35
|
+
Rails.logger.debug "Stripe Subscription #{object.id} does not have a customer"
|
36
|
+
return
|
37
|
+
end
|
34
38
|
|
35
39
|
pay_customer = Pay::Customer.find_by(processor: :stripe, processor_id: object.customer)
|
36
|
-
|
40
|
+
if pay_customer.blank?
|
41
|
+
Rails.logger.debug "Pay::Customer #{object.customer} is not in the database while syncing Stripe Subscription #{object.id}"
|
42
|
+
return
|
43
|
+
end
|
37
44
|
|
38
45
|
attributes = {
|
39
46
|
application_fee_percent: object.application_fee_percent,
|
data/lib/pay/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pay
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 6.8.
|
4
|
+
version: 6.8.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jason Charnes
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2023-
|
13
|
+
date: 2023-09-05 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rails
|