effective_orders 6.19.3 → 6.19.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 73f7c7e5f31c361565954b31a82a278a0c5127829cbd24be06b4c307205c5f74
4
- data.tar.gz: d7821ca6b2a5e7a9b22c9e5d67c69a6a22f49a6c7211b88961b6cb42a8f7698a
3
+ metadata.gz: 9ac540563873add27dbdaae886f216f3c20e0abe562476d7736e7c8ff73c04b2
4
+ data.tar.gz: 562b4bd4ecb4204e44f8910e4f633932ab172c3a377f2662beaefdd733e4e505
5
5
  SHA512:
6
- metadata.gz: '0967f05a59940c88a2b1ea47a8125c3501a9e1a0e1497fd5280fe4542f74b7bea94253fb72fd192adf32f6df958cfbc5179231d5c3d1351f0bf41bbc7ce49b1d'
7
- data.tar.gz: 950b3b66593162a86e80a69dcea163415a0a7f1d1c0496dd3deeb886d8d1be7d9fb575fd3db334f8ab3e73662a8e9d3c3c2d8ec2d1fafd35fd49946a9dbf88ba
6
+ metadata.gz: c6e7dca80311b8aa229dbba54979ff85319035d2ee7b61c7b65d7cff7502207d7a882a82921011f4680ba337d39e6d84cf4cbe8bb9137df2fe844c2fa9edcb13
7
+ data.tar.gz: 35e988323e5dd995719e34ad8b8a0976f32185c31fa82001604fb077b9801f7d933a40b9bcd50c9193607bb1c83dee1fceae26c5267506ba2d980cbad7861d1a
@@ -100,7 +100,7 @@ module Effective
100
100
 
101
101
  # Create Payment
102
102
  def create_payment(order, payment_intent)
103
- response = post('/payments', params: create_payment_params(order, payment_intent))
103
+ response = post_once('/payments', params: create_payment_params(order, payment_intent))
104
104
 
105
105
  # Sanity check response
106
106
  raise('expected responseCode') unless response.kind_of?(Hash) && response['responseCode'].present?
@@ -386,6 +386,25 @@ module Effective
386
386
  http.read_timeout = (read_timeout || 30)
387
387
  http.use_ssl = true
388
388
 
389
+ result = with_retries do
390
+ puts "[POST] #{uri} #{params}" if Rails.env.development?
391
+
392
+ response = http.post(uri.path, params.to_json, headers)
393
+ raise Exception.new("#{response.code} #{response.body}") unless response.code == '200'
394
+
395
+ response
396
+ end
397
+
398
+ JSON.parse(result.body)
399
+ end
400
+
401
+ def post_once(endpoint, params:)
402
+ uri = URI.parse(api_url + endpoint)
403
+
404
+ http = Net::HTTP.new(uri.host, uri.port)
405
+ http.read_timeout = (read_timeout || 30)
406
+ http.use_ssl = true
407
+
389
408
  puts "[POST] #{uri} #{params}" if Rails.env.development?
390
409
 
391
410
  response = http.post(uri.path, params.to_json, headers)
@@ -1,3 +1,3 @@
1
1
  module EffectiveOrders
2
- VERSION = '6.19.3'.freeze
2
+ VERSION = '6.19.4'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: effective_orders
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.19.3
4
+ version: 6.19.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Code and Effect