private string BuildAutoSubPassThruData(AutoSubstantiation autoSubstantiation) { var autoSub = new List <string>(); if (autoSubstantiation.TotalHealthcareAmount != default(decimal)) { autoSub.Add("HealthCare,{0}".FormatWith("{0:c}".FormatWith(autoSubstantiation.TotalHealthcareAmount).ToNumeric())); } if (autoSubstantiation.PrescriptionSubTotal != default(decimal)) { autoSub.Add("Rx,{0}".FormatWith("{0:c}".FormatWith(autoSubstantiation.PrescriptionSubTotal).ToNumeric())); } if (autoSubstantiation.VisionSubTotal != default(decimal)) { autoSub.Add("Vision,{0}".FormatWith("{0:c}".FormatWith(autoSubstantiation.VisionSubTotal).ToNumeric())); } if (autoSubstantiation.DentalSubTotal != default(decimal)) { autoSub.Add("Dental,{0}".FormatWith("{0:c}".FormatWith(autoSubstantiation.DentalSubTotal).ToNumeric())); } if (autoSubstantiation.ClinicSubTotal != default(decimal)) { autoSub.Add("Clinical,{0}".FormatWith("{0:c}".FormatWith(autoSubstantiation.ClinicSubTotal).ToNumeric())); } if (autoSub.Count == 0) { return(string.Empty); } return("FSA:{0}".FormatWith(string.Join("|", autoSub))); }
public void Sale_Wallet() { var autoSubstantiation = new AutoSubstantiation { CopaySubTotal = 1m, ClinicSubTotal = 1m, DentalSubTotal = 1m, PrescriptionSubTotal = 1m, VisionSubTotal = 1m }; var response = applePay.Charge() .WithCurrency("USD") .WithCashBack(1m) .WithConvenienceAmount(1.25m) //.WithTaxAmount(1m) .WithAutoSubstantiation(autoSubstantiation) .WithInvoiceNumber("INV123") // PoNumber // CustomerCode .WithClientTransactionId("TX123") .WithAllowPartialAuth(true) .WithAllowDuplicates(true) .Execute(); Assert.IsNotNull(response); Assert.AreEqual("00", response.ResponseCode); }
public void CreditSale() { _device.OnMessageSent += (message) => { Assert.IsNotNull(message); }; var autoSub = new AutoSubstantiation { PrescriptionSubTotal = 10m, ClinicSubTotal = 1m, DentalSubTotal = 2m, VisionSubTotal = 2m }; var response = _device.Sale(10m) .WithEcrId(13) .WithClerkId(123) .WithGratuity(0m) .WithRequestMultiUseToken(true) .WithCardOnFileIndicator(StoredCredentialInitiator.CardHolder) .WithCardBrandTransId("transId") .WithAutoSubstantiation(autoSub) .Execute(); Assert.IsNotNull(response); Assert.AreEqual("00", response.ResponseCode); }
public void Ecomm_015_Charge_Master_Card() { var address = new Address { StreetAddress1 = "6860", PostalCode = "75024" }; var autoSub = new AutoSubstantiation { PrescriptionSubTotal = 33 }; var card = TestCards.MasterCardManual(); var response = card.Charge(33m) .WithCurrency("USD") .WithAddress(address) .WithAllowDuplicates(true) .WithAutoSubstantiation(autoSub) .Execute("ecomm"); Assert.IsNotNull(response); Assert.AreEqual("00", response.ResponseCode); // test case 27 var voidResponse = response.Void().Execute("ecomm"); Assert.IsNotNull(voidResponse); Assert.AreEqual("00", voidResponse.ResponseCode); }
public void PreAuth() { _device.OnMessageSent += (message) => { Assert.IsNotNull(message); }; var autoSub = new AutoSubstantiation { PrescriptionSubTotal = 10m, ClinicSubTotal = 1m, DentalSubTotal = 2m, VisionSubTotal = 2m }; var response = _device.Authorize() .WithEcrId(13) .WithClerkId(123) // .WithRequestMultiUseToken(true) // .WithToken("2323") // .WithCardOnFileIndicator(StoredCredentialInitiator.CardHolder) .WithCardBrandTransId("transId") .WithAmount(10m) .WithTerminalRefNumber("1234") .WithAutoSubstantiation(autoSub) .Execute(); Assert.IsNotNull(response); Assert.AreEqual("00", 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 CreditSaleManualFSA() { _device.OnMessageSent += (message) => { Assert.IsNotNull(message); }; var card = new CreditCardData { Number = "4393421234561236", ExpMonth = 12, ExpYear = 29, Cvn = "123" }; var address = new Address { StreetAddress1 = "1 Heartland Way", PostalCode = "60523" }; var autoSub = new AutoSubstantiation { ClinicSubTotal = 3, DentalSubTotal = 3, PrescriptionSubTotal = 3, VisionSubTotal = 2 }; var response = _device.Sale(11m) .WithAllowDuplicates(true) .WithPaymentMethod(card) .WithAddress(address) .WithAutoSubstantiation(autoSub) .Execute(); Assert.IsNotNull(response); Assert.AreEqual("00", response.ResponseCode); }
public void TotalAmountTest() { var autoSub = new AutoSubstantiation { ClinicSubTotal = 25m, VisionSubTotal = 25m, DentalSubTotal = 25m, PrescriptionSubTotal = 25m }; Assert.AreEqual(100m, autoSub.TotalHealthcareAmount); }
public void Retail_016_ChargeMastercardSwipe() { var card = TestCards.MasterCardSwipe(); var autoSub = new AutoSubstantiation { VisionSubTotal = 24 }; var response = card.Charge(24m) .WithCurrency("USD") .WithAllowDuplicates(true) .WithAutoSubstantiation(autoSub) .Execute("retail"); Assert.IsNotNull(response); Assert.AreEqual("00", response.ResponseCode); }
private bool IsCardHSAFSA(AutoSubstantiation autoSubstantiation) { if (autoSubstantiation != null) { return(autoSubstantiation.PrescriptionSubTotal > 0m || autoSubstantiation.ClinicSubTotal > 0m || autoSubstantiation.DentalSubTotal > 0m || autoSubstantiation.VisionSubTotal > 0m || autoSubstantiation.CopaySubTotal > 0m || autoSubstantiation.TotalHealthcareAmount > 0m); } else { return(false); } }
public void ClinicOrOther() { var autoSub = new AutoSubstantiation { MerchantVerificationValue = "12345", RealTimeSubstantiation = false, ClinicSubTotal = 150m }; var response = card.Charge(215m) .WithCurrency("USD") .WithAllowDuplicates(true) .WithAutoSubstantiation(autoSub) .Execute(); Assert.IsNotNull(response); Assert.AreEqual("00", response.ResponseCode); }
public void AllSubTotals() { var autoSub = new AutoSubstantiation { MerchantVerificationValue = "12345", RealTimeSubstantiation = false, ClinicSubTotal = 25m, VisionSubTotal = 25m, DentalSubTotal = 25m, PrescriptionSubTotal = 25m }; var response = card.Charge(215m) .WithCurrency("USD") .WithAllowDuplicates(true) .WithAutoSubstantiation(autoSub) .Execute(); }
public void Retail_014_ChargeVisaSwipe() { var card = TestCards.VisaSwipe(); var autoSub = new AutoSubstantiation { PrescriptionSubTotal = 22, VisionSubTotal = 10 }; var response = card.Charge(32m) .WithCurrency("USD") .WithAllowDuplicates(true) .WithAutoSubstantiation(autoSub) .Execute("retail"); Assert.IsNotNull(response); Assert.AreEqual("00", response.ResponseCode); }
public void Sale_Healthcare() { AutoSubstantiation autoSubstantiation = new AutoSubstantiation { CopaySubTotal = 60m }; var response = card.Charge(202m) .WithCurrency("USD") .WithInvoiceNumber("1556") // PoNumber // CustomerCode .WithClientTransactionId("166901") .WithAllowPartialAuth(true) .WithAllowDuplicates(false) .Execute(); Assert.IsNotNull(response); Assert.AreEqual("00", response.ResponseCode); }
public void Ecomm_012_Charge_Visa() { var address = new Address { StreetAddress1 = "6860", PostalCode = "75024" }; var autoSub = new AutoSubstantiation { VisionSubTotal = 21 }; var card = TestCards.VisaManual(); var response = card.Charge(21m) .WithCurrency("USD") .WithAddress(address) .WithAllowDuplicates(true) .WithAutoSubstantiation(autoSub) .Execute("ecomm"); Assert.IsNotNull(response); Assert.AreEqual("00", response.ResponseCode); }
public void Ecomm_017_Charge_Master_Card() { var address = new Address { StreetAddress1 = "6860", PostalCode = "75024" }; var autoSub = new AutoSubstantiation { ClinicSubTotal = 32, DentalSubTotal = 10 }; var card = TestCards.MasterCardManual(); var response = card.Charge(42m) .WithCurrency("USD") .WithAddress(address) .WithAllowDuplicates(true) .WithAutoSubstantiation(autoSub) .Execute("ecomm"); Assert.IsNotNull(response); Assert.AreEqual("00", response.ResponseCode); }
public void Tokenize() { _device.OnMessageSent += (message) => { Assert.IsNotNull(message); }; var autoSub = new AutoSubstantiation { PrescriptionSubTotal = 10m, ClinicSubTotal = 1m, DentalSubTotal = 2m, VisionSubTotal = 2m }; var response = _device.Tokenize() .WithEcrId(13) .WithClerkId(123) .Execute(); Assert.IsNotNull(response); Assert.AreEqual("00", response.ResponseCode); }
public void Retail_015_ChargeMastercardSwipe() { var card = TestCards.MasterCardSwipe(); var autoSub = new AutoSubstantiation { PrescriptionSubTotal = 33 }; var response = card.Charge(33m) .WithCurrency("USD") .WithAllowDuplicates(true) .WithAutoSubstantiation(autoSub) .Execute("retail"); Assert.IsNotNull(response); Assert.AreEqual("00", response.ResponseCode); // test 27 var reversal = card.Reverse(33.00m).Execute("retail"); Assert.IsNotNull(reversal); Assert.AreEqual("00", reversal.ResponseCode); }
/// <summary> /// Sets the auto subtantiation values for the transaction. /// </summary> /// <param name="value">The auto substantiation object</param> /// <returns>AuthorizationBuilder</returns> public AuthorizationBuilder WithAutoSubstantiation(AutoSubstantiation value) { AutoSubstantiation = value; return(this); }
/// <summary> /// Sets the auto subtantiation values for the transaction. /// </summary> /// <param name="value">The auto substantiation object</param> /// <returns>TerminalAuthBuilder</returns> public TerminalAuthBuilder WithAutoSubstantiation(AutoSubstantiation value) { AutoSubstantiation = value; return(this); }
public Transaction ProcessAuthorization(AuthorizationBuilder builder) { ElementTree et = new ElementTree(); IPaymentMethod paymentMethod = builder.PaymentMethod; var transaction = et.Element(MapRequestType(builder)) .Set("xmlns", "http://schemas.merchantwarehouse.com/merchantware/v45/"); // Credentials var credentials = et.SubElement(transaction, "Credentials"); et.SubElement(credentials, "MerchantName").Text(MerchantName); et.SubElement(credentials, "MerchantSiteId").Text(MerchantSiteId); et.SubElement(credentials, "MerchantKey").Text(MerchantKey); // Payment Data var paymentData = et.SubElement(transaction, "PaymentData"); if (paymentMethod is CreditCardData) { CreditCardData card = paymentMethod as CreditCardData; if (card.Token != null) { if (card.MobileType != null) { et.SubElement(paymentData, "Source").Text("Wallet"); et.SubElement(paymentData, "WalletId", MapWalletId(card.MobileType)); et.SubElement(paymentData, "EncryptedPaymentData", card.Token); } else { et.SubElement(paymentData, "Source").Text("Vault"); et.SubElement(paymentData, "VaultToken", card.Token); } } else { et.SubElement(paymentData, "Source").Text("Keyed"); et.SubElement(paymentData, "CardNumber", card.Number); et.SubElement(paymentData, "ExpirationDate", card.ShortExpiry); et.SubElement(paymentData, "CardHolder", card.CardHolderName); et.SubElement(paymentData, "CardVerificationValue", card.Cvn); } } else if (paymentMethod is CreditTrackData) { et.SubElement(paymentData, "Source").Text("READER"); CreditTrackData track = paymentMethod as CreditTrackData; et.SubElement(paymentData, "TrackData", track.Value); } // AVS et.SubElement(paymentData, "AvsStreetAddress", builder.BillingAddress?.StreetAddress1); et.SubElement(paymentData, "AvsZipCode", builder.BillingAddress?.PostalCode); // Request var request = et.SubElement(transaction, "Request"); et.SubElement(request, "Amount", builder.Amount.ToCurrencyString()); et.SubElement(request, "CashbackAmount", builder.CashBackAmount.ToCurrencyString()); et.SubElement(request, "SurchargeAmount", builder.ConvenienceAmount.ToCurrencyString()); //et.SubElement(request, "TaxAmount", builder..ToCurrencyString()); et.SubElement(request, "AuthorizationCode", builder.OfflineAuthCode); if (builder.AutoSubstantiation != null) { var healthcare = et.SubElement(request, "HealthCareAmountDetails"); AutoSubstantiation auto = builder.AutoSubstantiation; et.SubElement(healthcare, "CopayAmount", auto.CopaySubTotal.ToCurrencyString()); et.SubElement(healthcare, "ClinicalAmount", auto.ClinicSubTotal.ToCurrencyString()); et.SubElement(healthcare, "DentalAmount", auto.DentalSubTotal.ToCurrencyString()); et.SubElement(healthcare, "HealthCareTotalAmount", auto.TotalHealthcareAmount.ToCurrencyString()); et.SubElement(healthcare, "PrescriptionAmount", auto.PrescriptionSubTotal.ToCurrencyString()); et.SubElement(healthcare, "VisionAmount", auto.VisionSubTotal.ToCurrencyString()); } et.SubElement(request, "InvoiceNumber", builder.InvoiceNumber); et.SubElement(request, "RegisterNumber", RegisterNumber); et.SubElement(request, "MerchantTransactionId", builder.ClientTransactionId); et.SubElement(request, "CardAcceptorTerminalId", TerminalId); et.SubElement(request, "EnablePartialAuthorization", builder.AllowPartialAuth); et.SubElement(request, "ForceDuplicate", builder.AllowDuplicates); // Level III if (builder.CommercialData != null) { var invoice = et.SubElement(request, "Invoice"); CommercialData cd = builder.CommercialData; et.SubElement(invoice, "TaxIndicator", MapTaxType(cd.TaxType)); et.SubElement(invoice, "ProductDescription", cd.Description); et.SubElement(invoice, "DiscountAmount", cd.DiscountAmount); et.SubElement(invoice, "ShippingAmount", cd.FreightAmount); et.SubElement(invoice, "DutyAmount", cd.DutyAmount); et.SubElement(invoice, "DestinationPostalCode", cd.DestinationPostalCode); et.SubElement(invoice, "DestinationCountryCode", cd.DestinationCountryCode); et.SubElement(invoice, "ShipFromPostalCode", cd.OriginPostalCode); if (cd.LineItems.Count > 0) { var lineItemsElement = et.SubElement(invoice, "LineItems"); foreach (var item in cd.LineItems) { var lineItem = et.SubElement(lineItemsElement, "LineItem"); et.SubElement(lineItem, "CommodityCode", item.CommodityCode); et.SubElement(lineItem, "Description", item.Description); et.SubElement(lineItem, "Upc", item.UPC); et.SubElement(lineItem, "Quantity", item.Quantity); et.SubElement(lineItem, "UnitOfMeasure", item.UnitOfMeasure); et.SubElement(lineItem, "UnitCost", item.UnitCost); et.SubElement(lineItem, "DiscountAmount", item.DiscountAmount); et.SubElement(lineItem, "TotalAmount", item.TotalAmount); et.SubElement(lineItem, "TaxAmount", item.TaxAmount); et.SubElement(lineItem, "ExtendedAmount", item.ExtendedAmount); et.SubElement(lineItem, "DebitOrCreditIndicator", item.CreditDebitIndicator.ToString()); et.SubElement(lineItem, "NetOrGrossIndicator", item.NetGrossIndicator.ToString()); } } } var response = DoTransaction(BuildEnvelope(et, transaction)); return(MapResponse(builder, response)); }