for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Yansongda\Pay\Gateways\Alipay;
use Yansongda\Pay\Contracts\GatewayInterface;
use Yansongda\Pay\Events;
use Yansongda\Supports\Collection;
class TransferGateway implements GatewayInterface
{
/**
* Pay an order.
*
* @author yansongda <[email protected]>
* @param string $endpoint
* @param array $payload
* @throws \Yansongda\Pay\Exceptions\GatewayException
* @throws \Yansongda\Pay\Exceptions\InvalidConfigException
* @throws \Yansongda\Pay\Exceptions\InvalidSignException
* @return Collection
*/
public function pay($endpoint, array $payload): Collection
$payload['method'] = 'alipay.fund.trans.toaccount.transfer';
$payload['biz_content'] = json_encode(array_merge(
json_decode($payload['biz_content'], true),
['product_code' => '']
));
$payload['sign'] = Support::generateSign($payload);
Events::dispatch(Events::PAY_STARTED, new Events\PayStarted('Alipay', 'Transfer', $endpoint, $payload));
return Support::requestApi($payload);
}