Example #1
0
        private EncryptedTurnover EncryptTurnover()
        {
            var sum            = TaxData.Sum();
            var counter        = (Turnover.Value + sum) * 100;
            var valueBytes     = GetValueBytes((long)counter);
            var encryptedValue = AesCtr(valueBytes, encrypt: true);

            return(new EncryptedTurnover(encryptedValue));
        }
Example #2
0
 private Receipt(ReceiptNumber number,
                 RegisterIdentifier registerIdentifier,
                 TaxData taxData,
                 CertificateSerialNumber certificateSerialNumber,
                 byte[] key,
                 LocalDateTime created = null)
 {
     Number                  = number ?? throw new ArgumentException("The receipt number has to be specified.");
     RegisterIdentifier      = registerIdentifier ?? throw new ArgumentException("The register identifier has to be specified.");
     TaxData                 = taxData ?? throw new ArgumentException("The tax data have to be specified.");
     CertificateSerialNumber = certificateSerialNumber ?? throw new ArgumentException("The certificate serial number has to be specified.");
     Created                 = created ?? LocalDateTime.Now;
     Suite = "R1-AT1";
     Key   = key;
 }
Example #3
0
 public Receipt(
     ReceiptNumber number,
     RegisterIdentifier registerIdentifier,
     TaxData taxData,
     EncryptedTurnover encryptedTurnover,
     CertificateSerialNumber certificateSerialNumber,
     ChainValue chainValue,
     byte[] key,
     LocalDateTime created = null)
     : this(number, registerIdentifier, taxData, certificateSerialNumber, key, created)
 {
     EncryptedTurnover = encryptedTurnover;
     Turnover          = DecryptTurnover();
     ChainValue        = chainValue;
 }
Example #4
0
 public Receipt(
     ReceiptNumber number,
     RegisterIdentifier registerIdentifier,
     TaxData taxData,
     CurrencyValue turnover,
     CertificateSerialNumber certificateSerialNumber,
     JwsRepresentation previousJwsRepresentation,
     byte[] key,
     LocalDateTime created = null)
     : this(number, registerIdentifier, taxData, certificateSerialNumber, key, created)
 {
     PreviousJwsRepresentation = previousJwsRepresentation;
     ChainValue        = ComputeChainValue();
     Turnover          = turnover ?? throw new ArgumentException("The turnover has to be specified.");
     EncryptedTurnover = EncryptTurnover();
 }