diff options
Diffstat (limited to 'views/mods/mod_paypalapi/overview_button.phtml')
| -rw-r--r-- | views/mods/mod_paypalapi/overview_button.phtml | 89 |
1 files changed, 0 insertions, 89 deletions
diff --git a/views/mods/mod_paypalapi/overview_button.phtml b/views/mods/mod_paypalapi/overview_button.phtml deleted file mode 100644 index deef1cd..0000000 --- a/views/mods/mod_paypalapi/overview_button.phtml +++ /dev/null @@ -1,89 +0,0 @@ -<?php - - declare(strict_types=1); - - /** - * @author: daniel - * @date: 13.06.24 - * @time: 14:48 - */ - - namespace wpsg; - -?> - -<?php GiroPayPalAPI::getInstance()->integrateSDK(); ?> - - -<div style="width:300px; float:right;"> - <div id="giropay-btn"></div> -</div> - -<script> - - paypal.Buttons({ - fundingSource: paypal.FUNDING.GIROPAY, - style: { - label: "pay", - }, - createOrder() { - - const form = document.getElementById('wpsg_form'); - - if (form.checkValidity()) { - - return fetch("<?php echo $this->getUrl(\wpsg_ShopController::URL_BASKET, 'wpsg_mod_paypalapi', 'giroPayCreateOrderFromSession', [ ], true); ?>", { - method: "POST", - headers: { - "Content-Type": "application/json", - }, - body: { } - }) - .then((response) => response.json()) - .then((order) => order.id); - - } else form.reportValidity(); - - }, - onApprove(data) { - - return fetch("<?php echo $this->getUrl(\wpsg_ShopController::URL_BASKET, 'wpsg_mod_paypalapi', 'giroPayApproveOrder', [], true); ?>", { - method: "POST", - headers: { - "Content-Type": "application/json", - }, - body: JSON.stringify({ - orderID: data.orderID - }) - }) - .then((response) => response.json()) - .then((orderData) => { - - location.href = orderData.order_done_url; - - // Successful capture! For dev/demo purposes: - // console.log('Capture result', orderData, JSON.stringify(orderData, null, 2)); - - // const transaction = orderData.order_paypal.purchase_units[0].payments.captures[0]; - - //console.log('Transaction Status:', transaction.status); - //console.log('Transaction ID:', transaction.id); - - }); - - }, - onCancel(data, actions) { - - console.log(`Order Canceled - ID: ${data.orderID}`); - - location.href = '<?php echo $this->getUrl(\wpsg_ShopController::URL_BASKET, 'wpsg_mod_paypalapi', 'giroPayCancelOrder', [], true); ?>'; - - }, - onError(err) { - - <?php if (\wpsg_ShopController::getShop()->get_option('wpsg_debugModus') === "1") { ?>console.error(err);<?php } ?> - - } - }).render("#giropay-btn"); - -</script>
\ No newline at end of file |
