Skip to content

Commit

Permalink
Merge pull request #11 from wes4m/dev
Browse files Browse the repository at this point in the history
Experimental release v0.1.3 release
  • Loading branch information
wes4m authored Oct 18, 2022
2 parents e9a4383 + 765dc55 commit 13770e0
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 7 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<div align="center">
<br/>
<img src="./docs/logo.png"/>
<p>v0.1.2 (experimental)</p>
<p>v0.1.3 (experimental)</p>
<br/>
<br/>
<p>
Expand All @@ -17,7 +17,7 @@
<img src="https://img.shields.io/badge/maintainer-wes4m-blue"/>
</a>
<a href="https://badge.fury.io/js/zatca-xml-js">
<img src="https://badge.fury.io/js/zatca-xml-js.svg/?v=0.1.2"/>
<img src="https://badge.fury.io/js/zatca-xml-js.svg/?v=0.1.3"/>
</a>
</p>

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "zatca-xml-js",
"version": "0.1.2",
"version": "0.1.3",
"description": "An implementation of Saudi Arabia ZATCA's E-Invoicing requirements, processes, and standards.",
"main": "lib/index.js",
"files": ["lib/**/*"],
Expand Down
6 changes: 4 additions & 2 deletions src/zatca/ZATCASimplifiedTaxInvoice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -166,9 +166,10 @@ export class ZATCASimplifiedTaxInvoice {
"@_currencyID": "SAR",
"#text": tax_exclusive_subtotal
},
// BR-DEC-14
"cbc:TaxInclusiveAmount": {
"@_currencyID": "SAR",
"#text": tax_exclusive_subtotal + taxes_total
"#text": (tax_exclusive_subtotal + taxes_total).toFixed(2)
},
"cbc:AllowanceTotalAmount": {
"@_currencyID": "SAR",
Expand All @@ -178,9 +179,10 @@ export class ZATCASimplifiedTaxInvoice {
"@_currencyID": "SAR",
"#text": 0
},
// BR-DEC-18
"cbc:PayableAmount": {
"@_currencyID": "SAR",
"#text": tax_exclusive_subtotal + taxes_total
"#text": (tax_exclusive_subtotal + taxes_total).toFixed(2)
}
}
}
Expand Down
6 changes: 4 additions & 2 deletions src/zatca/signing/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,8 @@ export const getCertificateInfo = (certificate_string: string): {hash: string, i
* @returns String base64 encoded certificate body.
*/
export const cleanUpCertificateString = (certificate_string: string): string => {
return certificate_string.replace("-----BEGIN CERTIFICATE-----\n", "").replace("-----END CERTIFICATE-----", "").trim()
const r = process.platform === "win32" ? "\r" : "";
return certificate_string.replace(`-----BEGIN CERTIFICATE-----${r}\n`, "").replace("-----END CERTIFICATE-----", "").trim()
}

/**
Expand All @@ -127,7 +128,8 @@ export const cleanUpCertificateString = (certificate_string: string): string =>
* @returns String base64 encoded private key body.
*/
export const cleanUpPrivateKeyString = (certificate_string: string): string => {
return certificate_string.replace("-----BEGIN EC PRIVATE KEY-----\n", "").replace("-----END EC PRIVATE KEY-----", "").trim()
const r = process.platform === "win32" ? "\r" : "";
return certificate_string.replace(`-----BEGIN EC PRIVATE KEY-----${r}\n`, "").replace("-----END EC PRIVATE KEY-----", "").trim()
}


Expand Down

0 comments on commit 13770e0

Please sign in to comment.