genesis_ruby 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (132) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG.md +11 -0
  3. data/Gemfile +6 -0
  4. data/Gemfile.lock +158 -0
  5. data/LICENSE +21 -0
  6. data/README.md +343 -0
  7. data/Rakefile +12 -0
  8. data/VERSION +1 -0
  9. data/genesis_ruby.gemspec +43 -0
  10. data/lib/genesis_ruby/api/constants/currencies/iso4217.rb +1106 -0
  11. data/lib/genesis_ruby/api/constants/date_time_formats.rb +45 -0
  12. data/lib/genesis_ruby/api/constants/endpoints.rb +18 -0
  13. data/lib/genesis_ruby/api/constants/environments.rb +17 -0
  14. data/lib/genesis_ruby/api/constants/states/state.rb +43 -0
  15. data/lib/genesis_ruby/api/constants/states.rb +86 -0
  16. data/lib/genesis_ruby/api/constants/transactions/parameters/business/payment_types.rb +24 -0
  17. data/lib/genesis_ruby/api/constants/transactions/parameters/recurring/categories.rb +24 -0
  18. data/lib/genesis_ruby/api/constants/transactions/parameters/recurring/types.rb +28 -0
  19. data/lib/genesis_ruby/api/constants/transactions/parameters/sca_exemptions.rb +34 -0
  20. data/lib/genesis_ruby/api/constants/transactions/parameters/threeds/version2/browser/color_depths.rb +46 -0
  21. data/lib/genesis_ruby/api/constants/transactions/parameters/threeds/version2/card_holder_account/password_change_indicators.rb +37 -0
  22. data/lib/genesis_ruby/api/constants/transactions/parameters/threeds/version2/card_holder_account/registration_indicators.rb +37 -0
  23. data/lib/genesis_ruby/api/constants/transactions/parameters/threeds/version2/card_holder_account/shipping_address_usage_indicators.rb +34 -0
  24. data/lib/genesis_ruby/api/constants/transactions/parameters/threeds/version2/card_holder_account/suspicious_activity_indicators.rb +28 -0
  25. data/lib/genesis_ruby/api/constants/transactions/parameters/threeds/version2/card_holder_account/update_indicators.rb +34 -0
  26. data/lib/genesis_ruby/api/constants/transactions/parameters/threeds/version2/control/challenge_indicators.rb +34 -0
  27. data/lib/genesis_ruby/api/constants/transactions/parameters/threeds/version2/control/challenge_window_sizes.rb +37 -0
  28. data/lib/genesis_ruby/api/constants/transactions/parameters/threeds/version2/control/device_types.rb +28 -0
  29. data/lib/genesis_ruby/api/constants/transactions/parameters/threeds/version2/merchant_risk/delivery_timeframes.rb +34 -0
  30. data/lib/genesis_ruby/api/constants/transactions/parameters/threeds/version2/merchant_risk/pre_order_purchase_indicators.rb +28 -0
  31. data/lib/genesis_ruby/api/constants/transactions/parameters/threeds/version2/merchant_risk/reorder_item_indicators.rb +28 -0
  32. data/lib/genesis_ruby/api/constants/transactions/parameters/threeds/version2/merchant_risk/shipping_indicators.rb +46 -0
  33. data/lib/genesis_ruby/api/constants/transactions/parameters/threeds/version2/purchase/categories.rb +43 -0
  34. data/lib/genesis_ruby/api/constants/transactions/parameters/threeds/version2/sdk/interfaces.rb +31 -0
  35. data/lib/genesis_ruby/api/constants/transactions/parameters/threeds/version2/sdk/ui_types.rb +37 -0
  36. data/lib/genesis_ruby/api/constants/transactions.rb +371 -0
  37. data/lib/genesis_ruby/api/mixins/constants/common.rb +27 -0
  38. data/lib/genesis_ruby/api/mixins/requests/address_info_attributes.rb +20 -0
  39. data/lib/genesis_ruby/api/mixins/requests/customer_address/billing_info_attributes.rb +33 -0
  40. data/lib/genesis_ruby/api/mixins/requests/customer_address/customer_info_attributes.rb +26 -0
  41. data/lib/genesis_ruby/api/mixins/requests/customer_address/shipping_info_attributes.rb +33 -0
  42. data/lib/genesis_ruby/api/mixins/requests/document_attributes.rb +14 -0
  43. data/lib/genesis_ruby/api/mixins/requests/financial/async_attributes.rb +34 -0
  44. data/lib/genesis_ruby/api/mixins/requests/financial/base_attributes.rb +16 -0
  45. data/lib/genesis_ruby/api/mixins/requests/financial/business/airlines_air_carriers_attributes.rb +60 -0
  46. data/lib/genesis_ruby/api/mixins/requests/financial/business/business_attributes.rb +56 -0
  47. data/lib/genesis_ruby/api/mixins/requests/financial/business/car_plane_and_boat_rentals_attributes.rb +53 -0
  48. data/lib/genesis_ruby/api/mixins/requests/financial/business/cruise_lines_attributes.rb +50 -0
  49. data/lib/genesis_ruby/api/mixins/requests/financial/business/event_management_attributes.rb +54 -0
  50. data/lib/genesis_ruby/api/mixins/requests/financial/business/furniture_attributes.rb +53 -0
  51. data/lib/genesis_ruby/api/mixins/requests/financial/business/hotels_and_real_estate_rentals_attributes.rb +53 -0
  52. data/lib/genesis_ruby/api/mixins/requests/financial/business/travel_agencies_attributes.rb +88 -0
  53. data/lib/genesis_ruby/api/mixins/requests/financial/cards/credit_card_attributes.rb +31 -0
  54. data/lib/genesis_ruby/api/mixins/requests/financial/cards/fx_rate_attributes.rb +18 -0
  55. data/lib/genesis_ruby/api/mixins/requests/financial/cards/recurring/recurring_category_attributes.rb +31 -0
  56. data/lib/genesis_ruby/api/mixins/requests/financial/cards/recurring/recurring_type_attributes.rb +31 -0
  57. data/lib/genesis_ruby/api/mixins/requests/financial/cards/tokenization_attributes.rb +39 -0
  58. data/lib/genesis_ruby/api/mixins/requests/financial/crypto_attributes.rb +25 -0
  59. data/lib/genesis_ruby/api/mixins/requests/financial/dynamic_descriptor_attributes.rb +114 -0
  60. data/lib/genesis_ruby/api/mixins/requests/financial/gaming_attributes.rb +25 -0
  61. data/lib/genesis_ruby/api/mixins/requests/financial/moto_attributes.rb +25 -0
  62. data/lib/genesis_ruby/api/mixins/requests/financial/notification_attributes.rb +25 -0
  63. data/lib/genesis_ruby/api/mixins/requests/financial/payment_attributes.rb +32 -0
  64. data/lib/genesis_ruby/api/mixins/requests/financial/pending_payment_attributes.rb +25 -0
  65. data/lib/genesis_ruby/api/mixins/requests/financial/reference_attributes.rb +16 -0
  66. data/lib/genesis_ruby/api/mixins/requests/financial/risk_attributes.rb +47 -0
  67. data/lib/genesis_ruby/api/mixins/requests/financial/sca_attributes.rb +37 -0
  68. data/lib/genesis_ruby/api/mixins/requests/financial/threeds/version2/browser.rb +92 -0
  69. data/lib/genesis_ruby/api/mixins/requests/financial/threeds/version2/card_holder_account.rb +183 -0
  70. data/lib/genesis_ruby/api/mixins/requests/financial/threeds/version2/common_attributes.rb +52 -0
  71. data/lib/genesis_ruby/api/mixins/requests/financial/threeds/version2/control.rb +61 -0
  72. data/lib/genesis_ruby/api/mixins/requests/financial/threeds/version2/merchant_risk.rb +114 -0
  73. data/lib/genesis_ruby/api/mixins/requests/financial/threeds/version2/method.rb +44 -0
  74. data/lib/genesis_ruby/api/mixins/requests/financial/threeds/version2/purchase.rb +42 -0
  75. data/lib/genesis_ruby/api/mixins/requests/financial/threeds/version2/recurring.rb +49 -0
  76. data/lib/genesis_ruby/api/mixins/requests/financial/threeds/version2/sdk.rb +107 -0
  77. data/lib/genesis_ruby/api/mixins/requests/financial/threeds/version2/wpf_attributes.rb +61 -0
  78. data/lib/genesis_ruby/api/mixins/requests/restricted_setter.rb +75 -0
  79. data/lib/genesis_ruby/api/request.rb +171 -0
  80. data/lib/genesis_ruby/api/requests/base/financial.rb +44 -0
  81. data/lib/genesis_ruby/api/requests/base/financials/credit_card.rb +27 -0
  82. data/lib/genesis_ruby/api/requests/financial/cards/authorize.rb +60 -0
  83. data/lib/genesis_ruby/api/requests/financial/cards/authorize3d.rb +76 -0
  84. data/lib/genesis_ruby/api/requests/financial/cards/sale.rb +59 -0
  85. data/lib/genesis_ruby/api/requests/financial/cards/sale3d.rb +75 -0
  86. data/lib/genesis_ruby/api/requests/wpf/create.rb +142 -0
  87. data/lib/genesis_ruby/api/response.rb +91 -0
  88. data/lib/genesis_ruby/builder.rb +42 -0
  89. data/lib/genesis_ruby/builders/base.rb +18 -0
  90. data/lib/genesis_ruby/builders/xml.rb +95 -0
  91. data/lib/genesis_ruby/configuration.rb +177 -0
  92. data/lib/genesis_ruby/connection.rb +20 -0
  93. data/lib/genesis_ruby/dependencies.rb +19 -0
  94. data/lib/genesis_ruby/errors/builder_error.rb +14 -0
  95. data/lib/genesis_ruby/errors/endpoint_not_set_error.rb +14 -0
  96. data/lib/genesis_ruby/errors/error.rb +18 -0
  97. data/lib/genesis_ruby/errors/invalid_argument_error.rb +14 -0
  98. data/lib/genesis_ruby/errors/network_error.rb +14 -0
  99. data/lib/genesis_ruby/errors/object_formatter_error.rb +14 -0
  100. data/lib/genesis_ruby/errors/parameter_error.rb +12 -0
  101. data/lib/genesis_ruby/errors/parser_error.rb +14 -0
  102. data/lib/genesis_ruby/errors/response_error.rb +14 -0
  103. data/lib/genesis_ruby/network/adapter/base_adapter.rb +31 -0
  104. data/lib/genesis_ruby/network/adapter/net_http_adapter.rb +92 -0
  105. data/lib/genesis_ruby/network/base_network.rb +83 -0
  106. data/lib/genesis_ruby/network/net_http.rb +28 -0
  107. data/lib/genesis_ruby/parser.rb +44 -0
  108. data/lib/genesis_ruby/parsers/base.rb +25 -0
  109. data/lib/genesis_ruby/parsers/xml.rb +120 -0
  110. data/lib/genesis_ruby/utils/common.rb +108 -0
  111. data/lib/genesis_ruby/utils/formatters/base.rb +40 -0
  112. data/lib/genesis_ruby/utils/formatters/response/definitions.rb +21 -0
  113. data/lib/genesis_ruby/utils/formatters/response/formats/amount.rb +34 -0
  114. data/lib/genesis_ruby/utils/formatters/response/formats/timestamp.rb +29 -0
  115. data/lib/genesis_ruby/utils/formatters/response/loader.rb +42 -0
  116. data/lib/genesis_ruby/utils/money/base/strategy.rb +38 -0
  117. data/lib/genesis_ruby/utils/money/conversions/amount_to_exponent.rb +22 -0
  118. data/lib/genesis_ruby/utils/money/conversions/exponent_to_amount.rb +22 -0
  119. data/lib/genesis_ruby/utils/money/format.rb +34 -0
  120. data/lib/genesis_ruby/utils/money_format.rb +39 -0
  121. data/lib/genesis_ruby/utils/object_formatter.rb +67 -0
  122. data/lib/genesis_ruby/utils/options/api_config.rb +36 -0
  123. data/lib/genesis_ruby/utils/options/base.rb +35 -0
  124. data/lib/genesis_ruby/utils/options/network_adapter_config.rb +41 -0
  125. data/lib/genesis_ruby/utils/transactions/financial_types.rb +50 -0
  126. data/lib/genesis_ruby/utils/transactions/references/capturable_types.rb +52 -0
  127. data/lib/genesis_ruby/utils/transactions/references/refundable_types.rb +70 -0
  128. data/lib/genesis_ruby/utils/transactions/references/voidable_types.rb +49 -0
  129. data/lib/genesis_ruby/utils/transactions/wpf_types.rb +43 -0
  130. data/lib/genesis_ruby/version.rb +5 -0
  131. data/lib/genesis_ruby.rb +57 -0
  132. metadata +372 -0
@@ -0,0 +1,183 @@
1
+ # rubocop:disable Layout/LineLength
2
+ require 'genesis_ruby/api/constants/date_time_formats'
3
+ require 'genesis_ruby/api/constants/transactions/parameters/threeds/version2/card_holder_account/update_indicators'
4
+ require 'genesis_ruby/api/constants/transactions/parameters/threeds/version2/card_holder_account/password_change_indicators'
5
+ require 'genesis_ruby/api/constants/transactions/parameters/threeds/version2/card_holder_account/shipping_address_usage_indicators'
6
+ require 'genesis_ruby/api/constants/transactions/parameters/threeds/version2/card_holder_account/suspicious_activity_indicators'
7
+ require 'genesis_ruby/api/constants/transactions/parameters/threeds/version2/card_holder_account/registration_indicators'
8
+ # rubocop:enable Layout/LineLength
9
+
10
+ module GenesisRuby
11
+ module Api
12
+ module Mixins
13
+ module Requests
14
+ module Financial
15
+ module Threeds
16
+ module Version2
17
+ # Mixin ThreedsV2 Card holder Account
18
+ module CardHolderAccount # rubocop:disable Metrics/ModuleLength
19
+
20
+ attr_reader :threeds_v2_card_holder_account_update_indicator,
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,
24
+ :threeds_v2_card_holder_account_transactions_activity_previous_year,
25
+ :threeds_v2_card_holder_account_provision_attempts_last24_hours,
26
+ :threeds_v2_card_holder_account_purchases_count_last6_months,
27
+ :threeds_v2_card_holder_account_suspicious_activity_indicator,
28
+ :threeds_v2_card_holder_account_registration_indicator
29
+
30
+ # Date that the cardholder opened the account with the 3DS Requester.
31
+ def threeds_v2_card_holder_account_creation_date
32
+ @threeds_v2_card_holder_account_creation_date&.strftime(
33
+ GenesisRuby::Api::Constants::DateTimeFormats::DD_MM_YYYY_L_HYPHENS
34
+ )
35
+ end
36
+
37
+ # Date that the cardholder opened the account with the 3DS Requester.
38
+ def threeds_v2_card_holder_account_creation_date=(value)
39
+ parse_date attribute: __method__, value: value, allow_empty: true
40
+ end
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
+ # Date that the cardholder’s account with the 3DS Requester was last changed
51
+ def threeds_v2_card_holder_account_last_change_date
52
+ @threeds_v2_card_holder_account_last_change_date&.strftime(
53
+ GenesisRuby::Api::Constants::DateTimeFormats::DD_MM_YYYY_L_HYPHENS
54
+ )
55
+ end
56
+
57
+ # Date that the cardholder’s account with the 3DS Requester was last changed
58
+ def threeds_v2_card_holder_account_last_change_date=(value)
59
+ parse_date attribute: __method__, value: value, allow_empty: true
60
+ end
61
+
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
+ # Date that cardholder’s account with the 3DS Requester had a password change or account reset
72
+ def threeds_v2_card_holder_account_password_change_date
73
+ @threeds_v2_card_holder_account_password_change_date&.strftime(
74
+ GenesisRuby::Api::Constants::DateTimeFormats::DD_MM_YYYY_L_HYPHENS
75
+ )
76
+ end
77
+
78
+ # Date that cardholder’s account with the 3DS Requester had a password change or account reset
79
+ def threeds_v2_card_holder_account_password_change_date=(value)
80
+ parse_date attribute: __method__, value: value, allow_empty: true
81
+ end
82
+
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
+ # Date when the shipping address used for this transaction was first used with the 3DS Requester
92
+ def threeds_v2_card_holder_account_shipping_address_date_first_used
93
+ @threeds_v2_card_holder_account_shipping_address_date_first_used&.strftime(
94
+ GenesisRuby::Api::Constants::DateTimeFormats::DD_MM_YYYY_L_HYPHENS
95
+ )
96
+ end
97
+
98
+ # Date when the shipping address used for this transaction was first used with the 3DS Requester
99
+ def threeds_v2_card_holder_account_shipping_address_date_first_used=(value)
100
+ parse_date attribute: __method__, value: value, allow_empty: true
101
+ end
102
+
103
+ # Number of transactions (successful and abandoned) for this cardholder account
104
+ def threeds_v2_card_holder_account_transactions_activity_last24_hours=(value)
105
+ parse_int attribute: __method__, value: value, allow_empty: true
106
+ end
107
+
108
+ # Number of transactions (successful and abandoned) for this cardholder account
109
+ def threeds_v2_card_holder_account_transactions_activity_previous_year=(value)
110
+ parse_int attribute: __method__, value: value, allow_empty: true
111
+ end
112
+
113
+ # Number of Add Card attempts in the last 24 hours
114
+ def threeds_v2_card_holder_account_provision_attempts_last24_hours=(value)
115
+ parse_int attribute: __method__, value: value, allow_empty: true
116
+ end
117
+
118
+ # Number of purchases with this cardholder account during the previous six months
119
+ def threeds_v2_card_holder_account_purchases_count_last6_months=(value)
120
+ parse_int attribute: __method__, value: value, allow_empty: true
121
+ end
122
+
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
+ # Date that the cardholder opened the account with the 3DS Requester.
141
+ def threeds_v2_card_holder_account_registration_date
142
+ @threeds_v2_card_holder_account_registration_date&.strftime(
143
+ GenesisRuby::Api::Constants::DateTimeFormats::DD_MM_YYYY_L_HYPHENS
144
+ )
145
+ end
146
+
147
+ # Date that the payment account was enrolled in the cardholder’s account with the 3DS Requester
148
+ def threeds_v2_card_holder_account_registration_date=(value)
149
+ parse_date attribute: __method__, value: value, allow_empty: true
150
+ end
151
+
152
+ protected
153
+
154
+ # Request CardHolder Account Attributes structure
155
+ # rubocop:disable Layout/LineLength, Metrics/MethodLength
156
+ def card_holder_account_attributes
157
+ {
158
+ creation_date: threeds_v2_card_holder_account_creation_date,
159
+ update_indicator: threeds_v2_card_holder_account_update_indicator,
160
+ last_change_date: threeds_v2_card_holder_account_last_change_date,
161
+ password_change_indicator: threeds_v2_card_holder_account_password_change_indicator,
162
+ password_change_date: threeds_v2_card_holder_account_password_change_date,
163
+ shipping_address_usage_indicator: threeds_v2_card_holder_account_shipping_address_usage_indicator,
164
+ shipping_address_date_first_used: threeds_v2_card_holder_account_shipping_address_date_first_used,
165
+ transactions_activity_last_24_hours: threeds_v2_card_holder_account_transactions_activity_last24_hours,
166
+ transactions_activity_previous_year: threeds_v2_card_holder_account_transactions_activity_previous_year,
167
+ provision_attempts_last_24_hours: threeds_v2_card_holder_account_provision_attempts_last24_hours,
168
+ purchases_count_last_6_months: threeds_v2_card_holder_account_purchases_count_last6_months,
169
+ suspicious_activity_indicator: threeds_v2_card_holder_account_suspicious_activity_indicator,
170
+ registration_indicator: threeds_v2_card_holder_account_registration_indicator,
171
+ registration_date: threeds_v2_card_holder_account_registration_date
172
+ }
173
+ end
174
+ # rubocop:enable Layout/LineLength, Metrics/MethodLength
175
+
176
+ end
177
+ end
178
+ end
179
+ end
180
+ end
181
+ end
182
+ end
183
+ end
@@ -0,0 +1,52 @@
1
+ require 'genesis_ruby/api/mixins/requests/financial/threeds/version2/browser'
2
+ require 'genesis_ruby/api/mixins/requests/financial/threeds/version2/card_holder_account'
3
+ require 'genesis_ruby/api/mixins/requests/financial/threeds/version2/control'
4
+ require 'genesis_ruby/api/mixins/requests/financial/threeds/version2/merchant_risk'
5
+ require 'genesis_ruby/api/mixins/requests/financial/threeds/version2/method'
6
+ require 'genesis_ruby/api/mixins/requests/financial/threeds/version2/purchase'
7
+ require 'genesis_ruby/api/mixins/requests/financial/threeds/version2/recurring'
8
+ require 'genesis_ruby/api/mixins/requests/financial/threeds/version2/sdk'
9
+
10
+ module GenesisRuby
11
+ module Api
12
+ module Mixins
13
+ module Requests
14
+ module Financial
15
+ module Threeds
16
+ module Version2
17
+ # Threeds Version 2 Common Attributes
18
+ module CommonAttributes
19
+
20
+ include Browser
21
+ include CardHolderAccount
22
+ include Control
23
+ include MerchantRisk
24
+ include Method
25
+ include Purchase
26
+ include Recurring
27
+ include Sdk
28
+
29
+ protected
30
+
31
+ # Threeds V2 Web Payment Form Attributes
32
+ def threeds_v2_common_attributes_structure
33
+ {
34
+ method: method_attributes,
35
+ control: control_attributes,
36
+ purchase: purchase_attributes,
37
+ merchant_risk: merchant_risk_attributes,
38
+ card_holder_account: card_holder_account_attributes,
39
+ recurring: recurring_attributes,
40
+ browser: browser_attributes,
41
+ sdk: sdk_attributes
42
+ }
43
+ end
44
+
45
+ end
46
+ end
47
+ end
48
+ end
49
+ end
50
+ end
51
+ end
52
+ end
@@ -0,0 +1,61 @@
1
+ require 'genesis_ruby/api/constants/transactions/parameters/threeds/version2/control/device_types'
2
+ require 'genesis_ruby/api/constants/transactions/parameters/threeds/version2/control/challenge_window_sizes'
3
+ require 'genesis_ruby/api/constants/transactions/parameters/threeds/version2/control/challenge_indicators'
4
+
5
+ module GenesisRuby
6
+ module Api
7
+ module Mixins
8
+ module Requests
9
+ module Financial
10
+ module Threeds
11
+ module Version2
12
+ # Mixin ThreedsV2 Control
13
+ module Control
14
+
15
+ attr_reader :threeds_v2_control_device_type, :threeds_v2_control_challenge_window_size,
16
+ :threeds_v2_control_challenge_indicator
17
+
18
+ # Identifies the device channel of the consumer
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
39
+
40
+ allowed_options attribute: __method__, allowed: allowed_indicators, value: value, allow_empty: true
41
+ end
42
+
43
+ protected
44
+
45
+ # Request Control Attributes structure
46
+ def control_attributes
47
+ {
48
+ device_type: threeds_v2_control_device_type,
49
+ challenge_window_size: threeds_v2_control_challenge_window_size,
50
+ challenge_indicator: threeds_v2_control_challenge_indicator
51
+ }
52
+ end
53
+
54
+ end
55
+ end
56
+ end
57
+ end
58
+ end
59
+ end
60
+ end
61
+ end
@@ -0,0 +1,114 @@
1
+ require 'genesis_ruby/api/constants/transactions/parameters/threeds/version2/merchant_risk/shipping_indicators'
2
+ require 'genesis_ruby/api/constants/transactions/parameters/threeds/version2/merchant_risk/delivery_timeframes'
3
+ require 'genesis_ruby/api/constants/transactions/parameters/threeds/version2/merchant_risk/reorder_item_indicators'
4
+ require 'genesis_ruby/api/constants/transactions/parameters/threeds/version2/merchant_risk/pre_order_purchase_indicators' # rubocop: disable Layout/LineLength
5
+
6
+ module GenesisRuby
7
+ module Api
8
+ module Mixins
9
+ module Requests
10
+ module Financial
11
+ module Threeds
12
+ module Version2
13
+ # Mixin ThreedsV2 MerchantRisk
14
+ module MerchantRisk
15
+
16
+ attr_reader :threeds_v2_merchant_risk_shipping_indicator, :threeds_v2_merchant_risk_delivery_timeframe,
17
+ :threeds_v2_merchant_risk_reorder_items_indicator,
18
+ :threeds_v2_merchant_risk_pre_order_purchase_indicator, :threeds_v2_merchant_risk_gift_card,
19
+ :threeds_v2_merchant_risk_gift_card_count
20
+
21
+ # Indicator code that most accurately describes the shipping method
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
65
+
66
+ # For a pre-ordered purchase, the expected date that the merchandise will be available
67
+ def threeds_v2_merchant_risk_pre_order_date
68
+ @threeds_v2_merchant_risk_pre_order_date&.strftime(
69
+ GenesisRuby::Api::Constants::DateTimeFormats::DD_MM_YYYY_L_HYPHENS
70
+ )
71
+ end
72
+
73
+ # For a pre-ordered purchase, the expected date that the merchandise will be available
74
+ def threeds_v2_merchant_risk_pre_order_date=(value)
75
+ parse_date attribute: __method__, value: value, allow_empty: true
76
+ end
77
+
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
+ # For prepaid or gift card purchase, total count of individual prepaid or gift cards/codes purchased
88
+ def threeds_v2_merchant_risk_gift_card_count=(value)
89
+ parse_int attribute: __method__, value: value, allow_empty: true
90
+ end
91
+
92
+ protected
93
+
94
+ # Request Merchant Risk Attributes structure
95
+ def merchant_risk_attributes
96
+ {
97
+ shipping_indicator: threeds_v2_merchant_risk_shipping_indicator,
98
+ delivery_timeframe: threeds_v2_merchant_risk_delivery_timeframe,
99
+ reorder_items_indicator: threeds_v2_merchant_risk_reorder_items_indicator,
100
+ pre_order_purchase_indicator: threeds_v2_merchant_risk_pre_order_purchase_indicator,
101
+ pre_order_date: threeds_v2_merchant_risk_pre_order_date,
102
+ gift_card: threeds_v2_merchant_risk_gift_card,
103
+ gift_card_count: threeds_v2_merchant_risk_gift_card_count
104
+ }
105
+ end
106
+
107
+ end
108
+ end
109
+ end
110
+ end
111
+ end
112
+ end
113
+ end
114
+ end
@@ -0,0 +1,44 @@
1
+ require 'genesis_ruby/utils/common'
2
+
3
+ module GenesisRuby
4
+ module Api
5
+ module Mixins
6
+ module Requests
7
+ module Financial
8
+ module Threeds
9
+ module Version2
10
+ # Mixin ThreedsV2 Mehtod
11
+ module Method
12
+
13
+ attr_reader :threeds_v2_method_callback_url
14
+
15
+ # 3DS-Method related parameters for any callbacks and notifications
16
+ def threeds_v2_method_callback_url=(value)
17
+ @threeds_v2_method_callback_url = nil
18
+
19
+ return if value.to_s.empty?
20
+
21
+ unless GenesisRuby::Utils::Common.valid_url?(value)
22
+ raise InvalidArgumentError, "Invalid URL given for #{__method__}"
23
+ end
24
+
25
+ @threeds_v2_method_callback_url = value
26
+ end
27
+
28
+ protected
29
+
30
+ # Request Method Attributes structure
31
+ def method_attributes
32
+ {
33
+ callback_url: threeds_v2_method_callback_url
34
+ }
35
+ end
36
+
37
+ end
38
+ end
39
+ end
40
+ end
41
+ end
42
+ end
43
+ end
44
+ end
@@ -0,0 +1,42 @@
1
+ require 'genesis_ruby/api/constants/transactions/parameters/threeds/version2/purchase/categories'
2
+
3
+ module GenesisRuby
4
+ module Api
5
+ module Mixins
6
+ module Requests
7
+ module Financial
8
+ module Threeds
9
+ module Version2
10
+ # Mixin ThreedsV2 Purchase
11
+ module Purchase
12
+
13
+ attr_reader :threeds_v2_purchase_category
14
+
15
+ # Identifies the type of transaction being authenticated
16
+ def threeds_v2_purchase_category=(value)
17
+ allowed_indicators = GenesisRuby::Api::Constants::Transactions::Parameters::Threeds::Version2::
18
+ Purchase::Categories.all
19
+
20
+ allowed_options attribute: __method__,
21
+ allowed: allowed_indicators,
22
+ value: value.to_s,
23
+ allow_empty: true
24
+ end
25
+
26
+ protected
27
+
28
+ # Request Purchase Attributes structure
29
+ def purchase_attributes
30
+ {
31
+ category: threeds_v2_purchase_category
32
+ }
33
+ end
34
+
35
+ end
36
+ end
37
+ end
38
+ end
39
+ end
40
+ end
41
+ end
42
+ end
@@ -0,0 +1,49 @@
1
+ module GenesisRuby
2
+ module Api
3
+ module Mixins
4
+ module Requests
5
+ module Financial
6
+ module Threeds
7
+ module Version2
8
+ # Mixin ThreedsV2 Recurring
9
+ module Recurring
10
+
11
+ attr_reader :threeds_v2_recurring_frequency
12
+
13
+ # A future date indicating the end date for any further subsequent transactions
14
+ def threeds_v2_recurring_expiration_date
15
+ @threeds_v2_recurring_expiration_date&.strftime(
16
+ GenesisRuby::Api::Constants::DateTimeFormats::DD_MM_YYYY_L_HYPHENS
17
+ )
18
+ end
19
+
20
+ # A future date indicating the end date for any further subsequent transactions
21
+ def threeds_v2_recurring_expiration_date=(value)
22
+ parse_date attribute: __method__, value: value, allow_empty: true
23
+ end
24
+
25
+ # Indicates the minimum number of days between subsequent transactions
26
+ def threeds_v2_recurring_frequency=(value)
27
+ limited_string attribute: __method__,
28
+ value: value.to_s.empty? || !value.to_i.positive? ? nil : value.to_i,
29
+ max: 4
30
+ end
31
+
32
+ protected
33
+
34
+ # Request Recurring Attributes structure
35
+ def recurring_attributes
36
+ {
37
+ expiration_date: threeds_v2_recurring_expiration_date,
38
+ frequency: threeds_v2_recurring_frequency
39
+ }
40
+ end
41
+
42
+ end
43
+ end
44
+ end
45
+ end
46
+ end
47
+ end
48
+ end
49
+ end
@@ -0,0 +1,107 @@
1
+ require 'genesis_ruby/api/constants/transactions/parameters/threeds/version2/sdk/interfaces'
2
+ require 'genesis_ruby/api/constants/transactions/parameters/threeds/version2/sdk/ui_types'
3
+ require 'genesis_ruby/errors/invalid_argument_error'
4
+
5
+ module GenesisRuby
6
+ module Api
7
+ module Mixins
8
+ module Requests
9
+ module Financial
10
+ module Threeds
11
+ module Version2
12
+ # Mixin ThreedsV2 SDK
13
+ module Sdk
14
+
15
+ attr_reader :threeds_v2_sdk_interface, :threeds_v2_sdk_application_id, :threeds_v2_sdk_encrypted_data,
16
+ :threeds_v2_sdk_ephemeral_public_key_pair, :threeds_v2_sdk_max_timeout,
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
27
+
28
+ # UI type that the device of the consumer supports for displaying specific challenge interface
29
+ def threeds_v2_sdk_ui_types
30
+ @threeds_v2_sdk_ui_types ||= []
31
+ end
32
+
33
+ # UI type that the device of the consumer supports for displaying specific challenge interface
34
+ def threeds_v2_sdk_ui_types=(value)
35
+ ui_types = GenesisRuby::Api::Constants::Transactions::Parameters::Threeds::Version2::Sdk::UiTypes
36
+
37
+ unless ui_types.valid?(value)
38
+ raise InvalidArgumentError, format(
39
+ 'Invalid value given for %{method}. Allowed values: %{allowed}',
40
+ method: __method__,
41
+ allowed: ui_types.all
42
+ )
43
+ end
44
+
45
+ threeds_v2_sdk_ui_types.push value.to_s.downcase
46
+ end
47
+
48
+ # Universally unique ID created upon all installations and updates of the 3DS Requester APP on
49
+ # a Customer Device
50
+ def threeds_v2_sdk_application_id=(value)
51
+ limited_string attribute: __method__, value: value.to_s.empty? ? nil : value, max: 36
52
+ end
53
+
54
+ # JWE Object as defined Section 6.2.2.1 containing data encrypted by the SDK for the DS to decrypt
55
+ def threeds_v2_sdk_encrypted_data=(value)
56
+ limited_string attribute: __method__, value: value.to_s.empty? ? nil : value, max: 64_000
57
+ end
58
+
59
+ # Public key component of the ephemeral key pair generated by the 3DS SDK and used to
60
+ # establish session keys between the 3DS SDK and ACS
61
+ def threeds_v2_sdk_ephemeral_public_key_pair=(value)
62
+ limited_string attribute: __method__, value: value.to_s.empty? ? nil : value, max: 256
63
+ end
64
+
65
+ # Indicates the maximum amount of time (in minutes) for all exchanges
66
+ def threeds_v2_sdk_max_timeout=(value)
67
+ parse_int attribute: __method__, value: value, allow_empty: true
68
+
69
+ return if @threeds_v2_sdk_max_timeout.nil?
70
+
71
+ error_message = format(
72
+ 'Invalid value given for %{attribute}, should be greater than or equal to 5.',
73
+ attribute: __method__
74
+ )
75
+
76
+ raise InvalidArgumentError, error_message if @threeds_v2_sdk_max_timeout < 5
77
+ end
78
+
79
+ # Identifies the vendor and version of the 3DS SDK that is integrated in a 3DS Requester App,
80
+ # assigned by EMVCo when the 3DS SDK is approved
81
+ def threeds_v2_sdk_reference_number=(value)
82
+ limited_string attribute: __method__, value: value.to_s.empty? ? nil : value, max: 32
83
+ end
84
+
85
+ protected
86
+
87
+ # Request SDK Attributes structure
88
+ def sdk_attributes
89
+ {
90
+ interface: threeds_v2_sdk_interface,
91
+ ui_types: { ui_type: threeds_v2_sdk_ui_types },
92
+ application_id: threeds_v2_sdk_application_id,
93
+ encrypted_data: threeds_v2_sdk_encrypted_data,
94
+ ephemeral_public_key_pair: threeds_v2_sdk_ephemeral_public_key_pair,
95
+ max_timeout: threeds_v2_sdk_max_timeout,
96
+ reference_number: threeds_v2_sdk_reference_number
97
+ }
98
+ end
99
+
100
+ end
101
+ end
102
+ end
103
+ end
104
+ end
105
+ end
106
+ end
107
+ end