Esempio n. 1
0
        public void AnulacionPartialRefundTest()
        {
            DecidirConnector       decidir = new DecidirConnector(Ambiente.AMBIENTE_SANDBOX, "566f2c897b5e4bfaa0ec2452f5d67f13", "b192e4cb99564b84bf5db5550112adea");
            CardData               data    = GetCardData();
            PaymentResponse        resultPaymentResponse = new PaymentResponse();
            GetAllPaymentsResponse pagos        = new GetAllPaymentsResponse();
            RefundResponse         refund       = new RefundResponse();
            DeleteRefundResponse   deleteRefund = new DeleteRefundResponse();

            try
            {
                Payment payment = GetPayment();

                resultPaymentResponse = decidir.Payment(payment);

                Assert.AreEqual(resultPaymentResponse.bin, payment.bin);
                Assert.AreEqual(resultPaymentResponse.amount, payment.amount * 100);
                Assert.AreEqual(resultPaymentResponse.site_transaction_id, payment.site_transaction_id);

                //Wait for Refund
                Thread.Sleep(5000);
                refund = decidir.PartialRefund(resultPaymentResponse.id, 1000);

                Assert.AreEqual(1000 * 100, refund.amount);
                Assert.AreEqual("approved", refund.status);

                deleteRefund = decidir.DeletePartialRefund(resultPaymentResponse.id, refund.id);
            }
            catch (Exception)
            {
                Assert.AreEqual(true, false);
            }
        }
        public ActionResult DeletePartialRefund(int ambienteId, string privateApiKey, string publicApiKey, long paymentId, long refundId)
        {
            DecidirConnector decidir = new DecidirConnector(ambienteId, privateApiKey, publicApiKey);

            DeleteRefundResponse respuesta = decidir.DeletePartialRefund(paymentId, refundId);

            return(Json(respuesta));
        }