PageRenderTime 38ms CodeModel.GetById 13ms RepoModel.GetById 0ms app.codeStats 0ms

/mojoPortal.Business.WebHelpers/PaymentGateway/NotImplementedPaymentGateway.cs

#
C# | 496 lines | 373 code | 106 blank | 17 comment | 1 complexity | e425a29810764d4e8ddf5952ff0056d3 MD5 | raw file
Possible License(s): LGPL-2.1, Apache-2.0, BSD-3-Clause, CPL-1.0, CC-BY-SA-3.0, GPL-2.0
  1. // Author: Joe Audette
  2. // Created: 2008-03-05
  3. // Last Modified: 2008-06-25
  4. //
  5. // The use and distribution terms for this software are covered by the
  6. // Common Public License 1.0 (http://opensource.org/licenses/cpl.php)
  7. // which can be found in the file CPL.TXT at the root of this distribution.
  8. // By using this software in any fashion, you are agreeing to be bound by
  9. // the terms of this license.
  10. //
  11. // You must not remove this notice, or any other, from this software.
  12. using System;
  13. namespace mojoPortal.Business.WebHelpers.PaymentGateway
  14. {
  15. /// <summary>
  16. /// This is just a stub that you can copy for a starting point in implementing new gateways
  17. ///
  18. /// </summary>
  19. public class NotImplementedPaymentGateway : IPaymentGateway
  20. {
  21. //private static readonly ILog log = LogManager.GetLogger(typeof(NotImplementedPaymentGateway));
  22. #region Constructors
  23. public NotImplementedPaymentGateway()
  24. { }
  25. #endregion
  26. #region Private Properties
  27. private string provider = "mojoPortal Not Implemented Payment Gateway";
  28. private PaymentGatewayTransactionType transactionType = PaymentGatewayTransactionType.AuthCapture;
  29. private PaymentGatewayResponse response = PaymentGatewayResponse.NoRequestInitiated;
  30. private string testUrl = "";
  31. private string productionUrl = "";
  32. private string merchantAPILogin = string.Empty;
  33. private string merchantAPITransactionKey = string.Empty;
  34. private string cardType = string.Empty;
  35. private string cardNumber = string.Empty;
  36. private string cardExpiration = string.Empty;
  37. private string cardSecurityCode = string.Empty;
  38. private string authenticationIndicator = string.Empty;
  39. private string cardholderAuthenticationValue = string.Empty;
  40. private string cardOwnerFirstName = string.Empty;
  41. private string cardOwnerLastName = string.Empty;
  42. private string cardOwnerCompanyName = string.Empty;
  43. private string cardBillingAddress = string.Empty;
  44. private string cardBillingCity = string.Empty;
  45. private string cardBillingState = string.Empty;
  46. private string cardBillingPostalCode = string.Empty;
  47. private string cardBillingCountry = string.Empty;
  48. private string cardBillingCountryCode = string.Empty;
  49. private string shipToFirstName = string.Empty;
  50. private string shipToLastName = string.Empty;
  51. private string shipToCompanyName = string.Empty;
  52. private string shipToAddress = string.Empty;
  53. private string shipToCity = string.Empty;
  54. private string shipToState = string.Empty;
  55. private string shipToPostalCode = string.Empty;
  56. private string shipToCountry = string.Empty;
  57. private string cardBillingPhone = string.Empty;
  58. private string cardBillingEmail = string.Empty;
  59. private string customerIPAddress = string.Empty;
  60. private string customerTaxID = string.Empty;
  61. private string customerID = string.Empty;
  62. private bool sendCustomerEmailConfirmation = false;
  63. private string merchantEmail = string.Empty;
  64. private string merchantInvoiceNumber = string.Empty;
  65. private string merchantTransactionDescription = string.Empty;
  66. private string merchantEmailConfirmationHeader = string.Empty;
  67. private string merchantEmailConfirmationFooter = string.Empty;
  68. private string previousTransactionID = string.Empty;
  69. private string transactionID = string.Empty;
  70. private string previousApprovalCode = string.Empty;
  71. private string approvalCode = string.Empty;
  72. private string responseCode = string.Empty;
  73. private string reasonCode = string.Empty;
  74. private string responseReason = string.Empty;
  75. private string avsResultCode = string.Empty;
  76. private string avsResultText = string.Empty;
  77. private string cardSecurityCodeResponseCode = string.Empty;
  78. private string cardholderAuthenticationValueResponseCode = string.Empty;
  79. private string currencyCode = "";
  80. private decimal chargeTotal = 0;
  81. private bool useTestMode = false;
  82. private bool useTestUrl = false;
  83. private string rawResponse = string.Empty;
  84. private int timeoutInMilliseconds = 120000; // 120 seconds
  85. private Exception lastExecutionException = null;
  86. #endregion
  87. #region Public Properties
  88. public string TestUrl
  89. {
  90. get { return testUrl; }
  91. }
  92. public string ProductionUrl
  93. {
  94. get { return productionUrl; }
  95. }
  96. #endregion
  97. #region IPaymentGateway
  98. #region IPaymentGateway Properties
  99. public string Provider
  100. {
  101. get { return provider; }
  102. }
  103. public string CardType
  104. {
  105. get { return cardType; }
  106. set { cardType = value; }
  107. }
  108. public string CardNumber
  109. {
  110. get { return cardNumber; }
  111. set { cardNumber = value; }
  112. }
  113. public string CardExpiration
  114. {
  115. get { return cardExpiration; }
  116. set { cardExpiration = value; }
  117. }
  118. public string CardSecurityCode
  119. {
  120. get { return cardSecurityCode; }
  121. set { cardSecurityCode = value; }
  122. }
  123. public string AuthenticationIndicator
  124. {
  125. get { return authenticationIndicator; }
  126. set { authenticationIndicator = value; }
  127. }
  128. public string CardholderAuthenticationValue
  129. {
  130. get { return cardholderAuthenticationValue; }
  131. set { cardholderAuthenticationValue = value; }
  132. }
  133. public string CardOwnerFirstName
  134. {
  135. get { return cardOwnerFirstName; }
  136. set { cardOwnerFirstName = value; }
  137. }
  138. public string CardOwnerLastName
  139. {
  140. get { return cardOwnerLastName; }
  141. set { cardOwnerLastName = value; }
  142. }
  143. public string CardOwnerCompanyName
  144. {
  145. get { return cardOwnerCompanyName; }
  146. set { cardOwnerCompanyName = value; }
  147. }
  148. public string CardBillingAddress
  149. {
  150. get { return cardBillingAddress; }
  151. set { cardBillingAddress = value; }
  152. }
  153. public string CardBillingCity
  154. {
  155. get { return cardBillingCity; }
  156. set { cardBillingCity = value; }
  157. }
  158. public string CardBillingState
  159. {
  160. get { return cardBillingState; }
  161. set { cardBillingState = value; }
  162. }
  163. public string CardBillingPostalCode
  164. {
  165. get { return cardBillingPostalCode; }
  166. set { cardBillingPostalCode = value; }
  167. }
  168. public string CardBillingCountry
  169. {
  170. get { return cardBillingCountry; }
  171. set { cardBillingCountry = value; }
  172. }
  173. public string CardBillingCountryCode
  174. {
  175. get { return cardBillingCountryCode; }
  176. set { cardBillingCountryCode = value; }
  177. }
  178. public string CardBillingPhone
  179. {
  180. get { return cardBillingPhone; }
  181. set { cardBillingPhone = value; }
  182. }
  183. public string CardBillingEmail
  184. {
  185. get { return cardBillingEmail; }
  186. set { cardBillingEmail = value; }
  187. }
  188. public string ShipToFirstName
  189. {
  190. get { return shipToFirstName; }
  191. set { shipToFirstName = value; }
  192. }
  193. public string ShipToLastName
  194. {
  195. get { return shipToLastName; }
  196. set { shipToLastName = value; }
  197. }
  198. public string ShipToCompanyName
  199. {
  200. get { return shipToCompanyName; }
  201. set { shipToCompanyName = value; }
  202. }
  203. public string ShipToAddress
  204. {
  205. get { return shipToAddress; }
  206. set { shipToAddress = value; }
  207. }
  208. public string ShipToCity
  209. {
  210. get { return shipToCity; }
  211. set { shipToCity = value; }
  212. }
  213. public string ShipToState
  214. {
  215. get { return shipToState; }
  216. set { shipToState = value; }
  217. }
  218. public string ShipToPostalCode
  219. {
  220. get { return shipToPostalCode; }
  221. set { shipToPostalCode = value; }
  222. }
  223. public string ShipToCountry
  224. {
  225. get { return shipToCountry; }
  226. set { shipToCountry = value; }
  227. }
  228. public string CustomerIPAddress
  229. {
  230. get { return customerIPAddress; }
  231. set { customerIPAddress = value; }
  232. }
  233. public string CustomerTaxId
  234. {
  235. get { return customerTaxID; }
  236. set { customerTaxID = value; }
  237. }
  238. public string CustomerId
  239. {
  240. get { return customerID; }
  241. set { customerID = value; }
  242. }
  243. public bool SendCustomerEmailConfirmation
  244. {
  245. get { return sendCustomerEmailConfirmation; }
  246. set { sendCustomerEmailConfirmation = value; }
  247. }
  248. public string MerchantEmail
  249. {
  250. get { return merchantEmail; }
  251. set { merchantEmail = value; }
  252. }
  253. public string MerchantInvoiceNumber
  254. {
  255. get { return merchantInvoiceNumber; }
  256. set { merchantInvoiceNumber = value; }
  257. }
  258. public string MerchantTransactionDescription
  259. {
  260. get { return merchantTransactionDescription; }
  261. set { merchantTransactionDescription = value; }
  262. }
  263. public string MerchantEmailConfirmationHeader
  264. {
  265. get { return merchantEmailConfirmationHeader; }
  266. set { merchantEmailConfirmationHeader = value; }
  267. }
  268. public string MerchantEmailConfirmationFooter
  269. {
  270. get { return merchantEmailConfirmationFooter; }
  271. set { merchantEmailConfirmationFooter = value; }
  272. }
  273. public string CurrencyCode
  274. {
  275. get { return currencyCode; }
  276. set { currencyCode = value; }
  277. }
  278. public decimal ChargeTotal
  279. {
  280. get { return chargeTotal; }
  281. set { chargeTotal = value; }
  282. }
  283. public PaymentGatewayTransactionType TransactionType
  284. {
  285. get { return transactionType; }
  286. set { transactionType = value; }
  287. }
  288. public string PreviousTransactionId
  289. {
  290. get { return previousTransactionID; }
  291. set { previousTransactionID = value; }
  292. }
  293. public string PreviousApprovalCode
  294. {
  295. get { return previousApprovalCode; }
  296. set { previousApprovalCode = value; }
  297. }
  298. public string TransactionId
  299. {
  300. get { return transactionID; }
  301. }
  302. public string ApprovalCode
  303. {
  304. get { return approvalCode; }
  305. }
  306. public string ResponseCode
  307. {
  308. get { return responseCode; }
  309. }
  310. public string ReasonCode
  311. {
  312. get { return reasonCode; }
  313. }
  314. public string ResponseReason
  315. {
  316. get { return responseReason; }
  317. }
  318. public PaymentGatewayResponse Response
  319. {
  320. get { return response; }
  321. }
  322. public string AvsResultCode
  323. {
  324. get { return avsResultCode; }
  325. }
  326. public string AvsResultText
  327. {
  328. get { return avsResultText; }
  329. }
  330. public string CardSecurityCodeResponseCode
  331. {
  332. get { return cardSecurityCodeResponseCode; }
  333. }
  334. public string CardholderAuthenticationValueResponseCode
  335. {
  336. get { return cardholderAuthenticationValueResponseCode; }
  337. }
  338. public bool UseTestMode
  339. {
  340. get { return useTestMode; }
  341. set { useTestMode = value; }
  342. }
  343. public bool UseTestUrl
  344. {
  345. get { return useTestUrl; }
  346. set { useTestUrl = value; }
  347. }
  348. public string RawResponse
  349. {
  350. get { return rawResponse; }
  351. set { rawResponse = value; }
  352. }
  353. public Exception LastExecutionException
  354. {
  355. get { return lastExecutionException; }
  356. }
  357. public int TimeoutInMilliseconds
  358. {
  359. get { return timeoutInMilliseconds; }
  360. set { timeoutInMilliseconds = value; }
  361. }
  362. #endregion
  363. #region IPaymentGateway Methods
  364. public bool ExecuteTransaction()
  365. {
  366. response = PaymentGatewayResponse.NoRequestInitiated;
  367. return false;
  368. }
  369. public void LogTransaction(Guid siteGuid, Guid moduleGuid, Guid storeGuid, Guid cartGuid, Guid userGuid, string providerName, string method, string serializedCart)
  370. {
  371. }
  372. #endregion
  373. #endregion
  374. #region Private Methods
  375. private String FormatCharge()
  376. {
  377. return chargeTotal.ToString();
  378. }
  379. private void ParseResponse()
  380. {
  381. if (rawResponse.Length > 0)
  382. {
  383. }
  384. }
  385. #endregion
  386. #region Constants
  387. // positions in the string array after split on pipe
  388. #endregion
  389. }
  390. }