public CreatePeccoInitializeRequest Build() { CreatePeccoInitializeRequest createPeccoInitializeRequest = new CreatePeccoInitializeRequest(); createPeccoInitializeRequest.Locale = Locale; createPeccoInitializeRequest.ConversationId = ConversationId; createPeccoInitializeRequest.Price = _price; createPeccoInitializeRequest.PaidPrice = _paidPrice; createPeccoInitializeRequest.Currency = _currency; createPeccoInitializeRequest.BasketId = _basketId; createPeccoInitializeRequest.PaymentGroup = _paymentGroup; createPeccoInitializeRequest.PaymentSource = _paymentSource; createPeccoInitializeRequest.Buyer = _buyer; createPeccoInitializeRequest.ShippingAddress = _shippingAddress; createPeccoInitializeRequest.BillingAddress = _billingAddress; createPeccoInitializeRequest.BasketItems = _basketItems; createPeccoInitializeRequest.CallbackUrl = _callbackUrl; return(createPeccoInitializeRequest); }
public void Should_Create_Pecco_Payment() { CreatePeccoInitializeRequest request = CreatePeccoInitializeRequestBuilder.Create() .CallbackUrl("https://www.merchant.com/callback") .PaymentGroup(PaymentGroup.LISTING.ToString()) .Price("1") .PaidPrice("10") .Build(); string token = PeccoInitialize.Create(request, Options).Token; CreatePeccoPaymentRequest peccoPaymentRequest = CreatePeccoPaymentRequestBuilder.Create() .Token(token) .Build(); PeccoPayment peccoPayment = PeccoPayment.Create(peccoPaymentRequest, Options); PrintResponse(peccoPayment); }
public void Should_Initialize_Pecco() { CreatePeccoInitializeRequest request = CreatePeccoInitializeRequestBuilder.Create() .CallbackUrl("https://www.merchant.com/callback") .PaymentGroup(PaymentGroup.LISTING.ToString()) .Price("1") .PaidPrice("10") .Build(); PeccoInitialize peccoInitialize = PeccoInitialize.Create(request, Options); PrintResponse(peccoInitialize); Assert.AreEqual(Locale.TR.ToString(), peccoInitialize.Locale); Assert.AreEqual(Status.SUCCESS.ToString(), peccoInitialize.Status); Assert.NotNull(peccoInitialize.SystemTime); Assert.NotNull(peccoInitialize.HtmlContent); Assert.Null(peccoInitialize.ErrorCode); Assert.Null(peccoInitialize.ErrorMessage); Assert.Null(peccoInitialize.ErrorGroup); }
public void Should_Initialize_Pecco() { CreatePeccoInitializeRequest request = new CreatePeccoInitializeRequest(); request.Locale = Locale.TR.ToString(); request.ConversationId = "123456789"; request.Price = "100000"; request.PaidPrice = "120000"; request.Currency = Currency.IRR.ToString(); request.BasketId = "B67832"; request.PaymentGroup = PaymentGroup.PRODUCT.ToString(); request.CallbackUrl = "https://www.merchant.com/callback"; 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 = "30000"; 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 = "50000"; 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 = "20000"; basketItems.Add(thirdBasketItem); request.BasketItems = basketItems; PeccoInitialize peccoInitialize = PeccoInitialize.Create(request, options); PrintResponse <PeccoInitialize>(peccoInitialize); Assert.AreEqual(Status.SUCCESS.ToString(), peccoInitialize.Status); Assert.AreEqual(Locale.TR.ToString(), peccoInitialize.Locale); Assert.AreEqual("123456789", peccoInitialize.ConversationId); Assert.IsNotNull(peccoInitialize.SystemTime); Assert.IsNull(peccoInitialize.ErrorCode); Assert.IsNull(peccoInitialize.ErrorMessage); Assert.IsNull(peccoInitialize.ErrorGroup); Assert.IsNotNull(peccoInitialize.HtmlContent); }
public static PeccoInitialize Create(CreatePeccoInitializeRequest request, Options options) { return(RestHttpClient.Create().Post <PeccoInitialize>(options.BaseUrl + "/payment/pecco/initialize", request, options)); }
public static async Task <PeccoInitialize> CreateAsync(CreatePeccoInitializeRequest request, Options options) { return(await RestHttpClient.Instance.PostAsync <PeccoInitialize>(options.BaseUrl + PeccoInitializeUrl, GetHttpHeaders(request, options), request)); }
public static PeccoInitialize Create(CreatePeccoInitializeRequest request, Options options) { return(RestHttpClient.Instance.Post <PeccoInitialize>(options.BaseUrl + PeccoInitializeUrl, GetHttpHeaders(request, options), request)); }