/**
  * Send the request with specified data
  *
  * @param  mixed $data The data to send
  *
  * @return 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);
 }
 protected function query()
 {
     $request = new AopTradeQueryRequest($this->httpClient, $this->httpRequest);
     $request->initialize($this->parameters->all());
     $request->setEndpoint($this->getEndpoint());
     $request->setPrivateKey($this->getPrivateKey());
     $request->setBizContent(['out_trade_no' => $this->getBizData('out_trade_no')]);
     $this->response = $request->send();
 }