Example #1
0
        public void Test_007b_CreditCharge_ScheduleIdWithCOF()
        {
            RecurringPaymentMethod paymentMethod = RecurringPaymentMethod.Find(PaymentId("Credit"));

            Assert.IsNotNull(paymentMethod);

            Schedule schedule = Schedule.Find(PaymentId("Credit"));

            Assert.IsNotNull(schedule);

            Transaction response = paymentMethod.Charge(19m)
                                   .WithCurrency("USD")
                                   .WithScheduleId(schedule.Key)
                                   .WithAllowDuplicates(true)
                                   .WithOneTimePayment(false)
                                   .WithCardBrandStorage(StoredCredentialInitiator.CardHolder)
                                   .Execute();

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

            Transaction nextResponse = paymentMethod.Charge(15m)
                                       .WithCurrency("USD")
                                       .WithScheduleId(schedule.Key)
                                       .WithAllowDuplicates(true)
                                       .WithOneTimePayment(false)
                                       .WithCardBrandStorage(StoredCredentialInitiator.Merchant, response.CardBrandTransactionId)
                                       .Execute();

            Assert.IsNotNull(nextResponse);
            Assert.AreEqual("00", nextResponse.ResponseCode);
        }
        public void recurring_017_RecurringBillingCheckCCD()
        {
            if (_paymentMethodCheckCcd == null || _scheduleCheckCcd == null)
            {
                Assert.Inconclusive();
            }

            var response = _paymentMethodCheckCcd.Charge(20.04m)
                           .WithCurrency("USD")
                           .WithScheduleId(_scheduleVisa.Key)
                           .WithOneTimePayment(false)
                           .Execute();

            Assert.IsNotNull(response);
            Assert.AreEqual("00", response.ResponseCode);
        }
Example #3
0
        public void Test_005_RecurringPayment()
        {
            var paymentMethod = new RecurringPaymentMethod(CustomerId, PaymentId("Credit"));
            var response      = paymentMethod.Charge(12m)
                                .WithRecurringInfo(RecurringType.Fixed, RecurringSequence.First)
                                .WithCurrency("USD")
                                .Execute("test");

            Assert.IsNotNull(response);
            Assert.AreEqual("00", response.ResponseCode);
        }
Example #4
0
        public void Test_004a_ChargeStoredCard()
        {
            var paymentMethod = new RecurringPaymentMethod(CustomerId, PaymentId("Credit"));
            var response      = paymentMethod.Charge(10m)
                                .WithCurrency("USD")
                                .WithCvn("123")
                                .Execute("test");

            Assert.IsNotNull(response);
            Assert.AreEqual("00", response.ResponseCode);
        }
Example #5
0
        public IActionResult AuthstoreApi(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
                Transaction response = paymentMethod.Charge(detalles.Tarjeta.importe)
                                       .WithCurrency("EUR")
                                       .Execute();

                var result  = response.ResponseCode;    // 00 == Success
                var message = response.ResponseMessage; // [ test system ] AUTHORISED

                // get the response details to save to the DB for future requests
                var orderId             = response.OrderId;           // ezJDQjhENTZBLTdCNzNDQw
                var authCode            = response.AuthorizationCode; // 12345
                var paymentsReference   = response.TransactionId;     // pasref 14622680939731425
                var schemeReferenceData = response.SchemeId;          // MMC0F00YE4000000715

                Respuesta respuesta = new Respuesta {
                    result = result, message = message, orderId = orderId, authCode = authCode, paymentsReference = paymentsReference, schemeReferenceData = schemeReferenceData
                };

                return(Ok(respuesta));
            }

            catch (ApiException exce) {
                RespuestaError respuesta = new RespuestaError {
                    resultado = "Error en el envĂ­o de datos <br><br>" + exce
                };
                return(BadRequest(respuesta));
            }
        }
Example #6
0
        public void FullCycle_v2_StoredCard()
        {
            // check enrollment
            ThreeDSecure secureEcom = Secure3dService.CheckEnrollment(stored)
                                      .Execute(Secure3dVersion.Two);

            Assert.IsNotNull(secureEcom);

            if (secureEcom.Enrolled.Equals("True"))
            {
                Assert.AreEqual(Secure3dVersion.Two, secureEcom.Version);

                // initiate authentication
                ThreeDSecure initAuth = Secure3dService.InitiateAuthentication(stored, secureEcom)
                                        .WithAmount(10.01m)
                                        .WithCurrency("USD")
                                        .WithOrderCreateDate(DateTime.Now)
                                        .WithAddress(billingAddress, AddressType.Billing)
                                        .WithAddress(shippingAddress, AddressType.Shipping)
                                        .WithBrowserData(browserData)
                                        .WithMethodUrlCompletion(MethodUrlCompletion.NO)
                                        .Execute();
                Assert.IsNotNull(initAuth);

                // get authentication data
                secureEcom = Secure3dService.GetAuthenticationData()
                             .WithServerTransactionId(initAuth.ServerTransactionId)
                             .Execute();
                card.ThreeDSecure = secureEcom;

                if (secureEcom.Status.Equals("AUTHENTICATION_SUCCESSFUL"))
                {
                    Transaction response = stored.Charge(10.01m)
                                           .WithCurrency("USD")
                                           .Execute();
                    Assert.IsNotNull(response);
                    Assert.AreEqual("00", response.ResponseCode);
                }
                else
                {
                    Assert.Fail("Signature verification failed.");
                }
            }
            else
            {
                Assert.Fail("Card not enrolled.");
            }
        }
Example #7
0
        public void SeansLatestSNAFU()
        {
            // configure client & request settings
            ServicesContainer.ConfigureService(new GatewayConfig {
                MerchantId   = "seanmacdomhnalltest",
                AccountId    = "yoma",
                SharedSecret = "secret",
                ServiceUrl   = "https://api.sandbox.realexpayments.com/epage-remote.cgi"
            });

            // add obtained 3D Secure 2 authentication data
            var threeDSecureData = new ThreeDSecure()
            {
                AuthenticationValue          = "ODQzNjgwNjU0ZjM3N2JmYTg0NTM=",
                DirectoryServerTransactionId = "c272b04f-6e7b-43a2-bb78-90f4fb94aa25",
                Eci            = 5,
                MessageVersion = "2.1.0"
            };

            // supply existing customer/payer ref
            string customerId = "03e28f0e-4cf0-492e-80bd-20ec318e9334";
            // supply existing card/payment method ref
            string paymentId = "cdb398ac-8a0e-49f7-acf0-52a38832cfc9";

            // create the payment method object
            RecurringPaymentMethod paymentMethod = new RecurringPaymentMethod(customerId, paymentId)
            {
                ThreeDSecure = threeDSecureData
            };

            var orderId = "ezJDQjhENTZBLTdCNzNDQw"; // use the same Order ID from the Verify-Enrolled & Verify-Sig
                                                    // create the Authorization with 3D Secure information
            var response = paymentMethod.Charge(99.99m)
                           .WithOrderId(orderId)
                           .WithCurrency("EUR")
                           .Execute();

            Assert.IsNotNull(response);
        }