/**
  *
  * @dataProvider invalidProvider
  */
 public function testInvalidValidate($class, $name, $exMessage)
 {
     try {
         $this->assertFalse(ModelAccessorValidator::validate($class, $name));
     } catch (\Exception $ex) {
         $this->assertContains($exMessage, $ex->getMessage());
     }
 }
 /**
  * Create a new PaymentForward.
  *
  * OPTIONS:
  * process_fees_address (string): Address to forward processing fees, if specified.
  *                                Allows you to receive a fee for your own services.
  * process_fees_satoshis (int): Fixed processing fee amount to be sent to the fee address. A fixed satoshi amount or a
  *                        percentage is required if a process_fees_address has been
  *                        specified.
  * process_fees_percent (float): Percentage of the transaction to be sent to the fee address. A fixed satoshi amount
  *                               or a percentage is required if a process_fees_address has been specified.
  * callback_url (url): The URL to call anytime a new payment is forwarded.
  * enable_confirmations (bool): Whether to also call the callback_url with subsequent confirmations of the
  *                              forwarding transactions. Automatically sets up a WebHook.
  * mining_fees_satoshis (int): Mining fee amount to include in the forwarding transaction, in satoshis. If not set,
  *                             defaults to 10,000.
  * transactions array[string]: History of forwarding transaction hashes for this payment forwarding request.
  *
  * @param string $destination
  * @param array $options
  * @param ApiContext $apiContext is the APIContext for this call. It can be used to pass dynamic configuration and credentials.
  * @param BlockCypherRestCall $restCall is the Rest Call Service that is used to make rest calls
  * @return PaymentForward
  */
 public function createForwardingAddress($destination, $options = array(), $apiContext = null, $restCall = null)
 {
     ArgumentValidator::validate($destination, 'destination');
     ArgumentArrayValidator::validate($options, 'options');
     $paymentForward = new PaymentForward();
     $paymentForward->setDestination($destination);
     // All options correspond to a setter
     foreach ($options as $option => $optionValue) {
         if (ModelAccessorValidator::validate($paymentForward, $this->convertToCamelCase($option))) {
             $setter = "set" . $this->convertToCamelCase($option);
             $paymentForward->{$setter}($optionValue);
         } else {
             throw new \InvalidArgumentException("Invalid option {$option}");
         }
     }
     return $this->create($paymentForward, $apiContext, $restCall);
 }
Exemplo n.º 3
0
 /**
  * Magic Set Method
  *
  * @param $key
  * @param $value
  */
 public function __set($key, $value)
 {
     ModelAccessorValidator::validate($this, $this->convertToCamelCase($key));
     if (!is_array($value) && $value === null) {
         $this->__unset($key);
     } else {
         $this->_propMap[$key] = $value;
     }
 }