private function _executeSchemeForDealer(\Akzo\Scheme\ExecData $execData, \Akzo\Dealer $dealer, $executionDataType, $dealerGroupedByCreditCode = true, $cumulatedResult = array())
 {
     // Use dealer code or dealer credit code based on what to collate by
     if ($dealerGroupedByCreditCode) {
         $dealerCode = $dealer->credit_code;
     } else {
         $dealerCode = $dealer->code;
     }
     // Generate the execution Json for this dealer
     $filledExecData = $execData->toRuleEngineDealerExecData($dealer, $executionDataType, 'json');
     // Placeholders populated into the JSON
     file_put_contents(getcwd() . '/logs/executeScheme/' . $execData->sid . '-' . $dealerCode . '-' . $executionDataType . '-execute.log', $filledExecData);
     // Execute the scheme using the rule engine
     $ruleService = new \Akzo\Scheme\RemoteRuleService();
     $result = json_decode($ruleService->executeScheme($execData->sid, $filledExecData), true);
     // Log Execution result
     file_put_contents(getcwd() . '/logs/executeScheme/' . $execData->sid . '-' . $dealerCode . '-' . $executionDataType . '-result.log', json_encode($result));
     // Marshall the current result and update the cumulated result
     $res = $this->_collateExecutionResults($result, $cumulatedResult, $dealerCode);
     return $res;
 }
Exemple #2
0
 private function _deleteSchemeRule($code, \Akzo\Scheme $scheme)
 {
     if (self::$remoteRuleApiEnabled) {
         $ruleService = new \Akzo\Scheme\RemoteRuleService();
         $ruleService->deleteScheme($code);
     }
     return true;
 }