-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathsuccess.html
More file actions
288 lines (248 loc) · 8.44 KB
/
success.html
File metadata and controls
288 lines (248 loc) · 8.44 KB
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
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Subscription Successful - Electrisim</title>
<style>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
min-height: 100vh;
display: flex;
align-items: center;
justify-content: center;
padding: 20px;
}
.success-container {
background: white;
border-radius: 20px;
padding: 40px;
text-align: center;
box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
max-width: 500px;
width: 100%;
}
.success-icon {
width: 80px;
height: 80px;
background: #4CAF50;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
margin: 0 auto 30px;
animation: pulse 2s infinite;
}
.success-icon::before {
content: "✓";
color: white;
font-size: 40px;
font-weight: bold;
}
@keyframes pulse {
0% { transform: scale(1); }
50% { transform: scale(1.05); }
100% { transform: scale(1); }
}
h1 {
color: #333;
margin-bottom: 20px;
font-size: 2.5em;
}
.subtitle {
color: #666;
font-size: 1.2em;
margin-bottom: 30px;
line-height: 1.6;
}
.session-info {
background: #f8f9fa;
border-radius: 10px;
padding: 20px;
margin: 30px 0;
border-left: 4px solid #4CAF50;
}
.session-id {
font-family: 'Courier New', monospace;
color: #495057;
word-break: break-all;
}
.buttons {
display: flex;
gap: 15px;
justify-content: center;
flex-wrap: wrap;
margin-top: 30px;
}
.btn {
padding: 12px 24px;
border: none;
border-radius: 8px;
text-decoration: none;
font-weight: 600;
transition: all 0.3s ease;
cursor: pointer;
display: inline-block;
}
.btn-primary {
background: #4CAF50;
color: white;
}
.btn-primary:hover {
background: #45a049;
transform: translateY(-2px);
}
.btn-secondary {
background: #6c757d;
color: white;
}
.btn-secondary:hover {
background: #5a6268;
transform: translateY(-2px);
}
.loading {
display: none;
margin: 20px 0;
}
.spinner {
border: 4px solid #f3f3f3;
border-top: 4px solid #4CAF50;
border-radius: 50%;
width: 40px;
height: 40px;
animation: spin 1s linear infinite;
margin: 0 auto;
}
@keyframes spin {
0% { transform: rotate(0deg); }
100% { transform: rotate(360deg); }
}
@media (max-width: 600px) {
.success-container {
padding: 30px 20px;
}
h1 {
font-size: 2em;
}
.buttons {
flex-direction: column;
}
.btn {
width: 100%;
}
}
</style>
</head>
<body>
<div class="success-container">
<div class="success-icon"></div>
<h1>Payment Successful!</h1>
<p class="subtitle">
Thank you for subscribing to Electrisim! Your subscription is now active and you have access to all premium features.
</p>
<div class="session-info">
<strong>Session ID:</strong><br>
<span class="session-id" id="sessionId">Loading...</span>
</div>
<div class="loading" id="loading">
<div class="spinner"></div>
<p>Verifying your subscription...</p>
</div>
<div class="buttons">
<a href="/" class="btn btn-primary" id="dashboard-btn">Go to Dashboard</a>
<a href="javascript:void(0)" onclick="checkSubscription()" class="btn btn-secondary">Verify Subscription</a>
</div>
</div>
<script>
// Configuration
const config = {
development: {
apiBaseUrl: 'http://localhost:5502/api',
isDevelopment: true
},
production: {
apiBaseUrl: 'https://api.electrisim.com/api',
isDevelopment: false
}
};
const currentConfig = window.location.hostname === '127.0.0.1' || window.location.hostname === 'localhost'
? config.development
: config.production;
// Get session ID from URL parameters
const urlParams = new URLSearchParams(window.location.search);
const sessionId = urlParams.get('session_id');
if (sessionId) {
document.getElementById('sessionId').textContent = sessionId;
} else {
document.getElementById('sessionId').textContent = 'No session ID found';
}
// Function to check subscription status
async function checkSubscription() {
const loading = document.getElementById('loading');
loading.style.display = 'block';
try {
const token = localStorage.getItem('token');
if (!token) {
alert('❌ No authentication token found. Please log in again.');
return;
}
const response = await fetch(`${currentConfig.apiBaseUrl}/stripe/check-subscription`, {
method: 'GET',
headers: {
'Content-Type': 'application/json',
'Authorization': `Bearer ${token}`
}
});
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
}
const data = await response.json();
if (data.hasActiveSubscription) {
console.log('✅ Your subscription is active! You can now access all premium features.');
} else {
alert('❌ Subscription not found. Please contact support if you believe this is an error.');
}
} catch (error) {
console.error('Error checking subscription:', error);
alert('❌ Error verifying subscription. Please try again or contact support.');
} finally {
loading.style.display = 'none';
}
}
// Auto-check subscription after 2 seconds
setTimeout(() => {
const token = localStorage.getItem('token');
if (token) {
checkSubscription();
} else {
console.log('No token found, skipping auto-check');
}
}, 2000);
// Add some interactive effects
document.addEventListener('DOMContentLoaded', function() {
const container = document.querySelector('.success-container');
container.style.opacity = '0';
container.style.transform = 'translateY(20px)';
setTimeout(() => {
container.style.transition = 'all 0.6s ease';
container.style.opacity = '1';
container.style.transform = 'translateY(0)';
}, 100);
// Set correct dashboard URL based on environment
const dashboardBtn = document.getElementById('dashboard-btn');
const isProduction = !window.location.hostname.includes('localhost') && !window.location.hostname.includes('127.0.0.1');
if (isProduction) {
dashboardBtn.href = '/';
} else {
dashboardBtn.href = '/src/main/webapp/index.html';
}
});
</script>
</body>
</html>