/// <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; 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> /// 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> /// 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 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> /// 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> /// 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> /// 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> /// 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> /// 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> /// 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> /// 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> /// 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> /// 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> /// 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> /// 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 /// </summary> public static async Task <String> Init_HKKAZ(FinTsClient client, string FromDate, string ToDate, string Startpoint) { Log.Write("Starting job HKKAZ: Request transactions"); var connectionDetails = client.ConnectionDetails; string segments = string.Empty; client.SEGNUM = SEGNUM.SETInt(3); if (string.IsNullOrEmpty(FromDate)) { if (string.IsNullOrEmpty(Startpoint)) { if (Convert.ToInt16(client.HKKAZ) < 7) { segments = "HKKAZ:" + client.SEGNUM + ":" + client.HKKAZ + "+" + connectionDetails.Account + "::280:" + connectionDetails.Blz + "+N'"; } else { segments = "HKKAZ:" + client.SEGNUM + ":" + client.HKKAZ + "+" + connectionDetails.Iban + ":" + connectionDetails.Bic + ":" + connectionDetails.Account + "::280:" + connectionDetails.Blz + "+N'"; } } else { if (Convert.ToInt16(client.HKKAZ) < 7) { segments = "HKKAZ:" + client.SEGNUM + ":" + client.HKKAZ + "+" + connectionDetails.Account + "::280:" + connectionDetails.Blz + "+N++++" + Startpoint + "'"; } else { segments = "HKKAZ:" + client.SEGNUM + ":" + client.HKKAZ + "+" + connectionDetails.Iban + ":" + connectionDetails.Bic + ":" + connectionDetails.Account + "::280:" + connectionDetails.Blz + "+N++++" + Startpoint + "'"; } } } else { if (string.IsNullOrEmpty(Startpoint)) { if (Convert.ToInt16(client.HKKAZ) < 7) { segments = "HKKAZ:" + client.SEGNUM + ":" + client.HKKAZ + "+" + connectionDetails.Account + "::280:" + connectionDetails.Blz + "+N+" + FromDate + "+" + ToDate + "'"; } else { segments = "HKKAZ:" + client.SEGNUM + ":" + client.HKKAZ + "+" + connectionDetails.Iban + ":" + connectionDetails.Bic + ":" + connectionDetails.Account + "::280:" + connectionDetails.Blz + "+N+" + FromDate + "+" + ToDate + "'"; } } else { if (Convert.ToInt16(client.HKKAZ) < 7) { segments = "HKKAZ:" + client.SEGNUM + ":" + client.HKKAZ + "+" + connectionDetails.Account + "::280:" + connectionDetails.Blz + "+N+" + FromDate + "+" + ToDate + "++" + Startpoint + "'"; } else { segments = "HKKAZ:" + client.SEGNUM + ":" + client.HKKAZ + "+" + connectionDetails.Iban + ":" + connectionDetails.Bic + ":" + connectionDetails.Account + "::280:" + connectionDetails.Blz + "+N+" + FromDate + "+" + ToDate + "++" + Startpoint + "'"; } } } if (Helper.IsTANRequired("HKKAZ")) { 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> /// Transactions /// </summary> public static async Task <String> Init_HKKAZ(FinTsClient client, string FromDate, string ToDate, string Startpoint) { Log.Write("Starting job HKKAZ: Request transactions"); var connectionDetails = client.ConnectionDetails; string segments = string.Empty; 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, } }; client.SEGNUM = SEGNUM.SETInt(3); if (string.IsNullOrEmpty(FromDate)) { if (string.IsNullOrEmpty(Startpoint)) { if (Convert.ToInt16(client.HIKAZS) < 7) { segments = "HKKAZ:" + client.SEGNUM + ":" + client.HIKAZS + "+" + activeAccount.AccountNumber + "::280:" + activeAccount.AccountBankCode + "+N'"; } else { segments = "HKKAZ:" + client.SEGNUM + ":" + client.HIKAZS + "+" + activeAccount.AccountIban + ":" + activeAccount.AccountBic + ":" + activeAccount.AccountNumber + "::280:" + activeAccount.AccountBankCode + "+N'"; } } else { if (Convert.ToInt16(client.HIKAZS) < 7) { segments = "HKKAZ:" + client.SEGNUM + ":" + client.HIKAZS + "+" + activeAccount.AccountNumber + "::280:" + activeAccount.AccountBankCode + "+N++++" + Startpoint + "'"; } else { segments = "HKKAZ:" + client.SEGNUM + ":" + client.HIKAZS + "+" + activeAccount.AccountIban + ":" + activeAccount.AccountBic + ":" + activeAccount.AccountNumber + "::280:" + activeAccount.AccountBankCode + "+N++++" + Startpoint + "'"; } } } else { if (string.IsNullOrEmpty(Startpoint)) { if (Convert.ToInt16(client.HIKAZS) < 7) { segments = "HKKAZ:" + client.SEGNUM + ":" + client.HIKAZS + "+" + activeAccount.AccountNumber + "::280:" + activeAccount.AccountBankCode + "+N+" + FromDate + "+" + ToDate + "'"; } else { segments = "HKKAZ:" + client.SEGNUM + ":" + client.HIKAZS + "+" + activeAccount.AccountIban + ":" + activeAccount.AccountBic + ":" + activeAccount.AccountNumber + "::280:" + activeAccount.AccountBankCode + "+N+" + FromDate + "+" + ToDate + "'"; } } else { if (Convert.ToInt16(client.HIKAZS) < 7) { segments = "HKKAZ:" + client.SEGNUM + ":" + client.HIKAZS + "+" + activeAccount.AccountNumber + "::280:" + activeAccount.AccountBankCode + "+N+" + FromDate + "+" + ToDate + "++" + Startpoint + "'"; } else { segments = "HKKAZ:" + client.SEGNUM + ":" + client.HIKAZS + "+" + activeAccount.AccountIban + ":" + activeAccount.AccountBic + ":" + activeAccount.AccountNumber + "::280:" + activeAccount.AccountBankCode + "+N+" + FromDate + "+" + ToDate + "++" + Startpoint + "'"; } } } if (Helper.IsTANRequired("HKKAZ")) { client.SEGNUM = SEGNUM.SETInt(4); segments = HKTAN.Init_HKTAN(client, segments, "HKKAZ"); } 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); }
/// <summary> /// INI /// </summary> public static async Task <String> Init_INI(FinTsClient client) { var connectionDetails = client.ConnectionDetails; if (!client.Anonymous) { /// <summary> /// Sync /// </summary> try { string segments; /// <summary> /// INI /// </summary> if (connectionDetails.HbciVersion == 220) { string segments_ = "HKIDN:" + SEGNUM.SETVal(3) + ":2+280:" + connectionDetails.BlzPrimary + "+" + connectionDetails.UserId + "+" + client.SystemId + "+1'" + "HKVVB:" + SEGNUM.SETVal(4) + ":2+0+0+0+" + FinTsConfig.ProductId + "+" + FinTsConfig.Version + "'"; segments = segments_; } else if (connectionDetails.HbciVersion == 300) { string segments_ = "HKIDN:" + SEGNUM.SETVal(3) + ":2+280:" + connectionDetails.BlzPrimary + "+" + connectionDetails.UserId + "+" + client.SystemId + "+1'" + "HKVVB:" + SEGNUM.SETVal(4) + ":3+0+0+0+" + FinTsConfig.ProductId + "+" + FinTsConfig.Version + "'"; if (client.HITANS != null && client.HITANS.Substring(0, 3).Equals("6+4")) { client.SEGNUM = SEGNUM.SETInt(5); segments_ = HKTAN.Init_HKTAN(client, segments_); } else { client.SEGNUM = SEGNUM.SETInt(4); } segments = segments_; } else { //Since connectionDetails is a re-usable object, this shouldn't be cleared. //connectionDetails.UserId = string.Empty; //connectionDetails.Pin = null; Log.Write("HBCI version not supported"); throw new Exception("HBCI version not supported"); } var message = FinTSMessage.Create(client, "1", "0", segments, client.HIRMS); var response = await FinTSMessage.Send(client, message); Helper.Parse_Segment(client, response); client.HITAN = Helper.Parse_String(Helper.Parse_String(response, "HITAN:", "'").Replace("?+", "??"), "++", "+").Replace("??", "?+"); return(response); } catch (Exception ex) { //Since connectionDetails is a re-usable object, this shouldn't be cleared. //connectionDetails.UserId = string.Empty; //connectionDetails.Pin = null; Log.Write(ex.ToString()); throw new Exception("Software error", ex); } } else { /// <summary> /// Sync /// </summary> try { Log.Write("Starting Synchronisation anonymous"); string segments; if (connectionDetails.HbciVersion == 300) { string segments_ = "HKIDN:" + SEGNUM.SETVal(2) + ":2+280:" + connectionDetails.BlzPrimary + "+" + "9999999999" + "+0+0'" + "HKVVB:" + SEGNUM.SETVal(3) + ":3+0+0+1+" + FinTsConfig.ProductId + "+" + FinTsConfig.Version + "'"; segments = segments_; } else { //Since connectionDetails is a re-usable object, this shouldn't be cleared. //connectionDetails.UserId = string.Empty; //connectionDetails.Pin = null; Log.Write("HBCI version not supported"); throw new Exception("HBCI version not supported"); } client.SEGNUM = SEGNUM.SETInt(4); string message = FinTsMessageAnonymous.Create(connectionDetails.HbciVersion, "1", "0", connectionDetails.Blz, connectionDetails.UserId, connectionDetails.Pin, "0", segments, null, client.SEGNUM); string response = await FinTSMessage.Send(client, message); var messages = Helper.Parse_Segment(client, response); var result = new HBCIDialogResult(messages, response); if (!result.IsSuccess) { Log.Write("Synchronisation anonymous failed. " + result); return(response); } // Sync OK Log.Write("Synchronisation anonymous ok"); /// <summary> /// INI /// </summary> if (connectionDetails.HbciVersion == 300) { string segments__ = "HKIDN:" + SEGNUM.SETVal(3) + ":2+280:" + connectionDetails.BlzPrimary + "+" + connectionDetails.UserId + "+" + client.SystemId + "+1'" + "HKVVB:" + SEGNUM.SETVal(4) + ":3+0+0+0+" + FinTsConfig.ProductId + "+" + FinTsConfig.Version + "'" + "HKSYN:" + SEGNUM.SETVal(5) + ":3+0'"; segments = segments__; } else { Log.Write("HBCI version not supported"); throw new Exception("HBCI version not supported"); } client.SEGNUM = SEGNUM.SETInt(5); message = FinTSMessage.Create(client, "1", "0", segments, client.HIRMS); response = await FinTSMessage.Send(client, message); Helper.Parse_Segment(client, response); client.HITAN = Helper.Parse_String(Helper.Parse_String(response, "HITAN:", "'").Replace("?+", "??"), "++", "+").Replace("??", "?+"); return(response); } catch (Exception ex) { //Since connectionDetails is a re-usable object, this shouldn't be cleared. //connectionDetails.UserId = string.Empty; //connectionDetails.Pin = null; Log.Write(ex.ToString()); DEBUG.Write("Software error: " + ex.ToString()); throw new Exception("Software error: " + ex.ToString()); } } }
/// <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> /// INI /// </summary> public static string Init_INI(ConnectionDetails connectionDetails, bool anonymous) { if (!anonymous) { /// <summary> /// Sync /// </summary> try { string segments; SEG.NUM = SEGNUM.SETInt(5); /// <summary> /// INI /// </summary> if (connectionDetails.HBCIVersion == 220) { string segments_ = "HKIDN:" + SEGNUM.SETVal(3) + ":2+280:" + connectionDetails.BlzPrimary + "+" + connectionDetails.UserId + "+" + Segment.HISYN + "+1'" + "HKVVB:" + SEGNUM.SETVal(4) + ":2+0+0+0+" + Program.ProductId + "+" + Program.Version + "'"; segments = segments_; } else if (connectionDetails.HBCIVersion == 300) { string segments_ = "HKIDN:" + SEGNUM.SETVal(3) + ":2+280:" + connectionDetails.BlzPrimary + "+" + connectionDetails.UserId + "+" + Segment.HISYN + "+1'" + "HKVVB:" + SEGNUM.SETVal(4) + ":3+0+0+0+" + Program.ProductId + "+" + Program.Version + "'"; if (Segment.HITANS != null && Segment.HITANS.Substring(0, 3).Equals("6+4")) { segments_ = HKTAN.Init_HKTAN(segments_); } segments = segments_; } else { //Since connectionDetails is a re-usable object, this shouldn't be cleared. //connectionDetails.UserId = string.Empty; //connectionDetails.Pin = null; Log.Write("HBCI version not supported"); throw new Exception("HBCI version not supported"); } var message = FinTSMessage.Create(connectionDetails.HBCIVersion, MSG.SETVal(1), DLG.SETVal(0), connectionDetails.BlzPrimary, connectionDetails.UserId, connectionDetails.Pin, Segment.HISYN, segments, Segment.HIRMS, SEG.NUM); var response = FinTSMessage.Send(connectionDetails.Url, message); Helper.Parse_Segment(connectionDetails.UserId, connectionDetails.Blz, connectionDetails.HBCIVersion, response); Segment.HITAN = Helper.Parse_String(Helper.Parse_String(response, "HITAN:", "'").Replace("?+", "??"), "++", "+").Replace("??", "?+"); return(response); } catch (Exception ex) { //Since connectionDetails is a re-usable object, this shouldn't be cleared. //connectionDetails.UserId = string.Empty; //connectionDetails.Pin = null; Log.Write(ex.ToString()); throw new Exception("Software error", ex); } } else { /// <summary> /// Sync /// </summary> try { Log.Write("Starting Synchronisation anonymous"); string segments; if (connectionDetails.HBCIVersion == 300) { string segments_ = "HKIDN:" + SEGNUM.SETVal(2) + ":2+280:" + connectionDetails.BlzPrimary + "+" + "9999999999" + "+0+0'" + "HKVVB:" + SEGNUM.SETVal(3) + ":3+0+0+1+" + Program.ProductId + "+" + Program.Version + "'"; segments = segments_; } else { //Since connectionDetails is a re-usable object, this shouldn't be cleared. //connectionDetails.UserId = string.Empty; //connectionDetails.Pin = null; Log.Write("HBCI version not supported"); throw new Exception("HBCI version not supported"); } SEG.NUM = SEGNUM.SETInt(4); string message = FinTSMessageAnonymous.Create(connectionDetails.HBCIVersion, MSG.SETVal(1), DLG.SETVal(0), connectionDetails.Blz, connectionDetails.UserId, connectionDetails.Pin, SYS.SETVal(0), segments, null, SEG.NUM); string response = FinTSMessage.Send(connectionDetails.Url, message); var messages = Helper.Parse_Segment(connectionDetails.UserId, connectionDetails.Blz, connectionDetails.HBCIVersion, response); var result = new HBCIDialogResult(messages, response); if (!result.IsSuccess) { Log.Write("Synchronisation anonymous failed. " + result); return(response); } // Sync OK Log.Write("Synchronisation anonymous ok"); /// <summary> /// INI /// </summary> if (connectionDetails.HBCIVersion == 300) { string segments__ = "HKIDN:" + SEGNUM.SETVal(3) + ":2+280:" + connectionDetails.BlzPrimary + "+" + connectionDetails.UserId + "+" + Segment.HISYN + "+1'" + "HKVVB:" + SEGNUM.SETVal(4) + ":3+0+0+0+" + Program.ProductId + "+" + Program.Version + "'" + "HKSYN:" + SEGNUM.SETVal(5) + ":3+0'"; segments = segments__; } else { Log.Write("HBCI version not supported"); throw new Exception("HBCI version not supported"); } SEG.NUM = SEGNUM.SETInt(5); message = FinTSMessage.Create(connectionDetails.HBCIVersion, MSG.SETVal(1), DLG.SETVal(0), connectionDetails.BlzPrimary, connectionDetails.UserId, connectionDetails.Pin, Segment.HISYN, segments, Segment.HIRMS, SEG.NUM); response = FinTSMessage.Send(connectionDetails.Url, message); Helper.Parse_Segment(connectionDetails.UserId, connectionDetails.Blz, connectionDetails.HBCIVersion, response); Segment.HITAN = Helper.Parse_String(Helper.Parse_String(response, "HITAN:", "'").Replace("?+", "??"), "++", "+").Replace("??", "?+"); return(response); } catch (Exception ex) { //Since connectionDetails is a re-usable object, this shouldn't be cleared. //connectionDetails.UserId = string.Empty; //connectionDetails.Pin = null; Log.Write(ex.ToString()); DEBUG.Write("Software error: " + ex.ToString()); throw new Exception("Software error: " + ex.ToString()); } } }