ExpressController.php 1.7 KB
Newer Older
T
Terry 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
<?php
/**
 * FecShop file.
 *
 * @link http://www.fecshop.com/
 * @copyright Copyright (c) 2016 FecShop Software LLC
 * @license http://www.fecshop.com/license/
 */

namespace fecshop\app\appserver\modules\Payment\controllers\paypal;

use fecshop\app\appserver\modules\AppserverController;
use Yii;

/**
 * @author Terry Zhao <2358269014@qq.com>
 * @since 1.0
 */
class ExpressController extends AppserverController
{
    public $enableCsrfValidation = false;

    public function actionStart()
    {
T
Terry 已提交
25 26 27
        if(Yii::$app->request->getMethod() === 'OPTIONS'){
            return [];
        }
T
Terry 已提交
28 29 30 31 32 33
        return $this->getBlock()->startExpress();
    }

    // 2.Review  从paypal确认后返回
    public function actionReview()
    {
T
Terry 已提交
34 35 36
        if(Yii::$app->request->getMethod() === 'OPTIONS'){
            return [];
        }
T
Terry 已提交
37 38 39 40
        return $this->getBlock()->getLastData();
    }
    // 3. 提交订单
    public function actionSubmitorder(){
T
Terry 已提交
41 42 43
        if(Yii::$app->request->getMethod() === 'OPTIONS'){
            return [];
        }
T
Terry 已提交
44
        return $this->getBlock('placeorder')->getLastData();
T
Terry 已提交
45
    }
T
Terry 已提交
46 47 48
    /**
     * IPN已经关掉
     */
T
Terry 已提交
49 50
    public function actionIpn()
    {
T
Terry 已提交
51 52 53
        if(Yii::$app->request->getMethod() === 'OPTIONS'){
            return [];
        }
T
Terry 已提交
54 55 56 57 58 59 60 61 62 63 64 65 66 67
        \Yii::info('paypal ipn begin', 'fecshop_debug');
       
        $post = Yii::$app->request->post();
        if (is_array($post) && !empty($post)) {
            $post = \Yii::$service->helper->htmlEncode($post);
            ob_start();
            ob_implicit_flush(false);
            var_dump($post);
            $post_log = ob_get_clean();
            \Yii::info($post_log, 'fecshop_debug');
            //Yii::$service->payment->paypal->receiveIpn($post);
        }
    }
}