Skip to content

Commit

Permalink
remove reference type document
Browse files Browse the repository at this point in the history
  • Loading branch information
gmahota committed Aug 25, 2021
1 parent bc0dd1b commit e29c940
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions src/routes/payment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ import * as PaymentControler from "../controllers/payments/paymentController";

const paymentRouter = Router();

paymentRouter.get("/ponto24/:entity-:document-:code-:numberPayment", async (request: Request, response: Response) => {
paymentRouter.get("/ponto24/:entity-:code-:numberPayment", async (request: Request, response: Response) => {

const { entity, document, code, numberPayment } = request.params
const { entity, code, numberPayment } = request.params

const reference = Reference.getReference_Ponto24(entity, document, Number(code), Number(numberPayment))
const reference = Reference.getReference_Ponto24(entity, Number(code), Number(numberPayment))
response.send({ "Referencia": reference, "tipo": "Ponto 24", "Caracteres": reference.length })
})

Expand Down
10 changes: 5 additions & 5 deletions src/services/payments/reference.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

const getReference_Ponto24 = (entity: string, document: string, code: number, numberPayment: number) => {
const getReference_Ponto24 = (entity: string, code: number, numberPayment: number) => {
let sReferenciaSCheck = ""

let sReferenciaSCheckCalc = ""
Expand All @@ -10,7 +10,7 @@ const getReference_Ponto24 = (entity: string, document: string, code: number, nu
let numPos = 0;
let CheckDigitReferencia = 0;

sReferenciaSCheck = document.substring(0, 1) + pad_with_zeroes(code.toString(), 6) + pad_with_zeroes(numberPayment.toString(), 2)
sReferenciaSCheck = pad_with_zeroes(code.toString(), 6) + pad_with_zeroes(numberPayment.toString(), 2)

sReferenciaSCheckCalc = pad_with_zeroes(entity, 5) + sReferenciaSCheck;

Expand All @@ -19,7 +19,7 @@ const getReference_Ponto24 = (entity: string, document: string, code: number, nu
P = 0;
}
if (I < 15) {
numPos = Number(sReferenciaSCheckCalc.substring(I - 1, 1));
numPos = Number(sReferenciaSCheckCalc.substr(I - 1, 1));
}
else {
numPos = 0;
Expand Down Expand Up @@ -58,15 +58,15 @@ const getReference_Bim = (bank_code: string, bank: string, code: string, invoice

for (var i = 0; i < arrayPeso.length; i++) {
//int num = Convert.ToInt32(strNib.ElementAt(i));
soma1 = Number(strNib.substring(i, 1)) * arrayPeso[i];
soma1 = Number(strNib.substr(i, 1)) * arrayPeso[i];
lngSoma = lngSoma + soma1;
}

var lngModSoma = lngSoma % 97;

var intChDj = 98 - lngModSoma;

strNibFinal = strNib.substring(0, 19);
strNibFinal = strNib.substr(0, 19);

strNibFinal += pad_with_zeroes(intChDj.toString(), 2);

Expand Down

0 comments on commit e29c940

Please sign in to comment.