pay 10.0.3 → 10.1.0

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.
Files changed (37) hide show
  1. checksums.yaml +4 -4
  2. data/app/models/pay/braintree/charge.rb +2 -0
  3. data/app/models/pay/braintree/customer.rb +2 -0
  4. data/app/models/pay/braintree/payment_method.rb +2 -0
  5. data/app/models/pay/braintree/subscription.rb +2 -0
  6. data/app/models/pay/charge.rb +2 -0
  7. data/app/models/pay/customer.rb +2 -0
  8. data/app/models/pay/fake_processor/charge.rb +2 -0
  9. data/app/models/pay/fake_processor/customer.rb +2 -0
  10. data/app/models/pay/fake_processor/merchant.rb +2 -0
  11. data/app/models/pay/fake_processor/payment_method.rb +2 -0
  12. data/app/models/pay/fake_processor/subscription.rb +2 -0
  13. data/app/models/pay/lemon_squeezy/charge.rb +2 -0
  14. data/app/models/pay/lemon_squeezy/customer.rb +2 -0
  15. data/app/models/pay/lemon_squeezy/payment_method.rb +2 -0
  16. data/app/models/pay/lemon_squeezy/subscription.rb +2 -0
  17. data/app/models/pay/merchant.rb +2 -0
  18. data/app/models/pay/paddle_billing/charge.rb +2 -0
  19. data/app/models/pay/paddle_billing/customer.rb +2 -0
  20. data/app/models/pay/paddle_billing/payment_method.rb +2 -0
  21. data/app/models/pay/paddle_billing/subscription.rb +2 -0
  22. data/app/models/pay/paddle_classic/charge.rb +2 -0
  23. data/app/models/pay/paddle_classic/customer.rb +2 -0
  24. data/app/models/pay/paddle_classic/payment_method.rb +2 -0
  25. data/app/models/pay/paddle_classic/subscription.rb +2 -0
  26. data/app/models/pay/payment_method.rb +2 -0
  27. data/app/models/pay/stripe/charge.rb +3 -1
  28. data/app/models/pay/stripe/customer.rb +2 -0
  29. data/app/models/pay/stripe/merchant.rb +2 -0
  30. data/app/models/pay/stripe/payment_method.rb +2 -0
  31. data/app/models/pay/stripe/subscription.rb +6 -3
  32. data/app/models/pay/subscription.rb +2 -0
  33. data/app/models/pay/webhook.rb +2 -0
  34. data/lib/pay/stripe/webhooks/payment_action_required.rb +4 -3
  35. data/lib/pay/stripe/webhooks/payment_failed.rb +4 -3
  36. data/lib/pay/version.rb +1 -1
  37. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e9a03557a1292cbb8dcd8b3c8b43533b3c2f9a0cfc53481f99976579e1009dba
4
- data.tar.gz: f1d085db81f5132db3abb62bf07306ae7c4703343d46a39279fbef9eaf7692f7
3
+ metadata.gz: 514244ea1a6e8f9b56ff307b1d5f37719772fb4418b057d398c74fb148b7b961
4
+ data.tar.gz: 52e53b7b4667dd1dba56cf74a82b55f421e22cc4d6d2a8c7701abdbf397bf09f
5
5
  SHA512:
6
- metadata.gz: c8af553a1fffd442ed1bc19399b4e19df35404a41af7546a48737d45af2b9cb9aa7906b71ad9c2abd3b119d72048608afe9a4506ba7dc75f606eff89adc803d5
7
- data.tar.gz: b1de35982f96be48e20e8d514c0d14ccda50bcc25beb1f5238405931f8a4cc0331edad92160ab664b9a4031b5f9e3533fad3c1d2f529184cebc5bc4311ad19aa
6
+ metadata.gz: 6e5449126348166ff4fe1b3831bf77d7ffe5939101618cb662b7f49129d031385dda7bc1fa92b3ac23d9e1929153b893fbe31cee5390851a3a54e5d8dbb106e5
7
+ data.tar.gz: 23e01395c177b9fad7df51a4147bccbf54e80966c1bb30711930ca4e6ae64f55692f9bc3c1513c154c39d81f6ae12e9438931b511655bab3a944b0db8005d321
@@ -34,3 +34,5 @@ module Pay
34
34
  end
35
35
  end
36
36
  end
37
+
38
+ ActiveSupport.run_load_hooks :pay_braintree_charge, Pay::Braintree::Charge
@@ -262,3 +262,5 @@ module Pay
262
262
  end
263
263
  end
264
264
  end
265
+
266
+ ActiveSupport.run_load_hooks :pay_braintree_customer, Pay::Braintree::Customer
@@ -32,3 +32,5 @@ module Pay
32
32
  end
33
33
  end
34
34
  end
35
+
36
+ ActiveSupport.run_load_hooks :pay_braintree_payment_method, Pay::Braintree::PaymentMethod
@@ -243,3 +243,5 @@ module Pay
243
243
  end
244
244
  end
245
245
  end
246
+
247
+ ActiveSupport.run_load_hooks :pay_braintree_subscription, Pay::Braintree::Subscription
@@ -104,3 +104,5 @@ module Pay
104
104
  end
105
105
  end
106
106
  end
107
+
108
+ ActiveSupport.run_load_hooks :pay_charge, Pay::Charge
@@ -88,3 +88,5 @@ module Pay
88
88
  end
89
89
  end
90
90
  end
91
+
92
+ ActiveSupport.run_load_hooks :pay_customer, Pay::Customer
@@ -15,3 +15,5 @@ module Pay
15
15
  end
16
16
  end
17
17
  end
18
+
19
+ ActiveSupport.run_load_hooks :pay_fake_processor_charge, Pay::FakeProcessor::Charge
@@ -80,3 +80,5 @@ module Pay
80
80
  end
81
81
  end
82
82
  end
83
+
84
+ ActiveSupport.run_load_hooks :pay_fake_processor_customer, Pay::FakeProcessor::Customer
@@ -17,3 +17,5 @@ module Pay
17
17
  end
18
18
  end
19
19
  end
20
+
21
+ ActiveSupport.run_load_hooks :pay_fake_processor_merchant, Pay::FakeProcessor::Merchant
@@ -9,3 +9,5 @@ module Pay
9
9
  end
10
10
  end
11
11
  end
12
+
13
+ ActiveSupport.run_load_hooks :pay_fake_processor_payment_method, Pay::FakeProcessor::PaymentMethod
@@ -66,3 +66,5 @@ module Pay
66
66
  end
67
67
  end
68
68
  end
69
+
70
+ ActiveSupport.run_load_hooks :pay_fake_processor_subscription, Pay::FakeProcessor::Subscription
@@ -92,3 +92,5 @@ module Pay
92
92
  end
93
93
  end
94
94
  end
95
+
96
+ ActiveSupport.run_load_hooks :pay_lemon_squeezy_charge, Pay::LemonSqueezy::Charge
@@ -76,3 +76,5 @@ module Pay
76
76
  end
77
77
  end
78
78
  end
79
+
80
+ ActiveSupport.run_load_hooks :pay_lemon_squeezy_customer, Pay::LemonSqueezy::Customer
@@ -25,3 +25,5 @@ module Pay
25
25
  end
26
26
  end
27
27
  end
28
+
29
+ ActiveSupport.run_load_hooks :pay_lemon_squeezy_payment_method, Pay::LemonSqueezy::PaymentMethod
@@ -125,3 +125,5 @@ module Pay
125
125
  end
126
126
  end
127
127
  end
128
+
129
+ ActiveSupport.run_load_hooks :pay_lemon_squeezy_subscription, Pay::LemonSqueezy::Subscription
@@ -11,3 +11,5 @@ module Pay
11
11
  end
12
12
  end
13
13
  end
14
+
15
+ ActiveSupport.run_load_hooks :pay_merchant, Pay::Merchant
@@ -66,3 +66,5 @@ module Pay
66
66
  end
67
67
  end
68
68
  end
69
+
70
+ ActiveSupport.run_load_hooks :pay_paddle_billing_charge, Pay::PaddleBilling::Charge
@@ -71,3 +71,5 @@ module Pay
71
71
  end
72
72
  end
73
73
  end
74
+
75
+ ActiveSupport.run_load_hooks :pay_paddle_billing_customer, Pay::PaddleBilling::Customer
@@ -43,3 +43,5 @@ module Pay
43
43
  end
44
44
  end
45
45
  end
46
+
47
+ ActiveSupport.run_load_hooks :pay_paddle_billing_payment_method, Pay::PaddleBilling::PaymentMethod
@@ -182,3 +182,5 @@ module Pay
182
182
  end
183
183
  end
184
184
  end
185
+
186
+ ActiveSupport.run_load_hooks :pay_paddle_billing_subscription, Pay::PaddleBilling::Subscription
@@ -28,3 +28,5 @@ module Pay
28
28
  end
29
29
  end
30
30
  end
31
+
32
+ ActiveSupport.run_load_hooks :pay_paddle_classic_charge, Pay::PaddleClassic::Charge
@@ -46,3 +46,5 @@ module Pay
46
46
  end
47
47
  end
48
48
  end
49
+
50
+ ActiveSupport.run_load_hooks :pay_paddle_classic_customer, Pay::PaddleClassic::Customer
@@ -48,3 +48,5 @@ module Pay
48
48
  end
49
49
  end
50
50
  end
51
+
52
+ ActiveSupport.run_load_hooks :pay_paddle_classic_payment_method, Pay::PaddleClassic::PaymentMethod
@@ -146,3 +146,5 @@ module Pay
146
146
  end
147
147
  end
148
148
  end
149
+
150
+ ActiveSupport.run_load_hooks :pay_paddle_classic_subscription, Pay::PaddleClassic::Subscription
@@ -34,3 +34,5 @@ module Pay
34
34
  end
35
35
  end
36
36
  end
37
+
38
+ ActiveSupport.run_load_hooks :pay_payment_method, Pay::PaymentMethod
@@ -1,7 +1,7 @@
1
1
  module Pay
2
2
  module Stripe
3
3
  class Charge < Pay::Charge
4
- EXPAND = ["balance_transaction", "refunds"]
4
+ EXPAND = ["balance_transaction", "payment_intent", "refunds.data.balance_transaction"]
5
5
 
6
6
  delegate :amount_captured, :payment_intent, to: :stripe_object
7
7
 
@@ -147,3 +147,5 @@ module Pay
147
147
  end
148
148
  end
149
149
  end
150
+
151
+ ActiveSupport.run_load_hooks :pay_stripe_charge, Pay::Stripe::Charge
@@ -270,3 +270,5 @@ module Pay
270
270
  end
271
271
  end
272
272
  end
273
+
274
+ ActiveSupport.run_load_hooks :pay_stripe_customer, Pay::Stripe::Customer
@@ -47,3 +47,5 @@ module Pay
47
47
  end
48
48
  end
49
49
  end
50
+
51
+ ActiveSupport.run_load_hooks :pay_stripe_merchant, Pay::Stripe::Merchant
@@ -84,3 +84,5 @@ module Pay
84
84
  end
85
85
  end
86
86
  end
87
+
88
+ ActiveSupport.run_load_hooks :pay_stripe_payment_method, Pay::Stripe::PaymentMethod
@@ -120,12 +120,13 @@ module Pay
120
120
  def self.expand_options
121
121
  {
122
122
  expand: [
123
- "discounts",
124
123
  "default_payment_method",
125
- "pending_setup_intent",
124
+ "discounts",
126
125
  "latest_invoice.confirmation_secret",
127
126
  "latest_invoice.payments",
128
- "latest_invoice.total_discount_amounts.discount"
127
+ "latest_invoice.total_discount_amounts.discount",
128
+ "pending_setup_intent",
129
+ "schedule"
129
130
  ]
130
131
  }
131
132
  end
@@ -359,3 +360,5 @@ module Pay
359
360
  end
360
361
  end
361
362
  end
363
+
364
+ ActiveSupport.run_load_hooks :pay_stripe_subscription, Pay::Stripe::Subscription
@@ -127,3 +127,5 @@ module Pay
127
127
  end
128
128
  end
129
129
  end
130
+
131
+ ActiveSupport.run_load_hooks :pay_subscription, Pay::Subscription
@@ -41,3 +41,5 @@ module Pay
41
41
  end
42
42
  end
43
43
  end
44
+
45
+ ActiveSupport.run_load_hooks :pay_webhook, Pay::Webhook
@@ -6,16 +6,17 @@ module Pay
6
6
  # Event is of type "invoice" see:
7
7
  # https://stripe.com/docs/api/invoices/object
8
8
 
9
- object = event.data.object
9
+ invoice = event.data.object
10
+ subscription_id = invoice.parent.try(:subscription_details).try(:subscription)
10
11
 
11
12
  # Don't send email on incomplete Stripe subscriptions since they're just getting created and the JavaScript will handle SCA
12
- pay_subscription = Pay::Subscription.find_by_processor_and_id(:stripe, object.subscription)
13
+ pay_subscription = Pay::Subscription.find_by_processor_and_id(:stripe, subscription_id)
13
14
  return if pay_subscription.nil? || pay_subscription.status == "incomplete"
14
15
 
15
16
  if Pay.send_email?(:payment_action_required, pay_subscription)
16
17
  Pay.mailer.with(
17
18
  pay_customer: pay_subscription.customer,
18
- payment_intent_id: event.data.object.payment_intent,
19
+ payment_intent_id: invoice.payment_intent,
19
20
  pay_subscription: pay_subscription
20
21
  ).payment_action_required.deliver_later
21
22
  end
@@ -6,16 +6,17 @@ module Pay
6
6
  # Event is of type "invoice" see:
7
7
  # https://stripe.com/docs/api/invoices/object
8
8
 
9
- object = event.data.object
9
+ invoice = event.data.object
10
+ subscription_id = invoice.parent.try(:subscription_details).try(:subscription)
10
11
 
11
12
  # Don't send email on incomplete Stripe subscriptions since they're just getting created and the JavaScript will handle SCA
12
- pay_subscription = Pay::Subscription.find_by_processor_and_id(:stripe, object.subscription)
13
+ pay_subscription = Pay::Subscription.find_by_processor_and_id(:stripe, subscription_id)
13
14
  return if pay_subscription.nil? || pay_subscription.status == "incomplete"
14
15
 
15
16
  if Pay.send_email?(:payment_failed, pay_subscription)
16
17
  Pay.mailer.with(
17
18
  pay_customer: pay_subscription.customer,
18
- stripe_invoice: object
19
+ stripe_invoice: invoice
19
20
  ).payment_failed.deliver_now
20
21
  end
21
22
  end
data/lib/pay/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Pay
2
- VERSION = "10.0.3"
2
+ VERSION = "10.1.0"
3
3
  end
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: 10.0.3
4
+ version: 10.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jason Charnes