/** * Detect, if we are using WC 2.0+ * * @return bool */ public static function is_wc_2() { if (is_bool(self::$is_wc_2)) { return self::$is_wc_2; } return self::$is_wc_2 = version_compare(self::get_wc_version_constant(), '2.0', '>='); }
/** * Add debug log message * * @since 1.1 * @param string $message */ public static function add_debug_log($message) { if (!is_object(self::$log)) { self::$log = WC_Compat_iPay88::get_wc_logger(); } self::$log->add('ipay88', $message); }
/** * Check the Payment method is submitted and is valid * * @global type $woocommerce * @param type $payment_type */ private function check_payment_fields($payment_type = '0') { // Check only if there are available payment types if ('ID' == $this->gateway) { if (!empty($this->paymenttype_available_ph)) { if ('0' == $payment_type) { WC_Compat_iPay88::wc_add_notice(__('Payment type is required.', 'wc_ipay88'), 'error'); return; } if (!in_array($payment_type, $this->paymenttype_available_ph)) { WC_Compat_iPay88::wc_add_notice(__('Wrong payment type. Please try again.', 'wc_ipay88'), 'error'); return; } } } else { if (!empty($this->paymenttype_available)) { if ('0' == $payment_type) { WC_Compat_iPay88::wc_add_notice(__('Payment type is required.', 'wc_ipay88'), 'error'); return; } if (!in_array($payment_type, $this->paymenttype_available)) { WC_Compat_iPay88::wc_add_notice(__('Wrong payment type. Please try again.', 'wc_ipay88'), 'error'); return; } } } }