is_enabled()) { $this->show_terms_info = true; $this->icon = apply_filters('woocommerce_payu_icon', plugins_url( '/assets/images/card-visa-mc.svg', PAYU_PLUGIN_FILE )); add_action('wp_enqueue_scripts', [$this, 'include_payu_sf_scripts']); //refresh card iframe after checkout change if (!is_admin()) { add_action('wp_footer', [$this, 'minicart_checkout_refresh_script']); if (!$this->try_retrieve_banks()) { add_filter('woocommerce_available_payment_gateways', [$this, 'unset_gateway']); } } } } /** * @return null */ function minicart_checkout_refresh_script() { if (is_checkout() || is_wc_endpoint_url()) : ?> get_payu_response(); if (isset($response) && $response->getStatus() === 'SUCCESS') { $this->retrieve_methods($response); $this->agreements_field(); echo ''; } } /** * @param OpenPayU_Result $response * * @return null */ private function retrieve_methods($response) { $payMethods = $response->getResponse(); if ($payMethods->payByLinks) { $payByLinks = $this->process_pay_methods($payMethods->payByLinks); if ($payByLinks) { ?>
get_payu_pay_method_array('CARD_TOKEN', $token ? $token : -1, $this->paytype); } /** * @return void */ public function include_payu_sf_scripts() { $payu_sdk_url = $this->sandbox==='yes'?'https://secure.snd.payu.com/javascript/sdk':'https://secure.payu.com/javascript/sdk'; wp_enqueue_script('payu-sfsdk', $payu_sdk_url, [], null); wp_enqueue_script('payu-promise-polyfill', plugins_url( '/assets/js/es6-promise.auto.min.js', PAYU_PLUGIN_FILE ), [], null); wp_enqueue_script('payu-sf-init', plugins_url( '/assets/js/sf-init.js', PAYU_PLUGIN_FILE ), [], PAYU_PLUGIN_VERSION, true); } }