-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsuccess.html
174 lines (152 loc) · 8.55 KB
/
success.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
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
<!DOCTYPE html>
<html lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>Indy</title>
<!--<link rel="shortcut icon" type="image/png" href="https://developer.paytm.com/demo//static/images/icon.png?v=1.9" />
<script type="application/javascript" src="https://developer.paytm.com/demo//static/js/jquery.min.js"></script> -->
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-EVSTQN3/azprG1Anm3QDgpJLIm9Nao0Yz1ztcQTwFspd3yD65VohhpuuCOmLASjC" crossorigin="anonymous">
<script src="https://code.jquery.com/jquery-3.2.1.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js"></script>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">
<link href="./assets/files/indy.css" rel="stylesheet">
<script>
async function updateOrder(){
const queryString = window.location.search;
var name = "<%= orderId %>";
console.log({name});
const urlParams = new URLSearchParams(queryString);
const order = urlParams.get('orderId');
var parameter = {
"orderId": order,
"testing": "1",
};
const url = `http://192.168.0.103:8080/customer/web/api/`;
const response = await fetch(url, {
method: 'POST',
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json'
},
body: JSON.stringify(parameter)
});
const trasactionStatusResponse = await response.json();
console.log({trasactionStatusResponse});
const error = trasactionStatusResponse["data"]["body"]["resultInfo"]["resultStatus"];
if(error != "TXN_FAILURE"){
var updateOrderData = {
"txnId": trasactionStatusResponse["data"]["body"]["txnId"],
"paymentMethod": trasactionStatusResponse["data"]["body"]["paymentMode"],
"orderId": trasactionStatusResponse["data"]["body"]["orderId"]
};
console.log({updateOrderData});
const url1 = `http://192.168.0.103:8080/customer/web/api/update`;
const responseUpdate = await fetch(url1, {
method: 'POST',
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json'
},
body: JSON.stringify(parameter)
});
const updateStatuOrder = await responseUpdate.json();
console.log({updateStatuOrder});
}else{
console.log("SOmething weny wrong!");
}
}
</script>
</head>
<script>
window.onload = async function(){
await updateOrder();
const queryString = window.location.search;
const urlParams = new URLSearchParams(queryString);
const order = urlParams.get('orderId');
console.log({urlParams});
console.log({order});
//const url = `https://app.indy-app.com:8080/seller/api/v1/product/order/${order}`
const url = `http://192.168.0.103:8080/seller/api/v1/product/order/${order}`
const response = await fetch(url);
const myJson = await response.json();
console.log({myJson});
const data = myJson.data;
const prodImage = document.getElementById("product-image");
const prodTitle = document.getElementById("product-title");
const orderId = document.getElementById("order-id");
const orderDate = document.getElementById("order-date");
const orderAddress = document.getElementById("customer-address");
const orderPrice = document.getElementById("product-price");
console.log({prodTitle});
orderAddress.innerHTML = data.address;
orderPrice.innerHTML = 'Rs.' +data.amount;
orderId.innerHTML = data.orderId;
const date = data.orderDate;
var dt = new Date(date);
orderDate.innerHTML = dt.toLocaleString();
prodImage.src = data.product[0].productImage;
prodTitle.innerHTML = data.product[0].productName;
//document.getElementById('output').innerHTML
}
</script>
<body>
<main class="indy-page indy-payment-page">
<section class="indy-payment-form indy-dark">
<div class="indy-container">
<card>
<div class="indy-products">
<div class="container">
<div class="row">
<div class="col-lg-12">
<img src="./assets/assets/images/bags.svg" class="img-responsive center-block d-block mx-auto" alt="Sample Image" style="color: #f57e42;">
<h3 class="text-center indy-primary pt-2" style="font-family: Open Sans; font-weight: bold;">Success!</h3>
</div>
<div class="col-lg-12 text-center">
<p class="indy-text-color" style="font-family: Open Sans;">Your Order will be delivered soon. Thank you for choosing our app!</p>
</div>
</div>
<div class="row">
<div class="col-lg-6 indy-container-product">
<img id="product-image" src="./images/Indy_icon.jpg" class="img-responsive center-block d-block mx-auto" alt="Sample Image" width="150">
</div>
</div>
<div class="row pt-3" style=" display:block; margin: auto;">
<div class="col-lg-6 indy-container-product">
<div class="indy-product-title">
<h5 id="product-title" class="indy-primary text-center" style="font-weight: bold;"></h5>
</div>
<div class=" col-lg-12 pt-2"style="display: inline;font-family: Open Sans; ">
<h6 class="indy-text-color"style="display: inline;font-weight: bold;" >Order Id : </h6>
<h6 id="order-id" class="indy-primary"style="display: inline;font-weight: bold;"></h6>
</div>
<div class=" col-lg-12 pt-2"style="font-family: Open Sans; font-weight: bold;">
<h6 class="indy-text-color"style="display: inline;font-weight: bold;">Price : </h6>
<h6 id="product-price" class="indy-primary"style="display: inline;font-weight: bold;"></h6>
</div>
<div class=" col-lg-12 pt-2"style="font-family: Open Sans; font-weight: bold;">
<h6 class="indy-text-color"style="display: inline;font-weight: bold;">Address : </h6>
<h6 id="customer-address" class="indy-primary"style="display: inline;font-weight: bold;"></h6>
</div>
<div class="col-lg-12 pt-2"style="font-family: Open Sans; font-weight: bold;">
<h6 class="indy-text-color"style="display: inline;font-weight: bold;">Order Date : </h6>
<h6 id="order-date" class="indy-primary"style="display: inline;font-weight: bold;"></h6>
</div>
</div>
</div>
<div class="row pt-5">
<button type="button" class="btn btn-indy-primary" onclick="callhome();">Continue Shopping</button>
</div>
</div>
</div>
</card>
<script>
function callhome(){
location.href = "https://app.indy-app.com:8001/home";
}
</script>
</div>
</section>
</main>
</body>
</html>