コード例 #1
0
        public void TestCancelPayment()
        {
            Moip.Models.PaymentRequest paymentRequest = Helpers.RequestsCreator.CreatePaymentWithPreAuthorizationRequest();

            string paymentId = controller.CreateCreditCard(GetClient().Orders.CreateOrder(Helpers.RequestsCreator.createOrderRequest()).Id, paymentRequest).Id;

            Thread.Sleep(1000);

            Moip.Models.PaymentResponse paymentResponse = controller.CancelPreAuthorized(paymentId);

            Assert.NotNull(paymentResponse.Id, "Id should not be null");
            Assert.AreEqual(1, paymentResponse.InstallmentCount, "Should match exactly (string literal match)");
            Assert.AreEqual("MyStore", paymentResponse.StatementDescriptor, "Should match exactly (string literal match)");
            Assert.AreEqual("CREDIT_CARD", paymentResponse.FundingInstrument.Method, "Should match exactly (string literal match)");
            Assert.AreEqual("Jose Goku da Silva", paymentResponse.FundingInstrument.CreditCard.Holder.Fullname, "Should match exactly (string literal match)");
            Assert.AreEqual("1988-12-30", paymentResponse.FundingInstrument.CreditCard.Holder.Birthdate, "Should match exactly (string literal match)");
            Assert.AreEqual("CPF", paymentResponse.FundingInstrument.CreditCard.Holder.TaxDocument.Type, "Should match exactly (string literal match)");
            Assert.AreEqual("33333333333", paymentResponse.FundingInstrument.CreditCard.Holder.TaxDocument.Number, "Should match exactly (string literal match)");
            Assert.AreEqual("CANCELLED", paymentResponse.Status, "Should match exactly (string literal match)");
        }