Notes
Notes - notes.io |
2
1
Scenarios
2026-06-30 06:11:51 PM
[1:17] 1) Deve gerar lançamentos contábeis na implantação do pré-contábil
[2:39] 2) Não deve gerar lançamentos contábeis na reimplantação do pré-contábil
[3:61] 3) Deve gerar evento de saída com os valores contábeis na implantação do pré-contábil
Summary| Tags| Feature: features/implantacao/implantacaoContratoValidacoes.feature| Validações de Negócio na Implantação de Contrato
implantacao-pre-contabilimplantacaovalidacoes-implantacaoNCA-T642pre-contabilNCA-580
Scenario: [1:17] 1) Deve gerar lançamentos contábeis na implantação do pré-contábil
ms: 265
>>
Background:
18
*
print "Cenário: Pré-contábil - Implantação"
1
20
*
def payload = read('classpath:data/payloads/implantacao/preContabilImplantacao79.json')
2
21
*
def expectedResponse = read('classpath:data/validacoes/implantacao/responsePreContabilImplantacao79.json')
2
23
*
print payload
1
25
Given
url 'https://sboot-gcef-prco-atom-pre-financial-accounting.varejouat.bvnet.bv/v1/pre-accounting-entry'
1
26
And
header Authorization = 'Bearer ' + auth.response.access_token
1
27
And
header Content-Type = 'application/json'
1
28
And
request payload
0
29
When
method post
154
31
Then
match responseStatus == 200
1
32
*
print response
0
implantacaoreimplantacao-pre-contabilvalidacoes-implantacaoNCA-T642pre-contabilNCA-580
Scenario: [2:39] 2) Não deve gerar lançamentos contábeis na reimplantação do pré-contábil
ms: 79
>>
Background:
40
*
print "Cenário: Pré-contábil - Reimplantação"
1
42
*
def payload = read('classpath:data/payloads/implantacao/preContabilReimplantacao82.json')
2
43
*
def expectedResponse = read('classpath:data/validacoes/implantacao/responsePreContabilReimplantacao82.json')
2
45
*
print payload
0
47
Given
url 'https://sboot-gcef-prco-atom-pre-financial-accounting.varejouat.bvnet.bv/v1/pre-accounting-entry'
0
48
And
header Authorization = 'Bearer ' + auth.response.access_token
0
49
And
header Content-Type = 'application/json'
0
50
And
request payload
0
51
When
method post
68
53
Then
match responseStatus == 200
1
54
*
print response
0
56
And
match response == expectedResponse
0
implantacao-pre-contabilimplantacaoNCA-458validacoes-implantacaopre-contabil
Scenario: [3:61] 3) Deve gerar evento de saída com os valores contábeis na implantação do pré-contábil
ms: 62439
>>
Background:
62
*
print "Cenário: NCA-458 - Evento de Saída Pré-Contábil"
1
64
*
def payload = read('classpath:data/payloads/implantacao/preContabilImplantacao458.json')
2
65
*
def expectedResponse = read('classpath:data/validacoes/implantacao/responsePreContabilImplantacao79_v2.json')
1
67
*
def System = Java.type('java.lang.System')
1
68
*
def loanNumber = 'NCA458-IMPL-' + System.currentTimeMillis()
5
69
*
set payload.loanNumber = loanNumber
3
70
*
print "loanNumber gerado: " + loanNumber
1
71
*
print payload
0
73
Given
url preContabil + '/v1/pre-accounting-entry'
1
74
And
header Authorization = 'Bearer ' + auth.response.access_token
0
75
And
header Content-Type = 'application/json'
0
76
And
request payload
0
77
When
method post
207
79
Then
match responseStatus == 200
1
80
*
print response
0
82
And
match response == '#[6]'
7
83
And
match each response contains expectedResponse[0]
4
84
And
match response[0].loanNumber == loanNumber
1
85
And
match response[0].financialEventCode == 'IMPL'
1
86
And
match response[0].financialEventDescription == 'IMPLANTACAO'
1
88
*
def SpannerUtil = Java.type('helpers.SpannerUtil')
1
89
*
def SpannerQueryHelper = Java.type('helpers.SpannerQueryHelper')
1
90
*
def cred = Utils.getSpannerCredential(karate.env)
2
91
*
def spannerUtil = new SpannerUtil(spanner.projectId, spanner.instanceId, spanner.databaseId, cred)
834
92
*
def db = new SpannerQueryHelper(spannerUtil)
5
# LoanAccountingId vem do próprio response (hash determinístico) e é o vínculo das tabelas
95
*
def loanAccountingId = response[0].loanAccountingId
1
96
*
print 'LoanAccountingId:', loanAccountingId
1
# 1) Cabeçalho contábil: 1 registro em TbLoanAccounting
99
*
print 'QUERY 1:', ("SELECT * FROM TbLoanAccounting WHERE LoanAccountingId = '" + loanAccountingId + "'")
1
100
*
def accountingList = db.queryWithRetry('TbLoanAccounting', { LoanAccountingId: loanAccountingId }, 12, 5000)
61348
101
*
print 'RESULTADO TbLoanAccounting:', accountingList
1
102
*
match accountingList == '#[1]'
3
18:11:51.594 classpath:features/implantacao/implantacaoContratoValidacoes.feature:102
* match accountingList == '#[1]'
match failed: EQUALS
$ | actual array length is 0 (LIST:STRING)
[]
'#[1]'
classpath:features/implantacao/implantacaoContratoValidacoes.feature:102
103
*
def accounting = accountingList[0]
0
104
*
match accounting contains { LoanNumber: '#(loanNumber)', TenantId: '#(payload.tenantId)', ProductType: '#(payload.productType)', BranchNumber: '#(payload.branchNumber)', PortfolioClassNumber: '#(payload.portfolioClassNumber)', IsActiveFlag: true }
0
# 2) Lançamentos: 1 registro em TbAccountEntry por accountingEvent enviado (6)
107
*
print 'QUERY 2:', ("SELECT * FROM TbAccountEntry WHERE LoanAccountingId = '" + loanAccountingId + "'")
0
108
*
def entries = db.queryWithRetry('TbAccountEntry', { LoanAccountingId: loanAccountingId }, 12, 5000)
0
109
*
print 'RESULTADO TbAccountEntry:', entries
0
110
*
match entries == '#[6]'
0
111
*
match each entries contains { LoanAccountingId: '#(loanAccountingId)', TenantId: '#(payload.tenantId)', IsActiveFlag: true, LoginDescription: 'accrual.posicaofinanceira' }
0
# 3) Os valores contábeis gravados devem bater com os enviados no payload (6 accountingEvent)
114
*
def amountsEnviados = karate.map(payload.accountingEvent, function(x){ return x.accountingEntryAmount })
0
115
*
def amountsGravados = karate.map(entries, function(x){ return x.AccountingEntryAmount })
0
116
*
print 'Valores enviados:', amountsEnviados, '| gravados:', amountsGravados
0
117
*
match amountsGravados contains only amountsEnviados
0
![]() |
Notes is a web-based application for online taking notes. You can take your notes and share with others people. If you like taking long notes, notes.io is designed for you. To date, over 8,000,000,000+ notes created and continuing...
With notes.io;
- * You can take a note from anywhere and any device with internet connection.
- * You can share the notes in social platforms (YouTube, Facebook, Twitter, instagram etc.).
- * You can quickly share your contents without website, blog and e-mail.
- * You don't need to create any Account to share a note. As you wish you can use quick, easy and best shortened notes with sms, websites, e-mail, or messaging services (WhatsApp, iMessage, Telegram, Signal).
- * Notes.io has fabulous infrastructure design for a short link and allows you to share the note as an easy and understandable link.
Fast: Notes.io is built for speed and performance. You can take a notes quickly and browse your archive.
Easy: Notes.io doesn’t require installation. Just write and share note!
Short: Notes.io’s url just 8 character. You’ll get shorten link of your note when you want to share. (Ex: notes.io/q )
Free: Notes.io works for 14 years and has been free since the day it was started.
You immediately create your first note and start sharing with the ones you wish. If you want to contact us, you can use the following communication channels;
Email: [email protected]
Twitter: http://twitter.com/notesio
Instagram: http://instagram.com/notes.io
Facebook: http://facebook.com/notesio
Regards;
Notes.io Team
