genesis_ruby 0.1.6 → 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.
Files changed (64) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +26 -0
  3. data/Gemfile.lock +42 -38
  4. data/README.md +305 -3
  5. data/VERSION +1 -1
  6. data/lib/genesis_ruby/api/constants/transactions/parameters/mobile/apple_pay/payment_subtypes.rb +29 -0
  7. data/lib/genesis_ruby/api/constants/transactions/parameters/mobile/google_pay/payment_subtypes.rb +29 -0
  8. data/lib/genesis_ruby/api/constants/transactions/parameters/mpi_protocol_sub_versions.rb +43 -0
  9. data/lib/genesis_ruby/api/constants/transactions/parameters/online_banking/bank_code_currencies.rb +128 -0
  10. data/lib/genesis_ruby/api/constants/transactions/parameters/online_banking/bank_codes.rb +600 -0
  11. data/lib/genesis_ruby/api/constants/transactions/parameters/online_banking/payment_types.rb +36 -0
  12. data/lib/genesis_ruby/api/constants/transactions/parameters/travel_data/ancillary_charges_types.rb +43 -0
  13. data/lib/genesis_ruby/api/constants/transactions.rb +1 -5
  14. data/lib/genesis_ruby/api/mixins/requests/attribute_validation.rb +138 -4
  15. data/lib/genesis_ruby/api/mixins/requests/birth_date_attributes.rb +22 -0
  16. data/lib/genesis_ruby/api/mixins/requests/customer_address/customer_info_attributes.rb +1 -1
  17. data/lib/genesis_ruby/api/mixins/requests/financial/cards/credit_card_attributes.rb +7 -0
  18. data/lib/genesis_ruby/api/mixins/requests/financial/cards/mpi_attributes.rb +14 -4
  19. data/lib/genesis_ruby/api/mixins/requests/financial/cards/recurring/managed_recurring_attributes.rb +23 -20
  20. data/lib/genesis_ruby/api/mixins/requests/financial/cards/recurring/managed_recurring_indian_card_attributes.rb +19 -39
  21. data/lib/genesis_ruby/api/mixins/requests/financial/cards/recurring/recurring_type_attributes.rb +15 -9
  22. data/lib/genesis_ruby/api/mixins/requests/financial/cards/tokenization_attributes.rb +9 -0
  23. data/lib/genesis_ruby/api/mixins/requests/financial/mobile/apple_pay_token_attributes.rb +51 -0
  24. data/lib/genesis_ruby/api/mixins/requests/financial/mobile/google_pay_token_attributes.rb +50 -0
  25. data/lib/genesis_ruby/api/mixins/requests/financial/online_banking_payments/virtual_payment_address_attributes.rb +27 -0
  26. data/lib/genesis_ruby/api/mixins/requests/financial/threeds/version2/browser.rb +11 -22
  27. data/lib/genesis_ruby/api/mixins/requests/financial/threeds/version2/card_holder_account.rb +81 -49
  28. data/lib/genesis_ruby/api/mixins/requests/financial/threeds/version2/common_attributes.rb +23 -0
  29. data/lib/genesis_ruby/api/mixins/requests/financial/threeds/version2/control.rb +13 -26
  30. data/lib/genesis_ruby/api/mixins/requests/financial/threeds/version2/merchant_risk.rb +21 -58
  31. data/lib/genesis_ruby/api/mixins/requests/financial/threeds/version2/purchase.rb +8 -11
  32. data/lib/genesis_ruby/api/mixins/requests/financial/threeds/version2/sdk.rb +10 -10
  33. data/lib/genesis_ruby/api/mixins/requests/financial/threeds/version2/wpf_attributes.rb +9 -0
  34. data/lib/genesis_ruby/api/mixins/requests/financial/travel_data/airline_itinerary_attributes.rb +166 -0
  35. data/lib/genesis_ruby/api/mixins/requests/financial/travel_data/car_rental_attributes.rb +119 -0
  36. data/lib/genesis_ruby/api/mixins/requests/financial/travel_data/hotel_rental_attributes.rb +77 -0
  37. data/lib/genesis_ruby/api/mixins/requests/financial/travel_data/reference_ticket_attributes.rb +75 -0
  38. data/lib/genesis_ruby/api/mixins/requests/financial/travel_data/travel_attributes.rb +34 -0
  39. data/lib/genesis_ruby/api/request.rb +4 -2
  40. data/lib/genesis_ruby/api/requests/base/financials/credit_card.rb +6 -4
  41. data/lib/genesis_ruby/api/requests/base/reference.rb +3 -2
  42. data/lib/genesis_ruby/api/requests/financial/capture.rb +3 -1
  43. data/lib/genesis_ruby/api/requests/financial/cards/authorize.rb +13 -3
  44. data/lib/genesis_ruby/api/requests/financial/cards/authorize3d.rb +22 -11
  45. data/lib/genesis_ruby/api/requests/financial/cards/sale.rb +13 -3
  46. data/lib/genesis_ruby/api/requests/financial/cards/sale3d.rb +22 -11
  47. data/lib/genesis_ruby/api/requests/financial/cards/threeds/v2/method_continue.rb +2 -2
  48. data/lib/genesis_ruby/api/requests/financial/mobile/apple_pay.rb +91 -0
  49. data/lib/genesis_ruby/api/requests/financial/mobile/google_pay.rb +108 -0
  50. data/lib/genesis_ruby/api/requests/financial/online_banking_payments/online_banking/pay_in.rb +157 -0
  51. data/lib/genesis_ruby/api/requests/financial/void.rb +2 -2
  52. data/lib/genesis_ruby/api/requests/non_financial/reconcile/date_range.rb +2 -2
  53. data/lib/genesis_ruby/api/requests/wpf/create.rb +11 -15
  54. data/lib/genesis_ruby/api/requests/wpf/reconcile.rb +2 -2
  55. data/lib/genesis_ruby/builders/xml.rb +6 -0
  56. data/lib/genesis_ruby/utils/common.rb +26 -0
  57. data/lib/genesis_ruby/utils/transactions/financial_types.rb +1 -1
  58. data/lib/genesis_ruby/utils/transactions/references/refundable_types.rb +1 -1
  59. data/lib/genesis_ruby/utils/transactions/travel_data/airline_itinerary/base.rb +33 -0
  60. data/lib/genesis_ruby/utils/transactions/travel_data/airline_itinerary/leg.rb +97 -0
  61. data/lib/genesis_ruby/utils/transactions/travel_data/airline_itinerary/tax.rb +42 -0
  62. data/lib/genesis_ruby/utils/transactions/wpf_types.rb +1 -1
  63. data/lib/genesis_ruby/version.rb +1 -1
  64. metadata +24 -2
@@ -0,0 +1,108 @@
1
+ require 'genesis_ruby/api/constants/transactions/parameters/mobile/google_pay/payment_subtypes'
2
+
3
+ module GenesisRuby
4
+ module Api
5
+ module Requests
6
+ module Financial
7
+ module Mobile
8
+ # Google Pay transaction request
9
+ class GooglePay < Requests::Base::Financial
10
+
11
+ attr_accessor :payment_subtype
12
+
13
+ include Mixins::Requests::AddressInfoAttributes
14
+ include Mixins::Requests::BirthDateAttributes
15
+ include Mixins::Requests::DocumentAttributes
16
+ include Mixins::Requests::Financial::AsyncAttributes
17
+ include Mixins::Requests::Financial::Business::BusinessAttributes
18
+ include Mixins::Requests::Financial::DynamicDescriptorAttributes
19
+ include Mixins::Requests::Financial::Mobile::GooglePayTokenAttributes
20
+ include Mixins::Requests::Financial::NotificationAttributes
21
+ include Mixins::Requests::Financial::PaymentAttributes
22
+ include Mixins::Requests::Financial::Threeds::Version2::CommonAttributes
23
+
24
+ # Define a payment token from a JSON string
25
+ def json_token=(value)
26
+ json_object = Utils::Common.parse_json_string value
27
+
28
+ map_google_pay_token_attributes json_object
29
+ end
30
+
31
+ protected
32
+
33
+ # Google Pay transaction request type
34
+ def transaction_type
35
+ Constants::Transactions::GOOGLE_PAY
36
+ end
37
+
38
+ # Google Pay Required fields
39
+ def init_field_validations
40
+ super
41
+
42
+ required_fields.push *%i[transaction_id payment_subtype amount currency token_signature token_signed_key
43
+ token_signatures token_protocol_version token_signed_message]
44
+
45
+ field_values.merge! currency: Constants::Currencies::Iso4217.all.map(&:upcase),
46
+ payment_subtype: Constants::Transactions::Parameters::Mobile::GooglePay::
47
+ PaymentSubtypes.all
48
+ field_values.merge! threeds_field_validations
49
+
50
+ field_value_dependencies.merge! threeds_field_conditional_validations
51
+ end
52
+
53
+ # Special validations upon document building
54
+ def check_requirements
55
+ validate_threeds_card_holder_dates
56
+
57
+ super
58
+ end
59
+
60
+ # Google Pay Payment Transaction Structure
61
+ def payment_transaction_structure # rubocop:disable Metrics/MethodLength
62
+ payment_attributes_structure.merge(
63
+ {
64
+ payment_subtype: payment_subtype,
65
+ payment_token: google_pay_token_structure,
66
+ customer_email: customer_email,
67
+ customer_phone: customer_phone,
68
+ birth_date: birth_date,
69
+ notification_url: notification_url,
70
+ return_success_url: return_success_url,
71
+ return_failure_url: return_failure_url,
72
+ billing_address: billing_address_parameters_structure,
73
+ shipping_address: shipping_address_parameters_structure,
74
+ business_attributes: business_attributes_structure,
75
+ dynamic_descriptor_params: dynamic_descriptor_structure,
76
+ document_id: document_id,
77
+ threeds_v2_params: threeds_v2_common_attributes_structure
78
+ }
79
+ )
80
+ end
81
+
82
+ private
83
+
84
+ # Map the Google Pay Token attributes from the given Hash object
85
+ def map_google_pay_token_attributes(json_object)
86
+ return nil unless json_object.is_a? Hash
87
+
88
+ json_object.each do |token_key, token_value|
89
+ if token_value.is_a? Hash
90
+ map_google_pay_token_attributes token_value
91
+
92
+ next
93
+ end
94
+
95
+ token_method = "token_#{GenesisRuby::Utils::Common.camel_to_snake_case(token_key)}="
96
+
97
+ __send__ token_method, token_value if respond_to? token_method
98
+ end
99
+
100
+ nil
101
+ end
102
+
103
+ end
104
+ end
105
+ end
106
+ end
107
+ end
108
+ end
@@ -0,0 +1,157 @@
1
+ require 'genesis_ruby/api/constants/transactions/parameters/online_banking/payment_types'
2
+ require 'genesis_ruby/api/constants/transactions/parameters/online_banking/bank_code_currencies'
3
+
4
+ module GenesisRuby
5
+ module Api
6
+ module Requests
7
+ module Financial
8
+ module OnlineBankingPayments
9
+ module OnlineBanking
10
+ # Online Banking PayIn transaction class
11
+ class PayIn < Base::Financial # rubocop:disable Metrics/ClassLength
12
+
13
+ include Api::Mixins::Requests::AddressInfoAttributes
14
+ include Api::Mixins::Requests::DocumentAttributes
15
+ include Api::Mixins::Requests::Financial::AsyncAttributes
16
+ include Api::Mixins::Requests::Financial::OnlineBankingPayments::VirtualPaymentAddressAttributes
17
+ include Api::Mixins::Requests::Financial::PaymentAttributes
18
+
19
+ attr_accessor :user_category, :payment_type, :bank_code, :consumer_reference, :auth_code
20
+
21
+ protected
22
+
23
+ # Online Banking PayIn transaction type
24
+ def transaction_type
25
+ Api::Constants::Transactions::ONLINE_BANKING_PAYIN
26
+ end
27
+
28
+ # Online Banking PayIn field validations
29
+ def init_field_validations # rubocop:disable Metrics/MethodLength, Metrics/AbcSize
30
+ required_fields.push *%i[transaction_id return_success_url return_failure_url amount currency bank_code]
31
+
32
+ field_values.merge! payment_type: Api::Constants::Transactions::Parameters::OnlineBanking::
33
+ PaymentTypes.all,
34
+ currency: Api::Constants::Transactions::Parameters::OnlineBanking::
35
+ BankCodeCurrencies.all.map(&:upcase),
36
+ bank_code: Api::Constants::Transactions::Parameters::OnlineBanking::BankCodes.all
37
+
38
+ field_value_dependencies.merge!(
39
+ {
40
+ currency: {
41
+ AUD: {
42
+ bank_code: Api::Constants::Transactions::Parameters::OnlineBanking::BankCodeCurrencies
43
+ .bank_codes_per_currency('AUD')
44
+ },
45
+ BRL: {
46
+ bank_code: Api::Constants::Transactions::Parameters::OnlineBanking::BankCodeCurrencies
47
+ .bank_codes_per_currency('BRL')
48
+ },
49
+ CAD: {
50
+ bank_code: Api::Constants::Transactions::Parameters::OnlineBanking::BankCodeCurrencies
51
+ .bank_codes_per_currency('CAD')
52
+ },
53
+ CHF: {
54
+ bank_code: Api::Constants::Transactions::Parameters::OnlineBanking::BankCodeCurrencies
55
+ .bank_codes_per_currency('CHF')
56
+ },
57
+ CNY: {
58
+ bank_code: Api::Constants::Transactions::Parameters::OnlineBanking::BankCodeCurrencies
59
+ .bank_codes_per_currency('CNY')
60
+ },
61
+ CLP: {
62
+ bank_code: Api::Constants::Transactions::Parameters::OnlineBanking::BankCodeCurrencies
63
+ .bank_codes_per_currency('CLP')
64
+ },
65
+ EUR: {
66
+ bank_code: Api::Constants::Transactions::Parameters::OnlineBanking::BankCodeCurrencies
67
+ .bank_codes_per_currency('EUR')
68
+ },
69
+ THB: {
70
+ bank_code: Api::Constants::Transactions::Parameters::OnlineBanking::BankCodeCurrencies
71
+ .bank_codes_per_currency('THB')
72
+ },
73
+ USD: {
74
+ bank_code: Api::Constants::Transactions::Parameters::OnlineBanking::BankCodeCurrencies
75
+ .bank_codes_per_currency('USD')
76
+ },
77
+ MYR: {
78
+ bank_code: Api::Constants::Transactions::Parameters::OnlineBanking::BankCodeCurrencies
79
+ .bank_codes_per_currency('MYR')
80
+ },
81
+ PEN: {
82
+ bank_code: Api::Constants::Transactions::Parameters::OnlineBanking::BankCodeCurrencies
83
+ .bank_codes_per_currency('PEN')
84
+ },
85
+ PYG: {
86
+ bank_code: Api::Constants::Transactions::Parameters::OnlineBanking::BankCodeCurrencies
87
+ .bank_codes_per_currency('PYG')
88
+ },
89
+ IDR: {
90
+ bank_code: Api::Constants::Transactions::Parameters::OnlineBanking::BankCodeCurrencies
91
+ .bank_codes_per_currency('IDR')
92
+ },
93
+ INR: {
94
+ bank_code: Api::Constants::Transactions::Parameters::OnlineBanking::BankCodeCurrencies
95
+ .bank_codes_per_currency('INR')
96
+ },
97
+ MXN: {
98
+ bank_code: Api::Constants::Transactions::Parameters::OnlineBanking::BankCodeCurrencies
99
+ .bank_codes_per_currency('MXN')
100
+ },
101
+ PHP: {
102
+ bank_code: Api::Constants::Transactions::Parameters::OnlineBanking::BankCodeCurrencies
103
+ .bank_codes_per_currency('PHP')
104
+ },
105
+ SGD: {
106
+ bank_code: Api::Constants::Transactions::Parameters::OnlineBanking::BankCodeCurrencies
107
+ .bank_codes_per_currency('SGD')
108
+ },
109
+ UYU: {
110
+ bank_code: Api::Constants::Transactions::Parameters::OnlineBanking::BankCodeCurrencies
111
+ .bank_codes_per_currency('UYU')
112
+ },
113
+ VND: {
114
+ bank_code: Api::Constants::Transactions::Parameters::OnlineBanking::BankCodeCurrencies
115
+ .bank_codes_per_currency('VND')
116
+ },
117
+ PLN: {
118
+ bank_code: Api::Constants::Transactions::Parameters::OnlineBanking::BankCodeCurrencies
119
+ .bank_codes_per_currency('PLN')
120
+ },
121
+ GBP: {
122
+ bank_code: Api::Constants::Transactions::Parameters::OnlineBanking::BankCodeCurrencies
123
+ .bank_codes_per_currency('GBP')
124
+ }
125
+ }
126
+ }
127
+ )
128
+ end
129
+
130
+ # Online Banking PayIn parameters structure
131
+ def payment_transaction_structure # rubocop:disable Metrics/MethodLength
132
+ payment_attributes_structure.merge(
133
+ {
134
+ return_success_url: return_success_url,
135
+ return_failure_url: return_failure_url,
136
+ billing_address: billing_address_parameters_structure,
137
+ shipping_address: shipping_address_parameters_structure,
138
+ customer_email: customer_email,
139
+ customer_phone: customer_phone,
140
+ payment_type: payment_type,
141
+ bank_code: bank_code,
142
+ document_id: document_id,
143
+ user_category: user_category,
144
+ virtual_payment_address: virtual_payment_address,
145
+ consumer_reference: consumer_reference,
146
+ auth_code: auth_code
147
+ }
148
+ )
149
+ end
150
+
151
+ end
152
+ end
153
+ end
154
+ end
155
+ end
156
+ end
157
+ end
@@ -14,8 +14,8 @@ module GenesisRuby
14
14
  Api::Constants::Transactions::VOID
15
15
  end
16
16
 
17
- def init_required_fields
18
- self.required_fields = %i[transaction_id reference_id]
17
+ def init_field_validations
18
+ required_fields.push *%i[transaction_id reference_id]
19
19
  end
20
20
 
21
21
  # Void transaction request structure
@@ -60,8 +60,8 @@ module GenesisRuby
60
60
  @api_config.parser_skip_root_node = false
61
61
  end
62
62
 
63
- def init_required_fields
64
- self.required_fields = %i[start_date]
63
+ def init_field_validations
64
+ required_fields.push *%i[start_date]
65
65
  end
66
66
 
67
67
  # API Request structure
@@ -116,26 +116,20 @@ module GenesisRuby
116
116
  init_api_wpf_configuration
117
117
  end
118
118
 
119
- def init_required_fields
120
- self.required_fields = %i[
121
- transaction_id
122
- amount
123
- currency
124
- notification_url
125
- return_success_url
126
- return_failure_url
127
- return_cancel_url
128
- transaction_types
129
- ]
119
+ def init_field_validations
120
+ required_fields.push *%i[transaction_id amount currency notification_url return_success_url
121
+ return_failure_url return_cancel_url transaction_types]
122
+
123
+ field_values.merge!(
124
+ { currency: Api::Constants::Currencies::Iso4217.all.map(&:upcase) },
125
+ threeds_field_validations
126
+ )
130
127
  end
131
128
 
132
129
  # Perform validation over the defined parameters upon request execution
133
130
  def check_requirements
134
- unless GenesisRuby::Api::Constants::Currencies::Iso4217.valid?(currency)
135
- raise ParameterError, "Invalid Currency given with value #{currency}"
136
- end
137
-
138
131
  validate_reminders
132
+ validate_threeds_card_holder_dates
139
133
 
140
134
  super
141
135
  end
@@ -185,6 +179,8 @@ module GenesisRuby
185
179
 
186
180
  # Add every transaction type to the transaction types structure
187
181
  def transaction_types=(value)
182
+ @transaction_types = [] if value.nil?
183
+
188
184
  @transaction_types ||= []
189
185
 
190
186
  @transaction_types.push(value)
@@ -17,8 +17,8 @@ module GenesisRuby
17
17
  @api_config.url = build_request_url subdomain: 'wpf', path: 'wpf/reconcile'
18
18
  end
19
19
 
20
- def init_required_fields
21
- self.required_fields = %i[unique_id]
20
+ def init_field_validations
21
+ required_fields.push *%i[unique_id]
22
22
  end
23
23
 
24
24
  # WPF Reconcile request structure
@@ -86,6 +86,12 @@ module GenesisRuby
86
86
  # Build XMl Document part from Array
87
87
  def build_array(element_name, element_value)
88
88
  element_value.each do |tag_value|
89
+ if tag_value.is_a? Hash
90
+ add_node element_name, tag_value
91
+
92
+ next
93
+ end
94
+
89
95
  add_element element_name, tag_value
90
96
  end
91
97
  end
@@ -1,5 +1,6 @@
1
1
  require 'uri'
2
2
  require 'date'
3
+ require 'json'
3
4
 
4
5
  module GenesisRuby
5
6
  module Utils
@@ -108,6 +109,31 @@ module GenesisRuby
108
109
  false
109
110
  end
110
111
 
112
+ # Parse JSON string
113
+ def parse_json_string(value)
114
+ JSON.parse value
115
+ rescue StandardError => e
116
+ raise InvalidArgumentError, "Given JSON string is invalid: #{e.message}"
117
+ end
118
+
119
+ # String conversion from CamelCase to snake_case
120
+ def camel_to_snake_case(camel_cased_word)
121
+ camel_cased_word.to_s.gsub(/::/, '/')
122
+ .gsub(/([A-Z]+)([A-Z][a-z])/, '\1_\2')
123
+ .gsub(/([a-z\d])([A-Z])/, '\1_\2')
124
+ .tr('-', '_')
125
+ .downcase
126
+ end
127
+
128
+ # String conversion from snake_case to CamelCase
129
+ def snake_to_camel_case(snake_case_word, lower: true)
130
+ string = snake_case_word.to_s.split(/_/).map(&:capitalize).join
131
+
132
+ string.sub!(/^[[:alpha:]]/, &:downcase) if lower
133
+
134
+ string
135
+ end
136
+
111
137
  end
112
138
 
113
139
  end
@@ -19,7 +19,7 @@ module GenesisRuby
19
19
  EFECTY, ELO, EPS,
20
20
  EZEECARD_PAYOUT, EZEEWALLET,
21
21
  FASHIONCHEQUE,
22
- GIROPAY, GOOGLE_PAY,
22
+ GOOGLE_PAY,
23
23
  IDEAL, IDEBIT_PAYIN, IDEBIT_PAYOUT, INCREMENTAL_AUTHORIZE, INSTA_DEBIT_PAYIN, INSTA_DEBIT_PAYOUT,
24
24
  INTERSOLVE, ITAU,
25
25
  MULTIBANCO, MY_BANK,
@@ -17,7 +17,7 @@ module GenesisRuby
17
17
  CAPTURE, CASHU,
18
18
  DAVIVIENDA,
19
19
  EFECTY, EPS, FASHIONCHEQUE,
20
- GIROPAY, GOOGLE_PAY,
20
+ GOOGLE_PAY,
21
21
  IDEAL, IDEBIT_PAYIN, INIT_RECURRING_SALE, INIT_RECURRING_SALE_3D, INVOICE_CAPTURE, ITAU,
22
22
  MY_BANK,
23
23
  NEOSURF,
@@ -0,0 +1,33 @@
1
+ module GenesisRuby
2
+ module Utils
3
+ module Transactions
4
+ module TravelData
5
+ module AirlineItinerary
6
+ # Airline Itinerary Data base class
7
+ class Base
8
+
9
+ include Api::Mixins::Requests::RestrictedSetter
10
+
11
+ # Constructor
12
+ def initialize(params = {}) # rubocop:disable Style/OptionHash
13
+ parse_attributes params if params.is_a? Hash
14
+
15
+ super()
16
+ end
17
+
18
+ # Item attribute structure
19
+ def attributes_structure; end
20
+
21
+ protected
22
+
23
+ # Initialize attributes
24
+ def parse_attributes(params)
25
+ params.each { |key, value| __send__ "#{key}=", value }
26
+ end
27
+
28
+ end
29
+ end
30
+ end
31
+ end
32
+ end
33
+ end
@@ -0,0 +1,97 @@
1
+ require 'genesis_ruby/utils/transactions/travel_data/airline_itinerary/base'
2
+
3
+ module GenesisRuby
4
+ module Utils
5
+ module Transactions
6
+ module TravelData
7
+ module AirlineItinerary
8
+ # Signify a single AirlineItinerary Leg data
9
+ class Leg < Base
10
+
11
+ attr_reader :carrier_code, :service_class, :origin_city, :destination_city, :fare_basis_code,
12
+ :flight_number, :departure_time_segment, :stopover_code
13
+ attr_accessor :departure_time
14
+
15
+ # Departure date
16
+ def departure_date
17
+ @departure_date&.strftime GenesisRuby::Api::Constants::DateTimeFormats::DD_MM_YYYY_L_HYPHENS
18
+ end
19
+
20
+ # Departure date
21
+ def departure_date=(value)
22
+ parse_date attribute: __method__, value: value, allow_empty: true
23
+ end
24
+
25
+ # Arrival date
26
+ def arrival_date
27
+ @arrival_date&.strftime GenesisRuby::Api::Constants::DateTimeFormats::DD_MM_YYYY_L_HYPHENS
28
+ end
29
+
30
+ # Arrival date
31
+ def arrival_date=(value)
32
+ parse_date attribute: __method__, value: value, allow_empty: true
33
+ end
34
+
35
+ # Carrier Code
36
+ def carrier_code=(value)
37
+ limited_string attribute: __method__, value: value.to_s, max: 2
38
+ end
39
+
40
+ # Service Class
41
+ def service_class=(value)
42
+ limited_string attribute: __method__, value: value.to_s, max: 1
43
+ end
44
+
45
+ # Origin City
46
+ def origin_city=(value)
47
+ limited_string attribute: __method__, value: value.to_s, max: 3
48
+ end
49
+
50
+ # Destination City
51
+ def destination_city=(value)
52
+ limited_string attribute: __method__, value: value.to_s, max: 3
53
+ end
54
+
55
+ # Fare basis code
56
+ def fare_basis_code=(value)
57
+ limited_string attribute: __method__, value: value.to_s, max: 6
58
+ end
59
+
60
+ # Flight number
61
+ def flight_number=(value)
62
+ limited_string attribute: __method__, value: value.to_s, max: 5
63
+ end
64
+
65
+ # Departure time segment
66
+ def departure_time_segment=(value)
67
+ allowed_options attribute: __method__, value: value.to_s, allowed: %w(A P), allow_empty: true
68
+ end
69
+
70
+ # Stopover code
71
+ def stopover_code=(value)
72
+ allowed_options attribute: __method__, value: value, allowed: [0, 1], allow_empty: true
73
+ end
74
+
75
+ # Get Single Leg structure
76
+ def attributes_structure # rubocop:disable Metrics/MethodLength
77
+ {
78
+ departure_date: departure_date,
79
+ arrival_date: arrival_date,
80
+ carrier_code: carrier_code,
81
+ service_class: service_class,
82
+ origin_city: origin_city,
83
+ destination_city: destination_city,
84
+ stopover_code: stopover_code,
85
+ fare_basis_code: fare_basis_code,
86
+ flight_number: flight_number,
87
+ departure_time: departure_time,
88
+ departure_time_segment: departure_time_segment
89
+ }
90
+ end
91
+
92
+ end
93
+ end
94
+ end
95
+ end
96
+ end
97
+ end
@@ -0,0 +1,42 @@
1
+ require 'genesis_ruby/utils/transactions/travel_data/airline_itinerary/base'
2
+ require 'genesis_ruby/utils/money_format'
3
+
4
+ module GenesisRuby
5
+ module Utils
6
+ module Transactions
7
+ module TravelData
8
+ module AirlineItinerary
9
+ # Signify a single AirlineItinerary Tax data
10
+ class Tax < Base
11
+
12
+ attr_reader :fee_type
13
+ attr_accessor :fee_amount, :currency
14
+
15
+ # Fee type
16
+ def fee_type=(value)
17
+ limited_string attribute: __method__, value: value, max: 8
18
+ end
19
+
20
+ # Get Single Tax structure
21
+ def attributes_structure
22
+ {
23
+ fee_amount: parse_fee_amount,
24
+ fee_type: fee_type
25
+ }
26
+ end
27
+
28
+ protected
29
+
30
+ # Minor currency conversion if currency is set
31
+ def parse_fee_amount
32
+ return fee_amount if currency.nil? || fee_amount.nil?
33
+
34
+ MoneyFormat.amount_to_exponent fee_amount, currency
35
+ end
36
+
37
+ end
38
+ end
39
+ end
40
+ end
41
+ end
42
+ end
@@ -16,7 +16,7 @@ module GenesisRuby
16
16
  BRADESCO,
17
17
  CABAL, CASHU, CENCOSUD, DAVIVIENDA,
18
18
  EFECTY, ELO, EPS, EZEEWALLET, FASHIONCHEQUE,
19
- GIROPAY, GOOGLE_PAY,
19
+ GOOGLE_PAY,
20
20
  IDEAL, IDEBIT_PAYIN, INSTA_DEBIT_PAYIN, INTERSOLVE, ITAU,
21
21
  MULTIBANCO, MY_BANK,
22
22
  NARANJA, NATIVA, NEOSURF, NETELLER,
@@ -1,5 +1,5 @@
1
1
  module GenesisRuby
2
2
 
3
- VERSION = '0.1.6'.freeze
3
+ VERSION = '0.1.8'.freeze
4
4
 
5
5
  end