| 1 |
<?php |
| 2 |
/** |
| 3 |
* POS payment gateway adapter interface. |
| 4 |
* |
| 5 |
* @package WCPOS\WooCommercePOS\Payments |
| 6 |
*/ |
| 7 |
|
| 8 |
namespace WCPOS\WooCommercePOS\Payments; |
| 9 |
|
| 10 |
\defined( 'ABSPATH' ) || die; |
| 11 |
|
| 12 |
use WC_Order; |
| 13 |
use WP_REST_Request; |
| 14 |
|
| 15 |
/** |
| 16 |
* Declares the POS-facing payment gateway adapter contract. |
| 17 |
*/ |
| 18 |
interface Gateway_Adapter_Interface { |
| 19 |
/** |
| 20 |
* Provider family identifier. |
| 21 |
* |
| 22 |
* @param WP_REST_Request|null $request Request object. |
| 23 |
*/ |
| 24 |
public function get_pos_provider( ?WP_REST_Request $request = null ): string; |
| 25 |
|
| 26 |
/** |
| 27 |
* POS handling type. |
| 28 |
* |
| 29 |
* @param WP_REST_Request|null $request Request object. |
| 30 |
*/ |
| 31 |
public function get_pos_type( ?WP_REST_Request $request = null ): string; |
| 32 |
|
| 33 |
/** |
| 34 |
* Provider-specific public metadata. |
| 35 |
* |
| 36 |
* @param WP_REST_Request|null $request Request object. |
| 37 |
*/ |
| 38 |
public function get_pos_provider_data( ?WP_REST_Request $request = null ): array; |
| 39 |
|
| 40 |
/** |
| 41 |
* Whether the gateway supports the POS checkout flow. |
| 42 |
* |
| 43 |
* @param WP_REST_Request|null $request Request object. |
| 44 |
*/ |
| 45 |
public function supports_pos_checkout( ?WP_REST_Request $request = null ): bool; |
| 46 |
|
| 47 |
/** |
| 48 |
* Whether POS may initiate automatic refunds for this gateway. |
| 49 |
* |
| 50 |
* @param WP_REST_Request|null $request Request object. |
| 51 |
*/ |
| 52 |
public function supports_pos_automatic_refunds( ?WP_REST_Request $request = null ): bool; |
| 53 |
|
| 54 |
/** |
| 55 |
* Whether POS may initiate provider refunds for this gateway. |
| 56 |
* |
| 57 |
* @param WP_REST_Request|null $request Request object. |
| 58 |
*/ |
| 59 |
public function supports_pos_provider_refunds( ?WP_REST_Request $request = null ): bool; |
| 60 |
|
| 61 |
/** |
| 62 |
* Bootstrap response for the POS app. |
| 63 |
* |
| 64 |
* @param array $context Bootstrap context. |
| 65 |
* @param WP_REST_Request|null $request Request object. |
| 66 |
*/ |
| 67 |
public function get_pos_bootstrap_response( array $context, ?WP_REST_Request $request = null ): array; |
| 68 |
|
| 69 |
/** |
| 70 |
* Process a POS checkout action. |
| 71 |
* |
| 72 |
* @param array $state Checkout state. |
| 73 |
* @param string $action Checkout action. |
| 74 |
* @param array $payment_data Payment data. |
| 75 |
* @param WC_Order $order Order object. |
| 76 |
* @param WP_REST_Request|null $request Request object. |
| 77 |
* |
| 78 |
* @return array|\WP_Error |
| 79 |
*/ |
| 80 |
public function process_pos_checkout_action( array $state, string $action, array $payment_data, WC_Order $order, ?WP_REST_Request $request = null ); |
| 81 |
} |
| 82 |
|