| 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 Plugins Braintree For WooCommerce gateways with sellkit checkout widget. |
| 11 |
* |
| 12 |
* @since 1.1.0 |
| 13 |
*/ |
| 14 |
class Woo_Payment_Gateway 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 defined( 'WC_BRAINTREE_PLUGIN_NAME' ); |
| 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 $id => $gateway ) { |
| 35 |
if ( $gateway->supports( 'wc_braintree_banner_checkout' ) && $gateway->banner_checkout_enabled() ) { |
| 36 |
$gateways[ $id ] = $gateway; |
| 37 |
} |
| 38 |
} |
| 39 |
|
| 40 |
if ( count( $gateways ) > 0 ) { |
| 41 |
foreach ( $gateways as $gateway ) :?> |
| 42 |
<div class="wc-braintree-banner-gateway wc_braintree_banner_gateway_<?php echo esc_attr( $gateway->id ); ?>"> |
| 43 |
<?php $gateway->banner_fields(); ?> |
| 44 |
</div> |
| 45 |
<?php |
| 46 |
endforeach; |
| 47 |
} |
| 48 |
} |
| 49 |
|
| 50 |
/** |
| 51 |
* Hooks to integrate current gateway with sellkit checkout widget. |
| 52 |
* |
| 53 |
* @return void |
| 54 |
* @since 1.1.0 |
| 55 |
*/ |
| 56 |
public function hooks() { |
| 57 |
remove_action( 'woocommerce_checkout_before_customer_details', 'wc_braintree_banner_checkout_template' ); |
| 58 |
} |
| 59 |
} |
| 60 |
|