A QCodo powered CMS
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

1360 lines
60 KiB

  1. <?php
  2. /**
  3. * The abstract AuthorizeNetTransactionGen class defined here is
  4. * code-generated and contains all the basic CRUD-type functionality as well as
  5. * basic methods to handle relationships and index-based loading.
  6. *
  7. * To use, you should use the AuthorizeNetTransaction subclass which
  8. * extends this AuthorizeNetTransactionGen class.
  9. *
  10. * Because subsequent re-code generations will overwrite any changes to this
  11. * file, you should leave this file unaltered to prevent yourself from losing
  12. * any information or code changes. All customizations should be done by
  13. * overriding existing or implementing new methods, properties and variables
  14. * in the AuthorizeNetTransaction class.
  15. *
  16. * @package Quinta CMS
  17. * @subpackage GeneratedDataObjects
  18. * @property-read integer $Id the value for intId (Read-Only PK)
  19. * @property integer $OrderId the value for intOrderId (Not Null)
  20. * @property-read string $CreationDate the value for strCreationDate (Read-Only Timestamp)
  21. * @property string $ResponseCode the value for strResponseCode
  22. * @property string $ResponseSubcode the value for strResponseSubcode
  23. * @property string $ResponseReasonCode the value for strResponseReasonCode
  24. * @property string $ResponseReasonText the value for strResponseReasonText
  25. * @property string $AuthorizationCode the value for strAuthorizationCode
  26. * @property string $TransactionId the value for strTransactionId
  27. * @property string $TransactionType the value for strTransactionType
  28. * @property double $Amount the value for fltAmount
  29. * @property string $AvsResponseCode the value for strAvsResponseCode
  30. * @property string $CcvResponseCode the value for strCcvResponseCode
  31. * @property string $CavResponseCode the value for strCavResponseCode
  32. * @property Order $Order the value for the Order object referenced by intOrderId (Not Null)
  33. * @property-read boolean $__Restored whether or not this object was restored from the database (as opposed to created new)
  34. */
  35. class AuthorizeNetTransactionGen extends QBaseClass
  36. {
  37. ///////////////////////////////////////////////////////////////////////
  38. // PROTECTED MEMBER VARIABLES and TEXT FIELD MAXLENGTHS (if applicable)
  39. ///////////////////////////////////////////////////////////////////////
  40. /////////// Object properties ////////////
  41. /**
  42. * Protected member variable that maps to the database PK Identity column authorize_net_transaction.id
  43. * @var integer intId
  44. *
  45. */
  46. protected $intId = null;
  47. /**
  48. * Protected member variable that maps to the database column authorize_net_transaction.order_id
  49. * @var integer intOrderId
  50. *
  51. */
  52. protected $intOrderId = null;
  53. /**
  54. * Protected member variable that maps to the database column authorize_net_transaction.creation_date
  55. * @var string strCreationDate
  56. *
  57. */
  58. protected $strCreationDate = null;
  59. /**
  60. * Protected member variable that maps to the database column authorize_net_transaction.response_code
  61. * @var string strResponseCode
  62. *
  63. */
  64. protected $strResponseCode = null;
  65. const ResponseCodeMaxLength = 8;
  66. /**
  67. * Protected member variable that maps to the database column authorize_net_transaction.response_subcode
  68. * @var string strResponseSubcode
  69. *
  70. */
  71. protected $strResponseSubcode = null;
  72. const ResponseSubcodeMaxLength = 8;
  73. /**
  74. * Protected member variable that maps to the database column authorize_net_transaction.response_reason_code
  75. * @var string strResponseReasonCode
  76. *
  77. */
  78. protected $strResponseReasonCode = null;
  79. const ResponseReasonCodeMaxLength = 8;
  80. /**
  81. * Protected member variable that maps to the database column authorize_net_transaction.response_reason_text
  82. * @var string strResponseReasonText
  83. *
  84. */
  85. protected $strResponseReasonText = null;
  86. /**
  87. * Protected member variable that maps to the database column authorize_net_transaction.authorization_code
  88. * @var string strAuthorizationCode
  89. *
  90. */
  91. protected $strAuthorizationCode = null;
  92. const AuthorizationCodeMaxLength = 8;
  93. /**
  94. * Protected member variable that maps to the database column authorize_net_transaction.transaction_id
  95. * @var string strTransactionId
  96. *
  97. */
  98. protected $strTransactionId = null;
  99. const TransactionIdMaxLength = 128;
  100. /**
  101. * Protected member variable that maps to the database column authorize_net_transaction.transaction_type
  102. * @var string strTransactionType
  103. *
  104. */
  105. protected $strTransactionType = null;
  106. const TransactionTypeMaxLength = 128;
  107. /**
  108. * Protected member variable that maps to the database column authorize_net_transaction.amount
  109. * @var double fltAmount
  110. *
  111. */
  112. protected $fltAmount = null;
  113. /**
  114. * Protected member variable that maps to the database column authorize_net_transaction.avs_response_code
  115. * @var string strAvsResponseCode
  116. *
  117. */
  118. protected $strAvsResponseCode = null;
  119. const AvsResponseCodeMaxLength = 8;
  120. /**
  121. * Protected member variable that maps to the database column authorize_net_transaction.ccv_response_code
  122. * @var string strCcvResponseCode
  123. *
  124. */
  125. protected $strCcvResponseCode = null;
  126. const CcvResponseCodeMaxLength = 8;
  127. /**
  128. * Protected member variable that maps to the database column authorize_net_transaction.cav_response_code
  129. * @var string strCavResponseCode
  130. *
  131. */
  132. protected $strCavResponseCode = null;
  133. const CavResponseCodeMaxLength = 8;
  134. /**
  135. * Protected array of virtual attributes for this object (e.g. extra/other calculated and/or non-object bound
  136. * columns from the run-time database query result for this object). Used by InstantiateDbRow and
  137. * GetVirtualAttribute.
  138. * @var string[] $__strVirtualAttributeArray
  139. */
  140. protected $__strVirtualAttributeArray = array();
  141. /**
  142. * Protected internal member variable that specifies whether or not this object is Restored from the database.
  143. * Used by Save() to determine if Save() should perform a db UPDATE or INSERT.
  144. * @var bool __blnRestored;
  145. */
  146. protected $__blnRestored;
  147. ///////////////////////////////
  148. // PROTECTED MEMBER OBJECTS
  149. ///////////////////////////////
  150. /**
  151. * Protected member variable that contains the object pointed by the reference
  152. * in the database column authorize_net_transaction.order_id.
  153. *
  154. * NOTE: Always use the Order property getter to correctly retrieve this Order object.
  155. * (Because this class implements late binding, this variable reference MAY be null.)
  156. * @var Order objOrder
  157. */
  158. protected $objOrder;
  159. ///////////////////////////////
  160. // CLASS-WIDE LOAD AND COUNT METHODS
  161. ///////////////////////////////
  162. /**
  163. * Static method to retrieve the Database object that owns this class.
  164. * @return QDatabaseBase reference to the Database object that can query this class
  165. */
  166. public static function GetDatabase() {
  167. return QApplication::$Database[1];
  168. }
  169. /**
  170. * Load a AuthorizeNetTransaction from PK Info
  171. * @param integer $intId
  172. * @return AuthorizeNetTransaction
  173. */
  174. public static function Load($intId) {
  175. // Use QuerySingle to Perform the Query
  176. return AuthorizeNetTransaction::QuerySingle(
  177. QQ::Equal(QQN::AuthorizeNetTransaction()->Id, $intId)
  178. );
  179. }
  180. /**
  181. * Load all AuthorizeNetTransactions
  182. * @param QQClause[] $objOptionalClauses additional optional QQClause objects for this query
  183. * @return AuthorizeNetTransaction[]
  184. */
  185. public static function LoadAll($objOptionalClauses = null) {
  186. // Call AuthorizeNetTransaction::QueryArray to perform the LoadAll query
  187. try {
  188. return AuthorizeNetTransaction::QueryArray(QQ::All(), $objOptionalClauses);
  189. } catch (QCallerException $objExc) {
  190. $objExc->IncrementOffset();
  191. throw $objExc;
  192. }
  193. }
  194. /**
  195. * Count all AuthorizeNetTransactions
  196. * @return int
  197. */
  198. public static function CountAll() {
  199. // Call AuthorizeNetTransaction::QueryCount to perform the CountAll query
  200. return AuthorizeNetTransaction::QueryCount(QQ::All());
  201. }
  202. ///////////////////////////////
  203. // QCODO QUERY-RELATED METHODS
  204. ///////////////////////////////
  205. /**
  206. * Internally called method to assist with calling Qcodo Query for this class
  207. * on load methods.
  208. * @param QQueryBuilder &$objQueryBuilder the QueryBuilder object that will be created
  209. * @param QQCondition $objConditions any conditions on the query, itself
  210. * @param QQClause[] $objOptionalClausees additional optional QQClause object or array of QQClause objects for this query
  211. * @param mixed[] $mixParameterArray a array of name-value pairs to perform PrepareStatement with (sending in null will skip the PrepareStatement step)
  212. * @param boolean $blnCountOnly only select a rowcount
  213. * @return string the query statement
  214. */
  215. protected static function BuildQueryStatement(&$objQueryBuilder, QQCondition $objConditions, $objOptionalClauses, $mixParameterArray, $blnCountOnly) {
  216. // Get the Database Object for this Class
  217. $objDatabase = AuthorizeNetTransaction::GetDatabase();
  218. // Create/Build out the QueryBuilder object with AuthorizeNetTransaction-specific SELET and FROM fields
  219. $objQueryBuilder = new QQueryBuilder($objDatabase, 'authorize_net_transaction');
  220. AuthorizeNetTransaction::GetSelectFields($objQueryBuilder);
  221. $objQueryBuilder->AddFromItem('authorize_net_transaction');
  222. // Set "CountOnly" option (if applicable)
  223. if ($blnCountOnly)
  224. $objQueryBuilder->SetCountOnlyFlag();
  225. // Apply Any Conditions
  226. if ($objConditions)
  227. try {
  228. $objConditions->UpdateQueryBuilder($objQueryBuilder);
  229. } catch (QCallerException $objExc) {
  230. $objExc->IncrementOffset();
  231. throw $objExc;
  232. }
  233. // Iterate through all the Optional Clauses (if any) and perform accordingly
  234. if ($objOptionalClauses) {
  235. if ($objOptionalClauses instanceof QQClause)
  236. $objOptionalClauses->UpdateQueryBuilder($objQueryBuilder);
  237. else if (is_array($objOptionalClauses))
  238. foreach ($objOptionalClauses as $objClause)
  239. $objClause->UpdateQueryBuilder($objQueryBuilder);
  240. else
  241. throw new QCallerException('Optional Clauses must be a QQClause object or an array of QQClause objects');
  242. }
  243. // Get the SQL Statement
  244. $strQuery = $objQueryBuilder->GetStatement();
  245. // Prepare the Statement with the Query Parameters (if applicable)
  246. if ($mixParameterArray) {
  247. if (is_array($mixParameterArray)) {
  248. if (count($mixParameterArray))
  249. $strQuery = $objDatabase->PrepareStatement($strQuery, $mixParameterArray);
  250. // Ensure that there are no other Unresolved Named Parameters
  251. if (strpos($strQuery, chr(QQNamedValue::DelimiterCode) . '{') !== false)
  252. throw new QCallerException('Unresolved named parameters in the query');
  253. } else
  254. throw new QCallerException('Parameter Array must be an array of name-value parameter pairs');
  255. }
  256. // Return the Objects
  257. return $strQuery;
  258. }
  259. /**
  260. * Static Qcodo Query method to query for a single AuthorizeNetTransaction object.
  261. * Uses BuildQueryStatment to perform most of the work.
  262. * @param QQCondition $objConditions any conditions on the query, itself
  263. * @param QQClause[] $objOptionalClausees additional optional QQClause objects for this query
  264. * @param mixed[] $mixParameterArray a array of name-value pairs to perform PrepareStatement with
  265. * @return AuthorizeNetTransaction the queried object
  266. */
  267. public static function QuerySingle(QQCondition $objConditions, $objOptionalClauses = null, $mixParameterArray = null) {
  268. // Get the Query Statement
  269. try {
  270. $strQuery = AuthorizeNetTransaction::BuildQueryStatement($objQueryBuilder, $objConditions, $objOptionalClauses, $mixParameterArray, false);
  271. } catch (QCallerException $objExc) {
  272. $objExc->IncrementOffset();
  273. throw $objExc;
  274. }
  275. // Perform the Query, Get the First Row, and Instantiate a new AuthorizeNetTransaction object
  276. $objDbResult = $objQueryBuilder->Database->Query($strQuery);
  277. return AuthorizeNetTransaction::InstantiateDbRow($objDbResult->GetNextRow(), null, null, null, $objQueryBuilder->ColumnAliasArray);
  278. }
  279. /**
  280. * Static Qcodo Query method to query for an array of AuthorizeNetTransaction objects.
  281. * Uses BuildQueryStatment to perform most of the work.
  282. * @param QQCondition $objConditions any conditions on the query, itself
  283. * @param QQClause[] $objOptionalClausees additional optional QQClause objects for this query
  284. * @param mixed[] $mixParameterArray a array of name-value pairs to perform PrepareStatement with
  285. * @return AuthorizeNetTransaction[] the queried objects as an array
  286. */
  287. public static function QueryArray(QQCondition $objConditions, $objOptionalClauses = null, $mixParameterArray = null) {
  288. // Get the Query Statement
  289. try {
  290. $strQuery = AuthorizeNetTransaction::BuildQueryStatement($objQueryBuilder, $objConditions, $objOptionalClauses, $mixParameterArray, false);
  291. } catch (QCallerException $objExc) {
  292. $objExc->IncrementOffset();
  293. throw $objExc;
  294. }
  295. // Perform the Query and Instantiate the Array Result
  296. $objDbResult = $objQueryBuilder->Database->Query($strQuery);
  297. return AuthorizeNetTransaction::InstantiateDbResult($objDbResult, $objQueryBuilder->ExpandAsArrayNodes, $objQueryBuilder->ColumnAliasArray);
  298. }
  299. /**
  300. * Static Qcodo Query method to query for a count of AuthorizeNetTransaction objects.
  301. * Uses BuildQueryStatment to perform most of the work.
  302. * @param QQCondition $objConditions any conditions on the query, itself
  303. * @param QQClause[] $objOptionalClausees additional optional QQClause objects for this query
  304. * @param mixed[] $mixParameterArray a array of name-value pairs to perform PrepareStatement with
  305. * @return integer the count of queried objects as an integer
  306. */
  307. public static function QueryCount(QQCondition $objConditions, $objOptionalClauses = null, $mixParameterArray = null) {
  308. // Get the Query Statement
  309. try {
  310. $strQuery = AuthorizeNetTransaction::BuildQueryStatement($objQueryBuilder, $objConditions, $objOptionalClauses, $mixParameterArray, true);
  311. } catch (QCallerException $objExc) {
  312. $objExc->IncrementOffset();
  313. throw $objExc;
  314. }
  315. // Perform the Query and return the row_count
  316. $objDbResult = $objQueryBuilder->Database->Query($strQuery);
  317. // Figure out if the query is using GroupBy
  318. $blnGrouped = false;
  319. if ($objOptionalClauses) foreach ($objOptionalClauses as $objClause) {
  320. if ($objClause instanceof QQGroupBy) {
  321. $blnGrouped = true;
  322. break;
  323. }
  324. }
  325. if ($blnGrouped)
  326. // Groups in this query - return the count of Groups (which is the count of all rows)
  327. return $objDbResult->CountRows();
  328. else {
  329. // No Groups - return the sql-calculated count(*) value
  330. $strDbRow = $objDbResult->FetchRow();
  331. return QType::Cast($strDbRow[0], QType::Integer);
  332. }
  333. }
  334. /* public static function QueryArrayCached($strConditions, $mixParameterArray = null) {
  335. // Get the Database Object for this Class
  336. $objDatabase = AuthorizeNetTransaction::GetDatabase();
  337. // Lookup the QCache for This Query Statement
  338. $objCache = new QCache('query', 'authorize_net_transaction_' . serialize($strConditions));
  339. if (!($strQuery = $objCache->GetData())) {
  340. // Not Found -- Go ahead and Create/Build out a new QueryBuilder object with AuthorizeNetTransaction-specific fields
  341. $objQueryBuilder = new QQueryBuilder($objDatabase);
  342. AuthorizeNetTransaction::GetSelectFields($objQueryBuilder);
  343. AuthorizeNetTransaction::GetFromFields($objQueryBuilder);
  344. // Ensure the Passed-in Conditions is a string
  345. try {
  346. $strConditions = QType::Cast($strConditions, QType::String);
  347. } catch (QCallerException $objExc) {
  348. $objExc->IncrementOffset();
  349. throw $objExc;
  350. }
  351. // Create the Conditions object, and apply it
  352. $objConditions = eval('return ' . $strConditions . ';');
  353. // Apply Any Conditions
  354. if ($objConditions)
  355. $objConditions->UpdateQueryBuilder($objQueryBuilder);
  356. // Get the SQL Statement
  357. $strQuery = $objQueryBuilder->GetStatement();
  358. // Save the SQL Statement in the Cache
  359. $objCache->SaveData($strQuery);
  360. }
  361. // Prepare the Statement with the Parameters
  362. if ($mixParameterArray)
  363. $strQuery = $objDatabase->PrepareStatement($strQuery, $mixParameterArray);
  364. // Perform the Query and Instantiate the Array Result
  365. $objDbResult = $objDatabase->Query($strQuery);
  366. return AuthorizeNetTransaction::InstantiateDbResult($objDbResult);
  367. }*/
  368. /**
  369. * Updates a QQueryBuilder with the SELECT fields for this AuthorizeNetTransaction
  370. * @param QQueryBuilder $objBuilder the Query Builder object to update
  371. * @param string $strPrefix optional prefix to add to the SELECT fields
  372. */
  373. public static function GetSelectFields(QQueryBuilder $objBuilder, $strPrefix = null) {
  374. if ($strPrefix) {
  375. $strTableName = $strPrefix;
  376. $strAliasPrefix = $strPrefix . '__';
  377. } else {
  378. $strTableName = 'authorize_net_transaction';
  379. $strAliasPrefix = '';
  380. }
  381. $objBuilder->AddSelectItem($strTableName, 'id', $strAliasPrefix . 'id');
  382. $objBuilder->AddSelectItem($strTableName, 'order_id', $strAliasPrefix . 'order_id');
  383. $objBuilder->AddSelectItem($strTableName, 'creation_date', $strAliasPrefix . 'creation_date');
  384. $objBuilder->AddSelectItem($strTableName, 'response_code', $strAliasPrefix . 'response_code');
  385. $objBuilder->AddSelectItem($strTableName, 'response_subcode', $strAliasPrefix . 'response_subcode');
  386. $objBuilder->AddSelectItem($strTableName, 'response_reason_code', $strAliasPrefix . 'response_reason_code');
  387. $objBuilder->AddSelectItem($strTableName, 'response_reason_text', $strAliasPrefix . 'response_reason_text');
  388. $objBuilder->AddSelectItem($strTableName, 'authorization_code', $strAliasPrefix . 'authorization_code');
  389. $objBuilder->AddSelectItem($strTableName, 'transaction_id', $strAliasPrefix . 'transaction_id');
  390. $objBuilder->AddSelectItem($strTableName, 'transaction_type', $strAliasPrefix . 'transaction_type');
  391. $objBuilder->AddSelectItem($strTableName, 'amount', $strAliasPrefix . 'amount');
  392. $objBuilder->AddSelectItem($strTableName, 'avs_response_code', $strAliasPrefix . 'avs_response_code');
  393. $objBuilder->AddSelectItem($strTableName, 'ccv_response_code', $strAliasPrefix . 'ccv_response_code');
  394. $objBuilder->AddSelectItem($strTableName, 'cav_response_code', $strAliasPrefix . 'cav_response_code');
  395. }
  396. ///////////////////////////////
  397. // INSTANTIATION-RELATED METHODS
  398. ///////////////////////////////
  399. /**
  400. * Instantiate a AuthorizeNetTransaction from a Database Row.
  401. * Takes in an optional strAliasPrefix, used in case another Object::InstantiateDbRow
  402. * is calling this AuthorizeNetTransaction::InstantiateDbRow in order to perform
  403. * early binding on referenced objects.
  404. * @param DatabaseRowBase $objDbRow
  405. * @param string $strAliasPrefix
  406. * @param string $strExpandAsArrayNodes
  407. * @param QBaseClass $objPreviousItem
  408. * @param string[] $strColumnAliasArray
  409. * @return AuthorizeNetTransaction
  410. */
  411. public static function InstantiateDbRow($objDbRow, $strAliasPrefix = null, $strExpandAsArrayNodes = null, $objPreviousItem = null, $strColumnAliasArray = array()) {
  412. // If blank row, return null
  413. if (!$objDbRow)
  414. return null;
  415. // Create a new instance of the AuthorizeNetTransaction object
  416. $objToReturn = new AuthorizeNetTransaction();
  417. $objToReturn->__blnRestored = true;
  418. $strAliasName = array_key_exists($strAliasPrefix . 'id', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'id'] : $strAliasPrefix . 'id';
  419. $objToReturn->intId = $objDbRow->GetColumn($strAliasName, 'Integer');
  420. $strAliasName = array_key_exists($strAliasPrefix . 'order_id', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'order_id'] : $strAliasPrefix . 'order_id';
  421. $objToReturn->intOrderId = $objDbRow->GetColumn($strAliasName, 'Integer');
  422. $strAliasName = array_key_exists($strAliasPrefix . 'creation_date', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'creation_date'] : $strAliasPrefix . 'creation_date';
  423. $objToReturn->strCreationDate = $objDbRow->GetColumn($strAliasName, 'VarChar');
  424. $strAliasName = array_key_exists($strAliasPrefix . 'response_code', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'response_code'] : $strAliasPrefix . 'response_code';
  425. $objToReturn->strResponseCode = $objDbRow->GetColumn($strAliasName, 'VarChar');
  426. $strAliasName = array_key_exists($strAliasPrefix . 'response_subcode', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'response_subcode'] : $strAliasPrefix . 'response_subcode';
  427. $objToReturn->strResponseSubcode = $objDbRow->GetColumn($strAliasName, 'VarChar');
  428. $strAliasName = array_key_exists($strAliasPrefix . 'response_reason_code', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'response_reason_code'] : $strAliasPrefix . 'response_reason_code';
  429. $objToReturn->strResponseReasonCode = $objDbRow->GetColumn($strAliasName, 'VarChar');
  430. $strAliasName = array_key_exists($strAliasPrefix . 'response_reason_text', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'response_reason_text'] : $strAliasPrefix . 'response_reason_text';
  431. $objToReturn->strResponseReasonText = $objDbRow->GetColumn($strAliasName, 'Blob');
  432. $strAliasName = array_key_exists($strAliasPrefix . 'authorization_code', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'authorization_code'] : $strAliasPrefix . 'authorization_code';
  433. $objToReturn->strAuthorizationCode = $objDbRow->GetColumn($strAliasName, 'VarChar');
  434. $strAliasName = array_key_exists($strAliasPrefix . 'transaction_id', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'transaction_id'] : $strAliasPrefix . 'transaction_id';
  435. $objToReturn->strTransactionId = $objDbRow->GetColumn($strAliasName, 'VarChar');
  436. $strAliasName = array_key_exists($strAliasPrefix . 'transaction_type', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'transaction_type'] : $strAliasPrefix . 'transaction_type';
  437. $objToReturn->strTransactionType = $objDbRow->GetColumn($strAliasName, 'VarChar');
  438. $strAliasName = array_key_exists($strAliasPrefix . 'amount', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'amount'] : $strAliasPrefix . 'amount';
  439. $objToReturn->fltAmount = $objDbRow->GetColumn($strAliasName, 'Float');
  440. $strAliasName = array_key_exists($strAliasPrefix . 'avs_response_code', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'avs_response_code'] : $strAliasPrefix . 'avs_response_code';
  441. $objToReturn->strAvsResponseCode = $objDbRow->GetColumn($strAliasName, 'VarChar');
  442. $strAliasName = array_key_exists($strAliasPrefix . 'ccv_response_code', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'ccv_response_code'] : $strAliasPrefix . 'ccv_response_code';
  443. $objToReturn->strCcvResponseCode = $objDbRow->GetColumn($strAliasName, 'VarChar');
  444. $strAliasName = array_key_exists($strAliasPrefix . 'cav_response_code', $strColumnAliasArray) ? $strColumnAliasArray[$strAliasPrefix . 'cav_response_code'] : $strAliasPrefix . 'cav_response_code';
  445. $objToReturn->strCavResponseCode = $objDbRow->GetColumn($strAliasName, 'VarChar');
  446. // Instantiate Virtual Attributes
  447. foreach ($objDbRow->GetColumnNameArray() as $strColumnName => $mixValue) {
  448. $strVirtualPrefix = $strAliasPrefix . '__';
  449. $strVirtualPrefixLength = strlen($strVirtualPrefix);
  450. if (substr($strColumnName, 0, $strVirtualPrefixLength) == $strVirtualPrefix)
  451. $objToReturn->__strVirtualAttributeArray[substr($strColumnName, $strVirtualPrefixLength)] = $mixValue;
  452. }
  453. // Prepare to Check for Early/Virtual Binding
  454. if (!$strAliasPrefix)
  455. $strAliasPrefix = 'authorize_net_transaction__';
  456. // Check for Order Early Binding
  457. $strAlias = $strAliasPrefix . 'order_id__id';
  458. $strAliasName = array_key_exists($strAlias, $strColumnAliasArray) ? $strColumnAliasArray[$strAlias] : $strAlias;
  459. if (!is_null($objDbRow->GetColumn($strAliasName)))
  460. $objToReturn->objOrder = Order::InstantiateDbRow($objDbRow, $strAliasPrefix . 'order_id__', $strExpandAsArrayNodes, null, $strColumnAliasArray);
  461. return $objToReturn;
  462. }
  463. /**
  464. * Instantiate an array of AuthorizeNetTransactions from a Database Result
  465. * @param DatabaseResultBase $objDbResult
  466. * @param string $strExpandAsArrayNodes
  467. * @param string[] $strColumnAliasArray
  468. * @return AuthorizeNetTransaction[]
  469. */
  470. public static function InstantiateDbResult(QDatabaseResultBase $objDbResult, $strExpandAsArrayNodes = null, $strColumnAliasArray = null) {
  471. $objToReturn = array();
  472. if (!$strColumnAliasArray)
  473. $strColumnAliasArray = array();
  474. // If blank resultset, then return empty array
  475. if (!$objDbResult)
  476. return $objToReturn;
  477. // Load up the return array with each row
  478. if ($strExpandAsArrayNodes) {
  479. $objLastRowItem = null;
  480. while ($objDbRow = $objDbResult->GetNextRow()) {
  481. $objItem = AuthorizeNetTransaction::InstantiateDbRow($objDbRow, null, $strExpandAsArrayNodes, $objLastRowItem, $strColumnAliasArray);
  482. if ($objItem) {
  483. $objToReturn[] = $objItem;
  484. $objLastRowItem = $objItem;
  485. }
  486. }
  487. } else {
  488. while ($objDbRow = $objDbResult->GetNextRow())
  489. $objToReturn[] = AuthorizeNetTransaction::InstantiateDbRow($objDbRow, null, null, null, $strColumnAliasArray);
  490. }
  491. return $objToReturn;
  492. }
  493. ///////////////////////////////////////////////////
  494. // INDEX-BASED LOAD METHODS (Single Load and Array)
  495. ///////////////////////////////////////////////////
  496. /**
  497. * Load a single AuthorizeNetTransaction object,
  498. * by Id Index(es)
  499. * @param integer $intId
  500. * @return AuthorizeNetTransaction
  501. */
  502. public static function LoadById($intId) {
  503. return AuthorizeNetTransaction::QuerySingle(
  504. QQ::Equal(QQN::AuthorizeNetTransaction()->Id, $intId)
  505. );
  506. }
  507. /**
  508. * Load an array of AuthorizeNetTransaction objects,
  509. * by TransactionId Index(es)
  510. * @param string $strTransactionId
  511. * @param QQClause[] $objOptionalClauses additional optional QQClause objects for this query
  512. * @return AuthorizeNetTransaction[]
  513. */
  514. public static function LoadArrayByTransactionId($strTransactionId, $objOptionalClauses = null) {
  515. // Call AuthorizeNetTransaction::QueryArray to perform the LoadArrayByTransactionId query
  516. try {
  517. return AuthorizeNetTransaction::QueryArray(
  518. QQ::Equal(QQN::AuthorizeNetTransaction()->TransactionId, $strTransactionId),
  519. $objOptionalClauses);
  520. } catch (QCallerException $objExc) {
  521. $objExc->IncrementOffset();
  522. throw $objExc;
  523. }
  524. }
  525. /**
  526. * Count AuthorizeNetTransactions
  527. * by TransactionId Index(es)
  528. * @param string $strTransactionId
  529. * @return int
  530. */
  531. public static function CountByTransactionId($strTransactionId) {
  532. // Call AuthorizeNetTransaction::QueryCount to perform the CountByTransactionId query
  533. return AuthorizeNetTransaction::QueryCount(
  534. QQ::Equal(QQN::AuthorizeNetTransaction()->TransactionId, $strTransactionId)
  535. );
  536. }
  537. /**
  538. * Load an array of AuthorizeNetTransaction objects,
  539. * by OrderId Index(es)
  540. * @param integer $intOrderId
  541. * @param QQClause[] $objOptionalClauses additional optional QQClause objects for this query
  542. * @return AuthorizeNetTransaction[]
  543. */
  544. public static function LoadArrayByOrderId($intOrderId, $objOptionalClauses = null) {
  545. // Call AuthorizeNetTransaction::QueryArray to perform the LoadArrayByOrderId query
  546. try {
  547. return AuthorizeNetTransaction::QueryArray(
  548. QQ::Equal(QQN::AuthorizeNetTransaction()->OrderId, $intOrderId),
  549. $objOptionalClauses);
  550. } catch (QCallerException $objExc) {
  551. $objExc->IncrementOffset();
  552. throw $objExc;
  553. }
  554. }
  555. /**
  556. * Count AuthorizeNetTransactions
  557. * by OrderId Index(es)
  558. * @param integer $intOrderId
  559. * @return int
  560. */
  561. public static function CountByOrderId($intOrderId) {
  562. // Call AuthorizeNetTransaction::QueryCount to perform the CountByOrderId query
  563. return AuthorizeNetTransaction::QueryCount(
  564. QQ::Equal(QQN::AuthorizeNetTransaction()->OrderId, $intOrderId)
  565. );
  566. }
  567. ////////////////////////////////////////////////////
  568. // INDEX-BASED LOAD METHODS (Array via Many to Many)
  569. ////////////////////////////////////////////////////
  570. //////////////////////////
  571. // SAVE, DELETE AND RELOAD
  572. //////////////////////////
  573. /**
  574. * Save this AuthorizeNetTransaction
  575. * @param bool $blnForceInsert
  576. * @param bool $blnForceUpdate
  577. * @return int
  578. */
  579. public function Save($blnForceInsert = false, $blnForceUpdate = false) {
  580. // Get the Database Object for this Class
  581. $objDatabase = AuthorizeNetTransaction::GetDatabase();
  582. $mixToReturn = null;
  583. try {
  584. if ((!$this->__blnRestored) || ($blnForceInsert)) {
  585. // Perform an INSERT query
  586. $objDatabase->NonQuery('
  587. INSERT INTO `authorize_net_transaction` (
  588. `order_id`,
  589. `response_code`,
  590. `response_subcode`,
  591. `response_reason_code`,
  592. `response_reason_text`,
  593. `authorization_code`,
  594. `transaction_id`,
  595. `transaction_type`,
  596. `amount`,
  597. `avs_response_code`,
  598. `ccv_response_code`,
  599. `cav_response_code`
  600. ) VALUES (
  601. ' . $objDatabase->SqlVariable($this->intOrderId) . ',
  602. ' . $objDatabase->SqlVariable($this->strResponseCode) . ',
  603. ' . $objDatabase->SqlVariable($this->strResponseSubcode) . ',
  604. ' . $objDatabase->SqlVariable($this->strResponseReasonCode) . ',
  605. ' . $objDatabase->SqlVariable($this->strResponseReasonText) . ',
  606. ' . $objDatabase->SqlVariable($this->strAuthorizationCode) . ',
  607. ' . $objDatabase->SqlVariable($this->strTransactionId) . ',
  608. ' . $objDatabase->SqlVariable($this->strTransactionType) . ',
  609. ' . $objDatabase->SqlVariable($this->fltAmount) . ',
  610. ' . $objDatabase->SqlVariable($this->strAvsResponseCode) . ',
  611. ' . $objDatabase->SqlVariable($this->strCcvResponseCode) . ',
  612. ' . $objDatabase->SqlVariable($this->strCavResponseCode) . '
  613. )
  614. ');
  615. // Update Identity column and return its value
  616. $mixToReturn = $this->intId = $objDatabase->InsertId('authorize_net_transaction', 'id');
  617. } else {
  618. // Perform an UPDATE query
  619. // First checking for Optimistic Locking constraints (if applicable)
  620. if (!$blnForceUpdate) {
  621. // Perform the Optimistic Locking check
  622. $objResult = $objDatabase->Query('
  623. SELECT
  624. `creation_date`
  625. FROM
  626. `authorize_net_transaction`
  627. WHERE
  628. `id` = ' . $objDatabase->SqlVariable($this->intId) . '
  629. ');
  630. $objRow = $objResult->FetchArray();
  631. if ($objRow[0] != $this->strCreationDate)
  632. throw new QOptimisticLockingException('AuthorizeNetTransaction');
  633. }
  634. // Perform the UPDATE query
  635. $objDatabase->NonQuery('
  636. UPDATE
  637. `authorize_net_transaction`
  638. SET
  639. `order_id` = ' . $objDatabase->SqlVariable($this->intOrderId) . ',
  640. `response_code` = ' . $objDatabase->SqlVariable($this->strResponseCode) . ',
  641. `response_subcode` = ' . $objDatabase->SqlVariable($this->strResponseSubcode) . ',
  642. `response_reason_code` = ' . $objDatabase->SqlVariable($this->strResponseReasonCode) . ',
  643. `response_reason_text` = ' . $objDatabase->SqlVariable($this->strResponseReasonText) . ',
  644. `authorization_code` = ' . $objDatabase->SqlVariable($this->strAuthorizationCode) . ',
  645. `transaction_id` = ' . $objDatabase->SqlVariable($this->strTransactionId) . ',
  646. `transaction_type` = ' . $objDatabase->SqlVariable($this->strTransactionType) . ',
  647. `amount` = ' . $objDatabase->SqlVariable($this->fltAmount) . ',
  648. `avs_response_code` = ' . $objDatabase->SqlVariable($this->strAvsResponseCode) . ',
  649. `ccv_response_code` = ' . $objDatabase->SqlVariable($this->strCcvResponseCode) . ',
  650. `cav_response_code` = ' . $objDatabase->SqlVariable($this->strCavResponseCode) . '
  651. WHERE
  652. `id` = ' . $objDatabase->SqlVariable($this->intId) . '
  653. ');
  654. }
  655. } catch (QCallerException $objExc) {
  656. $objExc->IncrementOffset();
  657. throw $objExc;
  658. }
  659. // Update __blnRestored and any Non-Identity PK Columns (if applicable)
  660. $this->__blnRestored = true;
  661. // Update Local Timestamp
  662. $objResult = $objDatabase->Query('
  663. SELECT
  664. `creation_date`
  665. FROM
  666. `authorize_net_transaction`
  667. WHERE
  668. `id` = ' . $objDatabase->SqlVariable($this->intId) . '
  669. ');
  670. $objRow = $objResult->FetchArray();
  671. $this->strCreationDate = $objRow[0];
  672. // Return
  673. return $mixToReturn;
  674. }
  675. /**
  676. * Delete this AuthorizeNetTransaction
  677. * @return void
  678. */
  679. public function Delete() {
  680. if ((is_null($this->intId)))
  681. throw new QUndefinedPrimaryKeyException('Cannot delete this AuthorizeNetTransaction with an unset primary key.');
  682. // Get the Database Object for this Class
  683. $objDatabase = AuthorizeNetTransaction::GetDatabase();
  684. // Perform the SQL Query
  685. $objDatabase->NonQuery('
  686. DELETE FROM
  687. `authorize_net_transaction`
  688. WHERE
  689. `id` = ' . $objDatabase->SqlVariable($this->intId) . '');
  690. }
  691. /**
  692. * Delete all AuthorizeNetTransactions
  693. * @return void
  694. */
  695. public static function DeleteAll() {
  696. // Get the Database Object for this Class
  697. $objDatabase = AuthorizeNetTransaction::GetDatabase();
  698. // Perform the Query
  699. $objDatabase->NonQuery('
  700. DELETE FROM
  701. `authorize_net_transaction`');
  702. }
  703. /**
  704. * Truncate authorize_net_transaction table
  705. * @return void
  706. */
  707. public static function Truncate() {
  708. // Get the Database Object for this Class
  709. $objDatabase = AuthorizeNetTransaction::GetDatabase();
  710. // Perform the Query
  711. $objDatabase->NonQuery('
  712. TRUNCATE `authorize_net_transaction`');
  713. }
  714. /**
  715. * Reload this AuthorizeNetTransaction from the database.
  716. * @return void
  717. */
  718. public function Reload() {
  719. // Make sure we are actually Restored from the database
  720. if (!$this->__blnRestored)
  721. throw new QCallerException('Cannot call Reload() on a new, unsaved AuthorizeNetTransaction object.');
  722. // Reload the Object
  723. $objReloaded = AuthorizeNetTransaction::Load($this->intId);
  724. // Update $this's local variables to match
  725. $this->OrderId = $objReloaded->OrderId;
  726. $this->strCreationDate = $objReloaded->strCreationDate;
  727. $this->strResponseCode = $objReloaded->strResponseCode;
  728. $this->strResponseSubcode = $objReloaded->strResponseSubcode;
  729. $this->strResponseReasonCode = $objReloaded->strResponseReasonCode;
  730. $this->strResponseReasonText = $objReloaded->strResponseReasonText;
  731. $this->strAuthorizationCode = $objReloaded->strAuthorizationCode;
  732. $this->strTransactionId = $objReloaded->strTransactionId;
  733. $this->strTransactionType = $objReloaded->strTransactionType;
  734. $this->fltAmount = $objReloaded->fltAmount;
  735. $this->strAvsResponseCode = $objReloaded->strAvsResponseCode;
  736. $this->strCcvResponseCode = $objReloaded->strCcvResponseCode;
  737. $this->strCavResponseCode = $objReloaded->strCavResponseCode;
  738. }
  739. ////////////////////
  740. // GETTORS AND SETTORS
  741. ////////////////////
  742. /**
  743. * Lookup a VirtualAttribute value (if applicable). Returns NULL if none found.
  744. * @param string $strName
  745. * @return string
  746. */
  747. public function GetVirtualAttribute($strName)
  748. {
  749. if (array_key_exists($strName, $this->__strVirtualAttributeArray))
  750. return $this->__strVirtualAttributeArray[$strName];
  751. return null;
  752. }
  753. /**
  754. * Override method to perform a property "Get"
  755. * This will get the value of $strName
  756. *
  757. * @param string $strName Name of the property to get
  758. * @return mixed
  759. */
  760. public function __get($strName)
  761. {
  762. switch ($strName)
  763. {
  764. ///////////////////
  765. // Member Variables
  766. ///////////////////
  767. case 'Id':
  768. /**
  769. * Gets the value for intId (Read-Only PK)
  770. * @return integer
  771. */
  772. return $this->intId;
  773. case 'OrderId':
  774. /**
  775. * Gets the value for intOrderId (Not Null)
  776. * @return integer
  777. */
  778. return $this->intOrderId;
  779. case 'CreationDate':
  780. /**
  781. * Gets the value for strCreationDate (Read-Only Timestamp)
  782. * @return string
  783. */
  784. return $this->strCreationDate;
  785. case 'ResponseCode':
  786. /**
  787. * Gets the value for strResponseCode
  788. * @return string
  789. */
  790. return $this->strResponseCode;
  791. case 'ResponseSubcode':
  792. /**
  793. * Gets the value for strResponseSubcode
  794. * @return string
  795. */
  796. return $this->strResponseSubcode;
  797. case 'ResponseReasonCode':
  798. /**
  799. * Gets the value for strResponseReasonCode
  800. * @return string
  801. */
  802. return $this->strResponseReasonCode;
  803. case 'ResponseReasonText':
  804. /**
  805. * Gets the value for strResponseReasonText
  806. * @return string
  807. */
  808. return $this->strResponseReasonText;
  809. case 'AuthorizationCode':
  810. /**
  811. * Gets the value for strAuthorizationCode
  812. * @return string
  813. */
  814. return $this->strAuthorizationCode;
  815. case 'TransactionId':
  816. /**
  817. * Gets the value for strTransactionId
  818. * @return string
  819. */
  820. return $this->strTransactionId;
  821. case 'TransactionType':
  822. /**
  823. * Gets the value for strTransactionType
  824. * @return string
  825. */
  826. return $this->strTransactionType;
  827. case 'Amount':
  828. /**
  829. * Gets the value for fltAmount
  830. * @return double
  831. */
  832. return $this->fltAmount;
  833. case 'AvsResponseCode':
  834. /**
  835. * Gets the value for strAvsResponseCode
  836. * @return string
  837. */
  838. return $this->strAvsResponseCode;
  839. case 'CcvResponseCode':
  840. /**
  841. * Gets the value for strCcvResponseCode
  842. * @return string
  843. */
  844. return $this->strCcvResponseCode;
  845. case 'CavResponseCode':
  846. /**
  847. * Gets the value for strCavResponseCode
  848. * @return string
  849. */
  850. return $this->strCavResponseCode;
  851. ///////////////////
  852. // Member Objects
  853. ///////////////////
  854. case 'Order':
  855. /**
  856. * Gets the value for the Order object referenced by intOrderId (Not Null)
  857. * @return Order
  858. */
  859. try {
  860. if ((!$this->objOrder) && (!is_null($this->intOrderId)))
  861. $this->objOrder = Order::Load($this->intOrderId);
  862. return $this->objOrder;
  863. } catch (QCallerException $objExc) {
  864. $objExc->IncrementOffset();
  865. throw $objExc;
  866. }
  867. ////////////////////////////
  868. // Virtual Object References (Many to Many and Reverse References)
  869. // (If restored via a "Many-to" expansion)
  870. ////////////////////////////
  871. case '__Restored':
  872. return $this->__blnRestored;
  873. default:
  874. try {
  875. return parent::__get($strName);
  876. } catch (QCallerException $objExc) {
  877. $objExc->IncrementOffset();
  878. throw $objExc;
  879. }
  880. }
  881. }
  882. /**
  883. * Override method to perform a property "Set"
  884. * This will set the property $strName to be $mixValue
  885. *
  886. * @param string $strName Name of the property to set
  887. * @param string $mixValue New value of the property
  888. * @return mixed
  889. */
  890. public function __set($strName, $mixValue) {
  891. switch ($strName) {
  892. ///////////////////
  893. // Member Variables
  894. ///////////////////
  895. case 'OrderId':
  896. /**
  897. * Sets the value for intOrderId (Not Null)
  898. * @param integer $mixValue
  899. * @return integer
  900. */
  901. try {
  902. $this->objOrder = null;
  903. return ($this->intOrderId = QType::Cast($mixValue, QType::Integer));
  904. } catch (QCallerException $objExc) {
  905. $objExc->IncrementOffset();
  906. throw $objExc;
  907. }
  908. case 'ResponseCode':
  909. /**
  910. * Sets the value for strResponseCode
  911. * @param string $mixValue
  912. * @return string
  913. */
  914. try {
  915. return ($this->strResponseCode = QType::Cast($mixValue, QType::String));
  916. } catch (QCallerException $objExc) {
  917. $objExc->IncrementOffset();
  918. throw $objExc;
  919. }
  920. case 'ResponseSubcode':
  921. /**
  922. * Sets the value for strResponseSubcode
  923. * @param string $mixValue
  924. * @return string
  925. */
  926. try {
  927. return ($this->strResponseSubcode = QType::Cast($mixValue, QType::String));
  928. } catch (QCallerException $objExc) {
  929. $objExc->IncrementOffset();
  930. throw $objExc;
  931. }
  932. case 'ResponseReasonCode':
  933. /**
  934. * Sets the value for strResponseReasonCode
  935. * @param string $mixValue
  936. * @return string
  937. */
  938. try {
  939. return ($this->strResponseReasonCode = QType::Cast($mixValue, QType::String));
  940. } catch (QCallerException $objExc) {
  941. $objExc->IncrementOffset();
  942. throw $objExc;
  943. }
  944. case 'ResponseReasonText':
  945. /**
  946. * Sets the value for strResponseReasonText
  947. * @param string $mixValue
  948. * @return string
  949. */
  950. try {
  951. return ($this->strResponseReasonText = QType::Cast($mixValue, QType::String));
  952. } catch (QCallerException $objExc) {
  953. $objExc->IncrementOffset();
  954. throw $objExc;
  955. }
  956. case 'AuthorizationCode':
  957. /**
  958. * Sets the value for strAuthorizationCode
  959. * @param string $mixValue
  960. * @return string
  961. */
  962. try {
  963. return ($this->strAuthorizationCode = QType::Cast($mixValue, QType::String));
  964. } catch (QCallerException $objExc) {
  965. $objExc->IncrementOffset();
  966. throw $objExc;
  967. }
  968. case 'TransactionId':
  969. /**
  970. * Sets the value for strTransactionId
  971. * @param string $mixValue
  972. * @return string
  973. */
  974. try {
  975. return ($this->strTransactionId = QType::Cast($mixValue, QType::String));
  976. } catch (QCallerException $objExc) {
  977. $objExc->IncrementOffset();
  978. throw $objExc;
  979. }
  980. case 'TransactionType':
  981. /**
  982. * Sets the value for strTransactionType
  983. * @param string $mixValue
  984. * @return string
  985. */
  986. try {
  987. return ($this->strTransactionType = QType::Cast($mixValue, QType::String));
  988. } catch (QCallerException $objExc) {
  989. $objExc->IncrementOffset();
  990. throw $objExc;
  991. }
  992. case 'Amount':
  993. /**
  994. * Sets the value for fltAmount
  995. * @param double $mixValue
  996. * @return double
  997. */
  998. try {
  999. return ($this->fltAmount = QType::Cast($mixValue, QType::Float));
  1000. } catch (QCallerException $objExc) {
  1001. $objExc->IncrementOffset();
  1002. throw $objExc;
  1003. }
  1004. case 'AvsResponseCode':
  1005. /**
  1006. * Sets the value for strAvsResponseCode
  1007. * @param string $mixValue
  1008. * @return string
  1009. */
  1010. try {
  1011. return ($this->strAvsResponseCode = QType::Cast($mixValue, QType::String));
  1012. } catch (QCallerException $objExc) {
  1013. $objExc->IncrementOffset();
  1014. throw $objExc;
  1015. }
  1016. case 'CcvResponseCode':
  1017. /**
  1018. * Sets the value for strCcvResponseCode
  1019. * @param string $mixValue
  1020. * @return string
  1021. */
  1022. try {
  1023. return ($this->strCcvResponseCode = QType::Cast($mixValue, QType::String));
  1024. } catch (QCallerException $objExc) {
  1025. $objExc->IncrementOffset();
  1026. throw $objExc;
  1027. }
  1028. case 'CavResponseCode':
  1029. /**
  1030. * Sets the value for strCavResponseCode
  1031. * @param string $mixValue
  1032. * @return string
  1033. */
  1034. try {
  1035. return ($this->strCavResponseCode = QType::Cast($mixValue, QType::String));
  1036. } catch (QCallerException $objExc) {
  1037. $objExc->IncrementOffset();
  1038. throw $objExc;
  1039. }
  1040. ///////////////////
  1041. // Member Objects
  1042. ///////////////////
  1043. case 'Order':
  1044. /**
  1045. * Sets the value for the Order object referenced by intOrderId (Not Null)
  1046. * @param Order $mixValue
  1047. * @return Order
  1048. */
  1049. if (is_null($mixValue)) {
  1050. $this->intOrderId = null;
  1051. $this->objOrder = null;
  1052. return null;
  1053. } else {
  1054. // Make sure $mixValue actually is a Order object
  1055. try {
  1056. $mixValue = QType::Cast($mixValue, 'Order');
  1057. } catch (QInvalidCastException $objExc) {
  1058. $objExc->IncrementOffset();
  1059. throw $objExc;
  1060. }
  1061. // Make sure $mixValue is a SAVED Order object
  1062. if (is_null($mixValue->Id))
  1063. throw new QCallerException('Unable to set an unsaved Order for this AuthorizeNetTransaction');
  1064. // Update Local Member Variables
  1065. $this->objOrder = $mixValue;
  1066. $this->intOrderId = $mixValue->Id;
  1067. // Return $mixValue
  1068. return $mixValue;
  1069. }
  1070. break;
  1071. default:
  1072. try {
  1073. return parent::__set($strName, $mixValue);
  1074. } catch (QCallerException $objExc) {
  1075. $objExc->IncrementOffset();
  1076. throw $objExc;
  1077. }
  1078. }
  1079. }
  1080. ///////////////////////////////
  1081. // ASSOCIATED OBJECTS' METHODS
  1082. ///////////////////////////////
  1083. }
  1084. /////////////////////////////////////
  1085. // ADDITIONAL CLASSES for QCODO QUERY
  1086. /////////////////////////////////////
  1087. class QQNodeAuthorizeNetTransaction extends QQNode {
  1088. protected $strTableName = 'authorize_net_transaction';
  1089. protected $strPrimaryKey = 'id';
  1090. protected $strClassName = 'AuthorizeNetTransaction';
  1091. public function __get($strName) {
  1092. switch ($strName) {
  1093. case 'Id':
  1094. return new QQNode('id', 'Id', 'integer', $this);
  1095. case 'OrderId':
  1096. return new QQNode('order_id', 'OrderId', 'integer', $this);
  1097. case 'Order':
  1098. return new QQNodeOrder('order_id', 'Order', 'integer', $this);
  1099. case 'CreationDate':
  1100. return new QQNode('creation_date', 'CreationDate', 'string', $this);
  1101. case 'ResponseCode':
  1102. return new QQNode('response_code', 'ResponseCode', 'string', $this);
  1103. case 'ResponseSubcode':
  1104. return new QQNode('response_subcode', 'ResponseSubcode', 'string', $this);
  1105. case 'ResponseReasonCode':
  1106. return new QQNode('response_reason_code', 'ResponseReasonCode', 'string', $this);
  1107. case 'ResponseReasonText':
  1108. return new QQNode('response_reason_text', 'ResponseReasonText', 'string', $this);
  1109. case 'AuthorizationCode':
  1110. return new QQNode('authorization_code', 'AuthorizationCode', 'string', $this);
  1111. case 'TransactionId':
  1112. return new QQNode('transaction_id', 'TransactionId', 'string', $this);
  1113. case 'TransactionType':
  1114. return new QQNode('transaction_type', 'TransactionType', 'string', $this);
  1115. case 'Amount':
  1116. return new QQNode('amount', 'Amount', 'double', $this);
  1117. case 'AvsResponseCode':
  1118. return new QQNode('avs_response_code', 'AvsResponseCode', 'string', $this);
  1119. case 'CcvResponseCode':
  1120. return new QQNode('ccv_response_code', 'CcvResponseCode', 'string', $this);
  1121. case 'CavResponseCode':
  1122. return new QQNode('cav_response_code', 'CavResponseCode', 'string', $this);
  1123. case '_PrimaryKeyNode':
  1124. return new QQNode('id', 'Id', 'integer', $this);
  1125. default:
  1126. try {
  1127. return parent::__get($strName);
  1128. } catch (QCallerException $objExc) {
  1129. $objExc->IncrementOffset();
  1130. throw $objExc;
  1131. }
  1132. }
  1133. }
  1134. }
  1135. class QQReverseReferenceNodeAuthorizeNetTransaction extends QQReverseReferenceNode {
  1136. protected $strTableName = 'authorize_net_transaction';
  1137. protected $strPrimaryKey = 'id';
  1138. protected $strClassName = 'AuthorizeNetTransaction';
  1139. public function __get($strName) {
  1140. switch ($strName) {
  1141. case 'Id':
  1142. return new QQNode('id', 'Id', 'integer', $this);
  1143. case 'OrderId':
  1144. return new QQNode('order_id', 'OrderId', 'integer', $this);
  1145. case 'Order':
  1146. return new QQNodeOrder('order_id', 'Order', 'integer', $this);
  1147. case 'CreationDate':
  1148. return new QQNode('creation_date', 'CreationDate', 'string', $this);
  1149. case 'ResponseCode':
  1150. return new QQNode('response_code', 'ResponseCode', 'string', $this);
  1151. case 'ResponseSubcode':
  1152. return new QQNode('response_subcode', 'ResponseSubcode', 'string', $this);
  1153. case 'ResponseReasonCode':
  1154. return new QQNode('response_reason_code', 'ResponseReasonCode', 'string', $this);
  1155. case 'ResponseReasonText':
  1156. return new QQNode('response_reason_text', 'ResponseReasonText', 'string', $this);
  1157. case 'AuthorizationCode':
  1158. return new QQNode('authorization_code', 'AuthorizationCode', 'string', $this);
  1159. case 'TransactionId':
  1160. return new QQNode('transaction_id', 'TransactionId', 'string', $this);
  1161. case 'TransactionType':
  1162. return new QQNode('transaction_type', 'TransactionType', 'string', $this);
  1163. case 'Amount':
  1164. return new QQNode('amount', 'Amount', 'double', $this);
  1165. case 'AvsResponseCode':
  1166. return new QQNode('avs_response_code', 'AvsResponseCode', 'string', $this);
  1167. case 'CcvResponseCode':
  1168. return new QQNode('ccv_response_code', 'CcvResponseCode', 'string', $this);
  1169. case 'CavResponseCode':
  1170. return new QQNode('cav_response_code', 'CavResponseCode', 'string', $this);
  1171. case '_PrimaryKeyNode':
  1172. return new QQNode('id', 'Id', 'integer', $this);
  1173. default:
  1174. try {
  1175. return parent::__get($strName);
  1176. } catch (QCallerException $objExc) {
  1177. $objExc->IncrementOffset();
  1178. throw $objExc;
  1179. }
  1180. }
  1181. }
  1182. }
  1183. ?>