genesis_ruby 0.1.4 → 0.1.5

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 (29) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +11 -0
  3. data/Gemfile.lock +41 -38
  4. data/README.md +18 -0
  5. data/VERSION +1 -1
  6. data/lib/genesis_ruby/api/constants/transactions/parameters/managed_recurring/amount_types.rb +1 -1
  7. data/lib/genesis_ruby/api/mixins/requests/attribute_validation.rb +54 -0
  8. data/lib/genesis_ruby/api/mixins/requests/financial/cards/recurring/recurring_type_attributes.rb +7 -0
  9. data/lib/genesis_ruby/api/request.rb +7 -4
  10. data/lib/genesis_ruby/api/requests/base/financial.rb +27 -0
  11. data/lib/genesis_ruby/api/requests/base/financials/credit_card.rb +4 -0
  12. data/lib/genesis_ruby/api/requests/base/reference.rb +4 -0
  13. data/lib/genesis_ruby/api/requests/financial/capture.rb +0 -1
  14. data/lib/genesis_ruby/api/requests/financial/cards/authorize.rb +6 -1
  15. data/lib/genesis_ruby/api/requests/financial/cards/authorize3d.rb +0 -1
  16. data/lib/genesis_ruby/api/requests/financial/cards/sale.rb +6 -1
  17. data/lib/genesis_ruby/api/requests/financial/cards/sale3d.rb +0 -1
  18. data/lib/genesis_ruby/api/requests/financial/cards/threeds/v2/method_continue.rb +4 -1
  19. data/lib/genesis_ruby/api/requests/financial/refund.rb +0 -2
  20. data/lib/genesis_ruby/api/requests/financial/void.rb +4 -0
  21. data/lib/genesis_ruby/api/requests/non_financial/reconcile/date_range.rb +4 -2
  22. data/lib/genesis_ruby/api/requests/wpf/create.rb +14 -2
  23. data/lib/genesis_ruby/api/requests/wpf/reconcile.rb +4 -0
  24. data/lib/genesis_ruby/api/response.rb +1 -1
  25. data/lib/genesis_ruby/configuration.rb +21 -3
  26. data/lib/genesis_ruby/dependencies.rb +2 -1
  27. data/lib/genesis_ruby/errors/request_error.rb +14 -0
  28. data/lib/genesis_ruby/version.rb +1 -1
  29. metadata +4 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 02dff613f2499bed46dee4d66d10fb64ea987d663d14e1097bb6ab36a444336a
4
- data.tar.gz: bc89246c16d0b2e5b70dbd11c2b35421874ec749e0e6dd2926135850bf37faa7
3
+ metadata.gz: c16e207efd1721cd293a6749709104f57410f684e5bbb3d0b3378001cdfe5d19
4
+ data.tar.gz: 495b1333514eecfc206cac7ae713b9593fdd886233ef840be3af610f499f80c8
5
5
  SHA512:
6
- metadata.gz: 8eacfb3b669fee18642bbeadb3d291ee4e8fd18e45fd45486c954646f3dc7f1cc146321b64cfef6d8bdce9a91c58e13d6e3a4c4a44eb71154a366d54a58a5e6c
7
- data.tar.gz: 7d8eff36538c46f41671c90d71af6af9d8d432c52ddb2238a5b64699956be0a9eabf68fd19c52a03e2310738ce9eb6f918d1c4b1d12dd23c06265cb2c0d7cb2b
6
+ metadata.gz: 58dba79785a36d57714cf28f6b56878cbf2c8a748584bf7c5e0a4440775c77b39db44eb0a3cf645b399aef81ca3e84967ea05be8e513014b7498ae61a078eec4
7
+ data.tar.gz: 8fea90819598e5f3830de518c4a044fbbf2f7c83dc96f56fe1b1b9c2479a157f095fe5ec1cc8b9fddc4de51a80bbaad0167fe9c84df77f5b0e79652fcf6bc5f6
data/CHANGELOG.md CHANGED
@@ -1,3 +1,14 @@
1
+ 0.1.5
2
+ -----
3
+ **Features**:
4
+
5
+ * Added Smart Routing support
6
+ * Added Required field validations to the existing transaction requests
7
+
8
+ **Fixes**:
9
+
10
+ * Fixed JSON parser loading in the Response handling logic
11
+
1
12
  0.1.4
2
13
  -----
3
14
  **Features**:
data/Gemfile.lock CHANGED
@@ -1,24 +1,26 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- genesis_ruby (0.1.4)
4
+ genesis_ruby (0.1.5)
5
5
  net-http (~> 0.3.2)
6
6
  nokogiri (~> 1.14)
7
7
 
8
8
  GEM
9
9
  remote: https://rubygems.org/
10
10
  specs:
11
- addressable (2.8.5)
11
+ addressable (2.8.6)
12
12
  public_suffix (>= 2.0.2, < 6.0)
13
13
  ast (2.4.2)
14
14
  base64 (0.2.0)
15
- concurrent-ruby (1.2.2)
16
- crack (0.4.5)
15
+ bigdecimal (3.1.6)
16
+ concurrent-ruby (1.2.3)
17
+ crack (1.0.0)
18
+ bigdecimal
17
19
  rexml
18
- diff-lcs (1.5.0)
20
+ diff-lcs (1.5.1)
19
21
  faker (2.23.0)
20
22
  i18n (>= 1.8.11, < 2)
21
- faraday (2.7.12)
23
+ faraday (2.8.1)
22
24
  base64
23
25
  faraday-net_http (>= 2.0, < 3.1)
24
26
  ruby2_keywords (>= 0.0.4)
@@ -28,13 +30,13 @@ GEM
28
30
  gitlab (4.19.0)
29
31
  httparty (~> 0.20)
30
32
  terminal-table (>= 1.5.1)
31
- hashdiff (1.0.1)
33
+ hashdiff (1.1.0)
32
34
  httparty (0.21.0)
33
35
  mini_mime (>= 1.0.0)
34
36
  multi_xml (>= 0.5.2)
35
37
  i18n (1.14.1)
36
38
  concurrent-ruby (~> 1.0)
37
- json (2.6.3)
39
+ json (2.7.1)
38
40
  language_server-protocol (3.17.0.3)
39
41
  mini_mime (1.1.5)
40
42
  mini_portile2 (2.8.5)
@@ -49,8 +51,8 @@ GEM
49
51
  octokit (7.2.0)
50
52
  faraday (>= 1, < 3)
51
53
  sawyer (~> 0.9)
52
- parallel (1.23.0)
53
- parser (3.2.2.4)
54
+ parallel (1.24.0)
55
+ parser (3.3.0.5)
54
56
  ast (~> 2.4.1)
55
57
  racc
56
58
  pronto (0.11.2)
@@ -66,70 +68,71 @@ GEM
66
68
  rubocop (>= 0.63.1, < 2.0)
67
69
  public_suffix (5.0.4)
68
70
  racc (1.7.3)
69
- rack (2.2.8)
70
- rack-protection (3.1.0)
71
+ rack (2.2.8.1)
72
+ rack-protection (3.2.0)
73
+ base64 (>= 0.1.0)
71
74
  rack (~> 2.2, >= 2.2.4)
72
75
  rainbow (3.1.1)
73
76
  rake (13.1.0)
74
- regexp_parser (2.8.2)
77
+ regexp_parser (2.9.0)
75
78
  rexml (3.2.6)
76
- rspec (3.12.0)
77
- rspec-core (~> 3.12.0)
78
- rspec-expectations (~> 3.12.0)
79
- rspec-mocks (~> 3.12.0)
80
- rspec-core (3.12.2)
81
- rspec-support (~> 3.12.0)
82
- rspec-expectations (3.12.3)
79
+ rspec (3.13.0)
80
+ rspec-core (~> 3.13.0)
81
+ rspec-expectations (~> 3.13.0)
82
+ rspec-mocks (~> 3.13.0)
83
+ rspec-core (3.13.0)
84
+ rspec-support (~> 3.13.0)
85
+ rspec-expectations (3.13.0)
83
86
  diff-lcs (>= 1.2.0, < 2.0)
84
- rspec-support (~> 3.12.0)
85
- rspec-mocks (3.12.6)
87
+ rspec-support (~> 3.13.0)
88
+ rspec-mocks (3.13.0)
86
89
  diff-lcs (>= 1.2.0, < 2.0)
87
- rspec-support (~> 3.12.0)
88
- rspec-support (3.12.1)
90
+ rspec-support (~> 3.13.0)
91
+ rspec-support (3.13.1)
89
92
  rspec_junit_formatter (0.6.0)
90
93
  rspec-core (>= 2, < 4, != 2.12.0)
91
- rubocop (1.57.2)
94
+ rubocop (1.61.0)
92
95
  json (~> 2.3)
93
96
  language_server-protocol (>= 3.17.0)
94
97
  parallel (~> 1.10)
95
- parser (>= 3.2.2.4)
98
+ parser (>= 3.3.0.2)
96
99
  rainbow (>= 2.2.2, < 4.0)
97
100
  regexp_parser (>= 1.8, < 3.0)
98
101
  rexml (>= 3.2.5, < 4.0)
99
- rubocop-ast (>= 1.28.1, < 2.0)
102
+ rubocop-ast (>= 1.30.0, < 2.0)
100
103
  ruby-progressbar (~> 1.7)
101
104
  unicode-display_width (>= 2.4.0, < 3.0)
102
- rubocop-ast (1.30.0)
103
- parser (>= 3.2.1.0)
104
- rubocop-capybara (2.19.0)
105
+ rubocop-ast (1.31.1)
106
+ parser (>= 3.3.0.4)
107
+ rubocop-capybara (2.20.0)
108
+ rubocop (~> 1.41)
109
+ rubocop-factory_bot (2.25.1)
105
110
  rubocop (~> 1.41)
106
- rubocop-factory_bot (2.24.0)
107
- rubocop (~> 1.33)
108
111
  rubocop-faker (1.1.0)
109
112
  faker (>= 2.12.0)
110
113
  rubocop (>= 0.82.0)
111
- rubocop-rspec (2.25.0)
114
+ rubocop-rspec (2.27.0)
112
115
  rubocop (~> 1.40)
113
116
  rubocop-capybara (~> 2.17)
114
117
  rubocop-factory_bot (~> 2.22)
115
118
  ruby-progressbar (1.13.0)
116
119
  ruby2_keywords (0.0.5)
117
- rugged (1.7.1)
120
+ rugged (1.7.2)
118
121
  sawyer (0.9.2)
119
122
  addressable (>= 2.3.5)
120
123
  faraday (>= 0.17.3, < 3)
121
- sinatra (3.1.0)
124
+ sinatra (3.2.0)
122
125
  mustermann (~> 3.0)
123
126
  rack (~> 2.2, >= 2.2.4)
124
- rack-protection (= 3.1.0)
127
+ rack-protection (= 3.2.0)
125
128
  tilt (~> 2.0)
126
129
  terminal-table (3.0.2)
127
130
  unicode-display_width (>= 1.1.1, < 3)
128
- thor (1.3.0)
131
+ thor (1.3.1)
129
132
  tilt (2.3.0)
130
133
  unicode-display_width (2.5.0)
131
134
  uri (0.13.0)
132
- webmock (3.19.1)
135
+ webmock (3.23.0)
133
136
  addressable (>= 2.8.0)
134
137
  crack (>= 0.3.2)
135
138
  hashdiff (>= 0.4.0, < 2.0.0)
data/README.md CHANGED
@@ -148,6 +148,24 @@ rescue GenesisRuby::Error => error
148
148
  end
149
149
  ```
150
150
 
151
+ ### Smart Router
152
+
153
+ The Smart Routing API is a higher-level abstraction that allows for simpler and more efficient gateway Processing API integration.
154
+ It does not require the terminal token (`configuration.token`). This by itself minimizes the need for complex customer-level manual routing to terminals set up on the gateway platform configuration layer.
155
+
156
+ By default the Smart Router is disabled. Contact your account manager to use the functionality.
157
+
158
+ Smart Router global definition for all requests
159
+ * GenesisRuby::Configuration
160
+ ```ruby
161
+ configuration.force_smart_routing = true
162
+ ```
163
+
164
+ * Smart Router definition per request
165
+ ```ruby
166
+ request.use_smart_router = true
167
+ ```
168
+
151
169
  ### Example 3DSv2 Request
152
170
 
153
171
  Sample request including all the conditionally required/optional params for initiating a 3DS transaction with the 3DSv2-Method authentication protocol.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.4
1
+ 0.1.5
@@ -13,7 +13,7 @@ module GenesisRuby
13
13
  FIXED = 'fixed'.freeze
14
14
 
15
15
  # Amount Type MAX
16
- MAX = 'MAX'.freeze
16
+ MAX = 'max'.freeze
17
17
 
18
18
  end
19
19
  end
@@ -0,0 +1,54 @@
1
+ require 'genesis_ruby/errors/request_error'
2
+
3
+ module GenesisRuby
4
+ module Api
5
+ module Mixins
6
+ module Requests
7
+ # Request Class attribute validations
8
+ # Reads the pre-set `validation_<attribute>` and perform validation on the fields
9
+ module AttributeValidation
10
+
11
+ protected
12
+
13
+ # Perform validation
14
+ def validate
15
+ validate_required_fields
16
+ end
17
+
18
+ # Required Fields Accessor
19
+ def required_fields
20
+ @required_fields ||= []
21
+ end
22
+
23
+ # Required Fields Accessor
24
+ def required_fields=(value)
25
+ raise RequestError, 'Invalid value given for Required Fields! Allowed type Array.' unless value.is_a? Array
26
+
27
+ @required_fields = value
28
+ end
29
+
30
+ private
31
+
32
+ # Validated Required fields
33
+ def validate_required_fields
34
+ required_fields.each do |field_name|
35
+ if null_or_empty_field?(field_name)
36
+ raise ParameterError, "Empty (nil) for required parameter: #{field_name}"
37
+ end
38
+ end
39
+ end
40
+
41
+ # Validate if the given field_name is null or empty
42
+ def null_or_empty_field?(field_name)
43
+ field_value = __send__ field_name.to_sym
44
+
45
+ return false if [Integer, Float, TrueClass, FalseClass, DateTime].any? { |type| field_value.is_a? type }
46
+
47
+ field_value.nil? || field_value.empty?
48
+ end
49
+
50
+ end
51
+ end
52
+ end
53
+ end
54
+ end
@@ -21,6 +21,13 @@ module GenesisRuby
21
21
  allow_empty: true
22
22
  end
23
23
 
24
+ protected
25
+
26
+ # Minimum required fields with recurring_type subsequent request
27
+ def recurring_type_subsequent_required_request_attributes
28
+ %i[transaction_id amount]
29
+ end
30
+
24
31
  end
25
32
  end
26
33
  end
@@ -9,6 +9,9 @@ module GenesisRuby
9
9
  # Base Request Class
10
10
  class Request
11
11
 
12
+ include Mixins::Requests::RestrictedSetter
13
+ include Mixins::Requests::AttributeValidation
14
+
12
15
  PROTOCOL_HTTPS = 'https'.freeze
13
16
  PORT_HTTPS = 443
14
17
 
@@ -46,12 +49,12 @@ module GenesisRuby
46
49
  attr_reader :configuration, :builder_interface, :builder_context
47
50
  attr_accessor :tree_structure
48
51
 
49
- # Request Configuration
50
- def init_configuration; end
51
-
52
52
  # Required fields for the request
53
53
  def init_required_fields; end
54
54
 
55
+ # Request Configuration
56
+ def init_configuration; end
57
+
55
58
  # Pre-defined XML Request Configuration
56
59
  def init_xml_configuration
57
60
  @api_config.load_xml_config
@@ -121,7 +124,7 @@ module GenesisRuby
121
124
 
122
125
  # Perform validation over the defined parameters
123
126
  def check_requirements
124
- # TODO: perform validation over the defined parameters
127
+ validate
125
128
  end
126
129
 
127
130
  # Build the Genesis API endpoint
@@ -7,6 +7,20 @@ module GenesisRuby
7
7
 
8
8
  include Mixins::Requests::Financial::BaseAttributes
9
9
 
10
+ # Use Smart Router endpoint for the current request
11
+ def use_smart_router
12
+ @use_smart_router ||= false
13
+ end
14
+
15
+ # Use Smart Router endpoint for the current request
16
+ def use_smart_router=(value)
17
+ unless [true, false].include? value
18
+ raise InvalidArgumentError, 'Given invalid Use Smart Routing value! Allowed: true, false'
19
+ end
20
+
21
+ @use_smart_router = value
22
+ end
23
+
10
24
  protected
11
25
 
12
26
  # Returns the Request transaction type
@@ -24,6 +38,14 @@ module GenesisRuby
24
38
  super
25
39
  init_xml_configuration
26
40
  init_api_gateway_configuration
41
+ init_api_smart_router_configuration if @configuration.force_smart_routing
42
+ end
43
+
44
+ # Process the request
45
+ def process_request_parameters
46
+ init_api_smart_router_configuration if use_smart_router
47
+
48
+ super
27
49
  end
28
50
 
29
51
  def populate_structure
@@ -37,6 +59,11 @@ module GenesisRuby
37
59
  }
38
60
  end
39
61
 
62
+ # Initialize Smart Router endpoint
63
+ def init_api_smart_router_configuration
64
+ api_config.url = build_request_url({ subdomain: 'smart_router', path: 'transactions' })
65
+ end
66
+
40
67
  end
41
68
  end
42
69
  end
@@ -11,6 +11,10 @@ module GenesisRuby
11
11
  include Mixins::Requests::Financial::Cards::TokenizationAttributes
12
12
  include Mixins::Requests::Financial::PaymentAttributes
13
13
 
14
+ def init_required_fields
15
+ self.required_fields = %i[transaction_id amount currency]
16
+ end
17
+
14
18
  protected
15
19
 
16
20
  # Credit Card attributes
@@ -10,6 +10,10 @@ module GenesisRuby
10
10
 
11
11
  protected
12
12
 
13
+ def init_required_fields
14
+ self.required_fields = %i[transaction_id reference_id amount currency]
15
+ end
16
+
13
17
  # Reference transaction request structure
14
18
  def reference_transaction_structure
15
19
  raise NotImplementedError, 'Reference transaction structure must be implemented.'
@@ -6,7 +6,6 @@ module GenesisRuby
6
6
  class Capture < Requests::Base::Reference
7
7
 
8
8
  include Mixins::Requests::Financial::Business::BusinessAttributes
9
- include Mixins::Requests::RestrictedSetter
10
9
 
11
10
  protected
12
11
 
@@ -23,7 +23,6 @@ module GenesisRuby
23
23
  include Mixins::Requests::Financial::ReferenceAttributes
24
24
  include Mixins::Requests::Financial::RiskAttributes
25
25
  include Mixins::Requests::Financial::ScaAttributes
26
- include Mixins::Requests::RestrictedSetter
27
26
 
28
27
  protected
29
28
 
@@ -32,6 +31,12 @@ module GenesisRuby
32
31
  GenesisRuby::Api::Constants::Transactions::AUTHORIZE
33
32
  end
34
33
 
34
+ def init_required_fields
35
+ return super unless recurring_type == Constants::Transactions::Parameters::Recurring::Types::SUBSEQUENT
36
+
37
+ self.required_fields = recurring_type_subsequent_required_request_attributes
38
+ end
39
+
35
40
  def payment_transaction_structure # rubocop:disable Metrics/MethodLength, Metrics/AbcSize
36
41
  super.merge(
37
42
  gaming: gaming,
@@ -26,7 +26,6 @@ module GenesisRuby
26
26
  include Mixins::Requests::Financial::RiskAttributes
27
27
  include Mixins::Requests::Financial::ScaAttributes
28
28
  include Mixins::Requests::Financial::Threeds::Version2::CommonAttributes
29
- include Mixins::Requests::RestrictedSetter
30
29
 
31
30
  # Specifies the recurring type of transaction
32
31
  def recurring_type=(value)
@@ -22,7 +22,6 @@ module GenesisRuby
22
22
  include Mixins::Requests::Financial::ReferenceAttributes
23
23
  include Mixins::Requests::Financial::RiskAttributes
24
24
  include Mixins::Requests::Financial::ScaAttributes
25
- include Mixins::Requests::RestrictedSetter
26
25
 
27
26
  protected
28
27
 
@@ -31,6 +30,12 @@ module GenesisRuby
31
30
  GenesisRuby::Api::Constants::Transactions::SALE
32
31
  end
33
32
 
33
+ def init_required_fields
34
+ return super unless recurring_type == Constants::Transactions::Parameters::Recurring::Types::SUBSEQUENT
35
+
36
+ self.required_fields = recurring_type_subsequent_required_request_attributes
37
+ end
38
+
34
39
  def payment_transaction_structure # rubocop:disable Metrics/MethodLength, Metrics/AbcSize
35
40
  super.merge(
36
41
  gaming: gaming,
@@ -25,7 +25,6 @@ module GenesisRuby
25
25
  include Mixins::Requests::Financial::RiskAttributes
26
26
  include Mixins::Requests::Financial::ScaAttributes
27
27
  include Mixins::Requests::Financial::Threeds::Version2::CommonAttributes
28
- include Mixins::Requests::RestrictedSetter
29
28
 
30
29
  # Specifies the recurring type of transaction
31
30
  def recurring_type=(value)
@@ -11,7 +11,6 @@ module GenesisRuby
11
11
  class MethodContinue < Request
12
12
 
13
13
  include Mixins::Requests::Financial::PaymentAttributes
14
- include Mixins::Requests::RestrictedSetter
15
14
 
16
15
  attr_writer :url, :transaction_unique_id, :signature
17
16
 
@@ -105,6 +104,10 @@ module GenesisRuby
105
104
  init_api_gateway_configuration request_path: 'threeds/threeds_method/:unique_id', include_token: false
106
105
  end
107
106
 
107
+ def init_required_fields
108
+ self.required_fields = %i[amount transaction_timestamp]
109
+ end
110
+
108
111
  # Build correct endpoint url during runtime
109
112
  def process_request_parameters
110
113
  @api_config.url = url
@@ -7,8 +7,6 @@ module GenesisRuby
7
7
  # Refund reference transaction request
8
8
  class Refund < Requests::Base::Reference
9
9
 
10
- include Mixins::Requests::RestrictedSetter
11
-
12
10
  attr_accessor :beneficiary_bank_code, :beneficiary_name, :beneficiary_account_number, :bank, :bank_branch,
13
11
  :bank_account
14
12
  attr_reader :bank_account_type
@@ -14,6 +14,10 @@ module GenesisRuby
14
14
  Api::Constants::Transactions::VOID
15
15
  end
16
16
 
17
+ def init_required_fields
18
+ self.required_fields = %i[transaction_id reference_id]
19
+ end
20
+
17
21
  # Void transaction request structure
18
22
  def payment_transaction_structure
19
23
  {
@@ -8,8 +8,6 @@ module GenesisRuby
8
8
  # The response is paginated, each request will return 100 entries max.
9
9
  class DateRange < Api::Request
10
10
 
11
- include Mixins::Requests::RestrictedSetter
12
-
13
11
  attr_reader :page
14
12
 
15
13
  # Start of the requested date range (time is optional)
@@ -62,6 +60,10 @@ module GenesisRuby
62
60
  @api_config.parser_skip_root_node = false
63
61
  end
64
62
 
63
+ def init_required_fields
64
+ self.required_fields = %i[start_date]
65
+ end
66
+
65
67
  # API Request structure
66
68
  def populate_structure
67
69
  @tree_structure = {
@@ -6,9 +6,8 @@ module GenesisRuby
6
6
  module Requests
7
7
  module Wpf
8
8
  # Web-Payment Form Request
9
- class Create < Request
9
+ class Create < Request # rubocop:disable Metrics/ClassLength
10
10
 
11
- include Mixins::Requests::RestrictedSetter
12
11
  include Mixins::Requests::Financial::PaymentAttributes
13
12
  include Mixins::Requests::AddressInfoAttributes
14
13
  include Mixins::Requests::Financial::AsyncAttributes
@@ -68,6 +67,19 @@ module GenesisRuby
68
67
  init_api_wpf_configuration
69
68
  end
70
69
 
70
+ def init_required_fields
71
+ self.required_fields = %i[
72
+ transaction_id
73
+ amount
74
+ currency
75
+ notification_url
76
+ return_success_url
77
+ return_failure_url
78
+ return_cancel_url
79
+ transaction_types
80
+ ]
81
+ end
82
+
71
83
  # Perform validation over the defined parameters upon request execution
72
84
  def check_requirements
73
85
  unless GenesisRuby::Api::Constants::Currencies::Iso4217.valid?(currency)
@@ -17,6 +17,10 @@ module GenesisRuby
17
17
  @api_config.url = build_request_url subdomain: 'wpf', path: 'wpf/reconcile'
18
18
  end
19
19
 
20
+ def init_required_fields
21
+ self.required_fields = %i[unique_id]
22
+ end
23
+
20
24
  # WPF Reconcile request structure
21
25
  def populate_structure
22
26
  @tree_structure = {
@@ -54,7 +54,7 @@ module GenesisRuby
54
54
 
55
55
  # Load the corresponding parser based on the Network header
56
56
  def load_parser(network)
57
- @parser = GenesisRuby::Parsers.new(GenesisRuby::Parser::JSON) if network.json?
57
+ @parser = GenesisRuby::Parser.new(GenesisRuby::Parser::JSON) if network.json?
58
58
  @parser = GenesisRuby::Parser.new(GenesisRuby::Parser::XML) if network.xml?
59
59
 
60
60
  raise NetworkError, network.server_message if @parser.nil? || @response_raw.empty?
@@ -59,6 +59,11 @@ module GenesisRuby
59
59
  @timeout ||= DEFAULT_TIMEOUT
60
60
  end
61
61
 
62
+ # Enable Smart Routing for Financial transaction requests
63
+ def force_smart_routing
64
+ @force_smart_routing ||= false
65
+ end
66
+
62
67
  # Genesis Request Timeout
63
68
  def timeout=(value)
64
69
  timeout = value.to_i
@@ -120,6 +125,15 @@ module GenesisRuby
120
125
  @sanitize_response
121
126
  end
122
127
 
128
+ # Enable Smart Routing for Financial transaction requests
129
+ def force_smart_routing=(value)
130
+ unless [true, false].include? value
131
+ raise InvalidArgumentError, 'Given invalid Force Smart Routing value! Allowed: true, false'
132
+ end
133
+
134
+ @force_smart_routing = value
135
+ end
136
+
123
137
  private
124
138
 
125
139
  # Various definitions for environment
@@ -160,15 +174,19 @@ module GenesisRuby
160
174
  # rubocop:enable Metrics/MethodLength
161
175
 
162
176
  # Available Genesis subdomains
163
- def available_sub_domains
177
+ def available_sub_domains # rubocop:disable Metrics/MethodLength
164
178
  {
165
- gateway: {
179
+ gateway: {
166
180
  GenesisRuby::Api::Constants::Environments::PRODUCTION => 'gate.',
167
181
  GenesisRuby::Api::Constants::Environments::STAGING => 'staging.gate.'
168
182
  },
169
- wpf: {
183
+ wpf: {
170
184
  GenesisRuby::Api::Constants::Environments::PRODUCTION => 'wpf.',
171
185
  GenesisRuby::Api::Constants::Environments::STAGING => 'staging.wpf.'
186
+ },
187
+ smart_router: {
188
+ GenesisRuby::Api::Constants::Environments::PRODUCTION => 'prod.api.',
189
+ GenesisRuby::Api::Constants::Environments::STAGING => 'staging.api.'
172
190
  }
173
191
  }
174
192
  end
@@ -1,9 +1,10 @@
1
1
  # =================================
2
2
  # Transaction Request Requirements
3
3
  # =================================
4
+ require 'genesis_ruby/api/mixins/requests/attribute_validation'
5
+ require 'genesis_ruby/api/mixins/requests/restricted_setter'
4
6
  require 'genesis_ruby/api/request'
5
7
  require 'genesis_ruby/api/mixins/constants/common'
6
- require 'genesis_ruby/api/mixins/requests/restricted_setter'
7
8
 
8
9
  # =================================
9
10
  # Transaction Requests Definitions
@@ -0,0 +1,14 @@
1
+ require 'genesis_ruby/errors/error'
2
+
3
+ module GenesisRuby
4
+ # Response Custom Error
5
+ class RequestError < Error
6
+
7
+ def custom_message
8
+ return 'Invalid argument given! ' unless @message
9
+
10
+ @message
11
+ end
12
+
13
+ end
14
+ end
@@ -1,5 +1,5 @@
1
1
  module GenesisRuby
2
2
 
3
- VERSION = '0.1.4'.freeze
3
+ VERSION = '0.1.5'.freeze
4
4
 
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: genesis_ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - emerchantpay Ltd.
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-01-19 00:00:00.000000000 Z
11
+ date: 2024-03-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: net-http
@@ -272,6 +272,7 @@ files:
272
272
  - lib/genesis_ruby/api/constants/transactions/parameters/threeds/version2/sdk/ui_types.rb
273
273
  - lib/genesis_ruby/api/mixins/constants/common.rb
274
274
  - lib/genesis_ruby/api/mixins/requests/address_info_attributes.rb
275
+ - lib/genesis_ruby/api/mixins/requests/attribute_validation.rb
275
276
  - lib/genesis_ruby/api/mixins/requests/customer_address/billing_info_attributes.rb
276
277
  - lib/genesis_ruby/api/mixins/requests/customer_address/customer_info_attributes.rb
277
278
  - lib/genesis_ruby/api/mixins/requests/customer_address/shipping_info_attributes.rb
@@ -349,6 +350,7 @@ files:
349
350
  - lib/genesis_ruby/errors/object_formatter_error.rb
350
351
  - lib/genesis_ruby/errors/parameter_error.rb
351
352
  - lib/genesis_ruby/errors/parser_error.rb
353
+ - lib/genesis_ruby/errors/request_error.rb
352
354
  - lib/genesis_ruby/errors/response_error.rb
353
355
  - lib/genesis_ruby/network/adapter/base_adapter.rb
354
356
  - lib/genesis_ruby/network/adapter/net_http_adapter.rb