| 1 |
<?php |
| 2 |
/** |
| 3 |
* Identification page template. |
| 4 |
* |
| 5 |
* @package woocommerce-sequra |
| 6 |
*/ |
| 7 |
|
| 8 |
// phpcs:disable VariableAnalysis.CodeAnalysis.VariableAnalysis.UndefinedVariable |
| 9 |
if ( $identity_form ) { |
| 10 |
add_filter( 'safe_style_css', 'SequraHelper::allow_css_attributes' ); |
| 11 |
echo wp_kses( |
| 12 |
$identity_form, |
| 13 |
array( |
| 14 |
'iframe' => array( |
| 15 |
'id' => array(), |
| 16 |
'name' => array(), |
| 17 |
'class' => array(), |
| 18 |
'src' => array(), |
| 19 |
'frameborder' => array(), |
| 20 |
'style' => array(), |
| 21 |
'type' => array(), |
| 22 |
), |
| 23 |
'script' => array( |
| 24 |
'type' => array(), |
| 25 |
'src' => array(), |
| 26 |
), |
| 27 |
), |
| 28 |
array( 'https' ) |
| 29 |
); |
| 30 |
remove_filter( 'safe_style_css', 'SequraHelper::allow_css_attributes' ); |
| 31 |
?> |
| 32 |
<script type="text/javascript"> |
| 33 |
function tryToOpenPumbaa() { |
| 34 |
try { |
| 35 |
window.SequraFormInstance.setCloseCallback(function () { |
| 36 |
document.location.href = '<?php echo esc_js( wc_get_checkout_url() ); ?>'; |
| 37 |
}); |
| 38 |
window.SequraFormInstance.show(); |
| 39 |
jQuery('.sq-identification-iframe').appendTo('body'); |
| 40 |
} catch (e) { |
| 41 |
setTimeout(tryToOpenPumbaa, 500); |
| 42 |
} |
| 43 |
} |
| 44 |
|
| 45 |
document.addEventListener("DOMContentLoaded", function () { |
| 46 |
tryToOpenPumbaa(); |
| 47 |
}); |
| 48 |
</script> |
| 49 |
<?php } else { ?> |
| 50 |
<script type="text/javascript"> |
| 51 |
alert("<?php echo esc_js( __( 'Sorry, something went wrong.\n Please contact the merchant.', 'sequra' ) ); ?>"); |
| 52 |
document.location.href = '<?php echo esc_js( wc_get_checkout_url() ); ?>'; |
| 53 |
</script> |
| 54 |
<?php } ?> |
| 55 |
|