paypoint-blue 0.7.0 → 1.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.rubocop.yml +10 -0
- data/lib/paypoint/blue/api.rb +9 -3
- data/lib/paypoint/blue/base.rb +16 -4
- data/lib/paypoint/blue/hosted.rb +6 -5
- data/lib/paypoint/blue/version.rb +2 -2
- data/paypoint-blue.gemspec +2 -2
- metadata +7 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: bb5dff3e392d8c738391d61586ab106d52867a22cdb100ee54567c44aac4ef21
|
4
|
+
data.tar.gz: 13535878fc6f73ac2c81201fcc5df04964eb468b27f762000e4991bc83674ed3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e73cf17b9f6777c2f38024bf6040c0defa8b2d5b35dcc8844dad00fb16b3577b33986a76f5e87d6067c9a08757448b6139996768be0532e3cc89370df40047b6
|
7
|
+
data.tar.gz: 07bf007f52f5e42988fb8c439647e89761afcbe4366e9fb7f5469c70701f7f8ce022f07dfbb7016b40f8654fcdd603cb9e815a69c789686bf62d92d29b248fcd
|
data/.rubocop.yml
CHANGED
@@ -5,6 +5,7 @@ AllCops:
|
|
5
5
|
- "bin/*"
|
6
6
|
- "support/**/*"
|
7
7
|
- "vendor/**/*"
|
8
|
+
TargetRubyVersion: 2.2
|
8
9
|
|
9
10
|
### Style ######################################################################
|
10
11
|
|
@@ -24,9 +25,15 @@ Style/BlockDelimiters:
|
|
24
25
|
Style/IndentHash:
|
25
26
|
EnforcedStyle: consistent
|
26
27
|
|
28
|
+
Style/MultilineMethodCallIndentation:
|
29
|
+
EnforcedStyle: indented
|
30
|
+
|
27
31
|
Style/MultilineOperationIndentation:
|
28
32
|
EnforcedStyle: indented
|
29
33
|
|
34
|
+
Style/SignalException:
|
35
|
+
EnforcedStyle: semantic
|
36
|
+
|
30
37
|
Style/StringLiterals:
|
31
38
|
EnforcedStyle: double_quotes
|
32
39
|
|
@@ -38,6 +45,9 @@ Style/StringLiteralsInInterpolation:
|
|
38
45
|
Style/SymbolArray:
|
39
46
|
Enabled: false
|
40
47
|
|
48
|
+
Style/TrailingCommaInArguments:
|
49
|
+
EnforcedStyleForMultiline: comma
|
50
|
+
|
41
51
|
Style/TrailingCommaInLiteral:
|
42
52
|
EnforcedStyleForMultiline: comma
|
43
53
|
|
data/lib/paypoint/blue/api.rb
CHANGED
@@ -3,8 +3,8 @@ require "paypoint/blue/base"
|
|
3
3
|
# Client class for the API product.
|
4
4
|
class PayPoint::Blue::API < PayPoint::Blue::Base
|
5
5
|
ENDPOINTS = {
|
6
|
-
test: "https://api.mite.
|
7
|
-
live: "https://api.
|
6
|
+
test: "https://api.mite.pay360.com/acceptor/rest",
|
7
|
+
live: "https://api.pay360.com/acceptor/rest",
|
8
8
|
}.freeze
|
9
9
|
|
10
10
|
shortcut :merchant_ref, "transaction.merchant_ref"
|
@@ -14,6 +14,7 @@ class PayPoint::Blue::API < PayPoint::Blue::Base
|
|
14
14
|
shortcut :description, "transaction.description"
|
15
15
|
shortcut :customer_ref, "customer.merchant_ref"
|
16
16
|
shortcut :customer_name, "customer.display_name"
|
17
|
+
shortcut :customer_registration, "customer.registered"
|
17
18
|
|
18
19
|
shortcut :pre_auth_callback, "callbacks.pre_auth_callback.url"
|
19
20
|
shortcut :post_auth_callback, "callbacks.post_auth_callback.url"
|
@@ -46,7 +47,7 @@ class PayPoint::Blue::API < PayPoint::Blue::Base
|
|
46
47
|
def make_payment(**payload)
|
47
48
|
payload = build_payload payload, defaults: %i(
|
48
49
|
currency commerce_type pre_auth_callback post_auth_callback
|
49
|
-
transaction_notification expiry_notification
|
50
|
+
transaction_notification expiry_notification customer_registration
|
50
51
|
)
|
51
52
|
client.post "transactions/#{inst_id}/payment", payload
|
52
53
|
end
|
@@ -228,4 +229,9 @@ class PayPoint::Blue::API < PayPoint::Blue::Base
|
|
228
229
|
def customer_payment_method(customer_id, token)
|
229
230
|
client.get "customers/#{inst_id}/#{customer_id}/paymentMethods/#{token}"
|
230
231
|
end
|
232
|
+
|
233
|
+
# Remove card
|
234
|
+
def remove_card(customer_id, token)
|
235
|
+
client.post "customers/#{inst_id}/#{customer_id}/paymentMethod/#{token}/remove"
|
236
|
+
end
|
231
237
|
end
|
data/lib/paypoint/blue/base.rb
CHANGED
@@ -52,9 +52,12 @@ module PayPoint
|
|
52
52
|
# @option options [String] :runscope when used, all traffic will
|
53
53
|
# pass through the provided {https://www.runscope.com/ Runscope}
|
54
54
|
# bucket, including notification callbacks
|
55
|
+
# @option options [Integer] :timeout waiting for response in seconds
|
56
|
+
# @option options [Integer] :open_timeout waiting for opening a connection
|
57
|
+
# in seconds
|
55
58
|
def initialize(endpoint:, inst_id: ENV["BLUE_API_INSTALLATION"],
|
56
|
-
|
57
|
-
|
59
|
+
api_id: ENV["BLUE_API_ID"], api_password: ENV["BLUE_API_PASSWORD"],
|
60
|
+
**options)
|
58
61
|
|
59
62
|
@endpoint = get_endpoint_or_override_with(endpoint)
|
60
63
|
@inst_id = inst_id or fail ArgumentError, "missing inst_id"
|
@@ -63,7 +66,7 @@ module PayPoint
|
|
63
66
|
api_password or fail ArgumentError, "missing api_password"
|
64
67
|
|
65
68
|
self.defaults = options.delete(:defaults)
|
66
|
-
@options = options.merge
|
69
|
+
@options = options.merge(url: @endpoint, **request_timeouts(options))
|
67
70
|
@client = build_client
|
68
71
|
end
|
69
72
|
|
@@ -75,6 +78,15 @@ module PayPoint
|
|
75
78
|
self.class.const_get("ENDPOINTS").fetch(endpoint, endpoint.to_s)
|
76
79
|
end
|
77
80
|
|
81
|
+
def request_timeouts(timeout_options)
|
82
|
+
{
|
83
|
+
request: {
|
84
|
+
open_timeout: timeout_options[:open_timeout] || 2,
|
85
|
+
timeout: timeout_options[:timeout] || 5,
|
86
|
+
}
|
87
|
+
}
|
88
|
+
end
|
89
|
+
|
78
90
|
def client_options
|
79
91
|
options.select { |k, _| Faraday::ConnectionOptions.members.include?(k) }
|
80
92
|
end
|
@@ -95,7 +107,7 @@ module PayPoint
|
|
95
107
|
end
|
96
108
|
f.response :json, content_type: /\bjson$/
|
97
109
|
if options[:logger] || options[:log]
|
98
|
-
f.response :logger, options[:logger]
|
110
|
+
f.response :logger, options[:logger], { headers: true, bodies: true }
|
99
111
|
end
|
100
112
|
|
101
113
|
# This sends all API traffic through Runscope, including
|
data/lib/paypoint/blue/hosted.rb
CHANGED
@@ -5,8 +5,8 @@ require "paypoint/blue/base"
|
|
5
5
|
# Client class for the Hosted product.
|
6
6
|
class PayPoint::Blue::Hosted < PayPoint::Blue::Base
|
7
7
|
ENDPOINTS = {
|
8
|
-
test: "https://
|
9
|
-
live: "https://
|
8
|
+
test: "https://api.mite.pay360.com/hosted/rest",
|
9
|
+
live: "https://api.pay360.com/hosted/rest",
|
10
10
|
}.freeze
|
11
11
|
|
12
12
|
shortcut :merchant_ref, "transaction.merchant_reference"
|
@@ -21,6 +21,7 @@ class PayPoint::Blue::Hosted < PayPoint::Blue::Base
|
|
21
21
|
shortcut :restore_url, "session.restore_url.url"
|
22
22
|
shortcut :skin, "session.skin"
|
23
23
|
shortcut :payment_method_registration, "features.payment_method_registration"
|
24
|
+
shortcut :customer_registration, "customer.registered"
|
24
25
|
|
25
26
|
shortcut :pre_auth_callback, "session.pre_auth_callback.url"
|
26
27
|
shortcut :post_auth_callback, "session.post_auth_callback.url"
|
@@ -64,7 +65,7 @@ class PayPoint::Blue::Hosted < PayPoint::Blue::Base
|
|
64
65
|
#
|
65
66
|
# @applies_defaults
|
66
67
|
# +:currency+, +:commerce_type+, +:return_url+, +:cancel_url+,
|
67
|
-
# +:restore_url+, +:skin+,
|
68
|
+
# +:restore_url+, +:skin+,
|
68
69
|
# +:pre_auth_callback+, +:post_auth_callback+, +:transaction_notification+
|
69
70
|
#
|
70
71
|
# @param [Hash] payload the payload is made up of the keyword
|
@@ -74,8 +75,8 @@ class PayPoint::Blue::Hosted < PayPoint::Blue::Base
|
|
74
75
|
def make_payment(**payload)
|
75
76
|
payload = build_payload payload, defaults: %i(
|
76
77
|
currency commerce_type return_url cancel_url restore_url skin
|
77
|
-
|
78
|
-
transaction_notification
|
78
|
+
pre_auth_callback post_auth_callback
|
79
|
+
transaction_notification customer_registration
|
79
80
|
)
|
80
81
|
client.post "sessions/#{inst_id}/payments", build_payload(payload)
|
81
82
|
end
|
data/paypoint-blue.gemspec
CHANGED
@@ -23,8 +23,8 @@ Gem::Specification.new do |spec|
|
|
23
23
|
spec.add_dependency "faraday_middleware"
|
24
24
|
spec.add_dependency "hashie"
|
25
25
|
|
26
|
-
spec.add_development_dependency "bundler", "~> 1
|
27
|
-
spec.add_development_dependency "rake", "~>
|
26
|
+
spec.add_development_dependency "bundler", "~> 2.1"
|
27
|
+
spec.add_development_dependency "rake", "~> 13.0.3"
|
28
28
|
spec.add_development_dependency "webmock"
|
29
29
|
spec.add_development_dependency "guard"
|
30
30
|
spec.add_development_dependency "guard-minitest"
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: paypoint-blue
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Laszlo Bacsi
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-03-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -58,28 +58,28 @@ dependencies:
|
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '1
|
61
|
+
version: '2.1'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: '1
|
68
|
+
version: '2.1'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: rake
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
73
|
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version:
|
75
|
+
version: 13.0.3
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version:
|
82
|
+
version: 13.0.3
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: webmock
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -202,8 +202,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
202
202
|
- !ruby/object:Gem::Version
|
203
203
|
version: '0'
|
204
204
|
requirements: []
|
205
|
-
|
206
|
-
rubygems_version: 2.4.5
|
205
|
+
rubygems_version: 3.1.3
|
207
206
|
signing_key:
|
208
207
|
specification_version: 4
|
209
208
|
summary: API client for PayPoint Blue
|