genesis_ruby 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
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,31 @@
1
+ require 'genesis_ruby/api/constants/transactions/parameters/recurring/types'
2
+
3
+ module GenesisRuby
4
+ module Api
5
+ module Mixins
6
+ module Requests
7
+ module Financial
8
+ module Cards
9
+ module Recurring
10
+ # Recurring Type Attributes
11
+ module RecurringTypeAttributes
12
+
13
+ attr_reader :recurring_type
14
+
15
+ # Specifies the recurring type of transaction
16
+ def recurring_type=(value)
17
+ allowed_options attribute: __method__,
18
+ allowed: GenesisRuby::Api::Constants::Transactions::Parameters::Recurring::
19
+ Types.all,
20
+ value: value,
21
+ allow_empty: true
22
+ end
23
+
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,39 @@
1
+ module GenesisRuby
2
+ module Api
3
+ module Mixins
4
+ module Requests
5
+ module Financial
6
+ module Cards
7
+ # Tokenization Attributes mixin
8
+ module TokenizationAttributes
9
+
10
+ attr_reader :remember_card
11
+ attr_accessor :consumer_id, :token
12
+
13
+ # Tokenizes cardholder parameters. Cannot be set together with token
14
+ def remember_card=(value)
15
+ allowed_options attribute: __method__,
16
+ allowed: [true, false],
17
+ value: value,
18
+ allow_empty: true,
19
+ error_message: 'Accepts only boolean values'
20
+ end
21
+
22
+ protected
23
+
24
+ # Tokenization Attributes Structure
25
+ def tokenization_attributes_structure
26
+ {
27
+ token: token,
28
+ consumer_id: consumer_id,
29
+ remember_card: remember_card
30
+ }
31
+ end
32
+
33
+ end
34
+ end
35
+ end
36
+ end
37
+ end
38
+ end
39
+ end
@@ -0,0 +1,25 @@
1
+ module GenesisRuby
2
+ module Api
3
+ module Mixins
4
+ module Requests
5
+ module Financial
6
+ # Crypto Attributes mixin
7
+ module CryptoAttributes
8
+
9
+ attr_reader :crypto
10
+
11
+ # Signifies whether a crypto transaction is performed
12
+ def crypto=(value)
13
+ allowed_options attribute: __method__,
14
+ allowed: [true, false],
15
+ value: value,
16
+ allow_empty: true,
17
+ error_message: 'Accepts only boolean values'
18
+ end
19
+
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,114 @@
1
+ module GenesisRuby
2
+ module Api
3
+ module Mixins
4
+ module Requests
5
+ module Financial
6
+ # Dynamic Descriptor Attributes
7
+ module DynamicDescriptorAttributes
8
+
9
+ attr_reader :dynamic_descriptor_merchant_name, :dynamic_descriptor_merchant_city,
10
+ :dynamic_descriptor_sub_merchant_id, :dynamic_descriptor_merchant_country,
11
+ :dynamic_descriptor_merchant_state, :dynamic_descriptor_merchant_zip_code,
12
+ :dynamic_descriptor_merchant_address, :dynamic_descriptor_merchant_url,
13
+ :dynamic_descriptor_merchant_phone, :dynamic_descriptor_merchant_service_city,
14
+ :dynamic_descriptor_merchant_service_country, :dynamic_descriptor_merchant_service_state,
15
+ :dynamic_descriptor_merchant_service_zip_code, :dynamic_descriptor_merchant_service_phone
16
+
17
+ # Allows to dynamically override the charge descriptor
18
+ def dynamic_descriptor_merchant_name=(value)
19
+ limited_string attribute: __method__, value: value.to_s.empty? ? nil : value.to_s, max: 25
20
+ end
21
+
22
+ # Allows to dynamically override the merchant city
23
+ def dynamic_descriptor_merchant_city=(value)
24
+ limited_string attribute: __method__, value: value.to_s.empty? ? nil : value.to_s, max: 13
25
+ end
26
+
27
+ # Allows to dynamically override the sub-merchant ID
28
+ def dynamic_descriptor_sub_merchant_id=(value)
29
+ limited_string attribute: __method__, value: value.to_s.empty? ? nil : value.to_s, max: 15
30
+ end
31
+
32
+ # Allows to dynamically override the merchant country
33
+ def dynamic_descriptor_merchant_country=(value)
34
+ limited_string attribute: __method__, value: value.to_s.empty? ? nil : value.to_s, max: 3
35
+ end
36
+
37
+ # Allows to dynamically override the merchant subdivision code
38
+ def dynamic_descriptor_merchant_state=(value)
39
+ limited_string attribute: __method__, value: value.to_s.empty? ? nil : value.to_s, max: 3
40
+ end
41
+
42
+ # Allows to dynamically override the merchant zip/postal code
43
+ def dynamic_descriptor_merchant_zip_code=(value)
44
+ limited_string attribute: __method__, value: value.to_s.empty? ? nil : value.to_s, max: 10
45
+ end
46
+
47
+ # Allows to dynamically override the merchant address
48
+ def dynamic_descriptor_merchant_address=(value)
49
+ limited_string attribute: __method__, value: value.to_s.empty? ? nil : value.to_s, max: 48
50
+ end
51
+
52
+ # Allows to dynamically override the merchant URL
53
+ def dynamic_descriptor_merchant_url=(value)
54
+ limited_string attribute: __method__, value: value.to_s.empty? ? nil : value.to_s, max: 60
55
+ end
56
+
57
+ # Allows to dynamically override the merchant phone number
58
+ def dynamic_descriptor_merchant_phone=(value)
59
+ limited_string attribute: __method__, value: value.to_s.empty? ? nil : value.to_s, max: 16
60
+ end
61
+
62
+ # Allows to dynamically override the merchant service city
63
+ def dynamic_descriptor_merchant_service_city=(value)
64
+ limited_string attribute: __method__, value: value.to_s.empty? ? nil : value.to_s, max: 13
65
+ end
66
+
67
+ # Allows to dynamically override the merchant service country
68
+ def dynamic_descriptor_merchant_service_country=(value)
69
+ limited_string attribute: __method__, value: value.to_s.empty? ? nil : value.to_s, max: 3
70
+ end
71
+
72
+ # Allows to dynamically override the merchant service subdivision code
73
+ def dynamic_descriptor_merchant_service_state=(value)
74
+ limited_string attribute: __method__, value: value.to_s.empty? ? nil : value.to_s, max: 3
75
+ end
76
+
77
+ # Allows to dynamically override the merchant service zip/postal
78
+ def dynamic_descriptor_merchant_service_zip_code=(value)
79
+ limited_string attribute: __method__, value: value.to_s.empty? ? nil : value.to_s, max: 10
80
+ end
81
+
82
+ # Allows to dynamically override the merchant service phone number
83
+ def dynamic_descriptor_merchant_service_phone=(value)
84
+ limited_string attribute: __method__, value: value.to_s.empty? ? nil : value.to_s, max: 16
85
+ end
86
+
87
+ protected
88
+
89
+ # Dynamic Descriptor Params structure
90
+ def dynamic_descriptor_structure # rubocop:disable Metrics/MethodLength
91
+ {
92
+ merchant_name: dynamic_descriptor_merchant_name,
93
+ merchant_city: dynamic_descriptor_merchant_city,
94
+ sub_merchant_id: dynamic_descriptor_sub_merchant_id,
95
+ merchant_country: dynamic_descriptor_merchant_country,
96
+ merchant_state: dynamic_descriptor_merchant_state,
97
+ merchant_zip_code: dynamic_descriptor_merchant_zip_code,
98
+ merchant_address: dynamic_descriptor_merchant_address,
99
+ merchant_url: dynamic_descriptor_merchant_url,
100
+ merchant_phone: dynamic_descriptor_merchant_phone,
101
+ merchant_service_city: dynamic_descriptor_merchant_service_city,
102
+ merchant_service_country: dynamic_descriptor_merchant_service_country,
103
+ merchant_service_state: dynamic_descriptor_merchant_service_state,
104
+ merchant_service_zip_code: dynamic_descriptor_merchant_service_zip_code,
105
+ merchant_service_phone: dynamic_descriptor_merchant_service_phone
106
+ }
107
+ end
108
+
109
+ end
110
+ end
111
+ end
112
+ end
113
+ end
114
+ end
@@ -0,0 +1,25 @@
1
+ module GenesisRuby
2
+ module Api
3
+ module Mixins
4
+ module Requests
5
+ module Financial
6
+ # Gaming Attributes mixin
7
+ module GamingAttributes
8
+
9
+ attr_reader :gaming
10
+
11
+ # Signifies whether a gaming transaction is performed
12
+ def gaming=(value)
13
+ allowed_options attribute: __method__,
14
+ allowed: [true, false],
15
+ value: value,
16
+ allow_empty: true,
17
+ error_message: 'Accepts only boolean values'
18
+ end
19
+
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,25 @@
1
+ module GenesisRuby
2
+ module Api
3
+ module Mixins
4
+ module Requests
5
+ module Financial
6
+ # Moto Attributes mixin
7
+ module MotoAttributes
8
+
9
+ attr_reader :moto
10
+
11
+ # Signifies whether a moto transaction is performed
12
+ def moto=(value)
13
+ allowed_options attribute: __method__,
14
+ allowed: [true, false],
15
+ value: value,
16
+ allow_empty: true,
17
+ error_message: 'Accepts only boolean values'
18
+ end
19
+
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,25 @@
1
+ module GenesisRuby
2
+ module Api
3
+ module Mixins
4
+ module Requests
5
+ module Financial
6
+ # Mixin Notification Attributes
7
+ module NotificationAttributes
8
+
9
+ attr_reader :notification_url
10
+
11
+ # Return Success URL setter
12
+ def notification_url=(value)
13
+ unless GenesisRuby::Utils::Common.valid_url?(value)
14
+ raise ParameterError, "Invalid URL given for #{__method__}"
15
+ end
16
+
17
+ @notification_url = value
18
+ end
19
+
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,32 @@
1
+ module GenesisRuby
2
+ module Api
3
+ module Mixins
4
+ module Requests
5
+ module Financial
6
+ # Mixin Payment Attributes, brings Payment Attributes partial
7
+ module PaymentAttributes
8
+
9
+ attr_accessor :amount
10
+ attr_writer :currency
11
+
12
+ # Currency Attribute getter
13
+ def currency
14
+ @currency.to_s.upcase
15
+ end
16
+
17
+ protected
18
+
19
+ # Returns the Payment Attributes structure with the Genesis Request keys
20
+ def payment_attributes_structure
21
+ {
22
+ amount: transform_amount(amount, currency),
23
+ currency: currency
24
+ }
25
+ end
26
+
27
+ end
28
+ end
29
+ end
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,25 @@
1
+ module GenesisRuby
2
+ module Api
3
+ module Mixins
4
+ module Requests
5
+ module Financial
6
+ # Mixin Pending Payment Attributes
7
+ module PendingPaymentAttributes
8
+
9
+ attr_reader :return_pending_url
10
+
11
+ # Return Success URL setter
12
+ def return_pending_url=(value)
13
+ unless GenesisRuby::Utils::Common.valid_url?(value)
14
+ raise ParameterError, "Invalid URL given for #{__method__}"
15
+ end
16
+
17
+ @return_pending_url = value
18
+ end
19
+
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,16 @@
1
+ module GenesisRuby
2
+ module Api
3
+ module Mixins
4
+ module Requests
5
+ module Financial
6
+ # Reference Attributes mixin
7
+ module ReferenceAttributes
8
+
9
+ attr_accessor :reference_id
10
+
11
+ end
12
+ end
13
+ end
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,47 @@
1
+ module GenesisRuby
2
+ module Api
3
+ module Mixins
4
+ module Requests
5
+ module Financial
6
+ # Risk Params Attributes
7
+ module RiskAttributes
8
+
9
+ attr_accessor :risk_ssn, :risk_mac_address, :risk_session_id, :risk_user_id, :risk_user_level, :risk_email,
10
+ :risk_phone, :risk_remote_ip, :risk_serial_number, :risk_pan_tail, :risk_bin,
11
+ :risk_first_name, :risk_last_name, :risk_country, :risk_pan, :risk_forwarded_ip,
12
+ :risk_username, :risk_password, :risk_bin_name, :risk_bin_phone
13
+
14
+ protected
15
+
16
+ # Risk Params Structure
17
+ def risk_parameters_structure # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
18
+ {
19
+ ssn: risk_ssn,
20
+ mac_address: risk_mac_address,
21
+ session_id: risk_session_id,
22
+ user_id: risk_user_id,
23
+ user_level: risk_user_level,
24
+ email: risk_email,
25
+ phone: risk_phone,
26
+ remote_ip: risk_remote_ip,
27
+ serial_number: risk_serial_number,
28
+ pan_tail: risk_pan_tail,
29
+ bin: risk_bin,
30
+ first_name: risk_first_name,
31
+ last_name: risk_last_name,
32
+ country: risk_country,
33
+ pan: risk_pan,
34
+ forwarded_ip: risk_forwarded_ip,
35
+ username: risk_username,
36
+ password: risk_password,
37
+ bin_name: risk_bin_name,
38
+ bin_phone: risk_bin_phone
39
+ }
40
+ end
41
+
42
+ end
43
+ end
44
+ end
45
+ end
46
+ end
47
+ end
@@ -0,0 +1,37 @@
1
+ require 'genesis_ruby/api/constants/transactions/parameters/sca_exemptions'
2
+
3
+ module GenesisRuby
4
+ module Api
5
+ module Mixins
6
+ module Requests
7
+ module Financial
8
+ # SCA Attributes mixin
9
+ module ScaAttributes
10
+
11
+ attr_reader :sca_exemption
12
+ attr_accessor :sca_visa_merchant_id
13
+
14
+ # The exemption that the transaction should take advantage of
15
+ def sca_exemption=(value)
16
+ allowed_options attribute: __method__,
17
+ allowed: GenesisRuby::Api::Constants::Transactions::Parameters::ScaExemptions.all,
18
+ value: value.to_s.empty? ? nil : value.to_s.downcase,
19
+ allow_empty: true
20
+ end
21
+
22
+ protected
23
+
24
+ # SCA Params Attributes Structure
25
+ def sca_attributes_structure
26
+ {
27
+ exemption: sca_exemption,
28
+ visa_merchant_id: sca_visa_merchant_id
29
+ }
30
+ end
31
+
32
+ end
33
+ end
34
+ end
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,92 @@
1
+ require 'genesis_ruby/api/constants/transactions/parameters/threeds/version2/browser/color_depths'
2
+ require 'genesis_ruby/errors/invalid_argument_error'
3
+
4
+ module GenesisRuby
5
+ module Api
6
+ module Mixins
7
+ module Requests
8
+ module Financial
9
+ module Threeds
10
+ module Version2
11
+ # Mixin ThreedsV2 Browser Attributes
12
+ module Browser
13
+
14
+ attr_reader :threeds_v2_browser_accept_header, :threeds_v2_browser_java_enabled,
15
+ :threeds_v2_browser_language, :threeds_v2_browser_color_depth,
16
+ :threeds_v2_browser_screen_height, :threeds_v2_browser_screen_width,
17
+ :threeds_v2_browser_time_zone_offset, :threeds_v2_browser_user_agent
18
+
19
+ # Exact content of the HTTP accept headers as sent to the 3DS Requester from the Cardholder browser
20
+ def threeds_v2_browser_accept_header=(value)
21
+ limited_string attribute: __method__, value: value.to_s.empty? ? nil : value.to_s, max: 2048
22
+ end
23
+
24
+ # Value representing the browser language as defined in IETF BCP47
25
+ def threeds_v2_browser_language=(value)
26
+ limited_string attribute: __method__, value: value.to_s.empty? ? nil : value.to_s, max: 8
27
+ end
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
+ # Total height of the Cardholder's screen in pixels
41
+ def threeds_v2_browser_screen_height=(value)
42
+ parse_int attribute: __method__, value: value, allow_empty: true
43
+ end
44
+
45
+ # Total width of the Cardholder's screen in pixels
46
+ def threeds_v2_browser_screen_width=(value)
47
+ parse_int attribute: __method__, value: value, allow_empty: true
48
+ end
49
+
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
+ # Time difference between UTC time and the Cardholder browser local time, in minutes
60
+ def threeds_v2_browser_time_zone_offset=(value)
61
+ limited_string attribute: __method__, value: value.to_s.empty? ? nil : value.to_s, max: 5
62
+ end
63
+
64
+ # Exact content of the HTTP user-agent header
65
+ def threeds_v2_browser_user_agent=(value)
66
+ limited_string attribute: __method__, value: value.to_s.empty? ? nil : value.to_s, max: 2048
67
+ end
68
+
69
+ protected
70
+
71
+ # Request Browser Attributes structure
72
+ def browser_attributes
73
+ {
74
+ accept_header: threeds_v2_browser_accept_header,
75
+ java_enabled: threeds_v2_browser_java_enabled,
76
+ language: threeds_v2_browser_language,
77
+ color_depth: threeds_v2_browser_color_depth,
78
+ screen_height: threeds_v2_browser_screen_height,
79
+ screen_width: threeds_v2_browser_screen_width,
80
+ time_zone_offset: threeds_v2_browser_time_zone_offset,
81
+ user_agent: threeds_v2_browser_user_agent
82
+ }
83
+ end
84
+
85
+ end
86
+ end
87
+ end
88
+ end
89
+ end
90
+ end
91
+ end
92
+ end