pay 4.0.0 → 4.0.1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of pay might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/app/mailers/pay/user_mailer.rb +1 -1
- data/lib/pay/braintree/webhooks/subscription_charged_successfully.rb +1 -1
- data/lib/pay/braintree/webhooks/subscription_charged_unsuccessfully.rb +1 -1
- data/lib/pay/paddle/webhooks/subscription_payment_refunded.rb +1 -1
- data/lib/pay/paddle/webhooks/subscription_payment_succeeded.rb +1 -1
- data/lib/pay/stripe/charge.rb +1 -1
- data/lib/pay/stripe/webhooks/charge_refunded.rb +1 -1
- data/lib/pay/stripe/webhooks/charge_succeeded.rb +1 -1
- data/lib/pay/stripe/webhooks/payment_action_required.rb +1 -1
- data/lib/pay/stripe/webhooks/subscription_renewing.rb +1 -1
- data/lib/pay/version.rb +1 -1
- data/lib/pay.rb +16 -0
- 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: '09c79f10c2e9258ebfd7a54a58283d0d14eb33121b5f51f4a5b563088f672d41'
|
4
|
+
data.tar.gz: 14af03dc31b7b65f9975c90876d1ffb764009e3cae1038abe2bce37822901c49
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bb583c78584c50bbf21d8d15f7a97449073864cb7064c6ae265639d3f75a97d528868d9db1b2b5d4a8e4e1036d19dd55a4ecdd49f96b9f24149f8e38c4cd4eab
|
7
|
+
data.tar.gz: 95f41a1f851f09d9dae598a7d2f795668f4c1b5f28b0fec2ac05e7aed1fd95ad5aefdc5f1fab28f4cbf9a16b6385d55d40bb0f78562906335d8373eb4d76cdee
|
@@ -15,7 +15,7 @@ module Pay
|
|
15
15
|
pay_charge = Pay::Braintree::Billable.new(pay_customer).save_transaction(subscription.transactions.first)
|
16
16
|
|
17
17
|
if pay_charge && Pay.send_email?(:receipt, pay_charge)
|
18
|
-
Pay
|
18
|
+
Pay.mailer.with(pay_customer: pay_customer, pay_charge: pay_charge).receipt.deliver_later
|
19
19
|
end
|
20
20
|
end
|
21
21
|
end
|
@@ -15,7 +15,7 @@ module Pay
|
|
15
15
|
# pay_charge = Pay::Braintree::Billable.new(pay_customer).save_transaction(subscription.transactions.first)
|
16
16
|
|
17
17
|
# if Pay.send_emails
|
18
|
-
# Pay
|
18
|
+
# Pay.mailer.with(pay_customer: pay_charge.customer, charge: pay_charge).receipt.deliver_later
|
19
19
|
# end
|
20
20
|
end
|
21
21
|
end
|
@@ -9,7 +9,7 @@ module Pay
|
|
9
9
|
pay_charge.update!(amount_refunded: (event.gross_refund.to_f * 100).to_i)
|
10
10
|
|
11
11
|
if Pay.send_email?(:refund, pay_charge)
|
12
|
-
Pay
|
12
|
+
Pay.mailer.with(pay_customer: pay_charge.customer, pay_charge: pay_charge).refund.deliver_later
|
13
13
|
end
|
14
14
|
end
|
15
15
|
end
|
@@ -44,7 +44,7 @@ module Pay
|
|
44
44
|
|
45
45
|
def notify_user(pay_charge)
|
46
46
|
if Pay.send_email?(:receipt, pay_charge)
|
47
|
-
Pay
|
47
|
+
Pay.mailer.with(pay_customer: pay_charge.customer, pay_charge: pay_charge).receipt.deliver_later
|
48
48
|
end
|
49
49
|
end
|
50
50
|
end
|
data/lib/pay/stripe/charge.rb
CHANGED
@@ -128,7 +128,7 @@ module Pay
|
|
128
128
|
else
|
129
129
|
::Stripe::Refund.create(options.merge(charge: processor_id, amount: amount_to_refund), stripe_options)
|
130
130
|
end
|
131
|
-
pay_charge.update!(amount_refunded: amount_to_refund)
|
131
|
+
pay_charge.update!(amount_refunded: pay_charge.amount_refunded + amount_to_refund)
|
132
132
|
rescue ::Stripe::StripeError => e
|
133
133
|
raise Pay::Stripe::Error, e
|
134
134
|
end
|
@@ -6,7 +6,7 @@ module Pay
|
|
6
6
|
pay_charge = Pay::Stripe::Charge.sync(event.data.object.id, stripe_account: event.try(:account))
|
7
7
|
|
8
8
|
if pay_charge && Pay.send_email?(:refund, pay_charge)
|
9
|
-
Pay
|
9
|
+
Pay.mailer.with(pay_customer: pay_charge.customer, pay_charge: pay_charge).refund.deliver_later
|
10
10
|
end
|
11
11
|
end
|
12
12
|
end
|
@@ -6,7 +6,7 @@ module Pay
|
|
6
6
|
pay_charge = Pay::Stripe::Charge.sync(event.data.object.id, stripe_account: event.try(:account))
|
7
7
|
|
8
8
|
if pay_charge && Pay.send_email?(:receipt, pay_charge)
|
9
|
-
Pay
|
9
|
+
Pay.mailer.with(pay_customer: pay_charge.customer, pay_charge: pay_charge).receipt.deliver_later
|
10
10
|
end
|
11
11
|
end
|
12
12
|
end
|
@@ -12,7 +12,7 @@ module Pay
|
|
12
12
|
return if pay_subscription.nil?
|
13
13
|
|
14
14
|
if Pay.send_email?(:payment_action_required, pay_subscription)
|
15
|
-
Pay
|
15
|
+
Pay.mailer.with(
|
16
16
|
pay_customer: pay_subscription.customer,
|
17
17
|
payment_intent_id: event.data.object.payment_intent,
|
18
18
|
pay_subscription: pay_subscription
|
@@ -15,7 +15,7 @@ module Pay
|
|
15
15
|
price = event.data.object.lines.data.first.price
|
16
16
|
|
17
17
|
if Pay.send_email?(:subscription_renewing, pay_subscription, price)
|
18
|
-
Pay
|
18
|
+
Pay.mailer.with(
|
19
19
|
pay_customer: pay_subscription.customer,
|
20
20
|
pay_subscription: pay_subscription,
|
21
21
|
date: Time.zone.at(event.data.object.next_payment_attempt)
|
data/lib/pay/version.rb
CHANGED
data/lib/pay.rb
CHANGED
@@ -3,6 +3,8 @@ require "pay/engine"
|
|
3
3
|
require "pay/errors"
|
4
4
|
require "pay/adapter"
|
5
5
|
|
6
|
+
require "active_support/dependencies"
|
7
|
+
|
6
8
|
module Pay
|
7
9
|
autoload :Attributes, "pay/attributes"
|
8
10
|
autoload :Env, "pay/env"
|
@@ -60,6 +62,20 @@ module Pay
|
|
60
62
|
(price&.type == "recurring") && (price.recurring&.interval == "year")
|
61
63
|
}
|
62
64
|
|
65
|
+
@@mailer = "Pay::UserMailer"
|
66
|
+
|
67
|
+
def self.mailer=(value)
|
68
|
+
@@mailer = value
|
69
|
+
@@mailer_ref = nil
|
70
|
+
end
|
71
|
+
|
72
|
+
def self.mailer
|
73
|
+
@@mailer_ref ||= @@mailer&.constantize
|
74
|
+
end
|
75
|
+
|
76
|
+
mattr_accessor :parent_mailer
|
77
|
+
@@parent_mailer = "Pay::ApplicationMailer"
|
78
|
+
|
63
79
|
def self.setup
|
64
80
|
yield self
|
65
81
|
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: 4.0.
|
4
|
+
version: 4.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jason Charnes
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2022-
|
12
|
+
date: 2022-06-07 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|