public PorticoRecurringTests() { ServicesContainer.ConfigureService(new PorticoConfig { SecretApiKey = "skapi_cert_MTyMAQBiHVEAewvIzXVFcmUd2UcyBge_eCpaASUp0A" }); }
public DebitService(GatewayConfig config, string configName = "default") { ServicesContainer.ConfigureService(config, configName); }
public HostedService(GpEcomConfig config, string configName = "default") { _config = config; ServicesContainer.ConfigureService(config, configName); }
public Secure3dServiceTests() { GatewayConfig config = new GatewayConfig { MerchantId = "myMerchantId", AccountId = "ecom3ds", SharedSecret = "secret", MethodNotificationUrl = "https://www.example.com/methodNotificationUrl", ChallengeNotificationUrl = "https://www.example.com/challengeNotificationUrl", Secure3dVersion = Secure3dVersion.Any, }; ServicesContainer.ConfigureService(config); // create card data card = new CreditCardData { Number = "4263970000005262", ExpMonth = 12, ExpYear = 2025, CardHolderName = "John Smith" }; // stored card stored = new RecurringPaymentMethod( "20190809-Realex", "20190809-Realex-Credit" ); // shipping address shippingAddress = new Address { StreetAddress1 = "Apartment 852", StreetAddress2 = "Complex 741", StreetAddress3 = "no", City = "Chicago", PostalCode = "5001", State = "IL", CountryCode = "840" }; // billing address billingAddress = new Address { StreetAddress1 = "Flat 456", StreetAddress2 = "House 789", StreetAddress3 = "no", City = "Halifax", PostalCode = "W5 9HR", CountryCode = "826" }; // browser data browserData = new BrowserData { AcceptHeader = "text/html,application/xhtml+xml,application/xml;q=9,image/webp,img/apng,*/*;q=0.8", ColorDepth = ColorDepth.TWENTY_FOUR_BITS, IpAddress = "123.123.123.123", JavaEnabled = true, Language = "en", ScreenHeight = 1080, ScreenWidth = 1920, ChallengeWindowSize = ChallengeWindowSize.WINDOWED_600X400, Timezone = "0", UserAgent = "Mozilla/5.0 (Windows NT 6.1; Win64, x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36" }; }
public NWSDebitTests() { Address address = new Address { Name = "My STORE", StreetAddress1 = "1 MY STREET", City = "MYTOWN", PostalCode = "90210", State = "KY", Country = "USA" }; AcceptorConfig acceptorConfig = new AcceptorConfig { Address = address, // data code values CardDataInputCapability = CardDataInputCapability.ContactlessEmv_ContactEmv_MagStripe_KeyEntry, TerminalOutputCapability = TerminalOutputCapability.Printing_Display, //CardHolderAuthenticationEntity = CardHolderAuthenticationEntity.AuthorizingAgent, //OperatingEnvironment = OperatingEnvironment.OnPremises_CardAcceptor_Unattended, // hardware software config values HardwareLevel = "34", SoftwareLevel = "21205710", // pos configuration values SupportsPartialApproval = true, SupportsShutOffAmount = true, SupportsReturnBalance = true, SupportsDiscoverNetworkReferenceId = true, SupportsAvsCnvVoidReferrals = true }; // gateway config NetworkGatewayConfig config = new NetworkGatewayConfig(NetworkGatewayType.NWS) { ServiceUrl = "test.txns-c.secureexchange.net", PrimaryPort = 15031, SecondaryEndpoint = "test.txns-e.secureexchange.net", SecondaryPort = 15031, CompanyId = "SPSA", TerminalId = "NWSDOTNET02", UniqueDeviceId = "0001", AcceptorConfig = acceptorConfig, EnableLogging = true, StanProvider = StanGenerator.GetInstance(), BatchProvider = BatchProvider.GetInstance() }; ServicesContainer.ConfigureService(config); // with merchant type config.MerchantType = "5542"; ServicesContainer.ConfigureService(config, "ICR"); // forced timeout config.ForceGatewayTimeout = true; ServicesContainer.ConfigureService(config, "timeout"); // debit card track = new DebitTrackData { Value = "4355567063338=2012101HJNw/ewskBgnZqkL", PinBlock = "62968D2481D231E1A504010024A00014", EncryptionData = EncryptionData.Version2("/wECAQEEAoFGAgEH4gcOTDT6jRZwb3NAc2VjdXJlZXhjaGFuZ2UubmV0m+/d4SO9TEshhRGUUQzVBrBvP/Os1qFx+6zdQp1ejjUCoDmzoUMbil9UG73zBxxTOy25f3Px0p8joyCh8PEWhADz1BkROJT3q6JnocQE49yYBHuFK0obm5kqUcYPfTY09vPOpmN+wp45gJY9PhkJF5XvPsMlcxX4/JhtCshegz4AYrcU/sFnI+nDwhy295BdOkVN1rn00jwCbRcE900kj3UsFfyc", "2") }; }
public NWSEncryptionTests() { Address address = new Address(); address.Name = "My STORE"; address.StreetAddress1 = "1 MY STREET"; address.City = "MYTOWN"; address.PostalCode = "90210"; address.State = "KY"; address.Country = "USA"; AcceptorConfig acceptorConfig = new AcceptorConfig(); acceptorConfig.Address = address; // data code values acceptorConfig.CardDataInputCapability = CardDataInputCapability.ContactlessEmv_ContactEmv_MagStripe_KeyEntry; acceptorConfig.TerminalOutputCapability = TerminalOutputCapability.Printing_Display; // hardware software config values acceptorConfig.HardwareLevel = "34"; acceptorConfig.SoftwareLevel = "21205710"; // pos configuration values acceptorConfig.SupportsPartialApproval = true; acceptorConfig.SupportsShutOffAmount = true; acceptorConfig.SupportsReturnBalance = true; acceptorConfig.SupportsDiscoverNetworkReferenceId = true; acceptorConfig.SupportsAvsCnvVoidReferrals = true; acceptorConfig.SupportedEncryptionType = EncryptionType.TEP2; // gateway config NetworkGatewayConfig config = new NetworkGatewayConfig(NetworkGatewayType.NWS); config.ServiceUrl = "test.txns-c.secureexchange.net"; config.PrimaryPort = 15031; config.SecondaryEndpoint = "test.txns-e.secureexchange.net"; config.SecondaryPort = 15031; config.CompanyId = "SPSA"; config.TerminalId = "NWSDOTNET01"; config.AcceptorConfig = acceptorConfig; config.EnableLogging = true; config.StanProvider = StanGenerator.GetInstance(); config.BatchProvider = BatchProvider.GetInstance(); ServicesContainer.ConfigureService(config); // AMEX //card = TestCards.AmexManualEncrypted(); ////cardWithCvn = TestCards.AmexManualEncrypted(); ////cardWithCvn.Cvn = "9072488"; //track = TestCards.AmexSwipeEncrypted(); // DISCOVER card = TestCards.DiscoverManualEncrypted(); //cardWithCvn = TestCards.DiscoverManualEncrypted(); //cardWithCvn.Cvn = "703"; track = TestCards.DiscoverSwipeEncryptedV2(); // MASTERCARD //card = TestCards.MasterCardManualEncrypted(); ////cardWithCvn = TestCards.MasterCardManualEncrypted(); ////cardWithCvn.Cvn = "7803754"; //track = TestCards.MasterCardSwipeEncryptedV2(); // VISA //card = TestCards.VisaManualEncrypted(true, true); ////cardWithCvn = TestCards.VisaManualEncrypted(); ////cardWithCvn.Cvn = "7803754"; //track = TestCards.VisaSwipeEncryptedV2(); // DEBIT debit = new DebitTrackData(); debit.Value = ";6090001234567891=2112120000000000001?"; debit.PinBlock = "62968D2481D231E1A504010024A00014"; debit.EncryptionData = EncryptionData.Version2("/wECAQEEAoFGAgEH4gcOTDT6jRZwb3NAc2VjdXJlZXhjaGFuZ2UubmV0m+/d4SO9TEshhRGUUQzVBrBvP/Os1qFx+6zdQp1ejjUCoDmzoUMbil9UG73zBxxTOy25f3Px0p8joyCh8PEWhADz1BkROJT3q6JnocQE49yYBHuFK0obm5kqUcYPfTY09vPOpmN+wp45gJY9PhkJF5XvPsMlcxX4/JhtCshegz4AYrcU/sFnI+nDwhy295BdOkVN1rn00jwCbRcE900kj3UsFfyc", "2"); }
public IActionResult AuthFinal([FromQuery] Tarjeta detalles, [FromQuery] RespuestaVersion3DS2 responseACSVersion) { // Configuramos los datos de nuestro comercio. Los datos son proporcionados por el equipo de Addon Payments, // en caso de duda debe llamar al 914 353 028 e indicar su número de comercio o Merchant ID ServicesContainer.ConfigureService(new GatewayConfig { MerchantId = "addonnettest", AccountId = "3ds2", SharedSecret = "secret", ServiceUrl = "https://remote.sandbox.addonpayments.com/remote" }); // Creamos el objeto de la tarjeta var card = new CreditCardData { Number = detalles.cardNumber, ExpMonth = detalles.month, ExpYear = detalles.year, Cvn = detalles.cvn, CardHolderName = detalles.cardholderName }; // Añadimos la información obtenida de autenticación 3DS2 var threeDSecureData = new ThreeDSecure() { AuthenticationValue = responseACSVersion.authenticationValue, DirectoryServerTransactionId = responseACSVersion.directoryServerTransactionId, Eci = responseACSVersion.eci, MessageVersion = responseACSVersion.messageVersion }; // add the 3D Secure 2 data to the card object card.ThreeDSecure = threeDSecureData; Transaction response = null; try { response = card.Charge(10.01m) .WithCurrency("EUR") .Execute(); // Obtenemos la respuesta y la mostramos var result = response.ResponseCode; // 00 == Success var message = response.ResponseMessage; // [ test system ] AUTHORISED var orderId = response.OrderId; // ezJDQjhENTZBLTdCNzNDQw var authCode = response.AuthorizationCode; // 12345 var paymentsReference = response.TransactionId; // pasref 14622680939731425 var schemeReferenceData = response.SchemeId; // MMC0F00YE4000000715 // Devolvemos el resultado de la operación al cliente Respuesta respuesta = new Respuesta { result = result, message = message, orderId = orderId, authCode = authCode, paymentsReference = paymentsReference, schemeReferenceData = schemeReferenceData }; return(Ok(respuesta)); } catch (ApiException exce) { return(BadRequest(exce)); } }
public int ProcessPayment(OrderDetails details, ref string response) { try { //bool addressMatch = false; string responseError = string.Empty; if (!HelperClass.ValidateRequest(details, ref responseError)) { response = responseError; return(400); } //if (!string.IsNullOrEmpty(details.HPPAddressMatchIndicator) && details.HPPAddressMatchIndicator.ToLower() == "true") //{ // bool.TryParse(details.HPPAddressMatchIndicator, out addressMatch); //} // configure client & request settings ServicesContainer.ConfigureService(new GatewayConfig { MerchantId = _config.MerchantId, AccountId = _config.AccountId, SharedSecret = _config.SharedSecret, ServiceUrl = _config.ServiceUrl }); int expYear = 0; int expMonth = 0; int.TryParse(details.CardExpYear, out expYear); int.TryParse(details.CardExpMonth, out expMonth); // create the card object var card = new CreditCardData { Number = details.CardNumber, ExpMonth = expMonth, ExpYear = expYear, Cvn = details.CardCvn, CardHolderName = details.CardHolderName }; try { // process an auto-capture authorization decimal amount = 0.0m; decimal.TryParse(details.Amount, out amount); Transaction GPresponse = card.Charge(amount) .WithCurrency(details.Currency) .Execute(); responseMsg["message"] = GPresponse.ResponseMessage; responseMsg["code"] = GPresponse.ResponseCode; responseMsg["OrderId"] = GPresponse.OrderId; responseMsg["AuthorizationCode"] = GPresponse.AuthorizationCode; responseMsg["TransactionId"] = GPresponse.TransactionId; responseMsg["SchemeId"] = GPresponse.SchemeId; response = JsonConvert.SerializeObject(responseMsg); return(200); } catch (ApiException ex) { throw new Exception(ex.Message); // TODO: Add your error handling here } } catch (Exception ex) { throw new Exception(ex.Message); } //return null; }
public HostedService(GpEcomConfig config) { _config = config; ServicesContainer.ConfigureService(config); }
/// <summary> /// Table Service constructor /// </summary> /// <param name="config">ServicesConfig object used to configure the services container.</param> public TableService(TableServiceConfig config, string configName = "default") { _configName = configName; ServicesContainer.ConfigureService(config, configName); }
public IActionResult ProcessPayment(OrderDetails details) { /* * The services container holds the various configurations the SDK needs to * handle your card processing. It is important to note that the services container * is a singleton. If you need to hold multiple configurations for the same service type * (i.e. multiple gateway configurations) then it is important to name your configurations. * Failing to do so will result in the default connector being replaced each time the ConfigureService * method is called for a specific configuration type. You can add as many as you like * and the services container will keep track of them all. Here we are configuring a gateway * connector and calling it "MyGlobalPaymentsDemo". */ ServicesContainer.ConfigureService(new GatewayConfig { SecretApiKey = "skapi_cert_MYl2AQAowiQAbLp5JesGKh7QFkcizOP2jcX9BrEMqQ", // The following variables will be provided to you during certification VersionNumber = "0000", DeveloperId = "000000", ServiceUrl = "https://cert.api2.heartlandportico.com" }, "MyGlobalPaymentsDemo"); try { var address = new Address { StreetAddress1 = details.Address, City = details.City, State = details.State, Country = "United States", PostalCode = details.Zip ?? string.Empty }; var creditCard = new CreditCardData { Token = details.Token_value, CardHolderName = string.Format("{0} {1}", details.FirstName ?? string.Empty, details.LastName ?? string.Empty).Trim() }; /* * Use method chaining to define your transactions and set all of your transaction * options before finally calling the Execute method. Remember, if you are using * named configurations to pass the name of the configuration you want to be used to * the Execute method. */ var authResponse = creditCard.Charge(15.15m) .WithCurrency("USD") .WithAddress(address) .WithAllowDuplicates(true) .Execute("MyGlobalPaymentsDemo"); if (authResponse.ResponseCode == "00") { SendEmail(); return(View("Success", new SuccessModel { FirstName = details.FirstName, TransactionId = authResponse.TransactionId })); } else { return(View("Error", model: "Transaction failed: " + authResponse.ResponseMessage)); } } catch (BuilderException exc) { /* * Handle invalid input exceptions: * i.e. Missing amount, currency or payment method */ return(View("Error", model: "Invalid Input: " + exc.Message)); } catch (GatewayException exc) { // handle errors related to gateway communication and invalid requests return(View("Error", model: "invalid cc number, gateway-timeout, etc: " + exc.Message)); } catch (ApiException exc) { // handle everything else return(View("Error", model: "Something went wrong: " + exc.Message)); } }
public IActionResult DatosAuth([FromQuery] Tarjeta detalles, [FromQuery] RespuestaVersion3DS2 responseACSVersion) { // Configuramos los datos de nuestro comercio. Los datos son proporcionados por el equipo de Addon Payments, // en caso de duda debe llamar al 914 353 028 e indicar su número de comercio o Merchant ID ServicesContainer.ConfigureService(new GatewayConfig { MerchantId = "addonnettest", AccountId = "3ds2", SharedSecret = "secret", MethodNotificationUrl = "https://dominio.com/notificacion3ds", ChallengeNotificationUrl = "https://dominio.com/notificacionAcs", MerchantContactUrl = "https://www.dominio.com/about", Secure3dVersion = Secure3dVersion.Two }); ThreeDSecure threeDSecureData = null; try { threeDSecureData = Secure3dService.GetAuthenticationData() .WithServerTransactionId(responseACSVersion.serverTransactionId) .Execute(); // Informamos al cliente RespuestaVersion3DS2 respuesta = new RespuestaVersion3DS2 { acsEndVersion = threeDSecureData.AcsEndVersion, acsStartVersion = threeDSecureData.AcsStartVersion, acsTransactionId = threeDSecureData.AcsTransactionId, algorithm = threeDSecureData.Algorithm, authenticationSource = threeDSecureData.AuthenticationSource, authenticationType = threeDSecureData.AuthenticationType, authenticationValue = threeDSecureData.AuthenticationValue, cardHolderResponseInfo = threeDSecureData.CardHolderResponseInfo, cavv = threeDSecureData.Cavv, challengeMandated = threeDSecureData.ChallengeMandated, criticalityIndicator = threeDSecureData.CriticalityIndicator, directoryServerEndVersion = threeDSecureData.DirectoryServerEndVersion, directoryServerStartVersion = threeDSecureData.DirectoryServerStartVersion, directoryServerTransactionId = threeDSecureData.DirectoryServerTransactionId, eci = threeDSecureData.Eci, enrolled = threeDSecureData.Enrolled, issuerAcsUrl = threeDSecureData.IssuerAcsUrl, messageCategory = threeDSecureData.MessageCategory, messageExtensionId = threeDSecureData.MessageExtensionId, messageExtensionName = threeDSecureData.MessageExtensionName, messageVersion = threeDSecureData.MessageVersion, payerAuthenticationRequest = threeDSecureData.PayerAuthenticationRequest, paymentDataSource = threeDSecureData.PaymentDataSource, paymentDataType = threeDSecureData.PaymentDataType, sdkInterface = threeDSecureData.SdkInterface, sdkUiType = threeDSecureData.SdkUiType, serverTransactionId = threeDSecureData.ServerTransactionId, status = threeDSecureData.Status, statusReason = threeDSecureData.StatusReason, xid = threeDSecureData.Xid }; return(Ok(respuesta)); } catch (ApiException exce) { return(BadRequest(exce)); // TODO: agregue su control de excepciones aquí } }
public static IDeviceInterface Create(ConnectionConfig config, string configName = "default") { ServicesContainer.ConfigureService(config, configName); return(ServicesContainer.Instance.GetDeviceInterface(configName)); }
public void Init() { ServicesContainer.ConfigureService(new BillPayConfig { MerchantName = "IntegrationTesting", Username = "******", Password = "******", ServiceUrl = ServiceEndpoints.BILLPAY_CERTIFICATION }); ServicesContainer.ConfigureService(new BillPayConfig { MerchantName = "IntegrationTestingBillUpload", Username = "******", Password = "******", ServiceUrl = ServiceEndpoints.BILLPAY_CERTIFICATION }, "billload"); ach = new eCheck() { AccountNumber = "12345", RoutingNumber = "064000017", AccountType = AccountType.CHECKING, CheckType = CheckType.BUSINESS, SecCode = "WEB", CheckHolderName = "Test Tester", BankName = "Regions" }; clearTextCredit = new CreditCardData() { Number = "4444444444444448", ExpMonth = DateTime.Now.Month, ExpYear = DateTime.Now.Year, Cvn = "123", CardHolderName = "Test Tester", }; address = new Address() { StreetAddress1 = "1234 Test St", StreetAddress2 = "Apt 201", City = "Auburn", State = "AL", Country = "US", PostalCode = "12345" }; customer = new Customer() { Address = address, Email = "*****@*****.**", FirstName = "Test", LastName = "Tester", HomePhone = "555-555-4444", Company = "Test Company", MiddleName = "Testing", }; bill = new Bill() { Amount = 50M, Identifier1 = "12345" }; bills = new Bill[] { new Bill() { BillType = "Tax Payments", Identifier1 = "123", Amount = 10M }, new Bill() { BillType = "Tax Payments", Identifier1 = "321", Amount = 10M } }; billLoad = new Bill() { Amount = 50M, BillType = "Tax Payments", Identifier1 = "12345", Identifier2 = "23456", BillPresentment = BillPresentment.Full, DueDate = DateTime.Now.AddDays(3), Customer = customer }; blindBill = new Bill() { Amount = 50M, BillType = "Tax Payments", Identifier1 = "12345", Identifier2 = "23456", BillPresentment = BillPresentment.Full, DueDate = DateTime.Now.AddDays(1), Customer = customer }; }