Subversion Repositories wpShopGermany4

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
5485 thomas 1
<?php
2
 
3
	/**
4
	 * Template für die Integration von "Bezahlen mit Amazon" in den Warenkorb
5
	 */
6
 
7
?>
8
 
9
<div id="LoginWithAmazon"></div>
10
 
11
<div class="wpsg_amazonhandler" id="addressBookWidgetDiv"></div>
12
<div class="wpsg_amazonhandler" id="walletWidgetDiv"></div>
13
 
14
<input type="hidden" name="amazon[OrderReference]" id="wpsg_mod_amazon_OrderReference" value="" />
15
 
16
<div class="wpsg_clear"></div>
17
 
18
<script type="text/javascript">/* <![CDATA[ */
19
 
20
	var authRequest;
21
 
22
	OffAmazonPayments.Button('LoginWithAmazon', '<?php echo $this->get_option('wpsg_mod_amazon_seller_id'); ?>', {
23
 
24
		type:  "PwA",
25
		color: "Gold",
26
		size:  "small",
27
		language: "de-DE",
28
 
29
		authorization: function() {
30
 
31
			loginOptions = {
32
				scope: "profile payments:widget payments:shipping_address payments:billing_address",
33
				popup: true
34
			};
35
 
36
			authRequest = amazon.Login.authorize(loginOptions, "<?php echo $this->view['wpsg_mod_amazon']['redirectURL']; ?>");
37
 
38
		},
39
 
40
		onError: function(error) {
41
 
42
			//console.log("Login: Es ist folgender Fehler aufgetreten: " + error.getErrorCode() + ' - ' + error.getErrorMessage());
43
			alert("Login: Es ist folgender Fehler aufgetreten: " + error.getErrorCode() + ' - ' + error.getErrorMessage());
44
 
45
		}
46
 
47
	} );
48
 
49
	<?php if (wpsg_isSizedString($this->view['wpsg_mod_amazon']['amazon_last_authorization_reference_id']) && $this->view['basket']['checkout']['payment'] == 3140) { ?>
50
 
51
	jQuery('.wpsg_checkoutbutton').hide();
52
	jQuery('.wpsg_amazonhandler').show();
53
 
54
	new OffAmazonPayments.Widgets.AddressBook( {
55
 
56
	    sellerId: '<?php echo $this->get_option('wpsg_mod_amazon_seller_id'); ?>',
57
 
58
	    onOrderReferenceCreate: function(orderReference) {
59
 
60
	    	var oID = orderReference.getAmazonOrderReferenceId();
61
 
62
			jQuery('#wpsg_mod_amazon_OrderReference').val(oID);
63
			jQuery('.wpsg_checkoutbutton').show();
64
 
65
	    },
66
 
67
	    onAddressSelect: function(orderReference) {
68
 
69
		    // Replace the following code with the action that you want to perform
70
		    // after the address is selected.
71
		    // The amazonOrderReferenceId can be used to retrieve
72
	    	// the address details by calling the GetOrderReferenceDetails
73
		    // operation. If rendering the AddressBook and Wallet widgets on the
74
		    // same page, you should wait for this event before you render the
75
	    	// Wallet widget for the first time.
76
		    // The Wallet widget will re-render itself on all subsequent
77
		    // onAddressSelect events, without any action from you. It is not
78
	    	// recommended that you explicitly refresh it.
79
 
80
			new OffAmazonPayments.Widgets.Wallet({
81
 
82
	    	    sellerId: '<?php echo $this->get_option('wpsg_mod_amazon_seller_id'); ?>',
83
 
84
	    	    onPaymentSelect: function(orderReference) {
85
 
86
	    			// Replace this code with the action that you want to perform
87
	    	      	// after the payment method is selected.
88
 
89
	    	    },
90
 
91
	    	    design: {
92
 
93
	    	      	designMode: 'responsive'
94
 
95
	    	    },
96
 
97
	    	    onError: function(error) {
98
 
99
	    	    	alert("Wallet: Es ist folgender Fehler aufgetreten: " + error.getErrorCode() + ' - ' + error.getErrorMessage());
100
 
101
	    	    }
102
 
103
	    	}).bind("walletWidgetDiv");
104
 
105
	    },
106
 
107
	    design: {
108
 
109
	      designMode: 'responsive'
110
 
111
	    },
112
 
113
	    onError: function(error) {
114
 
115
	    	alert("Payment: Es ist folgender Fehler aufgetreten: " + error.getErrorCode() + ' - ' + error.getErrorMessage());
116
 
117
	    }
118
 
119
	} ).bind("addressBookWidgetDiv");
120
 
121
	<?php } ?>
122
 
123
/* ]]> */</script>