genesis_ruby 0.2.1 → 0.2.3
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 +31 -0
- data/Gemfile.lock +50 -41
- data/README.md +20 -0
- data/VERSION +1 -1
- data/lib/genesis_ruby/api/constants/transactions/parameters/non_financial/billing_api/order_by_fields.rb +33 -0
- data/lib/genesis_ruby/api/constants/transactions/parameters/non_financial/billing_api/response_fields.rb +67 -0
- data/lib/genesis_ruby/api/constants/transactions/parameters/non_financial/billing_api/transaction_types.rb +48 -0
- data/lib/genesis_ruby/api/constants/transactions/parameters/non_financial/sort_directions.rb +24 -0
- data/lib/genesis_ruby/api/constants/transactions/parameters/online_banking/payment_types.rb +3 -0
- data/lib/genesis_ruby/api/constants/transactions/parameters/refund/credit_reason_indicators.rb +30 -0
- data/lib/genesis_ruby/api/constants/transactions/parameters/refund/ticket_change_indicators.rb +24 -0
- data/lib/genesis_ruby/api/constants/transactions.rb +5 -0
- data/lib/genesis_ruby/api/mixins/requests/financial/bank_attributes.rb +26 -0
- data/lib/genesis_ruby/api/mixins/requests/financial/cards/installment_attributes.rb +18 -0
- data/lib/genesis_ruby/api/mixins/requests/non_financial/billing_api/sort_attributes.rb +18 -0
- data/lib/genesis_ruby/api/mixins/requests/non_financial/date_attributes.rb +64 -0
- data/lib/genesis_ruby/api/mixins/requests/non_financial/paging_attributes.rb +33 -0
- data/lib/genesis_ruby/api/mixins/requests/restricted_setter.rb +18 -0
- data/lib/genesis_ruby/api/request.rb +21 -1
- data/lib/genesis_ruby/api/requests/base/graphql.rb +60 -0
- data/lib/genesis_ruby/api/requests/base/versioned.rb +88 -0
- data/lib/genesis_ruby/api/requests/financial/capture.rb +6 -3
- data/lib/genesis_ruby/api/requests/financial/cards/authorize.rb +22 -19
- data/lib/genesis_ruby/api/requests/financial/cards/authorize3d.rb +26 -23
- data/lib/genesis_ruby/api/requests/financial/cards/sale.rb +22 -19
- data/lib/genesis_ruby/api/requests/financial/cards/sale3d.rb +26 -23
- data/lib/genesis_ruby/api/requests/financial/online_banking_payments/banco_do_brasil.rb +60 -0
- data/lib/genesis_ruby/api/requests/financial/online_banking_payments/eps.rb +47 -0
- data/lib/genesis_ruby/api/requests/financial/online_banking_payments/idebit/pay_in.rb +55 -0
- data/lib/genesis_ruby/api/requests/financial/online_banking_payments/idebit/pay_out.rb +28 -0
- data/lib/genesis_ruby/api/requests/financial/online_banking_payments/wechat.rb +53 -0
- data/lib/genesis_ruby/api/requests/financial/refund.rb +32 -12
- data/lib/genesis_ruby/api/requests/financial/sdd/recurring/init_recurring_sale.rb +23 -0
- data/lib/genesis_ruby/api/requests/financial/sdd/recurring/recurring_sale.rb +28 -0
- data/lib/genesis_ruby/api/requests/financial/sdd/refund.rb +26 -0
- data/lib/genesis_ruby/api/requests/financial/sdd/sale.rb +61 -0
- data/lib/genesis_ruby/api/requests/financial/wallets/alipay.rb +49 -0
- data/lib/genesis_ruby/api/requests/non_financial/billing_api/transactions.rb +203 -0
- data/lib/genesis_ruby/api/requests/non_financial/installments/fetch.rb +59 -0
- data/lib/genesis_ruby/api/requests/non_financial/installments/show.rb +58 -0
- data/lib/genesis_ruby/api/requests/non_financial/reconcile/date_range.rb +2 -50
- data/lib/genesis_ruby/builder.rb +7 -0
- data/lib/genesis_ruby/builders/graphql.rb +118 -0
- data/lib/genesis_ruby/builders/json.rb +30 -0
- data/lib/genesis_ruby/configuration.rb +11 -2
- data/lib/genesis_ruby/dependencies.rb +3 -0
- data/lib/genesis_ruby/network/adapter/net_http_adapter.rb +22 -6
- data/lib/genesis_ruby/network/base_network.rb +1 -14
- data/lib/genesis_ruby/parser.rb +3 -0
- data/lib/genesis_ruby/parsers/json.rb +18 -0
- data/lib/genesis_ruby/utils/formatters/response/formats/timestamp.rb +1 -1
- data/lib/genesis_ruby/utils/options/api_config.rb +28 -0
- data/lib/genesis_ruby/utils/options/network_adapter_config.rb +49 -14
- data/lib/genesis_ruby/utils/transactions/financial_types.rb +1 -1
- data/lib/genesis_ruby/utils/transactions/references/refundable_types.rb +1 -1
- data/lib/genesis_ruby/utils/transactions/wpf_types.rb +1 -1
- data/lib/genesis_ruby/version.rb +1 -1
- metadata +32 -3
- /data/lib/genesis_ruby/api/requests/financial/wallets/{pay_pay.rb → pay_pal.rb} +0 -0
@@ -0,0 +1,64 @@
|
|
1
|
+
module GenesisRuby
|
2
|
+
module Api
|
3
|
+
module Mixins
|
4
|
+
module Requests
|
5
|
+
module NonFinancial
|
6
|
+
# Date Attributes mixin
|
7
|
+
module DateAttributes
|
8
|
+
|
9
|
+
# Start of the requested date range (time is optional)
|
10
|
+
def start_date
|
11
|
+
format = if start_date_time?
|
12
|
+
Api::Constants::DateTimeFormats::YYYY_MM_DD_H_I_S
|
13
|
+
else
|
14
|
+
Api::Constants::DateTimeFormats::YYYY_MM_DD_ISO_8601
|
15
|
+
end
|
16
|
+
|
17
|
+
@start_date&.strftime format
|
18
|
+
end
|
19
|
+
|
20
|
+
# Start of the requested date range (time is optional)
|
21
|
+
def start_date=(value)
|
22
|
+
self.start_date_time = Utils::Common.date_has_time? value
|
23
|
+
|
24
|
+
parse_date attribute: __method__, value: value, allow_empty: true
|
25
|
+
end
|
26
|
+
|
27
|
+
# Start of the requested date range (time is optional)
|
28
|
+
def end_date
|
29
|
+
format = if end_date_time?
|
30
|
+
Api::Constants::DateTimeFormats::YYYY_MM_DD_H_I_S
|
31
|
+
else
|
32
|
+
Api::Constants::DateTimeFormats::YYYY_MM_DD_ISO_8601
|
33
|
+
end
|
34
|
+
|
35
|
+
@end_date&.strftime format
|
36
|
+
end
|
37
|
+
|
38
|
+
# End of the requested date range (time is optional)
|
39
|
+
def end_date=(value)
|
40
|
+
self.end_date_time = Utils::Common.date_has_time? value
|
41
|
+
|
42
|
+
parse_date attribute: __method__, value: value, allow_empty: true
|
43
|
+
end
|
44
|
+
|
45
|
+
private
|
46
|
+
|
47
|
+
attr_accessor :start_date_time, :end_date_time
|
48
|
+
|
49
|
+
# Start Date has time within the given string
|
50
|
+
def start_date_time?
|
51
|
+
self.start_date_time ||= false
|
52
|
+
end
|
53
|
+
|
54
|
+
# End Date has time within the given string
|
55
|
+
def end_date_time?
|
56
|
+
self.end_date_time ||= false
|
57
|
+
end
|
58
|
+
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
module GenesisRuby
|
2
|
+
module Api
|
3
|
+
module Mixins
|
4
|
+
module Requests
|
5
|
+
module NonFinancial
|
6
|
+
# Paging Attributes mixin
|
7
|
+
module PagingAttributes
|
8
|
+
|
9
|
+
attr_reader :page, :per_page
|
10
|
+
|
11
|
+
# Page accessor
|
12
|
+
def page=(value)
|
13
|
+
parse_int attribute: __method__, value: value, allow_empty: true
|
14
|
+
end
|
15
|
+
|
16
|
+
# Per Page accessor
|
17
|
+
def per_page=(value)
|
18
|
+
parse_int attribute: __method__, value: value, allow_empty: true
|
19
|
+
end
|
20
|
+
|
21
|
+
protected
|
22
|
+
|
23
|
+
# Paging Response fields
|
24
|
+
def paging_query_fields
|
25
|
+
%w(page perPage pagesCount totalCount)
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -61,6 +61,24 @@ module GenesisRuby
|
|
61
61
|
assign_instance_variable attribute, value.to_i
|
62
62
|
end
|
63
63
|
|
64
|
+
# Parses given value by validating if an array is given
|
65
|
+
# Apply .to_s to every array value
|
66
|
+
def parse_array_of_strings(attribute:, value:, allowed: [], allow_empty: false)
|
67
|
+
raise InvalidArgumentError, "#{attribute} accepts only Array value." unless value.is_a?(Array)
|
68
|
+
raise InvalidArgumentError, "#{attribute} empty value not allowed!" if !allow_empty && value.empty?
|
69
|
+
|
70
|
+
parsed_value = value.map(&:to_s)
|
71
|
+
|
72
|
+
unless allowed.empty?
|
73
|
+
diff = parsed_value - allowed
|
74
|
+
message = "#{attribute} has invalid values #{diff.join(", ")}. Allowed: #{allowed.join(", ")}."
|
75
|
+
|
76
|
+
raise InvalidArgumentError, message unless diff.empty?
|
77
|
+
end
|
78
|
+
|
79
|
+
assign_instance_variable attribute, value
|
80
|
+
end
|
81
|
+
|
64
82
|
private
|
65
83
|
|
66
84
|
# Helper for assigning a attribute to the class instance
|
@@ -7,7 +7,7 @@ require 'genesis_ruby/utils/money_format'
|
|
7
7
|
module GenesisRuby
|
8
8
|
module Api
|
9
9
|
# Base Request Class
|
10
|
-
class Request
|
10
|
+
class Request # rubocop:disable Metrics/ClassLength
|
11
11
|
|
12
12
|
include Mixins::Requests::RestrictedSetter
|
13
13
|
include Mixins::Requests::AttributeValidation
|
@@ -19,6 +19,9 @@ module GenesisRuby
|
|
19
19
|
METHOD_GET = 'GET'.freeze
|
20
20
|
METHOD_PUT = 'PUT'.freeze
|
21
21
|
|
22
|
+
AUTH_TYPE_BASIC = 'basic'.freeze
|
23
|
+
AUTH_TYPE_TOKEN = 'bearer'.freeze
|
24
|
+
|
22
25
|
attr_reader :api_config
|
23
26
|
|
24
27
|
def initialize(configuration, builder_interface = 'xml')
|
@@ -70,6 +73,16 @@ module GenesisRuby
|
|
70
73
|
@api_config.load_form_config
|
71
74
|
end
|
72
75
|
|
76
|
+
# Pre-defined GET Request Configuration
|
77
|
+
def init_get_configuration
|
78
|
+
@api_config.load_get_config
|
79
|
+
end
|
80
|
+
|
81
|
+
# Pre-defined GraphQL Request Configuration
|
82
|
+
def init_graphql_configuration
|
83
|
+
@api_config.load_graphql_config
|
84
|
+
end
|
85
|
+
|
73
86
|
# Initializes Api EndPoint Url with request path & terminal token
|
74
87
|
def init_api_gateway_configuration(options = { request_path: 'process', include_token: true })
|
75
88
|
request_path = options.fetch :request_path, 'process'
|
@@ -96,6 +109,13 @@ module GenesisRuby
|
|
96
109
|
)
|
97
110
|
end
|
98
111
|
|
112
|
+
# Initializes API Service Configuration
|
113
|
+
def init_api_service_configuration(options = { request_path: 'graphql' })
|
114
|
+
request_path = options.fetch :request_path, 'graphql'
|
115
|
+
|
116
|
+
api_config.url = build_request_url({ subdomain: 'api_service', path: request_path })
|
117
|
+
end
|
118
|
+
|
99
119
|
# Process Everything the variables set previously
|
100
120
|
#
|
101
121
|
# Step 1: Execute per-field actions
|
@@ -0,0 +1,60 @@
|
|
1
|
+
module GenesisRuby
|
2
|
+
module Api
|
3
|
+
module Requests
|
4
|
+
module Base
|
5
|
+
# Base class for GraphQL API services
|
6
|
+
class Graphql < Versioned
|
7
|
+
|
8
|
+
# GraphQL base class constructor
|
9
|
+
def initialize(configuration, builder_interface = Builder::GRAPHQL)
|
10
|
+
super configuration, builder_interface
|
11
|
+
|
12
|
+
@root_key = 'query'
|
13
|
+
@request_name = ''
|
14
|
+
end
|
15
|
+
|
16
|
+
protected
|
17
|
+
|
18
|
+
attr_accessor :request_name, :root_key
|
19
|
+
|
20
|
+
# Init GraphQL configuration
|
21
|
+
def init_configuration
|
22
|
+
init_graphql_configuration
|
23
|
+
|
24
|
+
init_authorization_token
|
25
|
+
|
26
|
+
init_api_service_configuration request_path: "#{request_path}/#{version}/graphql", include_token: false
|
27
|
+
end
|
28
|
+
|
29
|
+
# Every Request must load the proper token in the Request API Config
|
30
|
+
def init_authorization_token
|
31
|
+
raise NoMethodError, "Authorization token isn't defined for #{self.class.name}"
|
32
|
+
end
|
33
|
+
|
34
|
+
# Response Filters
|
35
|
+
def query_filters
|
36
|
+
raise NoMethodError, "Response Filters isn't defined for #{self.class.name}"
|
37
|
+
end
|
38
|
+
|
39
|
+
# Response Fields
|
40
|
+
def query_response_fields
|
41
|
+
raise NoMethodError, "Response Fields isn't defined for #{self.class.name}"
|
42
|
+
end
|
43
|
+
|
44
|
+
# GraphQL request structure
|
45
|
+
def request_structure
|
46
|
+
Hash[
|
47
|
+
root_key,
|
48
|
+
Hash[
|
49
|
+
:action, request_name,
|
50
|
+
:filters, query_filters,
|
51
|
+
:response_fields, query_response_fields
|
52
|
+
]
|
53
|
+
]
|
54
|
+
end
|
55
|
+
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
@@ -0,0 +1,88 @@
|
|
1
|
+
module GenesisRuby
|
2
|
+
module Api
|
3
|
+
module Requests
|
4
|
+
module Base
|
5
|
+
# Base Versioned Request class used for Non Financial JSON API services
|
6
|
+
class Versioned < Request
|
7
|
+
|
8
|
+
DEFAULT_VERSION = 'v1'.freeze
|
9
|
+
private_constant :DEFAULT_VERSION
|
10
|
+
|
11
|
+
attr_reader :version, :allowed_versions
|
12
|
+
|
13
|
+
# Base Versioned Request constructor
|
14
|
+
def initialize(configuration, builder_interface = Builder::JSON)
|
15
|
+
super configuration, builder_interface
|
16
|
+
|
17
|
+
self.allowed_versions = [DEFAULT_VERSION]
|
18
|
+
self.version = DEFAULT_VERSION
|
19
|
+
self.request_path = ''
|
20
|
+
end
|
21
|
+
|
22
|
+
# Defines the version for the request
|
23
|
+
def version=(value)
|
24
|
+
allowed_options(
|
25
|
+
attribute: __method__,
|
26
|
+
value: value,
|
27
|
+
allowed: allowed_versions,
|
28
|
+
allow_empty: false,
|
29
|
+
error_message: 'Invalid API version! '
|
30
|
+
)
|
31
|
+
|
32
|
+
init_configuration
|
33
|
+
end
|
34
|
+
|
35
|
+
protected
|
36
|
+
|
37
|
+
attr_reader :request_path
|
38
|
+
|
39
|
+
# Every Specific request defines available versions
|
40
|
+
def allowed_versions=(value)
|
41
|
+
raise InvalidArgumentError, 'Allowed versions accepts only Array values' unless value.is_a? Array
|
42
|
+
|
43
|
+
@allowed_versions = value
|
44
|
+
end
|
45
|
+
|
46
|
+
# Defines the endpoint of the request
|
47
|
+
def request_path=(value)
|
48
|
+
@request_path = value.to_s
|
49
|
+
|
50
|
+
init_configuration
|
51
|
+
|
52
|
+
@request_path
|
53
|
+
rescue BuilderError
|
54
|
+
@request_path = ''
|
55
|
+
|
56
|
+
raise InvalidArgumentError, 'The Request can not be configured!'
|
57
|
+
end
|
58
|
+
|
59
|
+
# Initialize Request configuration
|
60
|
+
def init_configuration
|
61
|
+
super
|
62
|
+
|
63
|
+
case @builder_interface
|
64
|
+
when Builder::XML then init_xml_configuration
|
65
|
+
when Builder::JSON then init_json_configuration
|
66
|
+
else raise BuilderError, "Invalid Builder Interface specified for #{self.class.name}"
|
67
|
+
end
|
68
|
+
|
69
|
+
init_api_gateway_configuration request_path: "#{version}/#{request_path}", include_token: false
|
70
|
+
end
|
71
|
+
|
72
|
+
# Request structure. Overridden for common structure parameters
|
73
|
+
def populate_structure
|
74
|
+
super
|
75
|
+
|
76
|
+
@tree_structure = request_structure
|
77
|
+
end
|
78
|
+
|
79
|
+
# Request structure
|
80
|
+
def request_structure
|
81
|
+
raise NoMethodError, 'Request structure must be defined!'
|
82
|
+
end
|
83
|
+
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|
@@ -6,6 +6,7 @@ module GenesisRuby
|
|
6
6
|
class Capture < Requests::Base::Reference
|
7
7
|
|
8
8
|
include Mixins::Requests::Financial::Business::BusinessAttributes
|
9
|
+
include Mixins::Requests::Financial::Cards::InstallmentAttributes
|
9
10
|
include Mixins::Requests::Financial::TravelData::TravelAttributes
|
10
11
|
|
11
12
|
protected
|
@@ -18,9 +19,11 @@ module GenesisRuby
|
|
18
19
|
# Capture Transaction Request Structure
|
19
20
|
def reference_transaction_structure
|
20
21
|
{
|
21
|
-
reference_id:
|
22
|
-
business_attributes:
|
23
|
-
travel:
|
22
|
+
reference_id: reference_id,
|
23
|
+
business_attributes: business_attributes_structure,
|
24
|
+
travel: travel_data_attributes_structure,
|
25
|
+
installment_plan_id: installment_plan_id,
|
26
|
+
installment_plan_reference: installment_plan_reference
|
24
27
|
}
|
25
28
|
end
|
26
29
|
|
@@ -13,6 +13,7 @@ module GenesisRuby
|
|
13
13
|
include Mixins::Requests::DocumentAttributes
|
14
14
|
include Mixins::Requests::Financial::Business::BusinessAttributes
|
15
15
|
include Mixins::Requests::Financial::Cards::FxRateAttributes
|
16
|
+
include Mixins::Requests::Financial::Cards::InstallmentAttributes
|
16
17
|
include Mixins::Requests::Financial::Cards::Recurring::ManagedRecurringAttributes
|
17
18
|
include Mixins::Requests::Financial::Cards::Recurring::RecurringCategoryAttributes
|
18
19
|
include Mixins::Requests::Financial::Cards::Recurring::RecurringTypeAttributes
|
@@ -50,25 +51,27 @@ module GenesisRuby
|
|
50
51
|
|
51
52
|
def payment_transaction_structure # rubocop:disable Metrics/MethodLength, Metrics/AbcSize
|
52
53
|
super.merge(
|
53
|
-
gaming:
|
54
|
-
moto:
|
55
|
-
crypto:
|
56
|
-
customer_email:
|
57
|
-
customer_phone:
|
58
|
-
reference_id:
|
59
|
-
document_id:
|
60
|
-
fx_rate_id:
|
61
|
-
billing_address:
|
62
|
-
shipping_address:
|
63
|
-
risk_params:
|
64
|
-
dynamic_descriptor_params:
|
65
|
-
business_attributes:
|
66
|
-
recurring_type:
|
67
|
-
recurring_category:
|
68
|
-
sca_params:
|
69
|
-
managed_recurring:
|
70
|
-
travel:
|
71
|
-
funding:
|
54
|
+
gaming: gaming,
|
55
|
+
moto: moto,
|
56
|
+
crypto: crypto,
|
57
|
+
customer_email: customer_email,
|
58
|
+
customer_phone: customer_phone,
|
59
|
+
reference_id: reference_id,
|
60
|
+
document_id: document_id,
|
61
|
+
fx_rate_id: fx_rate_id,
|
62
|
+
billing_address: billing_address_parameters_structure,
|
63
|
+
shipping_address: shipping_address_parameters_structure,
|
64
|
+
risk_params: risk_parameters_structure,
|
65
|
+
dynamic_descriptor_params: dynamic_descriptor_structure,
|
66
|
+
business_attributes: business_attributes_structure,
|
67
|
+
recurring_type: recurring_type,
|
68
|
+
recurring_category: recurring_category,
|
69
|
+
sca_params: sca_attributes_structure,
|
70
|
+
managed_recurring: managed_recurring_attributes_structure,
|
71
|
+
travel: travel_data_attributes_structure,
|
72
|
+
funding: funding_attributes_structure,
|
73
|
+
installment_plan_id: installment_plan_id,
|
74
|
+
installment_plan_reference: installment_plan_reference
|
72
75
|
)
|
73
76
|
end
|
74
77
|
|
@@ -14,6 +14,7 @@ module GenesisRuby
|
|
14
14
|
include Mixins::Requests::Financial::AsyncAttributes
|
15
15
|
include Mixins::Requests::Financial::Business::BusinessAttributes
|
16
16
|
include Mixins::Requests::Financial::Cards::FxRateAttributes
|
17
|
+
include Mixins::Requests::Financial::Cards::InstallmentAttributes
|
17
18
|
include Mixins::Requests::Financial::Cards::MpiAttributes
|
18
19
|
include Mixins::Requests::Financial::Cards::Recurring::ManagedRecurringAttributes
|
19
20
|
include Mixins::Requests::Financial::Cards::Recurring::RecurringCategoryAttributes
|
@@ -61,29 +62,31 @@ module GenesisRuby
|
|
61
62
|
# Authorize 3D transaction request parameters
|
62
63
|
def payment_transaction_structure # rubocop:disable Metrics/MethodLength, Metrics/AbcSize
|
63
64
|
super.merge(
|
64
|
-
notification_url:
|
65
|
-
return_success_url:
|
66
|
-
return_failure_url:
|
67
|
-
gaming:
|
68
|
-
moto:
|
69
|
-
crypto:
|
70
|
-
customer_email:
|
71
|
-
customer_phone:
|
72
|
-
document_id:
|
73
|
-
fx_rate_id:
|
74
|
-
billing_address:
|
75
|
-
shipping_address:
|
76
|
-
mpi_params:
|
77
|
-
risk_params:
|
78
|
-
dynamic_descriptor_params:
|
79
|
-
business_attributes:
|
80
|
-
recurring_type:
|
81
|
-
recurring_category:
|
82
|
-
sca_params:
|
83
|
-
threeds_v2_params:
|
84
|
-
managed_recurring:
|
85
|
-
travel:
|
86
|
-
funding:
|
65
|
+
notification_url: notification_url,
|
66
|
+
return_success_url: return_success_url,
|
67
|
+
return_failure_url: return_failure_url,
|
68
|
+
gaming: gaming,
|
69
|
+
moto: moto,
|
70
|
+
crypto: crypto,
|
71
|
+
customer_email: customer_email,
|
72
|
+
customer_phone: customer_phone,
|
73
|
+
document_id: document_id,
|
74
|
+
fx_rate_id: fx_rate_id,
|
75
|
+
billing_address: billing_address_parameters_structure,
|
76
|
+
shipping_address: shipping_address_parameters_structure,
|
77
|
+
mpi_params: mpi_attributes_structure,
|
78
|
+
risk_params: risk_parameters_structure,
|
79
|
+
dynamic_descriptor_params: dynamic_descriptor_structure,
|
80
|
+
business_attributes: business_attributes_structure,
|
81
|
+
recurring_type: recurring_type,
|
82
|
+
recurring_category: recurring_category,
|
83
|
+
sca_params: sca_attributes_structure,
|
84
|
+
threeds_v2_params: threeds_v2_common_attributes_structure,
|
85
|
+
managed_recurring: managed_recurring_attributes_structure,
|
86
|
+
travel: travel_data_attributes_structure,
|
87
|
+
funding: funding_attributes_structure,
|
88
|
+
installment_plan_id: installment_plan_id,
|
89
|
+
installment_plan_reference: installment_plan_reference
|
87
90
|
)
|
88
91
|
end
|
89
92
|
|
@@ -12,6 +12,7 @@ module GenesisRuby
|
|
12
12
|
include Mixins::Requests::DocumentAttributes
|
13
13
|
include Mixins::Requests::Financial::Business::BusinessAttributes
|
14
14
|
include Mixins::Requests::Financial::Cards::FxRateAttributes
|
15
|
+
include Mixins::Requests::Financial::Cards::InstallmentAttributes
|
15
16
|
include Mixins::Requests::Financial::Cards::Recurring::ManagedRecurringAttributes
|
16
17
|
include Mixins::Requests::Financial::Cards::Recurring::RecurringCategoryAttributes
|
17
18
|
include Mixins::Requests::Financial::Cards::Recurring::RecurringTypeAttributes
|
@@ -49,25 +50,27 @@ module GenesisRuby
|
|
49
50
|
|
50
51
|
def payment_transaction_structure # rubocop:disable Metrics/MethodLength, Metrics/AbcSize
|
51
52
|
super.merge(
|
52
|
-
gaming:
|
53
|
-
moto:
|
54
|
-
crypto:
|
55
|
-
customer_email:
|
56
|
-
customer_phone:
|
57
|
-
reference_id:
|
58
|
-
document_id:
|
59
|
-
fx_rate_id:
|
60
|
-
billing_address:
|
61
|
-
shipping_address:
|
62
|
-
risk_params:
|
63
|
-
dynamic_descriptor_params:
|
64
|
-
business_attributes:
|
65
|
-
recurring_type:
|
66
|
-
recurring_category:
|
67
|
-
sca_params:
|
68
|
-
managed_recurring:
|
69
|
-
travel:
|
70
|
-
funding:
|
53
|
+
gaming: gaming,
|
54
|
+
moto: moto,
|
55
|
+
crypto: crypto,
|
56
|
+
customer_email: customer_email,
|
57
|
+
customer_phone: customer_phone,
|
58
|
+
reference_id: reference_id,
|
59
|
+
document_id: document_id,
|
60
|
+
fx_rate_id: fx_rate_id,
|
61
|
+
billing_address: billing_address_parameters_structure,
|
62
|
+
shipping_address: shipping_address_parameters_structure,
|
63
|
+
risk_params: risk_parameters_structure,
|
64
|
+
dynamic_descriptor_params: dynamic_descriptor_structure,
|
65
|
+
business_attributes: business_attributes_structure,
|
66
|
+
recurring_type: recurring_type,
|
67
|
+
recurring_category: recurring_category,
|
68
|
+
sca_params: sca_attributes_structure,
|
69
|
+
managed_recurring: managed_recurring_attributes_structure,
|
70
|
+
travel: travel_data_attributes_structure,
|
71
|
+
funding: funding_attributes_structure,
|
72
|
+
installment_plan_id: installment_plan_id,
|
73
|
+
installment_plan_reference: installment_plan_reference
|
71
74
|
)
|
72
75
|
end
|
73
76
|
|
@@ -13,6 +13,7 @@ module GenesisRuby
|
|
13
13
|
include Mixins::Requests::Financial::AsyncAttributes
|
14
14
|
include Mixins::Requests::Financial::Business::BusinessAttributes
|
15
15
|
include Mixins::Requests::Financial::Cards::FxRateAttributes
|
16
|
+
include Mixins::Requests::Financial::Cards::InstallmentAttributes
|
16
17
|
include Mixins::Requests::Financial::Cards::MpiAttributes
|
17
18
|
include Mixins::Requests::Financial::Cards::Recurring::ManagedRecurringAttributes
|
18
19
|
include Mixins::Requests::Financial::Cards::Recurring::RecurringCategoryAttributes
|
@@ -60,29 +61,31 @@ module GenesisRuby
|
|
60
61
|
# Sale 3D transaction request parameters
|
61
62
|
def payment_transaction_structure # rubocop:disable Metrics/MethodLength, Metrics/AbcSize
|
62
63
|
super.merge(
|
63
|
-
notification_url:
|
64
|
-
return_success_url:
|
65
|
-
return_failure_url:
|
66
|
-
gaming:
|
67
|
-
moto:
|
68
|
-
crypto:
|
69
|
-
customer_email:
|
70
|
-
customer_phone:
|
71
|
-
document_id:
|
72
|
-
fx_rate_id:
|
73
|
-
billing_address:
|
74
|
-
shipping_address:
|
75
|
-
mpi_params:
|
76
|
-
risk_params:
|
77
|
-
dynamic_descriptor_params:
|
78
|
-
business_attributes:
|
79
|
-
recurring_type:
|
80
|
-
recurring_category:
|
81
|
-
sca_params:
|
82
|
-
threeds_v2_params:
|
83
|
-
managed_recurring:
|
84
|
-
travel:
|
85
|
-
funding:
|
64
|
+
notification_url: notification_url,
|
65
|
+
return_success_url: return_success_url,
|
66
|
+
return_failure_url: return_failure_url,
|
67
|
+
gaming: gaming,
|
68
|
+
moto: moto,
|
69
|
+
crypto: crypto,
|
70
|
+
customer_email: customer_email,
|
71
|
+
customer_phone: customer_phone,
|
72
|
+
document_id: document_id,
|
73
|
+
fx_rate_id: fx_rate_id,
|
74
|
+
billing_address: billing_address_parameters_structure,
|
75
|
+
shipping_address: shipping_address_parameters_structure,
|
76
|
+
mpi_params: mpi_attributes_structure,
|
77
|
+
risk_params: risk_parameters_structure,
|
78
|
+
dynamic_descriptor_params: dynamic_descriptor_structure,
|
79
|
+
business_attributes: business_attributes_structure,
|
80
|
+
recurring_type: recurring_type,
|
81
|
+
recurring_category: recurring_category,
|
82
|
+
sca_params: sca_attributes_structure,
|
83
|
+
threeds_v2_params: threeds_v2_common_attributes_structure,
|
84
|
+
managed_recurring: managed_recurring_attributes_structure,
|
85
|
+
travel: travel_data_attributes_structure,
|
86
|
+
funding: funding_attributes_structure,
|
87
|
+
installment_plan_id: installment_plan_id,
|
88
|
+
installment_plan_reference: installment_plan_reference
|
86
89
|
)
|
87
90
|
end
|
88
91
|
|
@@ -0,0 +1,60 @@
|
|
1
|
+
module GenesisRuby
|
2
|
+
module Api
|
3
|
+
module Requests
|
4
|
+
module Financial
|
5
|
+
module OnlineBankingPayments
|
6
|
+
# Banco do Brasil offers online bank transfer payment service
|
7
|
+
class BancoDoBrasil < Base::Financial
|
8
|
+
|
9
|
+
include Api::Mixins::Requests::AddressInfoAttributes
|
10
|
+
include Api::Mixins::Requests::Financial::AsyncAttributes
|
11
|
+
include Api::Mixins::Requests::Financial::PendingPaymentAttributes
|
12
|
+
include Api::Mixins::Requests::BirthDateAttributes
|
13
|
+
include Api::Mixins::Requests::Financial::PaymentAttributes
|
14
|
+
include Api::Mixins::Requests::Financial::ConsumerIdentifierAttributes
|
15
|
+
|
16
|
+
protected
|
17
|
+
|
18
|
+
# Banco do Brasil transaction type
|
19
|
+
def transaction_type
|
20
|
+
Api::Constants::Transactions::BANCO_DO_BRASIL
|
21
|
+
end
|
22
|
+
|
23
|
+
# Allowed billing country for Banco do Brasil transaction request
|
24
|
+
def allowed_billing_countries
|
25
|
+
%w(BR)
|
26
|
+
end
|
27
|
+
|
28
|
+
# Banco Do Brasil field validations
|
29
|
+
def init_field_validations
|
30
|
+
super
|
31
|
+
|
32
|
+
required_fields.push *%i[transaction_id return_success_url return_failure_url
|
33
|
+
amount currency consumer_reference national_id customer_email billing_country]
|
34
|
+
|
35
|
+
field_values.merge! billing_country: allowed_billing_countries
|
36
|
+
end
|
37
|
+
|
38
|
+
# Banco do Brasil request structure
|
39
|
+
def payment_transaction_structure # rubocop:disable Metrics/MethodLength
|
40
|
+
payment_attributes_structure.merge(
|
41
|
+
{
|
42
|
+
return_success_url: return_success_url,
|
43
|
+
return_failure_url: return_failure_url,
|
44
|
+
return_pending_url: return_pending_url,
|
45
|
+
consumer_reference: consumer_reference,
|
46
|
+
national_id: national_id,
|
47
|
+
birth_date: birth_date,
|
48
|
+
customer_email: customer_email,
|
49
|
+
billing_address: billing_address_parameters_structure,
|
50
|
+
shipping_address: shipping_address_parameters_structure
|
51
|
+
}
|
52
|
+
)
|
53
|
+
end
|
54
|
+
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|