| 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 woocommerce amazon pay with sellkit checkout widget. |
| 11 |
* |
| 12 |
* @since 1.1.0 |
| 13 |
*/ |
| 14 |
class Amazon_Pay_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 |
// Plugin not installed. |
| 23 |
if ( ! class_exists( 'WC_Amazon_Payments_Advanced' ) ) { |
| 24 |
return false; |
| 25 |
} |
| 26 |
|
| 27 |
$this->instance = wc_apa()->get_gateway(); |
| 28 |
|
| 29 |
// Gateway is not active. |
| 30 |
if ( ! $this->instance->is_available() ) { |
| 31 |
return false; |
| 32 |
} |
| 33 |
|
| 34 |
return true; |
| 35 |
} |
| 36 |
|
| 37 |
/** |
| 38 |
* Content of express checkout methods. |
| 39 |
* |
| 40 |
* @return void |
| 41 |
* @since 1.1.0 |
| 42 |
*/ |
| 43 |
public function content() { |
| 44 |
echo '<div class="sellkit-amazon-pay-woocommerce">'; |
| 45 |
echo $this->instance->checkout_button( false ); |
| 46 |
echo '</div>'; |
| 47 |
} |
| 48 |
|
| 49 |
/** |
| 50 |
* Hooks to integrate current gateway with sellkit checkout widget. |
| 51 |
* |
| 52 |
* @return void |
| 53 |
* @since 1.1.0 |
| 54 |
*/ |
| 55 |
public function hooks() { |
| 56 |
remove_action( 'woocommerce_before_checkout_form', [ $this->instance, 'checkout_message' ], 5 ); |
| 57 |
} |
| 58 |
} |
| 59 |
|