static public function logAPI ($api, $request, $response, $request_data, $response_data) { $uid = 0; $log = new payone_ApiLogs(); $data = array( 'user_id' => $uid, 'api' => $api, 'request' => $request, 'response' => $response, 'request_data' => serialize($request_data), 'response_data' => serialize($response_data) ); try { // $stm->execute(array ($uid, $api, $request, $response, serialize ($request_data), serialize ($response_data))); $log->insert($data); } catch (Exception $e) { return 0; } return Shopware()->Db()->lastInsertId(); }
public function loadFormDataAction() { Shopware()->Plugins()->Controller()->ViewRenderer()->setNoRender(); new Enlight_Loader(); $log = new payone_ApiLogs(); try { $id = $this->Request()->getParam('id'); $result = $log->fetchRow( $log->select()->columns(array ('request_data', 'response_data'))->where('id=?', $id) ); } catch (Exception $e) { } $result['request_data'] = unserialize($result['request_data']); $result['response_data'] = unserialize($result['response_data']); $html = '<style type="text/css">'; $html .= '.zeile0{background-color:#D6E4F5;}'; $html .= '.zeile1{background-color:#C2D6F1;}'; $html .= '.container{font-family:Verdana;font-size:12px;}'; $html .= '</style>'; // Request $html .= '<div class="container" style="padding:10px;">'; $html .= '<table style="float:left; margin-right:100px;">'; $html .= "<tr>"; $html .= '<th colspan=2>Request</th>'; $html .= "</tr>"; $i = 0; foreach ($result['request_data'] as $key => $val) { $html .= "<tr>"; $html .= '<td style="padding:5px;" class="zeile' . ($i % 2 ) . '">' . $key . '</td>'; $html .= '<td style="padding:5px;" class="zeile' . ($i % 2 ) . '">' . $val . '</td>'; $html .= "</tr>"; $i++; } $html .= "</table>"; // Response $html .= '<table style="float:left;">'; $html .= "<tr>"; $html .= '<th colspan=2>Response</th>'; $html .= "</tr>"; $i = 0; foreach ($result['response_data'] as $key => $val) { $html .= "<tr>"; $html .= '<td style="padding:5px;" class="zeile' . ($i % 2 ) . '">' . $key . '</td>'; $html .= '<td style="padding:5px;" class="zeile' . ($i % 2 ) . '">' . $val . '</td>'; $html .= "</tr>"; $i++; } $html .= "</table>"; $html .= "</div>"; echo $html; exit; }