pay 3.0.22 → 3.0.23

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2dfae5ada22ac1b2cecc080e154223aed66740ce53327fcaf012fa28ed2e6580
4
- data.tar.gz: cfdf57b6ee3c1e011a67bf67923d55ca8da9bb6b0cffa8334af4713296aac33c
3
+ metadata.gz: 5755d6421fc4b0366728f278b32de2f9f1bf6186cafe4c62cf9c5a188204d0d6
4
+ data.tar.gz: 5a4cf13ffbdf85017401dd9aca4ddc3d7fd48fea249868ff10c04bfa383e39d1
5
5
  SHA512:
6
- metadata.gz: fbe399383317007d063340568d983e7fcdc928f352ccfe3126ea2ec686e5c7ed96978ba576af9774226d1c702e4b4f8c2c3dee6cb8be0e5d823f2a267bfff3a2
7
- data.tar.gz: 00eb2d8b09de4457a7aa3fe861e393b212d87ad74065817a4fffe53f04eb6e6fc05ba9d4d7bb6ed8a483a01c8f3334f438ecd4cc75d93c1e03e3f6b682400861
6
+ metadata.gz: 966be7e8c643bb6bfa65f21d111d76e35d461a500630434f6b37907c9001f823ae3aa7193f763a7b0af76ef35806de91bd8acfaff1eef219972c8284a96835d3
7
+ data.tar.gz: b0dd861df1aa7cb64ab45b267de205251e4a8885a113219a0eb5c3d4fe087332fae129ca7fa1b619d7b75aef6a53698f1665d977c52a472a3d31bce90ff255d5
@@ -187,8 +187,8 @@ module Pay
187
187
  payment_method_types: ["card"],
188
188
  mode: "payment",
189
189
  # These placeholder URLs will be replaced in a following step.
190
- success_url: options.delete(:success_url) || root_url(session_id: "{CHECKOUT_SESSION_ID}"),
191
- cancel_url: options.delete(:cancel_url) || root_url(session_id: "{CHECKOUT_SESSION_ID}")
190
+ success_url: merge_session_id_param(options.delete(:success_url) || root_url),
191
+ cancel_url: merge_session_id_param(options.delete(:cancel_url) || root_url)
192
192
  }
193
193
 
194
194
  # Line items are optional
@@ -240,6 +240,13 @@ module Pay
240
240
  def stripe_options
241
241
  {stripe_account: stripe_account}.compact
242
242
  end
243
+
244
+ # Includes the `session_id` param for Stripe Checkout with existing params (and makes sure the curly braces aren't escaped)
245
+ def merge_session_id_param(url)
246
+ uri = URI.parse(url)
247
+ uri.query = URI.encode_www_form(URI.decode_www_form(uri.query.to_s).to_h.merge("session_id" => "{CHECKOUT_SESSION_ID}").to_a)
248
+ uri.to_s.gsub("%7BCHECKOUT_SESSION_ID%7D", "{CHECKOUT_SESSION_ID}")
249
+ end
243
250
  end
244
251
  end
245
252
  end
data/lib/pay/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Pay
2
- VERSION = "3.0.22"
2
+ VERSION = "3.0.23"
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: 3.0.22
4
+ version: 3.0.23
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: 2021-10-03 00:00:00.000000000 Z
12
+ date: 2021-10-07 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails