pay 10.1.1 → 10.1.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 60ed8a33d928f8be5f8873e25bc9d52e659f3129750184b6bf5f7aa838f7d5a2
4
- data.tar.gz: 9969b2de4dcc2d3509529c62b27cbc28eb7fb440218523f9fb066625ea1897a8
3
+ metadata.gz: ddffc329aadfa7c04ea37c7a195fb26259a79f75e1433c27c42e6c78236840c7
4
+ data.tar.gz: 3f710608b74efec477fa33d5a65bb758cf77811b7deb88e2e81e87cfc90e32a2
5
5
  SHA512:
6
- metadata.gz: a764e343c15ee7afde06ed527b34e93398e4aa6a2314418d8ebfec733b7b4bf1d887ce4817b90100d5e4ce7be6ba0109c40b262f999bf5f4a78d942018b5d38b
7
- data.tar.gz: 8b1914ae7921a70334c5ec06b780e41952c77a0d3d1ab640fd9d0fe237df3f0e30c0cb82d2d736dabf22c1453e5442a0f5608d725137b7a299a5cd1b06b5e442
6
+ metadata.gz: 4d637527e7cb85e6dd8bc2ada0af265e2575589b73be8102fd0de82bb99afb732c69a28746bb088b0e16506438797265b69dad042e708af369794d0cd4ef2f3b
7
+ data.tar.gz: 485c2cf8bbdd879955702d816f3d4f4afd339b339d7b98bb2a8f790ca5f04a575cb14066a91a7dc7aeb0037b97ef4d3f02e05cf9406a66bcb76025160a35e89b
@@ -49,7 +49,8 @@ module Pay
49
49
  attributes[:trial_ends_at] = trial_period_days.to_i.days.from_now
50
50
  end
51
51
 
52
- attributes.delete(:promotion_code)
52
+ # Ignore any keys that aren't attribute names
53
+ attributes.deep_stringify_keys!.slice!(*subscriptions.attribute_names)
53
54
 
54
55
  subscriptions.create!(attributes)
55
56
  end
@@ -117,8 +117,8 @@ module Pay
117
117
  # capture(amount_to_capture: 15_00)
118
118
  def capture(**options)
119
119
  raise Pay::Stripe::Error, "no payment_intent on charge" unless payment_intent.present?
120
-
121
- ::Stripe::PaymentIntent.capture(payment_intent, options, stripe_options)
120
+ payment_intent_id = payment_intent.is_a?(::Stripe::PaymentIntent) ? payment_intent.id : payment_intent
121
+ ::Stripe::PaymentIntent.capture(payment_intent_id, options, stripe_options)
122
122
  self.class.sync(processor_id)
123
123
  rescue ::Stripe::StripeError => e
124
124
  raise Pay::Stripe::Error, e
@@ -122,7 +122,7 @@ module Pay
122
122
  amount: amount,
123
123
  currency: "usd",
124
124
  customer: processor_id || api_record.id,
125
- expand: ["latest_charge.refunds"],
125
+ expand: Pay::Stripe::Charge::EXPAND.map { |option| "latest_charge.#{option}" },
126
126
  return_url: root_url
127
127
  }.merge(options)
128
128
 
@@ -0,0 +1,11 @@
1
+ module Pay
2
+ module Stripe
3
+ module Webhooks
4
+ class ChargeUpdated
5
+ def call(event)
6
+ Pay::Stripe::Charge.sync(event.data.object.id, stripe_account: event.try(:account))
7
+ end
8
+ end
9
+ end
10
+ end
11
+ end
data/lib/pay/stripe.rb CHANGED
@@ -7,6 +7,7 @@ module Pay
7
7
  autoload :AccountUpdated, "pay/stripe/webhooks/account_updated"
8
8
  autoload :ChargeRefunded, "pay/stripe/webhooks/charge_refunded"
9
9
  autoload :ChargeSucceeded, "pay/stripe/webhooks/charge_succeeded"
10
+ autoload :ChargeUpdated, "pay/stripe/webhooks/charge_updated"
10
11
  autoload :CheckoutSessionCompleted, "pay/stripe/webhooks/checkout_session_completed"
11
12
  autoload :CheckoutSessionAsyncPaymentSucceeded, "pay/stripe/webhooks/checkout_session_async_payment_succeeded"
12
13
  autoload :CustomerDeleted, "pay/stripe/webhooks/customer_deleted"
@@ -72,8 +73,9 @@ module Pay
72
73
  # Listen to the charge event to make sure we get non-subscription
73
74
  # purchases as well. Invoice is only for subscriptions and manual creation
74
75
  # so it does not include individual charges.
75
- events.subscribe "stripe.charge.succeeded", Pay::Stripe::Webhooks::ChargeSucceeded.new
76
76
  events.subscribe "stripe.charge.refunded", Pay::Stripe::Webhooks::ChargeRefunded.new
77
+ events.subscribe "stripe.charge.succeeded", Pay::Stripe::Webhooks::ChargeSucceeded.new
78
+ events.subscribe "stripe.charge.updated", Pay::Stripe::Webhooks::ChargeUpdated.new
77
79
 
78
80
  events.subscribe "stripe.payment_intent.succeeded", Pay::Stripe::Webhooks::PaymentIntentSucceeded.new
79
81
 
data/lib/pay/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Pay
2
- VERSION = "10.1.1"
2
+ VERSION = "10.1.2"
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.1.1
4
+ version: 10.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jason Charnes
@@ -141,6 +141,7 @@ files:
141
141
  - lib/pay/stripe/webhooks/account_updated.rb
142
142
  - lib/pay/stripe/webhooks/charge_refunded.rb
143
143
  - lib/pay/stripe/webhooks/charge_succeeded.rb
144
+ - lib/pay/stripe/webhooks/charge_updated.rb
144
145
  - lib/pay/stripe/webhooks/checkout_session_async_payment_succeeded.rb
145
146
  - lib/pay/stripe/webhooks/checkout_session_completed.rb
146
147
  - lib/pay/stripe/webhooks/customer_deleted.rb