summaryrefslogtreecommitdiffstats
path: root/etherpad/src/templates/store/eepnet-checkout/summary.ejs
blob: 753873cfc500df63a9842f03d4a6625402165d49 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
<% /* Copyright 2009 Google Inc.

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

     http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS-IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License. */ %><%
function textRow(tcell, pcell) {
	%><tr>
			<td class="tcell"><%= tcell %></td>
			<td class="pcell"><%= pcell %></td>
		</tr>
	<%
}
var keyData = {
  ownerName: cart.ownerName,
  orgName: cart.orgName
}
if (cart.licenseKey) {
  var parts = cart.licenseKey.split(":");
  keyData.ownerName = parts[0];
  keyData.orgName = parts[1];
  keyData.key = parts[2];

  keyData.keyLine1 = keyData.key.substring(0, keyData.key.length/3);
  keyData.keyLine2 = keyData.key.substring(keyData.key.length/3, 2*keyData.key.length/3);
  keyData.keyLine3 = keyData.key.substring(2*keyData.key.length/3, keyData.key.length);
}

function makeRows(arr) {
	arr.forEach(function(arr) { textRow(arr[0], arr[1]); });
}
%>

<h4>License Information <% if (editable) { %><span class="editlink">(<a href="<%= pathTo("license-info") %>">edit</a>)</span><% } %></h4>

<table>
	<% 
	  makeRows([
		  [ "Administrator name:", keyData.ownerName ],
	    [ "Organization/Company:", keyData.orgName ],
	    [ "Email address for delivery:", cart.email ],
			[ "Total users:", cart.userCount ]
		]);
		if (keyData.key) {
		  textRow("License key:", keyData.keyLine1+"<BR>"+keyData.keyLine2+"<BR>"+keyData.keyLine3);
		  %><!-- key: <%= keyData.key %> --><%
		}
	%>
</table>

<h4>Payment Information <% if (editable) { %><span class="editlink">(<a href="<%= pathTo("billing-info") %>">edit</a>)</span><% } %></h4>

<table>
	<%
	  var isUs = cart.billingCountry == "US";
	  switch(cart.billingPurchaseType) {
		case 'creditcard':
			makeRows([
			  [ "Credit card number:", obfuscateCC(cart.billingCCNumber) ],
			  [ "Expiration date:", cart.billingExpirationMonth+" / 20"+cart.billingExpirationYear ]
			]);
		// falling through intentional.
		case 'invoice':
			makeRows([
				[ "Purchaser name:", cart.billingFirstName + " " + cart.billingLastName ],
				[ "Purchaser address: ", cart.billingAddressLine1 + "<br>" +
					             (cart.billingAddressLine2 ? cart.billingAddressLine2 + "<br>" : "") +
											 cart.billingCity + ", " +
											 (isUs?cart.billingState:cart.billingProvince) + "<br>" +
											 (isUs?cart.billingZipCode:cart.billingPostalCode) +
											 (isUs?'':', '+cart.billingCountry) ],
				[ "Invoice number: ", cart.invoiceId ]
			]);
			break;
		case 'paypal':
      textRow("Paid using:", "PayPal");
	    textRow("InvoiceNumber:", cart.invoiceId);
	}
	%>
</table>

<h4>Summary of Charges</h4>

<%= displayCart("shoppingconfirmation", editable) %>