vendor/codeages/biz-order-pay/src/Pay/Payment/WechatGateway.php

(开头部分) 1KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

<?php

namespace Codeages\Biz\Pay\Payment;

use Codeages\Biz\Framework\Util\ArrayToolkit;
use Codeages\Biz\Framework\Service\Exception\InvalidArgumentException;
use Codeages\Biz\Pay\Exception\PayGatewayException;
use Omnipay\Omnipay;

class WechatGateway extends AbstractGateway
{
    public function converterNotify($data)
    {
        $gateway = $this->createGateway('WechatPay');
        $request = $gateway->completePurchase(array(
            'request_params' => $data
        ));
        $response = $request->send();
        $data = $request->getData();

        if ($response->isPaid()) {
            return array(
                $this->converterTradeResponse($data),
                $this->getNotifyResponse()
            );
        }

        return array(
            array(
                'status' => 'failture',
                'notify_data' => $data,
            ),
            $this->getNotifyResponse()
        );
    }

    public function queryTrade($tradeSn)
    {
        $response = $this->createGateway("WechatPay")->query(array('out_trade_no' => $tradeSn))->send();
        $data = $response->getData();
        if ($response->isSuccessful() && $data['trade_state'] == 'SUCCESS') {
            $result = $this->converterTradeResponse($data);
            return $result;
        }
    }

    protected function converterTradeResponse($data)
    {
        return array(
            'status' => 'paid',
            'cash_flow' => $data['transaction_id'],
            'paid_time' => $this->timeConverter($data['time_end']),
            'pay_amount' => $data['cash_fee'],
            'cash_type' => $data['fee_type'],
            'trade_sn' => $data['out_trade_no'],
            'attach' => json_decode($data['attach'], true),
            'notify_data' => $data,
        );
    }

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。