Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
deryacakmak committed Jul 2, 2024
1 parent 0055b1f commit c45b247
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 40 deletions.
2 changes: 2 additions & 0 deletions Craftgate/Adapter/BkmExpressPaymentAdapter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,4 +36,6 @@ public PaymentResponse RetrievePayment(
CreateHeaders(path, RequestOptions));
}

}

}
2 changes: 1 addition & 1 deletion Craftgate/Model/PaymentAuthenticationType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
4 changes: 4 additions & 0 deletions Craftgate/Request/InitBkmExpressRequest.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
using System.Collections.Generic;
using Craftgate.Model;
using Craftgate.Request.Dto;

namespace Craftgate.Request
{
public class InitBkmExpressRequest
Expand Down
69 changes: 35 additions & 34 deletions Samples/BkmExpressSample.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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<PaymentItem>
{
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<PaymentItem>
{
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()
{
Expand All @@ -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);
}
}
}
12 changes: 7 additions & 5 deletions Samples/JuzdanSample.cs
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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",
Expand All @@ -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);
Expand Down

0 comments on commit c45b247

Please sign in to comment.