示例#1
0
 /**
  * @inheritDoc
  */
 protected function parseResponseData(\SimpleXMLElement $response)
 {
     $data = parent::parseResponseData($response);
     $data['transactionId'] = (string) $response->TransactionId;
     return $data;
 }
示例#2
0
 /**
  * Sends specified request
  *
  * @param AbstractRequest $request
  * @return \SimpleXMLElement
  * @throws PaxumException
  */
 public function sendRequest(AbstractRequest $request)
 {
     try {
         $client = new Client();
         $data = $request->getRequestPayload();
         $data['key'] = $request->getKey($this->sharedSecret);
         if (true === $this->sandbox) {
             $data['sandbox'] = 'ON';
             $data['return'] = $this->sandboxResponseCode;
         }
         $response = $client->post($this->apiURL, null, $data)->send();
     } catch (\Exception $e) {
         throw new PaxumException($e->getMessage(), $e->getCode(), $e);
     }
     if ($response->isSuccessful()) {
         return $response->xml();
     } else {
         throw new PaxumException($response->getReasonPhrase(), $response->getStatusCode());
     }
 }