From c45b247f62e3559c07c3cfd4d4534d2ee1905aa4 Mon Sep 17 00:00:00 2001 From: Derya Cakmak <97deryacakmak@gmail.com> Date: Tue, 2 Jul 2024 15:23:22 +0300 Subject: [PATCH] update --- Craftgate/Adapter/BkmExpressPaymentAdapter.cs | 2 + Craftgate/Model/PaymentAuthenticationType.cs | 2 +- Craftgate/Request/InitBkmExpressRequest.cs | 4 ++ Samples/BkmExpressSample.cs | 69 ++++++++++--------- Samples/JuzdanSample.cs | 12 ++-- 5 files changed, 49 insertions(+), 40 deletions(-) diff --git a/Craftgate/Adapter/BkmExpressPaymentAdapter.cs b/Craftgate/Adapter/BkmExpressPaymentAdapter.cs index 217452e..85a7530 100644 --- a/Craftgate/Adapter/BkmExpressPaymentAdapter.cs +++ b/Craftgate/Adapter/BkmExpressPaymentAdapter.cs @@ -36,4 +36,6 @@ public PaymentResponse RetrievePayment( CreateHeaders(path, RequestOptions)); } + } + } \ No newline at end of file diff --git a/Craftgate/Model/PaymentAuthenticationType.cs b/Craftgate/Model/PaymentAuthenticationType.cs index 038ad09..0eeaa51 100644 --- a/Craftgate/Model/PaymentAuthenticationType.cs +++ b/Craftgate/Model/PaymentAuthenticationType.cs @@ -8,7 +8,7 @@ namespace Craftgate.Model public enum PaymentAuthenticationType { [EnumMember(Value = "THREE_DS")] THREE_DS, - [EnumMember(Value = "NON_THREE_DS")] NON_THREE_DS + [EnumMember(Value = "NON_THREE_DS")] NON_THREE_DS, [EnumMember(Value = "BKM_EXPRESS")] BKM_EXPRESS } } \ No newline at end of file diff --git a/Craftgate/Request/InitBkmExpressRequest.cs b/Craftgate/Request/InitBkmExpressRequest.cs index 8f9a90e..6794701 100644 --- a/Craftgate/Request/InitBkmExpressRequest.cs +++ b/Craftgate/Request/InitBkmExpressRequest.cs @@ -1,3 +1,7 @@ +using System.Collections.Generic; +using Craftgate.Model; +using Craftgate.Request.Dto; + namespace Craftgate.Request { public class InitBkmExpressRequest diff --git a/Samples/BkmExpressSample.cs b/Samples/BkmExpressSample.cs index 8c4065a..b7c21e2 100644 --- a/Samples/BkmExpressSample.cs +++ b/Samples/BkmExpressSample.cs @@ -12,45 +12,45 @@ public class BkmExpressSample { private readonly CraftgateClient _craftgateClient = new CraftgateClient("api-key", "secret-key", "https://sandbox-api.craftgate.io"); - + [Test] public void Init_Bkm_Express_Payment() { var request = new InitBkmExpressRequest { - Price = new decimal(100.0), - PaidPrice = new decimal(100.0), - ConversationId = "456d1297-908e-4bd6-a13b-4be31a6e47d5", - Currency = Currency.TRY, - PaymentGroup = PaymentGroup.LISTING_OR_SUBSCRIPTION, - Items = new List - { - new PaymentItem - { - Name = "Item 1", - ExternalId = Guid.NewGuid().ToString(), - Price = new decimal(30.0) - }, - new PaymentItem - { - Name = "Item 2", - ExternalId = Guid.NewGuid().ToString(), - Price = new decimal(50.0) - }, - new PaymentItem - { - Name = "Item 3", - ExternalId = Guid.NewGuid().ToString(), - Price = new decimal(20.0) - } - } - }; + Price = new decimal(100.0), + PaidPrice = new decimal(100.0), + ConversationId = "456d1297-908e-4bd6-a13b-4be31a6e47d5", + Currency = Currency.TRY, + PaymentGroup = PaymentGroup.LISTING_OR_SUBSCRIPTION, + Items = new List + { + new PaymentItem + { + Name = "Item 1", + ExternalId = Guid.NewGuid().ToString(), + Price = new decimal(30.0) + }, + new PaymentItem + { + Name = "Item 2", + ExternalId = Guid.NewGuid().ToString(), + Price = new decimal(50.0) + }, + new PaymentItem + { + Name = "Item 3", + ExternalId = Guid.NewGuid().ToString(), + Price = new decimal(20.0) + } + } + }; - var response = _craftgateClient.BkmExpress.Init(request); + var response = _craftgateClient.BkmExpress().Init(request); Assert.NotNull(response); } - + [Test] public void Complete_Bkm_Express_Payment() { @@ -63,17 +63,18 @@ public void Complete_Bkm_Express_Payment() }; - var response = _craftgateClient.BkmExpress.Complete(request); - Assert.NotNull(response.ReferenceId); + var response = _craftgateClient.BkmExpress().Complete(request); + Assert.NotNull(response.HostReference); Assert.NotNull(response); } [Test] public void Retrieve_Payment() { - var ticketId = "b9bd7b93-662f-4460-9ef3-8fc735853cf1" + var ticketId = "b9bd7b93-662f-4460-9ef3-8fc735853cf1"; - var response = _craftgateClient.BkmExpress.RetrievePayment(ticketId); + var response = _craftgateClient.BkmExpress().RetrievePayment(ticketId); Assert.NotNull(response); } + } } \ No newline at end of file diff --git a/Samples/JuzdanSample.cs b/Samples/JuzdanSample.cs index fccdaad..590b79b 100644 --- a/Samples/JuzdanSample.cs +++ b/Samples/JuzdanSample.cs @@ -1,6 +1,8 @@ +using System.Collections.Generic; using Craftgate; using Craftgate.Model; using Craftgate.Request; +using Craftgate.Request.Dto; using NUnit.Framework; namespace Samples @@ -29,10 +31,10 @@ public void Init() PaidPrice = 1, Currency = Currency.TRY, PaymentGroup = PaymentGroup.PRODUCT, - ConversationId = "testConversationId, - ExternalId = "testExternalId, - CallbackUrl = "www.testCallbackUrl.com, - ClientType = InitJuzdanPaymentRequest.ClientType, + ConversationId = "testConversationId", + ExternalId = "testExternalId", + CallbackUrl = "www.testCallbackUrl.com", + ClientType = ClientType.W, Items = items, PaymentPhase = PaymentPhase.AUTH, PaymentChannel = "testPaymentChannel", @@ -50,7 +52,7 @@ public void Init() public void Retrieve() { var referenceId = "5493c7a7-4d8b-4517-887d-f8b8f826a3d0"; - var paymentResponse = _craftgateClient.Juzdan().Retrieve(referenceId) + var paymentResponse = _craftgateClient.Juzdan().Retrieve(referenceId); Assert.IsNotNull(paymentResponse); Assert.AreEqual(PaymentSource.JUZDAN, paymentResponse.PaymentSource);