use_class('payone_invoice');
 $class_payone = new payone();
 $invoice_order_type = substr($source, 0, 1);
 $invoice = new payone_invoice('invoice_order_type', $invoice_order_type, 'invoice_order_id=' . $order_id);
 if (isset($invoice->detail['invoice_id']) && $invoice->detail['invoice_id'] != '') {
     $month = date('n');
     $yearnow = date('Y');
     $yearbefore = $yearnow - 1;
     $pmilink = 'https://pmi.pay1.de/merchants/txmanager.popup.php?navi=&ebene=1&operation=1&b_id=&u_id=&sort_col=&sort_order=&e_operation=0&userid=';
     $pmilink .= '&plusminus%5B1%5D=%5Bweitere_Filterbedingung%5D&list_pos=0&search_kat%5B1%5D=buchungsid';
     $pmilink .= '&field%5B1%5D=' . $invoice->detail['payone_txid'];
     $pmilink .= '&startday=1&startmonth=' . $month . '&startyear=' . $yearbefore;
     $pmilink .= '&endday=' . date('j') . '&endmonth=' . $month . '&endyear=' . $yearnow;
     $pmilink .= '&selectedRadioMode=live';
     //$txid = ($invoice->detail['payone_txid']=='') ? '<span class="red">Not connected yet</span>' : '<a href="'.$pmilink.'" class="view_webpage" title="'.$sop_mouse_over['payone_link'].'">'.$invoice->detail['payone_txid'].'</a>';
     $txid = $invoice->detail['payone_txid'] == '' ? '<span class="red">Not connected yet</span>' : payoneWebLink($invoice->detail['payone_txid'], $sop_mouse_over['payone_link']);
     $content .= '<div><table border="0" cellpadding="0" cellspacing="0">';
     $content .= '<tr><td style="width:120px;">Payone TXID</td><td>:</td><td style="width:122px;">' . $txid . '</td></tr>';
     $content .= '<tr><td>Manobo Invoice ID</td><td>:</td><td>' . $invoice->detail['invoice_id'] . '</td></tr>';
     $content .= '</table></div>';
     $open_balance = $invoice->getBalance();
     $content .= '<div style="margin-top:10px;">';
     if ($open_balance == 0) {
         $content .= '<h3 class="green">Invoice is Closed <span class="notice" style="font-weight:normal;">(No Open Payment/Refund)</span></h3>';
     } elseif ($open_balance > 0) {
         $content .= '<h3 class="red">Open Amount: ' . displayCurrency($order_currency, $open_balance) . '</h3>';
     } else {
         $content .= '<h3 class="red">Open Refund: ' . displayCurrency($order_currency, abs($open_balance)) . '</h3>';
     }
     $content .= '</div>';
 } else {
Exemplo n.º 2
0
 function retrieveDetail($id)
 {
     $l = $this->retrieveDetailData($id);
     $request = unserialize($l['log_process_data_submit']);
     $response = strlen($l['log_process_data_result']) <= 4 ? $l['log_process_data_result'] : unserialize($l['log_process_data_result']);
     $txid = isset($request['txid']) && $request['txid'] != '' ? 'TXID ' . $request['txid'] : '<span class="notice">No TXID</span>';
     $log_time = date('d.m.y H:i:s', strtotime($l['log_process_time']));
     $log_process = '<span class="' . ($l['log_process'] == 'S' ? 'green">Submit' : 'blue">Receive') . '</span>';
     $mode = '<span class="' . (strtolower($request['mode']) == 'live' ? 'bold' : '') . '">' . $request['mode'] . '</span>';
     $status = $response == "TSOK" || $response['status'] == "TSOK" || $response['status'] == 'APPROVED' || $response['status'] == 'REDIRECT' ? '<span class="green">OK</span>' : '<span class="green">ERROR</span>';
     $result = '<h3 class="box ui-corner-all" style="margin-bottom:20px;">' . $txid . ' &sdot; ' . $log_time . ' &sdot; ' . $log_process . ' &sdot; ' . $l['log_process_method'] . ' &sdot; ' . $mode . ' &sdot; ' . $status . '</h3>';
     $logdata = '<div style="float:left;width:400px;border-right:4px solid #efefef;">';
     $logdata .= '<h3>Request</h3>';
     if (is_array($request)) {
         $logdata .= '<div><table border="0" cellpadding="0" cellspacing="0">';
         foreach ($request as $param => $value) {
             if ($param == 'txid' || $param == 'invoiceid') {
                 global $server;
                 use_class('payone_invoice');
                 if ($param == 'txid') {
                     $payi = new payone_invoice('payone_txid', $value);
                 } elseif ($param == 'invoiceid') {
                     $payi = new payone_invoice('invoice_no', $value);
                 }
                 $link_order = "{$server}/?open=customer-care-order-detail&amp;source=" . ($payi->detail['invoice_order_type'] == 'S' ? 'SP' : 'JG') . '&id=' . $payi->detail['invoice_order_id'];
                 $link_order = 'Click <a target="_blank" href="http://' . $link_order . '">here</a> to open Order Detail';
             }
             if (is_array($value)) {
                 foreach ($value as $vkey => $vval) {
                     $logdata .= '<tr><td>' . $param . '[' . $vkey . ']</td><td>' . $vval . '</td></tr>';
                 }
             } else {
                 $logdata .= '<tr><td>' . $param . '</td><td>' . $value . '</td></tr>';
             }
         }
         $logdata .= '</table></div>';
     } else {
         $logdata .= $request == '' ? '<em>BLANK</em>' : $request;
     }
     $logdata .= '</div>';
     $logdata .= '<div style="margin-left:420px;">';
     $logdata .= '<h3>Response</h3>';
     if (is_array($response)) {
         $logdata .= '<div><table border="0" cellpadding="0" cellspacing="0">';
         foreach ($response as $param => $value) {
             if (is_array($value)) {
                 foreach ($value as $vkey => $vval) {
                     $logdata .= '<tr><td>' . $param . '[' . $vkey . ']</td><td>' . $vval . '</td></tr>';
                 }
             } else {
                 $logdata .= '<tr><td>' . $param . '</td><td>' . $value . '</td></tr>';
             }
         }
         $logdata .= '</table></div>';
     } else {
         $logdata .= $response == '' ? '<em>BLANK</em>' : $response;
     }
     $logdata .= '</div>';
     if ($link_order != '') {
         $logdata = '<h3>' . $link_order . "</h3>" . $logdata;
     }
     $result .= $logdata;
     //Check unsent refund
     $payone_log_group = array('1', '39');
     global $session_userinfo;
     if (isset($payi->detail['invoice_id']) && $payi->detail['invoice_id'] != '' && in_array($session_userinfo['group'], $payone_log_group)) {
         $invoice_id = $payi->detail['invoice_id'];
         $result .= '<div style="clear:both;"></div><br/><br/>';
         $result .= '<div class="sop-box"><h3 class="red">Please more carefull to update below data, make sure all updates are correct based on problem analysis!<br/></h3>
             <br/><span>Please use also this <a target="_blank" href="https://docs.google.com/spreadsheet/ccc?key=0ArXESovGbTYcdF9RZ19xaUxFV2E2UjFNY2hzQzRsUVE&usp=drive_web#gid=0">Payone Error Guidance</a> for helping solving problems</span>
             </div><br/>';
         $result .= '<div class="float-left w400">';
         $result .= '<h3>Invoice Data</h3>';
         $result .= '<input type="hidden" id="invoice-id" value="' . $payi->detail['invoice_id'] . '"/>';
         $result .= '<table>';
         $result .= '<tr><td>Invoice Date</td><td>' . date('d-m-Y', strtotime($payi->detail['invoice_date'])) . '</td></tr>';
         $result .= '<tr><td>txid</td><td>' . payoneWebLink($payi->detail['payone_txid']) . '</td></tr>';
         $input_title = 'title="press enter to update this value"';
         $pi_input_text = array('Invoice Amount' => 'invoice_amount', 'Amount Paid' => 'invoice_amount_paid', 'Amount Cancelled' => 'invoice_amount_canceled', 'Amount Fines' => 'invoice_amount_fines', 'Amount Fines Cancelled' => 'invoice_amount_fines_canceled', 'Amount Refund' => 'invoice_amount_overpayment', 'Amount Refund Cancelled' => 'invoice_amount_overpayment_canceled', 'Payone Saldo' => 'payone_saldo', 'Sequence Number' => 'sequencenumber');
         foreach ($pi_input_text as $k => $v) {
             $result .= '<tr><td>' . $k . '</td><td><input name="' . $v . '" type="text" ' . $input_title . ' value="' . $payi->detail[$v] . '"/></td></tr>';
         }
         $status_desc = "<h3>Invoice Status</h3>";
         foreach (payone_invoice_status() as $ps => $pd) {
             $status_desc .= "{$ps}: {$pd}<br/>";
         }
         $result .= '<tr><td>Status<span class="ui-icon ui-icon-info help" style="float:right;" title="' . $status_desc . '"></span></td><td><input name="invoice_complete_status" type="text" ' . $input_title . ' value="' . $payi->detail['invoice_complete_status'] . '"/></td></tr>';
         $result .= '</table></div>';
         $dbq = tep_db_query("SELECT * FROM payone_orders_return WHERE invoice_id = {$invoice_id} AND status = 0");
         if (tep_db_num_rows($dbq) > 0) {
             $table = array();
             $t = array();
             $t['d'] = 'Created';
             $t['e'] = 'id';
             $t['sp'] = 'pr';
             $t['q'] = 'no';
             $t['id1'] = 'de';
             $t['s'] = 'va';
             $t['id2'] = 'Action';
             $table[] = $t;
             $btn_12 = '<input class="cancel" type="button" value="C12" title="Cancel this return value"/>';
             $btn_13 = '<input class="cancel" type="button" value="C13" title="Stop sending this return to payone becuase we have processed/will process it manually"/>';
             while ($r = tep_db_fetch_array($dbq)) {
                 $input_hid = '<input id="' . $r['pkey_id'] . '" type="hidden" value="' . $r['pkey_id'] . '"/>';
                 $t['d'] = date('d-m-Y H:i:s', strtotime($r['created_date']));
                 $t['e'] = $r['id'];
                 $t['sp'] = displayCurrency($r['currency'], $r['pr'] / 100);
                 $t['q'] = $r['no'];
                 $t['id1'] = $r['de'];
                 $t['s'] = $r['va'];
                 $t['id2'] = $input_hid . $btn_12 . $btn_13;
                 $table[] = $t;
             }
             $result .= '<div>';
             $result .= '<h3>Queued Refund</h3>';
             $result .= tep_draw_table('spo', $table);
             $result .= '</div>';
         }
     }
     return $result;
 }
    $message = 'Please check payone log ID:' . '<br />' . "\n";
    foreach ($log_ids as $id => $log) {
        $pmi_link = '';
        $txid = '';
        if (strlen($log['log_process_data_result']) <= 4) {
            $result = $log['log_process_data_result'];
        } else {
            $result_array = unserialize($log['log_process_data_result']);
            $submit_array = unserialize($log['log_process_data_submit']);
            $result = $result_array['errormessage'];
            if (isset($result_array['txid'])) {
                $txid = $result_array['txid'];
            } elseif (isset($submit_array['txid'])) {
                $txid = $submit_array['txid'];
            }
            if ($txid != '') {
                $pmi_link = ' (txid: ' . payoneWebLink($txid) . ')';
            }
        }
        $ldata = array();
        $ldata[] = '<a href="' . $server_name . '/?open=payone-logger&id=' . $id . '" target="_blank">' . $id . '</a>';
        $ldata[] = $log['log_process'];
        $ldata[] = $log['log_process_method'];
        $ldata[] = $result;
        $message .= '- ' . implode(', ', $ldata) . $pmi_link . '<br />' . "\n";
    }
    tep_mail(EMAIL_NAME_DEBUGR, EMAIL_ADDRESS_DEBUGR, $subjet, $message, FROM_EMAIL_NAME, FROM_EMAIL_ADDRESS, false);
    $class_plog->updateErrorsNotification($log_ids);
}
echo '<h3>' . count($log_ids) . ' Errors Found on ' . date('d.m.Y') . '</h3>';
tep_db_close();