public void Should_Initialize_PayWithIyzico() { CreatePayWithIyzicoInitializeRequest request = new CreatePayWithIyzicoInitializeRequest(); request.Locale = Locale.TR.ToString(); request.ConversationId = "123456789"; request.Price = "1"; request.PaidPrice = "1.2"; request.Currency = Currency.TRY.ToString(); request.BasketId = "B67832"; request.PaymentGroup = PaymentGroup.PRODUCT.ToString(); request.CallbackUrl = "https://www.merchant.com/callback"; List <int> enabledInstallments = new List <int>(); enabledInstallments.Add(2); enabledInstallments.Add(3); enabledInstallments.Add(6); enabledInstallments.Add(9); request.EnabledInstallments = enabledInstallments; Buyer buyer = new Buyer(); buyer.Id = "BY789"; buyer.Name = "John"; buyer.Surname = "Doe"; buyer.GsmNumber = "+905350000000"; buyer.Email = "*****@*****.**"; buyer.IdentityNumber = "74300864791"; buyer.LastLoginDate = "2015-10-05 12:43:35"; buyer.RegistrationDate = "2013-04-21 15:12:09"; buyer.RegistrationAddress = "Nidakule Göztepe, Merdivenköy Mah. Bora Sok. No:1"; buyer.Ip = "85.34.78.112"; buyer.City = "Istanbul"; buyer.Country = "Turkey"; buyer.ZipCode = "34732"; request.Buyer = buyer; Address shippingAddress = new Address(); shippingAddress.ContactName = "Jane Doe"; shippingAddress.City = "Istanbul"; shippingAddress.Country = "Turkey"; shippingAddress.Description = "Nidakule Göztepe, Merdivenköy Mah. Bora Sok. No:1"; shippingAddress.ZipCode = "34742"; request.ShippingAddress = shippingAddress; Address billingAddress = new Address(); billingAddress.ContactName = "Jane Doe"; billingAddress.City = "Istanbul"; billingAddress.Country = "Turkey"; billingAddress.Description = "Nidakule Göztepe, Merdivenköy Mah. Bora Sok. No:1"; billingAddress.ZipCode = "34742"; request.BillingAddress = billingAddress; List <BasketItem> basketItems = new List <BasketItem>(); BasketItem firstBasketItem = new BasketItem(); firstBasketItem.Id = "BI101"; firstBasketItem.Name = "Binocular"; firstBasketItem.Category1 = "Collectibles"; firstBasketItem.Category2 = "Accessories"; firstBasketItem.ItemType = BasketItemType.PHYSICAL.ToString(); firstBasketItem.Price = "0.3"; basketItems.Add(firstBasketItem); BasketItem secondBasketItem = new BasketItem(); secondBasketItem.Id = "BI102"; secondBasketItem.Name = "Game code"; secondBasketItem.Category1 = "Game"; secondBasketItem.Category2 = "Online Game Items"; secondBasketItem.ItemType = BasketItemType.VIRTUAL.ToString(); secondBasketItem.Price = "0.5"; basketItems.Add(secondBasketItem); BasketItem thirdBasketItem = new BasketItem(); thirdBasketItem.Id = "BI103"; thirdBasketItem.Name = "Usb"; thirdBasketItem.Category1 = "Electronics"; thirdBasketItem.Category2 = "Usb / Cable"; thirdBasketItem.ItemType = BasketItemType.PHYSICAL.ToString(); thirdBasketItem.Price = "0.2"; basketItems.Add(thirdBasketItem); request.BasketItems = basketItems; PayWithIyzicoInitialize payWithIyzicoInitialize = PayWithIyzicoInitialize.Create(request, options); PrintResponse <PayWithIyzicoInitialize>(payWithIyzicoInitialize); Assert.AreEqual(Status.SUCCESS.ToString(), payWithIyzicoInitialize.Status); Assert.AreEqual(Locale.TR.ToString(), payWithIyzicoInitialize.Locale); Assert.AreEqual("123456789", payWithIyzicoInitialize.ConversationId); Assert.IsNotNull(payWithIyzicoInitialize.SystemTime); Assert.IsNull(payWithIyzicoInitialize.ErrorCode); Assert.IsNull(payWithIyzicoInitialize.ErrorMessage); Assert.IsNull(payWithIyzicoInitialize.ErrorGroup); Assert.IsNotNull(payWithIyzicoInitialize.CheckoutFormContent); Assert.IsNotNull(payWithIyzicoInitialize.PayWithIyzicoPageUrl); }
public async Task Should_Initialize_PayWithIyzico() { List <int> enabledInstallments = new List <int>(); enabledInstallments.Add(2); enabledInstallments.Add(3); enabledInstallments.Add(6); enabledInstallments.Add(9); Buyer buyer = new Buyer { Id = "BY789", Name = "John", Surname = "Doe", GsmNumber = "+905350000000", Email = "*****@*****.**", IdentityNumber = "74300864791", LastLoginDate = "2015-10-05 12:43:35", RegistrationDate = "2013-04-21 15:12:09", RegistrationAddress = "Nidakule Göztepe, Merdivenköy Mah. Bora Sok. No:1", Ip = "85.34.78.112", City = "Istanbul", Country = "Turkey", ZipCode = "34732" }; Address shippingAddress = new Address { ContactName = "Jane Doe", City = "Istanbul", Country = "Turkey", Description = "Nidakule Göztepe, Merdivenköy Mah. Bora Sok. No:1", ZipCode = "34742" }; Address billingAddress = new Address { ContactName = "Jane Doe", City = "Istanbul", Country = "Turkey", Description = "Nidakule Göztepe, Merdivenköy Mah. Bora Sok. No:1", ZipCode = "34742" }; List <BasketItem> basketItems = new List <BasketItem> { new BasketItem { Id = "BI101", Name = "Binocular", Category1 = "Collectibles", Category2 = "Accessories", ItemType = BasketItemType.PHYSICAL.ToString(), Price = "0.3" }, new BasketItem { Id = "BI102", Name = "Game code", Category1 = "Game", Category2 = "Online Game Items", ItemType = BasketItemType.VIRTUAL.ToString(), Price = "0.5" }, new BasketItem { Id = "BI103", Name = "Usb", Category1 = "Electronics", Category2 = "Usb / Cable", ItemType = BasketItemType.PHYSICAL.ToString(), Price = "0.2" } }; CreatePayWithIyzicoInitializeRequest request = new CreatePayWithIyzicoInitializeRequest { Locale = Locale.TR.ToString(), ConversationId = "123456789", Price = "1", PaidPrice = "1.2", Currency = Currency.TRY.ToString(), BasketId = "B67832", PaymentGroup = PaymentGroup.PRODUCT.ToString(), CallbackUrl = "https://www.merchant.com/callback", EnabledInstallments = enabledInstallments, Buyer = buyer, ShippingAddress = shippingAddress, BillingAddress = billingAddress, BasketItems = basketItems }; PayWithIyzicoInitialize payWithIyzicoInitialize = await PayWithIyzicoInitialize.CreateAsync(request, Options); PrintResponse <PayWithIyzicoInitialize>(payWithIyzicoInitialize); Assert.AreEqual(Status.SUCCESS.ToString(), payWithIyzicoInitialize.Status); Assert.AreEqual(Locale.TR.ToString(), payWithIyzicoInitialize.Locale); Assert.AreEqual("123456789", payWithIyzicoInitialize.ConversationId); Assert.IsNotNull(payWithIyzicoInitialize.SystemTime); Assert.IsNull(payWithIyzicoInitialize.ErrorCode); Assert.IsNull(payWithIyzicoInitialize.ErrorMessage); Assert.IsNull(payWithIyzicoInitialize.ErrorGroup); Assert.IsNotNull(payWithIyzicoInitialize.CheckoutFormContent); Assert.IsNotNull(payWithIyzicoInitialize.PayWithIyzicoPageUrl); }