Esempio n. 1
0
        public async Task Should_Not_Update_Payment_Item_When_TransactionId_Is_Wrong()
        {
            CreateSubMerchantRequest createSubMerchantRequest = CreateSubMerchantRequestBuilder.Create()
                                                                .PersonalSubMerchantRequest()
                                                                .Build();

            SubMerchant subMerchant = await SubMerchant.CreateAsync(createSubMerchantRequest, Options);

            string subMerchantKey = subMerchant.SubMerchantKey;

            CreatePaymentRequest request = CreatePaymentRequestBuilder
                                           .Create()
                                           .MarketplacePayment(subMerchantKey, "40", "30")
                                           .Price("40")
                                           .PaidPrice("40")
                                           .Build();

            Payment payment = await Payment.CreateAsync(request, Options);

            UpdatePaymentItemRequest updateRequest = new UpdatePaymentItemRequest
            {
                Locale               = Locale.TR.ToString(),
                ConversationId       = payment.ConversationId,
                SubMerchantKey       = subMerchantKey,
                PaymentTransactionId = "1",
                SubMerchantPrice     = "25"
            };

            PaymentItem paymentItem = await PaymentItem.UpdateAsync(updateRequest, Options);

            PrintResponse(paymentItem);

            Assert.NotNull(paymentItem);
            Assert.AreEqual(Status.FAILURE.ToString(), paymentItem.Status);
        }
Esempio n. 2
0
        public async Task Should_Update_Payment_Item()
        {
            CreateSubMerchantRequest createSubMerchantRequest = CreateSubMerchantRequestBuilder.Create()
                                                                .PersonalSubMerchantRequest()
                                                                .Build();

            SubMerchant subMerchant = await SubMerchant.CreateAsync(createSubMerchantRequest, Options);

            string subMerchantKey = subMerchant.SubMerchantKey;

            CreatePaymentRequest request = CreatePaymentRequestBuilder
                                           .Create()
                                           .MarketplacePayment(subMerchantKey, "0.4", "0.3")
                                           .Price("0.4")
                                           .PaidPrice("0.4")
                                           .Build();

            Payment payment = await Payment.CreateAsync(request, Options);

            UpdatePaymentItemRequest updateRequest = new UpdatePaymentItemRequest
            {
                Locale               = Locale.TR.ToString(),
                ConversationId       = payment.ConversationId,
                SubMerchantKey       = subMerchantKey,
                PaymentTransactionId = payment.PaymentItems?[0]?.PaymentTransactionId,
                SubMerchantPrice     = "0.23"
            };

            PaymentItem paymentItem = await PaymentItem.UpdateAsync(updateRequest, Options);

            PrintResponse(paymentItem);

            Assert.NotNull(paymentItem);
            Assert.NotNull(paymentItem.Locale);
            Assert.NotNull(paymentItem.ConversationId);
            Assert.NotNull(paymentItem.SubMerchantKey);
            Assert.NotNull(paymentItem.PaymentTransactionId);
            Assert.NotNull(paymentItem.SubMerchantPrice);
            Assert.AreEqual(Status.SUCCESS.ToString(), paymentItem.Status);
            Assert.AreEqual(Locale.TR.ToString(), paymentItem.Locale);
            Assert.AreEqual(updateRequest.ConversationId, paymentItem.ConversationId);
            Assert.AreEqual(updateRequest.SubMerchantKey, paymentItem.SubMerchantKey);
            Assert.AreEqual(updateRequest.PaymentTransactionId, paymentItem.PaymentTransactionId);
            Assert.AreEqual(updateRequest.SubMerchantPrice, paymentItem.SubMerchantPrice);
        }
Esempio n. 3
0
        public void Should_Update_Payment_Item()
        {
            UpdatePaymentItemRequest request = new UpdatePaymentItemRequest();

            request.Locale               = Locale.TR.ToString();
            request.ConversationId       = "123456789";
            request.SubMerchantKey       = "subMerchantKey";
            request.PaymentTransactionId = "transactionId";
            request.SubMerchantPrice     = "price";

            PaymentItem paymentItem = PaymentItem.Update(request, options);

            PrintResponse <PaymentItem>(paymentItem);

            Assert.AreEqual(Status.SUCCESS.ToString(), paymentItem.Status);
            Assert.AreEqual(Locale.TR.ToString(), paymentItem.Locale);
            Assert.AreEqual("123456789", paymentItem.ConversationId);
            Assert.IsNotNull(paymentItem.SystemTime);
            Assert.IsNull(paymentItem.ErrorCode);
            Assert.IsNull(paymentItem.ErrorMessage);
            Assert.IsNull(paymentItem.ErrorGroup);
        }
        public async Task Should_Update_Payment_Item()
        {
            UpdatePaymentItemRequest request = new UpdatePaymentItemRequest
            {
                Locale               = Locale.TR.ToString(),
                ConversationId       = "123456789",
                SubMerchantKey       = "subMerchantKey",
                PaymentTransactionId = "transactionId",
                SubMerchantPrice     = "price"
            };

            PaymentItem paymentItem = await PaymentItem.UpdateAsync(request, Options);

            PrintResponse(paymentItem);

            Assert.AreEqual(Status.SUCCESS.ToString(), paymentItem.Status);
            Assert.AreEqual(Locale.TR.ToString(), paymentItem.Locale);
            Assert.AreEqual("123456789", paymentItem.ConversationId);
            Assert.IsNotNull(paymentItem.SystemTime);
            Assert.IsNull(paymentItem.ErrorCode);
            Assert.IsNull(paymentItem.ErrorMessage);
            Assert.IsNull(paymentItem.ErrorGroup);
        }
Esempio n. 5
0
 // Async
 public static async Task <PaymentItem> UpdateAsync(UpdatePaymentItemRequest request, Options options)
 {
     return(await RestHttpClient.Create().PutAsync <PaymentItem>(options.BaseUrl + "/payment/item", GetHttpHeaders(request, options), request));
 }
Esempio n. 6
0
 // sync
 public static PaymentItem Update(UpdatePaymentItemRequest request, Options options)
 {
     return(RestHttpClient.Create().Put <PaymentItem>(options.BaseUrl + "/payment/item", GetHttpHeaders(request, options), request));
 }
 public static async Task <PaymentItem> UpdateAsync(UpdatePaymentItemRequest request, Options options)
 {
     return(await RestHttpClient.Instance.PutAsync <PaymentItem>(options.BaseUrl + PaymentItemUrl, GetHttpHeaders(request, options), request));
 }
 public static PaymentItem Update(UpdatePaymentItemRequest request, Options options)
 {
     return(RestHttpClient.Instance.Put <PaymentItem>(options.BaseUrl + PaymentItemUrl, GetHttpHeaders(request, options), request));
 }