Skip to content

Commit

Permalink
Merge pull request #536 from RJ-SMTR/hotfix/ajusteIndevidos
Browse files Browse the repository at this point in the history
Ajuste pagamentos indevidos
  • Loading branch information
williamfl2007 authored Dec 13, 2024
2 parents f9fc8b6 + bd9b716 commit 9fdff8a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/cnab/service/pagamento/remessa-retorno.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ export class RemessaRetornoService {
async verificaPagamentoIndevido(itemTransacao: ItemTransacao) {
if (itemTransacao.nomeConsorcio === 'STPC' || itemTransacao.nomeConsorcio === 'STPL') {
const pagamentoIndevido = (await this.pagamentoIndevidoService.findAll())
.filter(p => p.nomeFavorecido === itemTransacao.clienteFavorecido.nome);
.filter(p => p.nomeFavorecido === itemTransacao.clienteFavorecido.nome && p.saldoDevedor > 0);
if (pagamentoIndevido && pagamentoIndevido[0] !== undefined
&& pagamentoIndevido[0].saldoDevedor !== undefined) {
return pagamentoIndevido[0].saldoDevedor > 0 ? pagamentoIndevido[0] : undefined;
Expand Down
5 changes: 4 additions & 1 deletion src/cron-jobs/cron-jobs.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,9 @@ export class CronJobsService {
}

async onModuleLoad() {
await this.generateRemessaVanzeiros();
await this.syncTransacaoViewOrdem('van');

const THIS_CLASS_WITH_METHOD = 'CronJobsService.onModuleLoad';
this.jobsConfig.push(
{
Expand Down Expand Up @@ -372,7 +375,7 @@ export class CronJobsService {
const sex = subDays(today, 7);
const qui = subDays(today, 1);

await this.cnabService.saveTransacoesJae(sex, qui, 0,'Van');
// await this.cnabService.saveTransacoesJae(sex, qui, 0,'Van');
const listCnab = await this.cnabService.generateRemessa({ tipo: PagadorContaEnum.ContaBilhetagem
, dataPgto: today, isConference: false, isCancelamento: false, isTeste: false });
await this.cnabService.sendRemessa(listCnab);
Expand Down
4 changes: 2 additions & 2 deletions src/sftp/sftp.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,9 @@ export class SftpService implements OnModuleInit, OnModuleLoad {
public async submitCnabRemessa(content: string): Promise<string> {
const METHOD = 'submitCnabRemessa';
await this.connectClient();
const remotePath = this.dir(`${this.FOLDERS.REMESSA}/${this.generateRemessaName()}`);
const remotePath = this.dir(`${this.FOLDERS.BACKUP_REMESSA}/${this.generateRemessaName()}`);
await this.sftpClient.upload(Buffer.from(content, 'utf-8'), remotePath);
await this.submitCnabBackupRemessa(content);
await this.submitCnabBackupRemessa(content);
this.logger.log(`Arquivo CNAB carregado em ${remotePath}`, METHOD);
return remotePath;
}
Expand Down

0 comments on commit 9fdff8a

Please sign in to comment.