Example #1
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 #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,
     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();
 }
Example #4
0
        /// <inheritdoc />
        public override string ToString()
        {
            var s = new StringBuilder();

            s.AppendFormat("Header:[{0:X2}] ", DataHeader);
            s.AppendFormat("Format:[{0:X2}] ", DataFormat);
            s.AppendFormat("Issuer Identifier:[{0}] ", ApplicationPan.ToHexa('\0'));
            s.AppendFormat("Expiration:[{0}] ", CertificateExpirationDate.ToHexa('\0'));
            s.AppendFormat("Serial:[{0}] ", CertificateSerialNumber.ToHexa('\0'));
            s.AppendFormat("Hash Algorithm:[{0:X2}] ", HashAlgorithmIndicator);
            s.AppendFormat("PK Algorithm:[{0:X2}] ", PublicKeyAlgorithmIndicator);
            s.AppendFormat("PK Length:[{0:X2}] ", PublicKeyLength);
            s.AppendFormat("PKExp Length:[{0:X2}] ", PublicKeyExponentLength);
            s.AppendFormat("Leftmost IssuerPK:[{0}] ", PublicKeyorLeftmostDigitsofthePublicKey.ToHexa('\0'));
            s.AppendFormat("Hash:[{0}] ", HashResult.ToHexa('\0'));
            s.AppendFormat("Trailer:[{0:X2}] ", DataTrailer);

            return(s.ToString());
        }
Example #5
0
 public Receipt(
     ReceiptNumber number,
     RegisterIdentifier registerIdentifier,
     TaxData taxData,
     CurrencyValue turnover,
     CertificateSerialNumber certificateSerialNumber,
     JwsRepresentation previousJwsRepresentation,
     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.");
     Turnover                  = turnover ?? throw new ArgumentException("The turnover has to be specified.");
     CertificateSerialNumber   = certificateSerialNumber ?? throw new ArgumentException("The certificate serial number has to be specified.");
     PreviousJwsRepresentation = previousJwsRepresentation;
     Created                   = created ?? LocalDateTime.Now;
     Suite             = "R1-AT1";
     Key               = key;
     ChainValue        = ComputeChainValue();
     EncryptedTurnover = EncryptTurnover();
 }