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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 35fda4129bc353db11b8304b32d6d73ea9c21ed1
4
- data.tar.gz: 93c06940ab960c891536e4d8d826c319a77ef04e
2
+ SHA256:
3
+ metadata.gz: bb5dff3e392d8c738391d61586ab106d52867a22cdb100ee54567c44aac4ef21
4
+ data.tar.gz: 13535878fc6f73ac2c81201fcc5df04964eb468b27f762000e4991bc83674ed3
5
5
  SHA512:
6
- metadata.gz: 3810b61fd3f56e8bbd97a62d4e010717de25c723d6646dcee20b0cc2d260f5be7548914f658b470da29c19df9cf136a3c5db8a1325c05e76ea2fa1902e530b73
7
- data.tar.gz: 8754b8f9b060eca327b42cedc08d892e7d24fdc044de0889c6304a89c3ccc9ea477a7bbd4c8b101c1f435c6c091cb8c616ae7a8f96c5d1138632f672f34cf565
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
 
@@ -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.paypoint.net:2443/acceptor/rest",
7
- live: "https://api.paypoint.net/acceptor/rest",
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
@@ -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
- api_id: ENV["BLUE_API_ID"], api_password: ENV["BLUE_API_PASSWORD"],
57
- **options)
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 url: @endpoint
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
@@ -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://hosted.mite.paypoint.net/hosted/rest",
9
- live: "https://hosted.paypoint.net/hosted/rest",
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+, +:payment_method_registration+,
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
- payment_method_registration pre_auth_callback post_auth_callback
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
@@ -1,5 +1,5 @@
1
1
  module PayPoint
2
- module Blue # rubocop:disable Documentation
3
- VERSION = "0.7.0"
2
+ module Blue
3
+ VERSION = "1.0.4".freeze
4
4
  end
5
5
  end
@@ -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.8"
27
- spec.add_development_dependency "rake", "~> 10.0"
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.7.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: 2016-10-18 00:00:00.000000000 Z
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.8'
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.8'
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: '10.0'
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: '10.0'
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
- rubyforge_project:
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