Ejemplo n.º 1
0
 /**
  * Make a request and convert to Stripe object.
  *
  * @param  string             $method
  * @param  array              $params
  * @param  array|string|null  $options
  *
  * @return self|\Arcanedev\Stripe\StripeObject|\Arcanedev\Stripe\StripeResource|array|
  */
 private function requestAndConvertToStripeObject($method, $params, $options)
 {
     list($url, $params) = $this->extractPathAndUpdateParams($params);
     list($response, $opts) = $this->request($method, $url, $params, $options);
     $this->setRequestParams($params);
     return Util::convertToStripeObject($response, $opts);
 }
Ejemplo n.º 2
0
 /**
  * Retrieve Upcoming Invoice.
  * @link   https://stripe.com/docs/api/php#retrieve_customer_invoice
  *
  * @param  array|null         $params
  * @param  array|string|null  $options
  *
  * @return self|array
  */
 public static function upcoming($params = [], $options = null)
 {
     /** @var \Arcanedev\Stripe\Http\Response $response */
     list($response, $opts) = self::staticRequest('get', self::classUrl(get_class()) . '/upcoming', $params, $options);
     $object = Util::convertToStripeObject($response->getJson(), $opts);
     $object->setLastResponse($response);
     return $object;
 }
Ejemplo n.º 3
0
 /**
  * Return an order.
  * @link   https://stripe.com/docs/api/php#return_order
  *
  * @param  array|null         $params
  * @param  array|string|null  $options
  *
  * @return \Arcanedev\Stripe\Resources\OrderReturn|array
  */
 public function returnOrder($params = [], $options = null)
 {
     list($response, $options) = $this->request('post', $this->instanceUrl() . '/returns', $params, $options);
     return Util::convertToStripeObject($response, $options);
 }
Ejemplo n.º 4
0
 /**
  * Construct Value.
  *
  * @param  string                                                   $key
  * @param  mixed                                                    $value
  * @param  \Arcanedev\Stripe\Http\RequestOptions|array|string|null  $options
  *
  * @return self|\Arcanedev\Stripe\StripeResource|\Arcanedev\Stripe\Collection|array
  */
 private function constructValue($key, $value, $options)
 {
     return self::$nestedUpdatableAttributes->includes($key) && is_array($value) ? self::scopedConstructFrom(AttachedObject::class, $value, $options) : Util::convertToStripeObject($value, $options);
 }
Ejemplo n.º 5
0
 /**
  * Update scope.
  *
  * @param  string             $id
  * @param  array|null         $params
  * @param  array|string|null  $options
  *
  * @return self
  *
  * @throws \Arcanedev\Stripe\Exceptions\InvalidArgumentException
  */
 protected static function scopedUpdate($id, $params = null, $options = null)
 {
     self::checkArguments($params, $options);
     /** @var \Arcanedev\Stripe\Http\Response $response */
     list($response, $opts) = static::staticRequest('post', static::resourceUrl($id), $params, $options);
     $object = Util::convertToStripeObject($response->getJson(), $opts);
     $object->setLastResponse($response);
     return $object;
 }