pay 11.1.1 → 11.1.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 +4 -4
- data/app/models/pay/stripe/charge.rb +9 -7
- data/app/models/pay/stripe/subscription.rb +7 -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: 65a518434cfa0042025a7d66ccaef83ab3057315d349988f3a6030ec58b55112
|
4
|
+
data.tar.gz: f92aada3064d15eb96d94cbb21dc3fce497176b4c09f514b0b7ed3f87c17fff2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c1861d93f6e98f1d2c4e48a0449d55b1099c20a5c61191b9d6ee1398ed169c0b0ee514d3d45d2079b4e196c043bce5d4e25eb8d28c40831b0237bf950e4be27a
|
7
|
+
data.tar.gz: 8aa5427869f976334156b802d5ef6320c151860510f78b0855a1c335b7152b5dce3b604e9545e08474770d2e8a8b257bea40c5d27286ae7fe5fe784f2275177d
|
@@ -47,13 +47,15 @@ module Pay
|
|
47
47
|
}
|
48
48
|
|
49
49
|
# Associate charge with subscription if we can
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
50
|
+
if object.payment_intent.present?
|
51
|
+
invoice_payments = ::Stripe::InvoicePayment.list({payment: {type: :payment_intent, payment_intent: object.payment_intent}, status: :paid, expand: ["data.invoice.total_discount_amounts.discount"]}, {stripe_account: stripe_account}.compact)
|
52
|
+
if invoice_payments.any? && (invoice = invoice_payments.first.invoice)
|
53
|
+
attrs[:stripe_invoice] = invoice.to_hash
|
54
|
+
attrs[:subtotal] = invoice.subtotal
|
55
|
+
attrs[:tax] = invoice.total - invoice.total_excluding_tax.to_i
|
56
|
+
if (subscription = invoice.parent.try(:subscription_details).try(:subscription))
|
57
|
+
attrs[:subscription] = pay_customer.subscriptions.find_by(processor_id: subscription)
|
58
|
+
end
|
57
59
|
end
|
58
60
|
end
|
59
61
|
|
@@ -103,7 +103,13 @@ module Pay
|
|
103
103
|
if (invoice = object.try(:latest_invoice))
|
104
104
|
Array(invoice.try(:payments)).each do |invoice_payment|
|
105
105
|
next unless invoice_payment.status == "paid"
|
106
|
-
|
106
|
+
|
107
|
+
case invoice_payment.payment.type
|
108
|
+
when "payment_intent"
|
109
|
+
Pay::Stripe::Charge.sync_payment_intent(invoice_payment.payment.payment_intent, stripe_account: pay_subscription.stripe_account)
|
110
|
+
when "charge"
|
111
|
+
Pay::Stripe::Charge.sync(invoice_payment.payment.charge, stripe_account: pay_subscription.stripe_account)
|
112
|
+
end
|
107
113
|
end
|
108
114
|
end
|
109
115
|
|
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: 11.1.
|
4
|
+
version: 11.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jason Charnes
|
@@ -187,7 +187,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
187
187
|
- !ruby/object:Gem::Version
|
188
188
|
version: '0'
|
189
189
|
requirements: []
|
190
|
-
rubygems_version: 3.
|
190
|
+
rubygems_version: 3.7.1
|
191
191
|
specification_version: 4
|
192
192
|
summary: Payments engine for Ruby on Rails
|
193
193
|
test_files: []
|