genesis_ruby 0.1.7 → 0.1.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +41 -0
- data/Gemfile.lock +45 -39
- data/README.md +246 -0
- data/VERSION +1 -1
- data/lib/genesis_ruby/api/constants/transactions/parameters/cash_payments/company_types.rb +45 -0
- data/lib/genesis_ruby/api/constants/transactions/parameters/cash_payments/genders.rb +27 -0
- data/lib/genesis_ruby/api/constants/transactions/parameters/cash_payments/marital_statuses.rb +39 -0
- data/lib/genesis_ruby/api/constants/transactions/parameters/mobile/apple_pay/payment_subtypes.rb +29 -0
- data/lib/genesis_ruby/api/constants/transactions/parameters/mobile/google_pay/payment_subtypes.rb +29 -0
- data/lib/genesis_ruby/api/constants/transactions/parameters/online_banking/bank_code_currencies.rb +128 -0
- data/lib/genesis_ruby/api/constants/transactions/parameters/online_banking/bank_codes.rb +600 -0
- data/lib/genesis_ruby/api/constants/transactions/parameters/online_banking/payment_types.rb +36 -0
- data/lib/genesis_ruby/api/constants/transactions/parameters/wallets/pay_pal/payment_types.rb +31 -0
- data/lib/genesis_ruby/api/mixins/requests/attribute_validation.rb +138 -4
- data/lib/genesis_ruby/api/mixins/requests/birth_date_attributes.rb +22 -0
- data/lib/genesis_ruby/api/mixins/requests/customer_address/billing_info_attributes.rb +11 -10
- data/lib/genesis_ruby/api/mixins/requests/customer_address/customer_info_attributes.rb +1 -1
- data/lib/genesis_ruby/api/mixins/requests/customer_address/shipping_info_attributes.rb +11 -10
- data/lib/genesis_ruby/api/mixins/requests/financial/cards/credit_card_attributes.rb +7 -0
- data/lib/genesis_ruby/api/mixins/requests/financial/cards/recurring/managed_recurring_attributes.rb +21 -20
- data/lib/genesis_ruby/api/mixins/requests/financial/cards/recurring/managed_recurring_indian_card_attributes.rb +15 -39
- data/lib/genesis_ruby/api/mixins/requests/financial/cards/recurring/recurring_type_attributes.rb +15 -9
- data/lib/genesis_ruby/api/mixins/requests/financial/cards/tokenization_attributes.rb +9 -0
- data/lib/genesis_ruby/api/mixins/requests/financial/consumer_identifier_attributes.rb +26 -0
- data/lib/genesis_ruby/api/mixins/requests/financial/mobile/apple_pay_token_attributes.rb +51 -0
- data/lib/genesis_ruby/api/mixins/requests/financial/mobile/google_pay_token_attributes.rb +50 -0
- data/lib/genesis_ruby/api/mixins/requests/financial/online_banking_payments/virtual_payment_address_attributes.rb +27 -0
- data/lib/genesis_ruby/api/mixins/requests/financial/threeds/version2/browser.rb +11 -22
- data/lib/genesis_ruby/api/mixins/requests/financial/threeds/version2/card_holder_account.rb +81 -49
- data/lib/genesis_ruby/api/mixins/requests/financial/threeds/version2/common_attributes.rb +23 -0
- data/lib/genesis_ruby/api/mixins/requests/financial/threeds/version2/control.rb +13 -26
- data/lib/genesis_ruby/api/mixins/requests/financial/threeds/version2/merchant_risk.rb +21 -58
- data/lib/genesis_ruby/api/mixins/requests/financial/threeds/version2/purchase.rb +8 -11
- data/lib/genesis_ruby/api/mixins/requests/financial/threeds/version2/sdk.rb +10 -10
- data/lib/genesis_ruby/api/mixins/requests/financial/threeds/version2/wpf_attributes.rb +9 -0
- data/lib/genesis_ruby/api/request.rb +4 -2
- data/lib/genesis_ruby/api/requests/base/financials/credit_card.rb +6 -4
- data/lib/genesis_ruby/api/requests/base/financials/south_american_payments.rb +59 -0
- data/lib/genesis_ruby/api/requests/base/reference.rb +3 -2
- data/lib/genesis_ruby/api/requests/financial/cards/argencard.rb +26 -0
- data/lib/genesis_ruby/api/requests/financial/cards/aura.rb +26 -0
- data/lib/genesis_ruby/api/requests/financial/cards/authorize.rb +10 -2
- data/lib/genesis_ruby/api/requests/financial/cards/authorize3d.rb +19 -10
- data/lib/genesis_ruby/api/requests/financial/cards/cabal.rb +26 -0
- data/lib/genesis_ruby/api/requests/financial/cards/cencosud.rb +26 -0
- data/lib/genesis_ruby/api/requests/financial/cards/elo.rb +26 -0
- data/lib/genesis_ruby/api/requests/financial/cards/naranja.rb +26 -0
- data/lib/genesis_ruby/api/requests/financial/cards/nativa.rb +26 -0
- data/lib/genesis_ruby/api/requests/financial/cards/sale.rb +10 -2
- data/lib/genesis_ruby/api/requests/financial/cards/sale3d.rb +19 -10
- data/lib/genesis_ruby/api/requests/financial/cards/tarjeta_shopping.rb +26 -0
- data/lib/genesis_ruby/api/requests/financial/cards/threeds/v2/method_continue.rb +2 -2
- data/lib/genesis_ruby/api/requests/financial/cash_payments/baloto.rb +26 -0
- data/lib/genesis_ruby/api/requests/financial/cash_payments/banco_de_occidente.rb +26 -0
- data/lib/genesis_ruby/api/requests/financial/cash_payments/boleto.rb +26 -0
- data/lib/genesis_ruby/api/requests/financial/cash_payments/efecty.rb +26 -0
- data/lib/genesis_ruby/api/requests/financial/cash_payments/oxxo.rb +26 -0
- data/lib/genesis_ruby/api/requests/financial/cash_payments/pago_facil.rb +26 -0
- data/lib/genesis_ruby/api/requests/financial/cash_payments/pix.rb +92 -0
- data/lib/genesis_ruby/api/requests/financial/cash_payments/redpagos.rb +26 -0
- data/lib/genesis_ruby/api/requests/financial/mobile/apple_pay.rb +91 -0
- data/lib/genesis_ruby/api/requests/financial/mobile/google_pay.rb +108 -0
- data/lib/genesis_ruby/api/requests/financial/online_banking_payments/bancomer.rb +33 -0
- data/lib/genesis_ruby/api/requests/financial/online_banking_payments/bradesco.rb +33 -0
- data/lib/genesis_ruby/api/requests/financial/online_banking_payments/davivienda.rb +34 -0
- data/lib/genesis_ruby/api/requests/financial/online_banking_payments/itau.rb +33 -0
- data/lib/genesis_ruby/api/requests/financial/online_banking_payments/online_banking/pay_in.rb +157 -0
- data/lib/genesis_ruby/api/requests/financial/online_banking_payments/pse.rb +33 -0
- data/lib/genesis_ruby/api/requests/financial/online_banking_payments/rapi_pago.rb +33 -0
- data/lib/genesis_ruby/api/requests/financial/online_banking_payments/santander.rb +33 -0
- data/lib/genesis_ruby/api/requests/financial/online_banking_payments/webpay.rb +33 -0
- data/lib/genesis_ruby/api/requests/financial/void.rb +2 -2
- data/lib/genesis_ruby/api/requests/financial/wallets/pay_pay.rb +65 -0
- data/lib/genesis_ruby/api/requests/non_financial/reconcile/date_range.rb +2 -2
- data/lib/genesis_ruby/api/requests/wpf/create.rb +11 -15
- data/lib/genesis_ruby/api/requests/wpf/reconcile.rb +2 -2
- data/lib/genesis_ruby/dependencies.rb +1 -0
- data/lib/genesis_ruby/utils/common.rb +26 -0
- data/lib/genesis_ruby/version.rb +1 -1
- metadata +46 -3
@@ -11,10 +11,10 @@ module GenesisRuby
|
|
11
11
|
# Mixin ThreedsV2 Browser Attributes
|
12
12
|
module Browser
|
13
13
|
|
14
|
-
attr_reader :threeds_v2_browser_accept_header, :
|
15
|
-
:threeds_v2_browser_language, :threeds_v2_browser_color_depth,
|
14
|
+
attr_reader :threeds_v2_browser_accept_header, :threeds_v2_browser_language,
|
16
15
|
:threeds_v2_browser_screen_height, :threeds_v2_browser_screen_width,
|
17
16
|
:threeds_v2_browser_time_zone_offset, :threeds_v2_browser_user_agent
|
17
|
+
attr_accessor :threeds_v2_browser_color_depth, :threeds_v2_browser_java_enabled
|
18
18
|
|
19
19
|
# Exact content of the HTTP accept headers as sent to the 3DS Requester from the Cardholder browser
|
20
20
|
def threeds_v2_browser_accept_header=(value)
|
@@ -26,17 +26,6 @@ module GenesisRuby
|
|
26
26
|
limited_string attribute: __method__, value: value.to_s.empty? ? nil : value.to_s, max: 8
|
27
27
|
end
|
28
28
|
|
29
|
-
# Value representing the bit depth of the colour palette for displaying images, in bits per pixel
|
30
|
-
def threeds_v2_browser_color_depth=(value)
|
31
|
-
allowed_depths = GenesisRuby::Api::Constants::Transactions::Parameters::Threeds::Version2::
|
32
|
-
Browser::ColorDepths.all
|
33
|
-
|
34
|
-
allowed_options attribute: __method__,
|
35
|
-
allowed: allowed_depths,
|
36
|
-
value: value.to_s.empty? ? nil : value.to_i,
|
37
|
-
allow_empty: true
|
38
|
-
end
|
39
|
-
|
40
29
|
# Total height of the Cardholder's screen in pixels
|
41
30
|
def threeds_v2_browser_screen_height=(value)
|
42
31
|
parse_int attribute: __method__, value: value, allow_empty: true
|
@@ -47,15 +36,6 @@ module GenesisRuby
|
|
47
36
|
parse_int attribute: __method__, value: value, allow_empty: true
|
48
37
|
end
|
49
38
|
|
50
|
-
# Boolean that represents the ability of the cardholder browser to execute Java
|
51
|
-
def threeds_v2_browser_java_enabled=(value)
|
52
|
-
allowed_options attribute: __method__,
|
53
|
-
allowed: [true, false],
|
54
|
-
value: value,
|
55
|
-
allow_empty: true,
|
56
|
-
error_message: 'Accepts only boolean values'
|
57
|
-
end
|
58
|
-
|
59
39
|
# Time difference between UTC time and the Cardholder browser local time, in minutes
|
60
40
|
def threeds_v2_browser_time_zone_offset=(value)
|
61
41
|
limited_string attribute: __method__, value: value.to_s.empty? ? nil : value.to_s, max: 5
|
@@ -68,6 +48,15 @@ module GenesisRuby
|
|
68
48
|
|
69
49
|
protected
|
70
50
|
|
51
|
+
# Browser filed validations structure
|
52
|
+
def threeds_browser_field_validations
|
53
|
+
{
|
54
|
+
threeds_v2_browser_color_depth: Api::Constants::Transactions::Parameters::Threeds::Version2::
|
55
|
+
Browser::ColorDepths.all,
|
56
|
+
threeds_v2_browser_java_enabled: [true, false]
|
57
|
+
}
|
58
|
+
end
|
59
|
+
|
71
60
|
# Request Browser Attributes structure
|
72
61
|
def browser_attributes
|
73
62
|
{
|
@@ -17,15 +17,15 @@ module GenesisRuby
|
|
17
17
|
# Mixin ThreedsV2 Card holder Account
|
18
18
|
module CardHolderAccount # rubocop:disable Metrics/ModuleLength
|
19
19
|
|
20
|
-
attr_reader :
|
21
|
-
:threeds_v2_card_holder_account_password_change_indicator,
|
22
|
-
:threeds_v2_card_holder_account_shipping_address_usage_indicator,
|
23
|
-
:threeds_v2_card_holder_account_transactions_activity_last24_hours,
|
20
|
+
attr_reader :threeds_v2_card_holder_account_transactions_activity_last24_hours,
|
24
21
|
:threeds_v2_card_holder_account_transactions_activity_previous_year,
|
25
22
|
:threeds_v2_card_holder_account_provision_attempts_last24_hours,
|
26
|
-
:threeds_v2_card_holder_account_purchases_count_last6_months
|
27
|
-
|
28
|
-
|
23
|
+
:threeds_v2_card_holder_account_purchases_count_last6_months
|
24
|
+
attr_accessor :threeds_v2_card_holder_account_update_indicator,
|
25
|
+
:threeds_v2_card_holder_account_password_change_indicator,
|
26
|
+
:threeds_v2_card_holder_account_shipping_address_usage_indicator,
|
27
|
+
:threeds_v2_card_holder_account_suspicious_activity_indicator,
|
28
|
+
:threeds_v2_card_holder_account_registration_indicator
|
29
29
|
|
30
30
|
# Date that the cardholder opened the account with the 3DS Requester.
|
31
31
|
def threeds_v2_card_holder_account_creation_date
|
@@ -39,14 +39,6 @@ module GenesisRuby
|
|
39
39
|
parse_date attribute: __method__, value: value, allow_empty: true
|
40
40
|
end
|
41
41
|
|
42
|
-
# Length of time since the cardholder’s account information with the 3DS Requester was last changed
|
43
|
-
def threeds_v2_card_holder_account_update_indicator=(value)
|
44
|
-
allowed_indicators = GenesisRuby::Api::Constants::Transactions::Parameters::Threeds::Version2::
|
45
|
-
CardHolderAccount::UpdateIndicators.all
|
46
|
-
|
47
|
-
allowed_options attribute: __method__, allowed: allowed_indicators, value: value, allow_empty: true
|
48
|
-
end
|
49
|
-
|
50
42
|
# Date that the cardholder’s account with the 3DS Requester was last changed
|
51
43
|
def threeds_v2_card_holder_account_last_change_date
|
52
44
|
@threeds_v2_card_holder_account_last_change_date&.strftime(
|
@@ -59,15 +51,6 @@ module GenesisRuby
|
|
59
51
|
parse_date attribute: __method__, value: value, allow_empty: true
|
60
52
|
end
|
61
53
|
|
62
|
-
# Length of time since the cardholder account with the 3DS Requester had a password change or
|
63
|
-
# account reset
|
64
|
-
def threeds_v2_card_holder_account_password_change_indicator=(value)
|
65
|
-
allowed_indicators = GenesisRuby::Api::Constants::Transactions::Parameters::Threeds::Version2::
|
66
|
-
CardHolderAccount::PasswordChangeIndicators.all
|
67
|
-
|
68
|
-
allowed_options attribute: __method__, allowed: allowed_indicators, value: value, allow_empty: true
|
69
|
-
end
|
70
|
-
|
71
54
|
# Date that cardholder’s account with the 3DS Requester had a password change or account reset
|
72
55
|
def threeds_v2_card_holder_account_password_change_date
|
73
56
|
@threeds_v2_card_holder_account_password_change_date&.strftime(
|
@@ -80,14 +63,6 @@ module GenesisRuby
|
|
80
63
|
parse_date attribute: __method__, value: value, allow_empty: true
|
81
64
|
end
|
82
65
|
|
83
|
-
# Indicates when the shipping address used for this transaction was first used with the 3DS Requester
|
84
|
-
def threeds_v2_card_holder_account_shipping_address_usage_indicator=(value)
|
85
|
-
allowed_indicators = GenesisRuby::Api::Constants::Transactions::Parameters::Threeds::Version2::
|
86
|
-
CardHolderAccount::ShippingAddressUsageIndicators.all
|
87
|
-
|
88
|
-
allowed_options attribute: __method__, allowed: allowed_indicators, value: value, allow_empty: true
|
89
|
-
end
|
90
|
-
|
91
66
|
# Date when the shipping address used for this transaction was first used with the 3DS Requester
|
92
67
|
def threeds_v2_card_holder_account_shipping_address_date_first_used
|
93
68
|
@threeds_v2_card_holder_account_shipping_address_date_first_used&.strftime(
|
@@ -120,23 +95,6 @@ module GenesisRuby
|
|
120
95
|
parse_int attribute: __method__, value: value, allow_empty: true
|
121
96
|
end
|
122
97
|
|
123
|
-
# Indicates whether the 3DS Requester has experienced suspicious activity (including previous fraud)
|
124
|
-
def threeds_v2_card_holder_account_suspicious_activity_indicator=(value)
|
125
|
-
allowed_indicators = GenesisRuby::Api::Constants::Transactions::Parameters::Threeds::Version2::
|
126
|
-
CardHolderAccount::SuspiciousActivityIndicators.all
|
127
|
-
|
128
|
-
allowed_options attribute: __method__, allowed: allowed_indicators, value: value, allow_empty: true
|
129
|
-
end
|
130
|
-
|
131
|
-
# Indicates the length of time that the payment account was enrolled in the
|
132
|
-
# cardholder’s account with the 3DS Requester
|
133
|
-
def threeds_v2_card_holder_account_registration_indicator=(value)
|
134
|
-
allowed_indicators = GenesisRuby::Api::Constants::Transactions::Parameters::Threeds::Version2::
|
135
|
-
CardHolderAccount::RegistrationIndicators.all
|
136
|
-
|
137
|
-
allowed_options attribute: __method__, allowed: allowed_indicators, value: value, allow_empty: true
|
138
|
-
end
|
139
|
-
|
140
98
|
# Date that the cardholder opened the account with the 3DS Requester.
|
141
99
|
def threeds_v2_card_holder_account_registration_date
|
142
100
|
@threeds_v2_card_holder_account_registration_date&.strftime(
|
@@ -151,6 +109,33 @@ module GenesisRuby
|
|
151
109
|
|
152
110
|
protected
|
153
111
|
|
112
|
+
# Card Holder field validations structure
|
113
|
+
def threeds_card_holder_field_validations # rubocop:disable Metrics/MethodLength
|
114
|
+
{
|
115
|
+
threeds_v2_card_holder_account_update_indicator: Api::Constants::Transactions::
|
116
|
+
Parameters::Threeds::Version2::CardHolderAccount::UpdateIndicators.all,
|
117
|
+
threeds_v2_card_holder_account_password_change_indicator: Api::Constants::Transactions::
|
118
|
+
Parameters::Threeds::Version2::CardHolderAccount::PasswordChangeIndicators.all,
|
119
|
+
threeds_v2_card_holder_account_shipping_address_usage_indicator: Api::Constants::Transactions::
|
120
|
+
Parameters::Threeds::Version2::CardHolderAccount::ShippingAddressUsageIndicators.all,
|
121
|
+
threeds_v2_card_holder_account_suspicious_activity_indicator: Api::Constants::Transactions::
|
122
|
+
Parameters::Threeds::Version2::CardHolderAccount::SuspiciousActivityIndicators.all,
|
123
|
+
threeds_v2_card_holder_account_registration_indicator: Api::Constants::Transactions::
|
124
|
+
Parameters::Threeds::Version2::CardHolderAccount::RegistrationIndicators.all
|
125
|
+
}
|
126
|
+
end
|
127
|
+
|
128
|
+
def validate_threeds_card_holder_dates
|
129
|
+
today = DateTime.now
|
130
|
+
message = 'must be a valid date in the past.'
|
131
|
+
|
132
|
+
validate_creation_date today, message
|
133
|
+
validate_last_change_date today, message
|
134
|
+
validate_password_change_date today, message
|
135
|
+
validate_shipping_address_date_first_used today, message
|
136
|
+
validate_registration_date today, message
|
137
|
+
end
|
138
|
+
|
154
139
|
# Request CardHolder Account Attributes structure
|
155
140
|
# rubocop:disable Layout/LineLength, Metrics/MethodLength
|
156
141
|
def card_holder_account_attributes
|
@@ -173,6 +158,53 @@ module GenesisRuby
|
|
173
158
|
end
|
174
159
|
# rubocop:enable Layout/LineLength, Metrics/MethodLength
|
175
160
|
|
161
|
+
private
|
162
|
+
|
163
|
+
# Creation Date Validation
|
164
|
+
def validate_creation_date(less_than, message)
|
165
|
+
return unless @threeds_v2_card_holder_account_creation_date.is_a? DateTime
|
166
|
+
|
167
|
+
return if @threeds_v2_card_holder_account_creation_date < less_than
|
168
|
+
|
169
|
+
raise ParameterError, "Card Holder Account Creation Date #{message}"
|
170
|
+
end
|
171
|
+
|
172
|
+
# Last Change Date validation
|
173
|
+
def validate_last_change_date(less_than, message)
|
174
|
+
return unless @threeds_v2_card_holder_account_last_change_date.is_a? DateTime
|
175
|
+
|
176
|
+
return if @threeds_v2_card_holder_account_last_change_date < less_than
|
177
|
+
|
178
|
+
raise ParameterError, "Card Holder Account Last Change Date #{message}"
|
179
|
+
end
|
180
|
+
|
181
|
+
# Password Change Date validation
|
182
|
+
def validate_password_change_date(less_than, message)
|
183
|
+
return unless @threeds_v2_card_holder_account_password_change_date.is_a? DateTime
|
184
|
+
|
185
|
+
return if @threeds_v2_card_holder_account_password_change_date < less_than
|
186
|
+
|
187
|
+
raise ParameterError, "Card Holder Account Password Change Date #{message}"
|
188
|
+
end
|
189
|
+
|
190
|
+
# Shipping Address Date First Used validation
|
191
|
+
def validate_shipping_address_date_first_used(less_than, message)
|
192
|
+
return unless @threeds_v2_card_holder_account_shipping_address_date_first_used.is_a? DateTime
|
193
|
+
|
194
|
+
return if @threeds_v2_card_holder_account_shipping_address_date_first_used < less_than
|
195
|
+
|
196
|
+
raise ParameterError, "Card Holder Account Shipping Address Date First Used #{message}"
|
197
|
+
end
|
198
|
+
|
199
|
+
# Registration Date validations
|
200
|
+
def validate_registration_date(less_than, message)
|
201
|
+
return unless @threeds_v2_card_holder_account_registration_date.is_a? DateTime
|
202
|
+
|
203
|
+
return if @threeds_v2_card_holder_account_registration_date < less_than
|
204
|
+
|
205
|
+
raise ParameterError, "Card Holder Account Registration Date #{message}"
|
206
|
+
end
|
207
|
+
|
176
208
|
end
|
177
209
|
end
|
178
210
|
end
|
@@ -28,6 +28,29 @@ module GenesisRuby
|
|
28
28
|
|
29
29
|
protected
|
30
30
|
|
31
|
+
# Threeds Common Attribute Field Validation
|
32
|
+
def threeds_field_validations
|
33
|
+
{}.merge threeds_control_field_validations, threeds_purchase_field_validations,
|
34
|
+
threeds_merchant_risk_field_validations, threeds_card_holder_field_validations,
|
35
|
+
threeds_browser_field_validations, threeds_sdk_field_validations
|
36
|
+
end
|
37
|
+
|
38
|
+
def threeds_field_conditional_validations # rubocop:disable Metrics/MethodLength
|
39
|
+
{
|
40
|
+
threeds_v2_control_device_type: Hash[
|
41
|
+
Api::Constants::Transactions::Parameters::Threeds::Version2::Control::DeviceTypes::BROWSER,
|
42
|
+
%i[threeds_v2_browser_accept_header threeds_v2_browser_java_enabled threeds_v2_browser_language
|
43
|
+
threeds_v2_browser_color_depth threeds_v2_browser_screen_height
|
44
|
+
threeds_v2_browser_screen_width threeds_v2_browser_time_zone_offset
|
45
|
+
threeds_v2_browser_user_agent],
|
46
|
+
Api::Constants::Transactions::Parameters::Threeds::Version2::Control::DeviceTypes::APPLICATION,
|
47
|
+
%i[threeds_v2_sdk_interface threeds_v2_sdk_ui_types threeds_v2_sdk_application_id
|
48
|
+
threeds_v2_sdk_encrypted_data threeds_v2_sdk_ephemeral_public_key_pair
|
49
|
+
threeds_v2_sdk_max_timeout threeds_v2_sdk_reference_number]
|
50
|
+
]
|
51
|
+
}
|
52
|
+
end
|
53
|
+
|
31
54
|
# Threeds V2 Web Payment Form Attributes
|
32
55
|
def threeds_v2_common_attributes_structure
|
33
56
|
{
|
@@ -12,36 +12,23 @@ module GenesisRuby
|
|
12
12
|
# Mixin ThreedsV2 Control
|
13
13
|
module Control
|
14
14
|
|
15
|
-
|
16
|
-
|
15
|
+
attr_accessor :threeds_v2_control_device_type, :threeds_v2_control_challenge_window_size,
|
16
|
+
:threeds_v2_control_challenge_indicator
|
17
17
|
|
18
|
-
|
19
|
-
def threeds_v2_control_device_type=(value)
|
20
|
-
allowed_types = GenesisRuby::Api::Constants::Transactions::Parameters::Threeds::Version2::Control::
|
21
|
-
DeviceTypes.all
|
22
|
-
|
23
|
-
allowed_options attribute: __method__, allowed: allowed_types, value: value, allow_empty: true
|
24
|
-
end
|
25
|
-
|
26
|
-
# Identifies the size of the challenge window for the consumer
|
27
|
-
def threeds_v2_control_challenge_window_size=(value)
|
28
|
-
allowed_sizes = GenesisRuby::Api::Constants::Transactions::Parameters::Threeds::Version2::Control::
|
29
|
-
ChallengeWindowSizes.all
|
30
|
-
|
31
|
-
allowed_options attribute: __method__, allowed: allowed_sizes, value: value, allow_empty: true
|
32
|
-
end
|
33
|
-
|
34
|
-
# The value has weight and might impact the decision whether a challenge will be required for the
|
35
|
-
# transaction or not
|
36
|
-
def threeds_v2_control_challenge_indicator=(value)
|
37
|
-
allowed_indicators = GenesisRuby::Api::Constants::Transactions::Parameters::Threeds::Version2::
|
38
|
-
Control::ChallengeIndicators.all
|
18
|
+
protected
|
39
19
|
|
40
|
-
|
20
|
+
# Control field validations structure
|
21
|
+
def threeds_control_field_validations
|
22
|
+
{
|
23
|
+
threeds_v2_control_device_type: Api::Constants::Transactions::Parameters::Threeds::
|
24
|
+
Version2::Control::DeviceTypes.all,
|
25
|
+
threeds_v2_control_challenge_window_size: Api::Constants::Transactions::Parameters::Threeds::
|
26
|
+
Version2::Control::ChallengeWindowSizes.all,
|
27
|
+
threeds_v2_control_challenge_indicator: Api::Constants::Transactions::Parameters::Threeds::
|
28
|
+
Version2::Control::ChallengeIndicators.all
|
29
|
+
}
|
41
30
|
end
|
42
31
|
|
43
|
-
protected
|
44
|
-
|
45
32
|
# Request Control Attributes structure
|
46
33
|
def control_attributes
|
47
34
|
{
|
@@ -13,55 +13,12 @@ module GenesisRuby
|
|
13
13
|
# Mixin ThreedsV2 MerchantRisk
|
14
14
|
module MerchantRisk
|
15
15
|
|
16
|
-
attr_reader :
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
def threeds_v2_merchant_risk_shipping_indicator=(value)
|
23
|
-
allowed_indicators = GenesisRuby::Api::Constants::Transactions::Parameters::Threeds::Version2::
|
24
|
-
MerchantRisk::ShippingIndicators.all
|
25
|
-
|
26
|
-
allowed_options attribute: __method__,
|
27
|
-
allowed: allowed_indicators,
|
28
|
-
value: value.to_s,
|
29
|
-
allow_empty: true
|
30
|
-
end
|
31
|
-
|
32
|
-
# Indicates the merchandise delivery timeframe
|
33
|
-
def threeds_v2_merchant_risk_delivery_timeframe=(value)
|
34
|
-
allowed_timeframes = GenesisRuby::Api::Constants::Transactions::Parameters::Threeds::Version2::
|
35
|
-
MerchantRisk::DeliveryTimeframes.all
|
36
|
-
|
37
|
-
allowed_options attribute: __method__,
|
38
|
-
allowed: allowed_timeframes,
|
39
|
-
value: value.to_s,
|
40
|
-
allow_empty: true
|
41
|
-
end
|
42
|
-
|
43
|
-
# Indicates whether the cardholder is reordering previously purchased merchandise
|
44
|
-
def threeds_v2_merchant_risk_reorder_items_indicator=(value)
|
45
|
-
allowed_indicators = GenesisRuby::Api::Constants::Transactions::Parameters::Threeds::Version2::
|
46
|
-
MerchantRisk::ReorderItemIndicators.all
|
47
|
-
|
48
|
-
allowed_options attribute: __method__,
|
49
|
-
allowed: allowed_indicators,
|
50
|
-
value: value.to_s,
|
51
|
-
allow_empty: true
|
52
|
-
end
|
53
|
-
|
54
|
-
# Indicates whether cardholder is placing an order for merchandise with a future-availability
|
55
|
-
# or release date
|
56
|
-
def threeds_v2_merchant_risk_pre_order_purchase_indicator=(value)
|
57
|
-
allowed_indicators = GenesisRuby::Api::Constants::Transactions::Parameters::Threeds::Version2::
|
58
|
-
MerchantRisk::PreOrderPurchaseIndicators.all
|
59
|
-
|
60
|
-
allowed_options attribute: __method__,
|
61
|
-
allowed: allowed_indicators,
|
62
|
-
value: value.to_s,
|
63
|
-
allow_empty: true
|
64
|
-
end
|
16
|
+
attr_reader :threeds_v2_merchant_risk_gift_card_count
|
17
|
+
attr_accessor :threeds_v2_merchant_risk_shipping_indicator,
|
18
|
+
:threeds_v2_merchant_risk_delivery_timeframe,
|
19
|
+
:threeds_v2_merchant_risk_reorder_items_indicator,
|
20
|
+
:threeds_v2_merchant_risk_pre_order_purchase_indicator,
|
21
|
+
:threeds_v2_merchant_risk_gift_card
|
65
22
|
|
66
23
|
# For a pre-ordered purchase, the expected date that the merchandise will be available
|
67
24
|
def threeds_v2_merchant_risk_pre_order_date
|
@@ -75,15 +32,6 @@ module GenesisRuby
|
|
75
32
|
parse_date attribute: __method__, value: value, allow_empty: true
|
76
33
|
end
|
77
34
|
|
78
|
-
# Prepaid or gift card purchase
|
79
|
-
def threeds_v2_merchant_risk_gift_card=(value)
|
80
|
-
allowed_options attribute: __method__,
|
81
|
-
allowed: [true, false],
|
82
|
-
value: value,
|
83
|
-
allow_empty: true,
|
84
|
-
error_message: 'Accepts only boolean values'
|
85
|
-
end
|
86
|
-
|
87
35
|
# For prepaid or gift card purchase, total count of individual prepaid or gift cards/codes purchased
|
88
36
|
def threeds_v2_merchant_risk_gift_card_count=(value)
|
89
37
|
parse_int attribute: __method__, value: value, allow_empty: true
|
@@ -91,6 +39,21 @@ module GenesisRuby
|
|
91
39
|
|
92
40
|
protected
|
93
41
|
|
42
|
+
# Merchant Risk field validations structure
|
43
|
+
def threeds_merchant_risk_field_validations # rubocop:disable Metrics/MethodLength
|
44
|
+
{
|
45
|
+
threeds_v2_merchant_risk_shipping_indicator: Api::Constants::Transactions::Parameters::
|
46
|
+
Threeds::Version2::MerchantRisk::ShippingIndicators.all,
|
47
|
+
threeds_v2_merchant_risk_delivery_timeframe: Api::Constants::Transactions::Parameters::
|
48
|
+
Threeds::Version2::MerchantRisk::DeliveryTimeframes.all,
|
49
|
+
threeds_v2_merchant_risk_reorder_items_indicator: Api::Constants::Transactions::Parameters::
|
50
|
+
Threeds::Version2::MerchantRisk::ReorderItemIndicators.all,
|
51
|
+
threeds_v2_merchant_risk_pre_order_purchase_indicator: Api::Constants::Transactions::Parameters::
|
52
|
+
Threeds::Version2::MerchantRisk::PreOrderPurchaseIndicators.all,
|
53
|
+
threeds_v2_merchant_risk_gift_card: [true, false]
|
54
|
+
}
|
55
|
+
end
|
56
|
+
|
94
57
|
# Request Merchant Risk Attributes structure
|
95
58
|
def merchant_risk_attributes
|
96
59
|
{
|
@@ -10,21 +10,18 @@ module GenesisRuby
|
|
10
10
|
# Mixin ThreedsV2 Purchase
|
11
11
|
module Purchase
|
12
12
|
|
13
|
-
|
13
|
+
attr_accessor :threeds_v2_purchase_category
|
14
14
|
|
15
|
-
|
16
|
-
def threeds_v2_purchase_category=(value)
|
17
|
-
allowed_indicators = GenesisRuby::Api::Constants::Transactions::Parameters::Threeds::Version2::
|
18
|
-
Purchase::Categories.all
|
15
|
+
protected
|
19
16
|
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
17
|
+
# Purchase field validations structure
|
18
|
+
def threeds_purchase_field_validations
|
19
|
+
{
|
20
|
+
threeds_v2_purchase_category: Api::Constants::Transactions::Parameters::Threeds::Version2::
|
21
|
+
Purchase::Categories.all
|
22
|
+
}
|
24
23
|
end
|
25
24
|
|
26
|
-
protected
|
27
|
-
|
28
25
|
# Request Purchase Attributes structure
|
29
26
|
def purchase_attributes
|
30
27
|
{
|
@@ -12,18 +12,10 @@ module GenesisRuby
|
|
12
12
|
# Mixin ThreedsV2 SDK
|
13
13
|
module Sdk
|
14
14
|
|
15
|
-
attr_reader :
|
15
|
+
attr_reader :threeds_v2_sdk_application_id, :threeds_v2_sdk_encrypted_data,
|
16
16
|
:threeds_v2_sdk_ephemeral_public_key_pair, :threeds_v2_sdk_max_timeout,
|
17
17
|
:threeds_v2_sdk_reference_number
|
18
|
-
|
19
|
-
# SDK Interface types that the device of the consumer supports for displaying specific challenge
|
20
|
-
# interfaces within the SDK
|
21
|
-
def threeds_v2_sdk_interface=(value)
|
22
|
-
allowed_interfaces = GenesisRuby::Api::Constants::Transactions::Parameters::Threeds::Version2::Sdk::
|
23
|
-
Interfaces.all
|
24
|
-
|
25
|
-
allowed_options attribute: __method__, allowed: allowed_interfaces, value: value, allow_empty: true
|
26
|
-
end
|
18
|
+
attr_accessor :threeds_v2_sdk_interface
|
27
19
|
|
28
20
|
# UI type that the device of the consumer supports for displaying specific challenge interface
|
29
21
|
def threeds_v2_sdk_ui_types
|
@@ -84,6 +76,14 @@ module GenesisRuby
|
|
84
76
|
|
85
77
|
protected
|
86
78
|
|
79
|
+
# SDK field validations
|
80
|
+
def threeds_sdk_field_validations
|
81
|
+
{
|
82
|
+
threeds_v2_sdk_interface: Api::Constants::Transactions::Parameters::Threeds::Version2::Sdk::
|
83
|
+
Interfaces.all
|
84
|
+
}
|
85
|
+
end
|
86
|
+
|
87
87
|
# Request SDK Attributes structure
|
88
88
|
def sdk_attributes
|
89
89
|
{
|
@@ -32,6 +32,15 @@ module GenesisRuby
|
|
32
32
|
|
33
33
|
protected
|
34
34
|
|
35
|
+
# Threeds Common Attribute Field Validation
|
36
|
+
def threeds_field_validations
|
37
|
+
control_validations = threeds_control_field_validations
|
38
|
+
control_validations.delete(:threeds_v2_control_device_type)
|
39
|
+
|
40
|
+
{}.merge control_validations, threeds_purchase_field_validations,
|
41
|
+
threeds_merchant_risk_field_validations, threeds_card_holder_field_validations
|
42
|
+
end
|
43
|
+
|
35
44
|
# Request Control Attributes structure available for the Web Payment Form
|
36
45
|
def control_attributes
|
37
46
|
{
|
@@ -27,7 +27,7 @@ module GenesisRuby
|
|
27
27
|
@api_config = GenesisRuby::Utils::Options::ApiConfig.new
|
28
28
|
|
29
29
|
init_configuration
|
30
|
-
|
30
|
+
init_field_validations
|
31
31
|
end
|
32
32
|
|
33
33
|
# Generate the Request Document based on the builder_interface
|
@@ -50,7 +50,7 @@ module GenesisRuby
|
|
50
50
|
attr_accessor :tree_structure
|
51
51
|
|
52
52
|
# Required fields for the request
|
53
|
-
def
|
53
|
+
def init_field_validations; end
|
54
54
|
|
55
55
|
# Request Configuration
|
56
56
|
def init_configuration; end
|
@@ -146,6 +146,8 @@ module GenesisRuby
|
|
146
146
|
|
147
147
|
# Transform amount to minor currency format
|
148
148
|
def transform_amount(amount, currency)
|
149
|
+
return amount if amount.nil? || !GenesisRuby::Api::Constants::Currencies::Iso4217.valid?(currency)
|
150
|
+
|
149
151
|
GenesisRuby::Utils::MoneyFormat.amount_to_exponent amount, currency
|
150
152
|
end
|
151
153
|
|
@@ -11,12 +11,14 @@ 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
|
-
|
18
14
|
protected
|
19
15
|
|
16
|
+
# Request Field validations
|
17
|
+
def init_field_validations
|
18
|
+
required_fields.push *%i[transaction_id amount currency]
|
19
|
+
field_values.merge! currency: Api::Constants::Currencies::Iso4217.all.map(&:upcase)
|
20
|
+
end
|
21
|
+
|
20
22
|
# Credit Card attributes
|
21
23
|
def payment_transaction_structure
|
22
24
|
payment_attributes_structure.merge(
|
@@ -0,0 +1,59 @@
|
|
1
|
+
module GenesisRuby
|
2
|
+
module Api
|
3
|
+
module Requests
|
4
|
+
module Base
|
5
|
+
module Financials
|
6
|
+
# South American Payments base class
|
7
|
+
class SouthAmericanPayments < Base::Financial
|
8
|
+
|
9
|
+
include Api::Mixins::Requests::AddressInfoAttributes
|
10
|
+
include Api::Mixins::Requests::Financial::AsyncAttributes
|
11
|
+
include Api::Mixins::Requests::BirthDateAttributes
|
12
|
+
include Api::Mixins::Requests::Financial::PaymentAttributes
|
13
|
+
include Api::Mixins::Requests::Financial::ConsumerIdentifierAttributes
|
14
|
+
|
15
|
+
# Billing Country custom accessor
|
16
|
+
def billing_country
|
17
|
+
return nil unless @billing_country
|
18
|
+
|
19
|
+
@billing_country.to_s.upcase
|
20
|
+
end
|
21
|
+
|
22
|
+
protected
|
23
|
+
|
24
|
+
# Defines allowed billing countries
|
25
|
+
def allowed_billing_countries
|
26
|
+
raise NoMethodError, 'South American Payment requests require definition of allowed billing countries'
|
27
|
+
end
|
28
|
+
|
29
|
+
def init_field_validations
|
30
|
+
super
|
31
|
+
|
32
|
+
required_fields.push *%i[transaction_id return_success_url return_failure_url amount currency
|
33
|
+
consumer_reference national_id customer_email billing_country]
|
34
|
+
|
35
|
+
field_values.merge! billing_country: allowed_billing_countries
|
36
|
+
end
|
37
|
+
|
38
|
+
# South American payments
|
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
|
+
consumer_reference: consumer_reference,
|
45
|
+
national_id: national_id,
|
46
|
+
birth_date: birth_date,
|
47
|
+
customer_email: customer_email,
|
48
|
+
billing_address: billing_address_parameters_structure,
|
49
|
+
shipping_address: shipping_address_parameters_structure
|
50
|
+
}
|
51
|
+
)
|
52
|
+
end
|
53
|
+
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
@@ -10,8 +10,9 @@ module GenesisRuby
|
|
10
10
|
|
11
11
|
protected
|
12
12
|
|
13
|
-
def
|
14
|
-
|
13
|
+
def init_field_validations
|
14
|
+
required_fields.push *%i[transaction_id reference_id amount currency]
|
15
|
+
field_values.merge! currency: Api::Constants::Currencies::Iso4217.all.map(&:upcase)
|
15
16
|
end
|
16
17
|
|
17
18
|
# Reference transaction request structure
|
@@ -0,0 +1,26 @@
|
|
1
|
+
module GenesisRuby
|
2
|
+
module Api
|
3
|
+
module Requests
|
4
|
+
module Financial
|
5
|
+
module Cards
|
6
|
+
# Argencard is a debit or credit card used in Argentina.
|
7
|
+
class Argencard < Base::Financials::SouthAmericanPayments
|
8
|
+
|
9
|
+
protected
|
10
|
+
|
11
|
+
# Argencard transaction type
|
12
|
+
def transaction_type
|
13
|
+
Api::Constants::Transactions::ARGENCARD
|
14
|
+
end
|
15
|
+
|
16
|
+
# Argencard allowed billing countries
|
17
|
+
def allowed_billing_countries
|
18
|
+
%w(AR)
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|