forked from Third-Culture-Software/bhima
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #24 from sfount/receipt-barcode-standard
Receipt Barcode Standard
- Loading branch information
Showing
5 changed files
with
40 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
|
||
exports.generate = generate; | ||
|
||
/** | ||
* @description | ||
* Standard method for generating the code used to display bar codes, this | ||
* provides a uniform interface ensuring that all barcodes displayed to users | ||
* use the same schema. | ||
* | ||
* ##Current Schema | ||
* ${receiptIdentifier}.${uuid(6)} | ||
* | ||
*/ | ||
const UUID_ACCURACY_LENGTH = 12; | ||
|
||
function generate(receiptIdentifier, uuid) { | ||
let entityIdentifier = uuid.substr(0, UUID_ACCURACY_LENGTH); | ||
|
||
return `${receiptIdentifier}${entityIdentifier}`; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
const barcode = require('../../barcode'); | ||
|
||
function barcodeString(receiptIdentifier, uuid) { | ||
return barcode.generate(receiptIdentifier, uuid); | ||
} | ||
|
||
exports.barcodeString = barcodeString; |