Exemple #1
0
        public void Test_007_ChargeStoredCard_from_different_configs()
        {
            ServicesContainer.ConfigureService(new GpEcomConfig
            {
                MerchantId     = "heartlandgpsandbox",
                AccountId      = "3dsecure",
                RefundPassword = "******",
                SharedSecret   = "secret",
                RequestLogger  = new RequestConsoleLogger()
            });

            var paymentMethod = new_customer.AddPaymentMethod(PaymentId("Credit"), new CreditCardData
            {
                Number         = "4263970000005262",
                ExpMonth       = 5,
                ExpYear        = DateTime.Now.AddYears(2).Year,
                CardHolderName = "James Mason"
            }).Create("test");

            Assert.IsNotNull(paymentMethod);
            var response = paymentMethod.Charge(12m)
                           .WithRecurringInfo(RecurringType.Fixed, RecurringSequence.First)
                           .WithCurrency("USD")
                           .Execute("test");

            Assert.IsNotNull(response);
            Assert.AreEqual("00", response.ResponseCode);

            var pm = new RecurringPaymentMethod(CustomerId, PaymentId("Credit"));

            pm.Delete(configName: "test");

            var paymentMethod2 = new_customer.AddPaymentMethod(PaymentId("Credit"), new CreditCardData
            {
                Number         = "4263970000005262",
                ExpMonth       = 5,
                ExpYear        = DateTime.Now.AddYears(2).Year,
                CardHolderName = "James Mason 2"
            }).Create();

            Assert.IsNotNull(paymentMethod2);
            var response2 = paymentMethod2.Charge(12m)
                            .WithRecurringInfo(RecurringType.Fixed, RecurringSequence.First)
                            .WithCurrency("USD")
                            .Execute();

            Assert.IsNotNull(response2);
            Assert.AreEqual("00", response2.ResponseCode);

            var pm2 = new RecurringPaymentMethod(CustomerId, PaymentId("Credit"));

            pm2.Delete();
        }
        public IActionResult DeletecardApi(Datos detalles)
        {
            // configure client & request settings
            ServicesContainer.ConfigureService(new GatewayConfig {
                MerchantId   = "addonnettest",
                AccountId    = "api",
                SharedSecret = "secret",
                ServiceUrl   = "https://remote.sandbox.addonpayments.com/remote"
            });

            // Identificador del cliente
            var customerId = detalles.Cliente.payerref;

            // Identificador de la tarjeta
            var paymentId = detalles.Cliente.paymentmethod;

            // Asociamos la tarjeta al cliente
            var paymentMethod = new RecurringPaymentMethod(customerId, paymentId);

            try {
                // process an auto-capture authorization
                paymentMethod.Delete();

                Respuesta respuesta = new Respuesta {
                    result = "Tarjeta eliminada correctamente."
                };

                return(Ok(respuesta));
            }

            catch (ApiException exce) {
                RespuestaError respuesta = new RespuestaError {
                    resultado = "Error en el envío de datos <br><br>" + exce
                };
                return(BadRequest(respuesta));
            }
        }
Exemple #3
0
        public void Test_006_DeletePaymentMethod()
        {
            var paymentMethod = new RecurringPaymentMethod(CustomerId, PaymentId("Credit"));

            paymentMethod.Delete(configName: "test");
        }