Beispiel #1
0
        public async Task UpdateRegistration()
        {
            using (var cert = Helper.GetX509Certificate2(CertTlsName, CertsPath, CertsPass))
            {
                var clientHandler = new HttpClientHandler();
                clientHandler.ClientCertificates.Add(cert);
                clientHandler.ClientCertificateOptions = ClientCertificateOption.Manual;
                clientHandler.SslProtocols             = SslProtocols.Tls12;

                var merchant = new Merchant
                {
                    merchantId           = "002345678",
                    merchantSubId        = "234567",
                    merchantName         = "Another Company BV",
                    merchantIBAN         = "NL33INGB8694892022",
                    merchantLogo         = "",
                    dailyReceivableLimit = new DailyReceivableLimit
                    {
                        value    = 20000.00F,
                        currency = "EUR"
                    },
                    allowIngAppPayments = "N"
                };

                using (var content = new StringContent(System.Text.Json.JsonSerializer.Serialize(merchant), Encoding.UTF8, "application/json"))
                    using (var client = new HttpClient(clientHandler))
                    {
                        var request = new HttpRequestMessage(HttpMethod.Patch, $"{HttpHost}/payment-requests/registrations");
                        request.Content = content;
                        request.AddHeadersWithAccessTokenWithpatch(Helper.GetX509Certificate2(CertSignName, CertsPath, CertsPass), await content.DigestValue(), "/payment-requests/registrations", KeyId, AccessToken);
                        System.Console.WriteLine($"===========REQUEST========\n{request}");
                        using (HttpResponseMessage response = await client.SendAsync(request))
                        {
                            System.Console.WriteLine($"===========RESPONSE========\n{response}");
                            var responseContent = await response.Content.ReadAsStringAsync();

                            System.Console.WriteLine(responseContent);
                        }
                    }
            }
        }