Example #1
0
 public static async Task <String> HKEND(FinTsClient client, string dialogId)
 {
     return(await Init_HKEND(client, dialogId));
 }
Example #2
0
 public static async Task <String> HKCAZ(FinTsClient client, string FromDate, string ToDate, string Startpoint, CamtVersion camtVers)
 {
     return(await Init_HKCAZ(client, FromDate, ToDate, Startpoint, camtVers));
 }
Example #3
0
 public static async Task <String> INI(FinTsClient client, string hkTanSegmentId = null)
 {
     return(await Init_INI(client, hkTanSegmentId));
 }
Example #4
0
 public static async Task <String> TAN(FinTsClient client, string TAN)
 {
     return(await Send_TAN(client, TAN));
 }
Example #5
0
 public static async Task <String> TAN4(FinTsClient client, string TAN, string MediumName)
 {
     return(await Send_TAN4(client, TAN, MediumName));
 }
Example #6
0
 public static async Task <String> HKPPD(FinTsClient client, int MobileServiceProvider, string PhoneNumber, int Amount)
 {
     return(await Init_HKPPD(client, MobileServiceProvider, PhoneNumber, Amount));
 }
Example #7
0
 public static async Task <String> 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)
 {
     return(await Init_HKCDL(client, OrderId, Receiver, ReceiverIBAN, ReceiverBIC, Amount, Usage, FirstTimeExecutionDay, TimeUnit, Rota, ExecutionDay, LastExecutionDay));
 }
Example #8
0
 public static async Task <String> HKDME(FinTsClient client, DateTime SettlementDate, List <Pain00800202CcData> PainData, string NumberofTransactions, decimal TotalAmount)
 {
     return(await Init_HKDME(client, SettlementDate, PainData, NumberofTransactions, TotalAmount));
 }
Example #9
0
 public static async Task <String> HKDSE(FinTsClient client, string Payer, string PayerIBAN, string PayerBIC, decimal Amount, string Usage,
                                         DateTime SettlementDate, string MandateNumber, DateTime MandateDate, string CeditorIDNumber)
 {
     return(await Init_HKDSE(client, Payer, PayerIBAN, PayerBIC, Amount, Usage, SettlementDate, MandateNumber, MandateDate, CeditorIDNumber));
 }
Example #10
0
        /// <summary>
        /// Fill given <code>TANDialog</code> and wait for user to enter a TAN.
        /// </summary>
        /// <param name="BankCode"></param>
        /// <param name="pictureBox"></param>
        /// <param name="flickerImage"></param>
        /// <param name="flickerWidth"></param>
        /// <param name="flickerHeight"></param>
        /// <param name="renderFlickerCodeAsGif"></param>
        public static async Task <string> WaitForTanAsync(FinTsClient client, HBCIDialogResult dialogResult, TanRequest tanRequest)
        {
            var BankCode_ = "HIRMS" + Parse_String(dialogResult.RawData, "'HIRMS", "'");

            string[] values = BankCode_.Split('+');
            foreach (var item in values)
            {
                if (!item.StartsWith("HIRMS"))
                {
                    TransactionConsole.Output = item.Replace("::", ": ");
                }
            }

            var HITAN = "HITAN" + Parse_String(dialogResult.RawData.Replace("?'", "").Replace("?:", ":").Replace("<br>", Environment.NewLine).Replace("?+", "??"), "'HITAN", "'");

            string HITANFlicker = string.Empty;

            var tanMethods = BPD.HITANS.Where(h => h.Version == client.HITANS).SelectMany(t => t.TanProcesses);

            var tanMethod = string.Empty;

            foreach (var item in tanMethods)
            {
                if (item.TanCode == Convert.ToInt32(client.HIRMS))
                {
                    tanMethod = item.Name;
                }
            }

            Log.Write($"Processing TAN process '{tanMethod}' ...");

            // Smart-TAN plus optisch
            // chipTAN optisch
            if (tanMethod.Equals("Smart-TAN plus optisch") || tanMethod.Contains("chipTAN optisch"))
            {
                HITANFlicker = HITAN;
            }

            String[] values_ = HITAN.Split('+');

            int i = 1;

            foreach (var item in values_)
            {
                i = i + 1;

                if (i == 6)
                {
                    TransactionConsole.Output = TransactionConsole.Output + "??" + item.Replace("::", ": ").TrimStart();

                    TransactionConsole.Output = TransactionConsole.Output.Replace("??", " ")
                                                .Replace("0030: ", "")
                                                .Replace("1.", Environment.NewLine + "1.")
                                                .Replace("2.", Environment.NewLine + "2.")
                                                .Replace("3.", Environment.NewLine + "3.")
                                                .Replace("4.", Environment.NewLine + "4.")
                                                .Replace("5.", Environment.NewLine + "5.")
                                                .Replace("6.", Environment.NewLine + "6.")
                                                .Replace("7.", Environment.NewLine + "7.")
                                                .Replace("8.", Environment.NewLine + "8.");
                }
            }

            // chipTAN optisch
            if (tanMethod.Contains("chipTAN optisch"))
            {
                string FlickerCode = string.Empty;

                FlickerCode = "CHLGUC" + Helper.Parse_String(HITAN, "CHLGUC", "CHLGTEXT") + "CHLGTEXT";

                FlickerCode flickerCode         = new FlickerCode(FlickerCode);
                var         flickerCodeRenderer = new FlickerCodeRenderer(flickerCode.Render());
                return(await tanRequest.WithFlickerAsync(flickerCodeRenderer));
            }

            // Smart-TAN plus optisch
            if (tanMethod.Equals("Smart-TAN plus optisch"))
            {
                HITANFlicker = HITAN.Replace("?@", "??");

                string FlickerCode = string.Empty;

                String[] values__ = HITANFlicker.Split('@');

                int ii = 1;

                foreach (var item in values__)
                {
                    ii = ii + 1;

                    if (ii == 4)
                    {
                        FlickerCode = item;
                    }
                }

                FlickerCode flickerCode         = new FlickerCode(FlickerCode.Trim());
                var         flickerCodeRenderer = new FlickerCodeRenderer(flickerCode.Render());
                return(await tanRequest.WithFlickerAsync(flickerCodeRenderer));
            }

            // Smart-TAN photo
            if (tanMethod.Equals("Smart-TAN photo"))
            {
                var PhotoCode = Parse_String(dialogResult.RawData, ".+@", "'HNSHA");

                var mCode = new MatrixCode(PhotoCode.Substring(5, PhotoCode.Length - 5));

                return(await tanRequest.WithMatrixAsync(mCode));
            }

            // PhotoTAN
            if (tanMethod.Equals("photoTAN-Verfahren"))
            {
                // HITAN:5:5:4+4++nmf3VmGQDT4qZ20190130091914641+Bitte geben Sie die photoTan ein+@3031@       image/pngʉPNG
                var match = Regex.Match(dialogResult.RawData, @"HITAN.+@\d+@(.+)'HNHBS", RegexOptions.Singleline);
                if (match.Success)
                {
                    var pichtureBinaryDataString = match.Groups[1].Value;

                    var mCode = new MatrixCode(pichtureBinaryDataString);

                    return(await tanRequest.WithMatrixAsync(mCode));
                }
            }

            return(await tanRequest.WithUnknownAsync());
        }
Example #11
0
        /// <summary>
        /// TAN
        /// </summary>
        public static async Task <String> Send_TAN(FinTsClient client, string TAN)
        {
            Log.Write("Starting TAN process");
            string segments = string.Empty;

            if (string.IsNullOrEmpty(client.HITAB)) // TAN Medium Name not set
            {
                // Version 2
                if (client.HITANS == 2)
                {
                    segments = "HKTAN:" + SEG_NUM.Seg3 + ":" + client.HITANS + "+2++" + client.HITAN + "++N'";
                }
                // Version 3
                else if (client.HITANS == 3)
                {
                    segments = "HKTAN:" + SEG_NUM.Seg3 + ":" + client.HITANS + "+2++" + client.HITAN + "++N'";
                }
                // Version 4
                else if (client.HITANS == 4)
                {
                    segments = "HKTAN:" + SEG_NUM.Seg3 + ":" + client.HITANS + "+2++" + client.HITAN + "++N'";
                }
                // Version 5
                else if (client.HITANS == 5)
                {
                    segments = "HKTAN:" + SEG_NUM.Seg3 + ":" + client.HITANS + "+2++++" + client.HITAN + "++N'";
                }
                // Version 6
                else if (client.HITANS == 6)
                {
                    segments = "HKTAN:" + SEG_NUM.Seg3 + ":" + client.HITANS + "+2++++" + client.HITAN + "+N'";
                }
                // Version 7 -> decoupled
                // FinTS_3.0_Security_Sicherheitsverfahren_PINTAN_2020-07-10_final_version.pdf Seite 64 - 65
                else if (client.HITANS == 7)
                {
                    segments = "HKTAN:" + SEG_NUM.Seg3 + ":" + client.HITANS + "+S++++" + client.HITAN + "+N'";
                }
                else // default
                {
                    segments = "HKTAN:" + SEG_NUM.Seg3 + ":" + client.HITANS + "+2++++" + client.HITAN + "++N'";
                }
            }
            else
            {
                // Version 2
                if (client.HITANS == 2)
                {
                    segments = "HKTAN:" + SEG_NUM.Seg3 + ":" + client.HITANS + "+2++" + client.HITAN + "++N++++" + client.HITAB + "'";
                }
                // Version 3
                else if (client.HITANS == 3)
                {
                    segments = "HKTAN:" + SEG_NUM.Seg3 + ":" + client.HITANS + "+2++" + client.HITAN + "++N++++" + client.HITAB + "'";
                }
                // Version 4
                else if (client.HITANS == 4)
                {
                    segments = "HKTAN:" + SEG_NUM.Seg3 + ":" + client.HITANS + "+2++" + client.HITAN + "++N++++" + client.HITAB + "'";
                }
                // Version 5
                else if (client.HITANS == 5)
                {
                    segments = "HKTAN:" + SEG_NUM.Seg3 + ":" + client.HITANS + "+2++++" + client.HITAN + "++N++++" + client.HITAB + "'";
                }
                // Version 6
                else if (client.HITANS == 6)
                {
                    segments = "HKTAN:" + SEG_NUM.Seg3 + ":" + client.HITANS + "+2++++" + client.HITAN + "+N++++" + client.HITAB + "'";
                }
                // Version 7 -> decoupled
                // FinTS_3.0_Security_Sicherheitsverfahren_PINTAN_2020-07-10_final_version.pdf Seite 64 - 65
                else if (client.HITANS == 7)
                {
                    segments = "HKTAN:" + SEG_NUM.Seg3 + ":" + client.HITANS + "+S++++" + client.HITAN + "+N++++" + client.HITAB + "'";
                }
                else // default
                {
                    segments = "HKTAN:" + SEG_NUM.Seg3 + ":" + client.HITANS + "+2++" + client.HITAN + "++N++++" + client.HITAB + "'";
                }
            }

            client.SEGNUM = Convert.ToInt16(SEG_NUM.Seg3);

            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);
        }
Example #12
0
        /// <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 = Convert.ToInt16(SEG_NUM.Seg3);

            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 = Convert.ToInt16(SEG_NUM.Seg3);
                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 = Convert.ToInt16(SEG_NUM.Seg4);
                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);
        }