示例#1
0
 /**
  * Prepare and check that the needed data is available.
  *
  * @param array $data
  * @return array
  */
 protected function prepareOrderData(array $data)
 {
     $requiredKeys = ['Checksum', 'Merchant', 'Status', 'OrderID', 'PaymentID', 'PaymentMethod'];
     Assert::that($data, null, 'data')->choicesNotEmpty($requiredKeys);
     Assert::that($data['Merchant'], null, 'data["Merchant"]')->eq($this->merchantId, 'Invalid MerchantId! Expected "%2$s" but received "%1$s".');
     $optionalKeys = ['StatusCode', 'TransactionID', 'Reference', 'ConsumerName', 'ConsumerAccountNumber', 'ConsumerAddress', 'ConsumerHouseNumber', 'ConsumerCity', 'ConsumerCountry', 'ConsumerEmail', 'ConsumerPhoneNumber', 'ConsumerIPAddress', 'Amount', 'Currency', 'Duration'];
     foreach ($optionalKeys as $key) {
         $data[$key] = isset($data[$key]) && $data[$key] !== "" ? $data[$key] : null;
     }
     return $data;
 }
示例#2
0
 /**
  * @inheritDoc
  * @param string $secretCode
  */
 public function __construct($secretCode, $wsdl, array $options = array())
 {
     Assert::that($secretCode, null, 'secretCode')->notEmpty()->string();
     if (empty($options['classmap'])) {
         $options['classmap'] = static::$classMap;
     } else {
         foreach (static::$classMap as $soapType => $phpType) {
             if (!isset($options['classmap'][$soapType])) {
                 $options['classmap'][$soapType] = $phpType;
             }
         }
     }
     if (!isset($options['exceptions'])) {
         $options['exceptions'] = false;
     }
     parent::__construct($wsdl, $options);
     $this->secret = $secretCode;
 }
示例#3
0
 /**
  * Sets the URLError.
  *
  * @param string|null $URLError
  * @return $this
  */
 public function setURLError($URLError = null)
 {
     Assert::that($URLError)->nullOr()->url()->maxLength(500);
     $this->URLError = $URLError;
     return $this;
 }
示例#4
0
 public function __construct($secretCode, Client $httpClient = null)
 {
     Assert::that($secretCode, null, 'secretCode')->notEmpty()->string();
     $this->secretCode = $secretCode;
     $this->httpClient = $httpClient;
 }
示例#5
0
 /**
  * GetPaymentRequestType constructor.
  *
  * @param int $paymentID
  */
 public function __construct($paymentID)
 {
     Assert::that($paymentID, null, 'paymentID')->integer();
     $this->PaymentID = $paymentID;
 }
示例#6
0
 /**
  * @param string $value
  * @param string $propertyPath
  * @param string|null $defaultMessage
  * @return $this
  */
 public function that($value, $propertyPath, $defaultMessage = null)
 {
     $this->currentChainFailed = false;
     $this->currentChain = Assert::that($value, $defaultMessage, $propertyPath);
     return $this;
 }