Skip to content

Commit

Permalink
commercial parameter on binnumber (#100)
Browse files Browse the repository at this point in the history
- added commercial parameter on bin number class
- added commercial on installment detail
  • Loading branch information
halitsoydemir authored Aug 10, 2020
1 parent 316e56a commit 7347bc1
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 0 deletions.
30 changes: 30 additions & 0 deletions Iyzipay.Tests/Functional/BinNumberTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,37 @@ public void Should_Retrieve_Bin()
Assert.AreEqual("MASTER_CARD", binNumber.CardAssociation);
Assert.AreEqual("Bonus", binNumber.CardFamily);
Assert.AreEqual("Garanti Bankası", binNumber.BankName);
Assert.AreEqual(0, binNumber.Commercial);
Assert.AreEqual(62, binNumber.BankCode);
}

[Test]
public void Should_Retrieve_Bin_With_Commercial_One()
{
RetrieveBinNumberRequest request = RetrieveBinNumberRequestBuilder.Create()
.BinNumber("552659")
.Build();

BinNumber binNumber = BinNumber.Retrieve(request, _options);

PrintResponse(request);

Assert.AreEqual(Status.SUCCESS.ToString(), binNumber.Status);
Assert.AreEqual(Locale.TR.ToString(), binNumber.Locale);
Assert.AreEqual("123456789", binNumber.ConversationId);
Assert.NotNull(binNumber.SystemTime);
Assert.Null(binNumber.ErrorCode);
Assert.Null(binNumber.ErrorMessage);
Assert.Null(binNumber.ErrorGroup);
Assert.AreEqual("552659", binNumber.Bin);
Assert.AreEqual("CREDIT_CARD", binNumber.CardType);
Assert.AreEqual("MASTER_CARD", binNumber.CardAssociation);
Assert.AreEqual("World", binNumber.CardFamily);
Assert.AreEqual("Yapı Kredi Bankası", binNumber.BankName);
Assert.AreEqual(1, binNumber.Commercial);
Assert.AreEqual(67, binNumber.BankCode);
}
}


}
35 changes: 35 additions & 0 deletions Iyzipay.Tests/Functional/InstallmentTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,41 @@ public void Should_Retrieve_Installments()
Assert.AreEqual("CREDIT_CARD", installmentInfo.InstallmentDetails[0].CardType);
Assert.AreEqual("MASTER_CARD", installmentInfo.InstallmentDetails[0].CardAssociation);
Assert.AreEqual("Bonus", installmentInfo.InstallmentDetails[0].CardFamilyName);
Assert.AreEqual(0, installmentInfo.InstallmentDetails[0].Commercial);
Assert.NotNull(installmentInfo.InstallmentDetails[0].InstallmentPrices[0].InstallmentNumber);
Assert.NotNull(installmentInfo.InstallmentDetails[0].InstallmentPrices[0].Price);
Assert.NotNull(installmentInfo.InstallmentDetails[0].InstallmentPrices[0].TotalPrice);
Assert.NotNull(installmentInfo.SystemTime);
Assert.Null(installmentInfo.ErrorCode);
Assert.Null(installmentInfo.ErrorMessage);
Assert.Null(installmentInfo.ErrorGroup);
Assert.NotNull(installmentInfo.InstallmentDetails);
Assert.False(installmentInfo.InstallmentDetails.Count == 0);
}

[Test]
public void Should_Retrieve_Installments_With_Commercial_One()
{
RetrieveInstallmentInfoRequest request = new RetrieveInstallmentInfoRequest();
request.Locale = Locale.TR.ToString();
request.ConversationId = "123456789";
request.BinNumber = "552659";
request.Price = "100";

InstallmentInfo installmentInfo = InstallmentInfo.Retrieve(request, _options);

PrintResponse(installmentInfo);

Assert.AreEqual(Status.SUCCESS.ToString(), installmentInfo.Status);
Assert.AreEqual(Locale.TR.ToString(), installmentInfo.Locale);
Assert.AreEqual("123456789", installmentInfo.ConversationId);
Assert.NotNull(installmentInfo.InstallmentDetails[0]);
Assert.AreEqual("552659", installmentInfo.InstallmentDetails[0].BinNumber);
Assert.AreEqual("100", installmentInfo.InstallmentDetails[0].Price);
Assert.AreEqual("CREDIT_CARD", installmentInfo.InstallmentDetails[0].CardType);
Assert.AreEqual("MASTER_CARD", installmentInfo.InstallmentDetails[0].CardAssociation);
Assert.AreEqual("World", installmentInfo.InstallmentDetails[0].CardFamilyName);
Assert.AreEqual(1, installmentInfo.InstallmentDetails[0].Commercial);
Assert.NotNull(installmentInfo.InstallmentDetails[0].InstallmentPrices[0].InstallmentNumber);
Assert.NotNull(installmentInfo.InstallmentDetails[0].InstallmentPrices[0].Price);
Assert.NotNull(installmentInfo.InstallmentDetails[0].InstallmentPrices[0].TotalPrice);
Expand Down
1 change: 1 addition & 0 deletions Iyzipay/Model/BinNumber.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ public class BinNumber : IyzipayResource
public String CardFamily { get; set; }
public String BankName { get; set; }
public long BankCode { get; set; }
public int Commercial { get; set; }

public static BinNumber Retrieve(RetrieveBinNumberRequest request, Options options)
{
Expand Down
1 change: 1 addition & 0 deletions Iyzipay/Model/InstallmentDetail.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ namespace Iyzipay.Model
public class InstallmentDetail
{
public String BinNumber { get; set; }
public int Commercial { get; set; }
public String Price { get; set; }
public String CardType { get; set; }
public String CardAssociation { get; set; }
Expand Down

0 comments on commit 7347bc1

Please sign in to comment.