genesis_ruby 0.2.0 → 0.2.2
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 +29 -0
- data/Gemfile.lock +4 -4
- data/README.md +8 -0
- data/VERSION +1 -1
- data/lib/genesis_ruby/api/constants/date_time_formats.rb +4 -0
- data/lib/genesis_ruby/api/constants/transactions/parameters/cash_payments/cash_payment_types.rb +36 -0
- data/lib/genesis_ruby/api/constants/transactions/parameters/credential_on_files.rb +29 -0
- data/lib/genesis_ruby/api/constants/transactions/parameters/online_banking/bank_account_types.rb +30 -0
- data/lib/genesis_ruby/api/constants/transactions/parameters/online_banking/payout_payment_types.rb +42 -0
- data/lib/genesis_ruby/api/constants/transactions/parameters/refund/credit_reason_indicators.rb +30 -0
- data/lib/genesis_ruby/api/constants/transactions/parameters/refund/ticket_change_indicators.rb +24 -0
- data/lib/genesis_ruby/api/constants/transactions.rb +4 -0
- data/lib/genesis_ruby/api/mixins/requests/financial/cards/credential_on_file_attributes.rb +29 -0
- data/lib/genesis_ruby/api/mixins/requests/financial/cards/installment_attributes.rb +18 -0
- data/lib/genesis_ruby/api/mixins/requests/financial/cards/mpi_attributes.rb +10 -0
- data/lib/genesis_ruby/api/mixins/requests/financial/cards/ucof_attributes.rb +33 -0
- data/lib/genesis_ruby/api/mixins/requests/financial/online_banking_payments/pix_attributes.rb +28 -0
- data/lib/genesis_ruby/api/request.rb +6 -1
- data/lib/genesis_ruby/api/requests/base/financials/credit_card.rb +25 -2
- data/lib/genesis_ruby/api/requests/base/versioned.rb +88 -0
- data/lib/genesis_ruby/api/requests/financial/capture.rb +6 -3
- data/lib/genesis_ruby/api/requests/financial/cards/authorize.rb +22 -19
- data/lib/genesis_ruby/api/requests/financial/cards/authorize3d.rb +29 -24
- data/lib/genesis_ruby/api/requests/financial/cards/bancontact.rb +47 -0
- data/lib/genesis_ruby/api/requests/financial/cards/sale.rb +22 -19
- data/lib/genesis_ruby/api/requests/financial/cards/sale3d.rb +29 -24
- data/lib/genesis_ruby/api/requests/financial/cash_payments/cash.rb +56 -0
- data/lib/genesis_ruby/api/requests/financial/cash_payments/pix.rb +4 -8
- data/lib/genesis_ruby/api/requests/financial/mobile/apple_pay.rb +4 -1
- data/lib/genesis_ruby/api/requests/financial/mobile/google_pay.rb +5 -3
- data/lib/genesis_ruby/api/requests/financial/online_banking_payments/online_banking/pay_out.rb +129 -0
- data/lib/genesis_ruby/api/requests/financial/refund.rb +32 -12
- data/lib/genesis_ruby/api/requests/non_financial/installments/fetch.rb +59 -0
- data/lib/genesis_ruby/api/requests/non_financial/installments/show.rb +58 -0
- data/lib/genesis_ruby/builder.rb +2 -0
- data/lib/genesis_ruby/builders/json.rb +30 -0
- data/lib/genesis_ruby/dependencies.rb +1 -0
- data/lib/genesis_ruby/network/adapter/net_http_adapter.rb +13 -8
- data/lib/genesis_ruby/parser.rb +3 -0
- data/lib/genesis_ruby/parsers/json.rb +18 -0
- data/lib/genesis_ruby/utils/options/api_config.rb +9 -0
- data/lib/genesis_ruby/version.rb +1 -1
- metadata +21 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b8bb23a143ba4c359861d35f9e03cfde80130d4e7566cd95a899e27e5f77b8d2
|
4
|
+
data.tar.gz: 72496117a1a8a3ec4dcca3b39f41ac080b9696b1d16e2844c3f3488b11b15104
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 54bfbce4e0a95961f64aafdc168e8509f810c070d9a24ff1430648da7f12611f87e418dea7483e97e655065b24a83bf80d61a9fe870ac6656e9bfd55704e2474
|
7
|
+
data.tar.gz: 9a10b7cd257d4dacb18b420d454cc564c265f0e636221454b00b6ed86ca95002a8cc8dfc9212ad599002fd6101da571a63063d14f1c71fe1675430a38443a47b
|
data/CHANGELOG.md
CHANGED
@@ -1,3 +1,32 @@
|
|
1
|
+
0.2.2
|
2
|
+
-----
|
3
|
+
**Features**:
|
4
|
+
|
5
|
+
* Added Installments API services support
|
6
|
+
* Added Installments attributes support to the following transaction requests:
|
7
|
+
* Authorize
|
8
|
+
* Authorize 3D
|
9
|
+
* Capture
|
10
|
+
* Sale
|
11
|
+
* Sale 3D
|
12
|
+
* Refund
|
13
|
+
* Added Level 3 Travel Data attributes support to Refund transaction request
|
14
|
+
|
15
|
+
0.2.1
|
16
|
+
-----
|
17
|
+
**Features**:
|
18
|
+
|
19
|
+
* Added Online Banking PayOut transaction request
|
20
|
+
* Added Funding Parameters support to Google Pay and Apple Pay transaction requests
|
21
|
+
* Added Bancontact transaction request support
|
22
|
+
* Added Cash transaction request support
|
23
|
+
* Added COF and UCOF parameters support to the following transaction requests:
|
24
|
+
* Authorize
|
25
|
+
* Authorize 3D
|
26
|
+
* Sale
|
27
|
+
* Sale 3D
|
28
|
+
* Added Tokenized e-commerce payment support
|
29
|
+
|
1
30
|
0.2.0
|
2
31
|
-----
|
3
32
|
**Features**:
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
genesis_ruby (0.2.
|
4
|
+
genesis_ruby (0.2.2)
|
5
5
|
net-http (~> 0.3.2)
|
6
6
|
nokogiri (~> 1.14)
|
7
7
|
|
@@ -41,13 +41,13 @@ GEM
|
|
41
41
|
json (2.7.2)
|
42
42
|
language_server-protocol (3.17.0.3)
|
43
43
|
mini_mime (1.1.5)
|
44
|
-
mini_portile2 (2.8.
|
44
|
+
mini_portile2 (2.8.8)
|
45
45
|
multi_xml (0.6.0)
|
46
46
|
mustermann (3.0.3)
|
47
47
|
ruby2_keywords (~> 0.0.1)
|
48
48
|
net-http (0.3.2)
|
49
49
|
uri
|
50
|
-
nokogiri (1.15.
|
50
|
+
nokogiri (1.15.7)
|
51
51
|
mini_portile2 (~> 2.8.2)
|
52
52
|
racc (~> 1.4)
|
53
53
|
octokit (7.2.0)
|
@@ -135,7 +135,7 @@ GEM
|
|
135
135
|
thor (1.3.2)
|
136
136
|
tilt (2.4.0)
|
137
137
|
unicode-display_width (2.6.0)
|
138
|
-
uri (1.0.
|
138
|
+
uri (1.0.3)
|
139
139
|
webmock (3.24.0)
|
140
140
|
addressable (>= 2.8.0)
|
141
141
|
crack (>= 0.3.2)
|
data/README.md
CHANGED
@@ -996,6 +996,7 @@ GenesisRuby::Api::Requests::Financial::Cards::Argencard
|
|
996
996
|
GenesisRuby::Api::Requests::Financial::Cards::Aura
|
997
997
|
GenesisRuby::Api::Requests::Financial::Cards::Authorize
|
998
998
|
GenesisRuby::Api::Requests::Financial::Cards::Authorize3d
|
999
|
+
GenesisRuby::Api::Requests::Financial::Cards::Bancontact
|
999
1000
|
GenesisRuby::Api::Requests::Financial::Cards::Cabal
|
1000
1001
|
GenesisRuby::Api::Requests::Financial::Cards::Cencosud
|
1001
1002
|
GenesisRuby::Api::Requests::Financial::Cards::Elo
|
@@ -1016,6 +1017,7 @@ GenesisRuby::Api::Requests::Financial::Wallets::PayPal
|
|
1016
1017
|
GenesisRuby::Api::Requests::Financial::CashPayments::Baloto
|
1017
1018
|
GenesisRuby::Api::Requests::Financial::CashPayments::BancoDeOccidente
|
1018
1019
|
GenesisRuby::Api::Requests::Financial::CashPayments::Boleto
|
1020
|
+
GenesisRuby::Api::Requests::Financial::CashPayments::Cash
|
1019
1021
|
GenesisRuby::Api::Requests::Financial::CashPayments::Efecty
|
1020
1022
|
GenesisRuby::Api::Requests::Financial::CashPayments::Oxxo
|
1021
1023
|
GenesisRuby::Api::Requests::Financial::CashPayments::PagoFacil
|
@@ -1039,6 +1041,8 @@ GenesisRuby::Api::Requests::Financial::OnlineBankingPayments::Santander
|
|
1039
1041
|
GenesisRuby::Api::Requests::Financial::OnlineBankingPayments::Webpay
|
1040
1042
|
# PayIn
|
1041
1043
|
GenesisRuby::Api::Requests::Financial::OnlineBankingPayments::OnlineBanking::PayIn
|
1044
|
+
# PayOut
|
1045
|
+
GenesisRuby::Api::Requests::Financial::OnlineBankingPayments::OnlineBanking::PayOut
|
1042
1046
|
|
1043
1047
|
# References
|
1044
1048
|
GenesisRuby::Api::Requests::Financial::Capture
|
@@ -1049,6 +1053,10 @@ GenesisRuby::Api::Requests::Financial::Refund
|
|
1049
1053
|
## Reconcile
|
1050
1054
|
GenesisRuby::Api::Requests::NonFinancial::Reconcile::Transaction
|
1051
1055
|
GenesisRuby::Api::Requests::NonFinancial::Reconcile::DateRange
|
1056
|
+
|
1057
|
+
## Installments
|
1058
|
+
GenesisRuby::Api::Requests::NonFinancial::Installments::Fetch
|
1059
|
+
|
1052
1060
|
```
|
1053
1061
|
|
1054
1062
|
### Manual initialization
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.2
|
@@ -24,6 +24,9 @@ module GenesisRuby
|
|
24
24
|
# Date Format ISO 8601
|
25
25
|
YYYY_MM_DD_ISO_8601 = '%Y-%m-%d'.freeze
|
26
26
|
|
27
|
+
# Date Format
|
28
|
+
MM_DD = '%m%d'.freeze
|
29
|
+
|
27
30
|
class << self
|
28
31
|
|
29
32
|
def all
|
@@ -33,6 +36,7 @@ module GenesisRuby
|
|
33
36
|
DD_MM_YYYY_L_SLASHES,
|
34
37
|
YYYY_MM_DD_H_I_S_ZULU,
|
35
38
|
YYYY_MM_DD_H_I_S,
|
39
|
+
MM_DD,
|
36
40
|
YYYY_MM_DD_ISO_8601 # Always keep it last!!!
|
37
41
|
]
|
38
42
|
end
|
data/lib/genesis_ruby/api/constants/transactions/parameters/cash_payments/cash_payment_types.rb
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
module GenesisRuby
|
2
|
+
module Api
|
3
|
+
module Constants
|
4
|
+
module Transactions
|
5
|
+
module Parameters
|
6
|
+
module CashPayments
|
7
|
+
# Cash Payment Types allowed values
|
8
|
+
class CashPaymentTypes
|
9
|
+
|
10
|
+
extend Mixins::Constants::Common
|
11
|
+
|
12
|
+
# 7 Eleven
|
13
|
+
SEVEN_ELEVEN = 'seven_eleven'.freeze
|
14
|
+
|
15
|
+
# Bancomer
|
16
|
+
BANCOMER = 'bancomer'.freeze
|
17
|
+
|
18
|
+
# Farmacias del Dr. Ahorro
|
19
|
+
PHARMACIES_DEL_DR_AHORRO = 'pharmacies_del_dr_ahorro'.freeze
|
20
|
+
|
21
|
+
# Farmacias Santa Maria
|
22
|
+
PHARMACIES_SANTA_MARIA = 'pharmacies_santa_maria'.freeze
|
23
|
+
|
24
|
+
# OXXO
|
25
|
+
OXXO = 'oxxo'.freeze
|
26
|
+
|
27
|
+
# Scotiabank
|
28
|
+
SCOTIABANK = 'scotiabank'.freeze
|
29
|
+
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
module GenesisRuby
|
2
|
+
module Api
|
3
|
+
module Constants
|
4
|
+
module Transactions
|
5
|
+
module Parameters
|
6
|
+
# Credential On Files allowed values
|
7
|
+
class CredentialOnFiles
|
8
|
+
|
9
|
+
extend Mixins::Constants::Common
|
10
|
+
|
11
|
+
# Initial transaction used to store payment credentials for future customer initiated payments while
|
12
|
+
# processing. Required for external tokenization, and optional for gateway-based tokenization
|
13
|
+
INITIAL_CUSTOMER_INITIATED = 'initial_customer_initiated'.freeze
|
14
|
+
|
15
|
+
# Subsequent customer initiated transaction using previously stored payment credentials.
|
16
|
+
# Required for external tokenization, and optional for gateway-based tokenization
|
17
|
+
SUBSEQUENT_CUSTOMER_INITIATED = 'subsequent_customer_initiated'.freeze
|
18
|
+
|
19
|
+
# For UCOF transaction, the scheme transaction identifier of the initial transaction must be sent in
|
20
|
+
# the transaction request. For MasterCard or Maestro UCOF, the scheme settlement date in MMDD format
|
21
|
+
# (e.g. 0107) of the initial transaction must be sent in the transaction request.
|
22
|
+
MERCHANT_UNSCHEDULED = 'merchant_unscheduled'.freeze
|
23
|
+
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
data/lib/genesis_ruby/api/constants/transactions/parameters/online_banking/bank_account_types.rb
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
module GenesisRuby
|
2
|
+
module Api
|
3
|
+
module Constants
|
4
|
+
module Transactions
|
5
|
+
module Parameters
|
6
|
+
module OnlineBanking
|
7
|
+
# Bank Payout Account Types allowed values
|
8
|
+
class BankAccountTypes
|
9
|
+
|
10
|
+
extend Mixins::Constants::Common
|
11
|
+
|
12
|
+
# Checking accounts
|
13
|
+
CHECKING = 'C'.freeze
|
14
|
+
|
15
|
+
# Savings accounts
|
16
|
+
SAVINGS = 'S'.freeze
|
17
|
+
|
18
|
+
# Maestra accounts(Only Peru)
|
19
|
+
MAESTRA = 'M'.freeze
|
20
|
+
|
21
|
+
# Payment accounts
|
22
|
+
PAYMENT = 'P'.freeze
|
23
|
+
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
data/lib/genesis_ruby/api/constants/transactions/parameters/online_banking/payout_payment_types.rb
ADDED
@@ -0,0 +1,42 @@
|
|
1
|
+
module GenesisRuby
|
2
|
+
module Api
|
3
|
+
module Constants
|
4
|
+
module Transactions
|
5
|
+
module Parameters
|
6
|
+
module OnlineBanking
|
7
|
+
# Bank Payout Payment Types allowed values
|
8
|
+
class PayoutPaymentTypes
|
9
|
+
|
10
|
+
extend Api::Mixins::Constants::Common
|
11
|
+
|
12
|
+
# Bank to Bank
|
13
|
+
BANK_TO_BANK = 'bank_to_bank'.freeze
|
14
|
+
|
15
|
+
# PIX
|
16
|
+
PIX = 'pix'.freeze
|
17
|
+
|
18
|
+
# BSB
|
19
|
+
BSB = 'bsb'.freeze
|
20
|
+
|
21
|
+
# Pay ID
|
22
|
+
PAY_ID = 'pay_id'.freeze
|
23
|
+
|
24
|
+
# Bank to Bank, Business to Business
|
25
|
+
BANK_TO_BANK_B2B = 'bank_to_bank_b2b'.freeze
|
26
|
+
|
27
|
+
# PIX Business to Business
|
28
|
+
PIX_B2B = 'pix_b2b'.freeze
|
29
|
+
|
30
|
+
# Clabe
|
31
|
+
CLABE = 'clabe'.freeze
|
32
|
+
|
33
|
+
# Cellphone
|
34
|
+
CELLPHONE = 'cellphone'.freeze
|
35
|
+
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
data/lib/genesis_ruby/api/constants/transactions/parameters/refund/credit_reason_indicators.rb
ADDED
@@ -0,0 +1,30 @@
|
|
1
|
+
module GenesisRuby
|
2
|
+
module Api
|
3
|
+
module Constants
|
4
|
+
module Transactions
|
5
|
+
module Parameters
|
6
|
+
module Refund
|
7
|
+
# Credit Reason Indicator allowed values
|
8
|
+
class CreditReasonIndicators
|
9
|
+
|
10
|
+
extend Api::Mixins::Constants::Common
|
11
|
+
|
12
|
+
# Passenger Transport Ancillary Cancellation
|
13
|
+
INDICATOR_A = 'A'.freeze
|
14
|
+
|
15
|
+
# Travel Ticket and Passenger Transport
|
16
|
+
INDICATOR_B = 'B'.freeze
|
17
|
+
|
18
|
+
# Partial Refund of Travel Ticket
|
19
|
+
INDICATOR_P = 'P'.freeze
|
20
|
+
|
21
|
+
# Other
|
22
|
+
INDICATOR_O = 'O'.freeze
|
23
|
+
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
data/lib/genesis_ruby/api/constants/transactions/parameters/refund/ticket_change_indicators.rb
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
module GenesisRuby
|
2
|
+
module Api
|
3
|
+
module Constants
|
4
|
+
module Transactions
|
5
|
+
module Parameters
|
6
|
+
module Refund
|
7
|
+
# Ticket Change Indicator allowed values
|
8
|
+
class TicketChangeIndicators
|
9
|
+
|
10
|
+
extend Api::Mixins::Constants::Common
|
11
|
+
|
12
|
+
# Change to existing Ticket
|
13
|
+
INDICATOR_C = 'C'.freeze
|
14
|
+
|
15
|
+
# New ticket
|
16
|
+
INDICATOR_N = 'N'.freeze
|
17
|
+
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -79,6 +79,10 @@ module GenesisRuby
|
|
79
79
|
# Capture settles a transaction which has been authorized before.
|
80
80
|
CAPTURE = 'capture'.freeze
|
81
81
|
|
82
|
+
# Cash payment methods allow customers to pay bills and online purchases in cash at convenient
|
83
|
+
# physical locations such as stores, banks, ATMs, even pharmacies in some countries.
|
84
|
+
CASH = 'cash'.freeze
|
85
|
+
|
82
86
|
# Voucher-based payment
|
83
87
|
CASHU = 'cashu'.freeze
|
84
88
|
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'genesis_ruby/api/constants/transactions/parameters/credential_on_files'
|
2
|
+
|
3
|
+
module GenesisRuby
|
4
|
+
module Api
|
5
|
+
module Mixins
|
6
|
+
module Requests
|
7
|
+
module Financial
|
8
|
+
module Cards
|
9
|
+
# Credential On File shared attributes mixin
|
10
|
+
module CredentialOnFileAttributes
|
11
|
+
|
12
|
+
attr_accessor :credential_on_file
|
13
|
+
|
14
|
+
protected
|
15
|
+
|
16
|
+
# Credential on file allowed field values validations
|
17
|
+
def credential_on_file_field_validations
|
18
|
+
{
|
19
|
+
credential_on_file: Api::Constants::Transactions::Parameters::CredentialOnFiles.all
|
20
|
+
}
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
module GenesisRuby
|
2
|
+
module Api
|
3
|
+
module Mixins
|
4
|
+
module Requests
|
5
|
+
module Financial
|
6
|
+
module Cards
|
7
|
+
# Installment shared attributes mixin
|
8
|
+
module InstallmentAttributes
|
9
|
+
|
10
|
+
attr_accessor :installment_plan_id, :installment_plan_reference
|
11
|
+
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -55,6 +55,16 @@ module GenesisRuby
|
|
55
55
|
}
|
56
56
|
end
|
57
57
|
|
58
|
+
# Field value dependencies for MPI parameters
|
59
|
+
def mpi_attributes_field_dependencies
|
60
|
+
{
|
61
|
+
mpi_protocol_version: Hash[
|
62
|
+
Api::Constants::Transactions::Parameters::MpiProtocolVersions::PROTOCOL_VERSION_2,
|
63
|
+
%w(mpi_directory_server_id)
|
64
|
+
]
|
65
|
+
}
|
66
|
+
end
|
67
|
+
|
58
68
|
end
|
59
69
|
end
|
60
70
|
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
module GenesisRuby
|
2
|
+
module Api
|
3
|
+
module Mixins
|
4
|
+
module Requests
|
5
|
+
module Financial
|
6
|
+
module Cards
|
7
|
+
# UCOF shared attributes mixin
|
8
|
+
module UcofAttributes
|
9
|
+
|
10
|
+
attr_reader :credential_on_file_transaction_identifier
|
11
|
+
|
12
|
+
# UCOF Transaction Identifier
|
13
|
+
def credential_on_file_transaction_identifier=(value)
|
14
|
+
limited_string attribute: __method__, value: value.to_s, min: 15, max: 32
|
15
|
+
end
|
16
|
+
|
17
|
+
# UCOF Settlement Date
|
18
|
+
def credential_on_file_settlement_date
|
19
|
+
@credential_on_file_settlement_date&.strftime Api::Constants::DateTimeFormats::MM_DD
|
20
|
+
end
|
21
|
+
|
22
|
+
# UCOF Settlement Date
|
23
|
+
def credential_on_file_settlement_date=(value)
|
24
|
+
parse_date attribute: __method__, value: value, allow_empty: true
|
25
|
+
end
|
26
|
+
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
module GenesisRuby
|
2
|
+
module Api
|
3
|
+
module Mixins
|
4
|
+
module Requests
|
5
|
+
module Financial
|
6
|
+
module OnlineBankingPayments
|
7
|
+
# PIX shared attributes
|
8
|
+
module PixAttributes
|
9
|
+
|
10
|
+
attr_accessor :company_type, :company_activity, :mothers_name
|
11
|
+
|
12
|
+
# Incorporation Date Accessor
|
13
|
+
def incorporation_date
|
14
|
+
@incorporation_date&.strftime GenesisRuby::Api::Constants::DateTimeFormats::YYYY_MM_DD_ISO_8601
|
15
|
+
end
|
16
|
+
|
17
|
+
# Incorporation Date Accessor
|
18
|
+
def incorporation_date=(value)
|
19
|
+
parse_date attribute: __method__, value: value, allow_empty: true
|
20
|
+
end
|
21
|
+
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -7,7 +7,7 @@ require 'genesis_ruby/utils/money_format'
|
|
7
7
|
module GenesisRuby
|
8
8
|
module Api
|
9
9
|
# Base Request Class
|
10
|
-
class Request
|
10
|
+
class Request # rubocop:disable Metrics/ClassLength
|
11
11
|
|
12
12
|
include Mixins::Requests::RestrictedSetter
|
13
13
|
include Mixins::Requests::AttributeValidation
|
@@ -70,6 +70,11 @@ module GenesisRuby
|
|
70
70
|
@api_config.load_form_config
|
71
71
|
end
|
72
72
|
|
73
|
+
# Pre-defined GET Request Configuration
|
74
|
+
def init_get_configuration
|
75
|
+
@api_config.load_get_config
|
76
|
+
end
|
77
|
+
|
73
78
|
# Initializes Api EndPoint Url with request path & terminal token
|
74
79
|
def init_api_gateway_configuration(options = { request_path: 'process', include_token: true })
|
75
80
|
request_path = options.fetch :request_path, 'process'
|
@@ -7,23 +7,46 @@ module GenesisRuby
|
|
7
7
|
class CreditCard < GenesisRuby::Api::Requests::Base::Financial
|
8
8
|
|
9
9
|
include Mixins::Requests::Financial::Cards::AccountOwnerAttributes
|
10
|
+
include Mixins::Requests::Financial::Cards::CredentialOnFileAttributes
|
10
11
|
include Mixins::Requests::Financial::Cards::CreditCardAttributes
|
11
12
|
include Mixins::Requests::Financial::Cards::TokenizationAttributes
|
13
|
+
include Mixins::Requests::Financial::Cards::UcofAttributes
|
12
14
|
include Mixins::Requests::Financial::PaymentAttributes
|
13
15
|
|
16
|
+
attr_reader :scheme_tokenized
|
17
|
+
|
18
|
+
# Visa tokenization for Visa
|
19
|
+
# Digital Secure Remote Payments (DSRP) for Mastercard.
|
20
|
+
def scheme_tokenized=(value)
|
21
|
+
allowed_options attribute: __method__,
|
22
|
+
allowed: [true, false],
|
23
|
+
value: value,
|
24
|
+
allow_empty: true,
|
25
|
+
error_message: 'Accepts only boolean values'
|
26
|
+
end
|
27
|
+
|
14
28
|
protected
|
15
29
|
|
16
30
|
# Request Field validations
|
17
31
|
def init_field_validations
|
18
32
|
required_fields.push *%i[transaction_id amount currency]
|
19
|
-
field_values.merge!
|
33
|
+
field_values.merge!(
|
34
|
+
{ currency: Api::Constants::Currencies::Iso4217.all.map(&:upcase) },
|
35
|
+
credential_on_file_field_validations
|
36
|
+
)
|
20
37
|
end
|
21
38
|
|
22
39
|
# Credit Card attributes
|
23
40
|
def payment_transaction_structure
|
24
41
|
payment_attributes_structure.merge(
|
25
42
|
credit_card_attributes_structure, tokenization_attributes_structure,
|
26
|
-
{
|
43
|
+
{
|
44
|
+
account_owner: account_owner_attributes_structure,
|
45
|
+
credential_on_file: credential_on_file,
|
46
|
+
credential_on_file_transaction_identifier: credential_on_file_transaction_identifier,
|
47
|
+
credential_on_file_settlement_date: credential_on_file_settlement_date,
|
48
|
+
scheme_tokenized: scheme_tokenized
|
49
|
+
}
|
27
50
|
)
|
28
51
|
end
|
29
52
|
|
@@ -0,0 +1,88 @@
|
|
1
|
+
module GenesisRuby
|
2
|
+
module Api
|
3
|
+
module Requests
|
4
|
+
module Base
|
5
|
+
# Base Versioned Request class used for Non Financial JSON API services
|
6
|
+
class Versioned < Request
|
7
|
+
|
8
|
+
DEFAULT_VERSION = 'v1'.freeze
|
9
|
+
private_constant :DEFAULT_VERSION
|
10
|
+
|
11
|
+
attr_reader :version, :allowed_versions
|
12
|
+
|
13
|
+
# Base Versioned Request constructor
|
14
|
+
def initialize(configuration, builder_interface = Builder::JSON)
|
15
|
+
super configuration, builder_interface
|
16
|
+
|
17
|
+
self.allowed_versions = [DEFAULT_VERSION]
|
18
|
+
self.version = DEFAULT_VERSION
|
19
|
+
self.request_path = ''
|
20
|
+
end
|
21
|
+
|
22
|
+
# Defines the version for the request
|
23
|
+
def version=(value)
|
24
|
+
allowed_options(
|
25
|
+
attribute: __method__,
|
26
|
+
value: value,
|
27
|
+
allowed: allowed_versions,
|
28
|
+
allow_empty: false,
|
29
|
+
error_message: 'Invalid API version! '
|
30
|
+
)
|
31
|
+
|
32
|
+
init_configuration
|
33
|
+
end
|
34
|
+
|
35
|
+
protected
|
36
|
+
|
37
|
+
attr_reader :request_path
|
38
|
+
|
39
|
+
# Every Specific request defines available versions
|
40
|
+
def allowed_versions=(value)
|
41
|
+
raise InvalidArgumentError, 'Allowed versions accepts only Array values' unless value.is_a? Array
|
42
|
+
|
43
|
+
@allowed_versions = value
|
44
|
+
end
|
45
|
+
|
46
|
+
# Defines the endpoint of the request
|
47
|
+
def request_path=(value)
|
48
|
+
@request_path = value.to_s
|
49
|
+
|
50
|
+
init_configuration
|
51
|
+
|
52
|
+
@request_path
|
53
|
+
rescue BuilderError
|
54
|
+
@request_path = ''
|
55
|
+
|
56
|
+
raise InvalidArgumentError, 'The Request can not be configured!'
|
57
|
+
end
|
58
|
+
|
59
|
+
# Initialize Request configuration
|
60
|
+
def init_configuration
|
61
|
+
super
|
62
|
+
|
63
|
+
case @builder_interface
|
64
|
+
when Builder::XML then init_xml_configuration
|
65
|
+
when Builder::JSON then init_json_configuration
|
66
|
+
else raise BuilderError, "Invalid Builder Interface specified for #{self.class.name}"
|
67
|
+
end
|
68
|
+
|
69
|
+
init_api_gateway_configuration request_path: "#{version}/#{request_path}", include_token: false
|
70
|
+
end
|
71
|
+
|
72
|
+
# Request structure. Overridden for common structure parameters
|
73
|
+
def populate_structure
|
74
|
+
super
|
75
|
+
|
76
|
+
@tree_structure = request_structure
|
77
|
+
end
|
78
|
+
|
79
|
+
# Request structure
|
80
|
+
def request_structure
|
81
|
+
raise NoMethodError, 'Request structure must be defined!'
|
82
|
+
end
|
83
|
+
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|
@@ -6,6 +6,7 @@ module GenesisRuby
|
|
6
6
|
class Capture < Requests::Base::Reference
|
7
7
|
|
8
8
|
include Mixins::Requests::Financial::Business::BusinessAttributes
|
9
|
+
include Mixins::Requests::Financial::Cards::InstallmentAttributes
|
9
10
|
include Mixins::Requests::Financial::TravelData::TravelAttributes
|
10
11
|
|
11
12
|
protected
|
@@ -18,9 +19,11 @@ module GenesisRuby
|
|
18
19
|
# Capture Transaction Request Structure
|
19
20
|
def reference_transaction_structure
|
20
21
|
{
|
21
|
-
reference_id:
|
22
|
-
business_attributes:
|
23
|
-
travel:
|
22
|
+
reference_id: reference_id,
|
23
|
+
business_attributes: business_attributes_structure,
|
24
|
+
travel: travel_data_attributes_structure,
|
25
|
+
installment_plan_id: installment_plan_id,
|
26
|
+
installment_plan_reference: installment_plan_reference
|
24
27
|
}
|
25
28
|
end
|
26
29
|
|