| 1 |
<?php |
| 2 |
/** |
| 3 |
* Payment method service interface |
| 4 |
* |
| 5 |
* @package SeQura/WC |
| 6 |
* @subpackage SeQura/WC/Services |
| 7 |
*/ |
| 8 |
|
| 9 |
namespace SeQura\WC\Services\Payment; |
| 10 |
|
| 11 |
use SeQura\Core\BusinessLogic\Domain\Order\Models\SeQuraForm; |
| 12 |
use SeQura\WC\Dto\Payment_Method_Data; |
| 13 |
use SeQura\WC\Dto\Payment_Method_Option; |
| 14 |
use WC_Order; |
| 15 |
|
| 16 |
/** |
| 17 |
* Handle use cases related to payment methods |
| 18 |
*/ |
| 19 |
interface Interface_Payment_Method_Service { |
| 20 |
|
| 21 |
/** |
| 22 |
* Get identification form |
| 23 |
*/ |
| 24 |
public function get_identification_form( WC_Order $order ): ?SeQuraForm; |
| 25 |
|
| 26 |
/** |
| 27 |
* Get payment methods |
| 28 |
* |
| 29 |
* @return Payment_Method_Option[] |
| 30 |
*/ |
| 31 |
public function get_payment_methods( ?WC_Order $order = null ); |
| 32 |
|
| 33 |
/** |
| 34 |
* Check if the payment method data matches a valid payment method. |
| 35 |
*/ |
| 36 |
public function is_payment_method_data_valid( ?Payment_Method_Data $data ): bool; |
| 37 |
|
| 38 |
/** |
| 39 |
* Check if the current page is the order pay page |
| 40 |
*/ |
| 41 |
public function is_order_pay_page(): bool; |
| 42 |
|
| 43 |
/** |
| 44 |
* Check if the current page is the checkout page |
| 45 |
*/ |
| 46 |
public function is_checkout(): bool; |
| 47 |
|
| 48 |
/** |
| 49 |
* Check if payment method selection is delegated to the seQura checkout form. |
| 50 |
* |
| 51 |
* When truthy, the seQura form URL will include `product=tbs` and shoppers are |
| 52 |
* redirected to the seQura-hosted selection form instead of selecting on the |
| 53 |
* merchant's checkout page. |
| 54 |
* |
| 55 |
* Controlled by the `sequra_delegate_payment_method_selection` WordPress filter: |
| 56 |
* add_filter( 'sequra_delegate_payment_method_selection', '__return_true' ); |
| 57 |
* The filter receives `(bool $enabled, ?\WC_Order $order)`. |
| 58 |
*/ |
| 59 |
public function is_delegated_payment_selection( ?WC_Order $order = null ): bool; |
| 60 |
} |
| 61 |
|