← All changes
|
src/Controllers/Hooks/Payment/class-payment-controller.php
+17
-8
3.0.2
→
4.1.0
View file →
| @@ -10,9 +10,9 @@ | ||
| 10 | 10 | |
| 11 | 11 | use Automattic\WooCommerce\Blocks\Payments\PaymentMethodRegistry; |
| 12 | 12 | use SeQura\Core\Infrastructure\ServiceRegister; |
| 13 | 13 | use SeQura\WC\Controllers\Controller; |
| 14 | -use SeQura\WC\Services\Interface_Logger_Service; | |
| 14 | +use SeQura\WC\Services\Log\Interface_Logger_Service; | |
| 15 | 15 | use SeQura\WC\Services\Order\Interface_Order_Service; |
| 16 | 16 | use SeQura\WC\Services\Payment\Sequra_Payment_Gateway; |
| 17 | 17 | use SeQura\WC\Services\Payment\Sequra_Payment_Gateway_Block_Support; |
| 18 | 18 | use WC_Order; |
| @@ -46,9 +46,9 @@ | ||
| 46 | 46 | * |
| 47 | 47 | * @param string[] $gateways |
| 48 | 48 | * @return string[] |
| 49 | 49 | */ |
| 50 | - public function register_gateway_classes( $gateways ): array { | |
| 50 | + public function register_gateway_classes( $gateways ) { | |
| 51 | 51 | $this->logger->log_debug( 'Hook executed', __FUNCTION__, __CLASS__ ); |
| 52 | 52 | if ( ! in_array( Sequra_Payment_Gateway::class, $gateways, true ) ) { |
| 53 | 53 | $gateways[] = Sequra_Payment_Gateway::class; |
| 54 | 54 | } |
| @@ -56,18 +56,23 @@ | ||
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | /** |
| 59 | 59 | * Register the payment gateway block so that it can be used by Gutenberg |
| 60 | + * | |
| 61 | + * @return void | |
| 60 | 62 | */ |
| 61 | - public function register_gateway_gutenberg_block(): void { | |
| 63 | + public function register_gateway_gutenberg_block() { | |
| 62 | 64 | $this->logger->log_debug( 'Hook executed', __FUNCTION__, __CLASS__ ); |
| 63 | - add_action( 'woocommerce_blocks_payment_method_type_registration', array( $this, 'register_gateway_gutenberg_block_class' ) ); | |
| 65 | + \add_action( 'woocommerce_blocks_payment_method_type_registration', array( $this, 'register_gateway_gutenberg_block_class' ) ); | |
| 64 | 66 | } |
| 65 | 67 | |
| 66 | 68 | /** |
| 67 | 69 | * Register the payment gateway block class |
| 70 | + * | |
| 71 | + * @param PaymentMethodRegistry $payment_method_registry The payment method registry. | |
| 72 | + * @return void | |
| 68 | 73 | */ |
| 69 | - public function register_gateway_gutenberg_block_class( PaymentMethodRegistry $payment_method_registry ): void { | |
| 74 | + public function register_gateway_gutenberg_block_class( $payment_method_registry ) { | |
| 70 | 75 | $this->logger->log_debug( 'Hook executed', __FUNCTION__, __CLASS__ ); |
| 71 | 76 | $payment_method_registry->register( ServiceRegister::getService( Sequra_Payment_Gateway_Block_Support::class ) ); |
| 72 | 77 | } |
| 73 | 78 | |
| @@ -73,13 +78,15 @@ | ||
| 73 | 78 | |
| 74 | 79 | /** |
| 75 | 80 | * Append text after the thank you message on the order received page |
| 76 | 81 | * |
| 82 | + * @param string $text The text to append. | |
| 77 | 83 | * @param mixed $order The order object. |
| 84 | + * @return string | |
| 78 | 85 | */ |
| 79 | - public function order_received_text( string $text, $order ): string { | |
| 86 | + public function order_received_text( $text, $order ) { | |
| 80 | 87 | $this->logger->log_debug( 'Hook executed', __FUNCTION__, __CLASS__ ); |
| 81 | - $notices = wc_print_notices( true ); | |
| 88 | + $notices = \wc_print_notices( true ); | |
| 82 | 89 | return $notices . $text; |
| 83 | 90 | } |
| 84 | 91 | |
| 85 | 92 | /** |
| @@ -84,11 +91,13 @@ | ||
| 84 | 91 | |
| 85 | 92 | /** |
| 86 | 93 | * Set the proper payment method description in the order |
| 87 | 94 | * |
| 95 | + * @param string $value The payment method title. | |
| 88 | 96 | * @param mixed $order The order object. |
| 97 | + * @return string | |
| 89 | 98 | */ |
| 90 | - public function order_get_payment_method_title( string $value, $order ): string { | |
| 99 | + public function order_get_payment_method_title( $value, $order ) { | |
| 91 | 100 | $this->logger->log_debug( 'Hook executed', __FUNCTION__, __CLASS__ ); |
| 92 | 101 | $sequra_payment_method = $order instanceof WC_Order ? $this->order_service->get_payment_method_title( $order ) : null; |
| 93 | 102 | return empty( $sequra_payment_method ) ? $value : $sequra_payment_method; |
| 94 | 103 | } |