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