PluginProbe
Pay with Vipps and MobilePay for WooCommerce / 6.1.4
Pay with Vipps and MobilePay for WooCommerce v6.1.4
6.2.1 6.2.0 6.1.10 6.1.9 6.1.8 6.1.7 6.1.6 6.1.5 6.1.4 6.1.3 6.1.2 6.1.1 6.1.0 6.0.5 6.0.4 6.0.3 6.0.2 6.0.1 6.0.0 5.4.3 5.4.2 5.4.1 5.4.0 5.3.4 trunk All 183 releases
woo-vipps / payment / Blocks / Payment / VippsCard.class.php

VippsCard.class.php in Pay with Vipps and MobilePay for WooCommerce 6.1.4, at payment/Blocks/Payment/VippsCard.class.php

66 lines 2.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Vipps payment gateway implementation for Gutenberg Blocks
4 *
5 * @package WooCommerce/Blocks
6 * @since 3.0.0
7 */
8
9
10 namespace Automattic\WooCommerce\Blocks\Payments\Integrations;
11
12 final class VippsCard extends AbstractPaymentMethodType {
13 private $localized=0;
14 protected $name = 'vipps_card';
15 protected $payment_method_name = "";
16 protected $description = "";
17
18 public function initialize() {
19 $gw = \WC_Gateway_VippsCard::instance();
20 $this->settings = get_option( 'woocommerce_vipps_card_settings', [] );
21 $this->payment_method_name = $gw->get_title();
22 $this->description = $gw->get_option('description');
23 }
24
25 // Register this payment method IOK 2020-08-10
26 public static function register() {
27 add_action( 'woocommerce_blocks_payment_method_type_registration',
28 function ($registry) {
29 $registry->register(new static());
30 });
31 }
32
33 public function is_active() {
34 return filter_var( $this->get_setting( 'enabled', false ), FILTER_VALIDATE_BOOLEAN );
35 }
36 public function get_payment_method_script_handles() {
37
38 $version = filemtime(dirname(__FILE__) . "/js/wc-payment-method-vipps-card.js");
39 $path = plugins_url('js/wc-payment-method-vipps-card.js', __FILE__);
40 $handle = 'wc-payment-method-vipps-card';
41 $dependencies = array('wp-hooks', 'vipps-gw');
42
43 wp_register_script($handle, $path, $dependencies,$version,true);
44
45
46 // Will not use wp_set_script_translations yet, it seems to be not fully compatible with Loco Translate etc. Instead use
47 // old-fashioned localize-script IOK 2020-08-11
48 // wp_set_script_translations( 'wc-payment-method-vipps', 'woo-vipps' );
49 // VippsLocale is localized for vipps-gw instead of this, as it seems it does no longer work to do localize-script at this point.
50 // IOK 2022-12-13
51
52 return [ 'wc-payment-method-vipps-card' ];
53 }
54
55 public function get_payment_method_data() {
56 $logo = $src = plugins_url('../../img/cclogos.svg',__FILE__);
57
58 return [
59 'title' => $this->payment_method_name,
60 'description' => $this->description,
61 'iconsrc' => apply_filters('woo_vipps_card_block_logo_url', $logo)
62 ];
63 }
64 }
65
66