genesis_ruby 0.1.7 → 0.1.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 +10 -0
- data/Gemfile.lock +44 -38
- data/README.md +217 -0
- data/VERSION +1 -1
- 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/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/customer_info_attributes.rb +1 -1
- 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/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/reference.rb +3 -2
- 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/sale.rb +10 -2
- data/lib/genesis_ruby/api/requests/financial/cards/sale3d.rb +19 -10
- data/lib/genesis_ruby/api/requests/financial/cards/threeds/v2/method_continue.rb +2 -2
- 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/online_banking/pay_in.rb +157 -0
- data/lib/genesis_ruby/api/requests/financial/void.rb +2 -2
- 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/utils/common.rb +26 -0
- data/lib/genesis_ruby/version.rb +1 -1
- metadata +15 -3
@@ -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(
|
@@ -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
|
@@ -32,8 +32,16 @@ module GenesisRuby
|
|
32
32
|
GenesisRuby::Api::Constants::Transactions::AUTHORIZE
|
33
33
|
end
|
34
34
|
|
35
|
-
|
36
|
-
|
35
|
+
# Request Field validations
|
36
|
+
def init_field_validations
|
37
|
+
super
|
38
|
+
|
39
|
+
field_values.merge! managed_recurring_field_values, recurring_type_field_values_validation_structure
|
40
|
+
|
41
|
+
field_value_dependencies.merge! required_tokenization_fields_conditional, required_cc_fields_conditional,
|
42
|
+
required_recurring_managed_type_field_conditional
|
43
|
+
|
44
|
+
return unless recurring_type == Constants::Transactions::Parameters::Recurring::Types::SUBSEQUENT
|
37
45
|
|
38
46
|
self.required_fields = recurring_type_subsequent_required_request_attributes
|
39
47
|
end
|
@@ -28,16 +28,6 @@ module GenesisRuby
|
|
28
28
|
include Mixins::Requests::Financial::Threeds::Version2::CommonAttributes
|
29
29
|
include Mixins::Requests::Financial::TravelData::TravelAttributes
|
30
30
|
|
31
|
-
# Specifies the recurring type of transaction
|
32
|
-
def recurring_type=(value)
|
33
|
-
allowed_values = [
|
34
|
-
GenesisRuby::Api::Constants::Transactions::Parameters::Recurring::Types::INITIAL,
|
35
|
-
GenesisRuby::Api::Constants::Transactions::Parameters::Recurring::Types::MANAGED
|
36
|
-
]
|
37
|
-
|
38
|
-
allowed_options attribute: __method__, allowed: allowed_values, value: value, allow_empty: true
|
39
|
-
end
|
40
|
-
|
41
31
|
protected
|
42
32
|
|
43
33
|
# Authorize 3D Transaction Type
|
@@ -45,6 +35,25 @@ module GenesisRuby
|
|
45
35
|
GenesisRuby::Api::Constants::Transactions::AUTHORIZE_3D
|
46
36
|
end
|
47
37
|
|
38
|
+
# Request Field validations
|
39
|
+
def init_field_validations
|
40
|
+
super
|
41
|
+
|
42
|
+
field_values.merge! managed_recurring_field_values,
|
43
|
+
recurring_type_initial_field_values_validation_structure, threeds_field_validations
|
44
|
+
|
45
|
+
field_value_dependencies.merge! required_tokenization_fields_conditional, required_cc_fields_conditional,
|
46
|
+
required_recurring_managed_type_field_conditional,
|
47
|
+
threeds_field_conditional_validations
|
48
|
+
end
|
49
|
+
|
50
|
+
# Special validations upon document building
|
51
|
+
def check_requirements
|
52
|
+
validate_threeds_card_holder_dates
|
53
|
+
|
54
|
+
super
|
55
|
+
end
|
56
|
+
|
48
57
|
# Authorize 3D transaction request parameters
|
49
58
|
def payment_transaction_structure # rubocop:disable Metrics/MethodLength, Metrics/AbcSize
|
50
59
|
super.merge(
|
@@ -31,8 +31,16 @@ module GenesisRuby
|
|
31
31
|
GenesisRuby::Api::Constants::Transactions::SALE
|
32
32
|
end
|
33
33
|
|
34
|
-
|
35
|
-
|
34
|
+
# Request Field validations
|
35
|
+
def init_field_validations
|
36
|
+
super
|
37
|
+
|
38
|
+
field_values.merge! managed_recurring_field_values, recurring_type_field_values_validation_structure
|
39
|
+
|
40
|
+
field_value_dependencies.merge! required_tokenization_fields_conditional, required_cc_fields_conditional,
|
41
|
+
required_recurring_managed_type_field_conditional
|
42
|
+
|
43
|
+
return unless recurring_type == Constants::Transactions::Parameters::Recurring::Types::SUBSEQUENT
|
36
44
|
|
37
45
|
self.required_fields = recurring_type_subsequent_required_request_attributes
|
38
46
|
end
|
@@ -27,16 +27,6 @@ module GenesisRuby
|
|
27
27
|
include Mixins::Requests::Financial::Threeds::Version2::CommonAttributes
|
28
28
|
include Mixins::Requests::Financial::TravelData::TravelAttributes
|
29
29
|
|
30
|
-
# Specifies the recurring type of transaction
|
31
|
-
def recurring_type=(value)
|
32
|
-
allowed_values = [
|
33
|
-
GenesisRuby::Api::Constants::Transactions::Parameters::Recurring::Types::INITIAL,
|
34
|
-
GenesisRuby::Api::Constants::Transactions::Parameters::Recurring::Types::MANAGED
|
35
|
-
]
|
36
|
-
|
37
|
-
allowed_options attribute: __method__, allowed: allowed_values, value: value, allow_empty: true
|
38
|
-
end
|
39
|
-
|
40
30
|
protected
|
41
31
|
|
42
32
|
# Sale 3D Transaction Type
|
@@ -44,6 +34,25 @@ module GenesisRuby
|
|
44
34
|
GenesisRuby::Api::Constants::Transactions::SALE_3D
|
45
35
|
end
|
46
36
|
|
37
|
+
# Request Field validations
|
38
|
+
def init_field_validations
|
39
|
+
super
|
40
|
+
|
41
|
+
field_values.merge! managed_recurring_field_values,
|
42
|
+
recurring_type_initial_field_values_validation_structure, threeds_field_validations
|
43
|
+
|
44
|
+
field_value_dependencies.merge! required_tokenization_fields_conditional, required_cc_fields_conditional,
|
45
|
+
required_recurring_managed_type_field_conditional,
|
46
|
+
threeds_field_conditional_validations
|
47
|
+
end
|
48
|
+
|
49
|
+
# Special validations upon document building
|
50
|
+
def check_requirements
|
51
|
+
validate_threeds_card_holder_dates
|
52
|
+
|
53
|
+
super
|
54
|
+
end
|
55
|
+
|
47
56
|
# Sale 3D transaction request parameters
|
48
57
|
def payment_transaction_structure # rubocop:disable Metrics/MethodLength, Metrics/AbcSize
|
49
58
|
super.merge(
|
@@ -104,8 +104,8 @@ module GenesisRuby
|
|
104
104
|
init_api_gateway_configuration request_path: 'threeds/threeds_method/:unique_id', include_token: false
|
105
105
|
end
|
106
106
|
|
107
|
-
def
|
108
|
-
|
107
|
+
def init_field_validations
|
108
|
+
required_fields.push *%i[amount transaction_timestamp]
|
109
109
|
end
|
110
110
|
|
111
111
|
# Build correct endpoint url during runtime
|