protected override void OnReadXml(XmlReader aXmlReader, SepaMessageInfo aMessageInfo) { this.m_sOrgnlPmtInfId = aXmlReader.ReadElementString("OrgnlPmtInfId"); if (aXmlReader.IsStartElement("OrgnlNbOfTxs")) { aXmlReader.Skip(); } if (aXmlReader.IsStartElement("OrgnlCtrlSum")) { aXmlReader.Skip(); } if (aXmlReader.IsStartElement("PmtInfSts")) { if (aXmlReader.ReadElementString() != "RJCT") { throw new XmlException("Unsupported PmtInfSts"); } while (aXmlReader.IsStartElement("StsRsnInf")) { SepaStatusReasonInformation item = new SepaStatusReasonInformation(); item.ReadXml(aXmlReader, aMessageInfo); this.m_vStsRsnInfs.Add(item); } } while (aXmlReader.IsStartElement("TxInfAndSts")) { SepaOriginalTransactionInformation information2 = new SepaOriginalTransactionInformation(); information2.ReadXml(aXmlReader, aMessageInfo); this.m_vTxInfAndSts.Add(information2); } }
/// <summary> /// /// </summary> /// <param name="aMessageInfo"></param> /// <param name="aPaymentMessage"></param> /// <param name="aPaymentInformation"></param> /// <param name="aTransactionInformation"></param> internal virtual void Update( SepaMessageInfo aMessageInfo, SepaPaymentInitiation aPaymentMessage, SepaPaymentInformation aPaymentInformation, SepaTransactionInformation aTransactionInformation) { // not abstract because of Designer! }
protected override void OnWriteXml(XmlWriter aXmlWriter, SepaMessageInfo aMessageInfo) { aXmlWriter.WriteElementString("OrgnlPmtInfId", this.m_sOrgnlPmtInfId); if (this.m_vStsRsnInfs.Count > 0) { aXmlWriter.WriteElementString("PmtInfSts", "RJCT"); this.m_vStsRsnInfs.WriteXml(aXmlWriter, aMessageInfo); } this.m_vTxInfAndSts.WriteXml(aXmlWriter, aMessageInfo); }
public SepaDocument(SepaMessageInfo aMessageInfo, SepaMessage aMessage) { this.m_aXmlEncoding = new UTF8Encoding(false); if (aMessageInfo == null) { throw new ArgumentNullException(); } this.MessageInfo = aMessageInfo; this.Message = aMessage; }
void CreateNewSepaDocument_SAVE(string _sSequenceType) { SepaDirectDebitGroupHeader m_aGroupHeader; SepaMessageInfo m_aSepaMessageInfo; OrganisationVO myCurrentOrganisationVO; OrganisationBO myCurrentOrganisationBO; SepaPaymentInformationVO myPaymentInformationVO; SepaDirectDebitRawDataBO mySepaDirectDebitRawDataBO; SepaDirectDebitRawDataVO [] mySepaDirectDebitRawDataVO; SepaDirectDebitTransactionInformation mySepaDirectDebitTransactionInformation; myCurrentOrganisationBO = new OrganisationBO(); myCurrentOrganisationVO = myCurrentOrganisationBO.getOrganisationById(m_CurrentOrganisation); mySepaDirectDebitRawDataBO = new SepaDirectDebitRawDataBO(m_CurrentOrganisation); mySepaDirectDebitRawDataVO = mySepaDirectDebitRawDataBO.getDirectDebitRawDataById(_sSequenceType); //Creation of the Sepa Document //Group Header m_aGroupHeader = new SepaDirectDebitGroupHeader(); m_aGroupHeader.MessageIdentification = mySepaDirectDebitRawDataVO[1].MessageID; m_aGroupHeader.CreationDateTime = mySepaDirectDebitRawDataVO[1].CreationDateTime; m_aGroupHeader.NumberOfTransactions = int.Parse(mySepaDirectDebitRawDataBO.getNumberOfTransactions(_sSequenceType).ToString()); //Kontrollsumme im Groupheader als Summe aus der Datenbank ermitteln m_aGroupHeader.ControlSum = (decimal) GetControlSumFromDBTable(_sSequenceType); m_aGroupHeader.InitiatingPartyName = mySepaDirectDebitRawDataVO[1].InitiatingPartyname; m_aGroupHeader.InitiatingPartyId = mySepaDirectDebitRawDataVO[1].CreditorIdentification; m_aSepaDocument = null; m_aSepaMessageInfo = SepaMessageInfo.Create(SepaWellKnownMessageInfos.Pain_008_003_02); //Payment Information //myPaymentInformationBO = new SepaPaymentInformationBO(m_CurrentOrganisation, m_CurrentDirectDebit); //myPaymentInformationVO = myPaymentInformationBO.getPaymentInformationById(m_CurrentOrganisation); myPaymentInformationVO = new SepaPaymentInformationVO(); myPaymentInformationVO.PaymentInformationIdentification = mySepaDirectDebitRawDataVO[1].PaymentInformationID; myPaymentInformationVO.PaymentMethod = "DD"; myPaymentInformationVO.BatchBooking = "true"; myPaymentInformationVO.NumberOfTransactions = m_aGroupHeader.NumberOfTransactions; //Summe der Einzeltransaktionen ermitteln decimal dControlSum = 0; for (int i = 0; i < myPaymentInformationVO.NumberOfTransactions; i++) { dControlSum = dControlSum + Convert.ToDecimal(mySepaDirectDebitRawDataVO[i].InstructedAmount); } //Stimmt die Summe der Einzeltransaktionen mit der Kontrollsumme aus der Datenbank überein? Debug.Assert(m_aGroupHeader.ControlSum == dControlSum); myPaymentInformationVO.ControlSum = dControlSum; myPaymentInformationVO.ServiceLevelCode = "SEPA"; myPaymentInformationVO.LocalInstrumentCode = "COR1"; myPaymentInformationVO.SequenceType = "RCUR"; //myPaymentInformationVO.RequestedCollectionDate = mySepaDirectDebitRawDataVO[1].RequestedCollectionDate; //Datenfeld RequestedCollectionDate fehlt im DTA-Input myPaymentInformationVO.RequestedCollectionDate = mySepaDirectDebitRawDataVO[1].CreationDateTime; myPaymentInformationVO.CreditorName = mySepaDirectDebitRawDataVO[1].CreditorName; myPaymentInformationVO.CreditorAccountIBAN = new SepaIBAN(mySepaDirectDebitRawDataVO[1].CreditorAccountIBAN.TrimEnd()); myPaymentInformationVO.CreditorAccountCurrency = "EUR"; myPaymentInformationVO.CreditorAgentBIC = new SepaBIC(mySepaDirectDebitRawDataVO[1].CreditorAgentBIC.TrimEnd()); myPaymentInformationVO.ChargeBearer = "SLEV"; myPaymentInformationVO.CreditorSchemeIdentification = mySepaDirectDebitRawDataVO[1].CreditorIdentification.ToString(); // SchemeName/Priority fehlen noch #region BuildXmlStructure XmlWriterSettings settings = new XmlWriterSettings(); settings.Indent = true; settings.NewLineChars = "\n"; using (XmlWriter writer = XmlWriter.Create("c:\\tmp\\test.xml", settings)) { //Namespace and Schema location writer.WriteStartDocument(); writer.WriteStartElement("Document", m_aSepaMessageInfo.XmlNamespace); writer.WriteAttributeString("xmlns", "xsi", null, "http://www.w3.org/2001/XMLSchema-instance"); // writer.WriteAttributeString("schemaLocation", "http://www.w3.org/2001/XMLSchema-instance", m_aSepaMessageInfo.XmlNamespace + " " + m_aSepaMessageInfo.XmlSchemaLocation); writer.WriteAttributeString("schemaLocation", "http://www.w3.org/2001/XMLSchema-instance", m_aSepaMessageInfo.XmlNamespace + " " + "C:\\Users\\Peter\\Documents\\SEPA\\pain.008.003.02.xsd"); writer.WriteStartElement("CstmrDrctDbtInitn"); //Groupheader writer.WriteStartElement("GrpHdr"); writer.WriteElementString("MsgId", m_aGroupHeader.MessageIdentification); writer.WriteElementString("CreDtTm", m_aGroupHeader.CreationDateTime.ToString()); writer.WriteElementString("NbOfTxs", m_aGroupHeader.NumberOfTransactions.ToString()); writer.WriteElementString("CtrlSum", GetControlSumFromDBTable(_sSequenceType).ToString().Replace(',','.')); writer.WriteStartElement("InitgPty"); writer.WriteElementString("Nm", m_aGroupHeader.InitiatingPartyName); writer.WriteEndElement(); writer.WriteEndElement(); //End Groupheader //PaymentInformation writer.WriteStartElement("PmtInf"); writer.WriteElementString("PmtInfId", myPaymentInformationVO.PaymentInformationIdentification); writer.WriteElementString("PmtMtd", myPaymentInformationVO.PaymentMethod); writer.WriteElementString("BtchBookg", myPaymentInformationVO.BatchBooking); writer.WriteElementString("NbOfTxs", myPaymentInformationVO.NumberOfTransactions.ToString()); writer.WriteElementString("CtrlSum", myPaymentInformationVO.ControlSum.ToString().Replace(',','.')); writer.WriteStartElement("PmtTpInf"); writer.WriteStartElement("SvcLvl"); writer.WriteElementString("Cd", myPaymentInformationVO.ServiceLevelCode); writer.WriteEndElement(); writer.WriteStartElement("LclInstrm"); writer.WriteElementString("Cd", myPaymentInformationVO.LocalInstrumentCode); writer.WriteEndElement(); writer.WriteElementString("SeqTp", myPaymentInformationVO.SequenceType); writer.WriteEndElement(); writer.WriteElementString("ReqdColltnDt", myPaymentInformationVO.RequestedCollectionDate.ToString()); writer.WriteStartElement("Cdtr"); writer.WriteElementString("Nm", myPaymentInformationVO.CreditorName); writer.WriteEndElement(); writer.WriteStartElement("CdtrAcct"); writer.WriteStartElement("Id"); writer.WriteElementString("IBAN", myPaymentInformationVO.CreditorAccountIBAN.ToString()); writer.WriteEndElement(); writer.WriteElementString("Ccy", myPaymentInformationVO.CreditorAccountCurrency); writer.WriteEndElement(); writer.WriteStartElement("CdtrAgt"); writer.WriteStartElement("FinInstnId"); writer.WriteElementString("BIC", myPaymentInformationVO.CreditorAgentBIC.ToString()); writer.WriteEndElement(); writer.WriteEndElement(); writer.WriteElementString("ChrgBr", myPaymentInformationVO.ChargeBearer); writer.WriteStartElement("CdtrSchmeId"); writer.WriteStartElement("Id"); writer.WriteStartElement("PrvtId"); writer.WriteStartElement("Othr"); writer.WriteElementString("Id", myPaymentInformationVO.CreditorSchemeIdentification); writer.WriteEndElement(); writer.WriteEndElement(); writer.WriteEndElement(); writer.WriteEndElement(); writer.WriteEndElement(); //End PaymentInformation //DirectDebitTransactionInformation writer.WriteStartElement("DrctDbtTxInf"); for (int i = 0; i < myPaymentInformationVO.NumberOfTransactions; i++) { writer.WriteStartElement("PmtId"); writer.WriteElementString("InstrId", mySepaDirectDebitRawDataVO[i].InstructionID.ToString()); writer.WriteElementString("EndToEndId", mySepaDirectDebitRawDataVO[i].EndToEndID.ToString()); writer.WriteEndElement(); writer.WriteStartElement("InstrAmt"); writer.WriteAttributeString("Ccy", "EUR"); writer.WriteString(mySepaDirectDebitRawDataVO[i].InstructedAmount.ToString().Replace(',','.')); writer.WriteEndElement(); writer.WriteElementString("ChrgBr", "SLEV"); writer.WriteStartElement("DrctDbtTx"); writer.WriteStartElement("MndtRltdInf"); writer.WriteElementString("MndtId", mySepaDirectDebitRawDataVO[i].MandateID); writer.WriteElementString("DtOfSgntr", mySepaDirectDebitRawDataVO[i].DateOfSignature); writer.WriteEndElement(); writer.WriteStartElement("CdtrSchmeId"); writer.WriteStartElement("Id"); writer.WriteStartElement("PrvtId"); writer.WriteStartElement("Othr"); writer.WriteElementString("Id", myPaymentInformationVO.CreditorSchemeIdentification); writer.WriteEndElement(); writer.WriteEndElement(); writer.WriteEndElement(); writer.WriteEndElement(); writer.WriteEndElement(); } writer.WriteEndElement(); //End DirectDebitTransactionInformation writer.WriteEndElement(); //End CstmrDrctDbtInitn writer.WriteEndElement(); //End Document writer.WriteEndDocument(); //End Namespace and Schema location } #endregion BuildXmlStructure for (int i = 0; i < mySepaDirectDebitRawDataVO.Length; i++) { mySepaDirectDebitTransactionInformation = new SepaDirectDebitTransactionInformation(); mySepaDirectDebitTransactionInformation.EndToEndId = mySepaDirectDebitRawDataVO[i].EndToEndID; mySepaDirectDebitTransactionInformation.Amount = decimal.Parse(mySepaDirectDebitRawDataVO[i].InstructedAmount); mySepaDirectDebitTransactionInformation.MandateIdentification = mySepaDirectDebitRawDataVO[i].MandateID; } m_CurrentControlSumFromDBTable = GetControlSumFromDBTable(_sSequenceType); DirectDebitDetailsDataGridView.DataSource = mySepaDirectDebitRawDataVO; showDirectDebitDetailsList(); //Dialog-Controls aktualisieren // msgIDLabel.Text = m_aSepaDoc.Message.MessageIdentification; paymentInformationCreditorNameTextBox.Text = myCurrentOrganisationVO.Name; paymentInformationCreditorBicTextBox.Text = myCurrentOrganisationVO.BIC; paymentInformationCreditorIbanTextBox.Text = myCurrentOrganisationVO.IBAN; paymentInformationCreditorSchemeIdTextBox.Text = myCurrentOrganisationVO.GläubigerID; controlSumOutputLabel.Text = m_CurrentControlSumFromDBTable.ToString(); //bindDirectDebitGridView(m_CurrentOrganisation, directDebitHistoryComboBox.SelectedItem.ToString()); }
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); }
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); }
public SepaDocument(SepaMessageInfo aMessageInfo) { }