本文整理汇总了PHP中WC_Payment_Gateway类的典型用法代码示例。如果您正苦于以下问题:PHP WC_Payment_Gateway类的具体用法?PHP WC_Payment_Gateway怎么用?PHP WC_Payment_Gateway使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了WC_Payment_Gateway类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: merge_settings
/**
* @param WC_Payment_Gateway $gateway
*/
public function merge_settings(WC_Payment_Gateway $gateway)
{
$data = $this->get_data();
if (isset($data['title'])) {
$gateway->title = $data['title'];
}
if (isset($data['description'])) {
$gateway->description = $data['description'];
}
$gateway->has_icon = $gateway->get_icon() != '';
$gateway->show_icon = isset($data['icon']) ? $data['icon'] : true;
}
开发者ID:bostondv,项目名称:WooCommerce-POS,代码行数:15,代码来源:class-wc-pos-gateways.php
示例2:
/**
* 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
示例3: 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
示例4: 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
示例5: sanitize_payment_fields
/**
* Sanitize payment fields
* - some gateways include js in their payment fields
*
* @param WC_Payment_Gateway $gateway
* @return mixed|string
*/
protected function sanitize_payment_fields(WC_Payment_Gateway $gateway)
{
$html = '';
if ($gateway->has_fields() || $gateway->get_description()) {
ob_start();
$gateway->payment_fields();
$html = ob_get_contents();
ob_end_clean();
// remove script tags
$html = $this->removeDomNodes($html, '//script');
}
return self::trim_html_string($html);
}
开发者ID:rt-sistemas,项目名称:WooCommerce-POS,代码行数:20,代码来源:class-wc-pos-template.php
示例6: prepare_item_for_response
/**
* Prepare a payment gateway for response.
*
* @param WC_Payment_Gateway $gateway Payment gateway object.
* @param WP_REST_Request $request Request object.
* @return WP_REST_Response $response Response data.
*/
public function prepare_item_for_response($gateway, $request)
{
$order = (array) get_option('woocommerce_gateway_order');
$item = array('id' => $gateway->id, 'title' => $gateway->title, 'description' => $gateway->description, 'order' => isset($order[$gateway->id]) ? $order[$gateway->id] : '', 'enabled' => 'yes' === $gateway->enabled, 'method_title' => $gateway->get_method_title(), 'method_description' => $gateway->get_method_description(), 'settings' => $this->get_settings($gateway));
$context = !empty($request['context']) ? $request['context'] : 'view';
$data = $this->add_additional_fields_to_object($item, $request);
$data = $this->filter_response_by_context($data, $context);
$response = rest_ensure_response($data);
$response->add_links($this->prepare_links($gateway, $request));
/**
* Filter payment gateway objects returned from the REST API.
*
* @param WP_REST_Response $response The response object.
* @param WC_Payment_Gateway $gateway Payment gateway object.
* @param WP_REST_Request $request Request object.
*/
return apply_filters('woocommerce_rest_prepare_payment_gateway', $response, $gateway, $request);
}
开发者ID:woocommerce,项目名称:woocommerce,代码行数:25,代码来源:class-wc-rest-payment-gateways-controller.php
示例7: subscriptions_maybe_edit_renewal_support_status
/**
* Edit the Subscriptions automatic renewal payments support column content
* when a gateway supports subscriptions (via tokenization) but tokenization
* is not enabled
*
* @since 4.1.0
* @param string $html column content
* @param \WC_Payment_Gateway|\SV_WC_Payment_Gateway $gateway payment gateway being checked for support
* @return string html
*/
public function subscriptions_maybe_edit_renewal_support_status($html, $gateway)
{
// only for our gateways
if (!in_array($gateway->id, $this->get_gateway_ids())) {
return $html;
}
if ($gateway->is_enabled() && $gateway->supports_tokenization() && !$gateway->tokenization_enabled()) {
$tool_tip = esc_attr__('You must enable tokenization for this gateway in order to support automatic renewal payments with the WooCommerce Subscriptions extension.', 'woocommerce-plugin-framework');
$status = esc_html__('Inactive', 'woocommerce-plugin-framework');
$html = sprintf('<a href="%1$s"><span class="sv-wc-payment-gateway-renewal-status-inactive tips" data-tip="%2$s">%3$s</span></a>', esc_url(SV_WC_Payment_Gateway_Helper::get_payment_gateway_configuration_url($this->get_gateway_class_name($gateway->get_id()))), $tool_tip, $status);
}
return $html;
}
开发者ID:lilweirdward,项目名称:blofishwordpress,代码行数:23,代码来源:class-sv-wc-payment-gateway-plugin.php
示例8: is_available
/**
* Checks for proper gateway configuration (required fields populated, etc)
* and that there are no missing dependencies
*
* @see WC_Payment_Gateway::is_available()
*/
public function is_available()
{
// proper configuration
if (!$this->get_ssl_merchant_id() || !$this->get_ssl_user_id() || !$this->get_ssl_pin()) {
return false;
}
// all dependencies met
if (count(wc_elavon_vm()->get_missing_dependencies()) > 0) {
return false;
}
return parent::is_available();
}
开发者ID:adrianjonmiller,项目名称:vadsupplies,代码行数:18,代码来源:class-wc-gateway-elavon-vm.php
示例9: payment_fields
public function payment_fields()
{
global $woocommerce;
if (!$GLOBALS['paymill_active']) {
paymill_load_frontend_scripts();
// load frontend scripts
// settings
$GLOBALS['paymill_active'] = true;
$cart_total = WC_Payment_Gateway::get_order_total() * 100;
$currency = get_woocommerce_currency();
$no_logos = true;
// form ids
echo '<script>
paymill_form_checkout_id = "form.checkout, form#order_review";
paymill_form_checkout_submit_id = "#place_order";
paymill_shop_name = "woocommerce";
paymill_pcidss3 = ' . (empty($GLOBALS['paymill_settings']->paymill_general_settings['pci_dss_3']) || $GLOBALS['paymill_settings']->paymill_general_settings['pci_dss_3'] != '1' ? 1 : 0) . ';
paymill_pcidss3_lang = "' . substr(apply_filters('plugin_locale', get_locale(), $domain), 0, 2) . '";
</script>';
echo '<a href="https://www.paymill.com/" target="_blank"><img src="' . WC_HTTPS::force_https_url($this->logo_small) . '" alt="' . $this->title . '" /></a>';
echo '<p class="paymill_payment_description">' . $this->settings['description'] . '</p>';
require_once PAYMILL_DIR . 'lib/tpl/checkout_form.php';
} else {
echo '<div class="paymill_notification paymill_notification_once_only"><strong>Error:</strong> Paymill can be loaded once only on the same page.</div>';
}
return true;
}
开发者ID:cyrrill,项目名称:paymill-wordpress,代码行数:27,代码来源:woocommerce.inc.php
示例10: 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
示例11: init_settings
public function init_settings()
{
parent::init_settings();
$options_to_import = array('payapp_user_id', 'payapp_link_key', 'payapp_link_val', 'checkout_methods');
foreach ($options_to_import as $key) {
$this->settings[$key] = get_option(wskl_get_option_name($key));
}
$this->settings['enabled'] = wskl_yes_or_no(wskl_is_option_enabled('enable_sym_pg') && wskl_get_option('pg_agency') == 'payapp' && in_array($this->checkout_method, $this->get_option('checkout_methods')));
}
开发者ID:EricKim65,项目名称:woosym-korean-localization,代码行数:9,代码来源:class-pg-payapp-common.php
示例12: init_settings
public function init_settings()
{
parent::init_settings();
$options_to_import = array('iamport_user_code', 'iamport_rest_key', 'iamport_rest_secret', 'checkout_methods');
foreach ($options_to_import as $key) {
$this->settings[$key] = wskl_get_option($key);
}
$this->settings['enabled'] = wskl_yes_or_no(wskl_is_option_enabled('enable_sym_pg') && wskl_get_option('pg_agency') == 'iamport' && in_array($this->checkout_method, $this->settings['checkout_methods']));
}
开发者ID:EricKim65,项目名称:woosym-korean-localization,代码行数:9,代码来源:class-pg-iamport-common.php
示例13:
/**
* 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
示例14: 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
示例15: admin_options
/**
* Admin Panel Options
* - Options for bits like 'title' and availability on a country-by-country basis
*
* @access public
* @return void
*/
public function admin_options()
{
parent::admin_options();
?>
<script type="text/javascript">
jQuery( '#woocommerce_paypal_pro_enable_3dsecure' ).change( function () {
var threedsec = jQuery( '#woocommerce_paypal_pro_centinel_pid, #woocommerce_paypal_pro_centinel_mid, #woocommerce_paypal_pro_centinel_pwd, #woocommerce_paypal_pro_liability_shift' ).closest( 'tr' );
if ( jQuery( this ).is( ':checked' ) ) {
threedsec.show();
} else {
threedsec.hide();
}
}).change();
</script>
<?php
}
开发者ID:NerdyDillinger,项目名称:ovrride,代码行数:24,代码来源:class-wc-gateway-paypal-pro.php
示例16: process_admin_options
public function process_admin_options()
{
$post_data = $this->get_post_data();
$mode = 'live';
if ($post_data['woocommerce_' . $this->id . '_sandbox'] == '1') {
$mode = 'test';
}
$this->merchant_id = $post_data['woocommerce_' . $this->id . '_' . $mode . '_merchant_id'];
$this->private_key = $post_data['woocommerce_' . $this->id . '_' . $mode . '_private_key'];
$this->publishable_key = $post_data['woocommerce_' . $this->id . '_' . $mode . '_publishable_key'];
$env = $mode == 'live' ? 'Producton' : 'Sandbox';
if ($this->merchant_id == '' || $this->private_key == '' || $this->publishable_key == '') {
$settings = new WC_Admin_Settings();
$settings->add_error('You need to enter "' . $env . '" credentials if you want to use this plugin in this mode.');
} else {
$this->createWebhook();
}
return parent::process_admin_options();
}
开发者ID:open-pay,项目名称:openpay-woocommerce,代码行数:19,代码来源:openpay_stores_gateway.php
示例17: 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
示例18: process_admin_options
public function process_admin_options()
{
$target_dir = IMAGE_FOLDER_URL;
$target_file = $target_dir . basename($_FILES["woocommerce_Pwacheckout_pwa_btn_img"]["name"]);
if ($_FILES["woocommerce_Pwacheckout_pwa_btn_img"]["name"]) {
try {
move_uploaded_file($_FILES["woocommerce_Pwacheckout_pwa_btn_img"]["tmp_name"], $target_file);
chmod($target_file, 0777);
} catch (Exception $e) {
echo 'error in uploading file';
}
}
$value = isset($_POST['woocommerce_Pwacheckout_pwa_delete_img']) ? $_POST['woocommerce_Pwacheckout_pwa_delete_img'] : 0;
if (!$value && $_FILES['woocommerce_Pwacheckout_pwa_btn_img']['name']) {
$_POST['woocommerce_Pwacheckout_pwa_btn_img_hidden'] = IMAGE_FOLDER_HTTPURL . $_FILES['woocommerce_Pwacheckout_pwa_btn_img']['name'];
} elseif ($value) {
$_POST['woocommerce_Pwacheckout_pwa_btn_img_hidden'] = '';
}
$_POST['woocommerce_Pwacheckout_pwa_delete_img'] = 0;
parent::process_admin_options();
}
开发者ID:booklein,项目名称:wpbookle,代码行数:21,代码来源:class-pwa-gateway.php
示例19: init_settings
/**
* extend parent method for initialising settings, so that new settings can receive defaults
*/
public function init_settings() {
parent::init_settings();
if (is_callable(array($this, 'get_form_fields'))) {
$form_fields = $this->get_form_fields();
}
else {
// WooCommerce 2.0.20 or earlier
$form_fields = $this->form_fields;
}
if ($form_fields) {
foreach ($form_fields as $key => $value) {
if (!isset($this->settings[$key])) {
$this->settings[$key] = isset($value['default']) ? $value['default'] : '';
}
}
}
}
开发者ID:helloworld-digital,项目名称:katemorgan,代码行数:22,代码来源:class.EwayPaymentsWoo.php
示例20: is_available
public function is_available()
{
$order = null;
if (empty($this->authorizenet_apilogin) || empty($this->authorizenet_transactionkey)) {
return false;
}
if (!empty($this->authorizenet_enable_for_methods)) {
// Only apply if all packages are being shipped via local pickup
$chosen_shipping_methods_session = WC()->session->get('chosen_shipping_methods');
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->authorizenet_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:samiksha369,项目名称:majorcraft,代码行数:40,代码来源:authorize.net-woocommerce-addon.php
注:本文中的WC_Payment_Gateway类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论