PluginProbe ʕ •ᴥ•ʔ
WooCommerce Square / 5.4.3
WooCommerce Square v5.4.3
5.4.3 5.4.2 5.4.1 5.4.0 trunk 1.0.25 1.0.26 1.0.27 1.0.28 1.0.29 1.0.30 1.0.31 1.0.32 1.0.33 1.0.34 1.0.35 1.0.36 1.0.37 1.0.38 2.0.0 2.0.1 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 2.0.7 2.0.8 2.1.0 2.1.1 2.1.2 2.1.3 2.1.4 2.1.5 2.1.6 2.2.0 2.2.1 2.2.2 2.2.3 2.2.4 2.2.5 2.3.0 2.3.1 2.3.2 2.3.3 2.3.4 2.4.0 2.4.1 2.5.0 2.5.1 2.5.2 2.5.3 2.6.0 2.7.0 2.8.0 2.9.0 2.9.1 3.0.0 3.0.1 3.0.2 3.0.3 3.1.0 3.2.0 3.3.0 3.4.0 3.4.1 3.4.2 3.5.0 3.6.0 3.6.1 3.7.0 3.7.1 3.8.0 3.8.1 3.8.2 3.8.3 3.9.0 4.0.0 4.1.0 4.2.0 4.2.1 4.2.2 4.2.3 4.3.0 4.3.1 4.3.2 4.4.0 4.4.1 4.4.2 4.5.0 4.5.1 4.5.2 4.6.0 4.6.1 4.6.2 4.6.3 4.6.4 4.7.0 4.7.1 4.7.2 4.7.3 4.7.4 4.8.0 4.8.1 4.8.2 4.8.3 4.8.4 4.8.5 4.8.6 4.8.7 4.8.8 4.9.0 4.9.1 4.9.2 4.9.3 4.9.4 4.9.5 4.9.6 4.9.7 4.9.8 4.9.9 5.0.0 5.0.1 5.1.0 5.1.1 5.1.2 5.2.0 5.3.0 5.3.1 5.3.2 5.3.3
woocommerce-square / includes / Framework / PaymentGateway / Api / Payment_Gateway_Api.php
woocommerce-square / includes / Framework / PaymentGateway / Api Last commit date
Payment_Gateway_API_Response.php 3 years ago Payment_Gateway_Api.php 2 years ago Payment_Gateway_Api_Authorization_Response.php 2 years ago Payment_Gateway_Api_Create_Payment_Token_Response.php 3 years ago Payment_Gateway_Api_Customer_Response.php 3 years ago Payment_Gateway_Api_Get_Tokenized_Payment_Methods_Response.php 3 years ago Payment_Gateway_Api_Response_Message_Helper.php 3 years ago
Payment_Gateway_Api.php
301 lines
1 <?php
2 /**
3 * WooCommerce Payment Gateway Framework
4 *
5 * This source file is subject to the GNU General Public License v3.0
6 * that is bundled with this package in the file license.txt.
7 * It is also available through the world-wide-web at this URL:
8 * http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0 or later
9 * If you did not receive a copy of the license and are unable to
10 * obtain it through the world-wide-web, please send an email
11 * to license@skyverge.com so we can send you a copy immediately.
12 *
13 * @since 3.0.0
14 * @author WooCommerce / SkyVerge
15 * @copyright Copyright (c) 2013-2019, SkyVerge, Inc.
16 * @license http://www.gnu.org/licenses/gpl-3.0.html GNU General Public License v3.0 or later
17 *
18 * Modified by WooCommerce on 15 December 2021.
19 */
20
21 namespace WooCommerce\Square\Framework\PaymentGateway\Api;
22
23 defined( 'ABSPATH' ) || exit;
24
25 /**
26 * WooCommerce Direct Payment Gateway API
27 */
28 interface Payment_Gateway_API {
29
30
31 /**
32 * Perform a credit card authorization for the given order
33 *
34 * If the gateway does not support credit card authorizations, this method can be a no-op.
35 *
36 * @since 3.0.0
37 *
38 * @param \WC_Order $order the order
39 * @return Payment_Gateway_API_Response credit card charge response
40 * @throws \Exception network timeouts, etc
41 */
42 public function credit_card_authorization( \WC_Order $order );
43
44
45 /**
46 * Perform a credit card charge for the given order
47 *
48 * If the gateway does not support credit card charges, this method can be a no-op.
49 *
50 * @since 3.0.0
51 *
52 * @param \WC_Order $order the order
53 * @return Payment_Gateway_API_Response credit card charge response
54 * @throws \Exception network timeouts, etc
55 */
56 public function credit_card_charge( \WC_Order $order );
57
58
59 /**
60 * Perform a credit card capture for a given authorized order
61 *
62 * If the gateway does not support credit card capture, this method can be a no-op.
63 *
64 * @since 3.0.0
65 *
66 * @param \WC_Order $order the order
67 * @return Payment_Gateway_API_Response credit card capture response
68 * @throws \Exception network timeouts, etc
69 */
70 public function credit_card_capture( \WC_Order $order );
71
72 /**
73 * Performs a gift card charge for a given order.
74 *
75 * @since 4.2.0
76 *
77 * @param \WC_Order $order order object
78 * @return \WooCommerce\Square\API\Response
79 */
80 public function gift_card_charge( \WC_Order $order );
81
82 /**
83 * Performs payments when a transaction is done using multiple payment methods.
84 * For example: Gift Card + Square Credit Card.
85 *
86 * @since 4.2.0
87 *
88 * @param array $payment_ids Array of payment IDs.
89 * @param string $order_id Square order ID.
90 */
91 public function pay_order( $payment_ids, $order_id );
92
93 /**
94 * Creates a Gift Card.
95 *
96 * @since 4.2.0
97 *
98 * @param $order_id Line item order ID.
99 * @return API\Responses\Get_Gift_Card
100 */
101 public function create_gift_card( $order_id );
102
103 /**
104 * Activates a Gift Card which is in a pending state.
105 *
106 * @since 4.2.0
107 *
108 * @param string $gift_card_id The ID of the inactive Gift Card.
109 * @param string $order_id Square Order ID associated with the Gift Card.
110 * @param string $line_item_id Line Item ID for the Gift Card.
111 */
112 public function activate_gift_card( $gift_card_id, $order_id, $line_item_id );
113
114 /**
115 * Loads an existing gift card with an amount.
116 *
117 * @since 4.2.0
118 *
119 * @param string $gan The gift card number.
120 * @param \WC_Order $order WooCommerce order.
121 */
122 public function load_gift_card( $gan, $order );
123
124 /**
125 * Sets data to refund/adjust decrement funds in a gift card.
126 *
127 * @since 4.2.0
128 *
129 * @param string $gan Gift card number.
130 * @param \Square\Models\Money $amount_money The amount to be refunded.
131 * @param \WC_Order $order WooCommerce order.
132 */
133 public function refund_gift_card( $gan, $amount_money, $order );
134
135 /**
136 * Perform an eCheck debit (ACH transaction) for the given order
137 *
138 * If the gateway does not support check debits, this method can be a no-op.
139 *
140 * @since 3.0.0
141 *
142 * @param \WC_Order $order the order
143 * @return Payment_Gateway_API_Response check debit response
144 * @throws \Exception network timeouts, etc
145 */
146 public function check_debit( \WC_Order $order );
147
148
149 /**
150 * Perform a refund for the given order
151 *
152 * If the gateway does not support refunds, this method can be a no-op.
153 *
154 * @since 3.0.0
155 *
156 * @param \WC_Order $order order object
157 * @return Payment_Gateway_API_Response refund response
158 * @throws \Exception network timeouts, etc
159 */
160 public function refund( \WC_Order $order );
161
162
163 /**
164 * Perform a void for the given order
165 *
166 * If the gateway does not support voids, this method can be a no-op.
167 *
168 * @since 3.0.0
169 *
170 * @param \WC_Order $order order object
171 * @return Payment_Gateway_API_Response void response
172 * @throws \Exception network timeouts, etc
173 */
174 public function void( \WC_Order $order );
175
176
177 /**
178 * Creates a payment token for the given order
179 *
180 * If the gateway does not support tokenization, this method can be a no-op.
181 *
182 * @since 3.0.0
183 *
184 * @param \WC_Order $order the order
185 * @return Payment_Gateway_API_Create_Payment_Token_Response payment method tokenization response
186 * @throws \Exception network timeouts, etc
187 */
188 public function tokenize_payment_method( \WC_Order $order );
189
190
191 /**
192 * Updates a tokenized payment method.
193 *
194 * @since 3.0.0
195 *
196 * @param \WC_Order $order order object
197 * @return Payment_Gateway_API_Response
198 * @throws \Exception
199 */
200 public function update_tokenized_payment_method( \WC_Order $order );
201
202
203 /**
204 * Determines if this API supports updating tokenized payment methods.
205 *
206 * @see Payment_Gateway_API::update_tokenized_payment_method()
207 *
208 * @since 3.0.0
209 *
210 * @return bool
211 */
212 public function supports_update_tokenized_payment_method();
213
214
215 /**
216 * Removes the tokenized payment method. This method should not be invoked
217 * unless supports_remove_tokenized_payment_method() returns true, otherwise
218 * the results are undefined.
219 *
220 * @since 3.0.0
221 * @see Payment_Gateway_API::supports_remove_tokenized_payment_method()
222 *
223 * @param string $token the payment method token
224 * @param string $customer_id unique customer id for gateways that support it
225 * @return Payment_Gateway_API_Response remove tokenized payment method response
226 * @throws \Exception network timeouts, etc
227 */
228 public function remove_tokenized_payment_method( $token, $customer_id );
229
230
231 /**
232 * Returns true if this API supports a "remove tokenized payment method"
233 * request. If this method returns true, then remove_tokenized_payment_method()
234 * is considered safe to call.
235 *
236 * @since 3.0.0
237 * @see Payment_Gateway_API::remove_tokenized_payment_method()
238 *
239 * @return boolean true if this API supports a "remove tokenized payment method" request, false otherwise
240 */
241 public function supports_remove_tokenized_payment_method();
242
243
244 /**
245 * Returns all tokenized payment methods for the customer. This method
246 * should not be invoked unless supports_get_tokenized_payment_methods()
247 * return true, otherwise the results are undefined
248 *
249 * @since 3.0.0
250 * @see Payment_Gateway_API::supports_get_tokenized_payment_methods()
251 *
252 * @param string $customer_id unique customer id
253 * @return Payment_Gateway_API_Get_Tokenized_Payment_Methods_Response response containing any payment tokens for the customer
254 * @throws \Exception network timeouts, etc
255 */
256 public function get_tokenized_payment_methods( $customer_id );
257
258
259 /**
260 * Returns true if this API supports a "get tokenized payment methods"
261 * request. If this method returns true, then get_tokenized_payment_methods()
262 * is considered safe to call.
263 *
264 * @since 3.0.0
265 * @see Payment_Gateway_API::get_tokenized_payment_methods()
266 *
267 * @return boolean true if this API supports a "get tokenized payment methods" request, false otherwise
268 */
269 public function supports_get_tokenized_payment_methods();
270
271
272 /**
273 * Returns the most recent request object
274 *
275 * @since 3.0.0
276 *
277 * @return \WooCommerce\Square\Framework\Api\API_Request the most recent request object
278 */
279 public function get_request();
280
281
282 /**
283 * Returns the most recent response object
284 *
285 * @since 3.0.0
286 *
287 * @return Payment_Gateway_API_Response the most recent response object
288 */
289 public function get_response();
290
291
292 /**
293 * Returns the WC_Order object associated with the request, if any
294 *
295 * @since 3.0.0
296 *
297 * @return \WC_Order
298 */
299 public function get_order();
300 }
301