genesis_ruby 0.2.4 → 0.2.6

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 (71) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +46 -0
  3. data/Gemfile.lock +15 -15
  4. data/README.md +41 -0
  5. data/VERSION +1 -1
  6. data/lib/genesis_ruby/api/constants/currencies/iso4217.rb +6 -0
  7. data/lib/genesis_ruby/api/constants/non_financial/kyc/document_supported_types.rb +28 -0
  8. data/lib/genesis_ruby/api/constants/non_financial/kyc/document_types.rb +49 -0
  9. data/lib/genesis_ruby/api/constants/non_financial/kyc/genders.rb +22 -0
  10. data/lib/genesis_ruby/api/constants/non_financial/kyc/profile_current_statuses.rb +25 -0
  11. data/lib/genesis_ruby/api/constants/transactions/parameters/african_mobile_operators.rb +37 -0
  12. data/lib/genesis_ruby/api/constants/transactions/parameters/customer_identification/customer_identification_owner.rb +24 -0
  13. data/lib/genesis_ruby/api/constants/transactions/parameters/customer_identification/customer_identification_subtype.rb +24 -0
  14. data/lib/genesis_ruby/api/constants/transactions/parameters/customer_identification/customer_identification_type.rb +63 -0
  15. data/lib/genesis_ruby/api/constants/transactions/parameters/digital_asset_types.rb +31 -0
  16. data/lib/genesis_ruby/api/constants/transactions/parameters/purpose_of_payment.rb +136 -0
  17. data/lib/genesis_ruby/api/constants/transactions/parameters/source_of_funds.rb +34 -0
  18. data/lib/genesis_ruby/api/mixins/requests/digital_asset_type_attributes.rb +26 -0
  19. data/lib/genesis_ruby/api/mixins/requests/financial/african_mobile_attributes.rb +30 -0
  20. data/lib/genesis_ruby/api/mixins/requests/financial/cards/tokenization_params_attributes.rb +36 -0
  21. data/lib/genesis_ruby/api/mixins/requests/financial/customer_identification_attributes.rb +82 -0
  22. data/lib/genesis_ruby/api/mixins/requests/financial/gift_cards_attributes.rb +26 -0
  23. data/lib/genesis_ruby/api/mixins/requests/financial/preauthorization_attributes.rb +25 -0
  24. data/lib/genesis_ruby/api/mixins/requests/financial/purpose_of_payment_attributes.rb +29 -0
  25. data/lib/genesis_ruby/api/mixins/requests/financial/source_of_funds_attributes.rb +38 -0
  26. data/lib/genesis_ruby/api/mixins/requests/financial/travel_data/airline_itinerary_attributes.rb +1 -1
  27. data/lib/genesis_ruby/api/mixins/requests/non_financial/fx/id_attributes.rb +28 -0
  28. data/lib/genesis_ruby/api/mixins/requests/non_financial/fx/tier_id_attributes.rb +28 -0
  29. data/lib/genesis_ruby/api/mixins/requests/non_financial/kyc/customer_information_attributes.rb +62 -0
  30. data/lib/genesis_ruby/api/mixins/requests/non_financial/kyc/document_attributes.rb +60 -0
  31. data/lib/genesis_ruby/api/request.rb +7 -0
  32. data/lib/genesis_ruby/api/requests/base/financials/credit_card.rb +4 -2
  33. data/lib/genesis_ruby/api/requests/base/non_financial/kyc/base.rb +33 -0
  34. data/lib/genesis_ruby/api/requests/base/reference.rb +1 -2
  35. data/lib/genesis_ruby/api/requests/financial/cards/authorize.rb +5 -1
  36. data/lib/genesis_ruby/api/requests/financial/cards/authorize3d.rb +5 -1
  37. data/lib/genesis_ruby/api/requests/financial/cards/credit.rb +39 -0
  38. data/lib/genesis_ruby/api/requests/financial/cards/payout.rb +72 -0
  39. data/lib/genesis_ruby/api/requests/financial/cards/sale.rb +3 -1
  40. data/lib/genesis_ruby/api/requests/financial/cards/sale3d.rb +3 -1
  41. data/lib/genesis_ruby/api/requests/financial/crypto/bit_pay/payout.rb +52 -0
  42. data/lib/genesis_ruby/api/requests/financial/crypto/bit_pay/refund.rb +36 -0
  43. data/lib/genesis_ruby/api/requests/financial/crypto/bit_pay/sale.rb +55 -0
  44. data/lib/genesis_ruby/api/requests/financial/gift_cards/fashioncheque.rb +47 -0
  45. data/lib/genesis_ruby/api/requests/financial/gift_cards/intersolve.rb +46 -0
  46. data/lib/genesis_ruby/api/requests/financial/gift_cards/tcs.rb +47 -0
  47. data/lib/genesis_ruby/api/requests/financial/mobile/african_mobile_sale.rb +81 -0
  48. data/lib/genesis_ruby/api/requests/financial/mobile/russian_mobile_sale.rb +55 -0
  49. data/lib/genesis_ruby/api/requests/financial/preauthorizations/incremental_authorize.rb +24 -0
  50. data/lib/genesis_ruby/api/requests/financial/preauthorizations/partial_reversal.rb +24 -0
  51. data/lib/genesis_ruby/api/requests/financial/vouchers/neosurf.rb +61 -0
  52. data/lib/genesis_ruby/api/requests/non_financial/fraud/chargeback/date_range.rb +82 -0
  53. data/lib/genesis_ruby/api/requests/non_financial/fraud/chargeback/transaction.rb +52 -0
  54. data/lib/genesis_ruby/api/requests/non_financial/fraud/reports/date_range.rb +108 -0
  55. data/lib/genesis_ruby/api/requests/non_financial/fraud/reports/transaction.rb +52 -0
  56. data/lib/genesis_ruby/api/requests/non_financial/fx/get_rate.rb +55 -0
  57. data/lib/genesis_ruby/api/requests/non_financial/fx/get_rates.rb +53 -0
  58. data/lib/genesis_ruby/api/requests/non_financial/fx/get_tier.rb +53 -0
  59. data/lib/genesis_ruby/api/requests/non_financial/fx/get_tiers.rb +35 -0
  60. data/lib/genesis_ruby/api/requests/non_financial/fx/search_rate.rb +61 -0
  61. data/lib/genesis_ruby/api/requests/non_financial/kyc/consumer_registration/create.rb +99 -0
  62. data/lib/genesis_ruby/api/requests/non_financial/kyc/consumer_registration/update.rb +50 -0
  63. data/lib/genesis_ruby/api/requests/non_financial/kyc/verifications/remote_identity.rb +91 -0
  64. data/lib/genesis_ruby/api/requests/non_financial/tokenization/cryptogram.rb +5 -2
  65. data/lib/genesis_ruby/api/requests/wpf/create.rb +3 -1
  66. data/lib/genesis_ruby/configuration.rb +4 -0
  67. data/lib/genesis_ruby/dependencies.rb +1 -0
  68. data/lib/genesis_ruby/utils/country.rb +272 -0
  69. data/lib/genesis_ruby/utils/money/conversions/amount_to_exponent.rb +1 -4
  70. data/lib/genesis_ruby/version.rb +1 -1
  71. metadata +52 -2
@@ -0,0 +1,61 @@
1
+ module GenesisRuby
2
+ module Api
3
+ module Requests
4
+ module Financial
5
+ module Vouchers
6
+ # Neosurf is a prepaid card (voucher) that is used for online shopping
7
+ class Neosurf < Base::Financial
8
+
9
+ include Api::Mixins::Requests::AddressInfoAttributes
10
+ include Api::Mixins::Requests::Financial::AsyncAttributes
11
+
12
+ attr_reader :voucher_number
13
+
14
+ # Voucher number. Alphanumeric maximum 10 characters
15
+ def voucher_number=(value)
16
+ limited_string attribute: __method__,
17
+ value: value.to_s.empty? ? nil : value.to_s,
18
+ min: 1,
19
+ max: 10
20
+ end
21
+
22
+ protected
23
+
24
+ # Neosurf transaction type
25
+ def transaction_type
26
+ Api::Constants::Transactions::NEOSURF
27
+ end
28
+
29
+ # Neosurf Field Validations
30
+ def init_field_validations
31
+ super
32
+
33
+ required_fields.push *%i[transaction_id amount currency billing_country]
34
+ field_values.merge! currency: %w( AUD BGN BRL CAD CHF CNY CZK DKK EUR GBP HKD HUF IDR
35
+ ILS INR JPY KRW MXN MYR NOK NZD PHP PLN RON RUB SEK
36
+ SGD THB TRY USD XOF ZAR ),
37
+ billing_country: %w( AT DZ AU BI BF BJ BE CV CY CA CF TD CO CG CM CD DK GQ
38
+ FR GM DE GA GN GH GW HK IE IT CI KE LU MW MZ MA MR ML
39
+ NE NG NL NZ NO PL PT RW RU RO SE ES SL SN ST CH RS TR
40
+ TG TN GB TZ UG ZW ZM )
41
+ end
42
+
43
+ # Neosurf request structure
44
+ def payment_transaction_structure
45
+ {
46
+ voucher_number: voucher_number,
47
+ customer_email: customer_email,
48
+ customer_phone: customer_phone,
49
+ return_success_url: return_success_url,
50
+ return_failure_url: return_failure_url,
51
+ billing_address: billing_address_parameters_structure,
52
+ shipping_address: shipping_address_parameters_structure
53
+ }
54
+ end
55
+
56
+ end
57
+ end
58
+ end
59
+ end
60
+ end
61
+ end
@@ -0,0 +1,82 @@
1
+ require 'genesis_ruby/api/constants/transactions/parameters/non_financial/externally_processed'
2
+ require 'genesis_ruby/api/constants/transactions/parameters/non_financial/processing_type'
3
+
4
+ module GenesisRuby
5
+ module Api
6
+ module Requests
7
+ module NonFinancial
8
+ module Fraud
9
+ module Chargeback
10
+ # Date range based chargeback retrieval allows you to fetch information for all
11
+ # chargebacks for a given merchant within a given date range
12
+ class DateRange < Api::Request
13
+
14
+ include Api::Mixins::Requests::NonFinancial::DateAttributes
15
+ include Api::Mixins::Requests::NonFinancial::PagingAttributes
16
+
17
+ attr_accessor :externally_processed, :processing_type
18
+
19
+ # Start of the requested date range
20
+ def start_date
21
+ @start_date&.strftime Api::Constants::DateTimeFormats::YYYY_MM_DD_ISO_8601
22
+ end
23
+
24
+ # End of the requested date range
25
+ def end_date
26
+ @end_date&.strftime Api::Constants::DateTimeFormats::YYYY_MM_DD_ISO_8601
27
+ end
28
+
29
+ # Date of import in the system
30
+ def import_date
31
+ @import_date&.strftime Api::Constants::DateTimeFormats::YYYY_MM_DD_ISO_8601
32
+ end
33
+
34
+ # Date of import in the system
35
+ def import_date=(value)
36
+ parse_date attribute: __method__, value: value, allow_empty: true
37
+ end
38
+
39
+ protected
40
+
41
+ # Set Gateway API configuration
42
+ def init_configuration
43
+ init_xml_configuration
44
+ init_api_gateway_configuration request_path: 'chargebacks/by_date', include_token: false
45
+ @api_config.parser_skip_root_node = false
46
+ end
47
+
48
+ # Field Validations
49
+ def init_field_validations
50
+ super
51
+
52
+ constant_values = {
53
+ externally_processed: Constants::Transactions::Parameters::NonFinancial::ExternallyProcessed.all,
54
+ processing_type: Constants::Transactions::Parameters::NonFinancial::ProcessingType.all
55
+ }
56
+
57
+ required_fields.push *%i[start_date]
58
+ field_values.merge! constant_values
59
+ end
60
+
61
+ # API Request structure
62
+ def populate_structure # rubocop:disable Metrics/MethodLength
63
+ @tree_structure = {
64
+ chargeback_request: {
65
+ start_date: start_date,
66
+ end_date: end_date,
67
+ import_date: import_date,
68
+ page: page,
69
+ per_page: per_page,
70
+ externally_processed: externally_processed,
71
+ processing_type: processing_type
72
+ }
73
+ }
74
+ end
75
+
76
+ end
77
+ end
78
+ end
79
+ end
80
+ end
81
+ end
82
+ end
@@ -0,0 +1,52 @@
1
+ module GenesisRuby
2
+ module Api
3
+ module Requests
4
+ module NonFinancial
5
+ module Fraud
6
+ module Chargeback
7
+ # Retrieve a single chargeback or a list of chargebacks by ARN or by passing the unique ID
8
+ # of the original transaction
9
+ class Transaction < Api::Request
10
+
11
+ include Api::Mixins::Requests::NonFinancial::ModeAttributes
12
+
13
+ attr_accessor :arn, :original_transaction_unique_id
14
+
15
+ protected
16
+
17
+ # Set Gateway API configuration
18
+ def init_configuration
19
+ init_xml_configuration
20
+ init_api_gateway_configuration request_path: 'chargebacks', include_token: false
21
+ end
22
+
23
+ # Chargeback custom field validations
24
+ def check_requirements
25
+ unless arn.nil? ^ original_transaction_unique_id.nil?
26
+ raise(
27
+ ParameterError,
28
+ 'Either arn or original_transaction_unique_id field has to be set, not both.'
29
+ )
30
+ end
31
+
32
+ super
33
+ end
34
+
35
+ # API Request structure
36
+ def populate_structure
37
+ @tree_structure = {
38
+ chargeback_request: {
39
+ arn: arn,
40
+ original_transaction_unique_id: original_transaction_unique_id,
41
+ mode: mode
42
+ }
43
+ }
44
+ end
45
+
46
+ end
47
+ end
48
+ end
49
+ end
50
+ end
51
+ end
52
+ end
@@ -0,0 +1,108 @@
1
+ module GenesisRuby
2
+ module Api
3
+ module Requests
4
+ module NonFinancial
5
+ module Fraud
6
+ module Reports
7
+ # Date range based SAFE/TC40 retrieval allows you to fetch information for
8
+ # all SAFE/TC40 reports for a given merchant within a given date range
9
+ class DateRange < Api::Request
10
+
11
+ include Api::Mixins::Requests::NonFinancial::DateAttributes
12
+ include Api::Mixins::Requests::NonFinancial::PagingAttributes
13
+
14
+ # Start of the requested date range
15
+ def start_date
16
+ @start_date&.strftime Api::Constants::DateTimeFormats::YYYY_MM_DD_ISO_8601
17
+ end
18
+
19
+ # End of the requested date range
20
+ def end_date
21
+ @end_date&.strftime Api::Constants::DateTimeFormats::YYYY_MM_DD_ISO_8601
22
+ end
23
+
24
+ # Date of import in the system
25
+ def import_date
26
+ @import_date&.strftime Api::Constants::DateTimeFormats::YYYY_MM_DD_ISO_8601
27
+ end
28
+
29
+ # Date of import in the system
30
+ def import_date=(value)
31
+ parse_date attribute: __method__, value: value, allow_empty: true
32
+ end
33
+
34
+ # Start of the requested date range for the date when the fraud was reported
35
+ def report_start_date
36
+ @report_start_date&.strftime Api::Constants::DateTimeFormats::YYYY_MM_DD_ISO_8601
37
+ end
38
+
39
+ # Start of the requested date range for the date when the fraud was reported
40
+ def report_start_date=(value)
41
+ parse_date attribute: __method__, value: value, allow_empty: true
42
+ end
43
+
44
+ # End of the requested date range for the date when the fraud was reported
45
+ def report_end_date
46
+ @report_end_date&.strftime Api::Constants::DateTimeFormats::YYYY_MM_DD_ISO_8601
47
+ end
48
+
49
+ # End of the requested date range for the date when the fraud was reported
50
+ def report_end_date=(value)
51
+ parse_date attribute: __method__, value: value, allow_empty: true
52
+ end
53
+
54
+ protected
55
+
56
+ # Set Gateway API configuration
57
+ def init_configuration
58
+ init_xml_configuration
59
+ init_api_gateway_configuration request_path: 'fraud_reports/by_date', include_token: false
60
+ @api_config.parser_skip_root_node = false
61
+ end
62
+
63
+ # Field Validations
64
+ def init_field_validations
65
+ super
66
+
67
+ field_value_dependencies.merge!(
68
+ {
69
+ start_date: %i[end_date],
70
+ report_start_date: %i[report_end_date]
71
+ }
72
+ )
73
+ end
74
+
75
+ # Custom field validations
76
+ def check_requirements
77
+ fields = [start_date, import_date, report_start_date]
78
+ error_message =
79
+ 'Either start_date/end_date, import_date or report_start_date/report_end_date' \
80
+ ' fields have to be set, do not mix'
81
+
82
+ raise ParameterError, error_message if fields.compact.size != 1
83
+
84
+ super
85
+ end
86
+
87
+ # API Request structure
88
+ def populate_structure # rubocop:disable Metrics/MethodLength
89
+ @tree_structure = {
90
+ fraud_report_request: {
91
+ start_date: start_date,
92
+ end_date: end_date,
93
+ import_date: import_date,
94
+ report_start_date: report_start_date,
95
+ report_end_date: report_end_date,
96
+ page: page,
97
+ per_page: per_page
98
+ }
99
+ }
100
+ end
101
+
102
+ end
103
+ end
104
+ end
105
+ end
106
+ end
107
+ end
108
+ end
@@ -0,0 +1,52 @@
1
+ module GenesisRuby
2
+ module Api
3
+ module Requests
4
+ module NonFinancial
5
+ module Fraud
6
+ module Reports
7
+ # Retrieve a single SAFE/TC40 or a list of SAFE/TC40 by ARN or by passing
8
+ # the unique ID of the original transaction
9
+ class Transaction < Api::Request
10
+
11
+ include Api::Mixins::Requests::NonFinancial::ModeAttributes
12
+
13
+ attr_accessor :arn, :original_transaction_unique_id
14
+
15
+ protected
16
+
17
+ # Set Gateway API configuration
18
+ def init_configuration
19
+ init_xml_configuration
20
+ init_api_gateway_configuration request_path: 'fraud_reports', include_token: false
21
+ end
22
+
23
+ # Report custom field validations
24
+ def check_requirements
25
+ unless arn.nil? ^ original_transaction_unique_id.nil?
26
+ raise(
27
+ ParameterError,
28
+ 'Either arn or original_transaction_unique_id field has to be set, not both.'
29
+ )
30
+ end
31
+
32
+ super
33
+ end
34
+
35
+ # API Request structure
36
+ def populate_structure
37
+ @tree_structure = {
38
+ fraud_report_request: {
39
+ arn: arn,
40
+ original_transaction_unique_id: original_transaction_unique_id,
41
+ mode: mode
42
+ }
43
+ }
44
+ end
45
+
46
+ end
47
+ end
48
+ end
49
+ end
50
+ end
51
+ end
52
+ end
@@ -0,0 +1,55 @@
1
+ module GenesisRuby
2
+ module Api
3
+ module Requests
4
+ module NonFinancial
5
+ module Fx
6
+ # This call is used to return information about selected Rate for merchant
7
+ class GetRate < Base::Versioned
8
+
9
+ include Api::Mixins::Requests::NonFinancial::Fx::IdAttributes
10
+ include Api::Mixins::Requests::NonFinancial::Fx::TierIdAttributes
11
+
12
+ # Get Rate initialization
13
+ def initialize(configuration, _builder_interface = nil)
14
+ super configuration
15
+
16
+ self.request_path = 'fx/tiers/:tier_id/rates/:id'
17
+ end
18
+
19
+ protected
20
+
21
+ # Override default Versioned Network configuration
22
+ def init_configuration
23
+ super
24
+
25
+ init_get_configuration
26
+ end
27
+
28
+ # Fetch request field validations
29
+ def init_field_validations
30
+ super
31
+
32
+ required_fields.push *id_required_fields, *tier_id_required_fields
33
+ end
34
+
35
+ # Get Rate request structure
36
+ def request_structure
37
+ {}
38
+ end
39
+
40
+ # Override API endpoint with provided IDs
41
+ def process_request_parameters
42
+ super
43
+
44
+ request_path.sub!(':tier_id', tier_id)
45
+ request_path.sub!(':id', id)
46
+
47
+ init_api_gateway_configuration request_path: "#{version}/#{request_path}", include_token: false
48
+ end
49
+
50
+ end
51
+ end
52
+ end
53
+ end
54
+ end
55
+ end
@@ -0,0 +1,53 @@
1
+ module GenesisRuby
2
+ module Api
3
+ module Requests
4
+ module NonFinancial
5
+ module Fx
6
+ # This call is used to return all rates for Tier
7
+ class GetRates < Base::Versioned
8
+
9
+ include Api::Mixins::Requests::NonFinancial::Fx::TierIdAttributes
10
+
11
+ # Get Rates initialization
12
+ def initialize(configuration, _builder_interface = nil)
13
+ super configuration
14
+
15
+ self.request_path = 'fx/tiers/:tier_id/rates'
16
+ end
17
+
18
+ protected
19
+
20
+ # Override default Versioned Network configuration
21
+ def init_configuration
22
+ super
23
+
24
+ init_get_configuration
25
+ end
26
+
27
+ # Fetch request field validations
28
+ def init_field_validations
29
+ super
30
+
31
+ required_fields.push *tier_id_required_fields
32
+ end
33
+
34
+ # Get Rates request structure
35
+ def request_structure
36
+ {}
37
+ end
38
+
39
+ # Override API endpoint with provided ID
40
+ def process_request_parameters
41
+ super
42
+
43
+ request_path.sub!(':tier_id', tier_id)
44
+
45
+ init_api_gateway_configuration request_path: "#{version}/#{request_path}", include_token: false
46
+ end
47
+
48
+ end
49
+ end
50
+ end
51
+ end
52
+ end
53
+ end
@@ -0,0 +1,53 @@
1
+ module GenesisRuby
2
+ module Api
3
+ module Requests
4
+ module NonFinancial
5
+ module Fx
6
+ # This call is used to return information about selected Tier for your merchant
7
+ class GetTier < Base::Versioned
8
+
9
+ include Api::Mixins::Requests::NonFinancial::Fx::IdAttributes
10
+
11
+ # Get Tier initialization
12
+ def initialize(configuration, _builder_interface = nil)
13
+ super configuration
14
+
15
+ self.request_path = 'fx/tiers/:id'
16
+ end
17
+
18
+ protected
19
+
20
+ # Override default Versioned Network configuration
21
+ def init_configuration
22
+ super
23
+
24
+ init_get_configuration
25
+ end
26
+
27
+ # Fetch request field validations
28
+ def init_field_validations
29
+ super
30
+
31
+ required_fields.push *id_required_fields
32
+ end
33
+
34
+ # Get Tier request structure
35
+ def request_structure
36
+ {}
37
+ end
38
+
39
+ # Override API endpoint with provided ID
40
+ def process_request_parameters
41
+ super
42
+
43
+ request_path.sub!(':id', id)
44
+
45
+ init_api_gateway_configuration request_path: "#{version}/#{request_path}", include_token: false
46
+ end
47
+
48
+ end
49
+ end
50
+ end
51
+ end
52
+ end
53
+ end
@@ -0,0 +1,35 @@
1
+ module GenesisRuby
2
+ module Api
3
+ module Requests
4
+ module NonFinancial
5
+ module Fx
6
+ # This call is used to return all Tiers that are related to your account
7
+ class GetTiers < Base::Versioned
8
+
9
+ # Get Tiers initialization
10
+ def initialize(configuration, _builder_interface = nil)
11
+ super configuration
12
+
13
+ self.request_path = 'fx/tiers'
14
+ end
15
+
16
+ protected
17
+
18
+ # Override default Versioned Network configuration
19
+ def init_configuration
20
+ super
21
+
22
+ init_get_configuration
23
+ end
24
+
25
+ # Get Tiers request structure
26
+ def request_structure
27
+ {}
28
+ end
29
+
30
+ end
31
+ end
32
+ end
33
+ end
34
+ end
35
+ end
@@ -0,0 +1,61 @@
1
+ module GenesisRuby
2
+ module Api
3
+ module Requests
4
+ module NonFinancial
5
+ module Fx
6
+ # This call is used to return information about selected Rate by currency pair
7
+ class SearchRate < Base::Versioned
8
+
9
+ include Api::Mixins::Requests::NonFinancial::Fx::TierIdAttributes
10
+
11
+ attr_writer :source_currency, :target_currency
12
+
13
+ # Search Rate initialization
14
+ def initialize(configuration, _builder_interface = nil)
15
+ super configuration
16
+
17
+ self.request_path = 'fx/tiers/:tier_id/rates/search'
18
+ end
19
+
20
+ # Source currency
21
+ def source_currency
22
+ @source_currency.to_s.upcase
23
+ end
24
+
25
+ # Target currency
26
+ def target_currency
27
+ @target_currency.to_s.upcase
28
+ end
29
+
30
+ protected
31
+
32
+ # Fetch request field validations
33
+ def init_field_validations
34
+ super
35
+
36
+ required_fields.push *tier_id_required_fields, *%i[source_currency target_currency]
37
+ end
38
+
39
+ # Search Rate request structure
40
+ def request_structure
41
+ {
42
+ source_currency: source_currency,
43
+ target_currency: target_currency
44
+ }
45
+ end
46
+
47
+ # Override API endpoint with provided ID
48
+ def process_request_parameters
49
+ super
50
+
51
+ request_path.sub!(':tier_id', tier_id)
52
+
53
+ init_api_gateway_configuration request_path: "#{version}/#{request_path}", include_token: false
54
+ end
55
+
56
+ end
57
+ end
58
+ end
59
+ end
60
+ end
61
+ end