예제 #1
0
 /**
  * Get the generated URL to the Dragonpay Payment Switch API.
  *
  * @param array $params
  * @param null|string $filter
  * @return string
  * @TODO Clean up logging
  */
 public function getUrl(array $params, $filter = null)
 {
     $params['merchantId'] = $this->client->getMerchantId();
     $params['password'] = $this->client->getMerchantPassword();
     // Log generation of URL
     $logMessage = "[dragonpay-sdk][url-generation] Generating URL to Dragonpay Payment Switch.";
     $this->log($logMessage);
     $url = $this->urlGenerator->generate($params, $this->client->isTesting());
     // Log successful generation of URL
     $logMessage = "[dragonpay-sdk][url-generation] Successfully generated URL to Dragonpay Payment Switch. URL: \"{$url}\"";
     $this->log($logMessage);
     if ($filter !== null) {
         $url = $this->addFilter($url, $filter);
     }
     return $url;
 }
예제 #2
0
 /**
  * Send billing information of customer's billing address to the Dragonpay
  * Payment Switch API for additional fraud checking.
  *
  * SOAP web service is required for this function.
  *
  * @param array $params
  * @return string
  * @throws Exception
  * @throws ValidationException
  */
 public function sendBillingInformation(array $params)
 {
     if (!$this->merchantService instanceof SoapMerchantService) {
         throw new Exception('You must use the SOAP web service in order to use this function.');
     }
     $this->validateBillingParams($params);
     $merchantId = $this->client->getMerchantId();
     $code = $this->merchantService->sendBillingInformation($merchantId, $params, $this->client->isTesting());
     // Log sending of billing information
     $logMessage = "[dragonpay-sdk][billing-info-sending] Sending billing information of Transaction ID {$params['transactionId']}";
     $this->log($logMessage);
     $status = $this->parseStatusCode($code);
     // Log status of sending of billing information
     $logMessage = "[dragonpay-sdk][billing-info-sending] Sending of billing information of Transaction ID {$params['transactionId']} returned with a status of \"{$status}\"";
     $this->log($logMessage);
     return $status;
 }