genesis_ruby 0.1.6 → 0.1.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +26 -0
- data/Gemfile.lock +42 -38
- data/README.md +305 -3
- data/VERSION +1 -1
- data/lib/genesis_ruby/api/constants/transactions/parameters/mobile/apple_pay/payment_subtypes.rb +29 -0
- data/lib/genesis_ruby/api/constants/transactions/parameters/mobile/google_pay/payment_subtypes.rb +29 -0
- data/lib/genesis_ruby/api/constants/transactions/parameters/mpi_protocol_sub_versions.rb +43 -0
- data/lib/genesis_ruby/api/constants/transactions/parameters/online_banking/bank_code_currencies.rb +128 -0
- data/lib/genesis_ruby/api/constants/transactions/parameters/online_banking/bank_codes.rb +600 -0
- data/lib/genesis_ruby/api/constants/transactions/parameters/online_banking/payment_types.rb +36 -0
- data/lib/genesis_ruby/api/constants/transactions/parameters/travel_data/ancillary_charges_types.rb +43 -0
- data/lib/genesis_ruby/api/constants/transactions.rb +1 -5
- data/lib/genesis_ruby/api/mixins/requests/attribute_validation.rb +138 -4
- data/lib/genesis_ruby/api/mixins/requests/birth_date_attributes.rb +22 -0
- data/lib/genesis_ruby/api/mixins/requests/customer_address/customer_info_attributes.rb +1 -1
- data/lib/genesis_ruby/api/mixins/requests/financial/cards/credit_card_attributes.rb +7 -0
- 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 +23 -20
- data/lib/genesis_ruby/api/mixins/requests/financial/cards/recurring/managed_recurring_indian_card_attributes.rb +19 -39
- data/lib/genesis_ruby/api/mixins/requests/financial/cards/recurring/recurring_type_attributes.rb +15 -9
- data/lib/genesis_ruby/api/mixins/requests/financial/cards/tokenization_attributes.rb +9 -0
- data/lib/genesis_ruby/api/mixins/requests/financial/mobile/apple_pay_token_attributes.rb +51 -0
- data/lib/genesis_ruby/api/mixins/requests/financial/mobile/google_pay_token_attributes.rb +50 -0
- data/lib/genesis_ruby/api/mixins/requests/financial/online_banking_payments/virtual_payment_address_attributes.rb +27 -0
- data/lib/genesis_ruby/api/mixins/requests/financial/threeds/version2/browser.rb +11 -22
- data/lib/genesis_ruby/api/mixins/requests/financial/threeds/version2/card_holder_account.rb +81 -49
- data/lib/genesis_ruby/api/mixins/requests/financial/threeds/version2/common_attributes.rb +23 -0
- data/lib/genesis_ruby/api/mixins/requests/financial/threeds/version2/control.rb +13 -26
- data/lib/genesis_ruby/api/mixins/requests/financial/threeds/version2/merchant_risk.rb +21 -58
- data/lib/genesis_ruby/api/mixins/requests/financial/threeds/version2/purchase.rb +8 -11
- data/lib/genesis_ruby/api/mixins/requests/financial/threeds/version2/sdk.rb +10 -10
- data/lib/genesis_ruby/api/mixins/requests/financial/threeds/version2/wpf_attributes.rb +9 -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/request.rb +4 -2
- data/lib/genesis_ruby/api/requests/base/financials/credit_card.rb +6 -4
- data/lib/genesis_ruby/api/requests/base/reference.rb +3 -2
- data/lib/genesis_ruby/api/requests/financial/capture.rb +3 -1
- data/lib/genesis_ruby/api/requests/financial/cards/authorize.rb +13 -3
- data/lib/genesis_ruby/api/requests/financial/cards/authorize3d.rb +22 -11
- data/lib/genesis_ruby/api/requests/financial/cards/sale.rb +13 -3
- data/lib/genesis_ruby/api/requests/financial/cards/sale3d.rb +22 -11
- data/lib/genesis_ruby/api/requests/financial/cards/threeds/v2/method_continue.rb +2 -2
- data/lib/genesis_ruby/api/requests/financial/mobile/apple_pay.rb +91 -0
- data/lib/genesis_ruby/api/requests/financial/mobile/google_pay.rb +108 -0
- data/lib/genesis_ruby/api/requests/financial/online_banking_payments/online_banking/pay_in.rb +157 -0
- data/lib/genesis_ruby/api/requests/financial/void.rb +2 -2
- data/lib/genesis_ruby/api/requests/non_financial/reconcile/date_range.rb +2 -2
- data/lib/genesis_ruby/api/requests/wpf/create.rb +11 -15
- data/lib/genesis_ruby/api/requests/wpf/reconcile.rb +2 -2
- data/lib/genesis_ruby/builders/xml.rb +6 -0
- data/lib/genesis_ruby/utils/common.rb +26 -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 +24 -2
@@ -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
|
@@ -27,7 +27,7 @@ module GenesisRuby
|
|
27
27
|
@api_config = GenesisRuby::Utils::Options::ApiConfig.new
|
28
28
|
|
29
29
|
init_configuration
|
30
|
-
|
30
|
+
init_field_validations
|
31
31
|
end
|
32
32
|
|
33
33
|
# Generate the Request Document based on the builder_interface
|
@@ -50,7 +50,7 @@ module GenesisRuby
|
|
50
50
|
attr_accessor :tree_structure
|
51
51
|
|
52
52
|
# Required fields for the request
|
53
|
-
def
|
53
|
+
def init_field_validations; end
|
54
54
|
|
55
55
|
# Request Configuration
|
56
56
|
def init_configuration; end
|
@@ -146,6 +146,8 @@ module GenesisRuby
|
|
146
146
|
|
147
147
|
# Transform amount to minor currency format
|
148
148
|
def transform_amount(amount, currency)
|
149
|
+
return amount if amount.nil? || !GenesisRuby::Api::Constants::Currencies::Iso4217.valid?(currency)
|
150
|
+
|
149
151
|
GenesisRuby::Utils::MoneyFormat.amount_to_exponent amount, currency
|
150
152
|
end
|
151
153
|
|
@@ -11,12 +11,14 @@ module GenesisRuby
|
|
11
11
|
include Mixins::Requests::Financial::Cards::TokenizationAttributes
|
12
12
|
include Mixins::Requests::Financial::PaymentAttributes
|
13
13
|
|
14
|
-
def init_required_fields
|
15
|
-
self.required_fields = %i[transaction_id amount currency]
|
16
|
-
end
|
17
|
-
|
18
14
|
protected
|
19
15
|
|
16
|
+
# Request Field validations
|
17
|
+
def init_field_validations
|
18
|
+
required_fields.push *%i[transaction_id amount currency]
|
19
|
+
field_values.merge! currency: Api::Constants::Currencies::Iso4217.all.map(&:upcase)
|
20
|
+
end
|
21
|
+
|
20
22
|
# Credit Card attributes
|
21
23
|
def payment_transaction_structure
|
22
24
|
payment_attributes_structure.merge(
|
@@ -10,8 +10,9 @@ module GenesisRuby
|
|
10
10
|
|
11
11
|
protected
|
12
12
|
|
13
|
-
def
|
14
|
-
|
13
|
+
def init_field_validations
|
14
|
+
required_fields.push *%i[transaction_id reference_id amount currency]
|
15
|
+
field_values.merge! currency: Api::Constants::Currencies::Iso4217.all.map(&:upcase)
|
15
16
|
end
|
16
17
|
|
17
18
|
# Reference transaction request structure
|
@@ -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
|
|
@@ -31,8 +32,16 @@ module GenesisRuby
|
|
31
32
|
GenesisRuby::Api::Constants::Transactions::AUTHORIZE
|
32
33
|
end
|
33
34
|
|
34
|
-
|
35
|
-
|
35
|
+
# Request Field validations
|
36
|
+
def init_field_validations
|
37
|
+
super
|
38
|
+
|
39
|
+
field_values.merge! managed_recurring_field_values, recurring_type_field_values_validation_structure
|
40
|
+
|
41
|
+
field_value_dependencies.merge! required_tokenization_fields_conditional, required_cc_fields_conditional,
|
42
|
+
required_recurring_managed_type_field_conditional
|
43
|
+
|
44
|
+
return unless recurring_type == Constants::Transactions::Parameters::Recurring::Types::SUBSEQUENT
|
36
45
|
|
37
46
|
self.required_fields = recurring_type_subsequent_required_request_attributes
|
38
47
|
end
|
@@ -55,7 +64,8 @@ module GenesisRuby
|
|
55
64
|
recurring_type: recurring_type,
|
56
65
|
recurring_category: recurring_category,
|
57
66
|
sca_params: sca_attributes_structure,
|
58
|
-
managed_recurring: managed_recurring_attributes_structure
|
67
|
+
managed_recurring: managed_recurring_attributes_structure,
|
68
|
+
travel: travel_data_attributes_structure
|
59
69
|
)
|
60
70
|
end
|
61
71
|
|
@@ -26,16 +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
|
-
|
30
|
-
# Specifies the recurring type of transaction
|
31
|
-
def recurring_type=(value)
|
32
|
-
allowed_values = [
|
33
|
-
GenesisRuby::Api::Constants::Transactions::Parameters::Recurring::Types::INITIAL,
|
34
|
-
GenesisRuby::Api::Constants::Transactions::Parameters::Recurring::Types::MANAGED
|
35
|
-
]
|
36
|
-
|
37
|
-
allowed_options attribute: __method__, allowed: allowed_values, value: value, allow_empty: true
|
38
|
-
end
|
29
|
+
include Mixins::Requests::Financial::TravelData::TravelAttributes
|
39
30
|
|
40
31
|
protected
|
41
32
|
|
@@ -44,6 +35,25 @@ module GenesisRuby
|
|
44
35
|
GenesisRuby::Api::Constants::Transactions::AUTHORIZE_3D
|
45
36
|
end
|
46
37
|
|
38
|
+
# Request Field validations
|
39
|
+
def init_field_validations
|
40
|
+
super
|
41
|
+
|
42
|
+
field_values.merge! managed_recurring_field_values,
|
43
|
+
recurring_type_initial_field_values_validation_structure, threeds_field_validations
|
44
|
+
|
45
|
+
field_value_dependencies.merge! required_tokenization_fields_conditional, required_cc_fields_conditional,
|
46
|
+
required_recurring_managed_type_field_conditional,
|
47
|
+
threeds_field_conditional_validations
|
48
|
+
end
|
49
|
+
|
50
|
+
# Special validations upon document building
|
51
|
+
def check_requirements
|
52
|
+
validate_threeds_card_holder_dates
|
53
|
+
|
54
|
+
super
|
55
|
+
end
|
56
|
+
|
47
57
|
# Authorize 3D transaction request parameters
|
48
58
|
def payment_transaction_structure # rubocop:disable Metrics/MethodLength, Metrics/AbcSize
|
49
59
|
super.merge(
|
@@ -67,7 +77,8 @@ module GenesisRuby
|
|
67
77
|
recurring_category: recurring_category,
|
68
78
|
sca_params: sca_attributes_structure,
|
69
79
|
threeds_v2_params: threeds_v2_common_attributes_structure,
|
70
|
-
managed_recurring: managed_recurring_attributes_structure
|
80
|
+
managed_recurring: managed_recurring_attributes_structure,
|
81
|
+
travel: travel_data_attributes_structure
|
71
82
|
)
|
72
83
|
end
|
73
84
|
|
@@ -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
|
|
@@ -30,8 +31,16 @@ module GenesisRuby
|
|
30
31
|
GenesisRuby::Api::Constants::Transactions::SALE
|
31
32
|
end
|
32
33
|
|
33
|
-
|
34
|
-
|
34
|
+
# Request Field validations
|
35
|
+
def init_field_validations
|
36
|
+
super
|
37
|
+
|
38
|
+
field_values.merge! managed_recurring_field_values, recurring_type_field_values_validation_structure
|
39
|
+
|
40
|
+
field_value_dependencies.merge! required_tokenization_fields_conditional, required_cc_fields_conditional,
|
41
|
+
required_recurring_managed_type_field_conditional
|
42
|
+
|
43
|
+
return unless recurring_type == Constants::Transactions::Parameters::Recurring::Types::SUBSEQUENT
|
35
44
|
|
36
45
|
self.required_fields = recurring_type_subsequent_required_request_attributes
|
37
46
|
end
|
@@ -54,7 +63,8 @@ module GenesisRuby
|
|
54
63
|
recurring_type: recurring_type,
|
55
64
|
recurring_category: recurring_category,
|
56
65
|
sca_params: sca_attributes_structure,
|
57
|
-
managed_recurring: managed_recurring_attributes_structure
|
66
|
+
managed_recurring: managed_recurring_attributes_structure,
|
67
|
+
travel: travel_data_attributes_structure
|
58
68
|
)
|
59
69
|
end
|
60
70
|
|
@@ -25,16 +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
|
-
|
29
|
-
# Specifies the recurring type of transaction
|
30
|
-
def recurring_type=(value)
|
31
|
-
allowed_values = [
|
32
|
-
GenesisRuby::Api::Constants::Transactions::Parameters::Recurring::Types::INITIAL,
|
33
|
-
GenesisRuby::Api::Constants::Transactions::Parameters::Recurring::Types::MANAGED
|
34
|
-
]
|
35
|
-
|
36
|
-
allowed_options attribute: __method__, allowed: allowed_values, value: value, allow_empty: true
|
37
|
-
end
|
28
|
+
include Mixins::Requests::Financial::TravelData::TravelAttributes
|
38
29
|
|
39
30
|
protected
|
40
31
|
|
@@ -43,6 +34,25 @@ module GenesisRuby
|
|
43
34
|
GenesisRuby::Api::Constants::Transactions::SALE_3D
|
44
35
|
end
|
45
36
|
|
37
|
+
# Request Field validations
|
38
|
+
def init_field_validations
|
39
|
+
super
|
40
|
+
|
41
|
+
field_values.merge! managed_recurring_field_values,
|
42
|
+
recurring_type_initial_field_values_validation_structure, threeds_field_validations
|
43
|
+
|
44
|
+
field_value_dependencies.merge! required_tokenization_fields_conditional, required_cc_fields_conditional,
|
45
|
+
required_recurring_managed_type_field_conditional,
|
46
|
+
threeds_field_conditional_validations
|
47
|
+
end
|
48
|
+
|
49
|
+
# Special validations upon document building
|
50
|
+
def check_requirements
|
51
|
+
validate_threeds_card_holder_dates
|
52
|
+
|
53
|
+
super
|
54
|
+
end
|
55
|
+
|
46
56
|
# Sale 3D transaction request parameters
|
47
57
|
def payment_transaction_structure # rubocop:disable Metrics/MethodLength, Metrics/AbcSize
|
48
58
|
super.merge(
|
@@ -66,7 +76,8 @@ module GenesisRuby
|
|
66
76
|
recurring_category: recurring_category,
|
67
77
|
sca_params: sca_attributes_structure,
|
68
78
|
threeds_v2_params: threeds_v2_common_attributes_structure,
|
69
|
-
managed_recurring: managed_recurring_attributes_structure
|
79
|
+
managed_recurring: managed_recurring_attributes_structure,
|
80
|
+
travel: travel_data_attributes_structure
|
70
81
|
)
|
71
82
|
end
|
72
83
|
|
@@ -104,8 +104,8 @@ module GenesisRuby
|
|
104
104
|
init_api_gateway_configuration request_path: 'threeds/threeds_method/:unique_id', include_token: false
|
105
105
|
end
|
106
106
|
|
107
|
-
def
|
108
|
-
|
107
|
+
def init_field_validations
|
108
|
+
required_fields.push *%i[amount transaction_timestamp]
|
109
109
|
end
|
110
110
|
|
111
111
|
# Build correct endpoint url during runtime
|
@@ -0,0 +1,91 @@
|
|
1
|
+
require 'genesis_ruby/api/constants/transactions/parameters/mobile/apple_pay/payment_subtypes'
|
2
|
+
|
3
|
+
module GenesisRuby
|
4
|
+
module Api
|
5
|
+
module Requests
|
6
|
+
module Financial
|
7
|
+
module Mobile
|
8
|
+
# Apple Pay transaction request
|
9
|
+
class ApplePay < Requests::Base::Financial
|
10
|
+
|
11
|
+
include Mixins::Requests::AddressInfoAttributes
|
12
|
+
include Mixins::Requests::BirthDateAttributes
|
13
|
+
include Mixins::Requests::DocumentAttributes
|
14
|
+
include Mixins::Requests::Financial::Business::BusinessAttributes
|
15
|
+
include Mixins::Requests::Financial::CryptoAttributes
|
16
|
+
include Mixins::Requests::Financial::DynamicDescriptorAttributes
|
17
|
+
include Mixins::Requests::Financial::Mobile::ApplePayTokenAttributes
|
18
|
+
include Mixins::Requests::Financial::PaymentAttributes
|
19
|
+
|
20
|
+
attr_accessor :payment_subtype
|
21
|
+
|
22
|
+
# Define Payment Token from a JSON string
|
23
|
+
def json_token=(value)
|
24
|
+
json_object = Utils::Common.parse_json_string value
|
25
|
+
|
26
|
+
map_apple_pay_token_attributes json_object
|
27
|
+
end
|
28
|
+
|
29
|
+
protected
|
30
|
+
|
31
|
+
# Apple Pay transaction request type
|
32
|
+
def transaction_type
|
33
|
+
Api::Constants::Transactions::APPLE_PAY
|
34
|
+
end
|
35
|
+
|
36
|
+
def init_field_validations
|
37
|
+
required_fields.push *%i[transaction_id payment_subtype token_version token_data token_signature
|
38
|
+
token_ephemeral_public_key token_public_key_hash token_transaction_id token_display_name token_network
|
39
|
+
token_type token_transaction_identifier amount currency]
|
40
|
+
|
41
|
+
field_values.merge! currency: Api::Constants::Currencies::Iso4217.all.map(&:upcase),
|
42
|
+
payment_subtype: Api::Constants::Transactions::Parameters::Mobile::ApplePay::
|
43
|
+
PaymentSubtypes.all
|
44
|
+
end
|
45
|
+
|
46
|
+
# Apple Pay payment transaction structure
|
47
|
+
def payment_transaction_structure # rubocop:disable Metrics/MethodLength
|
48
|
+
payment_attributes_structure.merge(
|
49
|
+
{
|
50
|
+
payment_subtype: payment_subtype,
|
51
|
+
payment_token: payment_token_structure,
|
52
|
+
customer_email: customer_email,
|
53
|
+
customer_phone: customer_phone,
|
54
|
+
birth_date: birth_date,
|
55
|
+
billing_address: billing_address_parameters_structure,
|
56
|
+
shipping_address: shipping_address_parameters_structure,
|
57
|
+
document_id: document_id,
|
58
|
+
crypto: crypto,
|
59
|
+
business_attributes: business_attributes_structure,
|
60
|
+
dynamic_descriptor_params: dynamic_descriptor_structure
|
61
|
+
}
|
62
|
+
)
|
63
|
+
end
|
64
|
+
|
65
|
+
private
|
66
|
+
|
67
|
+
# Map the Apple Pay Token attributes from the given Hash object
|
68
|
+
def map_apple_pay_token_attributes(json_object)
|
69
|
+
return nil unless json_object.is_a? Hash
|
70
|
+
|
71
|
+
json_object.each do |token_key, token_value|
|
72
|
+
if token_value.is_a? Hash
|
73
|
+
map_apple_pay_token_attributes token_value
|
74
|
+
|
75
|
+
next
|
76
|
+
end
|
77
|
+
|
78
|
+
token_method = "token_#{GenesisRuby::Utils::Common.camel_to_snake_case(token_key)}="
|
79
|
+
|
80
|
+
__send__ token_method, token_value if respond_to? token_method
|
81
|
+
end
|
82
|
+
|
83
|
+
nil
|
84
|
+
end
|
85
|
+
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|