vendor/codeages/biz-order-pay/src/Pay/Payment/AlipayGateway.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\Service\Exception\InvalidArgumentException;
use Omnipay\Omnipay;
class AlipayGateway extends AbstractGateway
{
public function createTrade($data)
{
if (!ArrayToolkit::requireds($data, array(
'goods_title',
'goods_detail',
'attach',
'trade_sn',
'amount',
'notify_url',
'return_url',
'create_ip',
))) {
throw new InvalidArgumentException('trade args is invalid.');
}
$platformType = empty($data['platform_type']) ? 'Web' : $data['platform_type'];
if (!in_array($platformType, array('Web', 'Wap'))) {
throw new InvalidArgumentException("platform_type is invalid, it must be 'web' or 'wap'.");
}
$gateway = $this->createGateway($platformType);
$gateway->setReturnUrl($data['return_url']);
$gateway->setNotifyUrl($data['notify_url']);
$method = "make{$platformType}Order";
$order = $this->$method($data);
$response = $gateway->purchase($order)->send();
return array(
'url' => $response->getRedirectUrl(),
'data' => $response->getRedirectData(),
);
}
public function closeTrade($trade)
{
$platformType = empty($trade['platform_type']) ? 'Web' : $trade['platform_type'];
$gateway = $this->createGateway($platformType);
$response = $gateway->close(array(
'out_trade_no' => $trade['trade_sn'],
))->send();
return $response;
}
protected function makeWebOrder($data)
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。