/// <summary> /// Delete terminated transfer /// </summary> public static async Task <string> Init_HKCSA(FinTsClient client, string OrderId, string Receiver, string ReceiverIBAN, string ReceiverBIC, decimal Amount, string Usage, DateTime ExecutionDay) { Log.Write("Starting job HKCSA: Modify terminated transfer"); client.SEGNUM = SEGNUM.SETInt(3); var connectionDetails = client.ConnectionDetails; string segments = "HKCSA:" + client.SEGNUM + ":1+" + connectionDetails.Iban + ":" + connectionDetails.Bic + "+urn?:iso?:std?:iso?:20022?:tech?:xsd?:pain.001.001.03+@@"; var sepaMessage = pain00100103.Create(connectionDetails.AccountHolder, connectionDetails.Iban, connectionDetails.Bic, Receiver, ReceiverIBAN, ReceiverBIC, Amount, Usage, ExecutionDay).Replace("'", ""); segments = segments.Replace("@@", "@" + sepaMessage.Length + "@") + sepaMessage; segments += "+" + OrderId; segments += "'"; if (Helper.IsTANRequired("HKCSA")) { client.SEGNUM = SEGNUM.SETInt(4); segments = HKTAN.Init_HKTAN(client, segments, "HKCSA"); } string message = FinTSMessage.Create(client, client.HNHBS, client.HNHBK, segments, client.HIRMS); var TAN = await FinTSMessage.Send(client, message); Helper.Parse_Message(client, TAN); return(TAN); }
/// <summary> /// Collect /// </summary> public static string Init_HKDSE(ConnectionDetails connectionDetails, string Payer, string PayerIBAN, string PayerBIC, decimal Amount, string Usage, DateTime SettlementDate, string MandateNumber, DateTime MandateDate, string CreditorIDNumber) { Log.Write("Starting job HKDSE: Collect money"); SEG.NUM = SEGNUM.SETInt(4); string segments = "HKDSE:" + SEG.NUM + ":1+" + connectionDetails.IBAN + ":" + connectionDetails.BIC + "+urn?:iso?:std?:iso?:20022?:tech?:xsd?:pain.008.002.02+@@"; var message = pain00800202.Create(connectionDetails.AccountHolder, connectionDetails.IBAN, connectionDetails.BIC, Payer, PayerIBAN, PayerBIC, Amount, Usage, SettlementDate, MandateNumber, MandateDate, CreditorIDNumber); segments = segments.Replace("@@", "@" + (message.Length - 1) + "@") + message; if (Helper.IsTANRequired("HKDSE")) { SEG.NUM = SEGNUM.SETInt(4); segments = HKTAN.Init_HKTAN(segments); } var TAN = FinTSMessage.Send(connectionDetails.Url, FinTSMessage.Create(connectionDetails.HBCIVersion, Segment.HNHBS, Segment.HNHBK, connectionDetails.BlzPrimary, connectionDetails.UserId, connectionDetails.Pin, Segment.HISYN, segments, Segment.HIRMS, SEG.NUM)); Segment.HITAN = Helper.Parse_String(Helper.Parse_String(TAN, "HITAN", "'").Replace("?+", "??"), "++", "+").Replace("??", "?+"); Helper.Parse_Message(TAN); return(TAN); }
/// <summary> /// Collective transfer terminated /// </summary> public static string Init_HKCME(int BLZ, string Accountholder, string AccountholderIBAN, string AccountholderBIC, List <pain00100203_ct_data> PainData, string NumberofTransactions, decimal TotalAmount, string ExecutionDay, string URL, int HBCIVersion, string UserID, string PIN) { Log.Write("Starting job HKCME: Collective transfer money terminated"); var TotalAmount_ = TotalAmount.ToString().Replace(",", "."); string segments = "HKCME:" + SEGNUM.SETVal(3) + ":1+" + AccountholderIBAN + ":" + AccountholderBIC + TotalAmount_ + ":EUR++" + " + urn?:iso?:std?:iso?:20022?:tech?:xsd?:pain.001.002.03+@@"; var message = pain00100203.Create(Accountholder, AccountholderIBAN, AccountholderBIC, PainData, NumberofTransactions, TotalAmount, ExecutionDay); segments = segments.Replace("@@", "@" + (message.Length - 1) + "@") + message; segments = segments + "HKTAN:" + SEGNUM.SETVal(4) + ":" + Segment.HITANS + "'"; SEG.NUM = SEGNUM.SETInt(4); var TAN = FinTSMessage.Send(URL, FinTSMessage.Create(HBCIVersion, Segment.HNHBS, Segment.HNHBK, BLZ, UserID, PIN, Segment.HISYN, segments, Segment.HIRMS, SEG.NUM)); Segment.HITAN = Helper.Parse_String(Helper.Parse_String(TAN, "HITAN", "'").Replace("?+", "??"), "++", "+").Replace("??", "?+"); Helper.Parse_Message(TAN); return(TAN); }
/// <summary> /// Delete banker's order /// </summary> public static async Task <String> Init_HKCDL(FinTsClient client, string OrderId, string Receiver, string ReceiverIBAN, string ReceiverBIC, decimal Amount, string Usage, DateTime FirstTimeExecutionDay, TimeUnit timeUnit, string Rota, int ExecutionDay, DateTime?LastExecutionDay) { Log.Write("Starting job HKCDL: Delete bankers order"); client.SEGNUM = SEGNUM.SETInt(3); var connectionDetails = client.ConnectionDetails; string segments = "HKCDL:" + client.SEGNUM + ":1+" + connectionDetails.Iban + ":" + connectionDetails.Bic + "+urn?:iso?:std?:iso?:20022?:tech?:xsd?:pain.001.001.03+@@"; var sepaMessage = pain00100103.Create(connectionDetails.AccountHolder, connectionDetails.Iban, connectionDetails.Bic, Receiver, ReceiverIBAN, ReceiverBIC, Amount, Usage, new DateTime(1999, 1, 1)).Replace("'", ""); segments = segments.Replace("@@", "@" + sepaMessage.Length + "@") + sepaMessage; segments += "++" + OrderId + "+" + FirstTimeExecutionDay.ToString("yyyyMMdd") + ":" + (char)timeUnit + ":" + Rota + ":" + ExecutionDay; if (LastExecutionDay != null) { segments += ":" + LastExecutionDay.Value.ToString("yyyyMMdd"); } segments += "'"; if (Helper.IsTANRequired("HKCDL")) { client.SEGNUM = SEGNUM.SETInt(4); segments = HKTAN.Init_HKTAN(client, segments, "HKCDL"); } string message = FinTSMessage.Create(client, client.HNHBS, client.HNHBK, segments, client.HIRMS); var TAN = await FinTSMessage.Send(client, message); Helper.Parse_Message(client, TAN); return(TAN); }
/// <summary> /// Collective collect /// </summary> public static string Init_HKDME(ConnectionDetails connectionDetails, DateTime SettlementDate, List <pain00800202_cc_data> PainData, string NumberofTransactions, decimal TotalAmount) { Log.Write("Starting job HKDME: Collective collect money"); SEG.NUM = SEGNUM.SETInt(3); var TotalAmount_ = TotalAmount.ToString().Replace(",", "."); string segments = "HKDME:" + SEG.NUM + ":2+" + connectionDetails.IBAN + ":" + connectionDetails.BIC + "+" + TotalAmount_ + ":EUR++" + "+urn?:iso?:std?:iso?:20022?:tech?:xsd?:pain.008.002.02+@@"; var message = pain00800202.Create(connectionDetails.AccountHolder, connectionDetails.IBAN, connectionDetails.BIC, SettlementDate, PainData, NumberofTransactions, TotalAmount); segments = segments.Replace("@@", "@" + (message.Length - 1) + "@") + message; if (Helper.IsTANRequired("HKDME")) { SEG.NUM = SEGNUM.SETInt(4); segments = HKTAN.Init_HKTAN(segments); } var TAN = FinTSMessage.Send(connectionDetails.Url, FinTSMessage.Create(connectionDetails.HBCIVersion, Segment.HNHBS, Segment.HNHBK, connectionDetails.BlzPrimary, connectionDetails.UserId, connectionDetails.Pin, Segment.HISYN, segments, Segment.HIRMS, SEG.NUM)); Segment.HITAN = Helper.Parse_String(Helper.Parse_String(TAN, "HITAN", "'").Replace("?+", "??"), "++", "+").Replace("??", "?+"); Helper.Parse_Message(TAN); return(TAN); }
/// <summary> /// Collect /// </summary> public static async Task <String> Init_HKDSE(FinTsClient client, string Payer, string PayerIBAN, string PayerBIC, decimal Amount, string Usage, DateTime SettlementDate, string MandateNumber, DateTime MandateDate, string CreditorIDNumber) { Log.Write("Starting job HKDSE: Collect money"); client.SEGNUM = SEGNUM.SETInt(4); var connectionDetails = client.ConnectionDetails; string segments = "HKDSE:" + client.SEGNUM + ":1+" + connectionDetails.Iban + ":" + connectionDetails.Bic + "+urn?:iso?:std?:iso?:20022?:tech?:xsd?:pain.008.002.02+@@"; var message = pain00800202.Create(connectionDetails.AccountHolder, connectionDetails.Iban, connectionDetails.Bic, Payer, PayerIBAN, PayerBIC, Amount, Usage, SettlementDate, MandateNumber, MandateDate, CreditorIDNumber); segments = segments.Replace("@@", "@" + (message.Length - 1) + "@") + message; if (Helper.IsTANRequired("HKDSE")) { client.SEGNUM = SEGNUM.SETInt(4); segments = HKTAN.Init_HKTAN(client, segments); } var TAN = await FinTSMessage.Send(client, FinTSMessage.Create(client, client.HNHBS, client.HNHBK, segments, client.HIRMS)); client.HITAN = Helper.Parse_String(Helper.Parse_String(TAN, "HITAN", "'").Replace("?+", "??"), "++", "+").Replace("??", "?+"); Helper.Parse_Message(client, TAN); return(TAN); }
/// <summary> /// Balance /// </summary> public static async Task <String> Init_HKSAL(FinTsClient client) { Log.Write("Starting job HKSAL: Request balance"); var connectionDetails = client.ConnectionDetails; string segments = string.Empty; client.SEGNUM = SEGNUM.SETInt(3); if (Convert.ToInt16(client.HISALS) >= 7) { segments = "HKSAL:" + client.SEGNUM + ":" + client.HISALS + "+" + connectionDetails.Iban + ":" + connectionDetails.Bic + "+N'"; } else { segments = "HKSAL:" + client.SEGNUM + ":" + client.HISALS + "+" + connectionDetails.Account + "::280:" + connectionDetails.Blz + "+N'"; } if (Helper.IsTANRequired("HKSAL")) { client.SEGNUM = SEGNUM.SETInt(4); segments = HKTAN.Init_HKTAN(client, segments); } string message = FinTSMessage.Create(client, client.HNHBS, client.HNHBK, segments, client.HIRMS); string response = await FinTSMessage.Send(client, message); client.HITAN = Helper.Parse_String(Helper.Parse_String(response, "HITAN", "'").Replace("?+", "??"), "++", "+").Replace("??", "?+"); Helper.Parse_Message(client, response); return(response); }
/// <summary> /// Rebooking /// </summary> public static string Init_HKCUM(ConnectionDetails connectionDetails, string Receiver, string ReceiverIBAN, string ReceiverBIC, decimal Amount, string Usage) { Log.Write("Starting job HKCUM: Rebooking money"); SEG.NUM = SEGNUM.SETInt(3); string segments = "HKCUM:" + SEG.NUM + ":1+" + connectionDetails.IBAN + ":" + connectionDetails.BIC + "+urn?:iso?:std?:iso?:20022?:tech?:xsd?:pain.001.002.03+@@"; var message = pain00100203.Create(connectionDetails.AccountHolder, connectionDetails.IBAN, connectionDetails.BIC, Receiver, ReceiverIBAN, ReceiverBIC, Amount, Usage, new DateTime(1999, 1, 1)); segments = segments.Replace("@@", "@" + (message.Length - 1) + "@") + message; if (Helper.IsTANRequired("HKCUM")) { SEG.NUM = SEGNUM.SETInt(4); segments = HKTAN.Init_HKTAN(segments); } var TAN = FinTSMessage.Send(connectionDetails.Url, FinTSMessage.Create(connectionDetails.HBCIVersion, Segment.HNHBS, Segment.HNHBK, connectionDetails.BlzPrimary, connectionDetails.UserId, connectionDetails.Pin, Segment.HISYN, segments, Segment.HIRMS, SEG.NUM)); Segment.HITAN = Helper.Parse_String(Helper.Parse_String(TAN, "HITAN", "'").Replace("?+", "??"), "++", "+").Replace("??", "?+"); Helper.Parse_Message(TAN); return(TAN); }
/// <summary> /// Collective transfer terminated /// </summary> public static async Task <String> Init_HKCME(FinTsClient client, List <Pain00100203CtData> PainData, string NumberofTransactions, decimal TotalAmount, DateTime ExecutionDay) { Log.Write("Starting job HKCME: Collective transfer money terminated"); var TotalAmount_ = TotalAmount.ToString().Replace(",", "."); client.SEGNUM = SEGNUM.SETInt(3); var connectionDetails = client.ConnectionDetails; string segments = "HKCME:" + client.SEGNUM + ":1+" + connectionDetails.Iban + ":" + connectionDetails.Bic + TotalAmount_ + ":EUR++" + " + urn?:iso?:std?:iso?:20022?:tech?:xsd?:pain.001.002.03+@@"; var painMessage = pain00100203.Create(connectionDetails.AccountHolder, connectionDetails.Iban, connectionDetails.Bic, PainData, NumberofTransactions, TotalAmount, ExecutionDay); segments = segments.Replace("@@", "@" + (painMessage.Length - 1) + "@") + painMessage; if (Helper.IsTANRequired("HKCME")) { client.SEGNUM = SEGNUM.SETInt(4); segments = HKTAN.Init_HKTAN(client, segments); } string message = FinTSMessage.Create(client, client.HNHBS, client.HNHBK, segments, client.HIRMS); var response = await FinTSMessage.Send(client, message); client.HITAN = Helper.Parse_String(Helper.Parse_String(response, "HITAN", "'").Replace("?+", "??"), "++", "+").Replace("??", "?+"); Helper.Parse_Message(client, response); return(response); }
/// <summary> /// Submit bankers order /// </summary> public static string Init_HKCDE(ConnectionDetails connectionDetails, string Receiver, string ReceiverIBAN, string ReceiverBIC, decimal Amount, string Usage, DateTime FirstTimeExecutionDay, TimeUnit timeUnit, string Rota, int ExecutionDay) { Log.Write("Starting job HKCDE: Submit bankers order"); SEG.NUM = SEGNUM.SETInt(3); string segments = "HKCDE:" + SEG.NUM + ":1+" + connectionDetails.IBAN + ":" + connectionDetails.BIC + "+urn?:iso?:std?:iso?:20022?:tech?:xsd?:pain.001.001.03+@@"; var sepaMessage = pain00100103.Create(connectionDetails.AccountHolder, connectionDetails.IBAN, connectionDetails.BIC, Receiver, ReceiverIBAN, ReceiverBIC, Amount, Usage, new DateTime(1999, 1, 1)).Replace("'", ""); segments = segments.Replace("@@", "@" + sepaMessage.Length + "@") + sepaMessage; segments += "+" + FirstTimeExecutionDay.ToString("yyyyMMdd") + ":" + (char)timeUnit + ":" + Rota + ":" + ExecutionDay + "'"; if (Helper.IsTANRequired("HKCDE")) { SEG.NUM = SEGNUM.SETInt(4); segments = HKTAN.Init_HKTAN(segments); } string message = FinTSMessage.Create(connectionDetails.HBCIVersion, Segment.HNHBS, Segment.HNHBK, connectionDetails.BlzPrimary, connectionDetails.UserId, connectionDetails.Pin, Segment.HISYN, segments, Segment.HIRMS, SEG.NUM); var response = FinTSMessage.Send(connectionDetails.Url, message); Segment.HITAN = Helper.Parse_String(Helper.Parse_String(response, "HITAN", "'").Replace("?+", "??"), "++", "+").Replace("??", "?+"); Helper.Parse_Message(response); return(response); }
/// <summary> /// Rebooking /// </summary> public static async Task <String> Init_HKCUM(FinTsClient client, string Receiver, string ReceiverIBAN, string ReceiverBIC, decimal Amount, string Usage) { Log.Write("Starting job HKCUM: Rebooking money"); client.SEGNUM = SEGNUM.SETInt(3); var connectionDetails = client.ConnectionDetails; string segments = "HKCUM:" + client.SEGNUM + ":1+" + connectionDetails.Iban + ":" + connectionDetails.Bic + "+urn?:iso?:std?:iso?:20022?:tech?:xsd?:pain.001.002.03+@@"; var message = pain00100203.Create(connectionDetails.AccountHolder, connectionDetails.Iban, connectionDetails.Bic, Receiver, ReceiverIBAN, ReceiverBIC, Amount, Usage, new DateTime(1999, 1, 1)); segments = segments.Replace("@@", "@" + (message.Length - 1) + "@") + message; if (Helper.IsTANRequired("HKCUM")) { client.SEGNUM = SEGNUM.SETInt(4); segments = HKTAN.Init_HKTAN(client, segments, "HKCUM"); } var TAN = await FinTSMessage.Send(client, FinTSMessage.Create(client, client.HNHBS, client.HNHBK, segments, client.HIRMS)); Helper.Parse_Message(client, TAN); return(TAN); }
/// <summary> /// Balance /// </summary> public static string Init_HKSAL(ConnectionDetails connectionDetails) { Log.Write("Starting job HKSAL: Request balance"); string segments = string.Empty; SEG.NUM = SEGNUM.SETInt(3); if (Convert.ToInt16(Segment.HISALS) >= 7) { segments = "HKSAL:" + SEG.NUM + ":" + Segment.HISALS + "+" + connectionDetails.IBAN + ":" + connectionDetails.BIC + "+N'"; } else { segments = "HKSAL:" + SEG.NUM + ":" + Segment.HISALS + "+" + connectionDetails.Account + "::280:" + connectionDetails.Blz + "+N'"; } if (Helper.IsTANRequired("HKSAL")) { SEG.NUM = SEGNUM.SETInt(4); segments = HKTAN.Init_HKTAN(segments); } string message = FinTSMessage.Create(connectionDetails.HBCIVersion, Segment.HNHBS, Segment.HNHBK, connectionDetails.BlzPrimary, connectionDetails.UserId, connectionDetails.Pin, Segment.HISYN, segments, Segment.HIRMS, SEG.NUM); string response = FinTSMessage.Send(connectionDetails.Url, message); Segment.HITAN = Helper.Parse_String(Helper.Parse_String(response, "HITAN", "'").Replace("?+", "??"), "++", "+").Replace("??", "?+"); Helper.Parse_Message(response); return(response); }
/// <summary> /// Collective collect /// </summary> public static async Task <String> Init_HKDME(FinTsClient client, DateTime SettlementDate, List <Pain00800202CcData> PainData, string NumberofTransactions, decimal TotalAmount) { Log.Write("Starting job HKDME: Collective collect money"); client.SEGNUM = SEGNUM.SETInt(3); var TotalAmount_ = TotalAmount.ToString().Replace(",", "."); var connectionDetails = client.ConnectionDetails; // TODO: Anscheinend wird totalAmount nur in der Version 2 unterstützt, diese hat jedoch nicht jede Bank implementiert. //string segments = "HKDME:" + client.SEGNUM + ":2+" + connectionDetails.Iban + ":" + connectionDetails.Bic + "+" + TotalAmount_ + ":EUR++" + "+urn?:iso?:std?:iso?:20022?:tech?:xsd?:pain.008.002.02+@@"; string segments = "HKDME:" + client.SEGNUM + ":1+" + connectionDetails.Iban + ":" + connectionDetails.Bic + "++" + "+urn?:iso?:std?:iso?:20022?:tech?:xsd?:pain.008.002.02+@@"; var message = pain00800202.Create(connectionDetails.AccountHolder, connectionDetails.Iban, connectionDetails.Bic, SettlementDate, PainData, NumberofTransactions, TotalAmount); segments = segments.Replace("@@", "@" + (message.Length - 1) + "@") + message; if (Helper.IsTANRequired("HKDME")) { client.SEGNUM = SEGNUM.SETInt(4); segments = HKTAN.Init_HKTAN(client, segments); } var TAN = await FinTSMessage.Send(client, FinTSMessage.Create(client, client.HNHBS, client.HNHBK, segments, client.HIRMS)); client.HITAN = Helper.Parse_String(Helper.Parse_String(TAN, "HITAN", "'").Replace("?+", "??"), "++", "+").Replace("??", "?+"); Helper.Parse_Message(client, TAN); return(TAN); }
/// <summary> /// Collective transfer /// </summary> public static string Init_HKCCM(ConnectionDetails connectionDetails, List <pain00100203_ct_data> PainData, string NumberofTransactions, decimal TotalAmount) { Log.Write("Starting job HKCCM: Collective transfer money"); SEG.NUM = SEGNUM.SETInt(3); var TotalAmount_ = TotalAmount.ToString().Replace(",", "."); string segments = "HKCCM:" + SEG.NUM + ":1+" + connectionDetails.IBAN + ":" + connectionDetails.BIC + TotalAmount_ + ":EUR++" + " + urn?:iso?:std?:iso?:20022?:tech?:xsd?:pain.001.002.03+@@"; var painMessage = pain00100203.Create(connectionDetails.AccountHolder, connectionDetails.IBAN, connectionDetails.BIC, PainData, NumberofTransactions, TotalAmount, new DateTime(1999, 1, 1)); segments = segments.Replace("@@", "@" + (painMessage.Length - 1) + "@") + painMessage; if (Helper.IsTANRequired("HKCCM")) { SEG.NUM = SEGNUM.SETInt(4); segments = HKTAN.Init_HKTAN(segments); } string message = FinTSMessage.Create(connectionDetails.HBCIVersion, Segment.HNHBS, Segment.HNHBK, connectionDetails.BlzPrimary, connectionDetails.UserId, connectionDetails.Pin, Segment.HISYN, segments, Segment.HIRMS, SEG.NUM); var response = FinTSMessage.Send(connectionDetails.Url, message); Segment.HITAN = Helper.Parse_String(Helper.Parse_String(response, "HITAN", "'").Replace("?+", "??"), "++", "+").Replace("??", "?+"); Helper.Parse_Message(response); return(response); }
/// <summary> /// Balance /// </summary> public static async Task <String> Init_HKSAL(FinTsClient client) { Log.Write("Starting job HKSAL: Request balance"); var connectionDetails = client.ConnectionDetails; AccountInformation activeAccount; if (client.activeAccount != null) { activeAccount = client.activeAccount; } else { activeAccount = new AccountInformation() { AccountNumber = connectionDetails.Account, AccountBankCode = connectionDetails.Blz.ToString(), AccountIban = connectionDetails.Iban, AccountBic = connectionDetails.Bic, } }; string segments = string.Empty; client.SEGNUM = SEGNUM.SETInt(3); if (Convert.ToInt16(client.HISALS) >= 7) { segments = "HKSAL:" + client.SEGNUM + ":" + client.HISALS + "+" + activeAccount.AccountIban + ":" + activeAccount.AccountBic + "+N'"; } else { segments = "HKSAL:" + client.SEGNUM + ":" + client.HISALS + "+" + activeAccount.AccountNumber + "::280:" + activeAccount.AccountBankCode + "+N'"; } if (Helper.IsTANRequired("HKSAL")) { client.SEGNUM = SEGNUM.SETInt(4); segments = HKTAN.Init_HKTAN(client, segments, "HKSAL"); } string message = FinTSMessage.Create(client, client.HNHBS, client.HNHBK, segments, client.HIRMS); string response = await FinTSMessage.Send(client, message); Helper.Parse_Message(client, response); return(response); } }
/// <summary> /// Account transactions in SWIFT-format /// </summary> /// <param name="connectionDetails">ConnectionDetails object must atleast contain the fields: Url, HBCIVersion, UserId, Pin, Blz, Account, IBAN, BIC</param> /// <param name="anonymous"></param> /// <param name="startDate"></param> /// <param name="endDate"></param> /// <returns> /// Transactions /// </returns> public static List <SWIFTStatement> Transactions(ConnectionDetails connectionDetails, bool anonymous, DateTime?startDate = null, DateTime?endDate = null) { var swiftStatements = new List <SWIFTStatement>(); if (Transaction.INI(connectionDetails, anonymous) == true) { var startDateStr = startDate?.ToString("yyyyMMdd"); var endDateStr = endDate?.ToString("yyyyMMdd"); // Success var BankCode = Transaction.HKKAZ(connectionDetails, startDateStr, endDateStr, null); var Transactions = string.Empty; if (BankCode.Contains("HNSHA")) { Transactions = ":20:STARTUMS" + Helper.Parse_String(BankCode, ":20:STARTUMS", "'HNSHA"); } else // -> Postbank finishes with HNHBS { Transactions = ":20:STARTUMS" + Helper.Parse_String(BankCode, ":20:STARTUMS", "'HNHBS"); } swiftStatements.AddRange(MT940.Serialize(Transactions, connectionDetails.Account)); string BankCode_ = BankCode; while (BankCode_.Contains("+3040::")) { Helper.Parse_Message(BankCode_); var Startpoint = new Regex(@"\+3040::[^:]+:(?<startpoint>[^']+)'").Match(BankCode_).Groups["startpoint"].Value; BankCode_ = Transaction.HKKAZ(connectionDetails, startDateStr, endDateStr, Startpoint); var Transactions_ = ":20:STARTUMS" + Helper.Parse_String(BankCode_, ":20:STARTUMS", "'HNSHA"); swiftStatements.AddRange(MT940.Serialize(Transactions_, connectionDetails.Account)); } return(swiftStatements); } else { Log.Write("Initialization/sync failed"); throw new Exception("Initialization/sync failed"); } }
/// <summary> /// Load prepaid /// </summary> public static string Init_HKPPD(ConnectionDetails connectionDetails, int MobileServiceProvider, string PhoneNumber, int Amount) { Log.Write("Starting job HKPPD: Load prepaid"); string segments = "HKPPD:" + SEGNUM.SETVal(3) + ":2+" + connectionDetails.IBAN + ":" + connectionDetails.BIC + "+" + MobileServiceProvider + "+" + PhoneNumber + "+" + Amount + ",:EUR'"; segments = HKTAN.Init_HKTAN(segments); SEG.NUM = SEGNUM.SETInt(4); var TAN = FinTSMessage.Send(connectionDetails.Url, FinTSMessage.Create(connectionDetails.HBCIVersion, Segment.HNHBS, Segment.HNHBK, connectionDetails.Blz, connectionDetails.UserId, connectionDetails.Pin, Segment.HISYN, segments, Segment.HIRMS, SEG.NUM)); Segment.HITAN = Helper.Parse_String(Helper.Parse_String(TAN, "HITAN", "'").Replace("?+", "??"), "++", "+").Replace("??", "?+"); Helper.Parse_Message(TAN); return(TAN); }
/// <summary> /// Transfer terminated /// </summary> public static async Task<String> Init_HKCSE(FinTsClient client, string ReceiverName, string ReceiverIBAN, string ReceiverBIC, decimal Amount, string Usage, DateTime ExecutionDay) { Log.Write("Starting job HKCSE: Transfer money terminated"); var connectionDetails = client.ConnectionDetails; string segments = string.Empty; string sepaMessage = string.Empty; client.SEGNUM = SEGNUM.SETInt(3); if (client.HISPAS == 1) { segments = "HKCSE:" + client.SEGNUM + ":1+" + connectionDetails.Iban + ":" + connectionDetails.Bic + "+urn?:iso?:std?:iso?:20022?:tech?:xsd?:pain.001.001.03+@@"; sepaMessage = pain00100103.Create(connectionDetails.AccountHolder, connectionDetails.Iban, connectionDetails.Bic, ReceiverName, ReceiverIBAN, ReceiverBIC, Amount, Usage, ExecutionDay); } else if (client.HISPAS == 2) { segments = "HKCSE:" + client.SEGNUM + ":1+" + connectionDetails.Iban + ":" + connectionDetails.Bic + "+urn?:iso?:std?:iso?:20022?:tech?:xsd?:pain.001.002.03+@@"; sepaMessage = pain00100203.Create(connectionDetails.AccountHolder, connectionDetails.Iban, connectionDetails.Bic, ReceiverName, ReceiverIBAN, ReceiverBIC, Amount, Usage, ExecutionDay); } else if (client.HISPAS == 3) { segments = "HKCSE:" + client.SEGNUM + ":1+" + connectionDetails.Iban + ":" + connectionDetails.Bic + "+urn?:iso?:std?:iso?:20022?:tech?:xsd?:pain.001.003.03+@@"; sepaMessage = pain00100303.Create(connectionDetails.AccountHolder, connectionDetails.Iban, connectionDetails.Bic, ReceiverName, ReceiverIBAN, ReceiverBIC, Amount, Usage, ExecutionDay); } segments = segments.Replace("@@", "@" + (sepaMessage.Length - 1) + "@") + sepaMessage; if (Helper.IsTANRequired("HKCSE")) { client.SEGNUM = SEGNUM.SETInt(4); segments = HKTAN.Init_HKTAN(client, segments); } var message = FinTSMessage.Create(client, client.HNHBS, client.HNHBK, segments, client.HIRMS); var response = await FinTSMessage.Send(client, message); client.HITAN = Helper.Parse_String(Helper.Parse_String(response, "HITAN", "'").Replace("?+", "??"), "++", "+").Replace("??", "?+"); Helper.Parse_Message(client, response); return response; }
/// <summary> /// Transfer /// </summary> public static string Init_HKCCS(ConnectionDetails connectionDetails, string ReceiverName, string ReceiverIBAN, string ReceiverBIC, decimal Amount, string Usage) { Log.Write("Starting job HKCCS: Transfer money"); string segments = string.Empty; string sepaMessage = string.Empty; SEG.NUM = SEGNUM.SETInt(3); if (Segment.HISPAS == 1) { segments = "HKCCS:" + SEG.NUM + ":1+" + connectionDetails.IBAN + ":" + connectionDetails.BIC + "+urn?:iso?:std?:iso?:20022?:tech?:xsd?:pain.001.001.03+@@"; sepaMessage = pain00100103.Create(connectionDetails.AccountHolder, connectionDetails.IBAN, connectionDetails.BIC, ReceiverName, ReceiverIBAN, ReceiverBIC, Amount, Usage, new DateTime(1999, 1, 1)); } else if (Segment.HISPAS == 2) { segments = "HKCCS:" + SEG.NUM + ":1+" + connectionDetails.IBAN + ":" + connectionDetails.BIC + "+urn?:iso?:std?:iso?:20022?:tech?:xsd?:pain.001.002.03+@@"; sepaMessage = pain00100203.Create(connectionDetails.AccountHolder, connectionDetails.IBAN, connectionDetails.BIC, ReceiverName, ReceiverIBAN, ReceiverBIC, Amount, Usage, new DateTime(1999, 1, 1)); } else if (Segment.HISPAS == 3) { segments = "HKCCS:" + SEG.NUM + ":1+" + connectionDetails.IBAN + ":" + connectionDetails.BIC + "+urn?:iso?:std?:iso?:20022?:tech?:xsd?:pain.001.003.03+@@"; sepaMessage = pain00100303.Create(connectionDetails.AccountHolder, connectionDetails.IBAN, connectionDetails.BIC, ReceiverName, ReceiverIBAN, ReceiverBIC, Amount, Usage, new DateTime(1999, 1, 1)); } segments = segments.Replace("@@", "@" + (sepaMessage.Length - 1) + "@") + sepaMessage; if (Helper.IsTANRequired("HKCCS")) { SEG.NUM = SEGNUM.SETInt(4); segments = HKTAN.Init_HKTAN(segments); } var message = FinTSMessage.Create(connectionDetails.HBCIVersion, Segment.HNHBS, Segment.HNHBK, connectionDetails.BlzPrimary, connectionDetails.UserId, connectionDetails.Pin, Segment.HISYN, segments, Segment.HIRMS, SEG.NUM); var response = FinTSMessage.Send(connectionDetails.Url, message); Segment.HITAN = Helper.Parse_String(Helper.Parse_String(response, "HITAN", "'").Replace("?+", "??"), "++", "+").Replace("??", "?+"); Helper.Parse_Message(response); return(response); }
/// <summary> /// Get bankers orders /// </summary> public static async Task <String> Init_HKCDB(FinTsClient client) { Log.Write("Starting job HKCDB: Get bankers order"); client.SEGNUM = SEGNUM.SETInt(3); var connectionDetails = client.ConnectionDetails; string segments = "HKCDB:" + client.SEGNUM + ":1+" + connectionDetails.Iban + ":" + connectionDetails.Bic + "+urn?:iso?:std?:iso?:20022?:tech?:xsd?:pain.001.001.03'"; if (Helper.IsTANRequired("HKCDB")) { client.SEGNUM = SEGNUM.SETInt(4); segments = HKTAN.Init_HKTAN(client, segments, "HKCDB"); } string message = FinTSMessage.Create(client, client.HNHBS, client.HNHBK, segments, client.HIRMS); string response = await FinTSMessage.Send(client, message); Helper.Parse_Message(client, response); return(response); }
/// <summary> /// Account transactions in SWIFT-format /// </summary> /// <param name="Account"></param> /// <param name="BLZ"></param> /// <param name="IBAN"></param> /// <param name="BIC"></param> /// <param name="URL"></param> /// <param name="HBCIVersion"></param> /// <param name="UserID"></param> /// <param name="PIN"></param> /// <param name="Anonymous"></param> /// <param name="startDate"></param> /// <param name="endDate"></param> /// <returns> /// Transactions /// </returns> public static List <SWIFTStatement> Transactions(string Account, int BLZ, string IBAN, string BIC, string URL, int HBCIVersion, string UserID, string PIN, bool Anonymous, DateTime?startDate = null, DateTime?endDate = null) { var swiftStatements = new List <SWIFTStatement>(); if (Transaction.INI(BLZ, URL, HBCIVersion, UserID, PIN, Anonymous) == true) { var startDateStr = startDate?.ToString("yyyyMMdd"); var endDateStr = endDate?.ToString("yyyyMMdd"); // Success var BankCode = Transaction.HKKAZ(Account, BLZ, IBAN, BIC, URL, HBCIVersion, UserID, PIN, startDateStr, endDateStr, null); var Transactions = ":20:STARTUMS" + Helper.Parse_String(BankCode, ":20:STARTUMS", "'HNSHA"); swiftStatements.AddRange(MT940.Serialize(Transactions, Account)); string BankCode_ = BankCode; while (BankCode_.Contains("+3040::")) { Helper.Parse_Message(BankCode_); var Startpoint = new Regex(@"\+3040::[^:]+:(?<startpoint>[^']+)'").Match(BankCode_).Groups["startpoint"].Value; BankCode_ = Transaction.HKKAZ(Account, BLZ, IBAN, BIC, URL, HBCIVersion, UserID, PIN, startDateStr, endDateStr, Startpoint); var Transactions_ = ":20:STARTUMS" + Helper.Parse_String(BankCode_, ":20:STARTUMS", "'HNSHA"); swiftStatements.AddRange(MT940.Serialize(Transactions_, Account)); } return(swiftStatements); } else { Log.Write("Initialization/sync failed"); throw new Exception("Initialization/sync failed"); } }
/// <summary> /// Load prepaid /// </summary> public static async Task <String> Init_HKPPD(FinTsClient client, int MobileServiceProvider, string PhoneNumber, int Amount) { Log.Write("Starting job HKPPD: Load prepaid"); client.SEGNUM = SEGNUM.SETInt(3); var connectionDetails = client.ConnectionDetails; string segments = "HKPPD:" + client.SEGNUM + ":2+" + connectionDetails.Iban + ":" + connectionDetails.Bic + "+" + MobileServiceProvider + "+" + PhoneNumber + "+" + Amount + ",:EUR'"; if (Helper.IsTANRequired("HKPPD")) { client.SEGNUM = SEGNUM.SETInt(4); segments = HKTAN.Init_HKTAN(client, segments, "HKPPD"); } string message = FinTSMessage.Create(client, client.HNHBS, client.HNHBK, segments, client.HIRMS); var response = await FinTSMessage.Send(client, message); Helper.Parse_Message(client, response); return(response); }
/// <summary> /// Transfer terminated /// </summary> public static string Init_HKCSE(ConnectionDetails connectionDetails, string Receiver, string ReceiverIBAN, string ReceiverBIC, decimal Amount, string Usage, DateTime ExecutionDay) { Log.Write("Starting job HKCSE: Transfer money terminated"); string segments = "HKCSE:" + SEGNUM.SETVal(3) + ":1+" + connectionDetails.IBAN + ":" + connectionDetails.BIC + "+urn?:iso?:std?:iso?:20022?:tech?:xsd?:pain.001.002.03+@@"; var message = pain00100203.Create(connectionDetails.AccountHolder, connectionDetails.IBAN, connectionDetails.BIC, Receiver, ReceiverIBAN, ReceiverBIC, Amount, Usage, ExecutionDay); segments = segments.Replace("@@", "@" + (message.Length - 1) + "@") + message; segments = HKTAN.Init_HKTAN(segments); SEG.NUM = SEGNUM.SETInt(4); var TAN = FinTSMessage.Send(connectionDetails.Url, FinTSMessage.Create(connectionDetails.HBCIVersion, Segment.HNHBS, Segment.HNHBK, connectionDetails.Blz, connectionDetails.UserId, connectionDetails.Pin, Segment.HISYN, segments, Segment.HIRMS, SEG.NUM)); Segment.HITAN = Helper.Parse_String(Helper.Parse_String(TAN, "HITAN", "'").Replace("?+", "??"), "++", "+").Replace("??", "?+"); Helper.Parse_Message(TAN); return(TAN); }
/// <summary> /// Get terminated transfers /// </summary> public static string Init_HKCSB(ConnectionDetails connectionDetails) { Log.Write("Starting job HKCSB: Get terminated transfers"); SEG.NUM = SEGNUM.SETInt(3); string segments = "HKCSB:" + SEG.NUM + ":1+" + connectionDetails.IBAN + ":" + connectionDetails.BIC + "+sepade?:xsd?:pain.001.001.03.xsd'"; if (Helper.IsTANRequired("HKCSB")) { SEG.NUM = SEGNUM.SETInt(4); segments = HKTAN.Init_HKTAN(segments); } string message = FinTSMessage.Create(connectionDetails.HBCIVersion, Segment.HNHBS, Segment.HNHBK, connectionDetails.BlzPrimary, connectionDetails.UserId, connectionDetails.Pin, Segment.HISYN, segments, Segment.HIRMS, SEG.NUM); string response = FinTSMessage.Send(connectionDetails.Url, message); Segment.HITAN = Helper.Parse_String(Helper.Parse_String(response, "HITAN", "'").Replace("?+", "??"), "++", "+").Replace("??", "?+"); Helper.Parse_Message(response); return(response); }
/// <summary> /// Get terminated transfers /// </summary> public static async Task <String> Init_HKCSB(FinTsClient client) { Log.Write("Starting job HKCSB: Get terminated transfers"); client.SEGNUM = SEGNUM.SETInt(3); var connectionDetails = client.ConnectionDetails; string segments = "HKCSB:" + client.SEGNUM + ":1+" + connectionDetails.Iban + ":" + connectionDetails.Bic + "+sepade?:xsd?:pain.001.001.03.xsd'"; if (Helper.IsTANRequired("HKCSB")) { client.SEGNUM = SEGNUM.SETInt(4); segments = HKTAN.Init_HKTAN(client, segments); } string message = FinTSMessage.Create(client, client.HNHBS, client.HNHBK, segments, client.HIRMS); string response = await FinTSMessage.Send(client, message); client.HITAN = Helper.Parse_String(Helper.Parse_String(response, "HITAN", "'").Replace("?+", "??"), "++", "+").Replace("??", "?+"); Helper.Parse_Message(client, response); return(response); }
/// <summary> /// Collective transfer terminated /// </summary> public static string Init_HKCME(ConnectionDetails connectionDetails, List <pain00100203_ct_data> PainData, string NumberofTransactions, decimal TotalAmount, DateTime ExecutionDay) { Log.Write("Starting job HKCME: Collective transfer money terminated"); var TotalAmount_ = TotalAmount.ToString().Replace(",", "."); string segments = "HKCME:" + SEGNUM.SETVal(3) + ":1+" + connectionDetails.IBAN + ":" + connectionDetails.BIC + TotalAmount_ + ":EUR++" + " + urn?:iso?:std?:iso?:20022?:tech?:xsd?:pain.001.002.03+@@"; var message = pain00100203.Create(connectionDetails.AccountHolder, connectionDetails.IBAN, connectionDetails.BIC, PainData, NumberofTransactions, TotalAmount, ExecutionDay); segments = segments.Replace("@@", "@" + (message.Length - 1) + "@") + message; segments = HKTAN.Init_HKTAN(segments); SEG.NUM = SEGNUM.SETInt(4); var TAN = FinTSMessage.Send(connectionDetails.Url, FinTSMessage.Create(connectionDetails.HBCIVersion, Segment.HNHBS, Segment.HNHBK, connectionDetails.BlzPrimary, connectionDetails.UserId, connectionDetails.Pin, Segment.HISYN, segments, Segment.HIRMS, SEG.NUM)); Segment.HITAN = Helper.Parse_String(Helper.Parse_String(TAN, "HITAN", "'").Replace("?+", "??"), "++", "+").Replace("??", "?+"); Helper.Parse_Message(TAN); return(TAN); }
/// <summary> /// TAN /// </summary> public static async Task <String> Send_TAN(FinTsClient client, string TAN) { Log.Write("Starting TAN process"); var connectionDetails = client.ConnectionDetails; string segments = string.Empty; var HITANS = !string.IsNullOrEmpty(client.HITANS.Substring(0, 1)) ? int.Parse(client.HITANS.Substring(0, 1)) : 0; if (string.IsNullOrEmpty(client.HITAB)) // TAN Medium Name not set { // Version 2 if (HITANS == 2) { segments = "HKTAN:" + SEGNUM.SETVal(3) + ":" + client.HITANS.Substring(0, 1) + "+2++" + client.HITAN + "++N'"; } // Version 3 else if (HITANS == 3) { segments = "HKTAN:" + SEGNUM.SETVal(3) + ":" + client.HITANS.Substring(0, 1) + "+2++" + client.HITAN + "++N'"; } // Version 4 else if (HITANS == 4) { segments = "HKTAN:" + SEGNUM.SETVal(3) + ":" + client.HITANS.Substring(0, 1) + "+2++" + client.HITAN + "++N'"; } // Version 5 else if (HITANS == 5) { segments = "HKTAN:" + SEGNUM.SETVal(3) + ":" + client.HITANS.Substring(0, 1) + "+2++++" + client.HITAN + "++N'"; } // Version 6 else if (HITANS == 6) { segments = "HKTAN:" + SEGNUM.SETVal(3) + ":" + client.HITANS.Substring(0, 1) + "+2++++" + client.HITAN + "+N'"; } else // default { segments = "HKTAN:" + SEGNUM.SETVal(3) + ":" + client.HITANS.Substring(0, 1) + "+2++++" + client.HITAN + "++N'"; } } else { // Version 2 if (HITANS == 2) { segments = "HKTAN:" + SEGNUM.SETVal(3) + ":" + client.HITANS.Substring(0, 1) + "+2++" + client.HITAN + "++N++++" + client.HITAB + "'"; } // Version 3 else if (HITANS == 3) { segments = "HKTAN:" + SEGNUM.SETVal(3) + ":" + client.HITANS.Substring(0, 1) + "+2++" + client.HITAN + "++N++++" + client.HITAB + "'"; } // Version 4 else if (HITANS == 4) { segments = "HKTAN:" + SEGNUM.SETVal(3) + ":" + client.HITANS.Substring(0, 1) + "+2++" + client.HITAN + "++N++++" + client.HITAB + "'"; } // Version 5 else if (HITANS == 5) { segments = "HKTAN:" + SEGNUM.SETVal(3) + ":" + client.HITANS.Substring(0, 1) + "+2++++" + client.HITAN + "++N++++" + client.HITAB + "'"; } // Version 6 else if (HITANS == 6) { segments = "HKTAN:" + SEGNUM.SETVal(3) + ":" + client.HITANS.Substring(0, 1) + "+2++++" + client.HITAN + "+N++++" + client.HITAB + "'"; } else // default { segments = "HKTAN:" + SEGNUM.SETVal(3) + ":" + client.HITANS.Substring(0, 1) + "+2++" + client.HITAN + "++N++++" + client.HITAB + "'"; } } client.SEGNUM = SEGNUM.SETInt(3); string message = FinTSMessage.Create(client, client.HNHBS, client.HNHBK, segments, client.HIRMS + ":" + TAN); string response = await FinTSMessage.Send(client, message); Helper.Parse_Message(client, response); return(response); }
/// <summary> /// Transactions /// </summary> public static string Init_HKKAZ(ConnectionDetails connectionDetails, string FromDate, string ToDate, string Startpoint) { Log.Write("Starting job HKKAZ: Request transactions"); string segments = string.Empty; SEG.NUM = SEGNUM.SETInt(3); if (String.IsNullOrEmpty(FromDate)) { if (String.IsNullOrEmpty(Startpoint)) { if (Convert.ToInt16(Segment.HKKAZ) < 7) { segments = "HKKAZ:" + SEG.NUM + ":" + Segment.HKKAZ + "+" + connectionDetails.Account + "::280:" + connectionDetails.Blz + "+N'"; } else { segments = "HKKAZ:" + SEG.NUM + ":" + Segment.HKKAZ + "+" + connectionDetails.IBAN + ":" + connectionDetails.BIC + ":" + connectionDetails.Account + "::280:" + connectionDetails.Blz + "+N'"; } } else { if (Convert.ToInt16(Segment.HKKAZ) < 7) { segments = "HKKAZ:" + SEG.NUM + ":" + Segment.HKKAZ + "+" + connectionDetails.Account + "::280:" + connectionDetails.Blz + "+N++++" + Startpoint + "'"; } else { segments = "HKKAZ:" + SEG.NUM + ":" + Segment.HKKAZ + "+" + connectionDetails.IBAN + ":" + connectionDetails.BIC + ":" + connectionDetails.Account + "::280:" + connectionDetails.Blz + "+N++++" + Startpoint + "'"; } } } else { if (String.IsNullOrEmpty(Startpoint)) { if (Convert.ToInt16(Segment.HKKAZ) < 7) { segments = "HKKAZ:" + SEG.NUM + ":" + Segment.HKKAZ + "+" + connectionDetails.Account + "::280:" + connectionDetails.Blz + "+N+" + FromDate + "+" + ToDate + "'"; } else { segments = "HKKAZ:" + SEG.NUM + ":" + Segment.HKKAZ + "+" + connectionDetails.IBAN + ":" + connectionDetails.BIC + ":" + connectionDetails.Account + "::280:" + connectionDetails.Blz + "+N+" + FromDate + "+" + ToDate + "'"; } } else { if (Convert.ToInt16(Segment.HKKAZ) < 7) { segments = "HKKAZ:" + SEG.NUM + ":" + Segment.HKKAZ + "+" + connectionDetails.Account + "::280:" + connectionDetails.Blz + "+N+" + FromDate + "+" + ToDate + "++" + Startpoint + "'"; } else { segments = "HKKAZ:" + SEG.NUM + ":" + Segment.HKKAZ + "+" + connectionDetails.IBAN + ":" + connectionDetails.BIC + ":" + connectionDetails.Account + "::280:" + connectionDetails.Blz + "+N+" + FromDate + "+" + ToDate + "++" + Startpoint + "'"; } } } if (Helper.IsTANRequired("HKKAZ")) { SEG.NUM = SEGNUM.SETInt(4); segments = HKTAN.Init_HKTAN(segments); } string message = FinTSMessage.Create(connectionDetails.HBCIVersion, Segment.HNHBS, Segment.HNHBK, connectionDetails.BlzPrimary, connectionDetails.UserId, connectionDetails.Pin, Segment.HISYN, segments, Segment.HIRMS, SEG.NUM); string response = FinTSMessage.Send(connectionDetails.Url, message); Segment.HITAN = Helper.Parse_String(Helper.Parse_String(response, "HITAN", "'").Replace("?+", "??"), "++", "+").Replace("??", "?+"); Helper.Parse_Message(response); return(response); }
/// <summary> /// Transactions in camt053 format /// </summary> public static async Task <String> Init_HKCAZ(FinTsClient client, string FromDate, string ToDate, string Startpoint, CamtVersion camtVers) { string segments = string.Empty; var connectionDetails = client.ConnectionDetails; client.SEGNUM = SEGNUM.SETInt(3); switch (camtVers) { case CamtVersion.Camt052: Log.Write("Starting job HKCAZ: Request transactions in camt052 format"); if (string.IsNullOrEmpty(FromDate)) { if (string.IsNullOrEmpty(Startpoint)) { segments = "HKCAZ:" + client.SEGNUM + ":" + client.HICAZS + "+" + connectionDetails.Iban + ":" + connectionDetails.Bic + ":" + connectionDetails.Account + "::280:" + connectionDetails.Blz + "+" + CamtScheme.Camt052 + "+N'"; } else { segments = "HKCAZ:" + client.SEGNUM + ":" + client.HICAZS + "+" + connectionDetails.Iban + ":" + connectionDetails.Bic + ":" + connectionDetails.Account + "::280:" + connectionDetails.Blz + "+" + CamtScheme.Camt052 + "+N++++" + Startpoint + "'"; } } else { if (string.IsNullOrEmpty(Startpoint)) { segments = "HKCAZ:" + client.SEGNUM + ":" + client.HICAZS + "+" + connectionDetails.Iban + ":" + connectionDetails.Bic + ":" + connectionDetails.Account + "::280:" + connectionDetails.Blz + "+" + CamtScheme.Camt052 + "+N+" + FromDate + "+" + ToDate + "'"; } else { segments = "HKCAZ:" + client.SEGNUM + ":" + client.HICAZS + "+" + connectionDetails.Iban + ":" + connectionDetails.Bic + ":" + connectionDetails.Account + "::280:" + connectionDetails.Blz + "+" + CamtScheme.Camt052 + "+N+" + FromDate + "+" + ToDate + "++" + Startpoint + "'"; } } client.SEGNUM = SEGNUM.SETInt(3); break; case CamtVersion.Camt053: Log.Write("Starting job HKCAZ: Request transactions in camt053 format"); if (string.IsNullOrEmpty(FromDate)) { if (string.IsNullOrEmpty(Startpoint)) { segments = "HKCAZ:" + client.SEGNUM + ":" + client.HICAZS + "+" + connectionDetails.Iban + ":" + connectionDetails.Bic + ":" + connectionDetails.Account + "::280:" + connectionDetails.Blz + "+" + CamtScheme.Camt053 + "+N'"; } else { segments = "HKCAZ:" + client.SEGNUM + ":" + client.HICAZS + "+" + connectionDetails.Iban + ":" + connectionDetails.Bic + ":" + connectionDetails.Account + "::280:" + connectionDetails.Blz + "+" + CamtScheme.Camt053 + "+N++++" + Startpoint + "'"; } } else { if (string.IsNullOrEmpty(Startpoint)) { segments = "HKCAZ:" + client.SEGNUM + ":" + client.HICAZS + "+" + connectionDetails.Iban + ":" + connectionDetails.Bic + ":" + connectionDetails.Account + "::280:" + connectionDetails.Blz + "+" + CamtScheme.Camt053 + "+N+" + FromDate + "+" + ToDate + "'"; } else { segments = "HKCAZ:" + client.SEGNUM + ":" + client.HICAZS + "+" + connectionDetails.Iban + ":" + connectionDetails.Bic + ":" + connectionDetails.Account + "::280:" + connectionDetails.Blz + "+" + CamtScheme.Camt053 + "+N+" + FromDate + "+" + ToDate + "++" + Startpoint + "'"; } } break; default: // -> Will never happen, only for compiler return(string.Empty); } if (Helper.IsTANRequired("HKCAZ")) { client.SEGNUM = SEGNUM.SETInt(4); segments = HKTAN.Init_HKTAN(client, segments, "HKCAZ"); } string message = FinTSMessage.Create(client, client.HNHBS, client.HNHBK, segments, client.HIRMS); string response = await FinTSMessage.Send(client, message); Helper.Parse_Message(client, response); return(response); }
/// <summary> /// Transactions in camt053 format /// </summary> public static string Init_HKCAZ(ConnectionDetails connectionDetails, string FromDate, string ToDate, string Startpoint, camtVersion camtVers) { string segments = string.Empty; SEG.NUM = SEGNUM.SETInt(3); switch (camtVers) { case camtVersion.camt052: Log.Write("Starting job HKCAZ: Request transactions in camt052 format"); if (String.IsNullOrEmpty(FromDate)) { if (String.IsNullOrEmpty(Startpoint)) { segments = "HKCAZ:" + SEG.NUM + ":" + Segment.HKCAZ + "+" + connectionDetails.IBAN + ":" + connectionDetails.BIC + ":" + connectionDetails.Account + "::280:" + connectionDetails.Blz + "+" + Scheme.camt052 + "+N'"; } else { segments = "HKCAZ:" + SEG.NUM + ":" + Segment.HKCAZ + "+" + connectionDetails.IBAN + ":" + connectionDetails.BIC + ":" + connectionDetails.Account + "::280:" + connectionDetails.Blz + "+" + Scheme.camt052 + "+N++++" + Startpoint + "'"; } } else { if (String.IsNullOrEmpty(Startpoint)) { segments = "HKCAZ:" + SEG.NUM + ":" + Segment.HKCAZ + "+" + connectionDetails.IBAN + ":" + connectionDetails.BIC + ":" + connectionDetails.Account + "::280:" + connectionDetails.Blz + "+" + Scheme.camt052 + "+N+" + FromDate + "+" + ToDate + "'"; } else { segments = "HKCAZ:" + SEG.NUM + ":" + Segment.HKCAZ + "+" + connectionDetails.IBAN + ":" + connectionDetails.BIC + ":" + connectionDetails.Account + "::280:" + connectionDetails.Blz + "+" + Scheme.camt052 + "+N+" + FromDate + "+" + ToDate + "++" + Startpoint + "'"; } } SEG.NUM = SEGNUM.SETInt(3); break; case camtVersion.camt053: Log.Write("Starting job HKCAZ: Request transactions in camt053 format"); if (String.IsNullOrEmpty(FromDate)) { if (String.IsNullOrEmpty(Startpoint)) { segments = "HKCAZ:" + SEG.NUM + ":" + Segment.HKCAZ + "+" + connectionDetails.IBAN + ":" + connectionDetails.BIC + ":" + connectionDetails.Account + "::280:" + connectionDetails.Blz + "+" + Scheme.camt053 + "+N'"; } else { segments = "HKCAZ:" + SEG.NUM + ":" + Segment.HKCAZ + "+" + connectionDetails.IBAN + ":" + connectionDetails.BIC + ":" + connectionDetails.Account + "::280:" + connectionDetails.Blz + "+" + Scheme.camt053 + "+N++++" + Startpoint + "'"; } } else { if (String.IsNullOrEmpty(Startpoint)) { segments = "HKCAZ:" + SEG.NUM + ":" + Segment.HKCAZ + "+" + connectionDetails.IBAN + ":" + connectionDetails.BIC + ":" + connectionDetails.Account + "::280:" + connectionDetails.Blz + "+" + Scheme.camt053 + "+N+" + FromDate + "+" + ToDate + "'"; } else { segments = "HKCAZ:" + SEG.NUM + ":" + Segment.HKCAZ + "+" + connectionDetails.IBAN + ":" + connectionDetails.BIC + ":" + connectionDetails.Account + "::280:" + connectionDetails.Blz + "+" + Scheme.camt053 + "+N+" + FromDate + "+" + ToDate + "++" + Startpoint + "'"; } } break; default: // -> Will never happen, only for compiler return(string.Empty); } if (Helper.IsTANRequired("HKCAZ")) { SEG.NUM = SEGNUM.SETInt(4); segments = HKTAN.Init_HKTAN(segments); } string message = FinTSMessage.Create(connectionDetails.HBCIVersion, Segment.HNHBS, Segment.HNHBK, connectionDetails.BlzPrimary, connectionDetails.UserId, connectionDetails.Pin, Segment.HISYN, segments, Segment.HIRMS, SEG.NUM); string response = FinTSMessage.Send(connectionDetails.Url, message); Segment.HITAN = Helper.Parse_String(Helper.Parse_String(response, "HITAN", "'").Replace("?+", "??"), "++", "+").Replace("??", "?+"); Helper.Parse_Message(response); return(response); }