/** * PaymentCardAPI class constructor * * @param string $cardApiKey api key * @param string $cardApiPassword api password * @param string $verificationCode verification code * @param string $hashAlg hash algorithm * * @throws TException */ public function __construct($cardApiKey, $cardApiPassword, $verificationCode = '', $hashAlg = 'sha1') { Validate::validateCardApiKey($cardApiKey); Validate::validateCardApiPassword($cardApiPassword); Validate::validateCardHashAlg($hashAlg); if ($verificationCode !== '') { Validate::validateCardCode($verificationCode); } $this->apiKey = $cardApiKey; $this->apiPass = $cardApiPassword; $this->hashAlg = $hashAlg; $this->verificationCode = $verificationCode; Util::loadClass('curl'); }
/** * PaymentCard class constructor for payment: * - card by panel * - card direct sale * - for saved cards * * @param string|bool $merchantId merchant id * @param string|bool $merchantSecret merchant secret * @param string|bool $apiKey card api key * @param string|bool $apiPassword card API password * @param string|bool $code card API code * @param string|bool $hashAlg card hash algorithm * @param string|bool $keyRSA card RSA key */ public function __construct($merchantId = false, $merchantSecret = false, $apiKey = false, $apiPassword = false, $code = false, $hashAlg = false, $keyRSA = false) { if ($merchantId !== false) { $this->merchantId = $merchantId; } if ($merchantSecret !== false) { $this->merchantSecret = $merchantSecret; } if ($apiKey !== false) { $this->apiKey = $apiKey; } if ($apiPassword !== false) { $this->apiPassword = $apiPassword; } if ($code !== false) { $this->code = $code; } if ($hashAlg !== false) { $this->hashAlg = $hashAlg; } if ($keyRSA !== false) { $this->keyRSA = $keyRSA; } require_once dirname(__FILE__) . '/util.php'; Util::loadClass('validate'); Util::loadClass('exception'); Util::loadClass('lang'); Util::checkVersionPHP(); Validate::validateMerchantId($this->merchantId); Validate::validateMerchantSecret($this->merchantSecret); Validate::validateCardApiKey($this->apiKey); Validate::validateCardApiPassword($this->apiPassword); Validate::validateCardCode($this->code); Validate::validateCardHashAlg($this->hashAlg); Validate::validateCardRSAKey($this->keyRSA); Util::loadClass('card_api'); }