Subversion Repositories wpShopGermany4

Rev

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

Rev Author Line No. Line
5485 thomas 1
<?php
2
 
3
	/**
4
	 * Integration der Zahlung über Amazon in den Bestellabschluß
5
	 */
6
 
7
?>
8
 
9
<?php if ($this->view['wpsg_mod_amazon']['state'] === wpsg_mod_amazon::ORDER_DONE) { ?>
10
 
11
<p><?php echo __('Zahlung wurde erfolgreich mit Amazon Payment abgewickelt.', 'wpsg'); ?></p>
12
 
13
<?php } else if ($this->view['wpsg_mod_amazon']['state'] === wpsg_mod_amazon::ORDER_DONE_PAST) { ?>
14
 
15
<p><?php echo __('Zahlung wurde bereits erfolgreich mit Amazon Payment abgewickelt.', 'wpsg'); ?></p>
16
 
17
<?php } else if ($this->view['wpsg_mod_amazon']['state'] === wpsg_mod_amazon::ORDER_DONE_START || $this->view['wpsg_mod_amazon']['state'] === wpsg_mod_amazon::ORDER_DONE_GO) { ?>
18
 
19
<div id="PayWithAmazon" style="<?php echo (($this->view['wpsg_mod_amazon']['state'] === wpsg_mod_amazon::ORDER_DONE_GO)?'display:none':''); ?>"></div>
20
 
21
<script type="text/javascript">/* <![CDATA[ */
22
 
23
	var authRequest;
24
 
25
	OffAmazonPayments.Button('PayWithAmazon', '<?php echo $this->get_option('wpsg_mod_amazon_seller_id'); ?>', {
26
 
27
		type:  "PwA",
28
		color: "Gold",
29
		size:  "small",
30
		language: "de-DE",
31
 
32
		authorization: function() {
33
 
34
			loginOptions = {
35
				scope: "profile payments:widget payments:shipping_address payments:billing_address",
36
				popup: true
37
			};
38
 
39
			authRequest = amazon.Login.authorize(loginOptions, "<?php echo $this->view['wpsg_mod_amazon']['redirectURL']; ?>");
40
 
41
		},
42
 
43
		onError: function(error) {
44
 
45
			console.log("Login: Es ist folgender Fehler aufgetreten: " + error.getErrorCode() + ' - ' + error.getErrorMessage());
46
 
47
		}
48
 
49
	} );
50
 
51
	var autoRun = setInterval(function(){
52
 
53
		if (jQuery('#PayWithAmazon img').length > 0)
54
		{
55
 
56
			//setTimeout(function(){ jQuery('#PayWithAmazon img').click(); }, 1000);
57
			clearInterval(autoRun);
58
 
59
		}
60
 
61
	}, 100);
62
 
63
/* ]]> */</script>
64
 
65
<?php } ?>
66
 
67
<?php if ($this->view['wpsg_mod_amazon']['state'] === wpsg_mod_amazon::ORDER_DONE_GO) { ?>
68
 
69
<form id="wpsg_mod_amazon_paymentForm" method="POST" action="<?php echo $this->getUrl(wpsg_ShopController::URL_BASKET, 'wpsg_mod_amazon', 'return'); ?>">
70
 
71
	<input type="hidden" name="order_id" value="<?php echo $_REQUEST['order_id']; ?>" />
72
	<input type="hidden" name="wpsg_done" value="<?php echo $_REQUEST['wpsg_done']; ?>" />
73
	<input type="hidden" name="amazon[OrderReference]" id="wpsg_mod_amazon_OrderReference" value="" />
74
 
75
	<div id="walletWidgetDiv"></div>
76
 
77
	<input type="submit" class="wpsg_button" name="submit" value="<?php echo __('Zahlung durchführen', 'wpsg'); ?>" id="wpsg_mod_amazon_doPayment" style="display:none;" />
78
	<div class="wpsg_clear"></div>
79
 
80
</form>
81
 
82
<script type="text/javascript">/* <![CDATA[ */
83
 
84
	new OffAmazonPayments.Widgets.Wallet( {
85
 
86
		sellerId: '<?php echo $this->get_option('wpsg_mod_amazon_seller_id'); ?>',
87
 
88
		onOrderReferenceCreate: function(orderReference) {
89
 
90
			jQuery('#wpsg_mod_amazon_OrderReference').val(orderReference.getAmazonOrderReferenceId());
91
			jQuery('#wpsg_mod_amazon_doPayment').show();
92
 
93
		},
94
 
95
		onPaymentSelect: function(orderReference) {
96
 
97
			// Replace this code with the action that you want to perform
98
			// after the payment method is selected.
99
 
100
		},
101
 
102
		design: {
103
 
104
			designMode: 'responsive'
105
 
106
		},
107
 
108
		onError: function(error) {
109
 
110
			jQuery('#wpsg_mod_amazon_paymentForm').hide();
111
			jQuery('#PayWithAmazon').show();
112
 
113
 
114
		}
115
 
116
	} ).bind("walletWidgetDiv");
117
 
118
/* ]]> */</script>
119
<?php } ?>