Initial project's source code check-in.
This commit is contained in:
commit
b03b0b373f
4573 changed files with 981205 additions and 0 deletions
|
@ -0,0 +1,134 @@
|
|||
// Copyright (c) 2011, Outercurve Foundation.
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without modification,
|
||||
// are permitted provided that the following conditions are met:
|
||||
//
|
||||
// - Redistributions of source code must retain the above copyright notice, this
|
||||
// list of conditions and the following disclaimer.
|
||||
//
|
||||
// - Redistributions in binary form must reproduce the above copyright notice,
|
||||
// this list of conditions and the following disclaimer in the documentation
|
||||
// and/or other materials provided with the distribution.
|
||||
//
|
||||
// - Neither the name of the Outercurve Foundation nor the names of its
|
||||
// contributors may be used to endorse or promote products derived from this
|
||||
// software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
||||
// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace WebsitePanel.Ecommerce.EnterpriseServer
|
||||
{
|
||||
public enum AIMField
|
||||
{
|
||||
ResponseCode = 0,
|
||||
ResponseSubCode = 1,
|
||||
ResponseReasonCode = 2,
|
||||
ResponseReasonText = 3,
|
||||
ApprovalCode = 4,
|
||||
AvsResultCode = 5,
|
||||
TransactionId = 6,
|
||||
RespInvoiceNum = 7,
|
||||
Description = 8,
|
||||
RespAmount = 9,
|
||||
RespPaymentMethod = 10,
|
||||
TransactionType = 11,
|
||||
RespCustomerId = 12,
|
||||
RespFirstName = 13,
|
||||
RespLastName = 14,
|
||||
RespCompany = 15,
|
||||
BillingAddress = 16,
|
||||
RespCity = 17,
|
||||
RespState = 18,
|
||||
Zip = 19,
|
||||
Country = 20,
|
||||
Phone = 21,
|
||||
Fax = 22,
|
||||
Email = 23,
|
||||
ShipToFirstName = 24,
|
||||
ShipToLastName = 25,
|
||||
ShipToCompany = 26,
|
||||
ShipToAddress = 27,
|
||||
ShipToCity = 28,
|
||||
ShipToState = 29,
|
||||
ShipToZip = 30,
|
||||
ShipToCountry = 31,
|
||||
TaxAmount = 32,
|
||||
DutyAmount = 33,
|
||||
FreightAmount = 34,
|
||||
TaxExemptFlag = 35,
|
||||
PurchaseOrderNumber = 36,
|
||||
ResponseSignature = 37,
|
||||
CardVerificationCode = 38
|
||||
};
|
||||
|
||||
public class AIMResponse
|
||||
{
|
||||
private string[] _aimData;
|
||||
private string _rawResponse;
|
||||
private int _aimLength;
|
||||
private char _delimChar = '|';
|
||||
|
||||
public string RawResponse
|
||||
{
|
||||
get { return _rawResponse; }
|
||||
}
|
||||
|
||||
public AIMResponse(Stream stream, char delimiter)
|
||||
{
|
||||
_delimChar = delimiter;
|
||||
StreamReader sr = new StreamReader(stream);
|
||||
string response = sr.ReadToEnd();
|
||||
sr.Close();
|
||||
|
||||
Initialize(response);
|
||||
}
|
||||
|
||||
public AIMResponse(string response)
|
||||
{
|
||||
Initialize(response);
|
||||
}
|
||||
|
||||
private void Initialize(string response)
|
||||
{
|
||||
if (string.IsNullOrEmpty(response))
|
||||
throw new Exception("Response data is empty.");
|
||||
|
||||
_aimData = response.Split(_delimChar);
|
||||
_aimLength = _aimData.Length;
|
||||
|
||||
if (_aimData.Length == 0 && response.Length > 0)
|
||||
throw new Exception("Invalid response data format.");
|
||||
|
||||
_rawResponse = response;
|
||||
}
|
||||
|
||||
public string this[AIMField field]
|
||||
{
|
||||
get
|
||||
{
|
||||
int index = (int)field;
|
||||
|
||||
if (index < _aimLength)
|
||||
return _aimData[index];
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,139 @@
|
|||
// Copyright (c) 2011, Outercurve Foundation.
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without modification,
|
||||
// are permitted provided that the following conditions are met:
|
||||
//
|
||||
// - Redistributions of source code must retain the above copyright notice, this
|
||||
// list of conditions and the following disclaimer.
|
||||
//
|
||||
// - Redistributions in binary form must reproduce the above copyright notice,
|
||||
// this list of conditions and the following disclaimer in the documentation
|
||||
// and/or other materials provided with the distribution.
|
||||
//
|
||||
// - Neither the name of the Outercurve Foundation nor the names of its
|
||||
// contributors may be used to endorse or promote products derived from this
|
||||
// software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
||||
// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
|
||||
namespace WebsitePanel.Ecommerce.EnterpriseServer
|
||||
{
|
||||
/// <summary>
|
||||
/// Authorize.NET Payment Provider keys set
|
||||
/// </summary>
|
||||
public class AuthorizeNetKeys
|
||||
{
|
||||
/// <summary>
|
||||
/// 3.1
|
||||
/// </summary>
|
||||
public const string Version = "x_version";
|
||||
/// <summary>
|
||||
/// True
|
||||
/// </summary>
|
||||
public const string DelimData = "x_delim_data";
|
||||
/// <summary>
|
||||
/// False
|
||||
/// </summary>
|
||||
public const string RelayResponse = "x_relay_response";
|
||||
/// <summary>
|
||||
/// API login ID for the payment gateway account
|
||||
/// </summary>
|
||||
public const string Account = "x_login";
|
||||
/// <summary>
|
||||
/// Transaction key obtained from the Merchant Interface
|
||||
/// </summary>
|
||||
public const string TransactionKey = "x_tran_key";
|
||||
/// <summary>
|
||||
/// Amount of purchase inclusive of tax
|
||||
/// </summary>
|
||||
public const string Amount = "x_amount";
|
||||
/// <summary>
|
||||
/// Customer's card number
|
||||
/// </summary>
|
||||
public const string CardNumber = "x_card_num";
|
||||
/// <summary>
|
||||
/// Customer's card expiration date
|
||||
/// </summary>
|
||||
public const string ExpirationDate = "x_exp_date";
|
||||
/// <summary>
|
||||
/// Type of transaction (AUTH_CAPTURE, AUTH_ONLY, CAPTURE_ONLY, CREDIT, VOID, PRIOR_AUTH_CAPTURE)
|
||||
/// </summary>
|
||||
public const string TransactType = "x_type";
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
public const string DemoMode = "x_test_request";
|
||||
public const string DelimiterChar = "x_delim_char";
|
||||
public const string EncapsulationChar = "x_encap_char";
|
||||
public const string DuplicateWindow = "x_duplicate_window";
|
||||
|
||||
public const string FirstName = "x_first_name";
|
||||
public const string LastName = "x_last_name";
|
||||
public const string Company = "x_company";
|
||||
public const string Address = "x_address";
|
||||
public const string City = "x_city";
|
||||
public const string State = "x_state";
|
||||
public const string Zip = "x_zip";
|
||||
public const string Country = "x_country";
|
||||
public const string Phone = "x_phone";
|
||||
public const string Fax = "x_fax";
|
||||
public const string CustomerId = "x_cust_id";
|
||||
public const string IPAddress = "x_customer_ip";
|
||||
public const string CustomerTax = "x_customer_tax_id";
|
||||
public const string CustomerEmail = "x_email";
|
||||
public const string SendConfirmation = "x_email_customer";
|
||||
public const string MerchantEmail = "x_merchant_email";
|
||||
public const string InvoiceNumber = "x_invoice_num";
|
||||
public const string TransDescription = "x_description";
|
||||
|
||||
public const string CurrencyCode = "x_currency_code";
|
||||
public const string PaymentMethod = "x_method";
|
||||
public const string RecurringBilling = "x_recurring_billing";
|
||||
public const string VerificationCode = "x_card_code";
|
||||
public const string AuthorizationCode = "x_auth_code";
|
||||
public const string AuthenticationIndicator = "x_authentication_indicator";
|
||||
public const string PurchaseOrder = "x_po_num";
|
||||
public const string Tax = "x_tax";
|
||||
|
||||
public const string FpHash = "x_fp_hash";
|
||||
public const string FpSequence = "x_fp_sequence";
|
||||
public const string FpTimestamp = "x_fp_timestamp";
|
||||
|
||||
public const string RelayUrl = "x_relay_url";
|
||||
|
||||
public const string TransactId = "x_trans_id";
|
||||
public const string AuthCode = "x_auth_code";
|
||||
|
||||
public const string MD5HashValue = "MD5HashValue";
|
||||
|
||||
public const string ShipToFirstName = "x_ship_to_first_name";
|
||||
public const string ShipToLastName = "x_ship_to_last_name";
|
||||
public const string ShipToCompany = "x_ship_to_company";
|
||||
public const string ShipToAddress = "x_ship_to_address";
|
||||
public const string ShipToCity = "x_ship_to_city";
|
||||
public const string ShipToState = "x_ship_to_state";
|
||||
public const string ShipToZip = "x_ship_to_zip";
|
||||
public const string ShipToCountry = "x_ship_to_country";
|
||||
|
||||
public const string ErrorPrefix = "AuthorizeNet.";
|
||||
|
||||
private AuthorizeNetKeys()
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,324 @@
|
|||
// Copyright (c) 2011, Outercurve Foundation.
|
||||
// All rights reserved.
|
||||
//
|
||||
// Redistribution and use in source and binary forms, with or without modification,
|
||||
// are permitted provided that the following conditions are met:
|
||||
//
|
||||
// - Redistributions of source code must retain the above copyright notice, this
|
||||
// list of conditions and the following disclaimer.
|
||||
//
|
||||
// - Redistributions in binary form must reproduce the above copyright notice,
|
||||
// this list of conditions and the following disclaimer in the documentation
|
||||
// and/or other materials provided with the distribution.
|
||||
//
|
||||
// - Neither the name of the Outercurve Foundation nor the names of its
|
||||
// contributors may be used to endorse or promote products derived from this
|
||||
// software without specific prior written permission.
|
||||
//
|
||||
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
||||
// ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
// WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
|
||||
// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
// (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
// LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
|
||||
// ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
// SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
using System;
|
||||
using System.Web;
|
||||
using System.Net;
|
||||
using System.IO;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Security.Cryptography;
|
||||
|
||||
namespace WebsitePanel.Ecommerce.EnterpriseServer
|
||||
{
|
||||
/// <summary>
|
||||
/// Payment provider for the Authorize.NET Gateway
|
||||
/// </summary>
|
||||
public class AuthorizeNetProvider : SystemPluginBase, IPaymentGatewayProvider
|
||||
{
|
||||
public const string DEMO_SERVICE_URL = "https://test.authorize.net/gateway/transact.dll";
|
||||
public const string LIVE_SERVICE_URL = "https://secure.authorize.net/gateway/transact.dll";
|
||||
public const char DELIMITER_CHAR = '|';
|
||||
public const string API_VERSION = "3.1";
|
||||
public const string TRANSACTION_TYPE = "AUTH_CAPTURE";
|
||||
public const string PAYMENT_METHOD = "CC";
|
||||
|
||||
public const string MD5_INVALID_MSG = "MD5 hash value received is either incorrect or modified.";
|
||||
|
||||
public override string[] SecureSettings
|
||||
{
|
||||
get
|
||||
{
|
||||
return new string[] { AuthNetSettings.MD5_HASH, AuthNetSettings.TRANSACTION_KEY };
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets Authorize.Net account is demo
|
||||
/// </summary>
|
||||
public bool DemoAccount
|
||||
{
|
||||
get
|
||||
{
|
||||
return Convert.ToBoolean(PluginSettings[AuthNetSettings.DEMO_ACCOUNT]);
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Gets whether provider is running in live mode
|
||||
/// </summary>
|
||||
public bool LiveMode
|
||||
{
|
||||
get
|
||||
{
|
||||
return Convert.ToBoolean(PluginSettings[AuthNetSettings.LIVE_MODE]);
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Gets whether email confirmations enabled
|
||||
/// </summary>
|
||||
public bool SendConfirmation
|
||||
{
|
||||
get
|
||||
{
|
||||
return Convert.ToBoolean(PluginSettings[AuthNetSettings.SEND_CONFIRMATION]);
|
||||
}
|
||||
}
|
||||
/// <summary>
|
||||
/// Get MD5 hash value for the account
|
||||
/// </summary>
|
||||
public string MD5_Hash
|
||||
{
|
||||
get { return PluginSettings[AuthNetSettings.MD5_HASH]; }
|
||||
}
|
||||
/// <summary>
|
||||
/// Gets transaction key for the account
|
||||
/// </summary>
|
||||
public string TransactionKey
|
||||
{
|
||||
get { return PluginSettings[AuthNetSettings.TRANSACTION_KEY]; }
|
||||
}
|
||||
/// <summary>
|
||||
/// Gets Authorize.Net account username
|
||||
/// </summary>
|
||||
public string Username
|
||||
{
|
||||
get { return PluginSettings[AuthNetSettings.USERNAME]; }
|
||||
}
|
||||
/// <summary>
|
||||
/// Gets merchant email to send confirmations by email
|
||||
/// </summary>
|
||||
public string MerchantEmail
|
||||
{
|
||||
get { return PluginSettings[AuthNetSettings.MERCHANT_EMAIL]; }
|
||||
}
|
||||
/// <summary>
|
||||
/// Gets Authorize.Net service url
|
||||
/// </summary>
|
||||
public string ServiceUrl
|
||||
{
|
||||
get
|
||||
{
|
||||
if (DemoAccount)
|
||||
return DEMO_SERVICE_URL;
|
||||
return LIVE_SERVICE_URL;
|
||||
}
|
||||
}
|
||||
|
||||
#region IPaymentGatewayProvider Members
|
||||
|
||||
public TransactionResult SubmitPaymentTransaction(CheckoutDetails details)
|
||||
{
|
||||
//init result structure
|
||||
TransactionResult ret = new TransactionResult();
|
||||
//create request content
|
||||
string data = GetRequestData(details);
|
||||
// create webrequest instance
|
||||
HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create(ServiceUrl);
|
||||
webRequest.Method = "POST";
|
||||
webRequest.ContentLength = data.Length;
|
||||
webRequest.ContentType = "application/x-www-form-urlencoded";
|
||||
// send service request
|
||||
StreamWriter sw = null;
|
||||
try
|
||||
{
|
||||
sw = new StreamWriter(webRequest.GetRequestStream());
|
||||
sw.Write(data);
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (sw != null)
|
||||
sw.Close();
|
||||
}
|
||||
// read service response
|
||||
AIMResponse aimResponse = null;
|
||||
HttpWebResponse webResponse = null;
|
||||
try
|
||||
{
|
||||
// get response
|
||||
webResponse = (HttpWebResponse)webRequest.GetResponse();
|
||||
// emit new response
|
||||
aimResponse = new AIMResponse(webResponse.GetResponseStream(), DELIMITER_CHAR);
|
||||
}
|
||||
finally
|
||||
{
|
||||
webResponse.Close();
|
||||
webRequest.Abort();
|
||||
}
|
||||
// copy raw service response
|
||||
ret.RawResponse = aimResponse.RawResponse;
|
||||
// read service response status
|
||||
switch (aimResponse[AIMField.ResponseCode])
|
||||
{
|
||||
case "1": //This transaction has been approved.
|
||||
case "4": //This transaction is being held for review.
|
||||
// check MD5 signature
|
||||
if (!CheckResponseSignature(Username, MD5_Hash, aimResponse[AIMField.TransactionId], details[CheckoutKeys.Amount],
|
||||
aimResponse[AIMField.ResponseSignature]))
|
||||
{
|
||||
throw new Exception(MD5_INVALID_MSG);
|
||||
}
|
||||
//
|
||||
ret.Succeed = true;
|
||||
//
|
||||
ret.TransactionId = aimResponse[AIMField.TransactionId];
|
||||
// mark transaction as a completed
|
||||
ret.TransactionStatus = TransactionStatus.Approved;
|
||||
//
|
||||
break;
|
||||
case "2": // This transaction has been declined.
|
||||
case "3": // There has been an error processing this transaction.
|
||||
//
|
||||
ret.StatusCode = String.Concat(AuthorizeNetKeys.ErrorPrefix, aimResponse[AIMField.ResponseCode],
|
||||
aimResponse[AIMField.ResponseReasonCode]);
|
||||
//
|
||||
ret.Succeed = false;
|
||||
//
|
||||
ret.TransactionStatus = TransactionStatus.Declined;
|
||||
//
|
||||
break;
|
||||
}
|
||||
// return result
|
||||
return ret;
|
||||
}
|
||||
#endregion
|
||||
|
||||
private bool CheckResponseSignature(string login, string md5hash,
|
||||
string transactId, string amount, string signature)
|
||||
{
|
||||
//input string = "MD5 Hash Value"+"API Login ID"+"Trans ID"+"Amount"
|
||||
byte[] data = Encoding.ASCII.GetBytes(md5hash + login + transactId + amount);
|
||||
MD5 md5 = new MD5CryptoServiceProvider();
|
||||
byte[] result = md5.ComputeHash(data);
|
||||
StringBuilder sb = new StringBuilder();
|
||||
foreach (byte b in result)
|
||||
{
|
||||
sb.Append(b.ToString("X2"));
|
||||
}
|
||||
// validate response signature
|
||||
return (sb.ToString() == signature);
|
||||
}
|
||||
|
||||
private string GetRequestData(CheckoutDetails details)
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
||||
AddRequestData(CheckoutKeys.CardNumber, AuthorizeNetKeys.CardNumber, sb, details);
|
||||
AddRequestData(CheckoutKeys.VerificationCode, AuthorizeNetKeys.VerificationCode, sb, details);
|
||||
|
||||
// expire date
|
||||
string expireDate = String.Concat(details[CheckoutKeys.ExpireMonth], details[CheckoutKeys.ExpireYear]);
|
||||
AddRequestData(AuthorizeNetKeys.ExpirationDate, expireDate, sb);
|
||||
|
||||
AddRequestData(CheckoutKeys.Amount, AuthorizeNetKeys.Amount, sb, details);
|
||||
|
||||
//TODO: Add currency support
|
||||
AddRequestData(CheckoutKeys.Currency, AuthorizeNetKeys.CurrencyCode, sb, details);
|
||||
|
||||
AddRequestData(CheckoutKeys.InvoiceNumber, AuthorizeNetKeys.InvoiceNumber, sb, details);
|
||||
AddRequestData(CheckoutKeys.ContractNumber, AuthorizeNetKeys.TransDescription, sb, details);
|
||||
|
||||
AddRequestData(CheckoutKeys.FirstName, AuthorizeNetKeys.FirstName, sb, details);
|
||||
AddRequestData(CheckoutKeys.LastName, AuthorizeNetKeys.LastName, sb, details);
|
||||
// email is shipping
|
||||
AddRequestData(CheckoutKeys.CustomerEmail, AuthorizeNetKeys.CustomerEmail, sb, details);
|
||||
AddRequestData(CheckoutKeys.Address, AuthorizeNetKeys.Address, sb, details);
|
||||
AddRequestData(CheckoutKeys.Zip, AuthorizeNetKeys.Zip, sb, details);
|
||||
AddRequestData(CheckoutKeys.City, AuthorizeNetKeys.City, sb, details);
|
||||
AddRequestData(CheckoutKeys.State, AuthorizeNetKeys.State, sb, details);
|
||||
AddRequestData(CheckoutKeys.Country, AuthorizeNetKeys.Country, sb, details);
|
||||
AddRequestData(CheckoutKeys.Phone, AuthorizeNetKeys.Phone, sb, details);
|
||||
AddRequestData(CheckoutKeys.Fax, AuthorizeNetKeys.Fax, sb, details);
|
||||
AddRequestData(CheckoutKeys.CustomerId, AuthorizeNetKeys.CustomerId, sb, details);
|
||||
AddRequestData(CheckoutKeys.IPAddress, AuthorizeNetKeys.IPAddress, sb, details);
|
||||
|
||||
// shipping information
|
||||
AddRequestData(CheckoutKeys.ShipToFirstName, AuthorizeNetKeys.ShipToFirstName, sb, details);
|
||||
AddRequestData(CheckoutKeys.ShipToLastName, AuthorizeNetKeys.ShipToLastName, sb, details);
|
||||
AddRequestData(CheckoutKeys.ShipToCompany, AuthorizeNetKeys.ShipToCompany, sb, details);
|
||||
AddRequestData(CheckoutKeys.ShipToZip, AuthorizeNetKeys.ShipToZip, sb, details);
|
||||
AddRequestData(CheckoutKeys.ShipToAddress, AuthorizeNetKeys.ShipToAddress, sb, details);
|
||||
AddRequestData(CheckoutKeys.ShipToCity, AuthorizeNetKeys.ShipToCity, sb, details);
|
||||
AddRequestData(CheckoutKeys.ShipToState, AuthorizeNetKeys.ShipToState, sb, details);
|
||||
AddRequestData(CheckoutKeys.ShipToCountry, AuthorizeNetKeys.ShipToCountry, sb, details);
|
||||
|
||||
// service settings
|
||||
// copy account username
|
||||
AddRequestData(AuthorizeNetKeys.Account, Username, sb);
|
||||
// copy response delimiter char
|
||||
AddRequestData(AuthorizeNetKeys.DelimiterChar, DELIMITER_CHAR.ToString(), sb);
|
||||
// copy transaction key
|
||||
AddRequestData(AuthorizeNetKeys.TransactionKey, TransactionKey, sb);
|
||||
// copy send confirmation flag & merchant email
|
||||
if (SendConfirmation)
|
||||
{
|
||||
AddRequestData(AuthorizeNetKeys.MerchantEmail, MerchantEmail, sb);
|
||||
AddRequestData(AuthorizeNetKeys.SendConfirmation, "TRUE", sb);
|
||||
}
|
||||
else
|
||||
{
|
||||
AddRequestData(AuthorizeNetKeys.SendConfirmation, "FALSE", sb);
|
||||
}
|
||||
// copy API version
|
||||
AddRequestData(AuthorizeNetKeys.Version, API_VERSION, sb);
|
||||
// copy demo mode flag
|
||||
if (!LiveMode)
|
||||
AddRequestData(AuthorizeNetKeys.DemoMode, "TRUE", sb);
|
||||
// copy payment method
|
||||
AddRequestData(AuthorizeNetKeys.PaymentMethod, PAYMENT_METHOD, sb);
|
||||
// copy transaction type
|
||||
AddRequestData(AuthorizeNetKeys.TransactType, TRANSACTION_TYPE, sb);
|
||||
// copy delim data flag
|
||||
AddRequestData(AuthorizeNetKeys.DelimData, "TRUE", sb);
|
||||
// copy relay response flag
|
||||
AddRequestData(AuthorizeNetKeys.RelayResponse, "FALSE", sb);
|
||||
// return result
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
private void AddRequestData(string key1, string key2, StringBuilder sb, CheckoutDetails details)
|
||||
{
|
||||
AddRequestData(key2, details[key1], sb);
|
||||
}
|
||||
|
||||
private void AddRequestData(string key, StringBuilder sb, CheckoutDetails details)
|
||||
{
|
||||
AddRequestData(key, details[key], sb);
|
||||
}
|
||||
|
||||
private void AddRequestData(string key, string value, StringBuilder sb)
|
||||
{
|
||||
if (!String.IsNullOrEmpty(key) && !String.IsNullOrEmpty(value))
|
||||
{
|
||||
if (sb.Length == 0)
|
||||
sb.AppendFormat("{0}={1}", key, value);
|
||||
else
|
||||
sb.AppendFormat("&{0}={1}", key, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("WebsitePanel.Plugins.AuthorizeNet")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyProduct("WebsitePanel.Plugins.AuthorizeNet")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("cd47ea40-fb02-4b35-aa78-803f223267b5")]
|
|
@ -0,0 +1,102 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="4.0">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProductVersion>9.0.30729</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{DB852295-2A86-44AB-8CF8-A73FEAF15368}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>WebsitePanel.Ecommerce.EnterpriseServer</RootNamespace>
|
||||
<AssemblyName>WebsitePanel.Plugins.AuthorizeNet</AssemblyName>
|
||||
<FileUpgradeFlags>
|
||||
</FileUpgradeFlags>
|
||||
<OldToolsVersion>3.5</OldToolsVersion>
|
||||
<UpgradeBackupLocation>
|
||||
</UpgradeBackupLocation>
|
||||
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
|
||||
<PublishUrl>publish\</PublishUrl>
|
||||
<Install>true</Install>
|
||||
<InstallFrom>Disk</InstallFrom>
|
||||
<UpdateEnabled>false</UpdateEnabled>
|
||||
<UpdateMode>Foreground</UpdateMode>
|
||||
<UpdateInterval>7</UpdateInterval>
|
||||
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
|
||||
<UpdatePeriodically>false</UpdatePeriodically>
|
||||
<UpdateRequired>false</UpdateRequired>
|
||||
<MapFileExtensions>true</MapFileExtensions>
|
||||
<ApplicationRevision>0</ApplicationRevision>
|
||||
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
|
||||
<IsWebBootstrapper>false</IsWebBootstrapper>
|
||||
<UseApplicationTrust>false</UseApplicationTrust>
|
||||
<BootstrapperEnabled>true</BootstrapperEnabled>
|
||||
<TargetFrameworkProfile />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>..\WebsitePanel.EnterpriseServer\bin\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<WarningsAsErrors>618</WarningsAsErrors>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>none</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>..\WebsitePanel.EnterpriseServer\bin\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<WarningsAsErrors>618</WarningsAsErrors>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="..\VersionInfo.cs">
|
||||
<Link>VersionInfo.cs</Link>
|
||||
</Compile>
|
||||
<Compile Include="AIMResponse.cs" />
|
||||
<Compile Include="AuthorizeNetKeys.cs" />
|
||||
<Compile Include="AuthorizeNetProvider.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\WebsitePanel.EnterpriseServer.Base\WebsitePanel.EnterpriseServer.Base.csproj">
|
||||
<Project>{C09CE910-F16B-48A1-B2CC-C99B8C1CF775}</Project>
|
||||
<Name>WebsitePanel.EnterpriseServer.Base</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<BootstrapperPackage Include="Microsoft.Net.Client.3.5">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName>
|
||||
<Install>false</Install>
|
||||
</BootstrapperPackage>
|
||||
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>.NET Framework 3.5 SP1</ProductName>
|
||||
<Install>true</Install>
|
||||
</BootstrapperPackage>
|
||||
<BootstrapperPackage Include="Microsoft.Windows.Installer.3.1">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>Windows Installer 3.1</ProductName>
|
||||
<Install>true</Install>
|
||||
</BootstrapperPackage>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
</Project>
|
Loading…
Add table
Add a link
Reference in a new issue