| 1 |
<?php |
| 2 |
|
| 3 |
namespace Sellkit\Elementor\Modules\Checkout\Integrations; |
| 4 |
|
| 5 |
defined( 'ABSPATH' ) || die(); |
| 6 |
|
| 7 |
use Sellkit\Elementor\Modules\Checkout\Integrations\Integration; |
| 8 |
|
| 9 |
/** |
| 10 |
* Integration class to integrate Payment Plugins for Stripe WooCommerce gateway with sellkit checkout widget. |
| 11 |
* |
| 12 |
* @since 1.1.0 |
| 13 |
*/ |
| 14 |
class Stripe_For_Woocommerce extends Integration { |
| 15 |
/** |
| 16 |
* Check requirement to enable gateway in sellkit checkout widget. |
| 17 |
* |
| 18 |
* @return bool |
| 19 |
* @since 1.1.0 |
| 20 |
*/ |
| 21 |
protected function requirements() { |
| 22 |
return class_exists( '\WC_Stripe_Field_Manager' ); |
| 23 |
} |
| 24 |
|
| 25 |
/** |
| 26 |
* Content of express checkout methods. |
| 27 |
* |
| 28 |
* @return void |
| 29 |
* @since 1.1.0 |
| 30 |
*/ |
| 31 |
public function content() { |
| 32 |
$gateways = []; |
| 33 |
|
| 34 |
foreach ( WC()->payment_gateways()->get_available_payment_gateways() as $gateway ) { |
| 35 |
if ( $gateway->supports( 'wc_stripe_banner_checkout' ) && $gateway->banner_checkout_enabled() ) { |
| 36 |
$gateways[ $gateway->id ] = $gateway; |
| 37 |
} |
| 38 |
} |
| 39 |
|
| 40 |
if ( count( $gateways ) > 0 ) { |
| 41 |
echo '<div class="sellkit-stripe-integration"><ul class="wc_stripe_checkout_banner_gateways">'; |
| 42 |
foreach ( $gateways as $gateway ) : |
| 43 |
?> |
| 44 |
<li class="wc-stripe-checkout-banner-gateway banner_payment_method_<?php echo esc_attr( $gateway->id ); ?>"></li> |
| 45 |
<?php |
| 46 |
endforeach; |
| 47 |
echo '</ul></div>'; |
| 48 |
} |
| 49 |
} |
| 50 |
|
| 51 |
/** |
| 52 |
* Hooks to integrate current gateway with sellkit checkout widget. |
| 53 |
* |
| 54 |
* @return void |
| 55 |
* @since 1.1.0 |
| 56 |
*/ |
| 57 |
public function hooks() { |
| 58 |
remove_action( 'woocommerce_checkout_before_customer_details', [ 'WC_Stripe_Field_Manager', 'output_banner_checkout_fields' ] ); |
| 59 |
} |
| 60 |
} |
| 61 |
|