/** * Pluggable function to render the checkout page payment fields form * * @since 3.0 * @param WC_Gateway_Authorize_Net_AIM_Credit_Card $gateway gateway object */ function woocommerce_authorize_net_aim_echeck_payment_fields($gateway) { // safely display the description, if there is one if ($gateway->get_description()) { echo '<p>' . wp_kses_post($gateway->get_description()) . '</p>'; } $payment_method_defaults = array('account-number' => '', 'routing-number' => ''); // for the test environment, display a notice and supply a default test payment method if ($gateway->is_environment('test')) { echo '<p>' . __('TEST MODE ENABLED', WC_Authorize_Net_AIM::TEXT_DOMAIN) . '</p>'; $payment_method_defaults = array('account-number' => '8675309', 'routing-number' => '031202084'); } // load the payment fields template file woocommerce_get_template('checkout/authorize-net-aim-echeck-payment-fields.php', array('payment_method_defaults' => $payment_method_defaults, 'sample_check_image_url' => SV_WC_Plugin_Compatibility::force_https_url($gateway->get_plugin()->get_plugin_url()) . '/' . $gateway->get_plugin()->get_framework_image_path() . 'example-check.png', 'states' => SV_WC_Plugin_Compatibility::WC()->countries->get_states('US')), '', $gateway->get_plugin()->get_plugin_path() . '/templates/'); }
/** * Returns the payment method image URL (if any) for the given $type, ie * if $type is 'amex' a URL to the american express card icon will be * returned. If $type is 'echeck', a URL to the echeck icon will be * returned. * * @since 1.0 * @param string $type the payment method cc type or name * @return string the image URL or null */ public function get_payment_method_image_url($type) { $image_type = strtolower($type); // translate card name to type as needed switch ($image_type) { case 'american express': $image_type = 'amex'; break; case 'discover': $image_type = 'disc'; break; case 'mastercard': $image_type = 'mc'; break; case 'paypal': $image_type = 'paypal-1'; break; case 'visa debit': $image_type = 'visa-debit'; break; case 'visa electron': $image_type = 'visa-electron'; break; // default: accept $type as is } // use plain card image if type is not known if (!$image_type) { if ($this->is_credit_card_gateway()) { $image_type = 'cc-plain'; } } // first, is the card image available within the plugin? if (is_readable($this->get_plugin()->get_plugin_path() . '/assets/images/card-' . $image_type . '.png')) { return SV_WC_Plugin_Compatibility::force_https_url($this->get_plugin()->get_plugin_url()) . '/assets/images/card-' . $image_type . '.png'; } // default: is the card image available within the framework? // NOTE: I don't particularly like hardcoding this path, but I don't see any real way around it if (is_readable($this->get_plugin()->get_plugin_path() . '/' . $this->get_plugin()->get_framework_image_path() . 'card-' . $image_type . '.png')) { return SV_WC_Plugin_Compatibility::force_https_url($this->get_plugin()->get_plugin_url()) . '/' . $this->get_plugin()->get_framework_image_path() . 'card-' . $image_type . '.png'; } return null; }
/** * Add selected card icons to payment method label, defaults to Visa/MC/Amex/Discover * * @since 2.0 */ public function get_icon() { global $wc_braintree; $icon = ''; if ($this->icon) { // use icon provided by filter $icon = '<img src="' . esc_url(SV_WC_Plugin_Compatibility::force_https_url($this->icon)) . '" alt="' . esc_attr($this->title) . '" />'; } elseif (!empty($this->card_types)) { // display icons for the selected card types foreach ($this->card_types as $card_type) { if (is_readable($wc_braintree->get_plugin_path() . '/assets/images/card-' . strtolower($card_type) . '.png')) { $icon .= '<img src="' . esc_url(SV_WC_Plugin_Compatibility::force_https_url($wc_braintree->get_plugin_url()) . '/assets/images/card-' . strtolower($card_type) . '.png') . '" alt="' . esc_attr(strtolower($card_type)) . '" />'; } } } return apply_filters('woocommerce_gateway_icon', $icon, $this->id); }