/**
  * Process payment result
  *
  * @access public
  * @return void
  */
 public static function process_result()
 {
     if (!empty($_GET['success']) && !empty($_GET['user_id']) && !empty($_GET['payment_type']) && !empty($_GET['object_id'])) {
         if ($_GET['success'] == 'true') {
             $post = get_post($_GET['object_id']);
             switch ($_GET['payment_type']) {
                 case 'pay_for_featured':
                     update_post_meta($post->ID, REALIA_PROPERTY_PREFIX . 'featured', 'on');
                     $_SESSION['messages'][] = array('success', __('Property has been featured.', 'realia'));
                     break;
                 case 'pay_for_sticky':
                     update_post_meta($post->ID, REALIA_PROPERTY_PREFIX . 'sticky', 'on');
                     $_SESSION['messages'][] = array('success', __('Property has been sticked.', 'realia'));
                     break;
                 case 'pay_per_post':
                     $review_before = get_theme_mod('realia_submission_review_before', false);
                     if (!$review_before) {
                         wp_publish_post($post->ID);
                         $_SESSION['messages'][] = array('success', __('Property has been published.', 'realia'));
                     } else {
                         $_SESSION['messages'][] = array('success', __('Property will be published after review.', 'realia'));
                     }
                     break;
                 case 'package':
                     Realia_Packages::set_package_for_user(get_current_user_id(), $post->ID);
                     $_SESSION['messages'][] = array('success', __('Package has been upgraded.', 'realia'));
                     break;
                 default:
                     $_SESSION['messages'][] = array('danger', __('Undefined payment type.', 'realia'));
                     wp_redirect(site_url());
                     exit;
             }
             $transaction_id = wp_insert_post(array('post_type' => 'transaction', 'post_title' => date(get_option('date_format'), strtotime('today')), 'post_status' => 'publish', 'post_author' => $_GET['user_id']));
             $object = array('success' => $_GET['success'], 'price' => $_GET['price'], 'price_formatted' => $_GET['price_formatted'], 'currency_code' => $_GET['code'], 'currency_sign' => $_GET['sign']);
             if (!empty($_GET['paymentId'])) {
                 $object['paymentId'] = $_GET['paymentId'];
                 $object['token'] = $_GET['token'];
                 $object['PayerID'] = $_GET['PayerID'];
                 $object['gateway'] = 'PayPal Account';
             } else {
                 $object['gateway'] = 'PayPal Credit Card';
             }
             update_post_meta($transaction_id, REALIA_TRANSACTION_PREFIX . 'object', serialize($object));
             update_post_meta($transaction_id, REALIA_TRANSACTION_PREFIX . 'object_id', $_GET['object_id']);
             update_post_meta($transaction_id, REALIA_TRANSACTION_PREFIX . 'payment_type', $_GET['payment_type']);
             $_SESSION['messages'][] = array('success', __('Payment has been successfull.', 'realia'));
         } else {
             $_SESSION['messages'][] = array('danger', __('Error processing payment.', 'realia'));
         }
         wp_redirect(site_url());
         exit;
     }
 }