当前位置: 首页>>代码示例>>PHP>>正文


PHP WC_Payment_Gateway::is_available方法代码示例

本文整理汇总了PHP中WC_Payment_Gateway::is_available方法的典型用法代码示例。如果您正苦于以下问题:PHP WC_Payment_Gateway::is_available方法的具体用法?PHP WC_Payment_Gateway::is_available怎么用?PHP WC_Payment_Gateway::is_available使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在WC_Payment_Gateway的用法示例。


在下文中一共展示了WC_Payment_Gateway::is_available方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1:

 /**
  * Amazon Payments Advanced is available if the following conditions are met (on top of WC_Payment_Gateway::is_available)
  * 1) Login App mode is enabled and we have an access token from Amazon
  * 2) Login App mode is *not* enabled and we have an order reference id
  *
  * @return bool
  */
 function is_available()
 {
     $login_app_enabled = 'yes' === $this->enable_login_app;
     $standard_mode_ok = !$login_app_enabled && !empty($this->reference_id);
     $login_app_mode_ok = $login_app_enabled && !empty($this->access_token);
     return parent::is_available() && ($standard_mode_ok || $login_app_mode_ok);
 }
开发者ID:lilweirdward,项目名称:blofishwordpress,代码行数:14,代码来源:class-wc-gateway-amazon-payments-advanced.php

示例2: is_available

 /**
  * Check if this gateway is enabled
  */
 public function is_available()
 {
     if (!$this->api_key || !$this->mid) {
         return false;
     }
     return parent::is_available();
 }
开发者ID:VisionFriendly,项目名称:woocommerce-gateway-arrowpayments,代码行数:10,代码来源:gateway-arrowpayments.php

示例3:

 /**
  * Check if gateway meets all the requirements to be used
  *
  * @access public
  * @return bool
  */
 function is_available()
 {
     // is enabled check
     $is_available = parent::is_available();
     // Required fields check
     if (!$this->customer_api && !$this->customer_password) {
         $is_available = false;
     }
     return apply_filters('woocommerce_eway_is_available', $is_available);
 }
开发者ID:Ezyva2015,项目名称:SMSF-Academy-Wordpress,代码行数:16,代码来源:class-wc-gateway-eway.php

示例4: is_available

 /**
  * Check if the gateway is available for use
  *
  * @return bool
  */
 public function is_available()
 {
     $is_available = parent::is_available();
     // Only allow unencrypted connections when testing
     if (!is_ssl() && !$this->testmode) {
         $is_available = false;
     }
     // Required fields check
     if (!$this->merchant_id || !$this->merchant_password) {
         $is_available = false;
     }
     return $is_available;
 }
开发者ID:strikewood,项目名称:woocommerce-first-atlantic-commerce,代码行数:18,代码来源:class-wc-gateway-fac.php

示例5: is_available

 /**
  * Disables the gateway under any of these conditions:
  * 1) If the cart does not contain a pre-order
  * 2) If the pre-order amount is charged upfront
  * 3) On the pay page
  *
  * @since 1.0
  * @return bool
  */
 public function is_available()
 {
     $is_available = parent::is_available();
     // on checkout page
     if (!is_page(woocommerce_get_page_id('pay')) || defined('WOOCOMMERCE_CHECKOUT') && WOOCOMMERCE_CHECKOUT) {
         // not available if the cart does not contain a pre-order
         if (WC_Pre_Orders_Cart::cart_contains_pre_order()) {
             // not available when the pre-order amount is charged upfront
             if (WC_Pre_Orders_Product::product_is_charged_upfront(WC_Pre_Orders_Cart::get_pre_order_product())) {
                 $is_available = false;
             }
         } else {
             $is_available = false;
         }
     } else {
         // not available on the pay page (for now)
         $is_available = false;
     }
     return $is_available;
 }
开发者ID:shahadat014,项目名称:geleyi,代码行数:29,代码来源:class-wc-pre-orders-gateway-pay-later.php

示例6: is_available

 /**
  * Check If The Gateway Is Available For Use
  *
  * @version 2.5.6
  * @return  bool
  */
 public function is_available()
 {
     // Check min amount
     $min_amount = apply_filters('booster_get_option', 0, $this->min_amount);
     if ($min_amount > 0 && isset(WC()->cart->total) && '' != WC()->cart->total && isset(WC()->cart->fee_total)) {
         $total_excluding_fees = WC()->cart->total - WC()->cart->fee_total;
         if ($total_excluding_fees < $min_amount) {
             return false;
         }
     }
     // Check shipping methods and is virtual
     $order = null;
     if (!$this->enable_for_virtual) {
         if (WC()->cart && !WC()->cart->needs_shipping()) {
             return false;
         }
         if (is_page(wc_get_page_id('checkout')) && 0 < get_query_var('order-pay')) {
             $order_id = absint(get_query_var('order-pay'));
             $order = new WC_Order($order_id);
             // Test if order needs shipping.
             $needs_shipping = false;
             if (0 < sizeof($order->get_items())) {
                 foreach ($order->get_items() as $item) {
                     $_product = $order->get_product_from_item($item);
                     if ($_product->needs_shipping()) {
                         $needs_shipping = true;
                         break;
                     }
                 }
             }
             $needs_shipping = apply_filters('woocommerce_cart_needs_shipping', $needs_shipping);
             if ($needs_shipping) {
                 return false;
             }
         }
     }
     if (!empty($this->enable_for_methods)) {
         // Only apply if all packages are being shipped via ...
         $session_object = WC()->session;
         $chosen_shipping_methods_session = is_object($session_object) ? $session_object->get('chosen_shipping_methods') : null;
         if (isset($chosen_shipping_methods_session)) {
             $chosen_shipping_methods = array_unique($chosen_shipping_methods_session);
         } else {
             $chosen_shipping_methods = array();
         }
         $check_method = false;
         if (is_object($order)) {
             if ($order->shipping_method) {
                 $check_method = $order->shipping_method;
             }
         } elseif (empty($chosen_shipping_methods) || sizeof($chosen_shipping_methods) > 1) {
             $check_method = false;
         } elseif (sizeof($chosen_shipping_methods) == 1) {
             $check_method = $chosen_shipping_methods[0];
         }
         if (!$check_method) {
             return false;
         }
         $found = false;
         foreach ($this->enable_for_methods as $method_id) {
             if (strpos($check_method, $method_id) === 0) {
                 $found = true;
                 break;
             }
         }
         if (!$found) {
             return false;
         }
     }
     return parent::is_available();
 }
开发者ID:algoritmika,项目名称:woocommerce-jetpack,代码行数:77,代码来源:class-wc-gateway-wcj-custom.php

示例7: is_available

 /**
  * Check if the gateway is available for use
  *
  * @return bool
  */
 public function is_available()
 {
     if (!parent::is_available()) {
         return false;
     }
     if (WC()->cart && $this->get_order_total() > 0) {
         // Validate min amount
         if (0 < $this->min_amount && $this->min_amount > $this->get_order_total()) {
             return false;
         }
         // Validate max amount
         if (0 < $this->max_amount && $this->max_amount < $this->get_order_total()) {
             return false;
         }
     }
     return true;
 }
开发者ID:vanengers,项目名称:WooCommerce,代码行数:22,代码来源:abstract.php

示例8: is_available

 /**
  * Checks for proper gateway configuration (required fields populated, etc)
  * and that there are no missing dependencies
  *
  * @since 2.0
  */
 public function is_available()
 {
     // is enabled check
     $is_available = parent::is_available();
     // proper configuration
     if (!$this->get_access_key() || !$this->get_secret_key()) {
         $is_available = false;
     }
     // all dependencies met
     if (count($GLOBALS['wc_amazon_fps']->get_missing_dependencies()) > 0) {
         $is_available = false;
     }
     return apply_filters('wc_gateway_amazon_fps_is_available', $is_available);
 }
开发者ID:Qualitair,项目名称:ecommerce,代码行数:20,代码来源:class-wc-gateway-amazon-fps.php

示例9: is_available

 /**
  * Check If The Gateway Is Available For Use
  *
  * @return bool
  */
 public function is_available()
 {
     if (!empty($this->enable_for_methods)) {
         // Only apply if all packages are being shipped via local pickup
         $chosen_shipping_methods = array_unique(WC()->session->get('chosen_shipping_methods'));
         $check_method = false;
         if (is_page(wc_get_page_id('checkout')) && !empty($wp->query_vars['order-pay'])) {
             $order_id = absint($wp->query_vars['order-pay']);
             $order = new WC_Order($order_id);
             if ($order->shipping_method) {
                 $check_method = $order->shipping_method;
             }
         } elseif (empty($chosen_shipping_methods) || sizeof($chosen_shipping_methods) > 1) {
             $check_method = false;
         } elseif (sizeof($chosen_shipping_methods) == 1) {
             $check_method = $chosen_shipping_methods[0];
         }
         if (!$check_method) {
             return false;
         }
         $found = false;
         foreach ($this->enable_for_methods as $method_id) {
             if (strpos($check_method, $method_id) === 0) {
                 $found = true;
                 break;
             }
         }
         if (!$found) {
             return false;
         }
     }
     return parent::is_available();
 }
开发者ID:hoonio,项目名称:PhoneAfrika,代码行数:38,代码来源:class-wc-gateway-cod.php

示例10: is_available

 /**
  * Returns a value indicating the the Gateway is available or not.
  *
  * @return bool
  */
 public function is_available()
 {
     if (!parent::is_available()) {
         return false;
     }
     $errors = array();
     if (empty($this->email)) {
         $errors[] = __('Skrill Gateway - Email address is not configured.', $this->texdomain);
     }
     if (empty($this->secret_word)) {
         $errors[] = __('Skrill Gateway - Secret word is not configured.', $this->texdomain);
     }
     $currency = get_woocommerce_currency();
     if (!$this->is_currency_supported($currency)) {
         $errors[] = sprintf(__('Skrill Gateway - Currency not supported: "%s".', $this->texdomain), $currency);
     }
     // If, for any reason, the gateway is enabled, but not available due to
     // misconfiguration, log the issues and trigger a warning so that the Admin
     // can take the appropriate corrective action(s)
     if (!empty($errors)) {
         $errors[] = __('Skrill Gateway disabled.', $this->text_domain);
         foreach ($errors as $error_msg) {
             $this->log($error_msg);
             trigger_error($error_msg, E_USER_WARNING);
         }
         return false;
     }
     return true;
 }
开发者ID:vanminh0910,项目名称:shangri-la,代码行数:34,代码来源:class-wc-gateway-skrill.php

示例11: is_available

 /**
  * Checks for proper gateway configuration (required fields populated, etc)
  * and that there are no missing dependencies
  *
  * @since 2.0
  */
 public function is_available()
 {
     global $wc_braintree;
     // is enabled check
     $is_available = parent::is_available();
     // proper configuration
     if (!$this->get_merchant_id() || !$this->get_public_key() || !$this->get_private_key() || !$this->get_cse_key()) {
         $is_available = false;
     }
     // all dependencies met
     if (count($wc_braintree->get_missing_dependencies()) > 0) {
         $is_available = false;
     }
     return apply_filters('wc_gateway_braintree_is_available', $is_available);
 }
开发者ID:keshvenderg,项目名称:cloudshop,代码行数:21,代码来源:class-wc-gateway-braintree.php

示例12: is_available

 /**
  * Checks for proper gateway configuration including:
  *
  * + gateway enabled
  * + correct configuration (gateway specific)
  * + any dependencies met
  * + required currency
  * + required country
  *
  * @since 1.0.0
  * @see WC_Payment_Gateway::is_available()
  * @return true if this gateway is available for checkout, false otherwise
  */
 public function is_available()
 {
     // is enabled check
     $is_available = parent::is_available();
     // proper configuration
     if (!$this->is_configured()) {
         $is_available = false;
     }
     // all plugin dependencies met
     if (count($this->get_plugin()->get_missing_dependencies()) > 0) {
         $is_available = false;
     }
     // any required currencies?
     if (!$this->currency_is_accepted()) {
         $is_available = false;
     }
     // any required countries?
     if ($this->countries && WC()->customer && WC()->customer->get_country() && !in_array(WC()->customer->get_country(), $this->countries)) {
         $is_available = false;
     }
     /**
      * Payment Gateway Is Available Filter.
      *
      * Allow actors to modify whether the gateway is available or not.
      *
      * @since 1.0.0
      * @param bool $is_available
      */
     return apply_filters('wc_gateway_' . $this->get_id() . '_is_available', $is_available);
 }
开发者ID:DustinHartzler,项目名称:TheCLEFT,代码行数:43,代码来源:class-sv-wc-payment-gateway.php

示例13: is_available

 /**
  * Checks for proper gateway configuration including:
  *
  * + gateway enabled
  * + correct configuration (gateway specific)
  * + any dependencies met
  * + required currency
  * + required country
  *
  * @since 1.0.0
  * @see WC_Payment_Gateway::is_available()
  * @return true if this gateway is available for checkout, false otherwise
  */
 public function is_available()
 {
     // is enabled check
     $is_available = parent::is_available();
     // proper configuration
     if (!$this->is_configured()) {
         $is_available = false;
     }
     // all plugin dependencies met
     if (count($this->get_plugin()->get_missing_dependencies()) > 0) {
         $is_available = false;
     }
     // any required currencies?
     if (!$this->currency_is_accepted()) {
         $is_available = false;
     }
     // any required countries?
     if ($this->countries && WC()->customer && WC()->customer->get_country() && !in_array(WC()->customer->get_country(), $this->countries)) {
         $is_available = false;
     }
     return apply_filters('wc_gateway_' . $this->get_id() . '_is_available', $is_available);
 }
开发者ID:Junaid-Farid,项目名称:gocnex,代码行数:35,代码来源:class-sv-wc-payment-gateway.php

示例14: elseif

 /**
  * Check If The Gateway Is Available For Use
  *
  * @access public
  * @return bool
  */
 function is_available()
 {
     global $woocommerce;
     if (!empty($this->enable_for_methods)) {
         if (is_page(woocommerce_get_page_id('pay'))) {
             $order_id = (int) $_GET['order_id'];
             $order = new WC_Order($order_id);
             if (!$order->shipping_method) {
                 return false;
             }
             $chosen_method = $order->shipping_method;
         } elseif (empty($woocommerce->session->chosen_shipping_method)) {
             return false;
         } else {
             $chosen_method = $woocommerce->session->chosen_shipping_method;
         }
         $found = false;
         foreach ($this->enable_for_methods as $method_id) {
             if (strpos($chosen_method, $method_id) === 0) {
                 $found = true;
                 break;
             }
         }
         if (!$found) {
             return false;
         }
     }
     return parent::is_available();
 }
开发者ID:joshquila,项目名称:demo2-youse,代码行数:35,代码来源:class-wc-gateway-cod.php

示例15: is_available

 /**
  * Check if this gateway is enabled and available in the user's country and for specific users
  *
  * @access public
  * @return bool
  */
 public function is_available()
 {
     global $current_user;
     get_currentuserinfo();
     $is_available = 'yes' === $this->enabled ? true : false;
     if ($this->get_option('debug') == 'yes') {
         $available_in_countries = $new_arr = array_map('trim', explode(',', $this->get_option('countries')));
         $available_to_customer_ids = $new_arr = array_map('trim', explode(',', $this->get_option('customer_ids')));
         $shipping_country = WC()->customer->get_shipping_country();
         if (!in_array($shipping_country, $available_in_countries)) {
             return false;
         }
         if (!in_array($current_user->user_email, $available_to_customer_ids)) {
             return false;
         }
     }
     return parent::is_available();
 }
开发者ID:keshvenderg,项目名称:cloudshop,代码行数:24,代码来源:gateway_manual_paypal.php


注:本文中的WC_Payment_Gateway::is_available方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。