genesis_ruby 0.1.5 → 0.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +28 -0
- data/Gemfile.lock +9 -11
- data/README.md +93 -3
- data/VERSION +1 -1
- data/lib/genesis_ruby/api/constants/i18n.rb +90 -0
- data/lib/genesis_ruby/api/constants/transactions/parameters/mpi_protocol_sub_versions.rb +43 -0
- data/lib/genesis_ruby/api/constants/transactions/parameters/travel_data/ancillary_charges_types.rb +43 -0
- data/lib/genesis_ruby/api/constants/transactions/parameters/wpf/reminder_channels.rb +24 -0
- data/lib/genesis_ruby/api/constants/transactions.rb +1 -5
- data/lib/genesis_ruby/api/mixins/requests/financial/cards/mpi_attributes.rb +14 -4
- data/lib/genesis_ruby/api/mixins/requests/financial/cards/recurring/managed_recurring_attributes.rb +2 -0
- data/lib/genesis_ruby/api/mixins/requests/financial/cards/recurring/managed_recurring_indian_card_attributes.rb +4 -0
- data/lib/genesis_ruby/api/mixins/requests/financial/travel_data/airline_itinerary_attributes.rb +166 -0
- data/lib/genesis_ruby/api/mixins/requests/financial/travel_data/car_rental_attributes.rb +119 -0
- data/lib/genesis_ruby/api/mixins/requests/financial/travel_data/hotel_rental_attributes.rb +77 -0
- data/lib/genesis_ruby/api/mixins/requests/financial/travel_data/reference_ticket_attributes.rb +75 -0
- data/lib/genesis_ruby/api/mixins/requests/financial/travel_data/travel_attributes.rb +34 -0
- data/lib/genesis_ruby/api/mixins/requests/wpf_reminders_attributes.rb +59 -0
- data/lib/genesis_ruby/api/requests/financial/capture.rb +3 -1
- data/lib/genesis_ruby/api/requests/financial/cards/authorize.rb +3 -1
- data/lib/genesis_ruby/api/requests/financial/cards/authorize3d.rb +3 -1
- data/lib/genesis_ruby/api/requests/financial/cards/sale.rb +3 -1
- data/lib/genesis_ruby/api/requests/financial/cards/sale3d.rb +3 -1
- data/lib/genesis_ruby/api/requests/wpf/create.rb +70 -3
- data/lib/genesis_ruby/builders/xml.rb +6 -0
- data/lib/genesis_ruby/utils/options/reminder.rb +60 -0
- data/lib/genesis_ruby/utils/transactions/financial_types.rb +1 -1
- data/lib/genesis_ruby/utils/transactions/references/refundable_types.rb +1 -1
- data/lib/genesis_ruby/utils/transactions/travel_data/airline_itinerary/base.rb +33 -0
- data/lib/genesis_ruby/utils/transactions/travel_data/airline_itinerary/leg.rb +97 -0
- data/lib/genesis_ruby/utils/transactions/travel_data/airline_itinerary/tax.rb +42 -0
- data/lib/genesis_ruby/utils/transactions/wpf_types.rb +1 -1
- data/lib/genesis_ruby/version.rb +1 -1
- metadata +17 -3
data/lib/genesis_ruby/api/mixins/requests/financial/travel_data/airline_itinerary_attributes.rb
ADDED
@@ -0,0 +1,166 @@
|
|
1
|
+
require 'genesis_ruby/utils/transactions/travel_data/airline_itinerary/leg'
|
2
|
+
require 'genesis_ruby/utils/transactions/travel_data/airline_itinerary/tax'
|
3
|
+
|
4
|
+
module GenesisRuby
|
5
|
+
module Api
|
6
|
+
module Mixins
|
7
|
+
module Requests
|
8
|
+
module Financial
|
9
|
+
module TravelData
|
10
|
+
# Level 3 Data Airline Itinerary Attributes
|
11
|
+
module AirlineItineraryAttributes
|
12
|
+
|
13
|
+
attr_reader :travel_aid_restricted_ticket_indicator, :travel_aid_ticket_number,
|
14
|
+
:travel_aid_passenger_name, :travel_aid_customer_code, :travel_aid_issuing_carrier,
|
15
|
+
:travel_aid_agency_name, :travel_aid_agency_code
|
16
|
+
attr_accessor :travel_aid_total_fare, :travel_aid_confirmation_information
|
17
|
+
|
18
|
+
# Date Of Issue
|
19
|
+
def travel_aid_date_of_issue
|
20
|
+
@travel_aid_date_of_issue&.strftime GenesisRuby::Api::Constants::DateTimeFormats::DD_MM_YYYY_L_HYPHENS
|
21
|
+
end
|
22
|
+
|
23
|
+
# Date Of Issue
|
24
|
+
def travel_aid_date_of_issue=(value)
|
25
|
+
parse_date attribute: __method__, value: value, allow_empty: true
|
26
|
+
end
|
27
|
+
|
28
|
+
# Restricted Ticket Indicator
|
29
|
+
def travel_aid_restricted_ticket_indicator=(value)
|
30
|
+
allowed_options attribute: __method__, value: value.to_i, allow_empty: true, allowed: [0, 1]
|
31
|
+
end
|
32
|
+
|
33
|
+
# Ticket Number
|
34
|
+
def travel_aid_ticket_number=(value)
|
35
|
+
limited_string attribute: __method__, value: value, max: 15
|
36
|
+
end
|
37
|
+
|
38
|
+
# Passenger name
|
39
|
+
def travel_aid_passenger_name=(value)
|
40
|
+
limited_string attribute: __method__, value: value, max: 29
|
41
|
+
end
|
42
|
+
|
43
|
+
# Customer code
|
44
|
+
def travel_aid_customer_code=(value)
|
45
|
+
limited_string attribute: __method__, value: value, max: 17
|
46
|
+
end
|
47
|
+
|
48
|
+
# Issuing carrier
|
49
|
+
def travel_aid_issuing_carrier=(value)
|
50
|
+
limited_string attribute: __method__, value: value, max: 4
|
51
|
+
end
|
52
|
+
|
53
|
+
# Agency name
|
54
|
+
def travel_aid_agency_name=(value)
|
55
|
+
limited_string attribute: __method__, value: value, max: 30
|
56
|
+
end
|
57
|
+
|
58
|
+
# Agency code
|
59
|
+
def travel_aid_agency_code=(value)
|
60
|
+
limited_string attribute: __method__, value: value, max: 8
|
61
|
+
end
|
62
|
+
|
63
|
+
# AirlineItinerary Legs data. Max legs 10
|
64
|
+
def travel_aid_legs
|
65
|
+
@travel_aid_legs || []
|
66
|
+
end
|
67
|
+
|
68
|
+
# AirlineItinerary Taxes data. Max taxes 10
|
69
|
+
def travel_aid_taxes
|
70
|
+
@travel_aid_taxes || []
|
71
|
+
end
|
72
|
+
|
73
|
+
# Add a single AirlineItinerary Leg data
|
74
|
+
def add_travel_aid_leg(leg)
|
75
|
+
@travel_aid_legs ||= travel_aid_legs
|
76
|
+
leg_obj = GenesisRuby::Utils::Transactions::TravelData::AirlineItinerary::Leg
|
77
|
+
|
78
|
+
raise InvalidArgumentError, "Leg must be instance of #{leg_obj.name}" unless leg.instance_of? leg_obj
|
79
|
+
|
80
|
+
if travel_aid_legs.count == ALLOWED_ITEMS_COUNT
|
81
|
+
raise InvalidArgumentError, "Allowed Legs count exceeded. Allowed #{ALLOWED_ITEMS_COUNT}."
|
82
|
+
end
|
83
|
+
|
84
|
+
@travel_aid_legs.push leg
|
85
|
+
end
|
86
|
+
|
87
|
+
# Add a single AirlineItinerary Tax data
|
88
|
+
def add_travel_aid_tax(tax)
|
89
|
+
@travel_aid_taxes ||= travel_aid_taxes
|
90
|
+
tax_obj = GenesisRuby::Utils::Transactions::TravelData::AirlineItinerary::Tax
|
91
|
+
|
92
|
+
raise InvalidArgumentError, "Tax must be instance of #{tax_obj.name}" unless tax.instance_of? tax_obj
|
93
|
+
|
94
|
+
if travel_aid_taxes.count == ALLOWED_ITEMS_COUNT
|
95
|
+
raise InvalidArgumentError, "Allowed Legs count exceeded. Allowed #{ALLOWED_ITEMS_COUNT}."
|
96
|
+
end
|
97
|
+
|
98
|
+
@travel_aid_taxes.push tax
|
99
|
+
end
|
100
|
+
|
101
|
+
# Reset Legs data
|
102
|
+
def clear_travel_aid_legs
|
103
|
+
@travel_aid_legs = []
|
104
|
+
end
|
105
|
+
|
106
|
+
# Reset Taxes
|
107
|
+
def clear_travel_aid_taxes
|
108
|
+
@travel_aid_taxes = []
|
109
|
+
end
|
110
|
+
|
111
|
+
protected
|
112
|
+
|
113
|
+
ALLOWED_ITEMS_COUNT = 10
|
114
|
+
|
115
|
+
# Legs structure
|
116
|
+
def legs_structure
|
117
|
+
parse_items 'leg', travel_aid_legs
|
118
|
+
end
|
119
|
+
|
120
|
+
# Taxes structure
|
121
|
+
def taxes_structure
|
122
|
+
parse_items 'tax', travel_aid_taxes
|
123
|
+
end
|
124
|
+
|
125
|
+
# Prepare structure
|
126
|
+
def parse_items(node_name, items)
|
127
|
+
data = []
|
128
|
+
|
129
|
+
items.each do |item|
|
130
|
+
item.currency = currency if item.respond_to?(:currency) && respond_to?(:currency)
|
131
|
+
data.push item.attributes_structure
|
132
|
+
end
|
133
|
+
|
134
|
+
Hash[node_name.to_sym, data]
|
135
|
+
end
|
136
|
+
|
137
|
+
# Attributes Structure
|
138
|
+
def airline_attributes_structure # rubocop:disable RSpec/MethodLength
|
139
|
+
{
|
140
|
+
ticket_number: travel_aid_ticket_number,
|
141
|
+
passenger_name: travel_aid_passenger_name,
|
142
|
+
customer_code: travel_aid_customer_code,
|
143
|
+
restricted_ticket_indicator: travel_aid_restricted_ticket_indicator,
|
144
|
+
issuing_carrier: travel_aid_issuing_carrier,
|
145
|
+
total_fare: parse_total_fare,
|
146
|
+
agency_name: travel_aid_agency_name,
|
147
|
+
agency_code: travel_aid_agency_code,
|
148
|
+
confirmation_information: travel_aid_confirmation_information,
|
149
|
+
date_of_issue: travel_aid_date_of_issue
|
150
|
+
}
|
151
|
+
end
|
152
|
+
|
153
|
+
# Parse Total Fare amount
|
154
|
+
def parse_total_fare
|
155
|
+
return travel_aid_total_fare if currency.nil? || travel_aid_total_fare.nil?
|
156
|
+
|
157
|
+
transform_amount travel_aid_total_fare, currency
|
158
|
+
end
|
159
|
+
|
160
|
+
end
|
161
|
+
end
|
162
|
+
end
|
163
|
+
end
|
164
|
+
end
|
165
|
+
end
|
166
|
+
end
|
@@ -0,0 +1,119 @@
|
|
1
|
+
module GenesisRuby
|
2
|
+
module Api
|
3
|
+
module Mixins
|
4
|
+
module Requests
|
5
|
+
module Financial
|
6
|
+
module TravelData
|
7
|
+
# Car Rental attributes
|
8
|
+
module CarRentalAttributes
|
9
|
+
|
10
|
+
attr_reader :travel_car_rental_purchase_identifier, :travel_car_rental_class_id,
|
11
|
+
:travel_car_rental_renter_name, :travel_car_rental_return_city,
|
12
|
+
:travel_car_rental_return_state, :travel_car_rental_return_country,
|
13
|
+
:travel_car_rental_renter_return_location_id, :travel_car_rental_customer_code,
|
14
|
+
:travel_car_rental_extra_charges, :travel_car_rental_no_show_indicator
|
15
|
+
|
16
|
+
# Travel Data Purchase Identifier
|
17
|
+
def travel_car_rental_purchase_identifier=(value)
|
18
|
+
limited_string attribute: __method__, value: value, max: 9
|
19
|
+
end
|
20
|
+
|
21
|
+
# Travel Data Class id
|
22
|
+
def travel_car_rental_class_id=(value)
|
23
|
+
allowed_options attribute: __method__,
|
24
|
+
value: value.to_i,
|
25
|
+
allow_empty: true,
|
26
|
+
allowed: [*1..30].push(9999)
|
27
|
+
end
|
28
|
+
|
29
|
+
# Travel Data PickUp Date
|
30
|
+
def travel_car_rental_pickup_date
|
31
|
+
@travel_car_rental_pickup_date&.strftime GenesisRuby::Api::Constants::DateTimeFormats::
|
32
|
+
DD_MM_YYYY_L_HYPHENS
|
33
|
+
end
|
34
|
+
|
35
|
+
# Travel Data PickUp Date
|
36
|
+
def travel_car_rental_pickup_date=(value)
|
37
|
+
parse_date attribute: __method__, value: value, allow_empty: true
|
38
|
+
end
|
39
|
+
|
40
|
+
# Travel Data Renter Name
|
41
|
+
def travel_car_rental_renter_name=(value)
|
42
|
+
limited_string attribute: __method__, value: value, max: 20
|
43
|
+
end
|
44
|
+
|
45
|
+
# Travel Data Return City
|
46
|
+
def travel_car_rental_return_city=(value)
|
47
|
+
limited_string attribute: __method__, value: value, max: 18
|
48
|
+
end
|
49
|
+
|
50
|
+
# Travel Data Return State
|
51
|
+
def travel_car_rental_return_state=(value)
|
52
|
+
limited_string attribute: __method__, value: value, max: 3
|
53
|
+
end
|
54
|
+
|
55
|
+
# Travel Data Return Country
|
56
|
+
def travel_car_rental_return_country=(value)
|
57
|
+
limited_string attribute: __method__, value: value, max: 3
|
58
|
+
end
|
59
|
+
|
60
|
+
# Travel Data Return Date
|
61
|
+
def travel_car_rental_return_date
|
62
|
+
@travel_car_rental_return_date&.strftime GenesisRuby::Api::Constants::DateTimeFormats::
|
63
|
+
DD_MM_YYYY_L_HYPHENS
|
64
|
+
end
|
65
|
+
|
66
|
+
# Travel Data Return Date
|
67
|
+
def travel_car_rental_return_date=(value)
|
68
|
+
parse_date attribute: __method__, value: value, allow_empty: true
|
69
|
+
end
|
70
|
+
|
71
|
+
# Travel Data Renter Return Location id
|
72
|
+
def travel_car_rental_renter_return_location_id=(value)
|
73
|
+
limited_string attribute: __method__, value: value, max: 10
|
74
|
+
end
|
75
|
+
|
76
|
+
# Travel Data Customer Code
|
77
|
+
def travel_car_rental_customer_code=(value)
|
78
|
+
limited_string attribute: __method__, value: value, max: 17
|
79
|
+
end
|
80
|
+
|
81
|
+
# Travel Data Extra Charges
|
82
|
+
def travel_car_rental_extra_charges=(value)
|
83
|
+
allowed_options attribute: __method__, value: value.to_i, allow_empty: true, allowed: [*1..5]
|
84
|
+
end
|
85
|
+
|
86
|
+
# Travel Data No Show Indicator
|
87
|
+
def travel_car_rental_no_show_indicator=(value)
|
88
|
+
allowed_options attribute: __method__, value: value.to_i, allow_empty: true, allowed: [0, 1]
|
89
|
+
end
|
90
|
+
|
91
|
+
protected
|
92
|
+
|
93
|
+
# Travel Data Car Rental Attributes Structure
|
94
|
+
def car_rental_attributes_structure # rubocop:disable Metrics/MethodLength
|
95
|
+
{
|
96
|
+
car_rental: {
|
97
|
+
purchase_identifier: travel_car_rental_purchase_identifier,
|
98
|
+
class_id: travel_car_rental_class_id,
|
99
|
+
pickup_date: travel_car_rental_pickup_date,
|
100
|
+
renter_name: travel_car_rental_renter_name,
|
101
|
+
return_city: travel_car_rental_return_city,
|
102
|
+
return_state: travel_car_rental_return_state,
|
103
|
+
return_country: travel_car_rental_return_country,
|
104
|
+
return_date: travel_car_rental_return_date,
|
105
|
+
renter_return_location_id: travel_car_rental_renter_return_location_id,
|
106
|
+
customer_code: travel_car_rental_customer_code,
|
107
|
+
extra_charges: travel_car_rental_extra_charges,
|
108
|
+
no_show_indicator: travel_car_rental_no_show_indicator
|
109
|
+
}
|
110
|
+
}
|
111
|
+
end
|
112
|
+
|
113
|
+
end
|
114
|
+
end
|
115
|
+
end
|
116
|
+
end
|
117
|
+
end
|
118
|
+
end
|
119
|
+
end
|
@@ -0,0 +1,77 @@
|
|
1
|
+
module GenesisRuby
|
2
|
+
module Api
|
3
|
+
module Mixins
|
4
|
+
module Requests
|
5
|
+
module Financial
|
6
|
+
module TravelData
|
7
|
+
# Hotel Rental Attributes
|
8
|
+
module HotelRentalAttributes
|
9
|
+
|
10
|
+
attr_reader :travel_hotel_rental_purchase_identifier, :travel_hotel_rental_customer_code,
|
11
|
+
:travel_hotel_rental_extra_charges, :travel_hotel_rental_no_show_indicator
|
12
|
+
|
13
|
+
# Hotel Rental Purchase Identifier
|
14
|
+
def travel_hotel_rental_purchase_identifier=(value)
|
15
|
+
limited_string attribute: __method__, value: value, max: 10
|
16
|
+
end
|
17
|
+
|
18
|
+
# Travel Data Arrival date
|
19
|
+
def travel_hotel_rental_arrival_date
|
20
|
+
@travel_hotel_rental_arrival_date&.strftime GenesisRuby::Api::Constants::DateTimeFormats::
|
21
|
+
DD_MM_YYYY_L_HYPHENS
|
22
|
+
end
|
23
|
+
|
24
|
+
# Travel Data Arrival Date
|
25
|
+
def travel_hotel_rental_arrival_date=(value)
|
26
|
+
parse_date attribute: __method__, value: value, allow_empty: true
|
27
|
+
end
|
28
|
+
|
29
|
+
# Travel Data Departure date
|
30
|
+
def travel_hotel_rental_departure_date
|
31
|
+
@travel_hotel_rental_departure_date&.strftime GenesisRuby::Api::Constants::DateTimeFormats::
|
32
|
+
DD_MM_YYYY_L_HYPHENS
|
33
|
+
end
|
34
|
+
|
35
|
+
# Travel Data Departure Date
|
36
|
+
def travel_hotel_rental_departure_date=(value)
|
37
|
+
parse_date attribute: __method__, value: value, allow_empty: true
|
38
|
+
end
|
39
|
+
|
40
|
+
# Travel Data Customer Code
|
41
|
+
def travel_hotel_rental_customer_code=(value)
|
42
|
+
limited_string attribute: __method__, value: value, max: 17
|
43
|
+
end
|
44
|
+
|
45
|
+
# Travel Data Extra Charges
|
46
|
+
def travel_hotel_rental_extra_charges=(value)
|
47
|
+
allowed_options attribute: __method__, value: value, allow_empty: true, allowed: [*2..7]
|
48
|
+
end
|
49
|
+
|
50
|
+
# Travel Data No Show Indicator
|
51
|
+
def travel_hotel_rental_no_show_indicator=(value)
|
52
|
+
allowed_options attribute: __method__, value: value, allow_empty: true, allowed: [0, 1]
|
53
|
+
end
|
54
|
+
|
55
|
+
protected
|
56
|
+
|
57
|
+
# Hotel Rental attributes structure
|
58
|
+
def hotel_rental_attributes_structure
|
59
|
+
{
|
60
|
+
hotel_rental: {
|
61
|
+
purchase_identifier: travel_hotel_rental_purchase_identifier,
|
62
|
+
arrival_date: travel_hotel_rental_arrival_date,
|
63
|
+
departure_date: travel_hotel_rental_departure_date,
|
64
|
+
customer_code: travel_hotel_rental_customer_code,
|
65
|
+
extra_charges: travel_hotel_rental_extra_charges,
|
66
|
+
no_show_indicator: travel_hotel_rental_no_show_indicator
|
67
|
+
}
|
68
|
+
}
|
69
|
+
end
|
70
|
+
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
data/lib/genesis_ruby/api/mixins/requests/financial/travel_data/reference_ticket_attributes.rb
ADDED
@@ -0,0 +1,75 @@
|
|
1
|
+
require 'genesis_ruby/api/constants/transactions/parameters/travel_data/ancillary_charges_types'
|
2
|
+
|
3
|
+
module GenesisRuby
|
4
|
+
module Api
|
5
|
+
module Mixins
|
6
|
+
module Requests
|
7
|
+
module Financial
|
8
|
+
module TravelData
|
9
|
+
# Ancillary Charges
|
10
|
+
module ReferenceTicketAttributes
|
11
|
+
|
12
|
+
attr_reader :travel_ac_ticket_reference_id, :travel_ac_type, :travel_ac_ticket_document_number,
|
13
|
+
:travel_ac_issued_with_ticket_number, :travel_ac_sub_type
|
14
|
+
|
15
|
+
# Ancillary Charges ticker reference id
|
16
|
+
def travel_ac_ticket_reference_id=(value)
|
17
|
+
limited_string attribute: __method__, value: value, max: 32
|
18
|
+
end
|
19
|
+
|
20
|
+
# Ancillary Charges Type
|
21
|
+
def travel_ac_type=(value)
|
22
|
+
allowed_options attribute: __method__,
|
23
|
+
value: value.to_s.upcase,
|
24
|
+
allowed: GenesisRuby::Api::Constants::Transactions::Parameters::TravelData::
|
25
|
+
AncillaryChargesTypes.all,
|
26
|
+
allow_empty: true
|
27
|
+
end
|
28
|
+
|
29
|
+
# Ancillary Charges Ticket document number
|
30
|
+
def travel_ac_ticket_document_number=(value)
|
31
|
+
limited_string attribute: __method__, value: value, max: 15
|
32
|
+
end
|
33
|
+
|
34
|
+
# Ancillary Charges issued with ticket number
|
35
|
+
def travel_ac_issued_with_ticket_number=(value)
|
36
|
+
limited_string attribute: __method__, value: value, max: 15
|
37
|
+
end
|
38
|
+
|
39
|
+
# Ancillary Charges Sub Type
|
40
|
+
def travel_ac_sub_type=(value)
|
41
|
+
allowed_options attribute: __method__,
|
42
|
+
value: value.to_s.upcase,
|
43
|
+
allowed: GenesisRuby::Api::Constants::Transactions::Parameters::TravelData::
|
44
|
+
AncillaryChargesTypes.all,
|
45
|
+
allow_empty: true
|
46
|
+
end
|
47
|
+
|
48
|
+
protected
|
49
|
+
|
50
|
+
# Reference Ticket attributes structure
|
51
|
+
def reference_ticket_attributes_structure
|
52
|
+
{
|
53
|
+
ticket_reference_id: travel_ac_ticket_reference_id,
|
54
|
+
ticket_document_number: travel_ac_ticket_document_number,
|
55
|
+
issued_with_ticket_number: travel_ac_issued_with_ticket_number
|
56
|
+
}
|
57
|
+
end
|
58
|
+
|
59
|
+
# Ancillary Charges attributes structure
|
60
|
+
def charges_attributes_structure
|
61
|
+
{
|
62
|
+
charge: {
|
63
|
+
type: travel_ac_type,
|
64
|
+
sub_type: travel_ac_sub_type
|
65
|
+
}
|
66
|
+
}
|
67
|
+
end
|
68
|
+
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
74
|
+
end
|
75
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
module GenesisRuby
|
2
|
+
module Api
|
3
|
+
module Mixins
|
4
|
+
module Requests
|
5
|
+
module Financial
|
6
|
+
module TravelData
|
7
|
+
# Travel Data Attributes
|
8
|
+
module TravelAttributes
|
9
|
+
|
10
|
+
include TravelData::AirlineItineraryAttributes
|
11
|
+
include TravelData::CarRentalAttributes
|
12
|
+
include TravelData::HotelRentalAttributes
|
13
|
+
include TravelData::ReferenceTicketAttributes
|
14
|
+
|
15
|
+
protected
|
16
|
+
|
17
|
+
# Travel Data attributes structure
|
18
|
+
def travel_data_attributes_structure
|
19
|
+
{
|
20
|
+
ticket: airline_attributes_structure.merge(reference_ticket_attributes_structure),
|
21
|
+
legs: legs_structure,
|
22
|
+
taxes: taxes_structure,
|
23
|
+
rentals: car_rental_attributes_structure.merge(hotel_rental_attributes_structure),
|
24
|
+
charges: charges_attributes_structure
|
25
|
+
}
|
26
|
+
end
|
27
|
+
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,59 @@
|
|
1
|
+
require 'genesis_ruby/utils/options/reminder'
|
2
|
+
|
3
|
+
module GenesisRuby
|
4
|
+
module Api
|
5
|
+
module Mixins
|
6
|
+
module Requests
|
7
|
+
# Settings for reminders sending when using the ’Pay Later’ feature
|
8
|
+
module WpfRemindersAttributes
|
9
|
+
|
10
|
+
attr_reader :reminder_language
|
11
|
+
attr_writer :reminders
|
12
|
+
|
13
|
+
# It must be a valid language abbreviation
|
14
|
+
def reminder_language=(value)
|
15
|
+
allowed_options attribute: __method__,
|
16
|
+
allowed: Api::Constants::I18n.all,
|
17
|
+
value: value.to_s.downcase,
|
18
|
+
allow_empty: true
|
19
|
+
end
|
20
|
+
|
21
|
+
# Settings for a single reminder. Upto three reminders are allowed
|
22
|
+
def add_reminder(channel:, after:)
|
23
|
+
raise InvalidArgumentError, 'Reminders exceed the allowed count of 3.' if reminders.count >= 3
|
24
|
+
|
25
|
+
reminders << init_reminder(channel: channel, after: after)
|
26
|
+
end
|
27
|
+
|
28
|
+
protected
|
29
|
+
|
30
|
+
# Reminders structure
|
31
|
+
def reminders_structure
|
32
|
+
return reminders if reminders.empty?
|
33
|
+
|
34
|
+
reminders.map &:object_structure
|
35
|
+
end
|
36
|
+
|
37
|
+
private :reminders=
|
38
|
+
|
39
|
+
# Reminder Data Object
|
40
|
+
def init_reminder(channel:, after:)
|
41
|
+
reminder = Utils::Options::Reminder.new
|
42
|
+
|
43
|
+
reminder.channel = channel
|
44
|
+
reminder.after = after.to_i
|
45
|
+
|
46
|
+
reminder
|
47
|
+
end
|
48
|
+
|
49
|
+
# The number of the sent reminders would be exactly as sent or configured and delivery failures could be
|
50
|
+
# handled on demand. Also there will be no reminders sent if the WPF is already completed
|
51
|
+
def reminders
|
52
|
+
@reminders ||= []
|
53
|
+
end
|
54
|
+
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
@@ -6,6 +6,7 @@ module GenesisRuby
|
|
6
6
|
class Capture < Requests::Base::Reference
|
7
7
|
|
8
8
|
include Mixins::Requests::Financial::Business::BusinessAttributes
|
9
|
+
include Mixins::Requests::Financial::TravelData::TravelAttributes
|
9
10
|
|
10
11
|
protected
|
11
12
|
|
@@ -18,7 +19,8 @@ module GenesisRuby
|
|
18
19
|
def reference_transaction_structure
|
19
20
|
{
|
20
21
|
reference_id: reference_id,
|
21
|
-
business_attributes: business_attributes_structure
|
22
|
+
business_attributes: business_attributes_structure,
|
23
|
+
travel: travel_data_attributes_structure
|
22
24
|
}
|
23
25
|
end
|
24
26
|
|
@@ -23,6 +23,7 @@ module GenesisRuby
|
|
23
23
|
include Mixins::Requests::Financial::ReferenceAttributes
|
24
24
|
include Mixins::Requests::Financial::RiskAttributes
|
25
25
|
include Mixins::Requests::Financial::ScaAttributes
|
26
|
+
include Mixins::Requests::Financial::TravelData::TravelAttributes
|
26
27
|
|
27
28
|
protected
|
28
29
|
|
@@ -55,7 +56,8 @@ module GenesisRuby
|
|
55
56
|
recurring_type: recurring_type,
|
56
57
|
recurring_category: recurring_category,
|
57
58
|
sca_params: sca_attributes_structure,
|
58
|
-
managed_recurring: managed_recurring_attributes_structure
|
59
|
+
managed_recurring: managed_recurring_attributes_structure,
|
60
|
+
travel: travel_data_attributes_structure
|
59
61
|
)
|
60
62
|
end
|
61
63
|
|
@@ -26,6 +26,7 @@ module GenesisRuby
|
|
26
26
|
include Mixins::Requests::Financial::RiskAttributes
|
27
27
|
include Mixins::Requests::Financial::ScaAttributes
|
28
28
|
include Mixins::Requests::Financial::Threeds::Version2::CommonAttributes
|
29
|
+
include Mixins::Requests::Financial::TravelData::TravelAttributes
|
29
30
|
|
30
31
|
# Specifies the recurring type of transaction
|
31
32
|
def recurring_type=(value)
|
@@ -67,7 +68,8 @@ module GenesisRuby
|
|
67
68
|
recurring_category: recurring_category,
|
68
69
|
sca_params: sca_attributes_structure,
|
69
70
|
threeds_v2_params: threeds_v2_common_attributes_structure,
|
70
|
-
managed_recurring: managed_recurring_attributes_structure
|
71
|
+
managed_recurring: managed_recurring_attributes_structure,
|
72
|
+
travel: travel_data_attributes_structure
|
71
73
|
)
|
72
74
|
end
|
73
75
|
|
@@ -22,6 +22,7 @@ module GenesisRuby
|
|
22
22
|
include Mixins::Requests::Financial::ReferenceAttributes
|
23
23
|
include Mixins::Requests::Financial::RiskAttributes
|
24
24
|
include Mixins::Requests::Financial::ScaAttributes
|
25
|
+
include Mixins::Requests::Financial::TravelData::TravelAttributes
|
25
26
|
|
26
27
|
protected
|
27
28
|
|
@@ -54,7 +55,8 @@ module GenesisRuby
|
|
54
55
|
recurring_type: recurring_type,
|
55
56
|
recurring_category: recurring_category,
|
56
57
|
sca_params: sca_attributes_structure,
|
57
|
-
managed_recurring: managed_recurring_attributes_structure
|
58
|
+
managed_recurring: managed_recurring_attributes_structure,
|
59
|
+
travel: travel_data_attributes_structure
|
58
60
|
)
|
59
61
|
end
|
60
62
|
|
@@ -25,6 +25,7 @@ module GenesisRuby
|
|
25
25
|
include Mixins::Requests::Financial::RiskAttributes
|
26
26
|
include Mixins::Requests::Financial::ScaAttributes
|
27
27
|
include Mixins::Requests::Financial::Threeds::Version2::CommonAttributes
|
28
|
+
include Mixins::Requests::Financial::TravelData::TravelAttributes
|
28
29
|
|
29
30
|
# Specifies the recurring type of transaction
|
30
31
|
def recurring_type=(value)
|
@@ -66,7 +67,8 @@ module GenesisRuby
|
|
66
67
|
recurring_category: recurring_category,
|
67
68
|
sca_params: sca_attributes_structure,
|
68
69
|
threeds_v2_params: threeds_v2_common_attributes_structure,
|
69
|
-
managed_recurring: managed_recurring_attributes_structure
|
70
|
+
managed_recurring: managed_recurring_attributes_structure,
|
71
|
+
travel: travel_data_attributes_structure
|
70
72
|
)
|
71
73
|
end
|
72
74
|
|