From 5f9e8e89376471fad84a3e1b698bdc7bf933f35b Mon Sep 17 00:00:00 2001 From: eeyuksel Date: Thu, 11 Jul 2024 21:20:38 +0300 Subject: [PATCH 1/3] =?UTF-8?q?requestler=20v2=20olarak=20d=C3=BCzenlendi?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Iyzipay/Model/Apm.cs | 24 ++++---- Iyzipay/Model/ApmResource.cs | 46 ++++++++-------- Iyzipay/Model/BasicBkm.cs | 21 +++---- Iyzipay/Model/BasicPayment.cs | 15 ++--- Iyzipay/Model/BasicPaymentPostAuth.cs | 15 ++--- Iyzipay/Model/BasicPaymentPreAuth.cs | 15 ++--- Iyzipay/Model/BasicPaymentResource.cs | 36 ++++++------ Iyzipay/Model/BasicThreedsInitialize.cs | 30 +++++----- .../Model/BasicThreedsInitializePreAuth.cs | 29 +++++----- Iyzipay/Model/BasicThreedsPayment.cs | 15 ++--- Iyzipay/Model/Bkm.cs | 7 ++- Iyzipay/Model/BkmInitialize.cs | 31 ++++++----- Iyzipay/Model/CheckoutForm.cs | 19 ++++--- Iyzipay/Model/CheckoutFormInitialize.cs | 3 +- .../Model/CheckoutFormInitializePreAuth.cs | 3 +- .../Model/CheckoutFormInitializeResource.cs | 8 +-- Iyzipay/Model/PayWithIyzico.cs | 3 +- Iyzipay/Model/PayWithIyzicoInitialize.cs | 15 ++--- .../Model/PayWithIyzicoInitializeResource.cs | 8 +-- Iyzipay/Model/Payment.cs | 24 ++++---- Iyzipay/Model/PaymentPostAuth.cs | 15 ++--- Iyzipay/Model/PaymentPreAuth.cs | 24 ++++---- Iyzipay/Model/PaymentResource.cs | 44 +++++++-------- Iyzipay/Model/ThreedsInitialize.cs | 29 +++++----- Iyzipay/Model/ThreedsInitializePreAuth.cs | 29 +++++----- Iyzipay/Model/ThreedsPayment.cs | 24 ++++---- Iyzipay/Request/CreateApmInitializeRequest.cs | 55 +++++-------------- Iyzipay/Request/CreateBasicPaymentRequest.cs | 38 ++++--------- Iyzipay/Request/CreateBkmInitializeRequest.cs | 29 ++-------- .../CreateCheckoutFormInitializeRequest.cs | 42 ++++---------- .../CreatePayWithIyzicoInitializeRequest.cs | 42 ++++---------- .../Request/CreatePaymentPostAuthRequest.cs | 21 ++----- Iyzipay/Request/CreatePaymentRequest.cs | 47 ++++------------ .../Request/CreateThreedsPaymentRequest.cs | 15 +---- Iyzipay/Request/RetrieveApmRequest.cs | 11 +--- Iyzipay/Request/RetrieveBkmRequest .cs | 12 +--- .../Request/RetrieveCheckoutFormRequest.cs | 12 +--- .../Request/RetrievePayWithIyzicoRequest.cs | 12 +--- Iyzipay/Request/RetrievePaymentRequest.cs | 15 +---- 39 files changed, 360 insertions(+), 523 deletions(-) diff --git a/Iyzipay/Model/Apm.cs b/Iyzipay/Model/Apm.cs index f810329..53eb711 100644 --- a/Iyzipay/Model/Apm.cs +++ b/Iyzipay/Model/Apm.cs @@ -2,16 +2,18 @@ namespace Iyzipay.Model { - public class Apm : ApmResource - { - public static Apm Create(CreateApmInitializeRequest request, Options options) - { - return RestHttpClient.Create().Post(options.BaseUrl + "/payment/apm/initialize", GetHttpHeaders(request, options), request); - } + public class Apm : ApmResource + { + public static Apm Create(CreateApmInitializeRequest request, Options options) + { + var uri = options.BaseUrl + "/payment/apm/initialize"; + return RestHttpClientV2.Create().Post(uri, GetHttpHeadersWithRequestBody(request, uri, options), request); + } - public static Apm Retrieve(RetrieveApmRequest request, Options options) - { - return RestHttpClient.Create().Post(options.BaseUrl + "/payment/apm/retrieve", GetHttpHeaders(request, options), request); - } - } + public static Apm Retrieve(RetrieveApmRequest request, Options options) + { + var uri = options.BaseUrl + "/payment/apm/retrieve"; + return RestHttpClientV2.Create().Post(uri, GetHttpHeadersWithRequestBody(request, uri, options), request); + } + } } diff --git a/Iyzipay/Model/ApmResource.cs b/Iyzipay/Model/ApmResource.cs index 2d45ff2..d15d493 100644 --- a/Iyzipay/Model/ApmResource.cs +++ b/Iyzipay/Model/ApmResource.cs @@ -4,31 +4,31 @@ namespace Iyzipay.Model { - public class ApmResource : IyzipayResource + public class ApmResource : IyzipayResourceV2 { - public String RedirectUrl { get; set; } - public String Price { get; set; } - public String PaidPrice { get; set; } - public String PaymentId { get; set; } - public String MerchantCommissionRate { get; set; } - public String MerchantCommissionRateAmount { get; set; } - public String IyziCommissionRateAmount { get; set; } - public String IyziCommissionFee { get; set; } - public String BasketId { get; set; } - public String Currency { get; set; } + public string RedirectUrl { get; set; } + public string Price { get; set; } + public string PaidPrice { get; set; } + public string PaymentId { get; set; } + public string MerchantCommissionRate { get; set; } + public string MerchantCommissionRateAmount { get; set; } + public string IyziCommissionRateAmount { get; set; } + public string IyziCommissionFee { get; set; } + public string BasketId { get; set; } + public string Currency { get; set; } [JsonProperty(PropertyName = "itemTransactions")] public List PaymentItems { get; set; } - public String Phase { get; set; } - public String AccountHolderName { get; set; } - public String AccountNumber { get; set; } - public String BankName { get; set; } - public String BankCode { get; set; } - public String Bic { get; set; } - public String PaymentPurpose { get; set; } - public String Iban { get; set; } - public String CountryCode { get; set; } - public String Apm { get; set; } - public String MobilePhone { get; set; } - public String PaymentStatus { get; set; } + public string Phase { get; set; } + public string AccountHolderName { get; set; } + public string AccountNumber { get; set; } + public string BankName { get; set; } + public string BankCode { get; set; } + public string Bic { get; set; } + public string PaymentPurpose { get; set; } + public string Iban { get; set; } + public string CountryCode { get; set; } + public string Apm { get; set; } + public string MobilePhone { get; set; } + public string PaymentStatus { get; set; } } } diff --git a/Iyzipay/Model/BasicBkm.cs b/Iyzipay/Model/BasicBkm.cs index fd24fc1..7cc84de 100644 --- a/Iyzipay/Model/BasicBkm.cs +++ b/Iyzipay/Model/BasicBkm.cs @@ -3,15 +3,16 @@ namespace Iyzipay.Model { - public class BasicBkm : BasicPaymentResource - { - public String Token { get; set; } - public String CallbackUrl { get; set; } - public String PaymentStatus { get; set; } + public class BasicBkm : BasicPaymentResource + { + public string Token { get; set; } + public string CallbackUrl { get; set; } + public string PaymentStatus { get; set; } - public static BasicBkm Retrieve(RetrieveBkmRequest request, Options options) - { - return RestHttpClient.Create().Post(options.BaseUrl + "/payment/bkm/auth/detail/basic", GetHttpHeaders(request, options), request); - } - } + public static BasicBkm Retrieve(RetrieveBkmRequest request, Options options) + { + var uri = options.BaseUrl + "/payment/bkm/auth/detail/basic"; + return RestHttpClientV2.Create().Post(uri, GetHttpHeadersWithRequestBody(request, uri, options), request); + } + } } diff --git a/Iyzipay/Model/BasicPayment.cs b/Iyzipay/Model/BasicPayment.cs index e8f27c2..95a472f 100644 --- a/Iyzipay/Model/BasicPayment.cs +++ b/Iyzipay/Model/BasicPayment.cs @@ -2,11 +2,12 @@ namespace Iyzipay.Model { - public class BasicPayment : BasicPaymentResource - { - public static BasicPayment Create(CreateBasicPaymentRequest request, Options options) - { - return RestHttpClient.Create().Post(options.BaseUrl + "/payment/auth/basic", GetHttpHeaders(request, options), request); - } - } + public class BasicPayment : BasicPaymentResource + { + public static BasicPayment Create(CreateBasicPaymentRequest request, Options options) + { + var uri = options.BaseUrl + "/payment/auth/basic"; + return RestHttpClientV2.Create().Post(uri, GetHttpHeadersWithRequestBody(request, uri, options), request); + } + } } diff --git a/Iyzipay/Model/BasicPaymentPostAuth.cs b/Iyzipay/Model/BasicPaymentPostAuth.cs index 7fae26b..d32856e 100644 --- a/Iyzipay/Model/BasicPaymentPostAuth.cs +++ b/Iyzipay/Model/BasicPaymentPostAuth.cs @@ -2,11 +2,12 @@ namespace Iyzipay.Model { - public class BasicPaymentPostAuth : BasicPaymentResource - { - public static BasicPaymentPostAuth Create(CreatePaymentPostAuthRequest request, Options options) - { - return RestHttpClient.Create().Post(options.BaseUrl + "/payment/postauth/basic", GetHttpHeaders(request, options), request); - } - } + public class BasicPaymentPostAuth : BasicPaymentResource + { + public static BasicPaymentPostAuth Create(CreatePaymentPostAuthRequest request, Options options) + { + var uri = options.BaseUrl + "/payment/postauth/basic"; + return RestHttpClientV2.Create().Post(uri, GetHttpHeadersWithRequestBody(request, uri, options), request); + } + } } diff --git a/Iyzipay/Model/BasicPaymentPreAuth.cs b/Iyzipay/Model/BasicPaymentPreAuth.cs index 8680f61..9a726a8 100644 --- a/Iyzipay/Model/BasicPaymentPreAuth.cs +++ b/Iyzipay/Model/BasicPaymentPreAuth.cs @@ -2,11 +2,12 @@ namespace Iyzipay.Model { - public class BasicPaymentPreAuth : BasicPaymentResource - { - public static BasicPaymentPreAuth Create(CreateBasicPaymentRequest request, Options options) - { - return RestHttpClient.Create().Post(options.BaseUrl + "/payment/preauth/basic", GetHttpHeaders(request, options), request); - } - } + public class BasicPaymentPreAuth : BasicPaymentResource + { + public static BasicPaymentPreAuth Create(CreateBasicPaymentRequest request, Options options) + { + var uri = options.BaseUrl + "/payment/preauth/basic"; + return RestHttpClientV2.Create().Post(uri, GetHttpHeadersWithRequestBody(request, uri, options), request); + } + } } diff --git a/Iyzipay/Model/BasicPaymentResource.cs b/Iyzipay/Model/BasicPaymentResource.cs index d930288..51083d1 100644 --- a/Iyzipay/Model/BasicPaymentResource.cs +++ b/Iyzipay/Model/BasicPaymentResource.cs @@ -2,25 +2,25 @@ namespace Iyzipay.Model { - public class BasicPaymentResource : IyzipayResource + public class BasicPaymentResource : IyzipayResourceV2 { - public String Price { get; set; } - public String PaidPrice { get; set; } + public string Price { get; set; } + public string PaidPrice { get; set; } public int? Installment { get; set; } - public String Currency { get; set; } - public String PaymentId { get; set; } - public String MerchantCommissionRate { get; set; } - public String MerchantCommissionRateAmount { get; set; } - public String IyziCommissionFee { get; set; } - public String CardType { get; set; } - public String CardAssociation { get; set; } - public String CardFamily { get; set; } - public String CardToken { get; set; } - public String CardUserKey { get; set; } - public String BinNumber { get; set; } - public String PaymentTransactionId { get; set; } - public String AuthCode { get; set; } - public String ConnectorName { get; set; } - public String Phase { get; set; } + public string Currency { get; set; } + public string PaymentId { get; set; } + public string MerchantCommissionRate { get; set; } + public string MerchantCommissionRateAmount { get; set; } + public string IyziCommissionFee { get; set; } + public string CardType { get; set; } + public string CardAssociation { get; set; } + public string CardFamily { get; set; } + public string CardToken { get; set; } + public string CardUserKey { get; set; } + public string BinNumber { get; set; } + public string PaymentTransactionId { get; set; } + public string AuthCode { get; set; } + public string ConnectorName { get; set; } + public string Phase { get; set; } } } diff --git a/Iyzipay/Model/BasicThreedsInitialize.cs b/Iyzipay/Model/BasicThreedsInitialize.cs index c0d759d..b6fd6ab 100644 --- a/Iyzipay/Model/BasicThreedsInitialize.cs +++ b/Iyzipay/Model/BasicThreedsInitialize.cs @@ -4,20 +4,20 @@ namespace Iyzipay.Model { - public class BasicThreedsInitialize : IyzipayResource - { - [JsonProperty(PropertyName = "threeDSHtmlContent")] - public String HtmlContent { get; set; } + public class BasicThreedsInitialize : IyzipayResourceV2 + { + [JsonProperty(PropertyName = "threeDSHtmlContent")] + public String HtmlContent { get; set; } + public static BasicThreedsInitialize Create(CreateBasicPaymentRequest request, Options options) + { + var uri = options.BaseUrl + "/payment/3dsecure/initialize/basic"; + BasicThreedsInitialize response = RestHttpClientV2.Create().Post(uri, GetHttpHeadersWithRequestBody(request, uri, options), request); - public static BasicThreedsInitialize Create(CreateBasicPaymentRequest request, Options options) - { - BasicThreedsInitialize response = RestHttpClient.Create().Post(options.BaseUrl + "/payment/3dsecure/initialize/basic", GetHttpHeaders(request, options), request); - - if (response != null) - { - response.HtmlContent = DigestHelper.DecodeString(response.HtmlContent); - } - return response; - } - } + if (response != null) + { + response.HtmlContent = DigestHelper.DecodeString(response.HtmlContent); + } + return response; + } + } } diff --git a/Iyzipay/Model/BasicThreedsInitializePreAuth.cs b/Iyzipay/Model/BasicThreedsInitializePreAuth.cs index 981cb71..3f80983 100644 --- a/Iyzipay/Model/BasicThreedsInitializePreAuth.cs +++ b/Iyzipay/Model/BasicThreedsInitializePreAuth.cs @@ -4,20 +4,21 @@ namespace Iyzipay.Model { - public class BasicThreedsInitializePreAuth : IyzipayResource - { - [JsonProperty(PropertyName = "threeDSHtmlContent")] - public String HtmlContent { get; set; } + public class BasicThreedsInitializePreAuth : IyzipayResourceV2 + { + [JsonProperty(PropertyName = "threeDSHtmlContent")] + public String HtmlContent { get; set; } - public static BasicThreedsInitializePreAuth Create(CreateBasicPaymentRequest request, Options options) - { - BasicThreedsInitializePreAuth response = RestHttpClient.Create().Post(options.BaseUrl + "/payment/3dsecure/initialize/preauth/basic", GetHttpHeaders(request, options), request); + public static BasicThreedsInitializePreAuth Create(CreateBasicPaymentRequest request, Options options) + { + var uri = options.BaseUrl + "/payment/3dsecure/initialize/preauth/basic"; + BasicThreedsInitializePreAuth response = RestHttpClientV2.Create().Post(uri, GetHttpHeadersWithRequestBody(request, uri, options), request); - if (response != null) - { - response.HtmlContent = DigestHelper.DecodeString(response.HtmlContent); - } - return response; - } - } + if (response != null) + { + response.HtmlContent = DigestHelper.DecodeString(response.HtmlContent); + } + return response; + } + } } diff --git a/Iyzipay/Model/BasicThreedsPayment.cs b/Iyzipay/Model/BasicThreedsPayment.cs index 4a621c7..4a972fb 100644 --- a/Iyzipay/Model/BasicThreedsPayment.cs +++ b/Iyzipay/Model/BasicThreedsPayment.cs @@ -2,11 +2,12 @@ namespace Iyzipay.Model { - public class BasicThreedsPayment : BasicPaymentResource - { - public static BasicThreedsPayment Create(CreateThreedsPaymentRequest request, Options options) - { - return RestHttpClient.Create().Post(options.BaseUrl + "/payment/3dsecure/auth/basic", GetHttpHeaders(request, options), request); - } - } + public class BasicThreedsPayment : BasicPaymentResource + { + public static BasicThreedsPayment Create(CreateThreedsPaymentRequest request, Options options) + { + var uri = options.BaseUrl + "/payment/3dsecure/auth/basic"; + return RestHttpClientV2.Create().Post(uri, GetHttpHeadersWithRequestBody(request, uri, options), request); + } + } } diff --git a/Iyzipay/Model/Bkm.cs b/Iyzipay/Model/Bkm.cs index 4f47e36..fb8b83c 100644 --- a/Iyzipay/Model/Bkm.cs +++ b/Iyzipay/Model/Bkm.cs @@ -5,12 +5,13 @@ namespace Iyzipay.Model { public class Bkm : PaymentResource { - public String Token { get; set; } - public String CallbackUrl { get; set; } + public string Token { get; set; } + public string CallbackUrl { get; set; } public static Bkm Retrieve(RetrieveBkmRequest request, Options options) { - return RestHttpClient.Create().Post(options.BaseUrl + "/payment/bkm/auth/detail", GetHttpHeaders(request, options), request); + var uri = options.BaseUrl + "/payment/bkm/auth/detail"; + return RestHttpClientV2.Create().Post(uri, GetHttpHeadersWithRequestBody(request, uri, options), request); } } } diff --git a/Iyzipay/Model/BkmInitialize.cs b/Iyzipay/Model/BkmInitialize.cs index 4d28da3..35279c4 100644 --- a/Iyzipay/Model/BkmInitialize.cs +++ b/Iyzipay/Model/BkmInitialize.cs @@ -3,20 +3,21 @@ namespace Iyzipay.Model { - public class BkmInitialize : IyzipayResource - { - public String HtmlContent { get; set; } - public String Token { get; set; } - - public static BkmInitialize Create(CreateBkmInitializeRequest request, Options options) - { - BkmInitialize response = RestHttpClient.Create().Post(options.BaseUrl + "/payment/bkm/initialize", GetHttpHeaders(request, options), request); + public class BkmInitialize : IyzipayResourceV2 + { + public string HtmlContent { get; set; } + public string Token { get; set; } - if (response != null) - { - response.HtmlContent = DigestHelper.DecodeString(response.HtmlContent); - } - return response; - } - } + public static BkmInitialize Create(CreateBkmInitializeRequest request, Options options) + { + var uri = options.BaseUrl + "/payment/bkm/initialize"; + BkmInitialize response = RestHttpClientV2.Create().Post(uri, GetHttpHeadersWithRequestBody(request, uri, options), request); + + if (response != null) + { + response.HtmlContent = DigestHelper.DecodeString(response.HtmlContent); + } + return response; + } + } } diff --git a/Iyzipay/Model/CheckoutForm.cs b/Iyzipay/Model/CheckoutForm.cs index 4fa5ac6..eb06c88 100644 --- a/Iyzipay/Model/CheckoutForm.cs +++ b/Iyzipay/Model/CheckoutForm.cs @@ -3,14 +3,15 @@ namespace Iyzipay.Model { - public class CheckoutForm : PaymentResource - { - public String Token { get; set; } - public String CallbackUrl { get; set; } + public class CheckoutForm : PaymentResource + { + public string Token { get; set; } + public string CallbackUrl { get; set; } - public static CheckoutForm Retrieve(RetrieveCheckoutFormRequest request, Options options) - { - return RestHttpClient.Create().Post(options.BaseUrl + "/payment/iyzipos/checkoutform/auth/ecom/detail", GetHttpHeaders(request, options), request); - } - } + public static CheckoutForm Retrieve(RetrieveCheckoutFormRequest request, Options options) + { + var uri = options.BaseUrl + "/payment/iyzipos/checkoutform/auth/ecom/detail"; + return RestHttpClientV2.Create().Post(uri, GetHttpHeadersWithRequestBody(request, uri, options), request); + } + } } diff --git a/Iyzipay/Model/CheckoutFormInitialize.cs b/Iyzipay/Model/CheckoutFormInitialize.cs index 90318f9..15196c3 100644 --- a/Iyzipay/Model/CheckoutFormInitialize.cs +++ b/Iyzipay/Model/CheckoutFormInitialize.cs @@ -6,7 +6,8 @@ public class CheckoutFormInitialize : CheckoutFormInitializeResource { public static CheckoutFormInitialize Create(CreateCheckoutFormInitializeRequest request, Options options) { - return RestHttpClient.Create().Post(options.BaseUrl + "/payment/iyzipos/checkoutform/initialize/auth/ecom", GetHttpHeaders(request, options), request); + var uri = options.BaseUrl + "/payment/iyzipos/checkoutform/initialize/auth/ecom"; + return RestHttpClientV2.Create().Post(uri, GetHttpHeadersWithRequestBody(request, uri, options), request); } } } diff --git a/Iyzipay/Model/CheckoutFormInitializePreAuth.cs b/Iyzipay/Model/CheckoutFormInitializePreAuth.cs index 3701c0a..4db2677 100644 --- a/Iyzipay/Model/CheckoutFormInitializePreAuth.cs +++ b/Iyzipay/Model/CheckoutFormInitializePreAuth.cs @@ -6,7 +6,8 @@ public class CheckoutFormInitializePreAuth : CheckoutFormInitializeResource { public static CheckoutFormInitializePreAuth Create(CreateCheckoutFormInitializeRequest request, Options options) { - return RestHttpClient.Create().Post(options.BaseUrl + "/payment/iyzipos/checkoutform/initialize/preauth/ecom", GetHttpHeaders(request, options), request); + var uri = options.BaseUrl + "/payment/iyzipos/checkoutform/initialize/preauth/ecom"; + return RestHttpClientV2.Create().Post(uri, GetHttpHeadersWithRequestBody(request, uri,options), request); } } } diff --git a/Iyzipay/Model/CheckoutFormInitializeResource.cs b/Iyzipay/Model/CheckoutFormInitializeResource.cs index b7ee110..f83cbeb 100644 --- a/Iyzipay/Model/CheckoutFormInitializeResource.cs +++ b/Iyzipay/Model/CheckoutFormInitializeResource.cs @@ -2,11 +2,11 @@ namespace Iyzipay.Model { - public class CheckoutFormInitializeResource : IyzipayResource + public class CheckoutFormInitializeResource : IyzipayResourceV2 { - public String Token { get; set; } - public String CheckoutFormContent { get; set; } + public string Token { get; set; } + public string CheckoutFormContent { get; set; } public long? TokenExpireTime { get; set; } - public String PaymentPageUrl { get; set; } + public string PaymentPageUrl { get; set; } } } diff --git a/Iyzipay/Model/PayWithIyzico.cs b/Iyzipay/Model/PayWithIyzico.cs index 994cc77..4728eb4 100644 --- a/Iyzipay/Model/PayWithIyzico.cs +++ b/Iyzipay/Model/PayWithIyzico.cs @@ -10,7 +10,8 @@ public class PayWithIyzico : PaymentResource public static PayWithIyzico Retrieve(RetrievePayWithIyzicoRequest request, Options options) { - return RestHttpClient.Create().Post(options.BaseUrl + "/payment/iyzipos/checkoutform/auth/ecom/detail", GetHttpHeaders(request, options), request); + var uri = options.BaseUrl + "/payment/iyzipos/checkoutform/auth/ecom/detail"; + return RestHttpClientV2.Create().Post(uri, GetHttpHeadersWithRequestBody(request, uri,options), request); } } } diff --git a/Iyzipay/Model/PayWithIyzicoInitialize.cs b/Iyzipay/Model/PayWithIyzicoInitialize.cs index 9585520..e3e0a67 100644 --- a/Iyzipay/Model/PayWithIyzicoInitialize.cs +++ b/Iyzipay/Model/PayWithIyzicoInitialize.cs @@ -2,11 +2,12 @@ namespace Iyzipay.Model { - public class PayWithIyzicoInitialize : PayWithIyzicoInitializeResource - { - public static PayWithIyzicoInitialize Create(CreatePayWithIyzicoInitializeRequest request, Options options) - { - return RestHttpClient.Create().Post(options.BaseUrl + "/payment/pay-with-iyzico/initialize", GetHttpHeaders(request, options), request); - } - } + public class PayWithIyzicoInitialize : PayWithIyzicoInitializeResource + { + public static PayWithIyzicoInitialize Create(CreatePayWithIyzicoInitializeRequest request, Options options) + { + var uri = options.BaseUrl + "/payment/pay-with-iyzico/initialize"; + return RestHttpClientV2.Create().Post(uri, GetHttpHeadersWithRequestBody(request, uri, options), request); + } + } } diff --git a/Iyzipay/Model/PayWithIyzicoInitializeResource.cs b/Iyzipay/Model/PayWithIyzicoInitializeResource.cs index 93a1a04..7adc7a7 100644 --- a/Iyzipay/Model/PayWithIyzicoInitializeResource.cs +++ b/Iyzipay/Model/PayWithIyzicoInitializeResource.cs @@ -2,11 +2,11 @@ namespace Iyzipay.Model { - public class PayWithIyzicoInitializeResource : IyzipayResource + public class PayWithIyzicoInitializeResource : IyzipayResourceV2 { - public String Token { get; set; } - public String CheckoutFormContent { get; set; } + public string Token { get; set; } + public string CheckoutFormContent { get; set; } public long? TokenExpireTime { get; set; } - public String PayWithIyzicoPageUrl { get; set; } + public string PayWithIyzicoPageUrl { get; set; } } } diff --git a/Iyzipay/Model/Payment.cs b/Iyzipay/Model/Payment.cs index a42c7b5..f78571c 100644 --- a/Iyzipay/Model/Payment.cs +++ b/Iyzipay/Model/Payment.cs @@ -2,16 +2,18 @@ namespace Iyzipay.Model { - public class Payment : PaymentResource - { - public static Payment Create(CreatePaymentRequest request, Options options) - { - return RestHttpClient.Create().Post(options.BaseUrl + "/payment/auth", GetHttpHeaders(request, options), request); - } + public class Payment : PaymentResource + { + public static Payment Create(CreatePaymentRequest request, Options options) + { + var uri = options.BaseUrl + "/payment/auth"; + return RestHttpClientV2.Create().Post(options.BaseUrl + "/payment/auth", GetHttpHeadersWithRequestBody(request, uri, options), request); + } - public static Payment Retrieve(RetrievePaymentRequest request, Options options) - { - return RestHttpClient.Create().Post(options.BaseUrl + "/payment/detail", GetHttpHeaders(request, options), request); - } - } + public static Payment Retrieve(RetrievePaymentRequest request, Options options) + { + var uri = options.BaseUrl + "/payment/detail"; + return RestHttpClientV2.Create().Post(uri, GetHttpHeadersWithRequestBody(request, uri, options), request); + } + } } diff --git a/Iyzipay/Model/PaymentPostAuth.cs b/Iyzipay/Model/PaymentPostAuth.cs index ff9202a..1ac1a22 100644 --- a/Iyzipay/Model/PaymentPostAuth.cs +++ b/Iyzipay/Model/PaymentPostAuth.cs @@ -2,11 +2,12 @@ namespace Iyzipay.Model { - public class PaymentPostAuth : PaymentResource - { - public static PaymentPostAuth Create(CreatePaymentPostAuthRequest request, Options options) - { - return RestHttpClient.Create().Post(options.BaseUrl + "/payment/postauth", GetHttpHeaders(request, options), request); - } - } + public class PaymentPostAuth : PaymentResource + { + public static PaymentPostAuth Create(CreatePaymentPostAuthRequest request, Options options) + { + var uri = options.BaseUrl + "/payment/postauth"; + return RestHttpClientV2.Create().Post(uri, GetHttpHeadersWithRequestBody(request, uri, options), request); + } + } } diff --git a/Iyzipay/Model/PaymentPreAuth.cs b/Iyzipay/Model/PaymentPreAuth.cs index cd326ef..b0e006a 100644 --- a/Iyzipay/Model/PaymentPreAuth.cs +++ b/Iyzipay/Model/PaymentPreAuth.cs @@ -2,16 +2,18 @@ namespace Iyzipay.Model { - public class PaymentPreAuth : PaymentResource - { - public static PaymentPreAuth Create(CreatePaymentRequest request, Options options) - { - return RestHttpClient.Create().Post(options.BaseUrl + "/payment/preauth", GetHttpHeaders(request, options), request); - } + public class PaymentPreAuth : PaymentResource + { + public static PaymentPreAuth Create(CreatePaymentRequest request, Options options) + { + var uri = options.BaseUrl + "/payment/preauth"; + return RestHttpClientV2.Create().Post(uri, GetHttpHeadersWithRequestBody(request, uri, options), request); + } - public static PaymentPreAuth Retrieve(RetrievePaymentRequest request, Options options) - { - return RestHttpClient.Create().Post(options.BaseUrl + "/payment/detail", GetHttpHeaders(request, options), request); - } - } + public static PaymentPreAuth Retrieve(RetrievePaymentRequest request, Options options) + { + var uri = options.BaseUrl + "/payment/detail"; + return RestHttpClientV2.Create().Post(uri, GetHttpHeadersWithRequestBody(request, uri, options), request); + } + } } diff --git a/Iyzipay/Model/PaymentResource.cs b/Iyzipay/Model/PaymentResource.cs index d312eb7..6a80fee 100644 --- a/Iyzipay/Model/PaymentResource.cs +++ b/Iyzipay/Model/PaymentResource.cs @@ -4,33 +4,33 @@ namespace Iyzipay.Model { - public class PaymentResource : IyzipayResource + public class PaymentResource : IyzipayResourceV2 { - public String Price { get; set; } - public String PaidPrice { get; set; } + public string Price { get; set; } + public string PaidPrice { get; set; } public int? Installment { get; set; } - public String Currency { get; set; } - public String PaymentId { get; set; } - public String PaymentStatus { get; set; } + public string Currency { get; set; } + public string PaymentId { get; set; } + public string PaymentStatus { get; set; } public int? FraudStatus { get; set; } - public String MerchantCommissionRate { get; set; } - public String MerchantCommissionRateAmount { get; set; } - public String IyziCommissionRateAmount { get; set; } - public String IyziCommissionFee { get; set; } - public String CardType { get; set; } - public String CardAssociation { get; set; } - public String CardFamily { get; set; } - public String CardToken { get; set; } - public String CardUserKey { get; set; } - public String BinNumber { get; set; } - public String LastFourDigits { get; set; } - public String BasketId { get; set; } + public string MerchantCommissionRate { get; set; } + public string MerchantCommissionRateAmount { get; set; } + public string IyziCommissionRateAmount { get; set; } + public string IyziCommissionFee { get; set; } + public string CardType { get; set; } + public string CardAssociation { get; set; } + public string CardFamily { get; set; } + public string CardToken { get; set; } + public string CardUserKey { get; set; } + public string BinNumber { get; set; } + public string LastFourDigits { get; set; } + public string BasketId { get; set; } [JsonProperty(PropertyName = "itemTransactions")] public List PaymentItems { get; set; } - public String ConnectorName { get; set; } - public String AuthCode { get; set; } - public String HostReference { get; set; } - public String Phase { get; set; } + public string ConnectorName { get; set; } + public string AuthCode { get; set; } + public string HostReference { get; set; } + public string Phase { get; set; } public int? MdStatus { get; set; } } } diff --git a/Iyzipay/Model/ThreedsInitialize.cs b/Iyzipay/Model/ThreedsInitialize.cs index a840b73..a87c50f 100644 --- a/Iyzipay/Model/ThreedsInitialize.cs +++ b/Iyzipay/Model/ThreedsInitialize.cs @@ -4,20 +4,21 @@ namespace Iyzipay.Model { - public class ThreedsInitialize : IyzipayResource - { - [JsonProperty(PropertyName = "threeDSHtmlContent")] - public String HtmlContent { get; set; } + public class ThreedsInitialize : IyzipayResourceV2 + { + [JsonProperty(PropertyName = "threeDSHtmlContent")] + public String HtmlContent { get; set; } - public static ThreedsInitialize Create(CreatePaymentRequest request, Options options) - { - ThreedsInitialize response = RestHttpClient.Create().Post(options.BaseUrl + "/payment/3dsecure/initialize", GetHttpHeaders(request, options), request); + public static ThreedsInitialize Create(CreatePaymentRequest request, Options options) + { + var uri = options.BaseUrl + "/payment/3dsecure/initialize"; + ThreedsInitialize response = RestHttpClientV2.Create().Post(uri, GetHttpHeadersWithRequestBody(request, uri, options), request); - if (response != null) - { - response.HtmlContent = DigestHelper.DecodeString(response.HtmlContent); - } - return response; - } - } + if (response != null) + { + response.HtmlContent = DigestHelper.DecodeString(response.HtmlContent); + } + return response; + } + } } diff --git a/Iyzipay/Model/ThreedsInitializePreAuth.cs b/Iyzipay/Model/ThreedsInitializePreAuth.cs index bf28694..6237c37 100644 --- a/Iyzipay/Model/ThreedsInitializePreAuth.cs +++ b/Iyzipay/Model/ThreedsInitializePreAuth.cs @@ -4,20 +4,21 @@ namespace Iyzipay.Model { - public class ThreedsInitializePreAuth : IyzipayResource - { - [JsonProperty(PropertyName = "threeDSHtmlContent")] - public String HtmlContent { get; set; } + public class ThreedsInitializePreAuth : IyzipayResourceV2 + { + [JsonProperty(PropertyName = "threeDSHtmlContent")] + public String HtmlContent { get; set; } - public static ThreedsInitializePreAuth Create(CreatePaymentRequest request, Options options) - { - ThreedsInitializePreAuth response = RestHttpClient.Create().Post(options.BaseUrl + "/payment/3dsecure/initialize/preauth", GetHttpHeaders(request, options), request); + public static ThreedsInitializePreAuth Create(CreatePaymentRequest request, Options options) + { + var uri = options.BaseUrl + "/payment/3dsecure/initialize/preauth"; + ThreedsInitializePreAuth response = RestHttpClientV2.Create().Post(uri, GetHttpHeadersWithRequestBody(request, uri, options), request); - if (response != null) - { - response.HtmlContent = DigestHelper.DecodeString(response.HtmlContent); - } - return response; - } - } + if (response != null) + { + response.HtmlContent = DigestHelper.DecodeString(response.HtmlContent); + } + return response; + } + } } diff --git a/Iyzipay/Model/ThreedsPayment.cs b/Iyzipay/Model/ThreedsPayment.cs index 4d42a22..39cb196 100644 --- a/Iyzipay/Model/ThreedsPayment.cs +++ b/Iyzipay/Model/ThreedsPayment.cs @@ -2,16 +2,18 @@ namespace Iyzipay.Model { - public class ThreedsPayment : PaymentResource - { - public static ThreedsPayment Create(CreateThreedsPaymentRequest request, Options options) - { - return RestHttpClient.Create().Post(options.BaseUrl + "/payment/3dsecure/auth", GetHttpHeaders(request, options), request); - } + public class ThreedsPayment : PaymentResource + { + public static ThreedsPayment Create(CreateThreedsPaymentRequest request, Options options) + { + var uri = options.BaseUrl + "/payment/3dsecure/auth"; + return RestHttpClientV2.Create().Post(uri, GetHttpHeadersWithRequestBody(request, uri, options), request); + } - public static ThreedsPayment Retrieve(RetrievePaymentRequest request, Options options) - { - return RestHttpClient.Create().Post(options.BaseUrl + "/payment/detail", GetHttpHeaders(request, options), request); - } - } + public static ThreedsPayment Retrieve(RetrievePaymentRequest request, Options options) + { + var uri = options.BaseUrl + "/payment/detail"; + return RestHttpClientV2.Create().Post(uri, GetHttpHeadersWithRequestBody(request, uri, options), request); + } + } } diff --git a/Iyzipay/Request/CreateApmInitializeRequest.cs b/Iyzipay/Request/CreateApmInitializeRequest.cs index 67a8e4d..886da9b 100644 --- a/Iyzipay/Request/CreateApmInitializeRequest.cs +++ b/Iyzipay/Request/CreateApmInitializeRequest.cs @@ -4,50 +4,25 @@ namespace Iyzipay.Request { - public class CreateApmInitializeRequest : BaseRequest + public class CreateApmInitializeRequest : BaseRequestV2 { - public String Price { get; set; } - public String PaidPrice { get; set; } - public String PaymentChannel { get; set; } - public String PaymentGroup { get; set; } - public String PaymentSource { get; set; } - public String Currency { get; set; } - public String BasketId { get; set; } - public String MerchantOrderId { get; set; } - public String CountryCode { get; set; } - public String AccountHolderName { get; set; } - public String MerchantCallbackUrl { get; set; } - public String MerchantErrorUrl { get; set; } - public String MerchantNotificationUrl { get; set; } - public String ApmType { get; set; } + public string Price { get; set; } + public string PaidPrice { get; set; } + public string PaymentChannel { get; set; } + public string PaymentGroup { get; set; } + public string PaymentSource { get; set; } + public string Currency { get; set; } + public string BasketId { get; set; } + public string MerchantOrderId { get; set; } + public string CountryCode { get; set; } + public string AccountHolderName { get; set; } + public string MerchantCallbackUrl { get; set; } + public string MerchantErrorUrl { get; set; } + public string MerchantNotificationUrl { get; set; } + public string ApmType { get; set; } public Buyer Buyer { get; set; } public Address ShippingAddress { get; set; } public Address BillingAddress { get; set; } public List BasketItems { get; set; } - - public override String ToPKIRequestString() - { - return ToStringRequestBuilder.NewInstance() - .AppendSuper(base.ToPKIRequestString()) - .AppendPrice("price", Price) - .AppendPrice("paidPrice", PaidPrice) - .Append("paymentChannel", PaymentChannel) - .Append("paymentGroup", PaymentGroup) - .Append("paymentSource", PaymentSource) - .Append("currency", Currency) - .Append("merchantOrderId", MerchantOrderId) - .Append("countryCode", CountryCode) - .Append("accountHolderName", AccountHolderName) - .Append("merchantCallbackUrl", MerchantCallbackUrl) - .Append("merchantErrorUrl", MerchantErrorUrl) - .Append("merchantNotificationUrl", MerchantNotificationUrl) - .Append("apmType", ApmType) - .Append("basketId", BasketId) - .Append("buyer", Buyer) - .Append("shippingAddress", ShippingAddress) - .Append("billingAddress", BillingAddress) - .AppendList("basketItems", BasketItems) - .GetRequestString(); - } } } diff --git a/Iyzipay/Request/CreateBasicPaymentRequest.cs b/Iyzipay/Request/CreateBasicPaymentRequest.cs index 6bb401a..ec0b9f2 100644 --- a/Iyzipay/Request/CreateBasicPaymentRequest.cs +++ b/Iyzipay/Request/CreateBasicPaymentRequest.cs @@ -3,43 +3,25 @@ namespace Iyzipay.Request { - public class CreateBasicPaymentRequest : BaseRequest + public class CreateBasicPaymentRequest : BaseRequestV2 { public static readonly int? SINGLE_INSTALLMENT = 1; - public String Price { get; set; } - public String PaidPrice { get; set; } + public string Price { get; set; } + public string PaidPrice { get; set; } public int? Installment { get; set; } - public String BuyerEmail { get; set; } - public String BuyerId { get; set; } - public String BuyerIp { get; set; } - public String PosOrderId { get; set; } + public string BuyerEmail { get; set; } + public string BuyerId { get; set; } + public string BuyerIp { get; set; } + public string PosOrderId { get; set; } public PaymentCard PaymentCard { get; set; } - public String Currency { get; set; } - public String ConnectorName { get; set; } - public String CallbackUrl { get; set; } + public string Currency { get; set; } + public string ConnectorName { get; set; } + public string CallbackUrl { get; set; } public CreateBasicPaymentRequest() { this.Installment = SINGLE_INSTALLMENT; } - - public override String ToPKIRequestString() - { - return ToStringRequestBuilder.NewInstance() - .AppendSuper(base.ToPKIRequestString()) - .AppendPrice("price", Price) - .AppendPrice("paidPrice", PaidPrice) - .Append("installment", Installment) - .Append("buyerEmail", BuyerEmail) - .Append("buyerId", BuyerId) - .Append("buyerIp", BuyerIp) - .Append("posOrderId", PosOrderId) - .Append("paymentCard", PaymentCard) - .Append("currency", Currency) - .Append("connectorName", ConnectorName) - .Append("callbackUrl", CallbackUrl) - .GetRequestString(); - } } } diff --git a/Iyzipay/Request/CreateBkmInitializeRequest.cs b/Iyzipay/Request/CreateBkmInitializeRequest.cs index 8c3a086..d25c963 100644 --- a/Iyzipay/Request/CreateBkmInitializeRequest.cs +++ b/Iyzipay/Request/CreateBkmInitializeRequest.cs @@ -4,34 +4,17 @@ namespace Iyzipay.Request { - public class CreateBkmInitializeRequest : BaseRequest + public class CreateBkmInitializeRequest : BaseRequestV2 { - public String Price { get; set; } - public String BasketId { get; set; } - public String PaymentGroup { get; set; } - public String PaymentSource { get; set; } + public string Price { get; set; } + public string BasketId { get; set; } + public string PaymentGroup { get; set; } + public string PaymentSource { get; set; } public Buyer Buyer { get; set; } public Address ShippingAddress { get; set; } public Address BillingAddress { get; set; } public List BasketItems { get; set; } - public String CallbackUrl { get; set; } + public string CallbackUrl { get; set; } public List EnabledInstallments { get; set; } - - public override String ToPKIRequestString() - { - return ToStringRequestBuilder.NewInstance() - .AppendSuper(base.ToPKIRequestString()) - .AppendPrice("price", Price) - .Append("basketId", BasketId) - .Append("paymentGroup", PaymentGroup) - .Append("buyer", Buyer) - .Append("shippingAddress", ShippingAddress) - .Append("billingAddress", BillingAddress) - .AppendList("basketItems", BasketItems) - .Append("callbackUrl", CallbackUrl) - .Append("paymentSource", PaymentSource) - .AppendList("enabledInstallments", EnabledInstallments) - .GetRequestString(); - } } } diff --git a/Iyzipay/Request/CreateCheckoutFormInitializeRequest.cs b/Iyzipay/Request/CreateCheckoutFormInitializeRequest.cs index 22149cd..89e656a 100644 --- a/Iyzipay/Request/CreateCheckoutFormInitializeRequest.cs +++ b/Iyzipay/Request/CreateCheckoutFormInitializeRequest.cs @@ -4,44 +4,22 @@ namespace Iyzipay.Request { - public class CreateCheckoutFormInitializeRequest : BaseRequest + public class CreateCheckoutFormInitializeRequest : BaseRequestV2 { - public String Price { get; set; } - public String PaidPrice { get; set; } - public String BasketId { get; set; } - public String PaymentGroup { get; set; } - public String PaymentSource { get; set; } - public String Currency { get; set; } + public string Price { get; set; } + public string PaidPrice { get; set; } + public string BasketId { get; set; } + public string PaymentGroup { get; set; } + public string PaymentSource { get; set; } + public string Currency { get; set; } public Buyer Buyer { get; set; } public Address ShippingAddress { get; set; } public Address BillingAddress { get; set; } public List BasketItems { get; set; } - public String CallbackUrl { get; set; } + public string CallbackUrl { get; set; } public int? ForceThreeDS { get; set; } - public String CardUserKey { get; set; } - public String PosOrderId { get; set; } + public string CardUserKey { get; set; } + public string PosOrderId { get; set; } public List EnabledInstallments { get; set; } - - public override String ToPKIRequestString() - { - return ToStringRequestBuilder.NewInstance() - .AppendSuper(base.ToPKIRequestString()) - .AppendPrice("price", Price) - .Append("basketId", BasketId) - .Append("paymentGroup", PaymentGroup) - .Append("buyer", Buyer) - .Append("shippingAddress", ShippingAddress) - .Append("billingAddress", BillingAddress) - .AppendList("basketItems", BasketItems) - .Append("callbackUrl", CallbackUrl) - .Append("paymentSource", PaymentSource) - .Append("currency", Currency) - .Append("posOrderId", PosOrderId) - .AppendPrice("paidPrice", PaidPrice) - .Append("forceThreeDS", ForceThreeDS) - .Append("cardUserKey", CardUserKey) - .AppendList("enabledInstallments", EnabledInstallments) - .GetRequestString(); - } } } diff --git a/Iyzipay/Request/CreatePayWithIyzicoInitializeRequest.cs b/Iyzipay/Request/CreatePayWithIyzicoInitializeRequest.cs index 283e814..e939a89 100644 --- a/Iyzipay/Request/CreatePayWithIyzicoInitializeRequest.cs +++ b/Iyzipay/Request/CreatePayWithIyzicoInitializeRequest.cs @@ -4,44 +4,22 @@ namespace Iyzipay.Request { - public class CreatePayWithIyzicoInitializeRequest : BaseRequest + public class CreatePayWithIyzicoInitializeRequest : BaseRequestV2 { - public String Price { get; set; } - public String PaidPrice { get; set; } - public String BasketId { get; set; } - public String PaymentGroup { get; set; } - public String PaymentSource { get; set; } - public String Currency { get; set; } + public string Price { get; set; } + public string PaidPrice { get; set; } + public string BasketId { get; set; } + public string PaymentGroup { get; set; } + public string PaymentSource { get; set; } + public string Currency { get; set; } public Buyer Buyer { get; set; } public Address ShippingAddress { get; set; } public Address BillingAddress { get; set; } public List BasketItems { get; set; } - public String CallbackUrl { get; set; } + public string CallbackUrl { get; set; } public int? ForceThreeDS { get; set; } - public String CardUserKey { get; set; } - public String PosOrderId { get; set; } + public string CardUserKey { get; set; } + public string PosOrderId { get; set; } public List EnabledInstallments { get; set; } - - public override String ToPKIRequestString() - { - return ToStringRequestBuilder.NewInstance() - .AppendSuper(base.ToPKIRequestString()) - .AppendPrice("price", Price) - .Append("basketId", BasketId) - .Append("paymentGroup", PaymentGroup) - .Append("buyer", Buyer) - .Append("shippingAddress", ShippingAddress) - .Append("billingAddress", BillingAddress) - .AppendList("basketItems", BasketItems) - .Append("callbackUrl", CallbackUrl) - .Append("paymentSource", PaymentSource) - .Append("currency", Currency) - .Append("posOrderId", PosOrderId) - .AppendPrice("paidPrice", PaidPrice) - .Append("forceThreeDS", ForceThreeDS) - .Append("cardUserKey", CardUserKey) - .AppendList("enabledInstallments", EnabledInstallments) - .GetRequestString(); - } } } diff --git a/Iyzipay/Request/CreatePaymentPostAuthRequest.cs b/Iyzipay/Request/CreatePaymentPostAuthRequest.cs index 895ab9e..141521b 100644 --- a/Iyzipay/Request/CreatePaymentPostAuthRequest.cs +++ b/Iyzipay/Request/CreatePaymentPostAuthRequest.cs @@ -2,22 +2,11 @@ namespace Iyzipay.Request { - public class CreatePaymentPostAuthRequest : BaseRequest + public class CreatePaymentPostAuthRequest : BaseRequestV2 { - public String PaymentId { get; set; } - public String PaidPrice { get; set; } - public String Ip { get; set; } - public String Currency { get; set; } - - public override String ToPKIRequestString() - { - return ToStringRequestBuilder.NewInstance() - .AppendSuper(base.ToPKIRequestString()) - .Append("paymentId", PaymentId) - .Append("ip", Ip) - .AppendPrice("paidPrice", PaidPrice) - .Append("currency", Currency) - .GetRequestString(); - } + public string PaymentId { get; set; } + public string PaidPrice { get; set; } + public string Ip { get; set; } + public string Currency { get; set; } } } diff --git a/Iyzipay/Request/CreatePaymentRequest.cs b/Iyzipay/Request/CreatePaymentRequest.cs index 21ec034..fd2df5a 100644 --- a/Iyzipay/Request/CreatePaymentRequest.cs +++ b/Iyzipay/Request/CreatePaymentRequest.cs @@ -4,49 +4,26 @@ namespace Iyzipay.Request { - public class CreatePaymentRequest : BaseRequest + public class CreatePaymentRequest : BaseRequestV2 { - public String Price { get; set; } - public String PaidPrice { get; set; } + public string Price { get; set; } + public string PaidPrice { get; set; } public int? Installment { get; set; } - public String PaymentChannel { get; set; } - public String BasketId { get; set; } - public String PaymentGroup { get; set; } + public string PaymentChannel { get; set; } + public string BasketId { get; set; } + public string PaymentGroup { get; set; } public PaymentCard PaymentCard { get; set; } public Buyer Buyer { get; set; } public Address ShippingAddress { get; set; } public Address BillingAddress { get; set; } public List BasketItems { get; set; } - public String PaymentSource { get; set; } - public String CallbackUrl { get; set; } - public String PosOrderId { get; set; } - public String ConnectorName { get; set; } - public String Currency { get; set; } + public string PaymentSource { get; set; } + public string CallbackUrl { get; set; } + public string PosOrderId { get; set; } + public string ConnectorName { get; set; } + public string Currency { get; set; } public LoyaltyReward Reward { get; set; } - public String GsmNumber { get; set; } + public string GsmNumber { get; set; } - public override String ToPKIRequestString() - { - return ToStringRequestBuilder.NewInstance() - .AppendSuper(base.ToPKIRequestString()) - .AppendPrice("price", Price) - .AppendPrice("paidPrice", PaidPrice) - .Append("installment", Installment) - .Append("paymentChannel", PaymentChannel) - .Append("basketId", BasketId) - .Append("paymentGroup", PaymentGroup) - .Append("paymentCard", PaymentCard) - .Append("buyer", Buyer) - .Append("shippingAddress", ShippingAddress) - .Append("billingAddress", BillingAddress) - .AppendList("basketItems", BasketItems) - .Append("paymentSource", PaymentSource) - .Append("currency", Currency) - .Append("posOrderId", PosOrderId) - .Append("connectorName", ConnectorName) - .Append("callbackUrl", CallbackUrl) - .Append("gsmNumber", GsmNumber) - .GetRequestString(); - } } } diff --git a/Iyzipay/Request/CreateThreedsPaymentRequest.cs b/Iyzipay/Request/CreateThreedsPaymentRequest.cs index dbed000..bfbee1a 100644 --- a/Iyzipay/Request/CreateThreedsPaymentRequest.cs +++ b/Iyzipay/Request/CreateThreedsPaymentRequest.cs @@ -2,18 +2,9 @@ namespace Iyzipay.Request { - public class CreateThreedsPaymentRequest : BaseRequest + public class CreateThreedsPaymentRequest : BaseRequestV2 { - public String PaymentId { get; set; } - public String ConversationData { get; set; } - - public override String ToPKIRequestString() - { - return ToStringRequestBuilder.NewInstance() - .AppendSuper(base.ToPKIRequestString()) - .Append("paymentId", PaymentId) - .Append("conversationData", ConversationData) - .GetRequestString(); - } + public string PaymentId { get; set; } + public string ConversationData { get; set; } } } diff --git a/Iyzipay/Request/RetrieveApmRequest.cs b/Iyzipay/Request/RetrieveApmRequest.cs index 76eba54..96afb3f 100644 --- a/Iyzipay/Request/RetrieveApmRequest.cs +++ b/Iyzipay/Request/RetrieveApmRequest.cs @@ -2,16 +2,9 @@ namespace Iyzipay.Request { - public class RetrieveApmRequest : BaseRequest + public class RetrieveApmRequest : BaseRequestV2 { - public String PaymentId { get; set; } + public string PaymentId { get; set; } - public override String ToPKIRequestString() - { - return ToStringRequestBuilder.NewInstance() - .AppendSuper(base.ToPKIRequestString()) - .Append("paymentId", PaymentId) - .GetRequestString(); - } } } diff --git a/Iyzipay/Request/RetrieveBkmRequest .cs b/Iyzipay/Request/RetrieveBkmRequest .cs index 62f41e6..041bcf3 100644 --- a/Iyzipay/Request/RetrieveBkmRequest .cs +++ b/Iyzipay/Request/RetrieveBkmRequest .cs @@ -2,16 +2,8 @@ namespace Iyzipay.Request { - public class RetrieveBkmRequest : BaseRequest + public class RetrieveBkmRequest : BaseRequestV2 { - public String Token { set; get; } - - public override String ToPKIRequestString() - { - return ToStringRequestBuilder.NewInstance() - .AppendSuper(base.ToPKIRequestString()) - .Append("token", Token) - .GetRequestString(); - } + public string Token { set; get; } } } diff --git a/Iyzipay/Request/RetrieveCheckoutFormRequest.cs b/Iyzipay/Request/RetrieveCheckoutFormRequest.cs index f71d461..66edffd 100644 --- a/Iyzipay/Request/RetrieveCheckoutFormRequest.cs +++ b/Iyzipay/Request/RetrieveCheckoutFormRequest.cs @@ -2,16 +2,8 @@ namespace Iyzipay.Request { - public class RetrieveCheckoutFormRequest : BaseRequest + public class RetrieveCheckoutFormRequest : BaseRequestV2 { - public String Token { set; get; } - - public override String ToPKIRequestString() - { - return ToStringRequestBuilder.NewInstance() - .AppendSuper(base.ToPKIRequestString()) - .Append("token", Token) - .GetRequestString(); - } + public string Token { set; get; } } } diff --git a/Iyzipay/Request/RetrievePayWithIyzicoRequest.cs b/Iyzipay/Request/RetrievePayWithIyzicoRequest.cs index 39e16df..5c4711a 100644 --- a/Iyzipay/Request/RetrievePayWithIyzicoRequest.cs +++ b/Iyzipay/Request/RetrievePayWithIyzicoRequest.cs @@ -2,16 +2,8 @@ namespace Iyzipay.Request { - public class RetrievePayWithIyzicoRequest : BaseRequest + public class RetrievePayWithIyzicoRequest : BaseRequestV2 { - public String Token { set; get; } - - public override String ToPKIRequestString() - { - return ToStringRequestBuilder.NewInstance() - .AppendSuper(base.ToPKIRequestString()) - .Append("token", Token) - .GetRequestString(); - } + public string Token { set; get; } } } diff --git a/Iyzipay/Request/RetrievePaymentRequest.cs b/Iyzipay/Request/RetrievePaymentRequest.cs index 4b4110a..860eae0 100644 --- a/Iyzipay/Request/RetrievePaymentRequest.cs +++ b/Iyzipay/Request/RetrievePaymentRequest.cs @@ -2,18 +2,9 @@ namespace Iyzipay.Request { - public class RetrievePaymentRequest : BaseRequest + public class RetrievePaymentRequest : BaseRequestV2 { - public String PaymentId { get; set; } - public String PaymentConversationId { get; set; } - - public override String ToPKIRequestString() - { - return ToStringRequestBuilder.NewInstance() - .AppendSuper(base.ToPKIRequestString()) - .Append("paymentId", PaymentId) - .Append("paymentConversationId", PaymentConversationId) - .GetRequestString(); - } + public string PaymentId { get; set; } + public string PaymentConversationId { get; set; } } } From d8fa9a22b6e5884a6119720b4e17f521c13050aa Mon Sep 17 00:00:00 2001 From: eeyuksel Date: Thu, 18 Jul 2024 09:57:14 +0300 Subject: [PATCH 2/3] sample verifcation methodu eklendi --- Iyzipay.Samples/SignatureVerification.cs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 Iyzipay.Samples/SignatureVerification.cs diff --git a/Iyzipay.Samples/SignatureVerification.cs b/Iyzipay.Samples/SignatureVerification.cs new file mode 100644 index 0000000..d3fa76c --- /dev/null +++ b/Iyzipay.Samples/SignatureVerification.cs @@ -0,0 +1,18 @@ +using System; +using System.Security.Cryptography; +using System.Text; + +namespace Iyzipay.Samples +{ + public class SignatureVerification + { + public static string GenerateHash(string apiKey, string secretKey, string randomString, string dataToEncrypt) + { + HashAlgorithm algorithm = new HMACSHA256(Encoding.UTF8.GetBytes(secretKey)); + byte[] computedHash = algorithm.ComputeHash(Encoding.UTF8.GetBytes(dataToEncrypt)); + string computedHashAsHex = BitConverter.ToString(computedHash).Replace("-", "").ToLower(); + string authorizationString = "apiKey:" + apiKey + "&randomKey:" + randomString + "&signature:" + computedHashAsHex; + return Convert.ToBase64String(Encoding.UTF8.GetBytes(authorizationString)); + } + } +} From 45038ecfa0cc9643dfcbdcf9293bb13ce1557a5a Mon Sep 17 00:00:00 2001 From: eeyuksel Date: Fri, 19 Jul 2024 09:48:54 +0300 Subject: [PATCH 3/3] =?UTF-8?q?signature=20d=C3=BCzeltildi?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Iyzipay.Samples/SignatureVerification.cs | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/Iyzipay.Samples/SignatureVerification.cs b/Iyzipay.Samples/SignatureVerification.cs index d3fa76c..b7fd2f0 100644 --- a/Iyzipay.Samples/SignatureVerification.cs +++ b/Iyzipay.Samples/SignatureVerification.cs @@ -6,13 +6,17 @@ namespace Iyzipay.Samples { public class SignatureVerification { - public static string GenerateHash(string apiKey, string secretKey, string randomString, string dataToEncrypt) + public static string CalculateHmacSHA256Signature(string secretKey, string[] parameters) { - HashAlgorithm algorithm = new HMACSHA256(Encoding.UTF8.GetBytes(secretKey)); - byte[] computedHash = algorithm.ComputeHash(Encoding.UTF8.GetBytes(dataToEncrypt)); - string computedHashAsHex = BitConverter.ToString(computedHash).Replace("-", "").ToLower(); - string authorizationString = "apiKey:" + apiKey + "&randomKey:" + randomString + "&signature:" + computedHashAsHex; - return Convert.ToBase64String(Encoding.UTF8.GetBytes(authorizationString)); + string dataToSign = string.Join(":", parameters); + byte[] keyBytes = Encoding.UTF8.GetBytes(secretKey); + byte[] dataBytes = Encoding.UTF8.GetBytes(dataToSign); + + using (var hmac = new HMACSHA256(keyBytes)) + { + byte[] hashBytes = hmac.ComputeHash(dataBytes); + return BitConverter.ToString(hashBytes).Replace("-", "").ToLower(); + } } } }