getnet_api 1.0.2 → 1.1.0
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 +5 -5
- data/.github/workflows/ruby.yml +40 -0
- data/.gitignore +2 -0
- data/.rspec +1 -0
- data/Gemfile +11 -1
- data/Gemfile.lock +63 -10
- data/README.md +31 -6
- data/lib/getnet_api/base.rb +14 -18
- data/lib/getnet_api/boleto.rb +0 -1
- data/lib/getnet_api/configure.rb +1 -1
- data/lib/getnet_api/customer.rb +5 -5
- data/lib/getnet_api/payment.rb +23 -29
- data/lib/getnet_api/payment_cancel.rb +1 -1
- data/lib/getnet_api/pix.rb +35 -0
- data/lib/getnet_api/version.rb +2 -2
- data/lib/getnet_api.rb +5 -5
- data/spec/lib/getnet_api/address_spec.rb +77 -0
- data/spec/lib/getnet_api/base_spec.rb +63 -0
- data/spec/lib/getnet_api/boleto_spec.rb +49 -0
- data/spec/lib/getnet_api/card_spec.rb +69 -0
- data/spec/lib/getnet_api/card_token_spec.rb +15 -0
- data/spec/lib/getnet_api/card_verification_spec.rb +30 -0
- data/spec/lib/getnet_api/configure_spec.rb +70 -0
- data/spec/lib/getnet_api/credit_spec.rb +68 -0
- data/spec/lib/getnet_api/customer_spec.rb +130 -0
- data/spec/lib/getnet_api/order_spec.rb +30 -0
- data/spec/lib/getnet_api/payment_cancel_spec.rb +121 -0
- data/spec/lib/getnet_api/payment_spec.rb +163 -0
- data/spec/spec_helper.rb +121 -0
- data/spec/vcr_cassettes/GetnetApi_Base/_build_request/builds_and_executes_request_based_on.yml +113 -0
- data/spec/vcr_cassettes/GetnetApi_CardVerification/_verify/performs_the_request_and_returns_the_verification_result.yml +110 -0
- data/spec/vcr_cassettes/GetnetApi_Customer/_create/performs_the_request.yml +64 -0
- data/spec/vcr_cassettes/GetnetApi_Customer/_create/performs_the_request_and_returns_the_number_token.yml +112 -0
- data/spec/vcr_cassettes/GetnetApi_Payment/_create/test/correctly_requests_for_cancelling.yml +67 -0
- data/spec/vcr_cassettes/GetnetApi_Payment/_create/when_cancelling_a_payment/correctly_execute_the_request.yml +118 -0
- data/spec/vcr_cassettes/GetnetApi_Payment/_create/when_paying_by_boleto/correctly_requests_for_boleto_payment.yml +60 -0
- data/spec/vcr_cassettes/GetnetApi_Payment/_create/when_paying_by_credit/correctly_requests_for_credit_payment.yml +63 -0
- data/spec/vcr_cassettes/getnet_api/base/valid_bearer.yml +58 -0
- data/spec/vcr_cassettes/getnet_api/cardtoken/get.yml +55 -0
- data/spec/vcr_cassettes/getnet_api/payment_cancel/create.yml +62 -0
- metadata +58 -8
@@ -0,0 +1,163 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
describe GetnetApi::Payment do
|
4
|
+
let(:boleto) do
|
5
|
+
GetnetApi::Boleto.new(
|
6
|
+
our_number: '123321123',
|
7
|
+
document_number: '12345678',
|
8
|
+
instructions: 'Não receber após o vencimento',
|
9
|
+
provider: 'santander'
|
10
|
+
)
|
11
|
+
end
|
12
|
+
|
13
|
+
let(:card_token) do
|
14
|
+
token = ''
|
15
|
+
VCR.use_cassette('getnet_api/cardtoken/get') do
|
16
|
+
card_number = '5155901222280001' # see https://developers.getnet.com.br/api#section/Cartoes-para-Teste
|
17
|
+
token = GetnetApi::CardToken.get(card_number)['number_token']
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
let(:card) do
|
22
|
+
GetnetApi::Card.new(
|
23
|
+
number_token: card_token,
|
24
|
+
cardholder_name: 'JOAO DA SILVA',
|
25
|
+
security_code: '123',
|
26
|
+
brand: 'Mastercard',
|
27
|
+
expiration_month: '12',
|
28
|
+
expiration_year: '23'
|
29
|
+
)
|
30
|
+
end
|
31
|
+
|
32
|
+
let(:credit) do
|
33
|
+
GetnetApi::Credit.new(
|
34
|
+
delayed: false,
|
35
|
+
authenticated: false,
|
36
|
+
pre_authorization: false,
|
37
|
+
save_card_data: false,
|
38
|
+
transaction_type: 'FULL',
|
39
|
+
number_installments: 1,
|
40
|
+
soft_descriptor: 'Descrição para fatura',
|
41
|
+
dynamic_mcc: 1799,
|
42
|
+
card: card
|
43
|
+
)
|
44
|
+
end
|
45
|
+
|
46
|
+
let(:address) do
|
47
|
+
GetnetApi::Address.new(
|
48
|
+
street: 'Nome da Rua',
|
49
|
+
number: '123',
|
50
|
+
complement: 'Complemento',
|
51
|
+
district: 'Nome do Bairro',
|
52
|
+
city: 'São Paulo',
|
53
|
+
state: 'SP',
|
54
|
+
country: 'Brasil',
|
55
|
+
postal_code: '01010010'
|
56
|
+
)
|
57
|
+
end
|
58
|
+
|
59
|
+
let(:customer) do
|
60
|
+
GetnetApi::Customer.new(
|
61
|
+
customer_id: '123',
|
62
|
+
first_name: 'João',
|
63
|
+
last_name: 'da Silva',
|
64
|
+
name: 'João da Silva',
|
65
|
+
email: 'joao@email.com',
|
66
|
+
document_type: :pessoa_fisica,
|
67
|
+
document_number: '12332112340',
|
68
|
+
address: address,
|
69
|
+
phone_number: '5551999887766',
|
70
|
+
celphone_number: '5551999887766',
|
71
|
+
observation: 'O cliente tem interesse no plano x.'
|
72
|
+
)
|
73
|
+
end
|
74
|
+
|
75
|
+
let(:order) do
|
76
|
+
GetnetApi::Order.new(
|
77
|
+
order_id: '123',
|
78
|
+
sales_tax: 0,
|
79
|
+
product_type: 'service'
|
80
|
+
)
|
81
|
+
end
|
82
|
+
|
83
|
+
let(:payment) do
|
84
|
+
GetnetApi::Payment.new(
|
85
|
+
amount: 10_000,
|
86
|
+
currency: 'BRL',
|
87
|
+
order: order,
|
88
|
+
customer: customer
|
89
|
+
)
|
90
|
+
end
|
91
|
+
|
92
|
+
it 'is valid with valid attributes' do
|
93
|
+
expect(payment).to be_valid
|
94
|
+
end
|
95
|
+
|
96
|
+
it 'is not valid with currency length > 3' do
|
97
|
+
payment.currency = 'ABCD'
|
98
|
+
expect(payment).not_to be_valid
|
99
|
+
expect(payment.errors.messages[:currency]).to be_present
|
100
|
+
end
|
101
|
+
|
102
|
+
it 'is not valid with order not being the correct object' do
|
103
|
+
payment.order = Object.new
|
104
|
+
expect(payment).not_to be_valid
|
105
|
+
expect(payment.errors.messages[:order]).to be_present
|
106
|
+
end
|
107
|
+
|
108
|
+
it 'is not valid with invalid order' do
|
109
|
+
payment.order.order_id = '1' * 37
|
110
|
+
expect(payment).not_to be_valid
|
111
|
+
expect(payment.errors.messages[:order]).to be_present
|
112
|
+
end
|
113
|
+
|
114
|
+
it 'is not valid with customer not being the correct object' do
|
115
|
+
payment.customer = Object.new
|
116
|
+
expect(payment).not_to be_valid
|
117
|
+
expect(payment.errors.messages[:customer]).to be_present
|
118
|
+
end
|
119
|
+
|
120
|
+
it 'is not valid with invalid customer' do
|
121
|
+
payment.customer.customer_id = '1' * 101
|
122
|
+
expect(payment).not_to be_valid
|
123
|
+
expect(payment.errors.messages[:customer]).to be_present
|
124
|
+
end
|
125
|
+
|
126
|
+
context '#to_request' do
|
127
|
+
it 'returns payment object as a hash' do
|
128
|
+
payment_hash = payment.to_request(credit, :credit)
|
129
|
+
hash_keys = payment_hash.keys.reject do |key|
|
130
|
+
%i[order customer credit seller_id].include?(key)
|
131
|
+
end
|
132
|
+
|
133
|
+
hash_keys.each do |key|
|
134
|
+
expect(payment_hash[key]).to eq payment.send(key)
|
135
|
+
end
|
136
|
+
|
137
|
+
expect(payment_hash[:order]).to eq payment.order.to_request
|
138
|
+
expect(payment_hash[:customer]).to eq payment.customer.to_request(:payment)
|
139
|
+
expect(payment_hash[:credit]).to eq credit.to_request
|
140
|
+
expect(payment_hash[:seller_id]).to eq GetnetApi.seller_id.to_s
|
141
|
+
end
|
142
|
+
end
|
143
|
+
|
144
|
+
context '.create' do
|
145
|
+
context 'when paying by boleto', :vcr do
|
146
|
+
it 'correctly requests for boleto payment' do
|
147
|
+
response = GetnetApi::Payment.create payment, boleto, :boleto
|
148
|
+
expected_uri = 'https://api-sandbox.getnet.com.br/v1/payments/boleto'
|
149
|
+
expect(WebMock).to have_requested(:post, expected_uri)
|
150
|
+
expect(response).to have_key('boleto')
|
151
|
+
end
|
152
|
+
end
|
153
|
+
|
154
|
+
context 'when paying by credit', :vcr do
|
155
|
+
it 'correctly requests for credit payment' do
|
156
|
+
response = GetnetApi::Payment.create payment, credit, :credit
|
157
|
+
expected_uri = 'https://api-sandbox.getnet.com.br/v1/payments/credit'
|
158
|
+
expect(WebMock).to have_requested(:post, expected_uri)
|
159
|
+
expect(response).to have_key('credit')
|
160
|
+
end
|
161
|
+
end
|
162
|
+
end
|
163
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,121 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'getnet_api'
|
3
|
+
require 'pry'
|
4
|
+
require 'vcr'
|
5
|
+
require 'webmock/rspec'
|
6
|
+
|
7
|
+
# This file was generated by the `rspec --init` command. Conventionally, all
|
8
|
+
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
|
9
|
+
# The generated `.rspec` file contains `--require spec_helper` which will cause
|
10
|
+
# this file to always be loaded, without a need to explicitly require it in any
|
11
|
+
# files.
|
12
|
+
#
|
13
|
+
# Given that it is always loaded, you are encouraged to keep this file as
|
14
|
+
# light-weight as possible. Requiring heavyweight dependencies from this file
|
15
|
+
# will add to the boot time of your test suite on EVERY test run, even for an
|
16
|
+
# individual file that may not need all of that loaded. Instead, consider making
|
17
|
+
# a separate helper file that requires the additional dependencies and performs
|
18
|
+
# the additional setup, and require it from the spec files that actually need
|
19
|
+
# it.
|
20
|
+
#
|
21
|
+
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
22
|
+
|
23
|
+
GetnetApi.configure do |config|
|
24
|
+
config.ambiente = :sandbox
|
25
|
+
config.seller_id = '67be6e90-00c1-410d-83f5-6d75621effc8'
|
26
|
+
config.client_id = '74438877-f00b-4502-8454-de3d7166dc2a'
|
27
|
+
config.client_secret = '4eac6920-1b57-4cd1-8799-d877173bfa37'
|
28
|
+
end
|
29
|
+
|
30
|
+
VCR.configure do |c|
|
31
|
+
c.cassette_library_dir = 'spec/vcr_cassettes'
|
32
|
+
c.hook_into :webmock
|
33
|
+
c.allow_http_connections_when_no_cassette = false
|
34
|
+
c.configure_rspec_metadata!
|
35
|
+
end
|
36
|
+
|
37
|
+
RSpec.configure do |config|
|
38
|
+
# rspec-expectations config goes here. You can use an alternate
|
39
|
+
# assertion/expectation library such as wrong or the stdlib/minitest
|
40
|
+
# assertions if you prefer.
|
41
|
+
config.expect_with :rspec do |expectations|
|
42
|
+
# This option will default to `true` in RSpec 4. It makes the `description`
|
43
|
+
# and `failure_message` of custom matchers include text for helper methods
|
44
|
+
# defined using `chain`, e.g.:
|
45
|
+
# be_bigger_than(2).and_smaller_than(4).description
|
46
|
+
# # => "be bigger than 2 and smaller than 4"
|
47
|
+
# ...rather than:
|
48
|
+
# # => "be bigger than 2"
|
49
|
+
expectations.include_chain_clauses_in_custom_matcher_descriptions = true
|
50
|
+
end
|
51
|
+
|
52
|
+
# rspec-mocks config goes here. You can use an alternate test double
|
53
|
+
# library (such as bogus or mocha) by changing the `mock_with` option here.
|
54
|
+
config.mock_with :rspec do |mocks|
|
55
|
+
# Prevents you from mocking or stubbing a method that does not exist on
|
56
|
+
# a real object. This is generally recommended, and will default to
|
57
|
+
# `true` in RSpec 4.
|
58
|
+
mocks.verify_partial_doubles = true
|
59
|
+
end
|
60
|
+
|
61
|
+
# This option will default to `:apply_to_host_groups` in RSpec 4 (and will
|
62
|
+
# have no way to turn it off -- the option exists only for backwards
|
63
|
+
# compatibility in RSpec 3). It causes shared context metadata to be
|
64
|
+
# inherited by the metadata hash of host groups and examples, rather than
|
65
|
+
# triggering implicit auto-inclusion in groups with matching metadata.
|
66
|
+
config.shared_context_metadata_behavior = :apply_to_host_groups
|
67
|
+
|
68
|
+
# The settings below are suggested to provide a good initial experience
|
69
|
+
# with RSpec, but feel free to customize to your heart's content.
|
70
|
+
=begin
|
71
|
+
# This allows you to limit a spec run to individual examples or groups
|
72
|
+
# you care about by tagging them with `:focus` metadata. When nothing
|
73
|
+
# is tagged with `:focus`, all examples get run. RSpec also provides
|
74
|
+
# aliases for `it`, `describe`, and `context` that include `:focus`
|
75
|
+
# metadata: `fit`, `fdescribe` and `fcontext`, respectively.
|
76
|
+
config.filter_run_when_matching :focus
|
77
|
+
|
78
|
+
# Allows RSpec to persist some state between runs in order to support
|
79
|
+
# the `--only-failures` and `--next-failure` CLI options. We recommend
|
80
|
+
# you configure your source control system to ignore this file.
|
81
|
+
config.example_status_persistence_file_path = "spec/examples.txt"
|
82
|
+
|
83
|
+
# Limits the available syntax to the non-monkey patched syntax that is
|
84
|
+
# recommended. For more details, see:
|
85
|
+
# - http://rspec.info/blog/2012/06/rspecs-new-expectation-syntax/
|
86
|
+
# - http://www.teaisaweso.me/blog/2013/05/27/rspecs-new-message-expectation-syntax/
|
87
|
+
# - http://rspec.info/blog/2014/05/notable-changes-in-rspec-3/#zero-monkey-patching-mode
|
88
|
+
config.disable_monkey_patching!
|
89
|
+
|
90
|
+
# This setting enables warnings. It's recommended, but in some cases may
|
91
|
+
# be too noisy due to issues in dependencies.
|
92
|
+
config.warnings = true
|
93
|
+
|
94
|
+
# Many RSpec users commonly either run the entire suite or an individual
|
95
|
+
# file, and it's useful to allow more verbose output when running an
|
96
|
+
# individual spec file.
|
97
|
+
if config.files_to_run.one?
|
98
|
+
# Use the documentation formatter for detailed output,
|
99
|
+
# unless a formatter has already been configured
|
100
|
+
# (e.g. via a command-line flag).
|
101
|
+
config.default_formatter = "doc"
|
102
|
+
end
|
103
|
+
|
104
|
+
# Print the 10 slowest examples and example groups at the
|
105
|
+
# end of the spec run, to help surface which specs are running
|
106
|
+
# particularly slow.
|
107
|
+
config.profile_examples = 10
|
108
|
+
|
109
|
+
# Run specs in random order to surface order dependencies. If you find an
|
110
|
+
# order dependency and want to debug it, you can fix the order by providing
|
111
|
+
# the seed, which is printed after each run.
|
112
|
+
# --seed 1234
|
113
|
+
config.order = :random
|
114
|
+
|
115
|
+
# Seed global randomization in this process using the `--seed` CLI option.
|
116
|
+
# Setting this allows you to use `--seed` to deterministically reproduce
|
117
|
+
# test failures related to randomization by passing the same `--seed` value
|
118
|
+
# as the one that triggered the failure.
|
119
|
+
Kernel.srand config.seed
|
120
|
+
=end
|
121
|
+
end
|
data/spec/vcr_cassettes/GetnetApi_Base/_build_request/builds_and_executes_request_based_on.yml
ADDED
@@ -0,0 +1,113 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: https://api-sandbox.getnet.com.br/auth/oauth/v2/token
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: grant_type=client_credentials&scope=oob
|
9
|
+
headers:
|
10
|
+
Accept-Encoding:
|
11
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
12
|
+
Accept:
|
13
|
+
- "*/*"
|
14
|
+
User-Agent:
|
15
|
+
- Ruby
|
16
|
+
Host:
|
17
|
+
- api-sandbox.getnet.com.br
|
18
|
+
Authorization:
|
19
|
+
- Basic NzQ0Mzg4NzctZjAwYi00NTAyLTg0NTQtZGUzZDcxNjZkYzJhOjRlYWM2OTIwLTFiNTctNGNkMS04Nzk5LWQ4NzcxNzNiZmEzNw==
|
20
|
+
Content-Type:
|
21
|
+
- application/x-www-form-urlencoded
|
22
|
+
response:
|
23
|
+
status:
|
24
|
+
code: 200
|
25
|
+
message: OK
|
26
|
+
headers:
|
27
|
+
Server:
|
28
|
+
- Apache-Coyote/1.1
|
29
|
+
Pragma:
|
30
|
+
- no-cache
|
31
|
+
Cache-Control:
|
32
|
+
- no-store
|
33
|
+
Strict-Transport-Security:
|
34
|
+
- max-age=15552000; includeSubDomains
|
35
|
+
Preload:
|
36
|
+
- ''
|
37
|
+
Content-Type:
|
38
|
+
- application/json;charset=UTF-8
|
39
|
+
X-Edgeconnect-Midmile-Rtt:
|
40
|
+
- '8'
|
41
|
+
X-Edgeconnect-Origin-Mex-Latency:
|
42
|
+
- '43'
|
43
|
+
X-Powered-By:
|
44
|
+
- '62207'
|
45
|
+
Vary:
|
46
|
+
- Accept-Encoding
|
47
|
+
Date:
|
48
|
+
- Wed, 14 Apr 2021 14:08:33 GMT
|
49
|
+
Content-Length:
|
50
|
+
- '127'
|
51
|
+
Connection:
|
52
|
+
- keep-alive
|
53
|
+
body:
|
54
|
+
encoding: UTF-8
|
55
|
+
string: "{\r\n \"access_token\":\"43bfa02b-8577-485e-83ca-b2f6383afb01\",\r\n
|
56
|
+
\ \"token_type\":\"Bearer\",\r\n \"expires_in\":3600,\r\n \"scope\":\"oob\"\r\n}"
|
57
|
+
recorded_at: Wed, 14 Apr 2021 14:08:33 GMT
|
58
|
+
- request:
|
59
|
+
method: get
|
60
|
+
uri: https://api-sandbox.getnet.com.br/v1/some_endpoint
|
61
|
+
body:
|
62
|
+
encoding: UTF-8
|
63
|
+
string: 'null'
|
64
|
+
headers:
|
65
|
+
Accept-Encoding:
|
66
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
67
|
+
Accept:
|
68
|
+
- "*/*"
|
69
|
+
User-Agent:
|
70
|
+
- Ruby
|
71
|
+
Host:
|
72
|
+
- api-sandbox.getnet.com.br
|
73
|
+
Authorization:
|
74
|
+
- Bearer 43bfa02b-8577-485e-83ca-b2f6383afb01
|
75
|
+
Content-Type:
|
76
|
+
- application/json
|
77
|
+
Seller-Id:
|
78
|
+
- 67be6e90-00c1-410d-83f5-6d75621effc8
|
79
|
+
response:
|
80
|
+
status:
|
81
|
+
code: 404
|
82
|
+
message: Not Found
|
83
|
+
headers:
|
84
|
+
Server:
|
85
|
+
- Apache-Coyote/1.1
|
86
|
+
Cache-Control:
|
87
|
+
- no-cache
|
88
|
+
Strict-Transport-Security:
|
89
|
+
- max-age=15552000; includeSubDomains
|
90
|
+
Preload:
|
91
|
+
- ''
|
92
|
+
Content-Type:
|
93
|
+
- application/json;charset=utf-8
|
94
|
+
X-Edgeconnect-Midmile-Rtt:
|
95
|
+
- '6'
|
96
|
+
X-Edgeconnect-Origin-Mex-Latency:
|
97
|
+
- '50'
|
98
|
+
X-Powered-By:
|
99
|
+
- '62208'
|
100
|
+
Vary:
|
101
|
+
- Accept-Encoding
|
102
|
+
Date:
|
103
|
+
- Wed, 14 Apr 2021 14:08:33 GMT
|
104
|
+
Content-Length:
|
105
|
+
- '196'
|
106
|
+
Connection:
|
107
|
+
- keep-alive
|
108
|
+
body:
|
109
|
+
encoding: UTF-8
|
110
|
+
string: '{"message":"Not Found","name":"GatewayClientError","status_code":404,"details":[{"status":"DENIED","error_code":"GENERIC-404","description":"Not
|
111
|
+
Found","description_detail":"Resource not found"}]}'
|
112
|
+
recorded_at: Wed, 14 Apr 2021 14:08:33 GMT
|
113
|
+
recorded_with: VCR 6.0.0
|
@@ -0,0 +1,110 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: https://api-sandbox.getnet.com.br/v1/tokens/card
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: '{"card_number":"5155901222280001"}'
|
9
|
+
headers:
|
10
|
+
Accept-Encoding:
|
11
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
12
|
+
Accept:
|
13
|
+
- "*/*"
|
14
|
+
User-Agent:
|
15
|
+
- Ruby
|
16
|
+
Host:
|
17
|
+
- api-sandbox.getnet.com.br
|
18
|
+
Authorization:
|
19
|
+
- Bearer 334de8fe-b9f4-49d3-87db-8188b69504ef
|
20
|
+
Content-Type:
|
21
|
+
- application/json
|
22
|
+
Seller-Id:
|
23
|
+
- 67be6e90-00c1-410d-83f5-6d75621effc8
|
24
|
+
response:
|
25
|
+
status:
|
26
|
+
code: 201
|
27
|
+
message: Created
|
28
|
+
headers:
|
29
|
+
Server:
|
30
|
+
- Apache-Coyote/1.1
|
31
|
+
Cache-Control:
|
32
|
+
- no-cache
|
33
|
+
Strict-Transport-Security:
|
34
|
+
- max-age=15552000; includeSubDomains
|
35
|
+
Preload:
|
36
|
+
- ''
|
37
|
+
Content-Type:
|
38
|
+
- application/json;charset=utf-8
|
39
|
+
Content-Length:
|
40
|
+
- '130'
|
41
|
+
X-Edgeconnect-Midmile-Rtt:
|
42
|
+
- '8'
|
43
|
+
X-Edgeconnect-Origin-Mex-Latency:
|
44
|
+
- '84'
|
45
|
+
X-Powered-By:
|
46
|
+
- '62211'
|
47
|
+
Date:
|
48
|
+
- Wed, 14 Apr 2021 14:08:33 GMT
|
49
|
+
Connection:
|
50
|
+
- keep-alive
|
51
|
+
body:
|
52
|
+
encoding: ASCII-8BIT
|
53
|
+
string: '{"number_token":"20fab04ff355fd0ec046137cc81a75f6f49ed1aa6b1700e40421824bf732447f105fa1740774782bad3c19c1a461f6c4f363ed95738e882635e19dad452c29d5"}'
|
54
|
+
recorded_at: Wed, 14 Apr 2021 14:08:33 GMT
|
55
|
+
- request:
|
56
|
+
method: post
|
57
|
+
uri: https://api-sandbox.getnet.com.br/v1/cards/verification
|
58
|
+
body:
|
59
|
+
encoding: UTF-8
|
60
|
+
string: '{"number_token":"20fab04ff355fd0ec046137cc81a75f6f49ed1aa6b1700e40421824bf732447f105fa1740774782bad3c19c1a461f6c4f363ed95738e882635e19dad452c29d5","cardholder_name":"JOAO
|
61
|
+
DA SILVA","expiration_month":"12","expiration_year":"20","security_code":"123"}'
|
62
|
+
headers:
|
63
|
+
Accept-Encoding:
|
64
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
65
|
+
Accept:
|
66
|
+
- "*/*"
|
67
|
+
User-Agent:
|
68
|
+
- Ruby
|
69
|
+
Host:
|
70
|
+
- api-sandbox.getnet.com.br
|
71
|
+
Authorization:
|
72
|
+
- Bearer 334de8fe-b9f4-49d3-87db-8188b69504ef
|
73
|
+
Content-Type:
|
74
|
+
- application/json
|
75
|
+
Seller-Id:
|
76
|
+
- 67be6e90-00c1-410d-83f5-6d75621effc8
|
77
|
+
response:
|
78
|
+
status:
|
79
|
+
code: 200
|
80
|
+
message: OK
|
81
|
+
headers:
|
82
|
+
Server:
|
83
|
+
- Apache-Coyote/1.1
|
84
|
+
Cache-Control:
|
85
|
+
- no-cache
|
86
|
+
Strict-Transport-Security:
|
87
|
+
- max-age=15552000; includeSubDomains
|
88
|
+
Preload:
|
89
|
+
- ''
|
90
|
+
Content-Type:
|
91
|
+
- application/json;charset=utf-8
|
92
|
+
X-Edgeconnect-Midmile-Rtt:
|
93
|
+
- '6'
|
94
|
+
X-Edgeconnect-Origin-Mex-Latency:
|
95
|
+
- '826'
|
96
|
+
X-Powered-By:
|
97
|
+
- '62212'
|
98
|
+
Vary:
|
99
|
+
- Accept-Encoding
|
100
|
+
Date:
|
101
|
+
- Wed, 14 Apr 2021 14:08:34 GMT
|
102
|
+
Content-Length:
|
103
|
+
- '120'
|
104
|
+
Connection:
|
105
|
+
- keep-alive
|
106
|
+
body:
|
107
|
+
encoding: UTF-8
|
108
|
+
string: '{"status":"VERIFIED","verification_id":"52eed537-e894-4b1e-a037-98601aa4b942","authorization_code":"205833985653860670"}'
|
109
|
+
recorded_at: Wed, 14 Apr 2021 14:08:34 GMT
|
110
|
+
recorded_with: VCR 6.0.0
|
@@ -0,0 +1,64 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: https://api-sandbox.getnet.com.br/v1/customers
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: '{"customer_id":"123","first_name":"João","last_name":"da Silva","email":"joao@email.com","document_type":"CPF","document_number":"12332112340","phone_number":"5551999887766","address":{"street":"Nome
|
9
|
+
da Rua","number":"123","complement":"Complemento","district":"Nome do Bairro","city":"São
|
10
|
+
Paulo","state":"SP","postal_code":"01010010","country":"Brasil"}}'
|
11
|
+
headers:
|
12
|
+
Accept-Encoding:
|
13
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
14
|
+
Accept:
|
15
|
+
- "*/*"
|
16
|
+
User-Agent:
|
17
|
+
- Ruby
|
18
|
+
Host:
|
19
|
+
- api-sandbox.getnet.com.br
|
20
|
+
Authorization:
|
21
|
+
- Bearer 3e28e48b-478f-4b98-b2ca-c2e82e4d5d14
|
22
|
+
Content-Type:
|
23
|
+
- application/json
|
24
|
+
Seller-Id:
|
25
|
+
- seller_id
|
26
|
+
response:
|
27
|
+
status:
|
28
|
+
code: 401
|
29
|
+
message: Unauthorized
|
30
|
+
headers:
|
31
|
+
Server:
|
32
|
+
- Apache-Coyote/1.1
|
33
|
+
Content-Type:
|
34
|
+
- application/json;charset=UTF-8
|
35
|
+
Content-Length:
|
36
|
+
- '342'
|
37
|
+
X-Edgeconnect-Midmile-Rtt:
|
38
|
+
- '11'
|
39
|
+
X-Edgeconnect-Origin-Mex-Latency:
|
40
|
+
- '48'
|
41
|
+
X-Powered-By:
|
42
|
+
- '58105'
|
43
|
+
Date:
|
44
|
+
- Tue, 13 Apr 2021 19:23:49 GMT
|
45
|
+
Connection:
|
46
|
+
- close
|
47
|
+
body:
|
48
|
+
encoding: UTF-8
|
49
|
+
string: |-
|
50
|
+
{
|
51
|
+
"message": "Unauthorized",
|
52
|
+
"name": "GatewayAuthenticationOAuth2ServiceError",
|
53
|
+
"status_code": 401,
|
54
|
+
"details": [
|
55
|
+
{
|
56
|
+
"status": "DENIED",
|
57
|
+
"error_code": "AUTHENTICATION-401",
|
58
|
+
"description": "Unauthorized",
|
59
|
+
"description_detail": "Invalid client credentials"
|
60
|
+
}
|
61
|
+
]
|
62
|
+
}
|
63
|
+
recorded_at: Tue, 13 Apr 2021 19:23:49 GMT
|
64
|
+
recorded_with: VCR 6.0.0
|
@@ -0,0 +1,112 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: https://api-sandbox.getnet.com.br/auth/oauth/v2/token
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: grant_type=client_credentials&scope=oob
|
9
|
+
headers:
|
10
|
+
Accept-Encoding:
|
11
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
12
|
+
Accept:
|
13
|
+
- "*/*"
|
14
|
+
User-Agent:
|
15
|
+
- Ruby
|
16
|
+
Host:
|
17
|
+
- api-sandbox.getnet.com.br
|
18
|
+
Authorization:
|
19
|
+
- Basic NzQ0Mzg4NzctZjAwYi00NTAyLTg0NTQtZGUzZDcxNjZkYzJhOjRlYWM2OTIwLTFiNTctNGNkMS04Nzk5LWQ4NzcxNzNiZmEzNw==
|
20
|
+
Content-Type:
|
21
|
+
- application/x-www-form-urlencoded
|
22
|
+
response:
|
23
|
+
status:
|
24
|
+
code: 200
|
25
|
+
message: OK
|
26
|
+
headers:
|
27
|
+
Server:
|
28
|
+
- Apache-Coyote/1.1
|
29
|
+
Pragma:
|
30
|
+
- no-cache
|
31
|
+
Cache-Control:
|
32
|
+
- no-store
|
33
|
+
Strict-Transport-Security:
|
34
|
+
- max-age=15552000; includeSubDomains
|
35
|
+
Preload:
|
36
|
+
- ''
|
37
|
+
Content-Type:
|
38
|
+
- application/json;charset=UTF-8
|
39
|
+
X-Edgeconnect-Midmile-Rtt:
|
40
|
+
- '11'
|
41
|
+
X-Edgeconnect-Origin-Mex-Latency:
|
42
|
+
- '19'
|
43
|
+
X-Powered-By:
|
44
|
+
- '51305'
|
45
|
+
Vary:
|
46
|
+
- Accept-Encoding
|
47
|
+
Date:
|
48
|
+
- Mon, 12 Apr 2021 20:38:45 GMT
|
49
|
+
Content-Length:
|
50
|
+
- '127'
|
51
|
+
Connection:
|
52
|
+
- keep-alive
|
53
|
+
body:
|
54
|
+
encoding: UTF-8
|
55
|
+
string: "{\r\n \"access_token\":\"b4679010-cf4f-4804-a5fc-d59cba7675d5\",\r\n
|
56
|
+
\ \"token_type\":\"Bearer\",\r\n \"expires_in\":3600,\r\n \"scope\":\"oob\"\r\n}"
|
57
|
+
recorded_at: Mon, 12 Apr 2021 20:38:45 GMT
|
58
|
+
- request:
|
59
|
+
method: post
|
60
|
+
uri: https://api-sandbox.getnet.com.br/v1/customers
|
61
|
+
body:
|
62
|
+
encoding: UTF-8
|
63
|
+
string: '{"customer_id":"123","first_name":"João","last_name":"da Silva","email":"joao@email.com","document_type":"CPF","document_number":"12332112340","phone_number":"5551999887766","address":{"street":"Nome
|
64
|
+
da Rua","number":"123","complement":"Complemento","district":"Nome do Bairro","city":"São
|
65
|
+
Paulo","state":"SP","postal_code":"01010010","country":"Brasil"}}'
|
66
|
+
headers:
|
67
|
+
Accept-Encoding:
|
68
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
69
|
+
Accept:
|
70
|
+
- "*/*"
|
71
|
+
User-Agent:
|
72
|
+
- Ruby
|
73
|
+
Host:
|
74
|
+
- api-sandbox.getnet.com.br
|
75
|
+
Authorization:
|
76
|
+
- Bearer b4679010-cf4f-4804-a5fc-d59cba7675d5
|
77
|
+
Content-Type:
|
78
|
+
- application/json
|
79
|
+
Seller-Id:
|
80
|
+
- 67be6e90-00c1-410d-83f5-6d75621effc8
|
81
|
+
response:
|
82
|
+
status:
|
83
|
+
code: 501
|
84
|
+
message: Not Implemented
|
85
|
+
headers:
|
86
|
+
Server:
|
87
|
+
- Apache-Coyote/1.1
|
88
|
+
Cache-Control:
|
89
|
+
- no-cache
|
90
|
+
Strict-Transport-Security:
|
91
|
+
- max-age=15552000; includeSubDomains
|
92
|
+
Preload:
|
93
|
+
- ''
|
94
|
+
Content-Type:
|
95
|
+
- application/json;charset=utf-8
|
96
|
+
Content-Length:
|
97
|
+
- '85'
|
98
|
+
X-Edgeconnect-Midmile-Rtt:
|
99
|
+
- '11'
|
100
|
+
X-Edgeconnect-Origin-Mex-Latency:
|
101
|
+
- '81'
|
102
|
+
X-Powered-By:
|
103
|
+
- '51306'
|
104
|
+
Date:
|
105
|
+
- Mon, 12 Apr 2021 20:38:45 GMT
|
106
|
+
Connection:
|
107
|
+
- close
|
108
|
+
body:
|
109
|
+
encoding: ASCII-8BIT
|
110
|
+
string: '{"message":"Not Implemented","name":"","status_code":501,"details":[]}'
|
111
|
+
recorded_at: Mon, 12 Apr 2021 20:38:45 GMT
|
112
|
+
recorded_with: VCR 6.0.0
|