public void Authorize_Keyed() { var response = card.Authorize(10m) .WithCurrency("USD") .WithAddress(address) .WithInvoiceNumber("1556") .Execute(); Assert.IsNotNull(response); Assert.AreEqual("00", response.ResponseCode); }
public void CreditCard_SaleManual_AuthorizeThenCapture() { var response = card.Authorize(amount) .WithCurrency(currency) .Execute(); AssertTransactionResponse(response, TransactionStatus.Preauthorized); var capture = response.Capture(amount) .WithCurrency(currency) .Execute(); AssertTransactionResponse(capture, TransactionStatus.Captured); }
public void Test_001_manual_authorization() { ProductData productData = new ProductData(ServiceLevel.FullServe, ProductCodeSet.Heartland); productData.Add("01", UnitOfMeasure.Gallons, 2m, 5m, 10m); Transaction response = card.Authorize(10m) .WithCurrency("USD") .WithProductData(productData) .WithFleetData(fleetData) .Execute(); Assert.IsNotNull(response); // check message data PriorMessageInformation pmi = response.MessageInformation; Assert.IsNotNull(pmi); Assert.AreEqual("1100", pmi.MessageTransactionIndicator); Assert.AreEqual("000900", pmi.ProcessingCode); Assert.AreEqual("100", pmi.FunctionCode); // check response System.Diagnostics.Debug.WriteLine(response.HostResponseDate); System.Diagnostics.Debug.WriteLine(response.SystemTraceAuditNumber); Assert.AreEqual("000", response.ResponseCode); }
public void Authorize_Wallet() { var autoSubstantiation = new AutoSubstantiation { CopaySubTotal = 1m, ClinicSubTotal = 1m, DentalSubTotal = 1m, PrescriptionSubTotal = 1m, VisionSubTotal = 1m }; var response = applePay.Authorize() .WithCurrency("USD") .WithAddress(address) .WithCashBack(1m) .WithConvenienceAmount(1.25m) .WithAutoSubstantiation(autoSubstantiation) .WithInvoiceNumber("INV123") //TaxAmount -> CommercialRequestData -> Level II //PoNumber -> CommercialRequestData -> Level II //CustomerCode .WithClientTransactionId("TX123") .WithAllowPartialAuth(true) .WithAllowDuplicates(true) .Execute(); Assert.IsNotNull(response); Assert.AreEqual("00", response.ResponseCode); var capture = response.Capture().Execute(); Assert.IsNotNull(capture); Assert.AreEqual("00", capture.ResponseCode); }
public void CreditAuthorization() { var authorization = card.Authorize(14m) .WithCurrency("USD") .WithAllowDuplicates(true) .Execute(); Assert.IsNotNull(authorization); Assert.AreEqual("00", authorization.ResponseCode, authorization.ResponseMessage); var capture = authorization.Capture(14m) .Execute(); Assert.IsNotNull(capture); Assert.AreEqual("00", capture.ResponseCode, capture.ResponseMessage); }
public void CreditDccRateAuthorize() { var dccDetails = card.GetDccRate() .WithAmount(Amount) .WithCurrency(CURRENCY) .Execute(); var expectedDccAmountValue = GetDccAmount(dccDetails); AssertDccInfoResponse(dccDetails, expectedDccAmountValue); waitForGpApiReplication(); var response = card.Authorize(Amount) .WithCurrency(CURRENCY) .WithDccRateData(dccDetails.DccRateData) .Execute(); AssertTransactionResponse(response, TransactionStatus.Preauthorized, expectedDccAmountValue); }
public void Test_002_credit_manual_auth() { Transaction response = card.Authorize(10m) .WithCurrency("USD") .Execute(); Assert.IsNotNull(response); Assert.AreEqual("000", response.ResponseCode); }
public void CreditAuthorization() { var response = card.Authorize(14m) .WithCurrency("USD") .WithAllowDuplicates(true) .Execute(); Assert.IsNotNull(response); Assert.AreEqual("00", response.ResponseCode); var capture = response.Capture(16m).WithGratuity(2m).Execute(); Assert.IsNotNull(capture); Assert.AreEqual("00", capture.ResponseCode); }
public void CreditAuthorization() { var transaction = card.Authorize(14m) .WithCurrency("USD") .WithAllowDuplicates(true) .Execute(); Assert.IsNotNull(transaction); Assert.AreEqual(SUCCESS, transaction?.ResponseCode); Assert.AreEqual(GetMapping(TransactionStatus.Preauthorized), transaction?.ResponseMessage); var capture = transaction.Capture(16m) .WithGratuity(2m) .Execute(); Assert.IsNotNull(capture); Assert.AreEqual(SUCCESS, capture?.ResponseCode); Assert.AreEqual(GetMapping(TransactionStatus.Captured), capture?.ResponseMessage); }
public IActionResult Auth(Tarjeta detalles) { // 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 = "api", 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 }; try { // Proceso de autorización automática Transaction response = card.Authorize(detalles.importe) .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 // Aconsejamos guardar los datos de la operacion en su base de datos en caso de querer gestionar de forma interna sus transacciones // 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) { // En caso de error informamos al cliente RespuestaError respuesta = new RespuestaError { resultado = "Error en el envío de datos <br><br>" + exce }; return(BadRequest(respuesta)); } }
public void Test_002_credit_manual_auth() { Transaction response = card.Authorize(10m) .WithCurrency("USD") .Execute(); Assert.IsNotNull(response); System.Diagnostics.Debug.WriteLine(response.HostResponseDate); System.Diagnostics.Debug.WriteLine(response.SystemTraceAuditNumber); Assert.AreEqual("000", response.ResponseCode); }
public void Authorize_Vault() { var response = tokenizedCard.Authorize(10m) .WithCurrency("USD") .WithInvoiceNumber("1558") .WithClientTransactionId("167903") .Execute(); Assert.IsNotNull(response); Assert.AreEqual("00", response.ResponseCode); }
public void ForceCapture_Encrypted_Keyed() { var response = encryptedCard.Authorize(10m) .WithCurrency("USD") .WithOfflineAuthCode("V00546") .WithInvoiceNumber("1559") .WithClientTransactionId("168901") .Execute(); Assert.IsNotNull(response); Assert.AreEqual("00", response.ResponseCode); }
public void Test_009_mastercard_sale() { CreditCardData card = TestCards.MasterCardManual(true, true); Transaction response = card.Authorize(0m) .WithCurrency("USD") .WithAddress(new Address("90031")) .Execute(); Assert.IsNotNull(response); Assert.AreEqual("000", response.ResponseCode); }
public void CreditAuthorization() { var transaction = card.Authorize(AMOUNT) .WithCurrency(CURRENCY) .Execute(); AssertTransactionResponse(transaction, TransactionStatus.Preauthorized); var capture = transaction.Capture(AMOUNT + 1m) .WithGratuity(1m) .Execute(); AssertTransactionResponse(capture, TransactionStatus.Captured); }
public void Test_013_visa_cid_on_card() { CreditCardData card = TestCards.VisaManual(false, false); card.Cvn = "113"; Transaction response = card.Authorize(10m) .WithCurrency("USD") .Execute(); Assert.IsNotNull(response); Assert.AreEqual("107", response.ResponseCode); }
public void Test_009_mastercard_not_processed() { CreditCardData card = TestCards.MasterCardManual(false, false); card.Cvn = "109"; Transaction response = card.Authorize(10m) .WithCurrency("USD") .Execute(); Assert.IsNotNull(response); Assert.AreEqual("107", response.ResponseCode); }
public void Test_002_discover_auth() { CreditCardData card = TestCards.DiscoverManual(true, true); Transaction response = card.Authorize(0m) .WithCurrency("USD") .WithAddress(new Address("90057")) .Execute(); Assert.IsNotNull(response); Assert.AreEqual("000", response.ResponseCode); System.Diagnostics.Debug.WriteLine(response.HostResponseDate); System.Diagnostics.Debug.WriteLine(response.SystemTraceAuditNumber); }
public void Test_002_amex_match() { CreditCardData card = TestCards.AmexManual(false, false); card.Cvn = "0101"; Transaction response = card.Authorize(10m) .WithCurrency("USD") .Execute(); Assert.IsNotNull(response); System.Diagnostics.Debug.WriteLine(response.HostResponseDate); System.Diagnostics.Debug.WriteLine(response.SystemTraceAuditNumber); Assert.AreEqual("000", response.ResponseCode); }
public void Auth_Manual() { var response = card.Authorize(Amount) .WithCurrency("USD") .Execute(); Assert.IsNotNull(response); Assert.AreEqual("00", response.ResponseCode, response.ResponseMessage); var captureResponse = response.Capture() .Execute(); Assert.IsNotNull(captureResponse); Assert.AreEqual("00", captureResponse.ResponseCode, captureResponse.ResponseMessage); }
public void CreditTestWithNewCryptoURL() { ServicesContainer.ConfigureService(new GatewayConfig { SecretApiKey = "skapi_cert_MTyMAQBiHVEAewvIzXVFcmUd2UcyBge_eCpaASUp0A", ServiceUrl = "https://cert.api2-c.heartlandportico.com" }); card = new CreditCardData { Number = "4111111111111111", ExpMonth = 12, ExpYear = 2025, Cvn = "123" }; var response = card.Authorize(14m) .WithCurrency("USD") .WithAllowDuplicates(true) .Execute(); Assert.IsNotNull(response); Assert.AreEqual("00", response.ResponseCode); }
public void Test_003_manual_authorization() { Transaction response = card.Authorize(10m, true) .WithCurrency("USD") .Execute(); Assert.IsNotNull(response); System.Diagnostics.Debug.WriteLine(response.HostResponseDate); System.Diagnostics.Debug.WriteLine(response.SystemTraceAuditNumber); // check message data PriorMessageInformation pmi = response.MessageInformation; Assert.IsNotNull(pmi); Assert.AreEqual("1100", pmi.MessageTransactionIndicator); Assert.AreEqual("003000", pmi.ProcessingCode); Assert.AreEqual("101", pmi.FunctionCode); // check response Assert.AreEqual("000", response.ResponseCode); }
public void CreatePayLink_ThenAuthorizeAndCapture() { var response = PayLinkService.Create(payLink, AMOUNT) .WithCurrency(CURRENCY) .WithClientTransactionId(GenerationUtils.GenerateRecurringKey()) .WithDescription("March and April Invoice") .Execute(); AssertTransactionResponse(response); ServicesContainer.ConfigureService(SetupTransactionConfig(), "createTransaction"); var authTransaction = card.Authorize(AMOUNT) .WithCurrency(CURRENCY) .WithPaymentLinkId(response.PayLinkResponse.Id) .Execute("createTransaction"); Assert.IsNotNull(authTransaction); Assert.AreEqual(SUCCESS, authTransaction?.ResponseCode); Assert.AreEqual(GetMapping(TransactionStatus.Preauthorized), authTransaction?.ResponseMessage); var chargeTransaction = authTransaction.Capture(AMOUNT) .WithCurrency(CURRENCY) .WithPaymentLinkId(response.PayLinkResponse.Id) .Execute("createTransaction"); Assert.IsNotNull(chargeTransaction); Assert.AreEqual(SUCCESS, chargeTransaction?.ResponseCode); Assert.AreEqual(GetMapping(TransactionStatus.Captured), chargeTransaction?.ResponseMessage); Thread.Sleep(2000); var getPayLinkById = PayLinkService.PayLinkDetail(response.PayLinkResponse.Id) .Execute(); Assert.IsNotNull(getPayLinkById); Assert.IsInstanceOfType(getPayLinkById, typeof(PayLinkSummary)); Assert.AreEqual(response.PayLinkResponse.Id, getPayLinkById.Id); Assert.AreEqual(1, getPayLinkById.Transactions.Count); Assert.AreEqual(GetMapping(TransactionStatus.Preauthorized), getPayLinkById.Transactions[0].TransactionStatus); }
protected async override Task <HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken) { string response = await request.Content.ReadAsStringAsync(); // gather information var json = JsonDoc.Parse(response, JsonEncoders.Base64Encoder); var timestamp = json.GetValue <string>("TIMESTAMP"); var merchantId = json.GetValue <string>("MERCHANT_ID"); var account = json.GetValue <string>("ACCOUNT"); var orderId = json.GetValue <string>("ORDER_ID"); var amount = json.GetValue <string>("AMOUNT"); var currency = json.GetValue <string>("CURRENCY"); var autoSettle = json.GetValue <int>("AUTO_SETTLE_FLAG") == 1; var requestHash = json.GetValue <string>("SHA1HASH"); // check hash var newhash = GenerationUtils.GenerateHash(_sharedSecret, timestamp, merchantId, orderId, amount, currency); if (!newhash.Equals(requestHash)) { return(BadRequest("Incorrect hash. Please check your code and the Developers Documentation.")); } // configure the container ServicesContainer.ConfigureService(new GatewayConfig { MerchantId = merchantId, AccountId = account, ServiceUrl = "https://api.sandbox.realexpayments.com/epage-remote.cgi", SharedSecret = _sharedSecret }, "realexResponder"); // gather additional information var shippingCode = json.GetValue <string>("SHIPPING_CODE"); var shippingCountry = json.GetValue <string>("SHIPPING_CO"); var billingCode = json.GetValue <string>("BILLING_CODE"); var billingCountry = json.GetValue <string>("BILLING_CO"); // build request AuthorizationBuilder gatewayRequest = null; if (amount == null) { var validate = json.GetValue <int>("VALIDATE_CARD_ONLY") == 1; if (validate) { gatewayRequest = _card.Verify(); } else { gatewayRequest = _card.Verify().WithRequestMultiUseToken(true); } } else { if (autoSettle) { gatewayRequest = _card.Charge(amount.ToAmount()); } else { gatewayRequest = _card.Authorize(amount.ToAmount()); } } try { gatewayRequest.WithCurrency(currency).WithOrderId(orderId).WithTimestamp(timestamp); if (billingCode != null || billingCountry != null) { gatewayRequest.WithAddress(new Address { PostalCode = billingCode, Country = billingCountry }); } if (shippingCode != null || shippingCountry != null) { gatewayRequest.WithAddress(new Address { PostalCode = shippingCode, Country = shippingCountry }, AddressType.Shipping); } var gatewayResponse = gatewayRequest.Execute("realexResponder"); if (gatewayResponse.ResponseCode.Equals("00")) { return(BuildResponse(HttpStatusCode.OK, ConvertResponse(json, gatewayResponse))); } else { return(BadRequest(gatewayResponse.ResponseMessage)); } } catch (ApiException exc) { return(ServerError(exc.Message)); } }
public void CreditAuthNoAmount() { card.Authorize().Execute(); }