genesis_ruby 0.1.7 → 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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +10 -0
- data/Gemfile.lock +44 -38
- data/README.md +217 -0
- 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/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/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/recurring/managed_recurring_attributes.rb +21 -20
- data/lib/genesis_ruby/api/mixins/requests/financial/cards/recurring/managed_recurring_indian_card_attributes.rb +15 -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/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/cards/authorize.rb +10 -2
- data/lib/genesis_ruby/api/requests/financial/cards/authorize3d.rb +19 -10
- data/lib/genesis_ruby/api/requests/financial/cards/sale.rb +10 -2
- data/lib/genesis_ruby/api/requests/financial/cards/sale3d.rb +19 -10
- 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/utils/common.rb +26 -0
- data/lib/genesis_ruby/version.rb +1 -1
- metadata +15 -3
@@ -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
|
@@ -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
|
18
|
-
|
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
|
@@ -116,26 +116,20 @@ module GenesisRuby
|
|
116
116
|
init_api_wpf_configuration
|
117
117
|
end
|
118
118
|
|
119
|
-
def
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
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
|
21
|
-
|
20
|
+
def init_field_validations
|
21
|
+
required_fields.push *%i[unique_id]
|
22
22
|
end
|
23
23
|
|
24
24
|
# WPF Reconcile request structure
|
@@ -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
|
data/lib/genesis_ruby/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: genesis_ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- emerchantpay Ltd.
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-10-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: net-http
|
@@ -250,8 +250,13 @@ files:
|
|
250
250
|
- lib/genesis_ruby/api/constants/transactions/parameters/managed_recurring/intervals.rb
|
251
251
|
- lib/genesis_ruby/api/constants/transactions/parameters/managed_recurring/modes.rb
|
252
252
|
- lib/genesis_ruby/api/constants/transactions/parameters/managed_recurring/payment_types.rb
|
253
|
+
- lib/genesis_ruby/api/constants/transactions/parameters/mobile/apple_pay/payment_subtypes.rb
|
254
|
+
- lib/genesis_ruby/api/constants/transactions/parameters/mobile/google_pay/payment_subtypes.rb
|
253
255
|
- lib/genesis_ruby/api/constants/transactions/parameters/mpi_protocol_sub_versions.rb
|
254
256
|
- lib/genesis_ruby/api/constants/transactions/parameters/mpi_protocol_versions.rb
|
257
|
+
- lib/genesis_ruby/api/constants/transactions/parameters/online_banking/bank_code_currencies.rb
|
258
|
+
- lib/genesis_ruby/api/constants/transactions/parameters/online_banking/bank_codes.rb
|
259
|
+
- lib/genesis_ruby/api/constants/transactions/parameters/online_banking/payment_types.rb
|
255
260
|
- lib/genesis_ruby/api/constants/transactions/parameters/recurring/categories.rb
|
256
261
|
- lib/genesis_ruby/api/constants/transactions/parameters/recurring/types.rb
|
257
262
|
- lib/genesis_ruby/api/constants/transactions/parameters/refund/bank_account_types.rb
|
@@ -277,6 +282,7 @@ files:
|
|
277
282
|
- lib/genesis_ruby/api/mixins/constants/common.rb
|
278
283
|
- lib/genesis_ruby/api/mixins/requests/address_info_attributes.rb
|
279
284
|
- lib/genesis_ruby/api/mixins/requests/attribute_validation.rb
|
285
|
+
- lib/genesis_ruby/api/mixins/requests/birth_date_attributes.rb
|
280
286
|
- lib/genesis_ruby/api/mixins/requests/customer_address/billing_info_attributes.rb
|
281
287
|
- lib/genesis_ruby/api/mixins/requests/customer_address/customer_info_attributes.rb
|
282
288
|
- lib/genesis_ruby/api/mixins/requests/customer_address/shipping_info_attributes.rb
|
@@ -303,8 +309,11 @@ files:
|
|
303
309
|
- lib/genesis_ruby/api/mixins/requests/financial/crypto_attributes.rb
|
304
310
|
- lib/genesis_ruby/api/mixins/requests/financial/dynamic_descriptor_attributes.rb
|
305
311
|
- lib/genesis_ruby/api/mixins/requests/financial/gaming_attributes.rb
|
312
|
+
- lib/genesis_ruby/api/mixins/requests/financial/mobile/apple_pay_token_attributes.rb
|
313
|
+
- lib/genesis_ruby/api/mixins/requests/financial/mobile/google_pay_token_attributes.rb
|
306
314
|
- lib/genesis_ruby/api/mixins/requests/financial/moto_attributes.rb
|
307
315
|
- lib/genesis_ruby/api/mixins/requests/financial/notification_attributes.rb
|
316
|
+
- lib/genesis_ruby/api/mixins/requests/financial/online_banking_payments/virtual_payment_address_attributes.rb
|
308
317
|
- lib/genesis_ruby/api/mixins/requests/financial/payment_attributes.rb
|
309
318
|
- lib/genesis_ruby/api/mixins/requests/financial/pending_payment_attributes.rb
|
310
319
|
- lib/genesis_ruby/api/mixins/requests/financial/reference_attributes.rb
|
@@ -338,6 +347,9 @@ files:
|
|
338
347
|
- lib/genesis_ruby/api/requests/financial/cards/sale.rb
|
339
348
|
- lib/genesis_ruby/api/requests/financial/cards/sale3d.rb
|
340
349
|
- lib/genesis_ruby/api/requests/financial/cards/threeds/v2/method_continue.rb
|
350
|
+
- lib/genesis_ruby/api/requests/financial/mobile/apple_pay.rb
|
351
|
+
- lib/genesis_ruby/api/requests/financial/mobile/google_pay.rb
|
352
|
+
- lib/genesis_ruby/api/requests/financial/online_banking_payments/online_banking/pay_in.rb
|
341
353
|
- lib/genesis_ruby/api/requests/financial/refund.rb
|
342
354
|
- lib/genesis_ruby/api/requests/financial/void.rb
|
343
355
|
- lib/genesis_ruby/api/requests/non_financial/reconcile/date_range.rb
|
@@ -418,7 +430,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
418
430
|
- !ruby/object:Gem::Version
|
419
431
|
version: '0'
|
420
432
|
requirements: []
|
421
|
-
rubygems_version: 3.
|
433
|
+
rubygems_version: 3.1.2
|
422
434
|
signing_key:
|
423
435
|
specification_version: 4
|
424
436
|
summary: Ruby Client for Genesis Payment Processing Gateway
|