genesis_ruby 0.1.8 → 0.1.9

Sign up to get free protection for your applications and to get access to all the features.
Files changed (41) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +31 -0
  3. data/Gemfile.lock +2 -2
  4. data/README.md +29 -0
  5. data/VERSION +1 -1
  6. data/lib/genesis_ruby/api/constants/transactions/parameters/cash_payments/company_types.rb +45 -0
  7. data/lib/genesis_ruby/api/constants/transactions/parameters/cash_payments/genders.rb +27 -0
  8. data/lib/genesis_ruby/api/constants/transactions/parameters/cash_payments/marital_statuses.rb +39 -0
  9. data/lib/genesis_ruby/api/constants/transactions/parameters/wallets/pay_pal/payment_types.rb +31 -0
  10. data/lib/genesis_ruby/api/mixins/requests/customer_address/billing_info_attributes.rb +11 -10
  11. data/lib/genesis_ruby/api/mixins/requests/customer_address/shipping_info_attributes.rb +11 -10
  12. data/lib/genesis_ruby/api/mixins/requests/financial/consumer_identifier_attributes.rb +26 -0
  13. data/lib/genesis_ruby/api/requests/base/financials/south_american_payments.rb +59 -0
  14. data/lib/genesis_ruby/api/requests/financial/cards/argencard.rb +26 -0
  15. data/lib/genesis_ruby/api/requests/financial/cards/aura.rb +26 -0
  16. data/lib/genesis_ruby/api/requests/financial/cards/cabal.rb +26 -0
  17. data/lib/genesis_ruby/api/requests/financial/cards/cencosud.rb +26 -0
  18. data/lib/genesis_ruby/api/requests/financial/cards/elo.rb +26 -0
  19. data/lib/genesis_ruby/api/requests/financial/cards/naranja.rb +26 -0
  20. data/lib/genesis_ruby/api/requests/financial/cards/nativa.rb +26 -0
  21. data/lib/genesis_ruby/api/requests/financial/cards/tarjeta_shopping.rb +26 -0
  22. data/lib/genesis_ruby/api/requests/financial/cash_payments/baloto.rb +26 -0
  23. data/lib/genesis_ruby/api/requests/financial/cash_payments/banco_de_occidente.rb +26 -0
  24. data/lib/genesis_ruby/api/requests/financial/cash_payments/boleto.rb +26 -0
  25. data/lib/genesis_ruby/api/requests/financial/cash_payments/efecty.rb +26 -0
  26. data/lib/genesis_ruby/api/requests/financial/cash_payments/oxxo.rb +26 -0
  27. data/lib/genesis_ruby/api/requests/financial/cash_payments/pago_facil.rb +26 -0
  28. data/lib/genesis_ruby/api/requests/financial/cash_payments/pix.rb +92 -0
  29. data/lib/genesis_ruby/api/requests/financial/cash_payments/redpagos.rb +26 -0
  30. data/lib/genesis_ruby/api/requests/financial/online_banking_payments/bancomer.rb +33 -0
  31. data/lib/genesis_ruby/api/requests/financial/online_banking_payments/bradesco.rb +33 -0
  32. data/lib/genesis_ruby/api/requests/financial/online_banking_payments/davivienda.rb +34 -0
  33. data/lib/genesis_ruby/api/requests/financial/online_banking_payments/itau.rb +33 -0
  34. data/lib/genesis_ruby/api/requests/financial/online_banking_payments/pse.rb +33 -0
  35. data/lib/genesis_ruby/api/requests/financial/online_banking_payments/rapi_pago.rb +33 -0
  36. data/lib/genesis_ruby/api/requests/financial/online_banking_payments/santander.rb +33 -0
  37. data/lib/genesis_ruby/api/requests/financial/online_banking_payments/webpay.rb +33 -0
  38. data/lib/genesis_ruby/api/requests/financial/wallets/pay_pay.rb +65 -0
  39. data/lib/genesis_ruby/dependencies.rb +1 -0
  40. data/lib/genesis_ruby/version.rb +1 -1
  41. metadata +34 -3
@@ -0,0 +1,26 @@
1
+ module GenesisRuby
2
+ module Api
3
+ module Requests
4
+ module Financial
5
+ module CashPayments
6
+ # Banco de Occidente is a cash payment method for Colombia
7
+ class BancoDeOccidente < Base::Financials::SouthAmericanPayments
8
+
9
+ protected
10
+
11
+ # Banco de Occidente transaction type
12
+ def transaction_type
13
+ Api::Constants::Transactions::BANCO_DE_OCCIDENTE
14
+ end
15
+
16
+ # Banco de Occidente allowed billing countries
17
+ def allowed_billing_countries
18
+ %w(CO)
19
+ end
20
+
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,26 @@
1
+ module GenesisRuby
2
+ module Api
3
+ module Requests
4
+ module Financial
5
+ module CashPayments
6
+ # Boleto is a payment service in Brazil
7
+ class Boleto < Base::Financials::SouthAmericanPayments
8
+
9
+ protected
10
+
11
+ # Boleto transaction type
12
+ def transaction_type
13
+ Api::Constants::Transactions::BOLETO
14
+ end
15
+
16
+ # Allowed billing country for Boleto transaction request
17
+ def allowed_billing_countries
18
+ %w(BR)
19
+ end
20
+
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,26 @@
1
+ module GenesisRuby
2
+ module Api
3
+ module Requests
4
+ module Financial
5
+ module CashPayments
6
+ # Efecty is a cash-based payment method.
7
+ class Efecty < Base::Financials::SouthAmericanPayments
8
+
9
+ protected
10
+
11
+ # Efecty transaction type
12
+ def transaction_type
13
+ Api::Constants::Transactions::EFECTY
14
+ end
15
+
16
+ # Allowed billing countries for Efecty transaction request
17
+ def allowed_billing_countries
18
+ %w(CO)
19
+ end
20
+
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,26 @@
1
+ module GenesisRuby
2
+ module Api
3
+ module Requests
4
+ module Financial
5
+ module CashPayments
6
+ # OXXO is the preferred payment method in Mexico
7
+ class Oxxo < Base::Financials::SouthAmericanPayments
8
+
9
+ protected
10
+
11
+ # OXXO transaction type
12
+ def transaction_type
13
+ Api::Constants::Transactions::OXXO
14
+ end
15
+
16
+ # Allowed billing countries for OXXO transaction request
17
+ def allowed_billing_countries
18
+ %w(MX)
19
+ end
20
+
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,26 @@
1
+ module GenesisRuby
2
+ module Api
3
+ module Requests
4
+ module Financial
5
+ module CashPayments
6
+ # Pago Facil is a cash-based payment used for online purchases
7
+ class PagoFacil < Base::Financials::SouthAmericanPayments
8
+
9
+ protected
10
+
11
+ # PagoFacil transaction type
12
+ def transaction_type
13
+ Api::Constants::Transactions::PAGO_FACIL
14
+ end
15
+
16
+ # Allowed billing countries for PagoFacil transaction request
17
+ def allowed_billing_countries
18
+ %w(AR)
19
+ end
20
+
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,92 @@
1
+ require 'genesis_ruby/api/constants/transactions/parameters/cash_payments/genders'
2
+ require 'genesis_ruby/api/constants/transactions/parameters/cash_payments/marital_statuses'
3
+ require 'genesis_ruby/api/constants/transactions/parameters/cash_payments/company_types'
4
+
5
+ module GenesisRuby
6
+ module Api
7
+ module Requests
8
+ module Financial
9
+ module CashPayments
10
+ # Pix is a payment service, which represents a new way of receiving/sending money.
11
+ # Pix allows payments to be made instantly.
12
+ class Pix < Requests::Base::Financial
13
+
14
+ include Api::Mixins::Requests::AddressInfoAttributes
15
+ include Api::Mixins::Requests::BirthDateAttributes
16
+ include Api::Mixins::Requests::DocumentAttributes
17
+ include Api::Mixins::Requests::Financial::AsyncAttributes
18
+ include Api::Mixins::Requests::Financial::PaymentAttributes
19
+ include Api::Mixins::Requests::Financial::PendingPaymentAttributes
20
+
21
+ attr_accessor :gender, :marital_status, :sender_occupation, :nationality, :country_of_origin, :birth_city,
22
+ :birth_state, :company_type, :company_activity, :mothers_name
23
+
24
+ # Billing Country custom accessor
25
+ def billing_country
26
+ return nil unless @billing_country
27
+
28
+ @billing_country.to_s.upcase
29
+ end
30
+
31
+ # Incorporation date
32
+ def incorporation_date
33
+ @incorporation_date&.strftime GenesisRuby::Api::Constants::DateTimeFormats::DD_MM_YYYY_L_HYPHENS
34
+ end
35
+
36
+ # Incorporation date
37
+ def incorporation_date=(value)
38
+ parse_date attribute: __method__, value: value, allow_empty: true
39
+ end
40
+
41
+ protected
42
+
43
+ # Pix transaction type
44
+ def transaction_type
45
+ Api::Constants::Transactions::PIX
46
+ end
47
+
48
+ def init_field_validations
49
+ super
50
+
51
+ required_fields.push *%i[transaction_id amount currency document_id]
52
+
53
+ field_values.merge! currency: Api::Constants::Currencies::Iso4217.all.map(&:upcase),
54
+ billing_country: %w(BR),
55
+ gender: Api::Constants::Transactions::Parameters::CashPayments::Genders.all,
56
+ marital_status: Api::Constants::Transactions::Parameters::CashPayments::
57
+ MaritalStatuses.all,
58
+ company_type: Api::Constants::Transactions::Parameters::CashPayments::
59
+ CompanyTypes.all
60
+ end
61
+
62
+ # PayPal request attributes structure
63
+ def payment_transaction_structure # rubocop:disable Metrics/AbcSize, Metrics/MethodLength
64
+ payment_attributes_structure.merge(
65
+ {
66
+ return_success_url: return_success_url,
67
+ return_failure_url: return_failure_url,
68
+ return_pending_url: return_pending_url,
69
+ customer_email: customer_email,
70
+ document_id: document_id,
71
+ billing_address: billing_address_parameters_structure,
72
+ shipping_address: shipping_address_parameters_structure,
73
+ birth_date: birth_date,
74
+ gender: gender,
75
+ marital_status: marital_status,
76
+ sender_occupation: sender_occupation,
77
+ nationality: nationality,
78
+ country_of_origin: country_of_origin,
79
+ company_type: company_type,
80
+ company_activity: company_activity,
81
+ incorporation_date: incorporation_date,
82
+ mothers_name: mothers_name
83
+ }
84
+ )
85
+ end
86
+
87
+ end
88
+ end
89
+ end
90
+ end
91
+ end
92
+ end
@@ -0,0 +1,26 @@
1
+ module GenesisRuby
2
+ module Api
3
+ module Requests
4
+ module Financial
5
+ module CashPayments
6
+ # Redpagos is a cash payment in Uruguay
7
+ class Redpagos < Base::Financials::SouthAmericanPayments
8
+
9
+ protected
10
+
11
+ # Redpagos transaction type
12
+ def transaction_type
13
+ Api::Constants::Transactions::REDPAGOS
14
+ end
15
+
16
+ # Allowed billing countries for Redpagos transaction request
17
+ def allowed_billing_countries
18
+ %w(UY)
19
+ end
20
+
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
26
+ 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,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
@@ -0,0 +1,65 @@
1
+ require 'genesis_ruby/api/constants/transactions/parameters/wallets/pay_pal/payment_types'
2
+
3
+ module GenesisRuby
4
+ module Api
5
+ module Requests
6
+ module Financial
7
+ module Wallets
8
+ # PayPal transaction is a fast and easy way for buyers to pay with their PayPal account
9
+ class PayPal < Requests::Base::Financial
10
+
11
+ include Api::Mixins::Requests::AddressInfoAttributes
12
+ include Api::Mixins::Requests::Financial::AsyncAttributes
13
+ include Api::Mixins::Requests::BirthDateAttributes
14
+ include Api::Mixins::Requests::Financial::Business::BusinessAttributes
15
+ include Api::Mixins::Requests::DocumentAttributes
16
+ include Api::Mixins::Requests::Financial::NotificationAttributes
17
+ include Api::Mixins::Requests::Financial::PaymentAttributes
18
+ include Api::Mixins::Requests::Financial::NotificationAttributes
19
+ include Api::Mixins::Requests::Financial::PendingPaymentAttributes
20
+
21
+ attr_accessor :payment_type
22
+
23
+ protected
24
+
25
+ # Initialize PayPal request field validations
26
+ def init_field_validations
27
+ required_fields
28
+ .push *%i[transaction_id payment_type amount currency return_success_url return_failure_url]
29
+
30
+ field_values.merge! currency: Api::Constants::Currencies::Iso4217.all.map(&:upcase),
31
+ payment_type: Api::Constants::Transactions::Parameters::Wallets::PayPal::
32
+ PaymentTypes.all
33
+ end
34
+
35
+ # PayPal transaction type
36
+ def transaction_type
37
+ Api::Constants::Transactions::PAY_PAL
38
+ end
39
+
40
+ # PayPal request attributes structure
41
+ def payment_transaction_structure # rubocop:disable Metrics/MethodLength
42
+ payment_attributes_structure.merge(
43
+ {
44
+ notification_url: notification_url,
45
+ return_success_url: return_success_url,
46
+ return_failure_url: return_failure_url,
47
+ return_pending_url: return_pending_url,
48
+ customer_email: customer_email,
49
+ customer_phone: customer_phone,
50
+ payment_type: payment_type,
51
+ birth_date: birth_date,
52
+ document_id: document_id,
53
+ billing_address: billing_address_parameters_structure,
54
+ shipping_address: shipping_address_parameters_structure,
55
+ business_attributes: business_attributes_structure
56
+ }
57
+ )
58
+ end
59
+
60
+ end
61
+ end
62
+ end
63
+ end
64
+ end
65
+ end
@@ -18,6 +18,7 @@ Dir["#{File.dirname(__FILE__)}/api/mixins/**/*_attributes.rb"].sort.each { |file
18
18
  # =================================
19
19
  require 'genesis_ruby/api/requests/base/financial'
20
20
  require 'genesis_ruby/api/requests/base/financials/credit_card'
21
+ require 'genesis_ruby/api/requests/base/financials/south_american_payments'
21
22
  require 'genesis_ruby/api/requests/base/reference'
22
23
  require 'genesis_ruby/api/notification'
23
24
 
@@ -1,5 +1,5 @@
1
1
  module GenesisRuby
2
2
 
3
- VERSION = '0.1.8'.freeze
3
+ VERSION = '0.1.9'.freeze
4
4
 
5
5
  end