| 1 |
<?php |
| 2 |
|
| 3 |
namespace Booktics\Payment\Contracts; |
| 4 |
|
| 5 |
use Booktics\Models\Order_Model; |
| 6 |
|
| 7 |
/** |
| 8 |
* Interface for a payment method. |
| 9 |
* |
| 10 |
* A payment method is an object that encapsulates all of the data and |
| 11 |
* behavior associated with a particular payment method. It must |
| 12 |
* implement the methods defined by this interface. |
| 13 |
* |
| 14 |
* @package Booktics\Core\Payment\Contracts |
| 15 |
*/ |
| 16 |
interface Payment_Method_Interface { |
| 17 |
|
| 18 |
/** |
| 19 |
* Get the unique identifier for this payment method |
| 20 |
* |
| 21 |
* @return string |
| 22 |
*/ |
| 23 |
public function get_id(): string; |
| 24 |
|
| 25 |
/** |
| 26 |
* Get the display name of the payment method |
| 27 |
* |
| 28 |
* @return string |
| 29 |
*/ |
| 30 |
public function get_name(): string; |
| 31 |
|
| 32 |
/** |
| 33 |
* Process the payment |
| 34 |
* |
| 35 |
* @return \WP_Error|array Result of payment processing |
| 36 |
*/ |
| 37 |
public function process_payment( $order ); |
| 38 |
|
| 39 |
/** |
| 40 |
* Validate payment data before processing |
| 41 |
* |
| 42 |
* @return \WP_Error|bool |
| 43 |
*/ |
| 44 |
public function validate_payment_data(); |
| 45 |
|
| 46 |
/** |
| 47 |
* Get payment status |
| 48 |
* |
| 49 |
* @param $order |
| 50 |
* |
| 51 |
* @return string |
| 52 |
*/ |
| 53 |
public function get_payment_status( $order ): string; |
| 54 |
|
| 55 |
/** |
| 56 |
* Process a refund through Stripe. |
| 57 |
* |
| 58 |
* @param Order_Model $order The order to process refund for |
| 59 |
*/ |
| 60 |
public function process_refund( $order ); |
| 61 |
} |
| 62 |
|