Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Basefy hash #142

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions Iyzipay.Samples/SignatureVerification.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
using System;
using System.Security.Cryptography;
using System.Text;

namespace Iyzipay.Samples
{
public class SignatureVerification
{
public static string CalculateHmacSHA256Signature(string secretKey, string[] parameters)
{
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();
}
}
}
}
24 changes: 13 additions & 11 deletions Iyzipay/Model/Apm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,18 @@

namespace Iyzipay.Model
{
public class Apm : ApmResource
{
public static Apm Create(CreateApmInitializeRequest request, Options options)
{
return RestHttpClient.Create().Post<Apm>(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<Apm>(uri, GetHttpHeadersWithRequestBody(request, uri, options), request);
}

public static Apm Retrieve(RetrieveApmRequest request, Options options)
{
return RestHttpClient.Create().Post<Apm>(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<Apm>(uri, GetHttpHeadersWithRequestBody(request, uri, options), request);
}
}
}
46 changes: 23 additions & 23 deletions Iyzipay/Model/ApmResource.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<PaymentItem> 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; }
}
}
21 changes: 11 additions & 10 deletions Iyzipay/Model/BasicBkm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<BasicBkm>(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<BasicBkm>(uri, GetHttpHeadersWithRequestBody(request, uri, options), request);
}
}
}
15 changes: 8 additions & 7 deletions Iyzipay/Model/BasicPayment.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@

namespace Iyzipay.Model
{
public class BasicPayment : BasicPaymentResource
{
public static BasicPayment Create(CreateBasicPaymentRequest request, Options options)
{
return RestHttpClient.Create().Post<BasicPayment>(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<BasicPayment>(uri, GetHttpHeadersWithRequestBody(request, uri, options), request);
}
}
}
15 changes: 8 additions & 7 deletions Iyzipay/Model/BasicPaymentPostAuth.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@

namespace Iyzipay.Model
{
public class BasicPaymentPostAuth : BasicPaymentResource
{
public static BasicPaymentPostAuth Create(CreatePaymentPostAuthRequest request, Options options)
{
return RestHttpClient.Create().Post<BasicPaymentPostAuth>(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<BasicPaymentPostAuth>(uri, GetHttpHeadersWithRequestBody(request, uri, options), request);
}
}
}
15 changes: 8 additions & 7 deletions Iyzipay/Model/BasicPaymentPreAuth.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@

namespace Iyzipay.Model
{
public class BasicPaymentPreAuth : BasicPaymentResource
{
public static BasicPaymentPreAuth Create(CreateBasicPaymentRequest request, Options options)
{
return RestHttpClient.Create().Post<BasicPaymentPreAuth>(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<BasicPaymentPreAuth>(uri, GetHttpHeadersWithRequestBody(request, uri, options), request);
}
}
}
36 changes: 18 additions & 18 deletions Iyzipay/Model/BasicPaymentResource.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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; }
}
}
30 changes: 15 additions & 15 deletions Iyzipay/Model/BasicThreedsInitialize.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<BasicThreedsInitialize>(uri, GetHttpHeadersWithRequestBody(request, uri, options), request);

public static BasicThreedsInitialize Create(CreateBasicPaymentRequest request, Options options)
{
BasicThreedsInitialize response = RestHttpClient.Create().Post<BasicThreedsInitialize>(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;
}
}
}
29 changes: 15 additions & 14 deletions Iyzipay/Model/BasicThreedsInitializePreAuth.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<BasicThreedsInitializePreAuth>(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<BasicThreedsInitializePreAuth>(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;
}
}
}
15 changes: 8 additions & 7 deletions Iyzipay/Model/BasicThreedsPayment.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,12 @@

namespace Iyzipay.Model
{
public class BasicThreedsPayment : BasicPaymentResource
{
public static BasicThreedsPayment Create(CreateThreedsPaymentRequest request, Options options)
{
return RestHttpClient.Create().Post<BasicThreedsPayment>(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<BasicThreedsPayment>(uri, GetHttpHeadersWithRequestBody(request, uri, options), request);
}
}
}
7 changes: 4 additions & 3 deletions Iyzipay/Model/Bkm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Bkm>(options.BaseUrl + "/payment/bkm/auth/detail", GetHttpHeaders(request, options), request);
var uri = options.BaseUrl + "/payment/bkm/auth/detail";
return RestHttpClientV2.Create().Post<Bkm>(uri, GetHttpHeadersWithRequestBody(request, uri, options), request);
}
}
}
31 changes: 16 additions & 15 deletions Iyzipay/Model/BkmInitialize.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<BkmInitialize>(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<BkmInitialize>(uri, GetHttpHeadersWithRequestBody(request, uri, options), request);

if (response != null)
{
response.HtmlContent = DigestHelper.DecodeString(response.HtmlContent);
}
return response;
}
}
}
Loading
Loading