| Line 659... |
Line 659... |
| 659 |
$.ajax({
|
659 |
$.ajax({
|
| 660 |
url: (typeof context !== 'undefined' ? context : '') + '/scratch-eligibility?imei=' + encodeURIComponent(imei),
|
660 |
url: (typeof context !== 'undefined' ? context : '') + '/scratch-eligibility?imei=' + encodeURIComponent(imei),
|
| 661 |
method: 'GET',
|
661 |
method: 'GET',
|
| 662 |
dataType: 'json',
|
662 |
dataType: 'json',
|
| 663 |
success: function (data) {
|
663 |
success: function (data) {
|
| - |
|
664 |
// applicable:false → no scratch offer running → no stale entry → no popup
|
| 664 |
if (data && data.eligible === false) {
|
665 |
if (data && data.applicable !== false && data.eligible === false) {
|
| 665 |
stale.push({imei: imei, message: data.message});
|
666 |
stale.push({imei: imei, message: data.message});
|
| 666 |
}
|
667 |
}
|
| 667 |
},
|
668 |
},
|
| 668 |
error: function () {
|
669 |
error: function () {
|
| 669 |
// Endpoint down or network blip — don't hold up the bill.
|
670 |
// Endpoint down or network blip — don't hold up the bill.
|
| Line 729... |
Line 730... |
| 729 |
url: (typeof context !== 'undefined' ? context : '') + '/scratch-eligibility?imei=' + encodeURIComponent(imei),
|
730 |
url: (typeof context !== 'undefined' ? context : '') + '/scratch-eligibility?imei=' + encodeURIComponent(imei),
|
| 730 |
method: 'GET',
|
731 |
method: 'GET',
|
| 731 |
dataType: 'json',
|
732 |
dataType: 'json',
|
| 732 |
success: function (data) {
|
733 |
success: function (data) {
|
| 733 |
if (!data) return;
|
734 |
if (!data) return;
|
| - |
|
735 |
// Skip rendering when no scratch offer is live — the backend sets
|
| - |
|
736 |
// applicable:false in that case and the whole badge is irrelevant.
|
| - |
|
737 |
if (data.applicable === false) return;
|
| 734 |
var eligible = data.eligible === true;
|
738 |
var eligible = data.eligible === true;
|
| 735 |
// Shortened message — the IMEI is already visible in the input right above.
|
739 |
// Shortened message — the IMEI is already visible in the input right above.
|
| 736 |
var short;
|
740 |
var short;
|
| 737 |
if (data.daysSinceActivation == null) {
|
741 |
if (data.daysSinceActivation == null) {
|
| 738 |
short = 'Fresh IMEI — coupon will be awarded';
|
742 |
short = 'Fresh IMEI — coupon will be awarded';
|