<?php


namespace App\Http\Controllers\api;

use App\Http\Controllers\Controller;
use Illuminate\Support\Facades\Log;
use Illuminate\Http\Request;

use App\Services\PaymentOrderService;

class Pay extends Controller
{
    // 同步通知
    public function returnHandle(Request $request)
    {

    }

    // 异步通知
    public function notifyHandle(Request $request)
    {
        $data = $request->all();
        // 记录到专用支付日志
        Log::channel('payment')->info('支付回调', $data);


        $res = PaymentOrderService::receiveOrder($data);
        // var_dump($res);
        echo 'success';
    }

    // 用户支付异步通知
    public function harvestHandle(Request $request)
    {
        $data = $request->all();
        // 记录到专用支付日志
        Log::channel('payment')->info('三斤支付回调', $data);

        $res = PaymentOrderService::receivePay($data);
        var_dump($res);
        echo 'success';
    }

}