-
Notifications
You must be signed in to change notification settings - Fork 62
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Adds Card Blacklist Feature * Card Blacklist Endpoint Change
- Loading branch information
1 parent
5d3de7b
commit 061aa83
Showing
5 changed files
with
169 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
using Iyzipay.Model; | ||
using Iyzipay.Request; | ||
using NUnit.Framework; | ||
|
||
namespace Iyzipay.Samples | ||
{ | ||
public class CardBlacklistSample : Sample | ||
{ | ||
[Test] | ||
public void Should_Create_Card_Blacklist() | ||
{ | ||
CreateCardBlacklistRequest request = new CreateCardBlacklistRequest(); | ||
request.Locale = Locale.TR.ToString(); | ||
request.ConversationId = "123456789"; | ||
request.CardToken = ""; | ||
request.CardUserKey = ""; | ||
|
||
|
||
CardBlacklist cardBlacklist = CardBlacklist.Create(request, options); | ||
|
||
|
||
PrintResponse<CardBlacklist>(cardBlacklist); | ||
|
||
Assert.AreEqual(Status.SUCCESS.ToString(), cardBlacklist.Status); | ||
Assert.AreEqual(Locale.TR.ToString(), cardBlacklist.Locale); | ||
Assert.AreEqual("123456789", cardBlacklist.ConversationId); | ||
Assert.IsNotNull(cardBlacklist.SystemTime); | ||
Assert.IsNull(cardBlacklist.ErrorCode); | ||
Assert.IsNull(cardBlacklist.ErrorMessage); | ||
Assert.IsNull(cardBlacklist.ErrorGroup); | ||
Assert.IsNotNull(cardBlacklist.CardUserKey); | ||
Assert.IsNotNull(cardBlacklist.CardToken); | ||
|
||
} | ||
|
||
[Test] | ||
public void Should_Update_Card_Blacklist() | ||
{ | ||
UpdateCardBlacklistRequest request = new UpdateCardBlacklistRequest(); | ||
request.Locale = Locale.TR.ToString(); | ||
request.ConversationId = "123456789"; | ||
request.CardToken = ""; | ||
request.CardUserKey = ""; | ||
|
||
|
||
CardBlacklist cardBlacklist = CardBlacklist.Update(request, options); | ||
|
||
|
||
PrintResponse<CardBlacklist>(cardBlacklist); | ||
|
||
Assert.AreEqual(Status.SUCCESS.ToString(), cardBlacklist.Status); | ||
Assert.AreEqual(Locale.TR.ToString(), cardBlacklist.Locale); | ||
Assert.AreEqual("123456789", cardBlacklist.ConversationId); | ||
Assert.IsNotNull(cardBlacklist.SystemTime); | ||
Assert.IsNull(cardBlacklist.ErrorCode); | ||
Assert.IsNull(cardBlacklist.ErrorMessage); | ||
Assert.IsNull(cardBlacklist.ErrorGroup); | ||
Assert.IsNotNull(cardBlacklist.CardUserKey); | ||
Assert.IsNotNull(cardBlacklist.CardToken); | ||
} | ||
|
||
[Test] | ||
public void Should_Retrieve_Blacklist_Cards() | ||
{ | ||
RetrieveCardBlacklistRequest request = new RetrieveCardBlacklistRequest(); | ||
request.Locale = Locale.TR.ToString(); | ||
request.ConversationId = "123456789"; | ||
request.CardNumber = ""; | ||
|
||
CardBlacklist cardBlacklist = CardBlacklist.Retrieve(request, options); | ||
|
||
PrintResponse<CardBlacklist>(cardBlacklist); | ||
|
||
Assert.AreEqual(Status.SUCCESS.ToString(), cardBlacklist.Status); | ||
Assert.AreEqual(Locale.TR.ToString(), cardBlacklist.Locale); | ||
Assert.IsNotNull(cardBlacklist.SystemTime); | ||
Assert.IsNull(cardBlacklist.ErrorCode); | ||
Assert.IsNull(cardBlacklist.ErrorMessage); | ||
Assert.IsNull(cardBlacklist.ErrorGroup); | ||
Assert.IsNotNull(cardBlacklist.CardNumber); | ||
Assert.IsNotNull(cardBlacklist.Blacklisted); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
using Iyzipay.Request; | ||
using System; | ||
|
||
namespace Iyzipay.Model | ||
{ | ||
public class CardBlacklist : IyzipayResource | ||
{ | ||
public String CardUserKey { get; set; } | ||
public String CardToken { get; set; } | ||
public String CardNumber { get; set; } | ||
public Boolean Blacklisted { get; set; } | ||
public static CardBlacklist Create(CreateCardBlacklistRequest request, Options options) | ||
{ | ||
return RestHttpClient.Create().Post<CardBlacklist>(options.BaseUrl + "/cardstorage/blacklist/card", GetHttpHeaders(request, options), request); | ||
} | ||
|
||
public static CardBlacklist Update(UpdateCardBlacklistRequest request, Options options) | ||
{ | ||
return RestHttpClient.Create().Post<CardBlacklist>(options.BaseUrl + "/cardstorage/blacklist/card/inactive", GetHttpHeaders(request, options), request); | ||
} | ||
|
||
public static CardBlacklist Retrieve(RetrieveCardBlacklistRequest request, Options options) | ||
{ | ||
return RestHttpClient.Create().Post<CardBlacklist>(options.BaseUrl + "/cardstorage/blacklist/card/retrieve", GetHttpHeaders(request, options), request); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
using Iyzipay.Model; | ||
using System; | ||
|
||
namespace Iyzipay.Request | ||
{ | ||
public class CreateCardBlacklistRequest : BaseRequest | ||
{ | ||
public String CardToken { get; set; } | ||
public String CardUserKey { get; set; } | ||
|
||
public override String ToPKIRequestString() | ||
{ | ||
return ToStringRequestBuilder.NewInstance() | ||
.AppendSuper(base.ToPKIRequestString()) | ||
.Append("cardToken", CardToken) | ||
.Append("cardUserKey", CardUserKey) | ||
.GetRequestString(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
using Iyzipay.Model; | ||
using System; | ||
|
||
namespace Iyzipay.Request | ||
{ | ||
public class RetrieveCardBlacklistRequest : BaseRequest | ||
{ | ||
public String CardNumber { get; set; } | ||
|
||
public override String ToPKIRequestString() | ||
{ | ||
return ToStringRequestBuilder.NewInstance() | ||
.AppendSuper(base.ToPKIRequestString()) | ||
.Append("cardNumber", CardNumber) | ||
.GetRequestString(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
using Iyzipay.Model; | ||
using System; | ||
|
||
namespace Iyzipay.Request | ||
{ | ||
public class UpdateCardBlacklistRequest : BaseRequest | ||
{ | ||
public String CardToken { get; set; } | ||
public String CardUserKey { get; set; } | ||
|
||
public override String ToPKIRequestString() | ||
{ | ||
return ToStringRequestBuilder.NewInstance() | ||
.AppendSuper(base.ToPKIRequestString()) | ||
.Append("cardToken", CardToken) | ||
.Append("cardUserKey", CardUserKey) | ||
.GetRequestString(); | ||
} | ||
} | ||
} |