/// <summary> /// Purchase with card data, specifying the currency code, and running fraud checks (optional). This method also accepts extra flags /// </summary> /// <param name="amount">purchase amount as an integer</param> /// <param name="card_holder">card holders name</param> /// <param name="card_number">card number</param> /// <param name="card_expiry">card expiry</param> /// <param name="cvv">CVV number</param> /// <param name="reference">purchase reference (invoice number or similar)</param> /// <param name="customer_ip">customers IP address</param> /// <param name="currency">The three-letter ISO-4217 currency code (see http://en.wikipedia.org/wiki/ISO_4217#Active_codes)</param> /// <param name="fraud_details">The fraud check details - optional - pass null if not used</param> /// <param name="extra">Extra params for the request (such as ECM flags) - optional - pass null if not used</param> /// <returns>Response</returns> public static Response<Purchase> Create(int amount, string card_holder, string card_number, DateTime card_expiry, string cvv, string reference, string customer_ip, string currency, FraudCheck fraud_details, Dictionary<String, Object> extra) { var req = new Requests.Purchase { Amount = amount, Reference = reference, CustomerIP = customer_ip, CardNumber = card_number, CardHolder = card_holder, CardExpiry = card_expiry, SecurityCode = cvv, Currency = currency, TestMode = Gateway.TestMode, FraudDetails = fraud_details, Extra = extra }; return Gateway.Post<Purchase>("purchases.json", req); }
/// <summary> /// Purchase with a tokenized card, specifying the currency code and running fraud checks /// </summary> /// <param name="amount">purchase amount as integer</param> /// <param name="token">card token</param> /// <param name="cvv">card CVV</param> /// <param name="reference">purchase reference (e.g. invoice number)</param> /// <param name="customer_ip">the custokers IP address</param> /// <param name="currency">The three-letter ISO-4217 currency code (see http://en.wikipedia.org/wiki/ISO_4217#Active_codes for full list)</para> /// /// <param name="fraud_details">The fraud check details</param> /// <returns>Response</returns> public static Response<Purchase> Create(int amount, string token, string cvv, string reference, string customer_ip, string currency, FraudCheck fraud_details) { var req = new Requests.Purchase { Amount = amount, Reference = reference, CustomerIP = customer_ip, CardToken = token, SecurityCode = cvv, Currency = currency, TestMode = Gateway.TestMode, FraudDetails = fraud_details }; return Gateway.Post<Purchase>("purchases.json", req); }
/// <summary> /// Purchase with a tokenized card, specifying the currency code and running fraud checks /// </summary> /// <param name="amount">purchase amount as integer</param> /// <param name="token">card token</param> /// <param name="cvv">card CVV</param> /// <param name="reference">purchase reference (e.g. invoice number)</param> /// <param name="customer_ip">the custokers IP address</param> /// <param name="currency">The three-letter ISO-4217 currency code (see http://en.wikipedia.org/wiki/ISO_4217#Active_codes for full list)</para> /// <param name="fraud_details">The fraud check details</param> /// <returns>Response</returns> public static Response <Purchase> Create(int amount, string token, string cvv, string reference, string customer_ip, string currency, FraudCheck fraud_details) { return(Purchase.Create(amount, token, cvv, reference, customer_ip, currency, fraud_details, null)); }
/// <summary> /// Purchase with a tokenized card, specifying the currency code and running fraud checks /// </summary> /// <param name="amount">purchase amount as integer</param> /// <param name="token">card token</param> /// <param name="cvv">card CVV</param> /// <param name="reference">purchase reference (e.g. invoice number)</param> /// <param name="customer_ip">the custokers IP address</param> /// <param name="currency">The three-letter ISO-4217 currency code (see http://en.wikipedia.org/wiki/ISO_4217#Active_codes for full list)</param> /// <param name="fraud_details">The fraud check details</param> /// <param name="extra">Extra params for the request (such as ECM flags) - optional - pass null if not used</param> /// <returns>Response</returns> public static Response <Purchase> Create(int amount, string token, string cvv, string reference, string customer_ip, string currency, FraudCheck fraud_details, Dictionary <String, Object> extra) { var req = new Requests.Purchase { Amount = amount, Reference = reference, CustomerIP = customer_ip, CardToken = token, SecurityCode = cvv, Currency = currency, TestMode = Gateway.TestMode, FraudDetails = fraud_details, Extra = extra }; return(Gateway.Post <Purchase>("purchases.json", req)); }
/// <summary> /// Purchase with card data, specifying the currency code, and running fraud checks /// </summary> /// <param name="amount">purchase amount as an integer</param> /// <param name="card_holder">card holders name</param> /// <param name="card_number">card number</param> /// <param name="card_expiry">card expiry</param> /// <param name="cvv">CVV number</param> /// <param name="reference">purchase reference (invoice number or similar)</param> /// <param name="customer_ip">customers IP address</param> /// <param name="currency">The three-letter ISO-4217 currency code (see http://en.wikipedia.org/wiki/ISO_4217#Active_codes)</param> /// <param name="fraud_details">The fraud check details</param> /// <returns>Response</returns> public static Response <Purchase> Create(int amount, string card_holder, string card_number, DateTime card_expiry, string cvv, string reference, string customer_ip, string currency, FraudCheck fraud_details) { return(Purchase.Create(amount, card_holder, card_number, card_expiry, cvv, reference, customer_ip, currency, fraud_details, null)); }
/// <summary> /// Purchase with card data, specifying the currency code, and running fraud checks /// </summary> /// <param name="amount">purchase amount as an integer</param> /// <param name="card_holder">card holders name</param> /// <param name="card_number">card number</param> /// <param name="card_expiry">card expiry</param> /// <param name="cvv">CVV number</param> /// <param name="reference">purchase reference (invoice number or similar)</param> /// <param name="customer_ip">customers IP address</param> /// <param name="currency">The three-letter ISO-4217 currency code (see http://en.wikipedia.org/wiki/ISO_4217#Active_codes)</param> /// <param name="fraud_details">The fraud check details</param> /// <returns>Response</returns> public static Response <Purchase> Create(int amount, string card_holder, string card_number, DateTime card_expiry, string cvv, string reference, string customer_ip, string currency, FraudCheck fraud_details) { var req = new Requests.Purchase { Amount = amount, Reference = reference, CustomerIP = customer_ip, CardNumber = card_number, CardHolder = card_holder, CardExpiry = card_expiry, SecurityCode = cvv, Currency = currency, TestMode = Gateway.TestMode, FraudDetails = fraud_details }; return(Gateway.Post <Purchase>("purchases.json", req)); }
public void PurchaseWithFraudCheckShouldBeSuccessful() { FraudCheck fc = new FraudCheck (); fc.DeviceID = "04003hQUMXGB0poNf94lis1ztjiCqvcbsN56bsuwsjuElyNu8BhUMCZzxJu5KaKrVRoPks+Sl5kZMVA4D1yzhjUZHdETNKeMs9+YWgT+Kx4Epa0/yoVIBnjain3l6hbzqbSTjyylda8tv/p+hOVDTbnr7BCIp0wtRbmoh0ylJGfM1m5dSDvFsQ9SoXAEKkoBeycPTld6LUiJXX9c8V1ZIWK++ykzCGBlggcGImwI4pTgqhbiV4XFveMqjhKePA1UZdKAZDwic+y5/r+SkyAbziDM7k8xAXTS4l7D1erHMnjL6riE+V79BTuQujkd6ANXzYbYiVcAZxPGQ1+WMCVbBcdxP6GA3q0kDinWcD6T1dGUjL/YgLUkuWAapecJ9jsJ+bfNdWTfYwpMVz5nPn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LMHCbhuhdJZ/iHWp+ZqIr5rDvKRlAKCHWoNwPpPV0ZSMvzeMUjYx7xIp83fkCy0HT+x5JWYrQYX/F2Qvc/aD4QI5TGEY5jKVDHmLWOdECPQd+q1m5xIViXecKELT8PPIMHTqUA1K/In41bj72Dc0ABO4ska/9lhJBIbI0DbA0PQPUkYGO654qVFcqx8NSjXTltLNn8hBxg9/+rcc+E+whLpIsDu0HhdTNgJzVadT6E80bdNomk5SuGcpTTQ59QBwg1G5qePpxSHeZQhF30C3lxeFGfvs5Ar0aC5+wFBpT/OWHYod8W1RBa+xqE2ke9YnGVJU03s1xF84Fe1u4fLr1IvPaH6NumZaAaR6LUcwY6jyIiAI/HQnx1Lh0BRUiwi7sqY3s5jdtOfO8Bxk7IwFHAmzAec53Oe3kVS9510wVGTGjhovpiPBzcR02v+O/9uH3A/s00G+tegYmd6e43SmfG0OEJrmCE/DXwJ32vGTOHYxg0FP6F9EkhlmXGhDvUpU3ztcmp8d3l/I1O3LPgQiChrVlaxMD3sFKEHiAjzCeLr/JKgoXy16eGlPDmAXrXEYZfU="; // Will be generated by the deviceID JS library fc.Customer.ID = "ABD123"; fc.Customer.FirstName = "James"; fc.Customer.LastName = "Smith"; fc.Customer.Email = "*****@*****.**"; fc.Customer.DOB = null; fc.Customer.AddressLine1 = "23 Smith Road"; fc.Customer.City = "Canberra"; fc.Customer.PostCode = "2600"; fc.Customer.Country = "AUS"; fc.Customer.HomePhone = "0421858999"; fc.Customer.ExistingCustomer = true; fc.Customer.CreatedAt = DateTime.Now; fc.ShippingAddress.FirstName = "James"; fc.ShippingAddress.LastName = "Smith"; fc.ShippingAddress.Email = "*****@*****.**"; fc.ShippingAddress.AddressLine1 = "23 Smith Road"; fc.ShippingAddress.City = "Canberra"; fc.ShippingAddress.PostCode = "2600"; fc.ShippingAddress.Country = "AUS"; fc.ShippingAddress.HomePhone = "0421858999"; fc.ShippingAddress.ShipMethod = ShippingMethod.Express; var item = new OrderItem (); item.ProductCode = "9999-A"; item.SKU = "9999"; item.Description = "Widgets"; item.ItemCost = 23.30f; item.LineTotal = 23.30f; item.Quantity = 1; fc.OrderItems.Add (item); var recip = new Recipient (); recip.FirstName = "James"; recip.LastName = "Smith"; recip.Email = "*****@*****.**"; recip.AddressLine1 = "1 Fairfield Road"; recip.City = "Austin"; recip.State = "TX"; recip.PostCode = "55555-1234"; recip.Country = "USA"; recip.PhoneNumber = "555-555-55555"; fc.Recipients.Add (recip); fc.Website = "http://www.website.com"; var response = Purchase.Create(120, "M Smith", "5123456789012346", DateTime.Now.AddYears(1), "123", Guid.NewGuid().ToString(), "123.0.0.1", "AUD", fc); Assert.IsTrue(response.Successful); Assert.IsTrue(response.Result.Successful); Assert.IsNotNull(response.Result.ID); Assert.AreEqual(response.Errors.Count, 0); Assert.AreEqual(response.Result.Amount, 120); Assert.AreEqual(response.Result.DecimalAmount, 1.20); Assert.AreEqual(response.Result.CardType, "MasterCard"); Assert.AreEqual(response.Result.FraudCheckResult, FraudResult.Accept); }