mpp-rb 0.1.9 → 0.1.10

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: 9b15406ee08abfa67c30c458ceb33ba59d0af4873350e5d0976521f6fd9409e1
4
- data.tar.gz: 7ed79eafc950f4fb78253c7b0e93003498597bb5d87ffeda2f6e147004e4f858
3
+ metadata.gz: 4a9ab53da9713524d119320b1843e58948b433e213e17250cd641e90f4286083
4
+ data.tar.gz: 9ed02c682b99438d702cf231e97e96f0b275e84954785ef9eb2f0750b4a1a7c5
5
5
  SHA512:
6
- metadata.gz: 0bd1c63ff9e43759b05f7f3c4114368679407b04856c38d620e1b85d02c856028a9b740f80c50f848ebd238c2bbab2a0ae02e53197b9e6034951956a3251a4a2
7
- data.tar.gz: 2c0e2ffd65f60ad41b4fe2ce25006491b7fea6c76c5f0edac0672e738e64c53d9b23f0e3216b477dd638474957f54be6c9f04c5005af173e6c83fdf51103bb7a
6
+ metadata.gz: 12603bd4ec974e488a632ce3ec6d91304e4996bf218cc47638a652c2a096b73aa2124c12242effde8d711f9106e2c4138ee68ca8542c13d9341bcadb2d42b24a
7
+ data.tar.gz: 74a80bdc6320841a891e305ae39838156292a6656ce6d73f48b92283dfd5e639f91e415e631d2cdf4cd4ffb91c6c7871c905e30685380f4a6981f074ee11977b
@@ -33,8 +33,13 @@ module Mpp
33
33
 
34
34
  sig { params(env: T.untyped).returns(T::Array[T.untyped]) }
35
35
  def call(env)
36
+ original_input = env["rack.input"]
37
+ body_capture = capture_request_body(env)
36
38
  charge_opts = @pricing.call(env)
37
- return @app.call(env) unless charge_opts
39
+ unless charge_opts
40
+ env["rack.input"] = original_input if body_capture && env["rack.input"].equal?(body_capture)
41
+ return @app.call(env)
42
+ end
38
43
 
39
44
  authorization = env["HTTP_AUTHORIZATION"]
40
45
  payment_authorization = env["HTTP_PAYMENT_AUTHORIZATION"]
@@ -42,7 +47,6 @@ module Mpp
42
47
  accept_payment = env["HTTP_ACCEPT_PAYMENT"]
43
48
  http_method = env["REQUEST_METHOD"]
44
49
  url = request_url(env)
45
- body_capture = capture_request_body(env)
46
50
 
47
51
  request_body = body_capture&.materialize
48
52
  env["rack.input"] = StringIO.new(request_body || "") if body_capture
@@ -278,8 +282,11 @@ module Mpp
278
282
 
279
283
  sig { returns(T.untyped) }
280
284
  def rewind
281
- @input.rewind if @input.respond_to?(:rewind)
285
+ return unless @input.respond_to?(:rewind)
286
+
287
+ result = @input.rewind
282
288
  @buffer = +"".b
289
+ result
283
290
  end
284
291
 
285
292
  sig { returns(T.untyped) }
data/lib/mpp/version.rb CHANGED
@@ -2,5 +2,5 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  module Mpp
5
- VERSION = "0.1.9"
5
+ VERSION = "0.1.10"
6
6
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mpp-rb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.9
4
+ version: 0.1.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Stripe