diff --git a/Payu/Blocks/PayuSecureFormBlock.php b/Payu/Blocks/PayuSecureFormBlock.php new file mode 100644 index 0000000..f483dc9 --- /dev/null +++ b/Payu/Blocks/PayuSecureFormBlock.php @@ -0,0 +1,11 @@ +payu_sdk_url = $this->sandbox ? 'https://secure.snd.payu.com/javascript/sdk' : 'https://secure.payu.com/javascript/sdk'; + if ( $this->is_enabled() ) { $this->icon = apply_filters( 'woocommerce_payu_icon', plugins_url( '/assets/images/card-visa-mc.svg', PAYU_PLUGIN_FILE ) ); @@ -28,10 +33,16 @@ public function is_available(): bool { return parent::is_available(); } - /** - * @return null - */ - function minicart_checkout_refresh_script() { + // Additional data for Blocks + public function get_additional_data(): array { + return [ + 'posId' => $this->pos_id, + 'sdkUrl' => $this->payu_sdk_url, + 'lang' => explode( '_', get_locale() )[0] + ]; + } + + function minicart_checkout_refresh_script(): void { if ( is_checkout() || is_wc_endpoint_url() ) : ?>