protected function storeReceiptInDB($ccTransID, $msg, $timeStamp) { $originalResponse = $msg->getMpgResponseData(); // echo "RESPONSE DATA <PRE>".print_r($originalResponse,true)."</PRE>"; $receiptManager = new RowManager_ReceiptManager(); $receiptManager->setCCtransID($ccTransID); // get data fields and populate with response data $responseData = array(); $tableFields = $receiptManager->getFields(); // echo "<pre>".print_r($tableFields ,true)."</pre>"; $idx = 0; reset($tableFields); foreach (array_keys($tableFields) as $k) { $field = current($tableFields); // get receipt table column name // echo "field = ".$field; $responseKey = $this->creditProcessor->getReceiptKey($field); // get Moneris response array key mapped to receipt table column if (isset($responseKey)) { // echo "response key = ".$responseKey; // use table column name as key to data in original response (as mapped to column via constant array) if ($field == 'ccreceipt_moddate') { // $timestamp = explode('|',CreditCardProcessor::TRANSACTION_TIMESTAMP); // if (isset($originalResponse[$timestamp[0]])&&($originalResponse[$timestamp[0]]!=null)&& // (isset($originalResponse[$timestamp[1]]))&&($originalResponse[$timestamp[1]]!=null)) // { // $t_date = $originalResponse[$timestamp[0]]; // $t_time = $originalResponse[$timestamp[1]]; $responseData[$field] = $timeStamp; //$t_date.' '.$t_time; // } } else { if (isset($originalResponse[$responseKey]) && $originalResponse[$responseKey] != null) { $responseData[$field] = $originalResponse[$responseKey]; } else { $responseData[$field] = '-1'; // if a response code is not available, set to -1 } } } next($tableFields); $idx++; } $responseData['cctransaction_id'] = $ccTransID; // LOAD DATA INTO cim_reg_ccreceipt TABLE $receiptManager->loadFromArray($responseData); // echo "responseData: <pre>".print_r($responseData ,true)."</pre>"; // Save the values into the Table. // if (!$receiptManager->isLoaded()) { // DISABLED BECAUSE MUST SET PRIMARY KEY MANUALLY ==> isLoaded() is set to TRUE by code $receiptManager->createNewEntry(true); // } // do NOT update any receipt rows }