Пример #1
0
 /**
  * Constructor.
  *
  * @param string $merchant_privatekey Either a filename pointing to a File
  *		containing the merchant private RSA key or the key itself in string
  *		form as read from the file. The key is used for signing outgoing
  *		requests. You can leave this blank here and instead use the
  *		useMerchantPrivateKey()/loadMerchantPrivateKey() function to set a
  *		key later, but it must be defined before issuing any API calls.
  *
  * @param string $username Username for the processing account used at Trustly.
  *
  * @param string $password Password for the processing account used at Trustly.
  *
  * @param string $host API host used for communication. Fully qualified
  *		hostname. When integrating with our public API this is typically
  *		either 'test.trustly.com' or 'trustly.com'.
  *
  * @param integer $port Port on API host used for communicaiton. Normally
  *		443 for https, or 80 for http.
  *
  * @param bool $is_https Indicator wether the port on the API host expects
  *		https.
  */
 public function __construct($merchant_privatekey, $username, $password, $host = 'trustly.com', $port = 443, $is_https = TRUE)
 {
     parent::__construct($host, $port, $is_https);
     $this->api_username = $username;
     $this->api_password = $password;
     if ($merchant_privatekey != NULL) {
         if (strpos($merchant_privatekey, "\n") !== FALSE) {
             if ($this->useMerchantPrivateKey($merchant_privatekey) === FALSE) {
                 throw new InvalidArgumentException('Cannot use merchant private key');
             }
         } else {
             if ($this->loadMerchantPrivateKey($merchant_privatekey) === FALSE) {
                 throw new InvalidArgumentException('Cannot load merchant private key file ' . $merchant_privatekey);
             }
         }
     }
 }
Пример #2
0
 /**
  * Constructor.
  *
  * @param string $username Username for the processing account used at Trustly.
  *
  * @param string $password Password for the processing account used at Trustly.
  *
  * @param string $host API host used for communication. Fully qualified
  *		hostname. When integrating with our public API this is typically
  *		either 'test.trustly.com' or 'trustly.com'.
  *
  * @param integer $port Port on API host used for communicaiton. Normally
  *		443 for https, or 80 for http.
  *
  * @param bool $is_https Indicator wether the port on the API host expects
  *		https.
  **/
 public function __construct($username, $password, $host = 'trustly.com', $port = 443, $is_https = TRUE)
 {
     parent::__construct($host, $port, $is_https);
     $this->api_username = $username;
     $this->api_password = $password;
 }