Beispiel #1
0
        public async Task Should_Retrieve_Checkout_Form_Result()
        {
            IReadOnlyList <BasketItem> basketItems =
                new ReadOnlyCollection <BasketItem>(new List <BasketItem>()
            {
                BasketItemBuilder.Create().Price("0.3").Build()
            });

            CreateCheckoutFormInitializeRequest request = CreateCheckoutFormInitializeRequestBuilder.Create()
                                                          .Price("0.3")
                                                          .PaymentGroup(PaymentGroup.LISTING.ToString())
                                                          .PaidPrice("0.4")
                                                          .CallbackUrl("https://www.merchant.com/callback")
                                                          .BasketItems(basketItems)
                                                          .Build();

            CheckoutFormInitialize checkoutFormInitialize = await CheckoutFormInitialize.CreateAsync(request, Options);

            RetrieveCheckoutFormRequest retrieveCheckoutFormRequest = RetrieveCheckoutFormRequestBuilder.Create()
                                                                      .Token(checkoutFormInitialize.Token)
                                                                      .Build();

            CheckoutForm checkoutForm = await CheckoutForm.RetrieveAsync(retrieveCheckoutFormRequest, Options);

            PrintResponse(checkoutForm);

            Assert.NotNull(checkoutForm.ErrorMessage);
            Assert.AreEqual(Status.FAILURE.ToString(), checkoutForm.Status);
            Assert.NotNull(checkoutForm.SystemTime);
        }
Beispiel #2
0
        public async Task Should_Initialize_Checkout_Form_For_Standard_Merchant()
        {
            IReadOnlyList <BasketItem> basketItems =
                new ReadOnlyCollection <BasketItem>(new List <BasketItem>()
            {
                BasketItemBuilder.Create().Price("0.3").Build()
            });

            CreateCheckoutFormInitializeRequest request = CreateCheckoutFormInitializeRequestBuilder.Create()
                                                          .Price("0.3")
                                                          .PaymentGroup(PaymentGroup.LISTING.ToString())
                                                          .PaidPrice("0.4")
                                                          .CallbackUrl("https://www.merchant.com/callback")
                                                          .BasketItems(basketItems)
                                                          .Build();

            CheckoutFormInitialize checkoutFormInitialize = await CheckoutFormInitialize.CreateAsync(request, Options);

            PrintResponse(request);

            Assert.AreEqual(Status.SUCCESS.ToString(), checkoutFormInitialize.Status);
            Assert.AreEqual(Locale.TR.ToString(), checkoutFormInitialize.Locale);
            Assert.NotNull(checkoutFormInitialize.SystemTime);
            Assert.NotNull(checkoutFormInitialize.Token);
            Assert.NotNull(checkoutFormInitialize.CheckoutFormContent);
        }
Beispiel #3
0
 public CreatePaymentRequestBuilder StandardListingPayment()
 {
     _basketItems  = BasketItemBuilder.Create().BuildDefaultBasketItems();
     _paymentGroup = Model.PaymentGroup.LISTING.ToString();
     return(this);
 }
Beispiel #4
0
 public CreatePaymentRequestBuilder MarketplacePayment(string subMerchantKey, string price, string subMerchantPrice)
 {
     _basketItems  = BasketItemBuilder.Create().BuildBasketItem(subMerchantKey, price, subMerchantPrice);
     _paymentGroup = Model.PaymentGroup.PRODUCT.ToString();
     return(this);
 }
Beispiel #5
0
 public CreatePaymentRequestBuilder MarketplacePaymentWithSamePrice(string subMerchantKey)
 {
     _basketItems  = BasketItemBuilder.Create().BuildBasketItemsWithSubmetchantKeyAndSamePrice(subMerchantKey);
     _paymentGroup = Model.PaymentGroup.PRODUCT.ToString();
     return(this);
 }