Skip to content

Commit

Permalink
Merge pull request #473 from RJ-SMTR/hotfix/sync-transacaoview-on-demand
Browse files Browse the repository at this point in the history
feat: sync TransacaoView on demand
  • Loading branch information
williamfl2007 committed Sep 20, 2024
2 parents 1ca1f8a + cc5675a commit 1d3fe3d
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "api-cct",
"version": "0.13.2",
"version": "0.13.3",
"description": "",
"author": "",
"private": true,
Expand Down
13 changes: 11 additions & 2 deletions src/bank-statements/bank-statements.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,28 +17,37 @@ import { IBSGetMePreviousDaysArgs, IBSGetMePreviousDaysValidArgs } from './inter
import { IBSGetMePreviousDaysResponse } from './interfaces/bs-get-me-previous-days-response.interface';
import { IBSGetMeResponse } from './interfaces/bs-get-me-response.interface';
import { IGetBSResponse } from './interfaces/get-bs-response.interface';
import { CnabService } from 'src/cnab/cnab.service';

/**
* Get weekly statements
*/
@Injectable()
export class BankStatementsService {
constructor(private readonly usersService: UsersService, private readonly bankStatementsRepository: BankStatementsRepositoryService, private readonly ticketRevenuesService: TicketRevenuesService) {}
constructor(
private readonly usersService: UsersService, //
private readonly bankStatementsRepository: BankStatementsRepositoryService,
private readonly ticketRevenuesService: TicketRevenuesService,
private readonly cnabService: CnabService,
) {}

/**
* - startDate
* - endDate
* - timeInterval (lastMonth)
* - user (mandatory)
*
* Tasks:
* 1. Validar argumentos
* 2. Obter transacaoView no intervalo e filtros
* 3. Agrupar por dia/semana e somar
* 4. Reteornar variáveis a partir do próprio resultado do transacaoView.
*/
public async getMe(args: IBSGetMeArgs): Promise<IBSGetMeResponse> {
const validArgs = await this.validateGetMe(args);
await this.cnabService.syncTransacaoViewOrdemPgto({
nomeFavorecido: [validArgs.user.getFullName()],
consorcio: ['STPC', 'STPL'],
});
const bsData = await this.generateBankStatements({
groupBy: 'week',
startDate: validArgs.startDate,
Expand Down
2 changes: 1 addition & 1 deletion src/cron-jobs/cron-jobs.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ export class CronJobsService {
{
/**
* Gerar arquivo remessa dos vanzeiros - toda 6a, 10:00, duração: 15 min
* + BD do CCT - Sincronizar Transações da Ordem Pagto com Trnas. VIEW
* + BD do CCT - Sincronizar Transações - DLake para CCT
*/
name: CronJobsEnum.generateRemessaVan,
cronJobParameters: {
Expand Down

0 comments on commit 1d3fe3d

Please sign in to comment.