effective_orders 5.9.2 → 5.9.4
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/controllers/effective/providers/stripe.rb +30 -31
- data/app/models/effective/order.rb +4 -1
- data/lib/effective_orders/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: 35bd45132852365a2cc570b4b6a7fbbf5cc62d42cd9f506710da80a0c77daf82
|
4
|
+
data.tar.gz: e97f9869c710bdfb91cfa35b6b0bc091b429b175cdc7af9b066283d02d90bac6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 02036ff52d79eaa0c47e6f2353f23b33d6168222abe6337a77880fb7c48d0c7de7b1960235ed2b2dcb9e304aac36b8bddbbf0f1132fee7395bed3638be80c2bd
|
7
|
+
data.tar.gz: 1929601f0588f3cefde7eec8ceec3f796b03822406e9ae1533507a783c3f0867a5c408f21a9954c12eaa225c912817044102c869d1a334660f328a80a9381a2c
|
@@ -13,7 +13,7 @@ module Effective
|
|
13
13
|
|
14
14
|
payment = validate_stripe_payment(stripe_params[:payment_intent_id])
|
15
15
|
|
16
|
-
if payment.blank?
|
16
|
+
if payment.blank?
|
17
17
|
return order_declined(payment: payment, provider: 'stripe', declined_url: stripe_params[:declined_url])
|
18
18
|
end
|
19
19
|
|
@@ -37,36 +37,35 @@ module Effective
|
|
37
37
|
end
|
38
38
|
|
39
39
|
def validate_stripe_payment(payment_intent_id)
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
end
|
40
|
+
intent = EffectiveOrders.with_stripe { ::Stripe::PaymentIntent.retrieve(payment_intent_id) }
|
41
|
+
raise('expected stripe intent to be present') if intent.blank?
|
42
|
+
return unless intent.status == 'succeeded'
|
43
|
+
|
44
|
+
# Stripe API version 2022-11-15 and 2022-08-01
|
45
|
+
charge_id = intent.try(:latest_charge) || (intent.charges.data.first.id rescue nil)
|
46
|
+
raise('expected stripe charge_id to be present') if charge_id.blank?
|
47
|
+
|
48
|
+
charge = EffectiveOrders.with_stripe { ::Stripe::Charge.retrieve(charge_id) }
|
49
|
+
raise('expected stripe charge to be present') if charge.blank?
|
50
|
+
return unless charge.status == 'succeeded'
|
51
|
+
|
52
|
+
card = charge.payment_method_details.try(:card) || {}
|
53
|
+
active_card = "**** **** **** #{card['last4']} #{card['brand']} #{card['exp_month']}/#{card['exp_year']}" if card.present?
|
54
|
+
|
55
|
+
{
|
56
|
+
charge_id: charge.id,
|
57
|
+
payment_method_id: charge.payment_method,
|
58
|
+
payment_intent_id: intent.id,
|
59
|
+
|
60
|
+
active_card: active_card,
|
61
|
+
card: card['brand'],
|
62
|
+
|
63
|
+
amount: charge.amount,
|
64
|
+
created: charge.created,
|
65
|
+
currency: charge.currency,
|
66
|
+
customer: charge.customer,
|
67
|
+
status: charge.status
|
68
|
+
}.compact
|
70
69
|
end
|
71
70
|
|
72
71
|
end
|
@@ -499,7 +499,10 @@ module Effective
|
|
499
499
|
self.addresses.clear if addresses.any? { |address| address.valid? == false }
|
500
500
|
save!
|
501
501
|
|
502
|
-
|
502
|
+
if send_payment_request_to_buyer?
|
503
|
+
after_commit { send_payment_request_to_buyer! }
|
504
|
+
end
|
505
|
+
|
503
506
|
true
|
504
507
|
end
|
505
508
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: effective_orders
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 5.9.
|
4
|
+
version: 5.9.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Code and Effect
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-12-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|