offsite_payments 2.7.13 → 2.7.14

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: 6c86875ed406dad004fcd7c01502b5a78c041354fe9c6c68d1d4040282934d9f
4
- data.tar.gz: 1586b616dff725696775335a37f2227920a35248e47ce8bfc87bd524284c82ef
3
+ metadata.gz: 1bc4531ed0ce30dfccdf87dfeba05cfa0c546a729d51ace52ab1b3b2f39b6f14
4
+ data.tar.gz: c5beb060a74becd03b15edaeb01154284a3638e2cc6268b3457b637c9e2aa301
5
5
  SHA512:
6
- metadata.gz: 35089d65c5f4a20211dbfd51efadfbe9b01df88fafe19be28ffdcf1afe20b7388a50f429718c3a023466989d94eb7adda5c9638bf5cac721f33e8e81c890fe24
7
- data.tar.gz: 2add27949675af7425dbea95bc2eae15f4174f3f5739b21066cc1ed36e72ba000fee06f6679959067eb02941332991805f7e454352c56f0fad5e6eba65386427
6
+ metadata.gz: b2f8e5cc845d37ef693636ff111f7ca2255ca33fecb39e4f8d87e7c49a089ead21e917d15571769ee478fece7d044fe699a04f04f7d28c2e87dbbd6ca90c7522
7
+ data.tar.gz: 46c08d37fabc1f3d1d3398a4b9e6e21cc659b9aa65f7391c445db3914d965609496462630e181efa469ca4349493ba4a9e00547bbb763e620544aaa953003a0c
@@ -2,7 +2,7 @@ module OffsitePayments #:nodoc:
2
2
  module Integrations #:nodoc:
3
3
  module BitPay
4
4
  API_V1_URL = 'https://bitpay.com/api/invoice'
5
- API_V1_TOKEN_REGEX = /[0OIl]/
5
+ API_V2_TOKEN_REGEX = /^[^0OIl]{44,}$/
6
6
  API_V2_URL = 'https://bitpay.com/invoices'
7
7
 
8
8
  mattr_accessor :service_url
@@ -21,7 +21,7 @@ module OffsitePayments #:nodoc:
21
21
  end
22
22
 
23
23
  def self.v2_api_token?(api_token)
24
- api_token.length >= 44 && !API_V1_TOKEN_REGEX.match(api_token)
24
+ API_V2_TOKEN_REGEX.match(api_token)
25
25
  end
26
26
 
27
27
  def self.invoicing_url(api_token)
@@ -84,7 +84,11 @@ module OffsitePayments #:nodoc:
84
84
  request = Net::HTTP::Post.new(uri.request_uri)
85
85
  request.content_type = "application/json"
86
86
  request.body = @fields.to_json
87
- request.basic_auth @account, ''
87
+
88
+ unless v2_api_token?(@account)
89
+ request.add_field("x-bitpay-plugin-info", "BitPay_Shopify_Client_v2.0.1906")
90
+ request.basic_auth @account, ''
91
+ end
88
92
 
89
93
  response = http.request(request)
90
94
  JSON.parse(response.body)
@@ -1,3 +1,3 @@
1
1
  module OffsitePayments
2
- VERSION = "2.7.13"
2
+ VERSION = "2.7.14"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: offsite_payments
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.7.13
4
+ version: 2.7.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tobias Luetke
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-05-22 00:00:00.000000000 Z
11
+ date: 2019-06-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport