Exemplo n.º 1
0
        public async Task Should_Cancel_Fraudulent_Payment()
        {
            CreatePaymentRequest paymentRequest = CreatePaymentRequestBuilder.Create()
                                                  .StandardListingPayment()
                                                  .Build();

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

            CreateCancelRequest cancelRequest = CreateCancelRequestBuilder.Create()
                                                .PaymentId(payment.PaymentId)
                                                .Build();

            cancelRequest.Reason      = RefundReason.FRAUD.ToString();
            cancelRequest.Description = "stolen card request with 11000 try payment for default sample";

            Cancel cancel = await Cancel.CreateAsync(cancelRequest, Options);

            PrintResponse(cancel);

            Assert.AreEqual(Locale.TR.ToString(), cancel.Locale);
            Assert.AreEqual(Status.SUCCESS.ToString(), cancel.Status);
            Assert.AreEqual(payment.PaymentId, cancel.PaymentId);
            Assert.AreEqual("1.10000000", cancel.Price);
            Assert.AreEqual(1.1, cancel.Price.ParseDouble());
            AssertDecimal.AreEqual(1.10000000M, cancel.Price.ParseDecimal());
            Assert.AreEqual(Currency.TRY.ToString(), cancel.Currency);
            Assert.NotNull(cancel.SystemTime);
            Assert.Null(cancel.ErrorCode);
            Assert.Null(cancel.ErrorMessage);
            Assert.Null(cancel.ErrorGroup);
        }
Exemplo n.º 2
0
        public async Task Should_Cancel_Payment()
        {
            CreatePaymentRequest paymentRequest = CreatePaymentRequestBuilder.Create()
                                                  .StandardListingPayment()
                                                  .Build();

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

            CreateCancelRequest cancelRequest = CreateCancelRequestBuilder.Create()
                                                .PaymentId(payment.PaymentId)
                                                .Build();

            Cancel cancel = await Cancel.CreateAsync(cancelRequest, Options);

            PrintResponse(cancel);

            Assert.AreEqual(Locale.TR.ToString(), cancel.Locale);
            Assert.AreEqual(Status.SUCCESS.ToString(), cancel.Status);
            Assert.AreEqual(payment.PaymentId, cancel.PaymentId);
            Assert.AreEqual("1.10000000", cancel.Price);
            Assert.AreEqual(1.1, cancel.Price.ParseDouble());
            AssertDecimal.AreEqual(1.10000000M, cancel.Price.ParseDecimal());
            Assert.AreEqual(Currency.TRY.ToString(), cancel.Currency);
            Assert.NotNull(cancel.SystemTime);
            Assert.Null(cancel.ErrorCode);
            Assert.Null(cancel.ErrorMessage);
            Assert.Null(cancel.ErrorGroup);
        }
Exemplo n.º 3
0
        public async Task Should_Cancel_Payment()
        {
            CreateCancelRequest request = new CreateCancelRequest
            {
                ConversationId = "123456789",
                Locale         = Locale.TR.ToString(),
                PaymentId      = "1",
                Ip             = "85.34.78.112"
            };

            Cancel cancel = await Cancel.CreateAsync(request, Options);

            PrintResponse(cancel);

            Assert.AreEqual(Status.SUCCESS.ToString(), cancel.Status);
            Assert.AreEqual(Locale.TR.ToString(), cancel.Locale);
            Assert.AreEqual("123456789", cancel.ConversationId);
            Assert.IsNotNull(cancel.SystemTime);
            Assert.IsNull(cancel.ErrorCode);
            Assert.IsNull(cancel.ErrorMessage);
            Assert.IsNull(cancel.ErrorGroup);
        }
Exemplo n.º 4
0
        public async Task Should_Cancel_Payment_With_Reason_And_Description()
        {
            CreateCancelRequest request = new CreateCancelRequest
            {
                ConversationId = "123456789",
                Locale         = Locale.TR.ToString(),
                PaymentId      = "1",
                Ip             = "85.34.78.112",
                Reason         = RefundReason.OTHER.ToString(),
                Description    = "customer requested for default sample"
            };

            Cancel cancel = await Cancel.CreateAsync(request, Options);

            PrintResponse(cancel);

            Assert.AreEqual(Status.SUCCESS.ToString(), cancel.Status);
            Assert.AreEqual(Locale.TR.ToString(), cancel.Locale);
            Assert.AreEqual("123456789", cancel.ConversationId);
            Assert.IsNotNull(cancel.SystemTime);
            Assert.IsNull(cancel.ErrorCode);
            Assert.IsNull(cancel.ErrorMessage);
            Assert.IsNull(cancel.ErrorGroup);
        }