| 1 |
<?php |
| 2 |
|
| 3 |
namespace Payplug\PayplugWoocommerce\Front\Layout; |
| 4 |
|
| 5 |
abstract class OneyBase implements InterfaceOneyResources |
| 6 |
{ |
| 7 |
public function __construct() |
| 8 |
{ |
| 9 |
add_action('wp_enqueue_scripts', [self::addOneyCSS()]); |
| 10 |
add_action('wp_enqueue_scripts', [self::addOneyJs()]); |
| 11 |
add_action('wp_enqueue_scripts', [self::addOneyScript()]); |
| 12 |
} |
| 13 |
|
| 14 |
/** |
| 15 |
* @global WP_Scripts $wp_scripts The WP_Scripts object for printing scripts. |
| 16 |
*/ |
| 17 |
public static function addOneyScript(): void |
| 18 |
{ |
| 19 |
wp_localize_script('payplug-oney', 'payplug_config', [ |
| 20 |
'ajax_url' => admin_url('admin-ajax.php'), |
| 21 |
'ajax_action' => 'simulate_oney_payment', |
| 22 |
]); |
| 23 |
} |
| 24 |
|
| 25 |
/** |
| 26 |
* Add CSS |
| 27 |
*/ |
| 28 |
public static function addOneyCSS(): void |
| 29 |
{ |
| 30 |
wp_enqueue_style('payplug-oney', PAYPLUG_GATEWAY_PLUGIN_URL . 'assets/css/payplug-oney.css', [], PAYPLUG_GATEWAY_VERSION); |
| 31 |
} |
| 32 |
|
| 33 |
/** |
| 34 |
* Add JS |
| 35 |
*/ |
| 36 |
public static function addOneyJs(): void |
| 37 |
{ |
| 38 |
wp_enqueue_script('payplug-oney-mobile', PAYPLUG_GATEWAY_PLUGIN_URL . 'assets/js/payplug-detect-mobile.js', [], PAYPLUG_GATEWAY_VERSION, true); |
| 39 |
wp_enqueue_script('payplug-oney', PAYPLUG_GATEWAY_PLUGIN_URL . 'assets/js/payplug-oney.js', [ |
| 40 |
'jquery', |
| 41 |
'jquery-ui-position', |
| 42 |
], PAYPLUG_GATEWAY_VERSION, true); |
| 43 |
} |
| 44 |
|
| 45 |
/** |
| 46 |
* Popup Content for Oney Without fees |
| 47 |
* |
| 48 |
* @param $oney |
| 49 |
* |
| 50 |
* @return mixed |
| 51 |
*/ |
| 52 |
abstract public static function simulationPopupContentWithoutFees($oney); |
| 53 |
|
| 54 |
/** |
| 55 |
* Popup Content for Oney With fees |
| 56 |
* |
| 57 |
* @param $oney |
| 58 |
* |
| 59 |
* @return mixed |
| 60 |
*/ |
| 61 |
abstract public static function simulationPopupContent($oney); |
| 62 |
|
| 63 |
/** |
| 64 |
* Popup footer for Oney without fees |
| 65 |
* |
| 66 |
* @param $min |
| 67 |
* @param $max |
| 68 |
* |
| 69 |
* @return mixed |
| 70 |
*/ |
| 71 |
abstract public static function footerOneyWithoutFees($min, $max); |
| 72 |
|
| 73 |
/** |
| 74 |
* Popup footer for Oney with fees |
| 75 |
* |
| 76 |
* @param $min |
| 77 |
* @param $max |
| 78 |
* |
| 79 |
* @return mixed |
| 80 |
*/ |
| 81 |
abstract public static function footerOneyWithFees($min, $max); |
| 82 |
|
| 83 |
/** |
| 84 |
* disable Oney image on cart |
| 85 |
* |
| 86 |
* @param $oney |
| 87 |
* |
| 88 |
* @return mixed |
| 89 |
*/ |
| 90 |
abstract public static function disabledOneyPopup($oney); |
| 91 |
|
| 92 |
/** |
| 93 |
* Oney image on cart |
| 94 |
* |
| 95 |
* @param $oney |
| 96 |
* |
| 97 |
* @return mixed |
| 98 |
*/ |
| 99 |
abstract public static function payWithOney($oney); |
| 100 |
} |
| 101 |
|