This repository has been archived by the owner on Oct 12, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
checkout.html
74 lines (72 loc) · 3.26 KB
/
checkout.html
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta http-equiv="X-UA-Compatible" content="ie=edge" />
<title>My legacy shop</title>
<script src="https://cdnjs.cloudflare.com/ajax/libs/js-polyfills/0.1.42/polyfill.min.js"></script>
</head>
<body>
<div>
<a href="./index.html">Home</a>
</div>
<br />
<br />
<div align="center">
<h1>My legacy shop</h1>
<br />
<div id="container"></div>
</div>
<!--using vendors directory and not node_modules, bcz I had issues with github pages
For your normal application, it is recommended to use it from node_modules to get the updated version all the time-->
<script src="vendors/react.production.min.js"></script>
<script src="vendors/react-dom.production.min.js"></script>
<script src="server/utils/index.js"></script>
<!-- use minified for production-->
<script src="vendors/express-checkout.js"></script>
<script src="config.js"></script>
<script>
// window.attr comes from config.js
function showExpressCheckout(container) {
var error = false;
if (container === null) {
// container is wrong and in this case, express-checkout will not load
console.error("Express Checkout needs a correct container");
error = true;
}
if (!ReactDOM) {
// should exist if react and react-dom are loaded correctly
console.error("Express Checkout needs react and react-dom");
error = true;
}
if (!optileExpressCheckout) {
// should exist if react and react-dom are loaded correctly
console.error("Express Checkout function (optileExpressCheckout) is not available, make sure to load the dependency");
error = true;
}
if (!attr.configuration) {
console.error("Express Checkout needs configuration object to be passed");
error = true;
}
if (!attr.createTransactionDetails) {
console.error("Express Checkout needs createTransactionDetails function to be passed");
error = true;
}
if (error) {
return; // don't try to run optileExpressCheckout when mandatory dependency or attribute is missing
}
//window.optileExpressCheckout comes from express-checkout
var expressCheckout = window.optileExpressCheckout({
configuration: attr.configuration,
createTransactionDetails: attr.createTransactionDetails,
customFunctions: attr.customFunctions,
mode: null,
longId: null,
});
ReactDOM.render(expressCheckout, container);
}
showExpressCheckout(document.getElementById("container"));
</script>
</body>
</html>