Пример #1
0
        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);
        }
Пример #2
0
 protected override void OnWriteXml(XmlWriter aXmlWriter, SepaMessageInfo aMessageInfo)
 {
     if (aMessageInfo.MessageType != SepaMessageType.DirectDebitPaymentInitiation)
     {
         throw new ArgumentException();
     }
     base.WritePmtIdXml(aXmlWriter);
     base.WriteInstdAmtXml(aXmlWriter);
     aXmlWriter.WriteStartElement("DrctDbtTx");
     aXmlWriter.WriteStartElement("MndtRltdInf");
     aXmlWriter.WriteElementString("MndtId", this.m_sMndtId);
     SepaUtil.WriteDtXml(aXmlWriter, "DtOfSgntr", this.m_dtMndtDtOfSgntr);
     if ((((this.m_sOrgnlMndtId != null) && (this.m_sOrgnlMndtId != "")) || ((this.m_sOrgnlCdtrNm != null) && (this.m_sOrgnlCdtrNm != ""))) || (((this.m_sOrgnlCdtrSchmeId != null) && (this.m_sOrgnlCdtrSchmeId != "")) || (!this.m_tOrgnlDbtrAcctIBAN.IsNull || this.m_fSMNDA)))
     {
         aXmlWriter.WriteElementString("AmdmntInd", "true");
         aXmlWriter.WriteStartElement("AmdmntInfDtls");
         if ((this.m_sOrgnlMndtId != null) && (this.m_sOrgnlMndtId != ""))
         {
             aXmlWriter.WriteElementString("OrgnlMndtId", this.m_sOrgnlMndtId);
         }
         if (((this.m_sOrgnlCdtrNm != null) && (this.m_sOrgnlCdtrNm != "")) || ((this.m_sOrgnlCdtrSchmeId != null) && (this.m_sOrgnlCdtrSchmeId != "")))
         {
             aXmlWriter.WriteStartElement("OrgnlCdtrSchmeId");
             if ((this.m_sOrgnlCdtrNm != null) && (this.m_sOrgnlCdtrNm != ""))
             {
                 aXmlWriter.WriteElementString("Nm", this.m_sOrgnlCdtrNm);
             }
             if ((this.m_sOrgnlCdtrSchmeId != null) && (this.m_sOrgnlCdtrSchmeId != ""))
             {
                 SepaUtil.WriteSepaIdXml(aXmlWriter, this.m_sOrgnlCdtrSchmeId, aMessageInfo.Version == 1);
             }
             aXmlWriter.WriteEndElement();
         }
         if (!this.m_tOrgnlDbtrAcctIBAN.IsNull)
         {
             SepaUtil.WriteAcctXml(aXmlWriter, "OrgnlDbtrAcct", this.m_tOrgnlDbtrAcctIBAN, null);
         }
         if (this.m_fSMNDA)
         {
             aXmlWriter.WriteStartElement("OrgnlDbtrAgt");
             aXmlWriter.WriteStartElement("FinInstnId");
             aXmlWriter.WriteStartElement("Othr");
             aXmlWriter.WriteElementString("Id", "SMNDA");
             aXmlWriter.WriteEndElement();
             aXmlWriter.WriteEndElement();
             aXmlWriter.WriteEndElement();
         }
         aXmlWriter.WriteEndElement();
     }
     else
     {
         aXmlWriter.WriteElementString("AmdmntInd", "false");
     }
     aXmlWriter.WriteEndElement();
     if (aMessageInfo.Version == 1)
     {
         SepaDirectDebitPaymentInformation paymentInformation = (SepaDirectDebitPaymentInformation)base.PaymentInformation;
         if (paymentInformation == null)
         {
             throw new InvalidOperationException();
         }
         string creditorSchemeIdentification = paymentInformation.CreditorSchemeIdentification;
         switch (creditorSchemeIdentification)
         {
         case null:
         case "":
             throw new InvalidOperationException();
         }
         SepaUtil.WriteCdtrSchmeIdXml(aXmlWriter, creditorSchemeIdentification, true);
     }
     aXmlWriter.WriteEndElement();
     SepaUtil.WriteAgtBIC(aXmlWriter, "DbtrAgt", this.m_tDbtrAgtBIC);
     this.m_aDbtr.WriteXml(aXmlWriter, aMessageInfo);
     SepaUtil.WriteAcctXml(aXmlWriter, "DbtrAcct", this.m_tDbtrAcctIBAN, null);
     if (!this.m_aUltmtDbtr.IsEmpty())
     {
         this.m_aUltmtDbtr.WriteXml(aXmlWriter, aMessageInfo);
     }
     if (aMessageInfo.XmlNamespace != "urn:sepade:xsd:pain.008.001.01")
     {
         base.WritePurpXml(aXmlWriter);
     }
     base.WriteRmtInfXml(aXmlWriter);
 }