[ Index ]

PHP Cross Reference of Phabricator

title

Body

[close]

/externals/stripe-php/lib/Stripe/ -> Charge.php (source)

   1  <?php
   2  
   3  class Stripe_Charge extends Stripe_ApiResource
   4  {
   5    /**
   6     * @param string $id The ID of the charge to retrieve.
   7     * @param string|null $apiKey
   8     *
   9     * @return Stripe_Charge
  10     */
  11    public static function retrieve($id, $apiKey=null)
  12    {
  13      $class = get_class();
  14      return self::_scopedRetrieve($class, $id, $apiKey);
  15    }
  16  
  17    /**
  18     * @param array|null $params
  19     * @param string|null $apiKey
  20     *
  21     * @return array An array of Stripe_Charges.
  22     */
  23    public static function all($params=null, $apiKey=null)
  24    {
  25      $class = get_class();
  26      return self::_scopedAll($class, $params, $apiKey);
  27    }
  28  
  29    /**
  30     * @param array|null $params
  31     * @param string|null $apiKey
  32     *
  33     * @return Stripe_Charge The created charge.
  34     */
  35    public static function create($params=null, $apiKey=null)
  36    {
  37      $class = get_class();
  38      return self::_scopedCreate($class, $params, $apiKey);
  39    }
  40  
  41    /**
  42     * @return Stripe_Charge The saved charge.
  43     */
  44    public function save()
  45    {
  46      $class = get_class();
  47      return self::_scopedSave($class);
  48    }
  49  
  50    /**
  51     * @param array|null $params
  52     *
  53     * @return Stripe_Charge The refunded charge.
  54     */
  55    public function refund($params=null)
  56    {
  57      $requestor = new Stripe_ApiRequestor($this->_apiKey);
  58      $url = $this->instanceUrl() . '/refund';
  59      list($response, $apiKey) = $requestor->request('post', $url, $params);
  60      $this->refreshFrom($response, $apiKey);
  61      return $this;
  62    }
  63  
  64    /**
  65     * @param array|null $params
  66     *
  67     * @return Stripe_Charge The captured charge.
  68     */
  69    public function capture($params=null)
  70    {
  71      $requestor = new Stripe_ApiRequestor($this->_apiKey);
  72      $url = $this->instanceUrl() . '/capture';
  73      list($response, $apiKey) = $requestor->request('post', $url, $params);
  74      $this->refreshFrom($response, $apiKey);
  75      return $this;
  76    }
  77  
  78    /**
  79     * @param array|null $params
  80     *
  81     * @return array The updated dispute.
  82     */
  83    public function updateDispute($params=null)
  84    {
  85      $requestor = new Stripe_ApiRequestor($this->_apiKey);
  86      $url = $this->instanceUrl() . '/dispute';
  87      list($response, $apiKey) = $requestor->request('post', $url, $params);
  88      $this->refreshFrom(array('dispute' => $response), $apiKey, true);
  89      return $this->dispute;
  90    }
  91  
  92    /**
  93     * @return Stripe_Charge The updated charge.
  94     */
  95    public function closeDispute()
  96    {
  97      $requestor = new Stripe_ApiRequestor($this->_apiKey);
  98      $url = $this->instanceUrl() . '/dispute/close';
  99      list($response, $apiKey) = $requestor->request('post', $url);
 100      $this->refreshFrom($response, $apiKey);
 101      return $this;
 102    }
 103  }


Generated: Sun Nov 30 09:20:46 2014 Cross-referenced by PHPXref 0.7.1