Configuration.php
1 year ago
ConnectionToken.php
1 year ago
Location.php
1 year ago
Reader.php
1 year ago
Reader.php
204 lines
| 1 | <?php |
| 2 | |
| 3 | // File generated from our OpenAPI spec |
| 4 | namespace WPForms\Vendor\Stripe\Terminal; |
| 5 | |
| 6 | /** |
| 7 | * A Reader represents a physical device for accepting payment details. |
| 8 | * |
| 9 | * Related guide: <a href="https://stripe.com/docs/terminal/payments/connect-reader">Connecting to a reader</a> |
| 10 | * |
| 11 | * @property string $id Unique identifier for the object. |
| 12 | * @property string $object String representing the object's type. Objects of the same type share the same value. |
| 13 | * @property null|\Stripe\StripeObject $action The most recent action performed by the reader. |
| 14 | * @property null|string $device_sw_version The current software version of the reader. |
| 15 | * @property string $device_type Type of reader, one of <code>bbpos_wisepad3</code>, <code>stripe_m2</code>, <code>stripe_s700</code>, <code>bbpos_chipper2x</code>, <code>bbpos_wisepos_e</code>, <code>verifone_P400</code>, <code>simulated_wisepos_e</code>, or <code>mobile_phone_reader</code>. |
| 16 | * @property null|string $ip_address The local IP address of the reader. |
| 17 | * @property string $label Custom label given to the reader for easier identification. |
| 18 | * @property bool $livemode Has the value <code>true</code> if the object exists in live mode or the value <code>false</code> if the object exists in test mode. |
| 19 | * @property null|string|\Stripe\Terminal\Location $location The location identifier of the reader. |
| 20 | * @property \Stripe\StripeObject $metadata Set of <a href="https://stripe.com/docs/api/metadata">key-value pairs</a> that you can attach to an object. This can be useful for storing additional information about the object in a structured format. |
| 21 | * @property string $serial_number Serial number of the reader. |
| 22 | * @property null|string $status The networking status of the reader. We do not recommend using this field in flows that may block taking payments. |
| 23 | */ |
| 24 | class Reader extends \WPForms\Vendor\Stripe\ApiResource |
| 25 | { |
| 26 | const OBJECT_NAME = 'terminal.reader'; |
| 27 | use \WPForms\Vendor\Stripe\ApiOperations\Update; |
| 28 | const DEVICE_TYPE_BBPOS_CHIPPER2X = 'bbpos_chipper2x'; |
| 29 | const DEVICE_TYPE_BBPOS_WISEPAD3 = 'bbpos_wisepad3'; |
| 30 | const DEVICE_TYPE_BBPOS_WISEPOS_E = 'bbpos_wisepos_e'; |
| 31 | const DEVICE_TYPE_MOBILE_PHONE_READER = 'mobile_phone_reader'; |
| 32 | const DEVICE_TYPE_SIMULATED_WISEPOS_E = 'simulated_wisepos_e'; |
| 33 | const DEVICE_TYPE_STRIPE_M2 = 'stripe_m2'; |
| 34 | const DEVICE_TYPE_STRIPE_S700 = 'stripe_s700'; |
| 35 | const DEVICE_TYPE_VERIFONE_P400 = 'verifone_P400'; |
| 36 | const STATUS_OFFLINE = 'offline'; |
| 37 | const STATUS_ONLINE = 'online'; |
| 38 | /** |
| 39 | * Creates a new <code>Reader</code> object. |
| 40 | * |
| 41 | * @param null|array $params |
| 42 | * @param null|array|string $options |
| 43 | * |
| 44 | * @throws \Stripe\Exception\ApiErrorException if the request fails |
| 45 | * |
| 46 | * @return \Stripe\Terminal\Reader the created resource |
| 47 | */ |
| 48 | public static function create($params = null, $options = null) |
| 49 | { |
| 50 | self::_validateParams($params); |
| 51 | $url = static::classUrl(); |
| 52 | list($response, $opts) = static::_staticRequest('post', $url, $params, $options); |
| 53 | $obj = \WPForms\Vendor\Stripe\Util\Util::convertToStripeObject($response->json, $opts); |
| 54 | $obj->setLastResponse($response); |
| 55 | return $obj; |
| 56 | } |
| 57 | /** |
| 58 | * Deletes a <code>Reader</code> object. |
| 59 | * |
| 60 | * @param null|array $params |
| 61 | * @param null|array|string $opts |
| 62 | * |
| 63 | * @throws \Stripe\Exception\ApiErrorException if the request fails |
| 64 | * |
| 65 | * @return \Stripe\Terminal\Reader the deleted resource |
| 66 | */ |
| 67 | public function delete($params = null, $opts = null) |
| 68 | { |
| 69 | self::_validateParams($params); |
| 70 | $url = $this->instanceUrl(); |
| 71 | list($response, $opts) = $this->_request('delete', $url, $params, $opts); |
| 72 | $this->refreshFrom($response, $opts); |
| 73 | return $this; |
| 74 | } |
| 75 | /** |
| 76 | * Returns a list of <code>Reader</code> objects. |
| 77 | * |
| 78 | * @param null|array $params |
| 79 | * @param null|array|string $opts |
| 80 | * |
| 81 | * @throws \Stripe\Exception\ApiErrorException if the request fails |
| 82 | * |
| 83 | * @return \Stripe\Collection<\Stripe\Terminal\Reader> of ApiResources |
| 84 | */ |
| 85 | public static function all($params = null, $opts = null) |
| 86 | { |
| 87 | $url = static::classUrl(); |
| 88 | return static::_requestPage($url, \WPForms\Vendor\Stripe\Collection::class, $params, $opts); |
| 89 | } |
| 90 | /** |
| 91 | * Retrieves a <code>Reader</code> object. |
| 92 | * |
| 93 | * @param array|string $id the ID of the API resource to retrieve, or an options array containing an `id` key |
| 94 | * @param null|array|string $opts |
| 95 | * |
| 96 | * @throws \Stripe\Exception\ApiErrorException if the request fails |
| 97 | * |
| 98 | * @return \Stripe\Terminal\Reader |
| 99 | */ |
| 100 | public static function retrieve($id, $opts = null) |
| 101 | { |
| 102 | $opts = \WPForms\Vendor\Stripe\Util\RequestOptions::parse($opts); |
| 103 | $instance = new static($id, $opts); |
| 104 | $instance->refresh(); |
| 105 | return $instance; |
| 106 | } |
| 107 | /** |
| 108 | * Updates a <code>Reader</code> object by setting the values of the parameters |
| 109 | * passed. Any parameters not provided will be left unchanged. |
| 110 | * |
| 111 | * @param string $id the ID of the resource to update |
| 112 | * @param null|array $params |
| 113 | * @param null|array|string $opts |
| 114 | * |
| 115 | * @throws \Stripe\Exception\ApiErrorException if the request fails |
| 116 | * |
| 117 | * @return \Stripe\Terminal\Reader the updated resource |
| 118 | */ |
| 119 | public static function update($id, $params = null, $opts = null) |
| 120 | { |
| 121 | self::_validateParams($params); |
| 122 | $url = static::resourceUrl($id); |
| 123 | list($response, $opts) = static::_staticRequest('post', $url, $params, $opts); |
| 124 | $obj = \WPForms\Vendor\Stripe\Util\Util::convertToStripeObject($response->json, $opts); |
| 125 | $obj->setLastResponse($response); |
| 126 | return $obj; |
| 127 | } |
| 128 | /** |
| 129 | * @param null|array $params |
| 130 | * @param null|array|string $opts |
| 131 | * |
| 132 | * @throws \Stripe\Exception\ApiErrorException if the request fails |
| 133 | * |
| 134 | * @return \Stripe\Terminal\Reader the canceled reader |
| 135 | */ |
| 136 | public function cancelAction($params = null, $opts = null) |
| 137 | { |
| 138 | $url = $this->instanceUrl() . '/cancel_action'; |
| 139 | list($response, $opts) = $this->_request('post', $url, $params, $opts); |
| 140 | $this->refreshFrom($response, $opts); |
| 141 | return $this; |
| 142 | } |
| 143 | /** |
| 144 | * @param null|array $params |
| 145 | * @param null|array|string $opts |
| 146 | * |
| 147 | * @throws \Stripe\Exception\ApiErrorException if the request fails |
| 148 | * |
| 149 | * @return \Stripe\Terminal\Reader the processed reader |
| 150 | */ |
| 151 | public function processPaymentIntent($params = null, $opts = null) |
| 152 | { |
| 153 | $url = $this->instanceUrl() . '/process_payment_intent'; |
| 154 | list($response, $opts) = $this->_request('post', $url, $params, $opts); |
| 155 | $this->refreshFrom($response, $opts); |
| 156 | return $this; |
| 157 | } |
| 158 | /** |
| 159 | * @param null|array $params |
| 160 | * @param null|array|string $opts |
| 161 | * |
| 162 | * @throws \Stripe\Exception\ApiErrorException if the request fails |
| 163 | * |
| 164 | * @return \Stripe\Terminal\Reader the processed reader |
| 165 | */ |
| 166 | public function processSetupIntent($params = null, $opts = null) |
| 167 | { |
| 168 | $url = $this->instanceUrl() . '/process_setup_intent'; |
| 169 | list($response, $opts) = $this->_request('post', $url, $params, $opts); |
| 170 | $this->refreshFrom($response, $opts); |
| 171 | return $this; |
| 172 | } |
| 173 | /** |
| 174 | * @param null|array $params |
| 175 | * @param null|array|string $opts |
| 176 | * |
| 177 | * @throws \Stripe\Exception\ApiErrorException if the request fails |
| 178 | * |
| 179 | * @return \Stripe\Terminal\Reader the refunded reader |
| 180 | */ |
| 181 | public function refundPayment($params = null, $opts = null) |
| 182 | { |
| 183 | $url = $this->instanceUrl() . '/refund_payment'; |
| 184 | list($response, $opts) = $this->_request('post', $url, $params, $opts); |
| 185 | $this->refreshFrom($response, $opts); |
| 186 | return $this; |
| 187 | } |
| 188 | /** |
| 189 | * @param null|array $params |
| 190 | * @param null|array|string $opts |
| 191 | * |
| 192 | * @throws \Stripe\Exception\ApiErrorException if the request fails |
| 193 | * |
| 194 | * @return \Stripe\Terminal\Reader the seted reader |
| 195 | */ |
| 196 | public function setReaderDisplay($params = null, $opts = null) |
| 197 | { |
| 198 | $url = $this->instanceUrl() . '/set_reader_display'; |
| 199 | list($response, $opts) = $this->_request('post', $url, $params, $opts); |
| 200 | $this->refreshFrom($response, $opts); |
| 201 | return $this; |
| 202 | } |
| 203 | } |
| 204 |