Update site: auth fixes, new admin pages, payment flow, membership renewal, helpers
This commit is contained in:
@@ -105,17 +105,29 @@ if (isset($_SESSION['user_id'])) {
|
||||
response = JSON.parse(response);
|
||||
}
|
||||
if (response.status === 'success') {
|
||||
// Check if the user has paid
|
||||
// If provider returned a direct paylink, go there immediately
|
||||
if (response.paylinkUrl) {
|
||||
window.location.href = 'membership_payment?token=' + encodeURIComponent(response.token);
|
||||
return;
|
||||
}
|
||||
|
||||
// If we have a payment_id, redirect to membership_payment with it
|
||||
// if (response.payment_id) {
|
||||
// setTimeout(function() {
|
||||
// window.location.href = 'membership_payment.php?payment_id=' + encodeURIComponent(response.token);
|
||||
// }, 800);
|
||||
// return;
|
||||
// }
|
||||
|
||||
// Fallback behaviour: check paymentStatus
|
||||
if (response.paymentStatus === 'PAID') {
|
||||
// Redirect to membership_details.php if paid
|
||||
setTimeout(function() {
|
||||
window.location.href = 'membership_details.php';
|
||||
}, 2000); // 2-second delay before redirecting
|
||||
}, 1200);
|
||||
} else {
|
||||
// Redirect to membership_payment.php if not paid
|
||||
setTimeout(function() {
|
||||
window.location.href = 'membership_payment.php';
|
||||
}, 2000); // 2-second delay before redirecting
|
||||
}, 1200);
|
||||
}
|
||||
} else {
|
||||
$('#responseMessage').html('<div class="alert alert-danger">' + response.message + '</div>');
|
||||
|
||||
Reference in New Issue
Block a user