fat_zebra 3.2.4 → 3.2.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.
Files changed (53) hide show
  1. checksums.yaml +4 -4
  2. data/.buildkite/pipeline.yml +34 -0
  3. data/.rubocop.yml +2 -2
  4. data/.tool-versions +1 -0
  5. data/.travis.yml +1 -4
  6. data/Gemfile +2 -0
  7. data/README.md +1 -1
  8. data/Rakefile +2 -0
  9. data/fat_zebra.gemspec +5 -1
  10. data/lib/fat_zebra/api_helper.rb +7 -4
  11. data/lib/fat_zebra/api_operation/delete.rb +2 -0
  12. data/lib/fat_zebra/api_operation/find.rb +2 -0
  13. data/lib/fat_zebra/api_operation/save.rb +2 -0
  14. data/lib/fat_zebra/api_operation/search.rb +2 -0
  15. data/lib/fat_zebra/api_operation/void.rb +2 -0
  16. data/lib/fat_zebra/api_resource.rb +11 -7
  17. data/lib/fat_zebra/authenticate.rb +2 -0
  18. data/lib/fat_zebra/bank_account.rb +2 -0
  19. data/lib/fat_zebra/batch.rb +5 -2
  20. data/lib/fat_zebra/card.rb +2 -0
  21. data/lib/fat_zebra/config.rb +3 -1
  22. data/lib/fat_zebra/customer.rb +2 -0
  23. data/lib/fat_zebra/direct_credit.rb +2 -0
  24. data/lib/fat_zebra/direct_debit.rb +2 -0
  25. data/lib/fat_zebra/errors.rb +3 -4
  26. data/lib/fat_zebra/fat_zebra_object.rb +2 -0
  27. data/lib/fat_zebra/information.rb +2 -0
  28. data/lib/fat_zebra/object_helper.rb +2 -0
  29. data/lib/fat_zebra/payment_plan.rb +2 -2
  30. data/lib/fat_zebra/paypal/authorization.rb +3 -1
  31. data/lib/fat_zebra/paypal/billing_agreement.rb +3 -1
  32. data/lib/fat_zebra/paypal/capture.rb +3 -1
  33. data/lib/fat_zebra/paypal/order.rb +3 -1
  34. data/lib/fat_zebra/paypal/refund.rb +3 -1
  35. data/lib/fat_zebra/purchase.rb +5 -2
  36. data/lib/fat_zebra/refund.rb +2 -0
  37. data/lib/fat_zebra/request/multipart/epilogue.rb +2 -0
  38. data/lib/fat_zebra/request/multipart/file_io.rb +2 -0
  39. data/lib/fat_zebra/request/multipart/param.rb +2 -0
  40. data/lib/fat_zebra/request/multipart/part.rb +3 -1
  41. data/lib/fat_zebra/request/multipart/stream.rb +3 -0
  42. data/lib/fat_zebra/request.rb +8 -5
  43. data/lib/fat_zebra/util.rb +4 -2
  44. data/lib/fat_zebra/utilities/mastercard/click_to_pay/registration.rb +35 -0
  45. data/lib/fat_zebra/validation.rb +6 -4
  46. data/lib/fat_zebra/version.rb +3 -1
  47. data/lib/fat_zebra/web_hook.rb +2 -0
  48. data/lib/fat_zebra.rb +7 -0
  49. data/spec/cassettes/FatZebra_PaymentPlan/_create/perpetual_subscription/1_1_4_1.yml +183 -0
  50. data/spec/cassettes/FatZebra_PaymentPlan/_create/perpetual_subscription/1_1_4_2.yml +183 -0
  51. data/spec/cassettes/FatZebra_PaymentPlan/_create/perpetual_subscription/1_1_4_3.yml +183 -0
  52. data/spec/lib/fat_zebra/payment_plan_spec.rb +33 -10
  53. metadata +17 -11
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ce036c9eb7ff13fb1c6f60e6b0e4230299ccdb3384e4359959426d75c9a8e42b
4
- data.tar.gz: b55070ec65cbbad8c82ed8974c572dc0cc9eae5d38b3d49a0446dd91febc1570
3
+ metadata.gz: ace23c2e07a9ce8da166d78fe441521986143f949a155160c7c97e21455f3ca9
4
+ data.tar.gz: 9515304dde5b7cec6f304718406c9191e4a1c32aad45f907c60040a0b413fa3b
5
5
  SHA512:
6
- metadata.gz: 741c6e12a74bc6f05de8b1b04794476dd3dd1c711db11e093ccba35768e753657c5289d8151458140f8e582f971eb0d0876bd9240151df6ba97ac12b577f8e16
7
- data.tar.gz: 9aee0585dd4f0addde3fbf1ce4408a8905ccf2c336994a9a46d4fd7b2dd6a0d11d1bf9b1c6a33af4f6148b790cfe097de5739f645395a269c684e34cc6e18b96
6
+ metadata.gz: 6f49354b516cd1093acc086815ff7c9099959cb2a671f16861c794b4b83e19ffb3261a2f09fd77657c622283191df4c7bb5c2eab8f46f04488b35abf6af87649
7
+ data.tar.gz: 2dfe966670f924e523aa6347804ff2e9acc17734cd37bdba678b2563306c77f3dde1e7c0737564e231b86a4b33e621afa49e1953996e3f4e4925b8793aef5ac9
@@ -0,0 +1,34 @@
1
+ steps:
2
+ - label: ":rspec: Run rspec"
3
+ command:
4
+ - "bundle install"
5
+ - "bundle exec rspec"
6
+ plugins:
7
+ - docker#v3.3.0:
8
+ image: ruby:2.7
9
+
10
+ - label: ":rubocop: Run the cop"
11
+ command:
12
+ - "bundle install"
13
+ - "echo 'running rubocop'"
14
+ - "bundle exec rubocop"
15
+ plugins:
16
+ - docker#v3.3.0:
17
+ image: ruby:2.7
18
+ - wait
19
+
20
+ - label: ":pick: Build and Push"
21
+ command:
22
+ - "bundle install"
23
+ - "gem build && gem push *.gem"
24
+ branches: master
25
+ plugins:
26
+ - docker#v3.3.0:
27
+ image: ruby:2.7
28
+ environment:
29
+ - GEM_HOST_API_KEY
30
+ - GIT_AUTHOR_NAME=Fat Zebra
31
+ - GIT_AUTHOR_EMAIL=support@fatzebra.com
32
+ agents:
33
+ queue: aws
34
+ Environment: test
data/.rubocop.yml CHANGED
@@ -7,7 +7,7 @@ Layout/EmptyLinesAroundBlockBody:
7
7
 
8
8
  Style/MissingRespondToMissing:
9
9
  Enabled: false
10
- Style/MethodMissingSuper:
10
+ Lint/MissingSuper:
11
11
  Enabled: false
12
12
  Style/NumericPredicate:
13
13
  Enabled: false
@@ -34,7 +34,7 @@ Documentation:
34
34
  Enabled: false
35
35
 
36
36
  AllCops:
37
- TargetRubyVersion: 2.2
37
+ TargetRubyVersion: 2.7
38
38
  Exclude:
39
39
  - bin/**/*
40
40
  - vendor/**/*
data/.tool-versions ADDED
@@ -0,0 +1 @@
1
+ ruby 3.2.2
data/.travis.yml CHANGED
@@ -1,11 +1,8 @@
1
1
  cache: bundler
2
2
  language: ruby
3
3
  rvm:
4
- - 2.3
5
- - 2.4
6
- - 2.5
7
- - 2.6
8
4
  - 2.7
5
+ - 3.2
9
6
  script:
10
7
  - bundle exec rspec spec
11
8
  - bundle exec rubocop
data/Gemfile CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  source 'http://rubygems.org'
2
4
 
3
5
  # Specify your gem's dependencies in FatZebra.gemspec
data/README.md CHANGED
@@ -3,7 +3,7 @@ Ruby API Library for Fat Zebra
3
3
 
4
4
  [![Build Status](https://travis-ci.org/fatzebra/Ruby-Library.svg?branch=master)](https://travis-ci.org/fatzebra/Ruby-Library)
5
5
 
6
- Release 3.2.3 for API version 1.0
6
+ Release 3.2.6 for API version 1.0
7
7
 
8
8
  A Ruby client for the [Fat Zebra](https://www.fatzebra.com) Online Payment Gateway
9
9
 
data/Rakefile CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'bundler/gem_tasks'
2
4
 
3
5
  require 'rspec/core/rake_task'
data/fat_zebra.gemspec CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  lib = File.expand_path('lib', __dir__)
2
4
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
5
 
@@ -16,10 +18,12 @@ Gem::Specification.new do |s|
16
18
  s.test_files = `git ls-files -- {spec}/*`.split("\n")
17
19
  s.require_paths = %w[lib]
18
20
 
21
+ s.required_ruby_version = '>= 2.7'
22
+
19
23
  s.add_development_dependency 'byebug'
20
24
  s.add_development_dependency 'rake'
21
25
  s.add_development_dependency 'rspec', '~> 3.6'
22
- s.add_development_dependency 'rubocop', '~> 0.58.1'
26
+ s.add_development_dependency 'rubocop'
23
27
  s.add_development_dependency 'vcr', '~> 3.0'
24
28
  s.add_development_dependency 'webmock', '~> 3.0'
25
29
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module FatZebra
2
4
  ##
3
5
  # == FatZebra \Helper
@@ -40,20 +42,21 @@ module FatZebra
40
42
  port = port.to_i if port
41
43
 
42
44
  url_params = Util.compact(
43
- host: host,
44
- path: path,
45
- port: port,
45
+ host: host,
46
+ path: path,
47
+ port: port,
46
48
  query: params
47
49
  )
48
50
 
49
51
  return URI::HTTPS.build(url_params) if options[:http_secure]
52
+
50
53
  URI::HTTP.build(url_params)
51
54
  end
52
55
 
53
56
  def default_headers
54
57
  {
55
58
  headers: {
56
- accept: 'application/json',
59
+ accept: 'application/json',
57
60
  content_type: 'application/json'
58
61
  }
59
62
  }
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module FatZebra
2
4
  class APIOperation
3
5
  ##
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module FatZebra
2
4
  class APIOperation
3
5
  ##
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module FatZebra
2
4
  class APIOperation
3
5
  ##
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module FatZebra
2
4
  class APIOperation
3
5
  ##
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module FatZebra
2
4
  class APIOperation
3
5
  ##
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module FatZebra
2
4
  ##
3
5
  # == FatZebra \API \Resource
@@ -30,16 +32,17 @@ module FatZebra
30
32
  uri = build_endpoint_url(configurations.gateway, path, url_params, http_secure: configurations.http_secure)
31
33
 
32
34
  request_options = Util.compact(
33
- method: method,
34
- url: uri.to_s,
35
+ method: method,
36
+ url: uri.to_s,
35
37
  payload: payload,
36
- proxy: configurations.proxy,
38
+ proxy: configurations.proxy,
37
39
  use_ssl: configurations.http_secure
38
40
  ).merge(authentication).merge(default_headers).merge(configurations.global_options).merge(options)
39
41
 
40
42
  Request.execute(request_options).body
41
- rescue FatZebra::RequestError => error
42
- return error.http_body if error.http_status == 422
43
+ rescue FatZebra::RequestError => e
44
+ return e.http_body if e.http_status == 422
45
+
43
46
  raise
44
47
  end
45
48
  # rubocop:enable Metrics/AbcSize
@@ -48,8 +51,9 @@ module FatZebra
48
51
 
49
52
  def ssl_options
50
53
  return {} unless configurations.http_secure
54
+
51
55
  {
52
- ca_file: File.expand_path(File.dirname(__FILE__) + '/../../vendor/cacert.pem'),
56
+ ca_file: File.expand_path("#{File.dirname(__FILE__)}/../../vendor/cacert.pem"),
53
57
  verify_mode: OpenSSL::SSL::VERIFY_PEER
54
58
  }
55
59
  end
@@ -57,7 +61,7 @@ module FatZebra
57
61
  def authentication
58
62
  {
59
63
  basic_auth: {
60
- user: configurations.username,
64
+ user: configurations.username,
61
65
  password: configurations.token
62
66
  }
63
67
  }
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module FatZebra
2
4
  ##
3
5
  # == FatZebra \Authenticate
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module FatZebra
2
4
  ##
3
5
  # == FatZebra \Bank \Account
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module FatZebra
2
4
  ##
3
5
  # == FatZebra \Batch
@@ -51,8 +53,9 @@ module FatZebra
51
53
  # @return [String] formated as CSV
52
54
  def result(params = {}, options = {})
53
55
  request(:get, "#{resource_path}/#{id}/result.csv", params, options)
54
- rescue FatZebra::RequestError => error
55
- return error.http_body if error.http_status == 422
56
+ rescue FatZebra::RequestError => e
57
+ return e.http_body if e.http_status == 422
58
+
56
59
  raise
57
60
  end
58
61
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module FatZebra
2
4
  ##
3
5
  # == FatZebra \Card
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module FatZebra
2
4
  ##
3
5
  # == FatZebra \Config
@@ -7,7 +9,7 @@ module FatZebra
7
9
 
8
10
  GATEWAY_URLS = {
9
11
  production: 'gateway.fatzebra.com.au',
10
- sandbox: 'gateway.sandbox.fatzebra.com.au'
12
+ sandbox: 'gateway.sandbox.fatzebra.com.au'
11
13
  }.freeze
12
14
 
13
15
  ##
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module FatZebra
2
4
  ##
3
5
  # == FatZebra \Customer
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module FatZebra
2
4
  ##
3
5
  # == FatZebra \Direct \Credit
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module FatZebra
2
4
  ##
3
5
  # == FatZebra \Direct \Debit
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module FatZebra
2
4
 
3
5
  ##
@@ -16,10 +18,7 @@ module FatZebra
16
18
  # Request to API Error
17
19
  class RequestError < StandardError
18
20
 
19
- attr_reader :http_body
20
- attr_reader :http_status
21
- attr_reader :http_status_type
22
- attr_reader :http_message
21
+ attr_reader :http_body, :http_status, :http_status_type, :http_message
23
22
 
24
23
  def initialize(response, message: nil)
25
24
  @http_status = response.code.to_i
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module FatZebra
2
4
  ##
3
5
  # == FatZebra \Object
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module FatZebra
2
4
  ##
3
5
  # == FatZebra \Information
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module FatZebra
2
4
  ##
3
5
  # == Object \Helper
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module FatZebra
2
4
  ##
3
5
  # == FatZebra \Payment \Plan
@@ -24,8 +26,6 @@ module FatZebra
24
26
  validates :start_date, required: true, on: :create
25
27
  validates :frequency, required: true, on: :create
26
28
  validates :anniversary, required: true, on: :create
27
- validates :total_count, required: true, on: :create
28
- validates :total_amount, required: true, on: :create
29
29
 
30
30
  ##
31
31
  # Suspend a payment plan
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module FatZebra
2
4
  ##
3
5
  # == FatZebra \Paypal::Authorization
@@ -16,7 +18,7 @@ module FatZebra
16
18
 
17
19
  class << self
18
20
  def base_path
19
- super + '/paypal/'
21
+ "#{super}/paypal/"
20
22
  end
21
23
 
22
24
  ##
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module FatZebra
2
4
  ##
3
5
  # == FatZebra \Paypal::BillingAgreement
@@ -21,7 +23,7 @@ module FatZebra
21
23
 
22
24
  class << self
23
25
  def base_path
24
- super + '/paypal/'
26
+ "#{super}/paypal/"
25
27
  end
26
28
 
27
29
  ##
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module FatZebra
2
4
  ##
3
5
  # == FatZebra \Paypal::Capture
@@ -15,7 +17,7 @@ module FatZebra
15
17
 
16
18
  class << self
17
19
  def base_path
18
- super + '/paypal/'
20
+ "#{super}/paypal/"
19
21
  end
20
22
 
21
23
  ##
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module FatZebra
2
4
  ##
3
5
  # == FatZebra \Paypal::Order
@@ -14,7 +16,7 @@ module FatZebra
14
16
 
15
17
  class << self
16
18
  def base_path
17
- super + '/paypal/'
19
+ "#{super}/paypal/"
18
20
  end
19
21
  end
20
22
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module FatZebra
2
4
  ##
3
5
  # == FatZebra \Paypal::Refund
@@ -14,7 +16,7 @@ module FatZebra
14
16
 
15
17
  class << self
16
18
  def base_path
17
- super + '/paypal/'
19
+ "#{super}/paypal/"
18
20
  end
19
21
  end
20
22
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module FatZebra
2
4
  ##
3
5
  # == FatZebra \Purchase
@@ -71,8 +73,8 @@ module FatZebra
71
73
  def refund(params = {}, options = {})
72
74
  Refund.create({
73
75
  transaction_id: id,
74
- amount: amount,
75
- reference: reference
76
+ amount: amount,
77
+ reference: reference
76
78
  }.merge(params), options)
77
79
  end
78
80
 
@@ -112,6 +114,7 @@ module FatZebra
112
114
  # @return [Response] Purchase response object
113
115
  def increment!(additional_amount, options = {})
114
116
  raise ArgumentError, 'Amount must be a positive amount' unless additional_amount > 0
117
+
115
118
  response = request(:put, resource_path("purchases/#{id}"), { amount: amount + additional_amount }, options)
116
119
  update_from(response)
117
120
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module FatZebra
2
4
  ##
3
5
  # == FatZebra \Refund
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module FatZebra
2
4
  ##
3
5
  # == FatZebra \Request \Multipart \Epilogue
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module FatZebra
2
4
  ##
3
5
  # == FatZebra \Request \Multipart \FileIO
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module FatZebra
2
4
  ##
3
5
  # == FatZebra \Request \Multipart \Param
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module FatZebra
2
4
  ##
3
5
  # == FatZebra \Request \Multipart \Part
@@ -7,7 +9,7 @@ module FatZebra
7
9
  module Multipart
8
10
  module Part
9
11
 
10
- LINE_BREAK = "\r\n".freeze
12
+ LINE_BREAK = "\r\n"
11
13
 
12
14
  def boundary
13
15
  '----FatZebraMultipartPost'
@@ -1,3 +1,4 @@
1
+ # rubocop:disable Style/FrozenStringLiteralComment
1
2
  module FatZebra
2
3
  ##
3
4
  # == FatZebra \Request \Multipart \Stream
@@ -55,3 +56,5 @@ module FatZebra
55
56
  end
56
57
  end
57
58
  end
59
+
60
+ # rubocop:enable Style/FrozenStringLiteralComment
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'fat_zebra/request/multipart/part'
2
4
  require 'fat_zebra/request/multipart/stream'
3
5
  require 'fat_zebra/request/multipart/epilogue'
@@ -15,13 +17,14 @@ module FatZebra
15
17
  def execute(params = {})
16
18
  klass = new(params)
17
19
 
18
- if params[:method] == :post
20
+ case params[:method]
21
+ when :post
19
22
  klass.post
20
- elsif params[:method] == :put
23
+ when :put
21
24
  klass.put
22
- elsif params[:method] == :delete
25
+ when :delete
23
26
  klass.delete
24
- elsif params[:method] == :get
27
+ when :get
25
28
  klass.get
26
29
  else
27
30
  raise FatZebra::UnknownRequestMethod, "#{params[:method]} haven't been implemented"
@@ -131,7 +134,7 @@ module FatZebra
131
134
  parts << Multipart::Epilogue.new
132
135
 
133
136
  request.content_length = parts.inject(0) { |sum, part| sum + part.length }
134
- request.content_type = 'multipart/form-data; boundary=' + parts.first.boundary
137
+ request.content_type = "multipart/form-data; boundary=#{parts.first.boundary}"
135
138
  request.body_stream = Multipart::Stream.new(parts.map(&:to_io))
136
139
  end
137
140
 
@@ -1,9 +1,11 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module FatZebra
2
4
  module Util
3
5
  class << self
4
6
 
5
- DATE_FORMAT = '%Y/%m/%d'.freeze
6
- REGEXP_HTTP = %r{http[s]?\:\/\/}
7
+ DATE_FORMAT = '%Y/%m/%d'
8
+ REGEXP_HTTP = %r{https?://}.freeze
7
9
 
8
10
  def cleanup_host(uri)
9
11
  uri.to_s.gsub(REGEXP_HTTP, '')
@@ -0,0 +1,35 @@
1
+ # frozen_string_literal: true
2
+
3
+ module FatZebra
4
+ module Utilities
5
+ module Mastercard
6
+ module ClickToPay
7
+ class Registration < APIResource
8
+
9
+ ENDPOINT_URL = '/v1.0/utilities/mastercard/click_to_pay/registration'
10
+
11
+ class << self
12
+
13
+ ##
14
+ # Register with Mastercard Click To Pay
15
+ #
16
+ # @return [FatZebra::Utilities::Mastercard::ClickToPay::Registration] response
17
+ def register!
18
+ response = request(:post, ENDPOINT_URL)
19
+ initialize_from(response)
20
+ end
21
+
22
+ ##
23
+ # Lookup regisrtation with Mastercard Click To Pay
24
+ #
25
+ # @return [FatZebra::Utilities::Mastercard::ClickToPay::Registration] response
26
+ def registered?
27
+ response = request(:get, ENDPOINT_URL)
28
+ initialize_from(response)
29
+ end
30
+ end
31
+ end
32
+ end
33
+ end
34
+ end
35
+ end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module FatZebra
2
4
  module Validation
3
5
 
@@ -39,7 +41,7 @@ module FatZebra
39
41
  errors << "'#{field}' is required" if params[field].nil? || params[field] == ''
40
42
  end
41
43
 
42
- # rubocop:disable Metrics/CyclomaticComplexity
44
+ # rubocop:disable Metrics/CyclomaticComplexity, Lint/MixedRegexpCaptureTypes
43
45
  def validate_type(field, options, params)
44
46
  regexp =
45
47
  case options
@@ -50,9 +52,9 @@ module FatZebra
50
52
  when :positive_integer
51
53
  /\A\d*\z/
52
54
  when :batch_filename
53
- /\ABATCH-(?<version>v\d)-(?<type>[A-Z]*)-((?<merchant_username>[A-Z0-9]*\-?[A-Z0-9]*)-)?(?<process_date>\d{8})-(?<reference>[a-zA-Z0-9\-_]*).csv\z/i
55
+ /\ABATCH-(?<version>v\d)-(?<type>[A-Z]*)-((?<merchant_username>[A-Z0-9]*-?[A-Z0-9]*)-)?(?<process_date>\d{8})-(?<reference>[a-zA-Z0-9\-_]*).csv\z/i
54
56
  when :file_type
55
- /\A\#\<File\:.*\z/
57
+ /\A\#<File:.*\z/
56
58
  when :boolean
57
59
  /\Atrue|false\z/
58
60
  else
@@ -61,7 +63,7 @@ module FatZebra
61
63
 
62
64
  errors << "'#{field}' is not a '#{options}'" unless params[field].to_s =~ regexp
63
65
  end
64
- # rubocop:enable Metrics/CyclomaticComplexity
66
+ # rubocop:enable Metrics/CyclomaticComplexity, Lint/MixedRegexpCaptureTypes
65
67
 
66
68
  end
67
69
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module FatZebra
2
- VERSION = '3.2.4'.freeze
4
+ VERSION = '3.2.6'
3
5
  end