pay 11.2.2 → 11.2.3
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/lib/pay/attributes.rb +4 -4
- data/lib/pay/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 71299748a825cda0c189c61f051f666840c413df3e33e177d126dffa9feaa2fe
|
4
|
+
data.tar.gz: 3d6ad655b364d9fea688fbeae0e1f013bd6966e796559ec4cf1e2d5cb181dda0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 530ea9ae04118c33c7aa91e17bb945cb752b22d175b3bdc32eef915e7e304f97f2017409eb53c3adb4ebeb319abf5e9c698ffa618167065d230c548d64ac23df
|
7
|
+
data.tar.gz: a39c4b305ce5083fcf44fdd8813de11292938bd2439a6288039d0f737e6f134b0ed869c61a06b99d1db4b105207e017de805c5a6cc86cbf9c2230add37dc69da
|
data/lib/pay/attributes.rb
CHANGED
@@ -28,7 +28,7 @@ module Pay
|
|
28
28
|
# - Finds or creates a Pay::Customer for the process and marks it as default
|
29
29
|
# - Removes the default flag from all other Pay::Customers
|
30
30
|
# - Removes the default flag from all Pay::PaymentMethods
|
31
|
-
def set_payment_processor(processor_name, allow_fake: false, **attributes)
|
31
|
+
def set_payment_processor(processor_name, allow_fake: false, stripe_account: nil, **attributes)
|
32
32
|
raise Pay::Error, "Processor `#{processor_name}` is not allowed" if processor_name.to_s == "fake_processor" && !allow_fake
|
33
33
|
|
34
34
|
# Safety check to make sure this is a valid Pay processor
|
@@ -37,7 +37,7 @@ module Pay
|
|
37
37
|
|
38
38
|
with_lock do
|
39
39
|
pay_customers.update_all(default: false)
|
40
|
-
pay_customer = pay_customers.active.where(processor: processor_name, type: klass.name).first_or_initialize
|
40
|
+
pay_customer = pay_customers.active.where(processor: processor_name, type: klass.name, stripe_account: stripe_account).first_or_initialize
|
41
41
|
pay_customer.update!(attributes.merge(default: true))
|
42
42
|
end
|
43
43
|
|
@@ -45,14 +45,14 @@ module Pay
|
|
45
45
|
reload_payment_processor
|
46
46
|
end
|
47
47
|
|
48
|
-
def add_payment_processor(processor_name, allow_fake: false, **attributes)
|
48
|
+
def add_payment_processor(processor_name, allow_fake: false, stripe_account: nil, **attributes)
|
49
49
|
raise Pay::Error, "Processor `#{processor_name}` is not allowed" if processor_name.to_s == "fake_processor" && !allow_fake
|
50
50
|
|
51
51
|
# Safety check to make sure this is a valid Pay processor
|
52
52
|
klass = "Pay::#{processor_name.to_s.classify}::Customer".constantize
|
53
53
|
raise ArgumentError, "not a valid payment processor" if klass.ancestors.exclude?(Pay::Customer)
|
54
54
|
|
55
|
-
pay_customer = pay_customers.active.where(processor: processor_name, type: klass.name).first_or_initialize
|
55
|
+
pay_customer = pay_customers.active.where(processor: processor_name, type: klass.name, stripe_account: stripe_account).first_or_initialize
|
56
56
|
pay_customer.update!(attributes)
|
57
57
|
pay_customer
|
58
58
|
end
|
data/lib/pay/version.rb
CHANGED