PluginProbe
PayPlug for WooCommerce (Official) / 2.9.0
PayPlug for WooCommerce (Official) v2.9.0
3.0.0 2.18.0 1.0.17 1.0.18 1.0.19 1.0.20 1.0.21 1.0.22 1.0.3 1.0.4 1.0.5 1.0.6 1.0.7 1.0.8 1.1.0 1.10.0 1.10.1 1.2.1 1.2.10 1.2.11 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 All 101 releases
← All changes | src/PayplugWoocommerce.php +90 -3 1.2.52.9.0 View file →
@@ -10,10 +10,25 @@
10 10 use Payplug\PayplugWoocommerce\Admin\Ajax;
11 11 use Payplug\PayplugWoocommerce\Admin\Metabox;
12 12 use Payplug\PayplugWoocommerce\Admin\Notices;
13 13 use Payplug\PayplugWoocommerce\Admin\WoocommerceActions;
14 -use Payplug\PayplugWoocommerce\Front\PayplugOneyDetail;
14 +use Payplug\PayplugWoocommerce\Controller\ApplePay;
15 +use Payplug\PayplugWoocommerce\Front\PayplugOney\Requests\OneyWithFees;
16 +use Payplug\PayplugWoocommerce\Front\PayplugOney\Requests\OneyWithoutFees;
15 17
18 +use Payplug\PayplugWoocommerce\Gateway\Blocks\PayplugAmex;
19 +use Payplug\PayplugWoocommerce\Gateway\Blocks\PayplugApplePay;
20 +use Payplug\PayplugWoocommerce\Gateway\Blocks\PayplugCreditCard;
21 +use Payplug\PayplugWoocommerce\Gateway\Blocks\PayplugBancontact;
22 +use Payplug\PayplugWoocommerce\Gateway\Blocks\PayplugMybank;
23 +use Payplug\PayplugWoocommerce\Gateway\Blocks\PayplugOney3x;
24 +use Payplug\PayplugWoocommerce\Gateway\Blocks\PayplugOney3xWithoutFees;
25 +use Payplug\PayplugWoocommerce\Gateway\Blocks\PayplugOney4x;
26 +use Payplug\PayplugWoocommerce\Gateway\Blocks\PayplugOney4xWithoutFees;
27 +use Payplug\PayplugWoocommerce\Gateway\Blocks\PayplugSatispay;
28 +use Payplug\PayplugWoocommerce\Gateway\Blocks\PayplugIdeal;
29 +use Payplug\PayplugWoocommerce\Gateway\Blocks\PayplugSofort;
30 +
16 31 class PayplugWoocommerce {
17 32
18 33 /**
19 34 * @var PayplugWoocommerce
@@ -74,9 +89,9 @@
74 89
75 90 /**
76 91 * Singleton instance can't be serialized.
77 92 */
78 - private function __wakeup() {
93 + public function __wakeup() {
79 94 }
80 95
81 96 /**
82 97 * PayplugWoocommerce constructor.
@@ -103,12 +118,20 @@
103 118 $this->notices = new Notices();
104 119 $this->metabox = new Metabox();
105 120 $this->actions = new WoocommerceActions();
106 121 $this->requests = new PayplugWoocommerceRequest();
122 + new Front\ApplePay();
107 123 $this->ajax = new Ajax();
108 - new PayplugOneyDetail();
109 124
125 + if( PayplugWoocommerceHelper::show_oney_popup() ) {
126 + $this->animationHandlers();
127 + }
128 +
110 129 add_action( 'woocommerce_payment_gateways', [ $this, 'register_payplug_gateway' ] );
130 +
131 + // Registers WooCommerce Blocks integration.
132 + add_action( 'woocommerce_blocks_loaded', [$this, 'woocommerce_gateways_block_support'] );
133 +
111 134 add_filter( 'plugin_action_links_' . PAYPLUG_GATEWAY_PLUGIN_BASENAME, [ $this, 'plugin_action_links' ] );
112 135 }
113 136
114 137 /**
@@ -121,9 +144,19 @@
121 144 public function register_payplug_gateway( $methods ) {
122 145 $methods[] = __NAMESPACE__ . '\\Gateway\\PayplugGateway';
123 146 $methods[] = __NAMESPACE__ . '\\Gateway\\PayplugGatewayOney3x';
124 147 $methods[] = __NAMESPACE__ . '\\Gateway\\PayplugGatewayOney4x';
148 + $methods[] = __NAMESPACE__ . '\\Gateway\\PayplugGatewayOney3xWithoutFees';
149 + $methods[] = __NAMESPACE__ . '\\Gateway\\PayplugGatewayOney4xWithoutFees';
150 + $methods[] = __NAMESPACE__ . '\\Gateway\\Bancontact';
151 + $methods[] = __NAMESPACE__ . '\\Gateway\\AmericanExpress';
152 + $methods[] = __NAMESPACE__ . '\\Gateway\\PPRO\\Mybank';
153 + $methods[] = __NAMESPACE__ . '\\Gateway\\PPRO\\Ideal';
154 + $methods[] = __NAMESPACE__ . '\\Gateway\\PPRO\\Sofort';
155 + $methods[] = __NAMESPACE__ . '\\Gateway\\PPRO\\Satispay';
125 156
157 + $methods[] = __NAMESPACE__ . '\\Controller\\ApplePay';
158 +
126 159 return $methods;
127 160 }
128 161
129 162 /**
@@ -139,5 +172,59 @@
139 172 ];
140 173
141 174 return array_merge( $plugin_links, $links );
142 175 }
176 +
177 + public function animationHandlers()
178 + {
179 + $options = get_option('woocommerce_payplug_settings', []);
180 +
181 + //if live and don't have country setted on the option
182 + if ( !isset($options['payplug_merchant_country']) ) {
183 + $options['payplug_merchant_country'] = PayplugWoocommerceHelper::UpdateCountryOption($options);
184 + }
185 +
186 + //failsafe
187 + if( empty($options['payplug_merchant_country']) || empty($options['oney_type']) ){
188 + return ;
189 + }
190 +
191 + if( !class_exists( "\\Payplug\\PayplugWoocommerce\\Front\\PayplugOney\\Country\\Oney" .$options['payplug_merchant_country'] )){
192 + return ;
193 + }
194 +
195 +
196 + //check if the options has the Country setted
197 + Switch($options['oney_type']){
198 + case "without_fees" : new OneyWithoutFees();break;
199 + default: new OneyWithFees();break;
200 + }
201 + }
202 +
203 + /**
204 + * Registers WooCommerce Blocks integration.
205 + *
206 + */
207 + public function woocommerce_gateways_block_support(){
208 + if ( class_exists( 'Automattic\WooCommerce\Blocks\Payments\Integrations\AbstractPaymentMethodType' ) ) {
209 +
210 + add_action(
211 + 'woocommerce_blocks_payment_method_type_registration',
212 + function( \Automattic\WooCommerce\Blocks\Payments\PaymentMethodRegistry $payment_method_registry ) {
213 + $payment_method_registry->register( new PayplugCreditCard() );
214 + $payment_method_registry->register( new PayplugBancontact() );
215 + $payment_method_registry->register( new PayplugSatispay() );
216 + $payment_method_registry->register( new PayplugAmex() );
217 + $payment_method_registry->register( new PayplugIdeal() );
218 + $payment_method_registry->register( new PayplugSofort() );
219 + $payment_method_registry->register( new PayplugMybank() );
220 + $payment_method_registry->register( new PayplugApplePay() );
221 + $payment_method_registry->register( new PayplugOney3x() );
222 + $payment_method_registry->register( new PayplugOney4x() );
223 + $payment_method_registry->register( new PayplugOney3xWithoutFees() );
224 + $payment_method_registry->register( new PayplugOney4xWithoutFees() );
225 + }
226 + );
227 + }
228 + }
229 +
143 230 }