payhyper 0.4.1 → 0.4.6
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 +4 -4
- data/lib/payhyper.rb +5 -4
- data/lib/payhyper/version.rb +1 -1
- data/payhyper.gemspec +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: aada0d54d9876d60aef30729eb1f363164d511ed
|
4
|
+
data.tar.gz: ffdeca74a07d40f5b3a00e944e779a351cc718ed
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9e8ba5dd1d185202991a5bf98926ffe7dc6e4e64cb4a542e9373949f32ca45e9c410a6551cc6392b33bbe23b9e2ec171b4509b2ea0ed2f672a10c5e03c022190
|
7
|
+
data.tar.gz: a5d4e8a1512decaab64cbb18232dbad90622353d193e788b06b03d34f8cd04e35844bfcbfdec1f8296b26935f8a395d6d5edc0e6e2ec8104f2d0ba9f9a2ceee0
|
data/lib/payhyper.rb
CHANGED
@@ -22,10 +22,11 @@ module PayHyper
|
|
22
22
|
}
|
23
23
|
end
|
24
24
|
|
25
|
-
CURRENCIES = %w{JOD USD BHD GBP EGP KWD OMR QAR SAR TRY AED PKR}
|
25
|
+
CURRENCIES = %w{JOD USD BHD GBP EGP KWD OMR QAR SAR TRY AED PKR IQD}
|
26
26
|
COUNTRY_CODES = {
|
27
27
|
"JO" => "962",
|
28
28
|
"SA" => "966",
|
29
|
+
"IQ" => "964",
|
29
30
|
"PK" => "92",
|
30
31
|
}
|
31
32
|
COUNTRIES = COUNTRY_CODES.keys
|
@@ -37,7 +38,7 @@ module PayHyper
|
|
37
38
|
@base_url = BASE_URLS[mode]
|
38
39
|
end
|
39
40
|
|
40
|
-
def self.at_door!(name, phone, email, country, city, amount, currency, address = nil, invoice = nil, tag = nil, stickiness_id = nil) # TODO: There is a lot of overlap with "in_store!", refactor.
|
41
|
+
def self.at_door!(name, phone, email, country, city, amount, currency, address = nil, invoice = nil, tag = nil, stickiness_id = nil, details = nil, location = nil) # TODO: There is a lot of overlap with "in_store!", refactor.
|
41
42
|
raise_if_not_setup!
|
42
43
|
# == Clean-up fields ==
|
43
44
|
currency = currency.upcase if currency && currency.is_a?(String)
|
@@ -58,7 +59,7 @@ module PayHyper
|
|
58
59
|
raise ValidationError, "Invalid email." if email.nil? || !email.match(/\A[^@\s]+@([^@\s]+\.)+[^@\s]+\z/)
|
59
60
|
raise ValidationError, "Name is mandatory." if name.nil? || name.strip.length == 0
|
60
61
|
# == Do the request ==
|
61
|
-
make_call("/v1/at-door", { :name => name, :phone => phone, :email => email, :country => country, :city => city, :amount => amount, :currency => currency, :address => address, :invoice => invoice, :tag => tag, :stickiness_id => stickiness_id })
|
62
|
+
make_call("/v1/at-door", { :name => name, :phone => phone, :email => email, :country => country, :city => city, :amount => amount, :currency => currency, :address => address, :invoice => invoice, :tag => tag, :stickiness_id => stickiness_id, :details => details, :location => location })
|
62
63
|
end
|
63
64
|
|
64
65
|
def self.in_store!(name, phone, email, country, amount, currency, tag = nil) # TODO: There is a lot of overlap with "at_door!", refactor.
|
@@ -128,7 +129,7 @@ module PayHyper
|
|
128
129
|
uri = URI.parse(@base_url + endpoint)
|
129
130
|
content_type = "application/json; charset=utf-8"
|
130
131
|
signature = Security.sign(@access_key_secret, ["POST", uri.port == uri.default_port ? uri.host : "#{uri.host}:#{uri.port}", uri.request_uri, content_type, body.encode("UTF-8")].join("\n")) # Would be great if this could read directly from the request's headers.
|
131
|
-
res = RestClient.post(@base_url + endpoint, body, :content_type => content_type, :authorization => "Hyper #{@access_key_id}:#{signature}")
|
132
|
+
res = RestClient.post(@base_url + endpoint, body, :content_type => content_type, :authorization => "Hyper #{@access_key_id}:#{signature}", ssl_ciphers: RestClient::Request::DefaultCiphers)
|
132
133
|
failure = false
|
133
134
|
rescue RestClient::Exception => e # HTTP status codes not in 200-207, 301-303 and 307 result in a RestClient::Exception.
|
134
135
|
if e.http_code && e.http_code.to_i == 422 && e.http_body
|
data/lib/payhyper/version.rb
CHANGED
data/payhyper.gemspec
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: payhyper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sinan Taifour
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 2.1.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: 2.1.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: multi_json
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -75,7 +75,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
75
75
|
version: '0'
|
76
76
|
requirements: []
|
77
77
|
rubyforge_project:
|
78
|
-
rubygems_version: 2.
|
78
|
+
rubygems_version: 2.6.12
|
79
79
|
signing_key:
|
80
80
|
specification_version: 4
|
81
81
|
summary: The Ruby bindings of the Hyper API
|