Omnipay\Alipay\Requests\AopCompletePurchaseRequest::sendData PHP Method

sendData() public method

Send the request with specified data
public sendData ( mixed $data ) : AopCompletePurchaseResponse
$data mixed The data to send
return Omnipay\Alipay\Responses\AopCompletePurchaseResponse
    public function sendData($data)
    {
        if (isset($data['result'])) {
            $request = new AopVerifyAppPayReturnRequest($this->httpClient, $this->httpRequest);
            $request->initialize($this->parameters->all());
            $request->setEndpoint($this->getEndpoint());
            $request->setResult($data['result']);
            $request->setAlipayPublicKey($this->getAlipayPublicKey());
            $data = $request->send()->getData();
        } else {
            $request = new AopNotifyRequest($this->httpClient, $this->httpRequest);
            $request->initialize(['params' => $data]);
            $request->setEndpoint($this->getEndpoint());
            $request->setAlipayPublicKey($this->getAlipayPublicKey());
            $data = $request->send()->getData();
            if (!array_get($data, 'trade_status')) {
                $tn = array_get($data, 'trade_no');
                $request = new AopTradeQueryRequest($this->httpClient, $this->httpRequest);
                $request->initialize($this->getParameters());
                $request->setEndpoint($this->getEndpoint());
                $request->setBizContent(['trade_no' => $tn]);
                $request->setPrivateKey($this->getPrivateKey());
                /**
                 * @var AopTradeQueryResponse $response
                 */
                $response = $request->send();
                $tradeStatus = $response->getAlipayResponse('trade_status');
                $data['trade_status'] = $tradeStatus;
            }
        }
        return $this->response = new AopCompletePurchaseResponse($this, $data);
    }