diff options
| author | Daniel Schmitzer <noreply@maennchen1.de> | 2020-10-19 13:00:52 +0000 |
|---|---|---|
| committer | Daniel Schmitzer <noreply@maennchen1.de> | 2020-10-19 13:00:52 +0000 |
| commit | ff9d7b7273b5c17449a09cd63d691eba17e2efd2 (patch) | |
| tree | 0dd8b50204d7007076c0aa82ee6c4e3439666475 /views/mods/mod_amazon_v2/overview_button.phtml | |
| parent | ee3ca1819f5b3df048f1d7342094b7f43cfeada7 (diff) | |
- Feature: Erinnerungsmail bei Unvollständigen Bestellungen
- Amazon V2 Commit
git-svn-id: https://[internal]/wordpress/plugins/wpsg4@7787 0d5edaf7-2b12-4e95-93f4-047927463d4b
Diffstat (limited to 'views/mods/mod_amazon_v2/overview_button.phtml')
| -rw-r--r-- | views/mods/mod_amazon_v2/overview_button.phtml | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/views/mods/mod_amazon_v2/overview_button.phtml b/views/mods/mod_amazon_v2/overview_button.phtml new file mode 100644 index 0000000..8f2c96c --- /dev/null +++ b/views/mods/mod_amazon_v2/overview_button.phtml @@ -0,0 +1,47 @@ +<?php
+
+ /**
+ *
+ */
+
+?>
+
+<script async="async" src="https://static-eu.payments-amazon.com/OffAmazonPayments/de/sandbox/lpa/js/Widgets.js"></script>
+
+<div id="buy-now">JETZT kaufen</div>
+
+<script>
+
+ var sellerId = '<?php echo $this->get_option('wpsg_mod_amazon_v2_seller_id'); ?>';
+ var id = '<?php echo $_SESSION['wpsg_mod_amazon_v2_amazonCheckoutSessionId']; ?>';
+ var buyNowBtn = document.getElementById("buy-now");
+
+ buyNowBtn.addEventListener('click', function () {
+
+ OffAmazonPayments.initConfirmationFlow(sellerId, id, function(confirmationFlow) {
+
+ placeOrder(confirmationFlow);
+
+ });
+
+ });
+
+ function placeOrder(confirmationFlow) {
+
+ jQuery.ajax({
+ url: '<?php echo $this->getUrl(wpsg_ShopController::URL_BASKET, 'wpsg_mod_amazon_v2', 'placeOrder', [], true) ?>',
+success: function (data) {
+confirmationFlow.success(); // continue Amazon Pay hosted site
+},
+error: function (data) { // called on ajax error and timeout
+confirmationFlow.error(); // abort Amazon Pay initConfirmationFlow
+// you might want to add additional error handling
+},
+timeout: "your timeout value" //specify your timeout value (for example, 3000)
+//If the ajax request takes longer than this timeout (in ms), the error callback
+//will be called
+});
+
+ }
+
+</script>
\ No newline at end of file |
