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

(开头部分) 1KB

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

<?php

namespace Codeages\Biz\Pay\Payment;


use Codeages\Biz\Framework\Service\Exception\AccessDeniedException;
use Codeages\Biz\Framework\Util\ArrayToolkit;
use Codeages\Biz\Framework\Targetlog\Service\TargetlogService;

class IapGateway extends AbstractGateway
{
    public function converterNotify($data)
    {
        $data = ArrayToolkit::parts($data, array(
            'user_id',
            'amount',
            'receipt',
            'transaction_id',
            'is_sand_box'
        ));

        return $this->requestReceiptData($data);
    }

    private function requestReceiptData($notifyData)
    {
        $userId = $notifyData['user_id'];
        $amount = $notifyData['amount'];
        $receipt = $notifyData['receipt'];
        $transactionId = $notifyData['transaction_id'];
        $isSandbox = $notifyData['is_sand_box'];

        if ($isSandbox) {
            $endpoint = 'https://sandbox.itunes.apple.com/verifyReceipt';
        } else {
            $endpoint = 'https://buy.itunes.apple.com/verifyReceipt';
        }

        $postData = json_encode(
            array('receipt-data' => $receipt)
        );

        $ch = curl_init($endpoint);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
        curl_setopt($ch, CURLOPT_POST, true);
        curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 30);
        curl_setopt($ch, CURLOPT_TIMEOUT, 30);
        curl_setopt($ch, CURLOPT_POSTFIELDS, $postData);

        $response = curl_exec($ch);
        $errno = curl_errno($ch);

        curl_close($ch);

        if ($errno != 0) {
            return array(
                array(
                    'msg' => '充值失败!'.$errno
                ),
                'failure'

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

AI 解读 AI

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

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