Ejemplo n.º 1
0
 /**
  * @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);
 }
Ejemplo n.º 2
0
 public function testWithUri()
 {
     $this->rb->withUri('http://api.example.org');
     static::assertEquals('http://api.example.org', $this->rb->getUri());
 }