Пример #1
0
        echo product_image_url($product['image']);
        ?>
" title="<?php 
        echo $product['name'];
        ?>
" alt="<?php 
        echo $product['name'];
        ?>
"> 
            		</a>
            		<p><?php 
        echo $product['name'];
        ?>
</p>
            		<p><?php 
        echo currencies_format($product['price']);
        ?>
 </p>
                <td>
                	<textarea id="comments[<?php 
        echo $product['products_id'];
        ?>
]" rows="5" cols="20" name="comments[<?php 
        echo $product['products_id'];
        ?>
]"><?php 
        echo $product['comments'];
        ?>
</textarea>
                </td>
                <td width="96" class="visible-desktop"><?php 
 function callback()
 {
     $post_string = 'cmd=_notify-validate&';
     foreach ($_POST as $key => $value) {
         $post_string .= $key . '=' . urlencode($value) . '&';
     }
     $post_string = substr($post_string, 0, -1);
     $this->transaction_response = $this->send_transaction_to_gateway($this->form_action_url, $post_string);
     if (strtoupper(trim($this->transaction_response)) == 'VERIFIED') {
         $invoice = $this->input->post('invoice');
         if (isset($invoice) && is_numeric($invoice) && $invoice > 0) {
             $this->ci->load->library('order');
             $this->ci->load->model('order_model');
             $order_total = $this->order_model->get_order_total($invoice);
             if ($order_total !== NULL) {
                 $payment_status = $this->input->post('payment_status');
                 $payer_status = $this->input->post('payer_status');
                 $mc_gross = $this->input->post('mc_gross');
                 $currency = $this->input->post('mc_currency');
                 $pending_reason = $this->input->post('pending_reason');
                 $reason_code = $this->input->post('reason_code');
                 $order_info = $this->ci->order_model->query($invoice);
                 $comment = $payment_status . ' (' . ucfirst($payer_status) . '; ' . currencies_format($mc_gross, FALSE, $currency) . ')';
                 if ($payment_status == 'Pending') {
                     $comment .= '; ' . $pending_reason;
                 } elseif ($payment_status == 'Reversed' || $payment_status == 'Refunded') {
                     $comment .= '; ' . $reason_code;
                 }
                 if ($mc_gross != number_format($order_total * $order_info['currency_value'], $this->ci->currencies->get_decimal_places($order_info['currency']))) {
                     $comment .= '; PayPal transaction value (' . $mc_gross . ') does not match order value (' . number_format($order_total * $order_info['currency_value'], $this->ci->currencies->get_decimal_places($order_info['currency'])) . ')';
                 }
                 $comments = 'PayPal IPN Verified [' . $comment . ']';
                 $this->ci->order->process($invoice, $this->order_status, $comments);
             }
         }
     } else {
         if (isset($this->config['MODULE_PAYMENT_PAYPAL_STANDARD_DEBUG_EMAIL'])) {
             $email_body = 'PAYPAL_STANDARD_DEBUG_POST_DATA:' . "\n\n";
             $posts = $this->input->post();
             foreach ($posts as $key => $value) {
                 $email_body .= $key . '=' . $value . "\n";
             }
             $email_body .= "\n" . 'PAYPAL_STANDARD_DEBUG_GET_DATA:' . "\n\n";
             $gets = $this->input->post();
             foreach ($gets as $key => $value) {
                 $email_body .= $key . '=' . $value . "\n";
             }
             //osc_email('', MODULE_PAYMENT_PAYPAL_STANDARD_DEBUG_EMAIL, 'PayPal IPN Invalid Process', $email_body, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);
         }
         $payment_status = $this->input->post('payment_status');
         $payer_status = $this->input->post('payer_status');
         $mc_gross = $this->input->post('mc_gross');
         $currency = $this->input->post('mc_currency');
         $pending_reason = $this->input->post('pending_reason');
         $reason_code = $this->input->post('reason_code');
         $order_info = $this->ci->order_model->query($invoice);
         if (isset($invoice) && is_numeric($invoice) && $invoice > 0) {
             if ($order_info !== NULL) {
                 $comment = $payment_status;
                 if ($payment_status == 'Pending') {
                     $comment .= '; ' . $pending_reason;
                 } elseif ($payment_status == 'Reversed' || $payment_status == 'Refunded') {
                     $comment .= '; ' . $reason_code;
                 }
                 $comments = 'PayPal IPN Invalid [' . $comment . ']';
                 $this->ci->order->insert_order_status_history($invoice, $this->order_status, $comments);
             }
         }
     }
 }