<?php
 namespace Stripe; class Invoice extends ApiResource { const OBJECT_NAME = 'invoice'; use ApiOperations\All; use ApiOperations\Create; use ApiOperations\Delete; use ApiOperations\Retrieve; use ApiOperations\Search; use ApiOperations\Update; const BILLING_CHARGE_AUTOMATICALLY = 'charge_automatically'; const BILLING_SEND_INVOICE = 'send_invoice'; const BILLING_REASON_MANUAL = 'manual'; const BILLING_REASON_QUOTE_ACCEPT = 'quote_accept'; const BILLING_REASON_SUBSCRIPTION = 'subscription'; const BILLING_REASON_SUBSCRIPTION_CREATE = 'subscription_create'; const BILLING_REASON_SUBSCRIPTION_CYCLE = 'subscription_cycle'; const BILLING_REASON_SUBSCRIPTION_THRESHOLD = 'subscription_threshold'; const BILLING_REASON_SUBSCRIPTION_UPDATE = 'subscription_update'; const BILLING_REASON_UPCOMING = 'upcoming'; const COLLECTION_METHOD_CHARGE_AUTOMATICALLY = 'charge_automatically'; const COLLECTION_METHOD_SEND_INVOICE = 'send_invoice'; const STATUS_DELETED = 'deleted'; const STATUS_DRAFT = 'draft'; const STATUS_OPEN = 'open'; const STATUS_PAID = 'paid'; const STATUS_UNCOLLECTIBLE = 'uncollectible'; const STATUS_VOID = 'void'; use ApiOperations\NestedResource; const PATH_LINES = '/lines'; public static function allLines($id, $params = null, $opts = null) { return self::_allNestedResources($id, static::PATH_LINES, $params, $opts); } public function finalizeInvoice($params = null, $opts = null) { $url = $this->instanceUrl() . '/finalize'; list($response, $opts) = $this->_request('post', $url, $params, $opts); $this->refreshFrom($response, $opts); return $this; } public function markUncollectible($params = null, $opts = null) { $url = $this->instanceUrl() . '/mark_uncollectible'; list($response, $opts) = $this->_request('post', $url, $params, $opts); $this->refreshFrom($response, $opts); return $this; } public function pay($params = null, $opts = null) { $url = $this->instanceUrl() . '/pay'; list($response, $opts) = $this->_request('post', $url, $params, $opts); $this->refreshFrom($response, $opts); return $this; } public function sendInvoice($params = null, $opts = null) { $url = $this->instanceUrl() . '/send'; list($response, $opts) = $this->_request('post', $url, $params, $opts); $this->refreshFrom($response, $opts); return $this; } public static function upcoming($params = null, $opts = null) { $url = static::classUrl() . '/upcoming'; list($response, $opts) = static::_staticRequest('get', $url, $params, $opts); $obj = \Stripe\Util\Util::convertToStripeObject($response->json, $opts); $obj->setLastResponse($response); return $obj; } public function voidInvoice($params = null, $opts = null) { $url = $this->instanceUrl() . '/void'; list($response, $opts) = $this->_request('post', $url, $params, $opts); $this->refreshFrom($response, $opts); return $this; } public static function search($params = null, $opts = null) { $url = '/v1/invoices/search'; return self::_searchResource($url, $params, $opts); } } 