Esempio n. 1
0
        /// <summary>
        /// Deserializes the data into a concrete type
        /// </summary>
        /// <returns>Deserilized contents</returns>
        public QcMonetaryValue Extract()
        {
            var sequence = Value.OfType <DerAsnSequence>().FirstOrDefault();

            if (sequence == null)
            {
                return(null);
            }

            var monetaryValue = new QcMonetaryValue();

            if (sequence.Value[0] is DerAsnPrintableString printableString)
            {
                monetaryValue.CurrencyCode = printableString.Value;
            }
            else if (sequence.Value[0] is DerAsnInteger integer)
            {
                monetaryValue.CurrencyCode = ((int)integer.Value).ToString();
            }
            var amount   = ((DerAsnInteger)(sequence.Value[1])).Value;
            var exponent = (int)((DerAsnInteger)(sequence.Value[2])).Value;

            monetaryValue.Value = (decimal)amount * (decimal)Math.Pow(10.0, exponent);
            return(monetaryValue);
        }
Esempio n. 2
0
        /// <summary>
        /// Used to create the extension from typed model
        /// </summary>
        /// <param name="isCompliant"><b>QcCompliant</b>. True is the cert is European Qualified Certificate otherwize false</param>
        /// <param name="limit"><b>QcLimitValue</b>. Monetary value </param>
        /// <param name="retentionPeriod"><b>QcRetentionPeriod</b></param>
        /// <param name="isQSCD"><b>QcSSCD</b></param>
        /// <param name="pdsLocations"><b>QcPds</b></param>
        /// <param name="type"><b>QcType</b></param>
        /// <param name="psd2"><b>PSD2 QcStatement</b></param>
        /// <param name="critical"></param>
        public QualifiedCertificateStatementsExtension(bool isCompliant, QcMonetaryValue limit, int retentionPeriod, bool isQSCD, IEnumerable <PdsLocation> pdsLocations, QcTypeIdentifiers type, Psd2Attributes psd2, bool critical)
        {
            Oid      = new Oid(Oid_QC_Statements, "Qualified Certificate Statements");
            Critical = critical;
            var statements = new List <DerAsnSequence>();

            if (isCompliant)
            {
                statements.Add(new QcComplianceStatement());
            }
            if (retentionPeriod > 0)
            {
                statements.Add(new QcRetentionPeriodStatement(retentionPeriod));
            }
            if (limit != null)
            {
                statements.Add(new QcLimitValueStatement(limit));
            }
            if (isQSCD)
            {
                statements.Add(new QcSSCDStatement());
            }
            statements.Add(new QcTypeStatement(type));
            if (pdsLocations?.Any() == true)
            {
                statements.Add(new QcPdsStatement(pdsLocations));
            }
            if (psd2 != null)
            {
                statements.Add(new Psd2QcStatement(psd2));
            }
            RawData     = DerConvert.Encode(new DerAsnSequence(statements.ToArray())).ToArray();
            _Statements = new QualifiedCertificateStatements(isCompliant, limit, retentionPeriod, isQSCD, pdsLocations, type, psd2);
            _decoded    = true;
        }
Esempio n. 3
0
 /// <summary>
 ///  DTO encapsulating all statements found inside a <see cref="QualifiedCertificateStatementsExtension"/>
 /// </summary>
 /// <param name="isCompliant"><b>QcCompliant</b>. True is the cert is European Qualified Certificate otherwize false</param>
 /// <param name="limit"><b>QcLimitValue</b>. Monetary value </param>
 /// <param name="retentionPeriod"><b>QcRetentionPeriod</b></param>
 /// <param name="isQSCD"><b>QcSSCD</b></param>
 /// <param name="pdsLocations"><b>QcPds</b></param>
 /// <param name="type"><b>QcType</b></param>
 /// <param name="psd2"><b>PSD2 QcStatement</b></param>
 public QualifiedCertificateStatements(bool isCompliant, QcMonetaryValue limit, int retentionPeriod, bool isQSCD, IEnumerable <PdsLocation> pdsLocations, QcTypeIdentifiers type, Psd2Attributes psd2)
 {
     IsCompliant     = isCompliant;
     LimitValue      = limit;
     RetentionPeriod = retentionPeriod;
     IsQSCD          = isQSCD;
     PdsLocations    = pdsLocations.ToArray();
     Type            = type;
     Psd2Type        = psd2;
 }
Esempio n. 4
0
 /// <summary>
 /// Constructs the QcStatement so it can be added to a certificate.
 /// </summary>
 public QcLimitValueStatement(QcMonetaryValue limit)
     : this(limit.Value, limit.CurrencyCode)
 {
 }