Exemple #1
0
 /**
  * Delete a Post
  *
  * @param Post $post
  *
  * @return bool
  */
 public function delete(Post $post)
 {
     $response = $this->api->process(new DeletePost($post));
     if ($response->getStatusCode() == 200) {
         return true;
     } else {
         return false;
     }
 }
 /**
  * @inheritdoc
  */
 public function buildRequest(ApiRequestBuilder $requestBuilder, ApiInterface $api)
 {
     /** @var QPayApi $api */
     $data = Object2ArrayBuilder::create()->build()->createArray($this);
     if (array_key_exists('urn:Header', $data)) {
         $data['urn:Header'] = ['urn1:CertPublicKey' => $api->getCredentials()->getCertificateSerialNumber(), 'urn1:UIID' => $api->getCredentials()->getUuid(), 'urn1:User' => 'system'];
     }
     if (array_key_exists('urn:RequestToken', $data)) {
         $data['urn:RequestToken'] = Object2ArrayBuilder::create()->build()->createArray($api->getRequestToken());
     }
     //build the request url
     $uri = sprintf('https://pos.qpay123.biz/%s/Gateway.svc', $api->getCredentials()->getMerchantName());
     $xml = QPayXMLParser::createRequest($this->getActionName(), $data);
     $requestBuilder->withUri($uri)->withMethod('POST')->withXMLBody($xml)->options()->setCurlOption(CURLOPT_CAINFO, $api->getCredentials()->getAuthorityCertificateFile())->setCurlOption(CURLOPT_SSLCERT, $api->getCredentials()->getClientCertificateFile())->setCurlOption(CURLOPT_SSLKEY, $api->getCredentials()->getCertificateKeyFile())->setCurlOption(CURLOPT_SSLCERTPASSWD, $api->getCredentials()->getCertificatePassword())->SSLVerification(false);
 }