Example #1
0
    /**
     * Initialize the object with parameters.
     *
     * If any unknown parameters passed, they will be ignored.
     *
     * @param array $parameters An associative array of parameters
     *
     * @return $this
     */
    public function initialize($parameters = null)
    {
        $this->parameters = new ParameterBag;

        Helper::initialize($this, $parameters);

        return $this;
    }
Example #2
0
 /**
  * Initialize the object with parameters.
  *
  * If any unknown parameters passed, they will be ignored.
  *
  * @param array An associative array of parameters
  */
 public function initialize(array $parameters = array())
 {
     if (null !== $this->response) {
         throw new RuntimeException('Request cannot be modified after it has been sent!');
     }
     $this->parameters = new ParameterBag();
     Helper::initialize($this, $parameters);
     return $this;
 }
Example #3
0
 /**
  * Initialize this item with the specified parameters
  *
  * @param array|null $parameters An array of parameters to set on this object
  *
  * @return Customer
  */
 public function initialize($parameters = null)
 {
     $this->parameters = new ParameterBag();
     $this->setType(self::TYPE_NEW);
     $this->setGroup(self::GROUP_PRIVATE);
     if ($parameters !== null) {
         Helper::initialize($this, $parameters);
     }
     return $this;
 }
 public function initialize(array $parameters = array())
 {
     $this->parameters = new ParameterBag();
     // set default parameters
     foreach ($this->getDefaultParameters() as $key => $value) {
         if (is_array($value)) {
             $this->parameters->set($key, reset($value));
         } else {
             $this->parameters->set($key, $value);
         }
     }
     Helper::initialize($this, $parameters);
     return $this;
 }
 /**
  * Initialize the object with parameters.
  *
  * If any unknown parameters passed, they will be ignored.
  *
  * @param array $parameters An associative array of parameters
  *
  * @return $this
  * @throws RuntimeException
  */
 public function initialize(array $parameters = array())
 {
     $this->parameters = new ParameterBag();
     $tempParams = array();
     foreach ($parameters as $key => $value) {
         if (is_array($value) || is_object($value)) {
             $tempParams[$key] = (array) $value;
             foreach ((array) $value as $subKey => $subValue) {
                 $tempParams[$subKey] = $subValue;
             }
             continue;
         }
         $tempParams[$key] = $value;
     }
     Helper::initialize($this, $tempParams);
     return $this;
 }
Example #6
0
 public function testInitializeIgnoresInvalidParameters()
 {
     $target = m::mock('\\Omnipay\\Common\\CreditCard');
     $target->shouldReceive('setName')->once()->with('adrian');
     Helper::initialize($target, ['name' => 'adrian', 'extra' => 'invalid']);
 }
 /**
  * Initialize this gateway with default parameters
  *
  * @param  array $parameters
  * @return $this
  */
 public function initialize(array $parameters = array())
 {
     $this->parameters = new ParameterBag();
     // set default parameters
     foreach ($this->getDefaultParameters() as $key => $value) {
         if (is_array($value)) {
             $this->parameters->set($key, reset($value));
         } else {
             $this->parameters->set($key, $value);
         }
     }
     $event = new GatewayEvent($this, $this->parameters);
     $this->dispatch(GatewayEvent::PRE_INITIALIZE, $event);
     Helper::initialize($this, $parameters);
     $event = new GatewayEvent($this, $this->parameters);
     $this->dispatch(GatewayEvent::POST_INITIALIZE, $event);
     return $this;
 }
Example #8
0
 public function acceptNotification(array $parameters = array())
 {
     // Rename hmacSignature parameter
     if (isset($parameters['additionalData_hmacSignature'])) {
         $parameters['hmacSignature'] = $parameters['additionalData_hmacSignature'];
     }
     // Add secret from configuration
     $parameters['secret'] = $this->getSecret();
     $notification = new \Omnipay\Adyen\Message\PostNotification();
     Helper::initialize($notification, $parameters);
     return $notification;
 }
 /**
  * @param array $parameters
  * @return $this
  */
 public function loadParameters($parameters = [])
 {
     Helper::initialize($this, $parameters);
     return $this;
 }