Exemple #1
0
 public SepaMessageInfo(SepaMessageType nMessageType, int nVersion, string sMessageTag, string sXmlNamespace, string sXmlSchemaLocation)
 {
     if (sMessageTag == null)
     {
         throw new ArgumentNullException();
     }
     if (!SepaUtil.CheckTagName(sMessageTag))
     {
         throw new ArgumentException();
     }
     if (nVersion <= 0)
     {
         throw new ArgumentException();
     }
     if (sXmlNamespace == "")
     {
         sXmlNamespace = null;
     }
     if (sXmlSchemaLocation == "")
     {
         sXmlSchemaLocation = null;
     }
     this.m_nMessageType       = nMessageType;
     this.m_nVersion           = nVersion;
     this.m_sMessageTag        = sMessageTag;
     this.m_sXmlNamespace      = sXmlNamespace;
     this.m_sXmlSchemaLocation = sXmlSchemaLocation;
 }
Exemple #2
0
        public static SepaMessageInfo Create(string sMessageTag, string sXmlNamespace)
        {
            if (sMessageTag == null)
            {
                throw new ArgumentNullException();
            }
            if (!SepaUtil.CheckTagName(sMessageTag))
            {
                throw new ArgumentException();
            }
            SepaMessageInfo info = null;

            switch (sMessageTag)
            {
            case "CstmrCdtTrfInitn":
                info = new SepaMessageInfo(SepaMessageType.CreditTransferPaymentInitiation, _ExtractVersion(sXmlNamespace, "pain.001", 3));
                break;

            case "CstmrDrctDbtInitn":
                info = new SepaMessageInfo(SepaMessageType.DirectDebitPaymentInitiation, _ExtractVersion(sXmlNamespace, "pain.008", 2));
                break;

            case "pain.001.001.02":
                info = new SepaMessageInfo(SepaMessageType.CreditTransferPaymentInitiation, 2);
                break;

            case "pain.008.001.01":
                info = new SepaMessageInfo(SepaMessageType.DirectDebitPaymentInitiation, 1);
                break;

            case "pain.008.001.02":
                info = new SepaMessageInfo(SepaMessageType.DirectDebitPaymentInitiation, 2);
                break;

            case "pain.008.003.02":
                info = new SepaMessageInfo(SepaMessageType.DirectDebitPaymentInitiation, 2);
                break;

            case "CstmrPmtStsRpt":
                info = new SepaMessageInfo(SepaMessageType.PaymentStatusReport, _ExtractVersion(sXmlNamespace, "pain.002", 3));
                break;

            case "BkToCstmrAcctRpt":
                info = new SepaMessageInfo(SepaMessageType.BankToCustomerAccountReport, _ExtractVersion(sXmlNamespace, "camt.052", 2));
                break;

            case "BkToCstmrStmt":
                info = new SepaMessageInfo(SepaMessageType.BankToCustomerStatement, _ExtractVersion(sXmlNamespace, "camt.053", 2));
                break;

            case "BkToCstmrDbtCdtNtfctn":
                info = new SepaMessageInfo(SepaMessageType.BankToCustomerDebitCreditNotification, _ExtractVersion(sXmlNamespace, "camt.054", 2));
                break;

            default:
                return(null);
            }
            info.XmlNamespace = sXmlNamespace;
            return(info);
        }
Exemple #3
0
 protected override void OnReadXml(XmlReader aXmlReader, SepaMessageInfo aMessageInfo)
 {
     if (aXmlReader.IsStartElement("BIC"))
     {
         this.m_tBIC = new SepaBIC(aXmlReader.ReadElementString("BIC"));
     }
     if (aXmlReader.IsStartElement("ClrSysMmbId"))
     {
         aXmlReader.ReadStartElement();
         if (aXmlReader.IsStartElement("ClrSysId"))
         {
             aXmlReader.Skip();
         }
         this.m_sClrSysMmbId = aXmlReader.ReadElementString("MmbId");
         aXmlReader.ReadEndElement();
     }
     if (aXmlReader.IsStartElement("Nm"))
     {
         this.m_sNm = aXmlReader.ReadElementString();
     }
     if (aXmlReader.IsStartElement("PstlAdr"))
     {
         aXmlReader.Skip();
     }
     if (aXmlReader.IsStartElement("Othr"))
     {
         this.m_sVatId = SepaUtil.ReadOthrId(aXmlReader, "UmsStId");
     }
 }
        protected override void OnWriteXml(XmlWriter aXmlWriter, SepaMessageInfo aMessageInfo)
        {
            if (base.MessageType != aMessageInfo.MessageType)
            {
                throw new ArgumentException();
            }
            aXmlWriter.WriteStartElement("GrpHdr");
            base.WriteGroupHeaderFields(aXmlWriter, aMessageInfo);
            switch (this.m_nOriginalMessageType)
            {
            case SepaMessageType.CreditTransferPaymentInitiation:
                SepaUtil.WriteAgtBIC(aXmlWriter, "DbtrAgt", this.m_tAgtBIC);
                break;

            case SepaMessageType.DirectDebitPaymentInitiation:
                SepaUtil.WriteAgtBIC(aXmlWriter, "CdtrAgt", this.m_tAgtBIC);
                break;
            }
            aXmlWriter.WriteEndElement();
            aXmlWriter.WriteStartElement("OrgnlGrpInfAndSts");
            aXmlWriter.WriteElementString("OrgnlMsgId", this.m_sOrgnlMsgId);
            aXmlWriter.WriteElementString("OrgnlMsgNmId", this.OriginalMessageNameIdentification);
            aXmlWriter.WriteEndElement();
            this.m_vOrgnlPmtInfs.WriteXml(aXmlWriter, aMessageInfo);
        }
Exemple #5
0
 protected override void OnWriteXml(XmlWriter aXmlWriter, SepaMessageInfo aMessageInfo)
 {
     if ((this.m_sNtryRef != null) && (this.m_sNtryRef != ""))
     {
         aXmlWriter.WriteElementString("NtryRef", this.m_sNtryRef);
     }
     this.m_aAmt.WriteXml(aXmlWriter, "Amt");
     if (this.m_fRvslInd)
     {
         aXmlWriter.WriteElementString("RvslInd", XmlConvert.ToString(this.m_fRvslInd));
     }
     aXmlWriter.WriteElementString("Sts", this.m_sSts);
     if (this.m_dtBookgDt > DateTime.MinValue)
     {
         aXmlWriter.WriteStartElement("BookgDt");
         SepaUtil.WriteDtXml(aXmlWriter, "Dt", this.m_dtBookgDt);
         aXmlWriter.WriteEndElement();
     }
     if (this.m_dtValDt > DateTime.MinValue)
     {
         aXmlWriter.WriteStartElement("ValDt");
         SepaUtil.WriteDtXml(aXmlWriter, "Dt", this.m_dtValDt);
         aXmlWriter.WriteEndElement();
     }
     if ((this.m_sAcctSvcrRef != null) && (this.m_sAcctSvcrRef != ""))
     {
         aXmlWriter.WriteElementString("AcctSvcrRef", this.m_sAcctSvcrRef);
     }
     SepaUtil.WriteBkTxCd(aXmlWriter, this.m_sBkTxCd, this.m_sBkTxCdIssr);
     if (((this.m_sAddtlInfIndMsgNmId != null) && (this.m_sAddtlInfIndMsgNmId != "")) || ((this.m_sAddtlInfIndMsgId != null) && (this.m_sAddtlInfIndMsgId != "")))
     {
         aXmlWriter.WriteStartElement("AddtlInfInd");
         if ((this.m_sAddtlInfIndMsgNmId != null) && (this.m_sAddtlInfIndMsgNmId != ""))
         {
             aXmlWriter.WriteElementString("MsgNmId", this.m_sAddtlInfIndMsgNmId);
         }
         if ((this.m_sAddtlInfIndMsgId != null) && (this.m_sAddtlInfIndMsgId != ""))
         {
             aXmlWriter.WriteElementString("MsgId", this.m_sAddtlInfIndMsgId);
         }
         aXmlWriter.WriteEndElement();
     }
     if (this.m_vTxDtls.Count > 0)
     {
         aXmlWriter.WriteStartElement("NtryDtls");
         if ((this.m_sBtchPmtInfId != null) && (this.m_sBtchPmtInfId != ""))
         {
             aXmlWriter.WriteStartElement("Btch");
             aXmlWriter.WriteElementString("PmtInfId", this.m_sBtchPmtInfId);
             aXmlWriter.WriteEndElement();
         }
         this.m_vTxDtls.WriteXml(aXmlWriter, aMessageInfo);
         aXmlWriter.WriteEndElement();
     }
     if ((this.m_sAddtlNtryInf != null) && (this.m_sAddtlNtryInf != ""))
     {
         aXmlWriter.WriteElementString("AddtlNtryInf", this.m_sAddtlNtryInf);
     }
 }
 public SepaObject(string sTagName)
 {
     if (!SepaUtil.CheckTagName(sTagName))
     {
         throw new ArgumentException();
     }
     this.m_sTagName = sTagName;
 }
Exemple #7
0
 public SepaStatement(string sTagName) : base(sTagName)
 {
     this.m_sId       = SepaUtil.GenerateIdentification("S");
     this.m_dtCreDtTm = DateTime.Now;
     this.m_aAcct     = new SepaAccount("Acct");
     this.m_vBals     = new SepaBalances(this);
     this.m_vNtrys    = new SepaStatementEntries(this);
 }
Exemple #8
0
 public static bool IsValid(string sIBAN)
 {
     if (sIBAN == null)
     {
         return(false);
     }
     return(((sIBAN.Length >= 6) && (sIBAN.Length <= 0x22)) && SepaUtil.IsValidID(sIBAN));
 }
 public static bool IsValid(string sCreditorID)
 {
     if (sCreditorID == null)
     {
         return(false);
     }
     return(((sCreditorID.Length >= 8) && (sCreditorID.Length <= 0x23)) && SepaUtil.IsValidID(sCreditorID.Substring(0, 4) + sCreditorID.Substring(7)));
 }
Exemple #10
0
 protected override void OnReadXml(XmlReader aXmlReader, SepaMessageInfo aMessageInfo)
 {
     this.m_sId = aXmlReader.ReadElementString("Id");
     if (aXmlReader.IsStartElement("ElctrncSeqNb"))
     {
         this.m_nElctrncSeqNb = XmlConvert.ToInt32(aXmlReader.ReadElementString());
     }
     if (aXmlReader.IsStartElement("LglSeqNb"))
     {
         this.m_nLglSeqNb = XmlConvert.ToInt32(aXmlReader.ReadElementString());
     }
     this.m_dtCreDtTm = SepaUtil.ToLocalDateTime(aXmlReader.ReadElementString("CreDtTm"));
     if (aXmlReader.IsStartElement("FrToDt"))
     {
         aXmlReader.ReadStartElement();
         this.m_dtFrDtTm = SepaUtil.ToLocalDateTime(aXmlReader.ReadElementString("FrDtTm"));
         this.m_dtToDtTm = SepaUtil.ToLocalDateTime(aXmlReader.ReadElementString("ToDtTm"));
         aXmlReader.ReadEndElement();
     }
     if (aXmlReader.IsStartElement("CpyDplctInd"))
     {
         aXmlReader.Skip();
     }
     if (aXmlReader.IsStartElement("RptgSrc"))
     {
         aXmlReader.Skip();
     }
     this.m_aAcct.ReadXml(aXmlReader, aMessageInfo);
     if (aXmlReader.IsStartElement("RltdAcct"))
     {
         aXmlReader.Skip();
     }
     while (aXmlReader.IsStartElement("Intrst"))
     {
         aXmlReader.Skip();
     }
     while (aXmlReader.IsStartElement("Bal"))
     {
         SepaBalance item = new SepaBalance();
         item.ReadXml(aXmlReader, aMessageInfo);
         this.m_vBals.Add(item);
     }
     while (aXmlReader.IsStartElement("TxsSummry"))
     {
         aXmlReader.Skip();
     }
     while (aXmlReader.IsStartElement("Ntry"))
     {
         SepaStatementEntry entry = new SepaStatementEntry();
         entry.ReadXml(aXmlReader, aMessageInfo);
         this.m_vNtrys.Add(entry);
     }
     if (aXmlReader.IsStartElement(this._GetAddtlInfTagName()))
     {
         this.m_sAddtlInf = aXmlReader.ReadElementString();
     }
 }
 protected override void OnWriteXml(XmlWriter aXmlWriter, SepaMessageInfo aMessageInfo)
 {
     aXmlWriter.WriteStartElement("Tp");
     aXmlWriter.WriteStartElement("CdOrPrtry");
     aXmlWriter.WriteElementString("Cd", this.m_sTpCd);
     aXmlWriter.WriteEndElement();
     aXmlWriter.WriteEndElement();
     this.m_aAmt.WriteXml(aXmlWriter, "Amt");
     aXmlWriter.WriteStartElement("Dt");
     SepaUtil.WriteDtXml(aXmlWriter, "Dt", this.m_dtDt);
     aXmlWriter.WriteEndElement();
 }
Exemple #12
0
 public static string GetCountryCode(string sBIC)
 {
     sBIC = SepaUtil.Trim(sBIC);
     if ((sBIC == null) || (sBIC == ""))
     {
         return(null);
     }
     if (!IsValid(sBIC))
     {
         throw new ArgumentException();
     }
     return(sBIC.Substring(4, 2));
 }
Exemple #13
0
 public static string GetCountryCode(string sIBAN)
 {
     sIBAN = SepaUtil.Trim(sIBAN);
     if ((sIBAN == null) || (sIBAN == ""))
     {
         return(null);
     }
     if ((sIBAN.Length < 6) || (sIBAN.Length > 0x22))
     {
         throw new ArgumentException();
     }
     return(sIBAN.Substring(0, 2));
 }
 public static string GetCountryCode(string sCreditorID)
 {
     sCreditorID = SepaUtil.Trim(sCreditorID);
     if ((sCreditorID == null) || (sCreditorID == ""))
     {
         return(null);
     }
     if ((sCreditorID.Length < 8) || (sCreditorID.Length > 0x23))
     {
         throw new ArgumentException();
     }
     return(sCreditorID.Substring(0, 2));
 }
        protected override void OnWriteXml(XmlWriter aXmlWriter, SepaMessageInfo aMessageInfo)
        {
            bool flag  = false;
            bool flag2 = false;

            if (base.TagName == "InitgPty")
            {
                flag  = (((aMessageInfo.XmlNamespace == "APC:STUZZA:payments:ISO:pain:001:001:02:austrian:002") || (aMessageInfo.XmlNamespace == "ISO:pain.001.001.03:APC:STUZZA:payments:001")) || (aMessageInfo.XmlNamespace == "APC:STUZZA:payments:ISO:pain:008:001:01:austrian:002")) || (aMessageInfo.XmlNamespace == "ISO:pain.008.001.02:APC:STUZZA:payments:001");
                flag2 = !flag;
            }
            bool flag3 = ((((this.m_nSupportedFields & Fields.Name) != Fields.None) && (this.m_sNm != null)) && (this.m_sNm != "")) && !flag;
            bool flag4 = (((this.m_nSupportedFields & Fields.BIC) != Fields.None) && !this.m_tBIC.IsNull) && !flag2;
            bool flag5 = (((this.m_nSupportedFields & Fields.EBICS) != Fields.None) && (this.m_sEBICSPartnerId != null)) && (this.m_sEBICSPartnerId != "");
            bool flag6 = (((this.m_nSupportedFields & Fields.CdtrId) != Fields.None) && (this.m_sCdtrSchmeId != null)) && (this.m_sCdtrSchmeId != "");

            if (flag3)
            {
                aXmlWriter.WriteElementString("Nm", this.m_sNm);
            }
            if ((flag4 || flag5) || flag6)
            {
                aXmlWriter.WriteStartElement("Id");
                if (flag4 || flag5)
                {
                    aXmlWriter.WriteStartElement("OrgId");
                    if (flag4)
                    {
                        if (flag)
                        {
                            aXmlWriter.WriteElementString("BkPtyId", this.m_tBIC.BIC);
                        }
                        else
                        {
                            aXmlWriter.WriteElementString("BICOrBEI", this.m_tBIC.BIC);
                        }
                    }
                    if (flag5)
                    {
                        SepaUtil.WriteOthrId(aXmlWriter, this.m_sEBICSPartnerId, "EBICS");
                    }
                    aXmlWriter.WriteEndElement();
                }
                if (flag6)
                {
                    aXmlWriter.WriteStartElement("PrvtId");
                    SepaUtil.WriteOthrId(aXmlWriter, this.m_sCdtrSchmeId, null);
                    aXmlWriter.WriteEndElement();
                }
                aXmlWriter.WriteEndElement();
            }
        }
Exemple #16
0
        protected override void OnWriteXml(XmlWriter aXmlWriter, SepaMessageInfo aMessageInfo)
        {
            if (aMessageInfo.MessageType != SepaMessageType.DirectDebitPaymentInitiation)
            {
                throw new ArgumentException();
            }
            base.WritePmtInfIdXml(aXmlWriter);
            base.WritePmtMtdXml(aXmlWriter);
            if (aMessageInfo.Version >= 2)
            {
                base.WriteBtchBookg(aXmlWriter);
                base.WriteNbOfTxs(aXmlWriter);
                base.WriteCtrlSum(aXmlWriter);
            }
            aXmlWriter.WriteStartElement("PmtTpInf");
            aXmlWriter.WriteStartElement("SvcLvl");
            aXmlWriter.WriteElementString("Cd", "SEPA");
            aXmlWriter.WriteEndElement();
            if (aMessageInfo.XmlNamespace != "urn:sepade:xsd:pain.008.001.01")
            {
                aXmlWriter.WriteStartElement("LclInstrm");
                aXmlWriter.WriteElementString("Cd", this.m_sLclInstrmCd);
                aXmlWriter.WriteEndElement();
            }
            aXmlWriter.WriteElementString("SeqTp", this.m_sSeqTp);
            if (aMessageInfo.XmlNamespace != "urn:sepade:xsd:pain.008.001.01")
            {
                base.WriteCtgyPurp(aXmlWriter, aMessageInfo.Version >= 2);
            }
            aXmlWriter.WriteEndElement();
            SepaUtil.WriteDtXml(aXmlWriter, "ReqdColltnDt", this.m_dtReqdColltnDt);
            this.m_aCdtr.WriteXml(aXmlWriter, aMessageInfo);
            string sCcy = (aMessageInfo.XmlNamespace != "urn:sepade:xsd:pain.008.001.01") ? this.m_sCdtrAcctCcy : null;

            SepaUtil.WriteAcctXml(aXmlWriter, "CdtrAcct", this.m_tCdtrAcctIBAN, sCcy);
            SepaUtil.WriteAgtBIC(aXmlWriter, "CdtrAgt", this.m_tCdtrAgtBIC);
            if (!this.m_aUltmtCdtr.IsEmpty())
            {
                this.m_aUltmtCdtr.WriteXml(aXmlWriter, aMessageInfo);
            }
            aXmlWriter.WriteElementString("ChrgBr", "SLEV");
            if (aMessageInfo.Version >= 2)
            {
                SepaUtil.WriteCdtrSchmeIdXml(aXmlWriter, this.m_sCdtrSchmeId, false);
            }
            base.WriteTxInfs(aXmlWriter, aMessageInfo);
        }
 protected override void OnReadXml(XmlReader aXmlReader, SepaMessageInfo aMessageInfo)
 {
     if (aMessageInfo.MessageType != SepaMessageType.CreditTransferPaymentInitiation)
     {
         throw new ArgumentException();
     }
     base.ReadPmtInfIdXml(aXmlReader);
     base.ReadPmtMtdXml(aXmlReader);
     if (aMessageInfo.Version >= 3)
     {
         base.ReadBtchBookg(aXmlReader);
         base.ReadNbOfTxs(aXmlReader);
         base.ReadCtrlSum(aXmlReader);
     }
     aXmlReader.ReadStartElement("PmtTpInf");
     if (aXmlReader.IsStartElement("InstrPrty"))
     {
         this.m_sInstrPrty = aXmlReader.ReadElementString();
     }
     aXmlReader.ReadStartElement("SvcLvl");
     this.m_sSvcLvlCd = aXmlReader.ReadElementString("Cd");
     aXmlReader.ReadEndElement();
     base.ReadCtgyPurp(aXmlReader, aMessageInfo.Version >= 3);
     aXmlReader.ReadEndElement();
     this.m_dtReqdExctnDt = SepaUtil.ReadDtXml(aXmlReader, "ReqdExctnDt");
     this.m_aDbtr.ReadXml(aXmlReader, aMessageInfo);
     this.m_tDbtrAcctIBAN = SepaUtil.ReadAcctXml(aXmlReader, "DbtrAcct", out this.m_sDbtrAcctCcy);
     this.m_tDbtrAgtBIC   = SepaUtil.ReadAgtBIC(aXmlReader, "DbtrAgt");
     if (aXmlReader.IsStartElement("UltmtDbtr"))
     {
         this.m_aUltmtDbtr.ReadXml(aXmlReader, aMessageInfo);
     }
     if (aXmlReader.IsStartElement("ChrgBr"))
     {
         aXmlReader.ReadElementString();
     }
     while (aXmlReader.IsStartElement("CdtTrfTxInf"))
     {
         SepaCreditTransferTransactionInformation item = (SepaCreditTransferTransactionInformation)this.NewTransactionInformation();
         item.ReadXml(aXmlReader, aMessageInfo);
         base.TransactionInformations.Add(item);
     }
 }
        public static string Capture(string sCreditorId)
        {
            sCreditorId = SepaUtil.Trim(sCreditorId);
            if ((sCreditorId == null) || (sCreditorId == ""))
            {
                return(null);
            }
            sCreditorId = sCreditorId.ToUpper(CultureInfo.InvariantCulture);
            StringBuilder builder = new StringBuilder(0x23);

            for (int i = 0; i < sCreditorId.Length; i++)
            {
                char ch = sCreditorId[i];
                if (((ch >= '0') && (ch <= '9')) || ((ch >= 'A') && (ch <= 'Z')))
                {
                    builder.Append(ch);
                }
            }
            return(builder.ToString());
        }
Exemple #19
0
        public static string Capture(string sBIC)
        {
            sBIC = SepaUtil.Trim(sBIC);
            if ((sBIC == null) || (sBIC == ""))
            {
                return(null);
            }
            sBIC = sBIC.ToUpper(CultureInfo.InvariantCulture);
            StringBuilder builder = new StringBuilder(11);

            for (int i = 0; i < sBIC.Length; i++)
            {
                char ch = sBIC[i];
                if (((ch >= '0') && (ch <= '9')) || ((ch >= 'A') && (ch <= 'Z')))
                {
                    builder.Append(ch);
                }
            }
            return(builder.ToString());
        }
Exemple #20
0
 public static bool IsValid(string sBIC)
 {
     if (sBIC == null)
     {
         return(false);
     }
     if ((sBIC.Length != 8) && (sBIC.Length != 11))
     {
         return(false);
     }
     if (!SepaUtil.IsAlpha(sBIC.Substring(0, 6)))
     {
         return(false);
     }
     if (!SepaUtil.IsAlphaNumeric(sBIC.Substring(6)))
     {
         return(false);
     }
     return(true);
 }
Exemple #21
0
        protected override void OnReadXml(XmlReader aXmlReader, SepaMessageInfo aMessageInfo)
        {
            string str;

            if (aMessageInfo.MessageType != SepaMessageType.CreditTransferPaymentInitiation)
            {
                throw new ArgumentException();
            }
            base.ReadPmtIdXml(aXmlReader);
            if (aXmlReader.IsStartElement("PmtTpInf"))
            {
                aXmlReader.Skip();
            }
            aXmlReader.ReadStartElement("Amt");
            base.ReadInstdAmtXml(aXmlReader);
            aXmlReader.ReadEndElement();
            if (aXmlReader.IsStartElement("ChrgBr"))
            {
                aXmlReader.Skip();
            }
            if (aXmlReader.IsStartElement("UltmtDbtr"))
            {
                aXmlReader.Skip();
            }
            if (aXmlReader.IsStartElement("CdtrAgt"))
            {
                this.m_tCdtrAgtBIC = SepaUtil.ReadAgtBIC(aXmlReader, "CdtrAgt");
            }
            this.m_aCdtr.ReadXml(aXmlReader, aMessageInfo);
            this.m_tCdtrAcctIBAN = SepaUtil.ReadAcctXml(aXmlReader, "CdtrAcct", out str);
            if (aXmlReader.IsStartElement("UltmtCdtr"))
            {
                aXmlReader.Skip();
            }
            while (aXmlReader.IsStartElement("InstrForCdtrAgt"))
            {
                aXmlReader.Skip();
            }
            base.ReadPurpXml(aXmlReader);
            base.ReadRmtInfXml(aXmlReader);
        }
        protected override void OnWriteXml(XmlWriter aXmlWriter, SepaMessageInfo aMessageInfo)
        {
            if (aMessageInfo.MessageType != SepaMessageType.CreditTransferPaymentInitiation)
            {
                throw new ArgumentException();
            }
            base.WritePmtInfIdXml(aXmlWriter);
            base.WritePmtMtdXml(aXmlWriter);
            if (aMessageInfo.Version >= 3)
            {
                base.WriteBtchBookg(aXmlWriter);
                base.WriteNbOfTxs(aXmlWriter);
                base.WriteCtrlSum(aXmlWriter);
            }
            aXmlWriter.WriteStartElement("PmtTpInf");
            if (((aMessageInfo.XmlNamespace != "urn:sepade:xsd:pain.001.001.02") && (this.m_sInstrPrty != null)) && (this.m_sInstrPrty != ""))
            {
                aXmlWriter.WriteElementString("InstrPrty", this.m_sInstrPrty);
            }
            aXmlWriter.WriteStartElement("SvcLvl");
            aXmlWriter.WriteElementString("Cd", this.m_sSvcLvlCd);
            aXmlWriter.WriteEndElement();
            if (aMessageInfo.XmlNamespace != "urn:sepade:xsd:pain.001.001.02")
            {
                base.WriteCtgyPurp(aXmlWriter, aMessageInfo.Version >= 3);
            }
            aXmlWriter.WriteEndElement();
            SepaUtil.WriteDtXml(aXmlWriter, "ReqdExctnDt", this.m_dtReqdExctnDt);
            this.m_aDbtr.WriteXml(aXmlWriter, aMessageInfo);
            string sCcy = (aMessageInfo.XmlNamespace != "urn:sepade:xsd:pain.001.001.02") ? this.m_sDbtrAcctCcy : null;

            SepaUtil.WriteAcctXml(aXmlWriter, "DbtrAcct", this.m_tDbtrAcctIBAN, sCcy);
            SepaUtil.WriteAgtBIC(aXmlWriter, "DbtrAgt", this.m_tDbtrAgtBIC);
            if (!this.m_aUltmtDbtr.IsEmpty())
            {
                this.m_aUltmtDbtr.WriteXml(aXmlWriter, aMessageInfo);
            }
            aXmlWriter.WriteElementString("ChrgBr", "SLEV");
            base.WriteTxInfs(aXmlWriter, aMessageInfo);
        }
Exemple #23
0
 protected override void OnWriteXml(XmlWriter aXmlWriter, SepaMessageInfo aMessageInfo)
 {
     if (aMessageInfo.MessageType != SepaMessageType.CreditTransferPaymentInitiation)
     {
         throw new ArgumentException();
     }
     base.WritePmtIdXml(aXmlWriter);
     aXmlWriter.WriteStartElement("Amt");
     base.WriteInstdAmtXml(aXmlWriter);
     aXmlWriter.WriteEndElement();
     if (!this.m_tCdtrAgtBIC.IsNull)
     {
         SepaUtil.WriteAgtBIC(aXmlWriter, "CdtrAgt", this.m_tCdtrAgtBIC);
     }
     this.m_aCdtr.WriteXml(aXmlWriter, aMessageInfo);
     SepaUtil.WriteAcctXml(aXmlWriter, "CdtrAcct", this.m_tCdtrAcctIBAN, null);
     if (aMessageInfo.XmlNamespace != "urn:sepade:xsd:pain.001.001.02")
     {
         base.WritePurpXml(aXmlWriter);
     }
     base.WriteRmtInfXml(aXmlWriter);
 }
 protected override void OnReadXml(XmlReader aXmlReader, SepaMessageInfo aMessageInfo)
 {
     if (base.MessageType != aMessageInfo.MessageType)
     {
         throw new ArgumentException();
     }
     aXmlReader.ReadStartElement("GrpHdr");
     base.ReadGroupHeaderFields(aXmlReader, aMessageInfo);
     if (aXmlReader.IsStartElement("DbtrAgt"))
     {
         this.m_tAgtBIC = SepaUtil.ReadAgtBIC(aXmlReader, "DbtrAgt");
         this.m_nOriginalMessageType = SepaMessageType.CreditTransferPaymentInitiation;
     }
     else
     {
         this.m_tAgtBIC = SepaUtil.ReadAgtBIC(aXmlReader, "CdtrAgt");
         this.m_nOriginalMessageType = SepaMessageType.DirectDebitPaymentInitiation;
     }
     aXmlReader.ReadEndElement();
     aXmlReader.ReadStartElement("OrgnlGrpInfAndSts");
     this.m_sOrgnlMsgId = aXmlReader.ReadElementString("OrgnlMsgId");
     if (aXmlReader.ReadElementString("OrgnlMsgNmId") != this.OriginalMessageNameIdentification)
     {
         throw new XmlException("Inconsistent OrgnlMsgNmId");
     }
     while (aXmlReader.NodeType != XmlNodeType.EndElement)
     {
         aXmlReader.Skip();
     }
     aXmlReader.ReadEndElement();
     while (aXmlReader.IsStartElement("OrgnlPmtInfAndSts"))
     {
         SepaOriginalPaymentInformation item = new SepaOriginalPaymentInformation();
         item.ReadXml(aXmlReader, aMessageInfo);
         this.m_vOrgnlPmtInfs.Add(item);
     }
 }
Exemple #25
0
        public static string Capture(string sPaperIBAN)
        {
            sPaperIBAN = SepaUtil.Trim(sPaperIBAN);
            if ((sPaperIBAN == null) || (sPaperIBAN == ""))
            {
                return(null);
            }
            sPaperIBAN = sPaperIBAN.ToUpper(CultureInfo.InvariantCulture);
            if (sPaperIBAN.StartsWith("IBAN"))
            {
                sPaperIBAN = sPaperIBAN.Substring(4);
            }
            StringBuilder builder = new StringBuilder(0x22);

            for (int i = 0; i < sPaperIBAN.Length; i++)
            {
                char ch = sPaperIBAN[i];
                if (((ch >= '0') && (ch <= '9')) || ((ch >= 'A') && (ch <= 'Z')))
                {
                    builder.Append(ch);
                }
            }
            return(builder.ToString());
        }
Exemple #26
0
 public SepaIBAN(string sCountryCode, string sBankCode, string sAcctNo)
 {
     if ((sCountryCode == null) || (sAcctNo == null))
     {
         throw new ArgumentNullException();
     }
     if (sBankCode == null)
     {
         sBankCode = "";
     }
     if ((((sCountryCode.Length != 2) || !SepaUtil.IsAlpha(sCountryCode)) || (!SepaUtil.IsAlphaNumeric(sBankCode) || (sAcctNo.Length == 0))) || (!SepaUtil.IsAlphaNumeric(sAcctNo) || ((sBankCode.Length + sAcctNo.Length) > 30)))
     {
         throw new ArgumentException();
     }
     if (sCountryCode == "DE")
     {
         if ((!SepaUtil.IsNumeric(sBankCode) || (sBankCode.Length != 8)) || (!SepaUtil.IsNumeric(sAcctNo) || (sAcctNo.Length > 10)))
         {
             throw new ArgumentException();
         }
         sAcctNo = sAcctNo.PadLeft(10, '0');
     }
     this.f_sIBAN = SepaUtil.BuildID(sCountryCode, sBankCode + sAcctNo);
 }
 protected override void OnReadXml(XmlReader aXmlReader, SepaMessageInfo aMessageInfo)
 {
     aXmlReader.ReadStartElement("Tp");
     aXmlReader.ReadStartElement("CdOrPrtry");
     this.m_sTpCd = aXmlReader.ReadElementString("Cd");
     aXmlReader.ReadEndElement();
     if (aXmlReader.IsStartElement("SubTp"))
     {
         aXmlReader.Skip();
     }
     aXmlReader.ReadEndElement();
     if (aXmlReader.IsStartElement("CdtLine"))
     {
         aXmlReader.Skip();
     }
     this.m_aAmt.ReadXml(aXmlReader, "Amt");
     aXmlReader.ReadStartElement("Dt");
     this.m_dtDt = SepaUtil.ReadDtOrDtTmXml(aXmlReader);
     aXmlReader.ReadEndElement();
     while (aXmlReader.IsStartElement("Avlbty"))
     {
         aXmlReader.Skip();
     }
 }
Exemple #28
0
 protected override void OnWriteXml(XmlWriter aXmlWriter, SepaMessageInfo aMessageInfo)
 {
     if (!this.m_tBIC.IsNull)
     {
         aXmlWriter.WriteElementString("BIC", this.m_tBIC.BIC);
     }
     if ((this.m_sClrSysMmbId != null) && (this.m_sClrSysMmbId != ""))
     {
         aXmlWriter.WriteStartElement("ClrSysMmbId");
         aXmlWriter.WriteStartElement("ClrSysId");
         aXmlWriter.WriteElementString("Cd", "DEBLZ");
         aXmlWriter.WriteEndElement();
         aXmlWriter.WriteElementString("MmbId", this.m_sClrSysMmbId);
         aXmlWriter.WriteEndElement();
     }
     if ((this.m_sNm != null) && (this.m_sNm != ""))
     {
         aXmlWriter.WriteElementString("Nm", this.m_sNm);
     }
     if ((this.m_sVatId != null) && (this.m_sVatId != ""))
     {
         SepaUtil.WriteOthrId(aXmlWriter, this.m_sVatId, "UmsStId");
     }
 }
Exemple #29
0
 public SepaPaymentInformation() : base("PmtInf")
 {
     this.m_sPmtInfId = SepaUtil.GenerateIdentification("P");
     this.m_vTxInfs   = new SepaTransactionInformations(this);
 }
        protected override void OnReadXml(XmlReader aXmlReader, SepaMessageInfo aMessageInfo)
        {
            string str2;

            if (aMessageInfo.MessageType != SepaMessageType.DirectDebitPaymentInitiation)
            {
                throw new ArgumentException();
            }
            base.ReadPmtIdXml(aXmlReader);
            base.ReadInstdAmtXml(aXmlReader);
            if (aXmlReader.IsStartElement("ChrgBr"))
            {
                aXmlReader.Skip();
            }
            aXmlReader.ReadStartElement("DrctDbtTx");
            aXmlReader.ReadStartElement("MndtRltdInf");
            this.m_sMndtId         = aXmlReader.ReadElementString("MndtId");
            this.m_dtMndtDtOfSgntr = SepaUtil.ReadDtXml(aXmlReader, "DtOfSgntr");
            bool flag = false;

            if (aXmlReader.IsStartElement("AmdmntInd"))
            {
                flag = XmlConvert.ToBoolean(aXmlReader.ReadElementString());
            }
            if (flag)
            {
                aXmlReader.ReadStartElement("AmdmntInfDtls");
                if (aXmlReader.IsStartElement("OrgnlMndtId"))
                {
                    this.m_sOrgnlMndtId = aXmlReader.ReadElementString();
                }
                if (aXmlReader.IsStartElement("OrgnlCdtrSchmeId"))
                {
                    aXmlReader.ReadStartElement();
                    if (aXmlReader.IsStartElement("Nm"))
                    {
                        this.m_sOrgnlCdtrNm = aXmlReader.ReadElementString();
                    }
                    if (aXmlReader.IsStartElement("Id"))
                    {
                        this.m_sOrgnlCdtrSchmeId = SepaUtil.ReadSepaIdXml(aXmlReader);
                    }
                    aXmlReader.ReadEndElement();
                }
                if (aXmlReader.IsStartElement("OrgnlDbtrAcct"))
                {
                    string str;
                    this.m_tOrgnlDbtrAcctIBAN = SepaUtil.ReadAcctXml(aXmlReader, "OrgnlDbtrAcct", out str);
                }
                if (aXmlReader.IsStartElement("OrgnlDbtrAgt"))
                {
                    aXmlReader.Skip();
                    this.m_fSMNDA = true;
                }
                aXmlReader.ReadEndElement();
            }
            if (aXmlReader.IsStartElement("ElctrncSgntr"))
            {
                aXmlReader.Skip();
            }
            aXmlReader.ReadEndElement();
            if (aXmlReader.IsStartElement("CdtrSchmeId"))
            {
                this.m_sCdtrSchmeIdRead = SepaUtil.ReadCdtrSchmeIdXml(aXmlReader);
            }
            aXmlReader.ReadEndElement();
            if (aXmlReader.IsStartElement("UltmtCdtr"))
            {
                aXmlReader.Skip();
            }
            this.m_tDbtrAgtBIC = SepaUtil.ReadAgtBIC(aXmlReader, "DbtrAgt");
            this.m_aDbtr.ReadXml(aXmlReader, aMessageInfo);
            this.m_tDbtrAcctIBAN = SepaUtil.ReadAcctXml(aXmlReader, "DbtrAcct", out str2);
            if (aXmlReader.IsStartElement("UltmtDbtr"))
            {
                this.m_aUltmtDbtr.ReadXml(aXmlReader, aMessageInfo);
            }
            base.ReadPurpXml(aXmlReader);
            base.ReadRmtInfXml(aXmlReader);
        }