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 }
* ccreceipt_responsecode [STRING] According to Moneris: Transaction Response Code < 50: Transaction approved >= 50: Transaction declined NULL: Transaction was not sent for authorization * If you would like further details on the response codes that are returned please see the Response Codes document available at https://www3.moneris.com/connect/en/documents/index.html * ccreceipt_message [STRING] According to Moneris: Response description returned from issuing institution. Major types: APPROVED, DECLINED, CALL FOR, and HOLD CARD * ccreceipt_moddate [DATE] The timestamp of when the receipt was created (or modified... but preferably no modifications are made). * cctransaction_id [INTEGER] The unique identifier of a CC transaction to associate with this Moneris receipt. */ $Receipt = new RowManager_ReceiptManager(); $Receipt->dropTable(); $Receipt->createTable(); /* * ActiveRule Table * * Used to determine whether the associated (volume) price rule has been triggered. Also keeps track of whether balance-owing recalculation has been executed yet. * * pricerules_id [INTEGER] Unique identifier of the associated price rule. * is_active [INTEGER] Indicates whether the (volume) price rule has already been made active or not. * is_recalculated [INTEGER] This is a flag indicating whether a balance-owing recalculation has been run yet with the 'is_active' flag being in its current state. */ $ActiveRule = new RowManager_ActiveRuleManager(); $ActiveRule->dropTable(); $ActiveRule->createTable(); /*[RAD_DAOBJ_TABLE]*/
private function deleteAssociatedRegRecords($reg_id) { // delete any CC transactions linked to the registration record $ccTrans = new RowManager_CreditCardTransactionManager(); $ccTrans->setRegID($reg_id); $ccTransList = $ccTrans->getListIterator(); $ccTransArray = $ccTransList->getDataList(); reset($ccTransArray); foreach (array_keys($ccTransArray) as $k) { $record = current($ccTransArray); $ccTransID = $record['cctransaction_id']; // delete any CC transaction receipts linked to the registration record $ccReceipt = new RowManager_ReceiptManager($ccTransID); $ccReceipt->deleteEntry(); // delete CC trans record now that we know CC trans. ID $deleteCCtrans = new RowManager_CreditCardTransactionManager($ccTransID); $deleteCCtrans->deleteEntry(); next($ccTransArray); } // delete any cash transactions linked to the registration record $cashTrans = new RowManager_CashTransactionManager(); $cashTrans->setRegID($reg_id); $cashTransList = $cashTrans->getListIterator(); $cashTransArray = $cashTransList->getDataList(); reset($cashTransArray); foreach (array_keys($cashTransArray) as $k) { $record = current($cashTransArray); $cashTransID = $record['cashtransaction_id']; // delete cash trans record now that we know cash trans. ID $deleteCashTrans = new RowManager_CashTransactionManager($cashTransID); $deleteCashTrans->deleteEntry(); next($cashTransArray); } // delete any scholarships linked to the registration record $scholarship = new RowManager_ScholarshipAssignmentManager(); $scholarship->setRegID($reg_id); $scholarshipList = $scholarship->getListIterator(); $scholarshipArray = $scholarshipList->getDataList(); reset($scholarshipArray); foreach (array_keys($scholarshipArray) as $k) { $record = current($scholarshipArray); $scholarshipID = $record['scholarship_id']; // delete cash trans record now that we know scholarship ID $deleteScholarship = new RowManager_ScholarshipAssignmentManager($scholarshipID); $deleteScholarship->deleteEntry(); next($scholarshipArray); } // delete any field values linked to the registration record $fieldValues = new RowManager_FieldValueManager(); $fieldValues->setRegID($reg_id); $fieldValuesList = $fieldValues->getListIterator(); $fieldValuesArray = $fieldValuesList->getDataList(); reset($fieldValuesArray); foreach (array_keys($fieldValuesArray) as $k) { $record = current($fieldValuesArray); $fieldValueID = $record['fieldvalues_id']; // delete cash trans record now that we know field value ID $deleteFieldValue = new RowManager_FieldValueManager($fieldValueID); $deleteFieldValue->deleteEntry(); next($fieldValuesArray); } }