56 lines
2.3 KiB
Smarty
56 lines
2.3 KiB
Smarty
{if $order->isActive() && !$order->isPaid(true)}
|
|
{$somethingToPay = $payment->createAdyenSession()}
|
|
|
|
{if $somethingToPay}
|
|
<script src="https://checkoutshopper-live.adyen.com/checkoutshopper/sdk/5.71.2/adyen.js"
|
|
integrity="sha384-jc/mYZi/5W1D4/eM5hc6xo0EWCbvV1AuWlZvXesp1c+ouFgGLk0eMlBzBT5mKGcN"
|
|
crossorigin="anonymous"></script>
|
|
|
|
<link rel="stylesheet"
|
|
href="https://checkoutshopper-live.adyen.com/checkoutshopper/sdk/5.71.2/adyen.css"
|
|
integrity="sha384-5MvB4RnzvviA3VBT4KYABZ4HXNZG5LRqREEgd41xt/pf/QvKmsj2O9GuNuywRXx9"
|
|
crossorigin="anonymous">
|
|
|
|
<div id="dropin-container"></div>
|
|
{get_session_value type="adyen_{$order->id}" assign=adyenSession}
|
|
|
|
<script type="application/javascript">
|
|
const klarnaConfiguration = { useKlarnaWidget: true };
|
|
|
|
const configuration = {
|
|
environment: {if isDevelopment() || $payment->config['test'] == '1'}'test'{else}'live'{/if},
|
|
clientKey: '{$payment->config['clientKey']}',
|
|
locale: '{$payment->getLocale()}',
|
|
analytics: {
|
|
enabled: true
|
|
},
|
|
session: {
|
|
id: '{$adyenSession.sessionId}',
|
|
sessionData: '{$adyenSession.sessionData}'
|
|
},
|
|
onPaymentCompleted: (result, component) => {
|
|
setTimeout(function () {
|
|
window.location = "{$payment->getGenericPaymentUrl(5)}&sessionId={$adyenSession.sessionId}&sessionResult="+result.sessionResult ;
|
|
}, 500)
|
|
},
|
|
onError: (error, component) => {
|
|
console.error(error.name, error.message, error.stack, component);
|
|
},
|
|
paymentMethodsConfiguration: { // Specify the widget flow for all Klarna types.
|
|
klarna: klarnaConfiguration,
|
|
klarna_account: klarnaConfiguration,
|
|
klarna_paynow: klarnaConfiguration
|
|
}
|
|
};
|
|
|
|
const checkout = AdyenCheckout(configuration).then((checkout) => {
|
|
checkout.create('dropin').mount('#dropin-container');
|
|
});
|
|
</script>
|
|
<hr>
|
|
<form method="post">
|
|
<button type="submit" name="rpm" value="1" id="adyen-change-payment" class="btn btn-ctr more" title="{t}Zobrazit více platebních metod{/t}">{t}Vybrat jinou platební metodu{/t}</button>
|
|
</form>
|
|
{/if}
|
|
{/if}
|