genesis_ruby 0.1.7 → 0.1.9
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 +41 -0
- data/Gemfile.lock +45 -39
- data/README.md +246 -0
- data/VERSION +1 -1
- data/lib/genesis_ruby/api/constants/transactions/parameters/cash_payments/company_types.rb +45 -0
- data/lib/genesis_ruby/api/constants/transactions/parameters/cash_payments/genders.rb +27 -0
- data/lib/genesis_ruby/api/constants/transactions/parameters/cash_payments/marital_statuses.rb +39 -0
- 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/constants/transactions/parameters/wallets/pay_pal/payment_types.rb +31 -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/billing_info_attributes.rb +11 -10
- data/lib/genesis_ruby/api/mixins/requests/customer_address/customer_info_attributes.rb +1 -1
- data/lib/genesis_ruby/api/mixins/requests/customer_address/shipping_info_attributes.rb +11 -10
- 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/consumer_identifier_attributes.rb +26 -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/financials/south_american_payments.rb +59 -0
- data/lib/genesis_ruby/api/requests/base/reference.rb +3 -2
- data/lib/genesis_ruby/api/requests/financial/cards/argencard.rb +26 -0
- data/lib/genesis_ruby/api/requests/financial/cards/aura.rb +26 -0
- 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/cabal.rb +26 -0
- data/lib/genesis_ruby/api/requests/financial/cards/cencosud.rb +26 -0
- data/lib/genesis_ruby/api/requests/financial/cards/elo.rb +26 -0
- data/lib/genesis_ruby/api/requests/financial/cards/naranja.rb +26 -0
- data/lib/genesis_ruby/api/requests/financial/cards/nativa.rb +26 -0
- 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/tarjeta_shopping.rb +26 -0
- data/lib/genesis_ruby/api/requests/financial/cards/threeds/v2/method_continue.rb +2 -2
- data/lib/genesis_ruby/api/requests/financial/cash_payments/baloto.rb +26 -0
- data/lib/genesis_ruby/api/requests/financial/cash_payments/banco_de_occidente.rb +26 -0
- data/lib/genesis_ruby/api/requests/financial/cash_payments/boleto.rb +26 -0
- data/lib/genesis_ruby/api/requests/financial/cash_payments/efecty.rb +26 -0
- data/lib/genesis_ruby/api/requests/financial/cash_payments/oxxo.rb +26 -0
- data/lib/genesis_ruby/api/requests/financial/cash_payments/pago_facil.rb +26 -0
- data/lib/genesis_ruby/api/requests/financial/cash_payments/pix.rb +92 -0
- data/lib/genesis_ruby/api/requests/financial/cash_payments/redpagos.rb +26 -0
- 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/bancomer.rb +33 -0
- data/lib/genesis_ruby/api/requests/financial/online_banking_payments/bradesco.rb +33 -0
- data/lib/genesis_ruby/api/requests/financial/online_banking_payments/davivienda.rb +34 -0
- data/lib/genesis_ruby/api/requests/financial/online_banking_payments/itau.rb +33 -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/online_banking_payments/pse.rb +33 -0
- data/lib/genesis_ruby/api/requests/financial/online_banking_payments/rapi_pago.rb +33 -0
- data/lib/genesis_ruby/api/requests/financial/online_banking_payments/santander.rb +33 -0
- data/lib/genesis_ruby/api/requests/financial/online_banking_payments/webpay.rb +33 -0
- data/lib/genesis_ruby/api/requests/financial/void.rb +2 -2
- data/lib/genesis_ruby/api/requests/financial/wallets/pay_pay.rb +65 -0
- 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/dependencies.rb +1 -0
- data/lib/genesis_ruby/utils/common.rb +26 -0
- data/lib/genesis_ruby/version.rb +1 -1
- metadata +46 -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,33 @@
|
|
|
1
|
+
module GenesisRuby
|
|
2
|
+
module Api
|
|
3
|
+
module Requests
|
|
4
|
+
module Financial
|
|
5
|
+
module OnlineBankingPayments
|
|
6
|
+
# Bancomer offers two options for payments in Mexico, cash payment and bank transfer
|
|
7
|
+
class Bancomer < Base::Financials::SouthAmericanPayments
|
|
8
|
+
|
|
9
|
+
include Api::Mixins::Requests::Financial::PendingPaymentAttributes
|
|
10
|
+
|
|
11
|
+
protected
|
|
12
|
+
|
|
13
|
+
# Bancomer transaction type
|
|
14
|
+
def transaction_type
|
|
15
|
+
Api::Constants::Transactions::BANCOMER
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
# Allowed billing country for Bancomer transaction request
|
|
19
|
+
def allowed_billing_countries
|
|
20
|
+
%w(MX)
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
# Bancomer request structure
|
|
24
|
+
def payment_transaction_structure
|
|
25
|
+
super.merge return_pending_url: return_pending_url
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
module GenesisRuby
|
|
2
|
+
module Api
|
|
3
|
+
module Requests
|
|
4
|
+
module Financial
|
|
5
|
+
module OnlineBankingPayments
|
|
6
|
+
# Bradesco is a payment service in Brazil
|
|
7
|
+
class Bradesco < Base::Financials::SouthAmericanPayments
|
|
8
|
+
|
|
9
|
+
include Api::Mixins::Requests::Financial::PendingPaymentAttributes
|
|
10
|
+
|
|
11
|
+
protected
|
|
12
|
+
|
|
13
|
+
# Bradesco transaction type
|
|
14
|
+
def transaction_type
|
|
15
|
+
Api::Constants::Transactions::BRADESCO
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
# Allowed billing countries for Bradesco transaction type
|
|
19
|
+
def allowed_billing_countries
|
|
20
|
+
%w(BR)
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
# Bradesco request structure
|
|
24
|
+
def payment_transaction_structure
|
|
25
|
+
super.merge return_pending_url: return_pending_url
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
module GenesisRuby
|
|
2
|
+
module Api
|
|
3
|
+
module Requests
|
|
4
|
+
module Financial
|
|
5
|
+
module OnlineBankingPayments
|
|
6
|
+
# Davivienda is offering the Bill pay service which is a fast, easy and secure way to pay and manage your
|
|
7
|
+
# bills online to anyone, anytime in Colombia.
|
|
8
|
+
class Davivienda < Base::Financials::SouthAmericanPayments
|
|
9
|
+
|
|
10
|
+
include Api::Mixins::Requests::Financial::PendingPaymentAttributes
|
|
11
|
+
|
|
12
|
+
protected
|
|
13
|
+
|
|
14
|
+
# Davivienda transaction type
|
|
15
|
+
def transaction_type
|
|
16
|
+
Api::Constants::Transactions::DAVIVIENDA
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
# Allowed billing countries for Davivienda transaction request
|
|
20
|
+
def allowed_billing_countries
|
|
21
|
+
%w(CO)
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
# Davivienda payment transaction structure
|
|
25
|
+
def payment_transaction_structure
|
|
26
|
+
super.merge return_pending_url: return_pending_url
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
end
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
module GenesisRuby
|
|
2
|
+
module Api
|
|
3
|
+
module Requests
|
|
4
|
+
module Financial
|
|
5
|
+
module OnlineBankingPayments
|
|
6
|
+
# Itau is a real-time online bank transfer method and a virtual card.
|
|
7
|
+
class Itau < Base::Financials::SouthAmericanPayments
|
|
8
|
+
|
|
9
|
+
include Api::Mixins::Requests::Financial::PendingPaymentAttributes
|
|
10
|
+
|
|
11
|
+
protected
|
|
12
|
+
|
|
13
|
+
# Itau transaction type
|
|
14
|
+
def transaction_type
|
|
15
|
+
Api::Constants::Transactions::ITAU
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
# Allowed billing countries for Itau transaction request
|
|
19
|
+
def allowed_billing_countries
|
|
20
|
+
%w(BR)
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
# Itau payment transaction structure
|
|
24
|
+
def payment_transaction_structure
|
|
25
|
+
super.merge return_pending_url: return_pending_url
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
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
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
module GenesisRuby
|
|
2
|
+
module Api
|
|
3
|
+
module Requests
|
|
4
|
+
module Financial
|
|
5
|
+
module OnlineBankingPayments
|
|
6
|
+
# PSE (Pagos Seguros en Linea) is the preferred alternative payment solution in Colombia.
|
|
7
|
+
class Pse < Base::Financials::SouthAmericanPayments
|
|
8
|
+
|
|
9
|
+
include Api::Mixins::Requests::Financial::PendingPaymentAttributes
|
|
10
|
+
|
|
11
|
+
protected
|
|
12
|
+
|
|
13
|
+
# PSE (Pagos Seguros en Linea) transaction type
|
|
14
|
+
def transaction_type
|
|
15
|
+
Api::Constants::Transactions::PSE
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
# Allowed billing countries for PSE (Pagos Seguros en Linea) transaction request
|
|
19
|
+
def allowed_billing_countries
|
|
20
|
+
%w(CO)
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
# PSE (Pagos Seguros en Linea) transaction request structure
|
|
24
|
+
def payment_transaction_structure
|
|
25
|
+
super.merge return_pending_url: return_pending_url
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
module GenesisRuby
|
|
2
|
+
module Api
|
|
3
|
+
module Requests
|
|
4
|
+
module Financial
|
|
5
|
+
module OnlineBankingPayments
|
|
6
|
+
# RapiPago from Argentina is an offline payment method used for online purchases
|
|
7
|
+
class RapiPago < Base::Financials::SouthAmericanPayments
|
|
8
|
+
|
|
9
|
+
include Api::Mixins::Requests::Financial::PendingPaymentAttributes
|
|
10
|
+
|
|
11
|
+
protected
|
|
12
|
+
|
|
13
|
+
# RapiPago transaction type
|
|
14
|
+
def transaction_type
|
|
15
|
+
Api::Constants::Transactions::RAPI_PAGO
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
# Allowed billing countries for RapiPago transaction request
|
|
19
|
+
def allowed_billing_countries
|
|
20
|
+
%w(AR)
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
# RapiPago transaction request structure
|
|
24
|
+
def payment_transaction_structure
|
|
25
|
+
super.merge return_pending_url: return_pending_url
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
module GenesisRuby
|
|
2
|
+
module Api
|
|
3
|
+
module Requests
|
|
4
|
+
module Financial
|
|
5
|
+
module OnlineBankingPayments
|
|
6
|
+
# Santander is an online bank transfer for ecommerce purchases
|
|
7
|
+
class Santander < Base::Financials::SouthAmericanPayments
|
|
8
|
+
|
|
9
|
+
include Api::Mixins::Requests::Financial::PendingPaymentAttributes
|
|
10
|
+
|
|
11
|
+
protected
|
|
12
|
+
|
|
13
|
+
# Santander transaction type
|
|
14
|
+
def transaction_type
|
|
15
|
+
Api::Constants::Transactions::SANTANDER
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
# Allowed billing countries for Santander transaction request
|
|
19
|
+
def allowed_billing_countries
|
|
20
|
+
%w(AR BR MX CL)
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
# Santander payment transaction structure
|
|
24
|
+
def payment_transaction_structure
|
|
25
|
+
super.merge return_pending_url: return_pending_url
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
module GenesisRuby
|
|
2
|
+
module Api
|
|
3
|
+
module Requests
|
|
4
|
+
module Financial
|
|
5
|
+
module OnlineBankingPayments
|
|
6
|
+
# Webpay is a Chilean real-time bank transfer method.
|
|
7
|
+
class Webpay < Base::Financials::SouthAmericanPayments
|
|
8
|
+
|
|
9
|
+
include Api::Mixins::Requests::Financial::PendingPaymentAttributes
|
|
10
|
+
|
|
11
|
+
protected
|
|
12
|
+
|
|
13
|
+
# Webpay transaction type
|
|
14
|
+
def transaction_type
|
|
15
|
+
Api::Constants::Transactions::WEBPAY
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
# Allowed billing countries for Webpay transaction request
|
|
19
|
+
def allowed_billing_countries
|
|
20
|
+
%w(CL)
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
# Webpay transaction request structure
|
|
24
|
+
def payment_transaction_structure
|
|
25
|
+
super.merge return_pending_url: return_pending_url
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
end
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
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
|