pay 2.6.8 → 2.6.9
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.
Potentially problematic release.
This version of pay might be problematic. Click here for more details.
- checksums.yaml +4 -4
- data/lib/pay/braintree/billable.rb +3 -1
- data/lib/pay/stripe/billable.rb +13 -13
- 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: 1f949f6c58c035891245506ba0da8f891a7bdf3a45f6ba25c84b3189908967e2
|
4
|
+
data.tar.gz: 103ce517061db04dadfd0221b064da6045e86a11bc64a9b0ec55d76b316ad98a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c28e3d599a33bbe368502ac1ffbefad92ebaa36eea88915c87dd4343365a71cdc15e26a3e6d2fd7d02a6f2525635feb80a3e4f84c421fcd02f798151f6e0438e
|
7
|
+
data.tar.gz: e959cec2e79585142b6cc0f3a69cb4491dba516113591cfc62c904d2dbff283dbd9e7295b052dc31c7ac4ee29f17781a8bcc731971a41b1bfa1f06d205bd35b7
|
@@ -19,7 +19,9 @@ module Pay
|
|
19
19
|
# Returns Braintree::Customer
|
20
20
|
def customer
|
21
21
|
if processor_id?
|
22
|
-
gateway.customer.find(processor_id)
|
22
|
+
customer = gateway.customer.find(processor_id)
|
23
|
+
update_card card_token if card_token.present?
|
24
|
+
customer
|
23
25
|
else
|
24
26
|
result = gateway.customer.create(
|
25
27
|
email: email,
|
data/lib/pay/stripe/billable.rb
CHANGED
@@ -26,23 +26,22 @@ module Pay
|
|
26
26
|
#
|
27
27
|
# Returns Stripe::Customer
|
28
28
|
def customer
|
29
|
-
if processor_id?
|
29
|
+
stripe_customer = if processor_id?
|
30
30
|
::Stripe::Customer.retrieve(processor_id)
|
31
31
|
else
|
32
|
-
|
33
|
-
billable.update(processor: :stripe, processor_id:
|
34
|
-
|
35
|
-
|
36
|
-
if card_token.present?
|
37
|
-
payment_method = ::Stripe::PaymentMethod.attach(card_token, {customer: stripe_customer.id})
|
38
|
-
stripe_customer.invoice_settings.default_payment_method = payment_method.id
|
39
|
-
stripe_customer.save
|
40
|
-
|
41
|
-
update_card_on_file ::Stripe::PaymentMethod.retrieve(card_token).card
|
42
|
-
end
|
32
|
+
sc = ::Stripe::Customer.create(email: email, name: customer_name)
|
33
|
+
billable.update(processor: :stripe, processor_id: sc.id)
|
34
|
+
sc
|
35
|
+
end
|
43
36
|
|
44
|
-
|
37
|
+
# Update the user's card on file if a token was passed in
|
38
|
+
if card_token.present?
|
39
|
+
payment_method = ::Stripe::PaymentMethod.attach(card_token, customer: stripe_customer.id)
|
40
|
+
stripe_customer = ::Stripe::Customer.update(stripe_customer.id, invoice_settings: {default_payment_method: payment_method.id})
|
41
|
+
update_card_on_file(payment_method.card)
|
45
42
|
end
|
43
|
+
|
44
|
+
stripe_customer
|
46
45
|
rescue ::Stripe::StripeError => e
|
47
46
|
raise Pay::Stripe::Error, e
|
48
47
|
end
|
@@ -84,6 +83,7 @@ module Pay
|
|
84
83
|
# Inherit trial from plan unless trial override was specified
|
85
84
|
opts[:trial_from_plan] = true unless opts[:trial_period_days]
|
86
85
|
|
86
|
+
# Load the Stripe customer to verify it exists and update card if needed
|
87
87
|
opts[:customer] = customer.id
|
88
88
|
|
89
89
|
stripe_sub = ::Stripe::Subscription.create(opts)
|
data/lib/pay/version.rb
CHANGED