genesis_ruby 0.2.7 → 0.2.8
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/CHANGELOG.md +9 -0
- data/Gemfile.lock +1 -1
- data/README.md +2 -0
- data/VERSION +1 -1
- data/lib/genesis_ruby/api/mixins/requests/customer_address/customer_info_attributes.rb +1 -3
- data/lib/genesis_ruby/api/mixins/requests/non_financial/kyc/verification_attributes.rb +1 -3
- data/lib/genesis_ruby/api/mixins/requests/non_financial/tokenization/tokenization_attributes.rb +1 -8
- data/lib/genesis_ruby/api/mixins/requests/restricted_setter.rb +10 -0
- data/lib/genesis_ruby/api/mixins/requests/smart_router_attributes.rb +37 -0
- data/lib/genesis_ruby/api/request.rb +6 -0
- data/lib/genesis_ruby/api/requests/base/financial.rb +1 -21
- data/lib/genesis_ruby/api/requests/non_financial/payee/account/update.rb +59 -0
- data/lib/genesis_ruby/api/requests/non_financial/payee/update.rb +58 -0
- data/lib/genesis_ruby/api/requests/non_financial/reconcile/transaction.rb +8 -0
- data/lib/genesis_ruby/builder.rb +5 -0
- data/lib/genesis_ruby/builders/patch.rb +32 -0
- data/lib/genesis_ruby/network/adapter/net_http_adapter.rb +1 -0
- data/lib/genesis_ruby/utils/options/api_config.rb +11 -0
- data/lib/genesis_ruby/utils/options/network_adapter_config.rb +2 -1
- data/lib/genesis_ruby/version.rb +1 -1
- metadata +6 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 28b3ffc2f8c2cb0705096ebfcccb8875a5c9c38e0d5e2231b5fa1b2cbdb24f67
|
4
|
+
data.tar.gz: 95da15fb47cb68a96da44147e48143a395b06ebd0e64c707564cf0e6045c814d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: daada6305af5b16335f35653ccf946b376811b76c4768b702a4e7d3c1c2456355f123a9baf1d5c07a257e2242d5af303dbcdd9e67330a429f3681e4df6177f02
|
7
|
+
data.tar.gz: b0298a9bff220ecdb6554dfe2a94faecc9cfd4dac03bbe1f1b90dbeb6baa2ff6a2b30c484214be3b385cb3d8d70f55af7485ccb2fd88b86cf0217504f9341338
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -1156,9 +1156,11 @@ GenesisRuby::Api::Requests::NonFinancial::Kyc::Transaction::Create
|
|
1156
1156
|
## Payee API
|
1157
1157
|
GenesisRuby::Api::Requests::NonFinancial::Payee::Create
|
1158
1158
|
GenesisRuby::Api::Requests::NonFinancial::Payee::Retrieve
|
1159
|
+
GenesisRuby::Api::Requests::NonFinancial::Payee::Update
|
1159
1160
|
GenesisRuby::Api::Requests::NonFinancial::Payee::Account::Create
|
1160
1161
|
GenesisRuby::Api::Requests::NonFinancial::Payee::Account::Retrieve
|
1161
1162
|
GenesisRuby::Api::Requests::NonFinancial::Payee::Account::List
|
1163
|
+
GenesisRuby::Api::Requests::NonFinancial::Payee::Account::Update
|
1162
1164
|
|
1163
1165
|
## Chargeback API
|
1164
1166
|
GenesisRuby::Api::Requests::NonFinancial::Fraud::Chargeback::Transaction
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.8
|
@@ -15,9 +15,7 @@ module GenesisRuby
|
|
15
15
|
|
16
16
|
# Email of the customer
|
17
17
|
def customer_email=(value)
|
18
|
-
|
19
|
-
|
20
|
-
@customer_email = value
|
18
|
+
parse_email attribute: __method__, value: value, allow_empty: true
|
21
19
|
end
|
22
20
|
|
23
21
|
end
|
@@ -17,9 +17,7 @@ module GenesisRuby
|
|
17
17
|
|
18
18
|
# User's email
|
19
19
|
def email=(value)
|
20
|
-
|
21
|
-
|
22
|
-
@email = value
|
20
|
+
parse_email attribute: __method__, value: value
|
23
21
|
end
|
24
22
|
|
25
23
|
# Signifies that both sides of the document are required to verify the identity
|
data/lib/genesis_ruby/api/mixins/requests/non_financial/tokenization/tokenization_attributes.rb
CHANGED
@@ -19,14 +19,7 @@ module GenesisRuby
|
|
19
19
|
|
20
20
|
# Consumer e-mail address
|
21
21
|
def email=(value)
|
22
|
-
|
23
|
-
'Invalid value given for %{attribute}',
|
24
|
-
attribute: __method__
|
25
|
-
)
|
26
|
-
|
27
|
-
raise GenesisRuby::ParameterError, error_message unless value.nil? || value =~ /\A.+@.+\..+\Z/
|
28
|
-
|
29
|
-
@email = value
|
22
|
+
parse_email attribute: __method__, value: value, allow_empty: true
|
30
23
|
end
|
31
24
|
|
32
25
|
protected
|
@@ -81,6 +81,16 @@ module GenesisRuby
|
|
81
81
|
assign_instance_variable attribute, value
|
82
82
|
end
|
83
83
|
|
84
|
+
# Parses given value to a valid email address and assign it to the given attribute
|
85
|
+
# If allow_empty is true, it will assign nil if the value is empty
|
86
|
+
def parse_email(attribute:, value:, allow_empty: false)
|
87
|
+
return assign_instance_variable attribute, nil if allow_empty && value.to_s.empty?
|
88
|
+
|
89
|
+
raise InvalidArgumentError, "#{attribute} must be a valid email address." unless value =~ /\A.+@.+\..+\Z/
|
90
|
+
|
91
|
+
assign_instance_variable attribute, value
|
92
|
+
end
|
93
|
+
|
84
94
|
private
|
85
95
|
|
86
96
|
# Helper for assigning a attribute to the class instance
|
@@ -0,0 +1,37 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module GenesisRuby
|
4
|
+
module Api
|
5
|
+
module Mixins
|
6
|
+
module Requests
|
7
|
+
# Smart Router Attributes Mixin
|
8
|
+
module SmartRouterAttributes
|
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
|
+
|
24
|
+
protected
|
25
|
+
|
26
|
+
# Process the request
|
27
|
+
def process_request_parameters
|
28
|
+
init_api_smart_router_configuration if use_smart_router
|
29
|
+
|
30
|
+
super
|
31
|
+
end
|
32
|
+
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -20,6 +20,7 @@ module GenesisRuby
|
|
20
20
|
METHOD_POST = 'POST'
|
21
21
|
METHOD_GET = 'GET'
|
22
22
|
METHOD_PUT = 'PUT'
|
23
|
+
METHOD_PATCH = 'PATCH'
|
23
24
|
|
24
25
|
AUTH_TYPE_BASIC = 'basic'
|
25
26
|
AUTH_TYPE_TOKEN = 'bearer'
|
@@ -85,6 +86,11 @@ module GenesisRuby
|
|
85
86
|
@api_config.load_graphql_config
|
86
87
|
end
|
87
88
|
|
89
|
+
# Pre-defined PATCH Request Configuration
|
90
|
+
def init_patch_configuration
|
91
|
+
@api_config.load_patch_config
|
92
|
+
end
|
93
|
+
|
88
94
|
# Initializes Api EndPoint Url with request path & terminal token
|
89
95
|
def init_api_gateway_configuration(options = { request_path: 'process', include_token: true })
|
90
96
|
request_path = options.fetch :request_path, 'process'
|
@@ -9,20 +9,7 @@ module GenesisRuby
|
|
9
9
|
|
10
10
|
include Mixins::Requests::Financial::BaseAttributes
|
11
11
|
include Mixins::Requests::Financial::PaymentAttributes
|
12
|
-
|
13
|
-
# Use Smart Router endpoint for the current request
|
14
|
-
def use_smart_router
|
15
|
-
@use_smart_router ||= false
|
16
|
-
end
|
17
|
-
|
18
|
-
# Use Smart Router endpoint for the current request
|
19
|
-
def use_smart_router=(value)
|
20
|
-
unless [true, false].include? value
|
21
|
-
raise InvalidArgumentError, 'Given invalid Use Smart Routing value! Allowed: true, false'
|
22
|
-
end
|
23
|
-
|
24
|
-
@use_smart_router = value
|
25
|
-
end
|
12
|
+
include Mixins::Requests::SmartRouterAttributes
|
26
13
|
|
27
14
|
protected
|
28
15
|
|
@@ -44,13 +31,6 @@ module GenesisRuby
|
|
44
31
|
init_api_smart_router_configuration if @configuration.force_smart_routing
|
45
32
|
end
|
46
33
|
|
47
|
-
# Process the request
|
48
|
-
def process_request_parameters
|
49
|
-
init_api_smart_router_configuration if use_smart_router
|
50
|
-
|
51
|
-
super
|
52
|
-
end
|
53
|
-
|
54
34
|
# Populate the request structure
|
55
35
|
def populate_structure
|
56
36
|
self.tree_structure = {
|
@@ -0,0 +1,59 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module GenesisRuby
|
4
|
+
module Api
|
5
|
+
module Requests
|
6
|
+
module NonFinancial
|
7
|
+
module Payee
|
8
|
+
module Account
|
9
|
+
# Update Payee Account
|
10
|
+
class Update < Base::Versioned
|
11
|
+
|
12
|
+
attr_accessor :payee_unique_id, :account_unique_id, :payee_account_country
|
13
|
+
|
14
|
+
# Retrieve Payee initialization
|
15
|
+
def initialize(configuration, _builder_interface = nil)
|
16
|
+
super configuration
|
17
|
+
|
18
|
+
self.request_path = 'payee/:payee_unique_id/account/:account_unique_id'
|
19
|
+
|
20
|
+
init_patch_configuration
|
21
|
+
end
|
22
|
+
|
23
|
+
protected
|
24
|
+
|
25
|
+
# Sets the request field validations
|
26
|
+
def init_field_validations
|
27
|
+
super
|
28
|
+
|
29
|
+
required_fields.push *%i[payee_unique_id account_unique_id payee_account_country]
|
30
|
+
field_values.merge! payee_account_country: GenesisRuby::Utils::Country::COUNTRIES.keys
|
31
|
+
end
|
32
|
+
|
33
|
+
# Returns the request structure
|
34
|
+
def request_structure
|
35
|
+
{
|
36
|
+
account: {
|
37
|
+
country: payee_account_country
|
38
|
+
}
|
39
|
+
}
|
40
|
+
end
|
41
|
+
|
42
|
+
# Override API endpoint configuration
|
43
|
+
def process_request_parameters
|
44
|
+
super
|
45
|
+
|
46
|
+
processed_path = request_path.dup
|
47
|
+
.gsub(':payee_unique_id', payee_unique_id.to_s)
|
48
|
+
.gsub(':account_unique_id', account_unique_id.to_s)
|
49
|
+
|
50
|
+
init_api_service_configuration request_path: processed_path, include_token: false
|
51
|
+
end
|
52
|
+
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
@@ -0,0 +1,58 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module GenesisRuby
|
4
|
+
module Api
|
5
|
+
module Requests
|
6
|
+
module NonFinancial
|
7
|
+
module Payee
|
8
|
+
# Update Payee
|
9
|
+
class Update < Base::Versioned
|
10
|
+
|
11
|
+
attr_accessor :payee_unique_id, :payee_name, :payee_country
|
12
|
+
|
13
|
+
# Retrieve Payee initialization
|
14
|
+
def initialize(configuration, _builder_interface = nil)
|
15
|
+
super configuration
|
16
|
+
|
17
|
+
self.request_path = 'payee/:payee_unique_id'
|
18
|
+
|
19
|
+
init_patch_configuration
|
20
|
+
end
|
21
|
+
|
22
|
+
protected
|
23
|
+
|
24
|
+
# Sets the request field validations
|
25
|
+
def init_field_validations
|
26
|
+
super
|
27
|
+
|
28
|
+
required_fields.push *%i[
|
29
|
+
payee_unique_id
|
30
|
+
]
|
31
|
+
field_values.merge! payee_country: GenesisRuby::Utils::Country::COUNTRIES.keys
|
32
|
+
end
|
33
|
+
|
34
|
+
# Returns the request structure
|
35
|
+
def request_structure
|
36
|
+
{
|
37
|
+
payee: {
|
38
|
+
name: payee_name,
|
39
|
+
country: payee_country
|
40
|
+
}
|
41
|
+
}
|
42
|
+
end
|
43
|
+
|
44
|
+
# Override API endpoint configuration
|
45
|
+
def process_request_parameters
|
46
|
+
super
|
47
|
+
|
48
|
+
processed_path = request_path.dup.gsub(':payee_unique_id', payee_unique_id.to_s)
|
49
|
+
|
50
|
+
init_api_service_configuration request_path: processed_path, include_token: false
|
51
|
+
end
|
52
|
+
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
@@ -10,6 +10,8 @@ module GenesisRuby
|
|
10
10
|
# which returned an error or has changed eg. has beed chargebacked.
|
11
11
|
class Transaction < Api::Request
|
12
12
|
|
13
|
+
include Mixins::Requests::SmartRouterAttributes
|
14
|
+
|
13
15
|
attr_accessor :arn, :transaction_id, :unique_id
|
14
16
|
|
15
17
|
protected
|
@@ -18,6 +20,12 @@ module GenesisRuby
|
|
18
20
|
def init_configuration
|
19
21
|
init_xml_configuration
|
20
22
|
init_api_gateway_configuration request_path: 'reconcile'
|
23
|
+
init_api_smart_router_configuration if @configuration.force_smart_routing
|
24
|
+
end
|
25
|
+
|
26
|
+
# Initialize Smart Router endpoint
|
27
|
+
def init_api_smart_router_configuration
|
28
|
+
api_config.url = build_request_url({ subdomain: 'smart_router', path: 'reconcile' })
|
21
29
|
end
|
22
30
|
|
23
31
|
# API Request structure
|
data/lib/genesis_ruby/builder.rb
CHANGED
@@ -4,6 +4,7 @@ require 'genesis_ruby/builders/xml'
|
|
4
4
|
require 'genesis_ruby/builders/form'
|
5
5
|
require 'genesis_ruby/builders/json'
|
6
6
|
require 'genesis_ruby/builders/graphql'
|
7
|
+
require 'genesis_ruby/builders/patch'
|
7
8
|
require 'genesis_ruby/errors/builder_error'
|
8
9
|
|
9
10
|
module GenesisRuby
|
@@ -22,6 +23,9 @@ module GenesisRuby
|
|
22
23
|
# Builder GraphQL
|
23
24
|
GRAPHQL = 'graphql'
|
24
25
|
|
26
|
+
# Builder PATCH
|
27
|
+
PATCH = 'patch'
|
28
|
+
|
25
29
|
# Initialize the Builder Interface based on the Request requirements
|
26
30
|
def initialize(request_interface)
|
27
31
|
case request_interface
|
@@ -29,6 +33,7 @@ module GenesisRuby
|
|
29
33
|
when FORM then @builder_context = Builders::Form.new
|
30
34
|
when JSON then @builder_context = Builders::Json.new
|
31
35
|
when GRAPHQL then @builder_context = Builders::Graphql.new
|
36
|
+
when PATCH then @builder_context = Builders::Patch.new
|
32
37
|
else
|
33
38
|
raise GenesisRuby::BuilderError, 'Invalid Builder interface!'
|
34
39
|
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'genesis_ruby/builders/base'
|
4
|
+
require 'json'
|
5
|
+
|
6
|
+
module GenesisRuby
|
7
|
+
module Builders
|
8
|
+
# PATCH Document builder
|
9
|
+
class Patch < Base
|
10
|
+
|
11
|
+
# PATCH constructor
|
12
|
+
def initialize
|
13
|
+
@document = ''
|
14
|
+
|
15
|
+
super
|
16
|
+
end
|
17
|
+
|
18
|
+
# PATCH output string
|
19
|
+
def output
|
20
|
+
@document
|
21
|
+
end
|
22
|
+
|
23
|
+
# Generate PATCH document
|
24
|
+
def populate_nodes(structure)
|
25
|
+
@document = JSON.pretty_generate structure
|
26
|
+
rescue StandardError => e
|
27
|
+
raise BuilderError, "Given request structure can not be generated! #{e.message}"
|
28
|
+
end
|
29
|
+
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -32,6 +32,7 @@ module GenesisRuby
|
|
32
32
|
when Api::Request::METHOD_POST then @response = @request.post path, request_data.body, headers
|
33
33
|
when Api::Request::METHOD_PUT then @response = @request.put path, request_data.body, headers
|
34
34
|
when Api::Request::METHOD_GET then @response = @request.get path, headers
|
35
|
+
when Api::Request::METHOD_PATCH then @response = @request.patch path, request_data.body, headers
|
35
36
|
else raise 'Invalid Request Type!'
|
36
37
|
end
|
37
38
|
end
|
@@ -63,6 +63,17 @@ module GenesisRuby
|
|
63
63
|
self.bearer_token = nil
|
64
64
|
end
|
65
65
|
|
66
|
+
# Load pre-defined PATCH configuration
|
67
|
+
def load_patch_config
|
68
|
+
self.protocol = GenesisRuby::Api::Request::PROTOCOL_HTTPS
|
69
|
+
self.port = GenesisRuby::Api::Request::PORT_HTTPS
|
70
|
+
self.type = GenesisRuby::Api::Request::METHOD_PATCH
|
71
|
+
self.format = Builder::PATCH
|
72
|
+
self.parser_skip_root_node = false
|
73
|
+
self.authorization = GenesisRuby::Api::Request::AUTH_TYPE_BASIC
|
74
|
+
self.bearer_token = nil
|
75
|
+
end
|
76
|
+
|
66
77
|
end
|
67
78
|
end
|
68
79
|
end
|
@@ -35,7 +35,8 @@ module GenesisRuby
|
|
35
35
|
when Builder::JSON then 'application/json'
|
36
36
|
when Builder::FORM then 'application/x-www-form-urlencoded'
|
37
37
|
when Builder::GRAPHQL then 'application/graphql'
|
38
|
-
|
38
|
+
when Builder::PATCH then 'application/json'
|
39
|
+
else raise InvalidArgumentError, 'Invalid request format type. Allowed are XML, JSON, FORM AND PATCH'
|
39
40
|
end
|
40
41
|
end
|
41
42
|
|
data/lib/genesis_ruby/version.rb
CHANGED
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.2.
|
4
|
+
version: 0.2.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- emerchantpay Ltd.
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2025-
|
11
|
+
date: 2025-08-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: net-http
|
@@ -416,6 +416,7 @@ files:
|
|
416
416
|
- lib/genesis_ruby/api/mixins/requests/non_financial/tokenization/token_attributes.rb
|
417
417
|
- lib/genesis_ruby/api/mixins/requests/non_financial/tokenization/tokenization_attributes.rb
|
418
418
|
- lib/genesis_ruby/api/mixins/requests/restricted_setter.rb
|
419
|
+
- lib/genesis_ruby/api/mixins/requests/smart_router_attributes.rb
|
419
420
|
- lib/genesis_ruby/api/mixins/requests/wpf_reminders_attributes.rb
|
420
421
|
- lib/genesis_ruby/api/notification.rb
|
421
422
|
- lib/genesis_ruby/api/request.rb
|
@@ -537,8 +538,10 @@ files:
|
|
537
538
|
- lib/genesis_ruby/api/requests/non_financial/payee/account/create.rb
|
538
539
|
- lib/genesis_ruby/api/requests/non_financial/payee/account/list.rb
|
539
540
|
- lib/genesis_ruby/api/requests/non_financial/payee/account/retrieve.rb
|
541
|
+
- lib/genesis_ruby/api/requests/non_financial/payee/account/update.rb
|
540
542
|
- lib/genesis_ruby/api/requests/non_financial/payee/create.rb
|
541
543
|
- lib/genesis_ruby/api/requests/non_financial/payee/retrieve.rb
|
544
|
+
- lib/genesis_ruby/api/requests/non_financial/payee/update.rb
|
542
545
|
- lib/genesis_ruby/api/requests/non_financial/processed_transactions/date_range.rb
|
543
546
|
- lib/genesis_ruby/api/requests/non_financial/processed_transactions/post_date_range.rb
|
544
547
|
- lib/genesis_ruby/api/requests/non_financial/processed_transactions/transaction.rb
|
@@ -560,6 +563,7 @@ files:
|
|
560
563
|
- lib/genesis_ruby/builders/form.rb
|
561
564
|
- lib/genesis_ruby/builders/graphql.rb
|
562
565
|
- lib/genesis_ruby/builders/json.rb
|
566
|
+
- lib/genesis_ruby/builders/patch.rb
|
563
567
|
- lib/genesis_ruby/builders/xml.rb
|
564
568
|
- lib/genesis_ruby/configuration.rb
|
565
569
|
- lib/genesis_ruby/connection.rb
|