Skip to content

Commit

Permalink
Add round to tax amount
Browse files Browse the repository at this point in the history
  • Loading branch information
m-arrieta-r committed Sep 28, 2024
1 parent ca5afd4 commit 25c2bb7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@facturacr/atv-sdk",
"version": "1.2.6",
"version": "1.2.7",
"description": "Librería (SDK) de Javascript/NodeJS para acceder al API de Administración Tributaria Virtual (ATV) del Ministerio de Hacienda.",
"main": "dist/src/index.js",
"types": "dist/src/index.d.ts",
Expand Down
10 changes: 5 additions & 5 deletions src/ATV/mappers/billDocToAtv.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ import { ReceptorMessageProps } from '../core/types'

type AtvFormat = InvoiceDocumentContainer

const parseAtvMoneyFormat = (amount: number) => {
return parseFloat(amount.toFixed(5))
}

const mapOrderLinesToAtvFormat = (orderLines: OrderLine[]): DetalleServicio => {
const LineaDetalle = orderLines.map<DetalleServicio['LineaDetalle'][0]>((orderLine) => {
return {
Expand All @@ -26,7 +30,7 @@ const mapOrderLinesToAtvFormat = (orderLines: OrderLine[]): DetalleServicio => {
Codigo: orderLine.tax.code,
CodigoTarifa: orderLine.tax.rateCode,
Tarifa: orderLine.tax.rate,
Monto: orderLine.tax.amount
Monto: parseAtvMoneyFormat(orderLine.tax.amount)
},
// ImpuestoNeto
MontoTotalLinea: orderLine.totalOrderLineAmount
Expand All @@ -35,10 +39,6 @@ const mapOrderLinesToAtvFormat = (orderLines: OrderLine[]): DetalleServicio => {
return { LineaDetalle }
}

const parseAtvMoneyFormat = (amount: number) => {
return parseFloat(amount.toFixed(5))
}

const mapSummaryInvoice = (summaryInvoice: DomainDocument['summaryInvoice']): Resumen => {
return {
CodigoTipoMoneda: {
Expand Down

0 comments on commit 25c2bb7

Please sign in to comment.