/** * 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; }
/** * @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; }
/** * 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; }
private function soapCall($method, BaseTypeType $request) { Assert::lazy()->that($request->getMerchantID(), 'MerchantID')->notEmpty()->that($request->getTimestamp(), 'Timestamp')->notEmpty()->that($request->getChecksum(), 'Checksum')->notEmpty()->verifyNow(); return $this->__soapCall($method, [(object) ['request' => $request]]); }
/** * @param string $paymentMethod * @param string $orderID * @param string $status * @param string $paymentID * @param string|null $statusCode * @param string|null $transactionID * @param string|null $reference * @param string|null $amount * @param string|null $currency * @param string|null $duration * @param string|null $consumerName * @param string|null $consumerAccountNumber * @param string|null $consumerAddress * @param string|null $consumerHouseNumber * @param string|null $consumerCity * @param string|null $consumerCountry * @param string|null $consumerEmail * @param string|null $consumerPhoneNumber * @param string|null $consumerIPAddress */ public function __construct($paymentMethod, $orderID, $status, $paymentID, $statusCode = null, $transactionID = null, $reference = null, $amount = null, $currency = null, $duration = null, $consumerName = null, $consumerAccountNumber = null, $consumerAddress = null, $consumerHouseNumber = null, $consumerCity = null, $consumerCountry = null, $consumerEmail = null, $consumerPhoneNumber = null, $consumerIPAddress = null) { Assert::lazy()->that($paymentMethod, 'paymentMethod')->notEmpty()->maxLength(20)->that($orderID, 'orderID')->notEmpty()->maxLength(10)->that($status, 'status')->inArray([self::STATE_OPEN, self::STATE_AUTHORIZED, self::STATE_ERROR, self::STATE_SUCCESS, self::STATE_REFUND, self::STATE_CHARGE_BACK])->that($paymentID, 'paymentID')->numeric()->that($statusCode, 'statusCode')->nullOr()->string()->maxLength(100)->that($transactionID, 'transactionID')->nullOr()->string()->maxLength(50)->that($reference, 'reference')->nullOr()->string()->maxLength(50)->that($amount, 'amount')->nullOr()->numeric()->that($currency, 'currency')->nullOr()->string()->length(3)->that($duration, 'duration')->nullOr()->numeric()->that($consumerName, 'consumerName')->nullOr()->string()->maxLength(100)->that($consumerAccountNumber, 'consumerAccountNumber')->nullOr()->string()->maxLength(100)->that($consumerAddress, 'consumerAddress')->nullOr()->string()->maxLength(100)->that($consumerHouseNumber, 'consumerHouseNumber')->nullOr()->string()->maxLength(10)->that($consumerCity, 'consumerCity')->nullOr()->string()->maxLength(100)->that($consumerCountry, 'consumerCountry')->nullOr()->string()->maxLength(100)->that($consumerEmail, 'consumerEmail')->nullOr()->string()->maxLength(200)->that($consumerPhoneNumber, 'consumerPhoneNumber')->nullOr()->string()->maxLength(50)->that($consumerIPAddress, 'consumerIPAddress')->nullOr()->ip()->verifyNow(); $this->paymentMethod = $paymentMethod; $this->orderID = $orderID; $this->status = $status; $this->paymentID = $paymentID; $this->statusCode = $statusCode; $this->transactionID = $transactionID; $this->reference = $reference; $this->amount = $amount; $this->currency = $currency; $this->duration = $duration; $this->consumerName = $consumerName; $this->consumerAccountNumber = $consumerAccountNumber; $this->consumerAddress = $consumerAddress; $this->consumerHouseNumber = $consumerHouseNumber; $this->consumerCity = $consumerCity; $this->consumerCountry = $consumerCountry; $this->consumerEmail = $consumerEmail; $this->consumerPhoneNumber = $consumerPhoneNumber; $this->consumerIPAddress = $consumerIPAddress; }
public function __construct($secretCode, Client $httpClient = null) { Assert::that($secretCode, null, 'secretCode')->notEmpty()->string(); $this->secretCode = $secretCode; $this->httpClient = $httpClient; }
/** * @param string $merchantId * @param string $secretCode */ public function __construct($merchantId, $secretCode) { Assert::lazy()->that($merchantId, 'merchantId')->notEmpty()->string()->that($secretCode, 'secretCode')->notEmpty()->string()->verifyNow(); $this->merchantId = $merchantId; $this->secretCode = $secretCode; }
/** * GetPaymentRequestType constructor. * * @param int $paymentID */ public function __construct($paymentID) { Assert::that($paymentID, null, 'paymentID')->integer(); $this->PaymentID = $paymentID; }
/** * @inheritdoc * @param string $consumerId */ public function __construct($consumerId, $orderId, $amount, $currency, $country, $language, $endUserIP, $paymentMethod, $paymentIssuer) { parent::__construct($orderId, $amount, $currency, $country, $language, $endUserIP, $paymentMethod, $paymentIssuer); Assert::lazy()->that($consumerId, 'consumerId')->notEmpty()->that($paymentMethod, 'paymentMethod')->notEmpty()->that($paymentIssuer, 'paymentIssuer')->notEmpty()->verifyNow(); $this->ConsumerID = $consumerId; }
/** * @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; }