4.3.1.1.1. Invoice Number Generation
The invoice number is generated using the following components:
-
Taxpayer ID – Uniquely identifies the business. This value is obtained during terminal activation, typically from the activation response.
-
Terminal Position – identifies the terminal within the business site or branch.
-
Julian Date – represents the transaction date in a numeric format.
-
Transaction Count – a sequential number for uniqueness per day.
Each of these values is then converted from Base10 to Base64 for compact representation, and finally combined in this format:
Base64(TaxpayerID) - Base64(TerminalPosition) - Base64(JulianDate) - Base64(Count)
|
Example implementation of the method that combines encoded values into the final invoice number:
private string GenerateCombinedString(long taxpayerId, int position, long julianDate, long transactionCount)
{
var base64TaxpayerNumber = Base10ToBase64(taxpayerId);
var base64Position = Base10ToBase64(position);
var julianDateBase64 = Base10ToBase64(julianDate);
var serialNumberBase64 = Base10ToBase64(transactionCount);
return $"{base64TaxpayerNumber}-{base64Position}-{julianDateBase64}-{serialNumberBase64}";
}
|