<?php 
get_header();

$res = PPO_Pay::pay_notify('get', $_GET);
$success = !isset($res['error']) && !empty($res);

$current_user = wp_get_current_user();
$user_id = $current_user->ID;
$pay_rurl = $_COOKIE["pay_rurl"] ?: home_url();

?>
<div id="pay-return-page" class="pay-return pix-content home-classic" uk-height-viewport="expand: true">

    <?php if($success) { ?>

        <div class="pay-return-icon success"><i class="ri-check-line"></i></div>
        <div class="success-title"><?php echo __('恭喜，支付成功','ppo'); ?></div>

    <?php } else { ?>

        <div class="pay-return-icon fail"><i class="ri-close-line"></i></div>
        <div class="fail-title"><?php echo __('抱歉，支付失败','ppo'); ?></div>

    <?php } ?>

    <div class="btn-group">
        <a class="close-page" href="javascript:window.location.href='about:blank';window.close();"><?php echo __('关闭此页面','ppo'); ?></a>
        <a class="jump-order-page" href="<?php echo get_author_posts_url($user_id); ?>"><?php echo __('查看订单页','ppo'); ?></a>
        <a class="back-page" href="<?php echo esc_url($pay_rurl); ?>"><?php echo __('返回商品页','ppo'); ?></a>
    </div>
</div>

<?php
get_footer();
