function rcl_add_payment_order($pay) { if ($pay->pay_type != 2) { return false; } rcl_payment_order($pay->pay_id); }
function rcl_pay_order_private_account() { global $user_ID, $wpdb, $rmag_options, $order; $order_id = intval($_POST['idorder']); if (!$order_id || !$user_ID) { $log['otvet'] = 1; echo json_encode($log); exit; } $order = rcl_get_order($order_id); //rcl_setup_orderdata($order); $oldusercount = rcl_get_user_money(); if (!$oldusercount) { $log['otvet'] = 1; $log['recall'] = $order->order_price; echo json_encode($log); exit; } //print_r($order); $newusercount = $oldusercount - $order->order_price; if ($newusercount < 0) { $log['otvet'] = 1; $log['recall'] = $order->order_price; echo json_encode($log); exit; } rcl_update_user_money($newusercount); $result = rcl_update_status_order($order_id, 2); if (!$result) { $log['otvet'] = 1; $log['recall'] = 'Ошибка запроса!'; echo json_encode($log); exit; } rcl_payment_order($order_id, $user_ID); do_action('payment_rcl', $user_ID, $order->order_price, $order_id, 2); $text = "<p>Ваш заказ успешно оплачен! Соответствующее уведомление было выслано администрации сервиса.</p>"; $text = apply_filters('payment_order_text', $text); $log['recall'] = "<div style='clear: both;color:green;font-weight:bold;padding:10px; border:2px solid green;'>" . $text . "</div>"; $log['count'] = $newusercount; $log['idorder'] = $order_id; $log['otvet'] = 100; echo json_encode($log); exit; }