示例#1
0
 public function populate($data)
 {
     parent::populate($data);
     if ($type = $this->getProperty($data, 'type')) {
         $this->type = $this->service()->resource('NotificationType', $type);
     }
 }
示例#2
0
 /**
  * @param string|DateTime $updatedSince
  * @return string
  */
 public function getAll($updatedSince = null)
 {
     $newUri = null;
     $newUri = '?' . http_build_query(array('updated_since' => $this->_appendUpdatedSinceParam($updatedSince)));
     $this->_uri = self::HARVEST_PATH . $newUri;
     return parent::getAll();
 }
 public function __construct($source, array $options = [], $sourceRoot = null, $lastModified = null)
 {
     if (is_null($sourceRoot)) {
         $sourceRoot = dirname($source);
     }
     parent::__construct($source, $options, $sourceRoot, $lastModified);
 }
示例#4
0
 public function __construct($type, Source\DataSourceInterface $source, $options = array())
 {
     parent::__construct($type, $options);
     $this->source = $source;
     $this->initReader();
     $this->initWriter();
 }
 protected function mockResponse($answer, $contentType = 'application/json')
 {
     $response = new Http\Response();
     $response = $response->withHeader('Content-Type', $contentType)->withBody($answer);
     $client = $this->getMock('Everypay\\Http\\Client\\CurlClient', array('send'));
     $client->expects($this->once())->method('send')->will($this->returnValue($response));
     AbstractResource::setClient($client);
 }
示例#6
0
 /**
  * Creates a new image resource.
  *
  * @param resource $resource A GD2 resource for an image.
  */
 public function __construct($resource)
 {
     parent::__construct($resource);
 }
 /**
  * Refund a payment.
  * Available $params are:
  * - amount: The amount to refund. The amount must not exceed the maximum
  *           amount of Payment. Can be used for partial refunds. If ommited
  *           then a full refund will be created. [Optional]
  * - description: A description for this refund max 255 chars. [Optional]
  *
  * @param string|stdClass $token A valid payment token returned from a
  *                               successful payment creation.
  * @param array $params
  */
 public static function refund($token, array $params = array())
 {
     $params['token_id'] = $token;
     return parent::invoke(__FUNCTION__, static::RESOURCE_NAME, $params);
 }
 public function __construct($source, array $options = [])
 {
     parent::__construct($source, $options);
 }
示例#9
0
文件: Quote.php 项目: aiesh/magento2
 /**
  * Load quote data by identifier without store
  *
  * @param \Magento\Sales\Model\Quote $quote
  * @param int $quoteId
  * @return $this
  */
 public function loadByIdWithoutStore($quote, $quoteId)
 {
     $read = $this->_getReadAdapter();
     if ($read) {
         $select = parent::_getLoadSelect('entity_id', $quoteId, $quote);
         $data = $read->fetchRow($select);
         if ($data) {
             $quote->setData($data);
         }
     }
     $this->_afterLoad($quote);
     return $this;
 }
示例#10
0
 /**
  * {@inheritdoc}
  */
 public function validate($object)
 {
     //validate attribute set entity type
     $entityType = $this->typeFactory->create()->loadByCode(\Magento\Catalog\Model\Product::ENTITY);
     $attributeSet = $this->setFactory->create()->load($object->getAttributeSetId());
     if ($attributeSet->getEntityTypeId() != $entityType->getId()) {
         return ['attribute_set' => 'Invalid product template entity type'];
     }
     return parent::validate($object);
 }
 /**
  * @param  array $array
  * @param  array $options
  * @return AbstractSignatureRequest
  * @ignore
  */
 public function fromArray($array, $options = array())
 {
     array_key_exists('signers', $array) && $this->setSigners($array['signers']);
     !isset($options['except']) && ($options['except'] = array());
     $options['except'][] = 'signers';
     return parent::fromArray($array, $options);
 }
 /**
  * Delete a customer.
  *
  * @param string|stdClass $token A valid customer token returned from a
  *                               successful customer creation.
  * @return stdClass
  */
 public static function delete($token)
 {
     return parent::delete($token);
 }
示例#13
0
 /**
  * Delete a customer.
  *
  * @param string|stdClass $token A valid customer token returned from a
  *                               successful customer creation.
  * @return stdClass
  */
 public static function delete($token, array $params = array())
 {
     return parent::delete($token, $params);
 }
示例#14
0
 /**
  * Save data related with product
  *
  * @param \Magento\Framework\Object $product
  * @return $this
  */
 protected function _afterSave(\Magento\Framework\Object $product)
 {
     $this->_saveWebsiteIds($product)->_saveCategories($product);
     return parent::_afterSave($product);
 }
示例#15
0
 /**
  * @param  stdClass $array
  * @param  array $options
  * @return Template
  * @ignore
  */
 public function fromArray($array, $options = array())
 {
     !isset($options['except']) && ($options['except'] = array());
     $options['except'][] = 'named_form_fields';
     return parent::fromArray($array, $options);
 }
示例#16
0
 /**
  * Updates an existing schedule.
  *
  * Available params are:
  * - description:       A string 255 chars max for schedule description. [Required]
  * - schedule_type:     String, one of "percentage" or "amount" [Required]
  * - schedule_rates:    Percentage rates separated with ";" when
  *                      schedule_type is "percentage". Each rate must be an
  *                      integer with sum not over 100. [Required]
  * - schedule_dates:    Dates separated with ";" char. Dates must be in ISO 8601 format. [Required]
  *
  * {@inheritdoc}
  *
  */
 public static function update($token, array $params)
 {
     return parent::update($token, $params);
 }
示例#17
0
 /**
  * Create a new payment object.
  *
  * Available params are:
  * - amount: The amount in cents for the payment. [Required]
  * For direct payment with credit / debit cards, card info are required.
  * - card_number:       A valid credit /debit card number. [Required]
  * - expiration_month:  Integer representation of month. [Required]
  * - expiration_year:   Integer represantation of a valid expiration year. [Required]
  * - cvv:               Card verification value. Three or four (American express) digits. [Required]
  * - holder_name:       First and last name of the card holder. [Required]
  * For payments with card token, a valid card token required. Card tokens
  * can be obtained from Token::create api calls.
  * - token [Required].
  * Optional params.
  * - currency:      The ISO 4217 code currency used for this payment. [Optional]
  * - description:   A decription for this payment max 255 chars. [Optional]
  * - payee_email:   Customer email. [Optional]
  * - payee_phone:   Customer phone number. [Optional]
  * - capture:       Boolean Whether to capture a payment or just authorize it.
  *                  To authorize a payment this value must be 0.
  * - create_customer: Boolean Whether to create a customer and store its
  *                    card or not.
  * - installments: Integer The number of installments for this payment.
  *                 Can only be used for credit card payments.
  * - max_installments: Integer Used for payments with token, to validate
  *                      max installments set by the merchant from
  *                      everypay Button.
  *
  * @param array $params
  * @return stdClass
  */
 public static function create(array $params)
 {
     return parent::create($params);
 }
 /**
  * Adds an API resource to the client.
  *
  * @param   AbstractResource    $resource
  * @return  self
  */
 protected function addResource(AbstractResource $resource)
 {
     $this->resources[$resource->getKey()] = $resource;
     return $this;
 }
示例#19
0
 /**
  * Process category data after save category object
  * save related products ids and update path value
  *
  * @param \Magento\Framework\Object $object
  * @return $this
  */
 protected function _afterSave(\Magento\Framework\Object $object)
 {
     /**
      * Add identifier for new category
      */
     if (substr($object->getPath(), -1) == '/') {
         $object->setPath($object->getPath() . $object->getId());
         $this->_savePath($object);
     }
     $this->_saveCategoryProducts($object);
     return parent::_afterSave($object);
 }
示例#20
0
 /**
  *	Constructor
  *
  *	Used to reset the endpoint for the BuzzAdapter
  *
  *	@param mixed  $adapter 		Adpater chosen during initialization
  *	@param int    $workspace 	Workspace used for reports
  *	@param string $user_agent 	Require User Agento
  */
 public function __construct($adapter, $workspace)
 {
     $this->workspace = $workspace;
     parent::__construct($adapter, 'https://toggl.com/reports/api/v2');
 }
示例#21
0
 /**
  * Constructor
  *
  * @param  mixed $options
  * @return void
  */
 public function __construct($options = null)
 {
     $this->_bootstraps = new \ArrayObject(array(), \ArrayObject::ARRAY_AS_PROPS);
     parent::__construct($options);
 }
示例#22
0
 /**
  * @param  stdClass $array
  * @param  array $options
  * @return Team
  * @ignore
  */
 public function fromArray($array, $options = array())
 {
     array_key_exists('accounts', $array) && $this->setAccounts($array['accounts']);
     array_key_exists('invited_accounts', $array) && $this->setInvitedAccounts($array['invited_accounts']);
     !isset($options['except']) && ($options['except'] = array());
     $options['except'] = array_merge($options['except'], array('accounts', 'invited_accounts'));
     return parent::fromArray($array, $options);
 }