@hmcts/ccpay-web-component 5.0.7-beta05 → 5.0.7-beta08

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -710,16 +710,28 @@
710
710
  };
711
711
  /**
712
712
  * @param {?} isErrorExist
713
+ * @param {?=} isDataNotExist
714
+ * @param {?=} error
713
715
  * @return {?}
714
716
  */
715
717
  ErrorHandlerService.prototype.getServerErrorMessage = /**
716
718
  * @param {?} isErrorExist
719
+ * @param {?=} isDataNotExist
720
+ * @param {?=} error
717
721
  * @return {?}
718
722
  */
719
- function (isErrorExist) {
723
+ function (isErrorExist, isDataNotExist, error) {
724
+ if (isDataNotExist === void 0) {
725
+ isDataNotExist = false;
726
+ }
727
+ if (error === void 0) {
728
+ error = '';
729
+ }
730
+ /** @type {?} */
731
+ var bodyContent = isDataNotExist ? error : 'Try again later';
720
732
  return {
721
733
  title: "There is a problem with the service",
722
- body: "Try again later",
734
+ body: bodyContent,
723
735
  showError: isErrorExist
724
736
  };
725
737
  };
@@ -6101,7 +6113,7 @@
6101
6113
  amount: 0
6102
6114
  };
6103
6115
  this.siteID = null;
6104
- this.errorMessage = this.errorHandlerService.getServerErrorMessage(false);
6116
+ this.errorMessage = this.errorHandlerService.getServerErrorMessage(false, false, '');
6105
6117
  this.paymentGroups = [];
6106
6118
  this.isMoreDetailsBoxHide = true;
6107
6119
  this.isConfirmButtondisabled = false;
@@ -6231,14 +6243,14 @@
6231
6243
  * @param {?} paymentGroup
6232
6244
  * @return {?}
6233
6245
  */function (paymentGroup) {
6234
- _this.errorMessage = _this.errorHandlerService.getServerErrorMessage(false);
6246
+ _this.errorMessage = _this.errorHandlerService.getServerErrorMessage(false, false, '');
6235
6247
  _this.paymentGroup = paymentGroup;
6236
6248
  _this.saveAndContinue();
6237
6249
  }), ( /**
6238
6250
  * @param {?} error
6239
6251
  * @return {?}
6240
6252
  */function (error) {
6241
- _this.errorMessage = _this.errorHandlerService.getServerErrorMessage(true);
6253
+ _this.errorMessage = _this.errorHandlerService.getServerErrorMessage(true, false, '');
6242
6254
  }));
6243
6255
  }
6244
6256
  else {
@@ -6246,7 +6258,7 @@
6246
6258
  * @param {?} paymentGroups
6247
6259
  * @return {?}
6248
6260
  */function (paymentGroups) {
6249
- _this.errorMessage = _this.errorHandlerService.getServerErrorMessage(false);
6261
+ _this.errorMessage = _this.errorHandlerService.getServerErrorMessage(false, false, '');
6250
6262
  _this.paymentGroups = paymentGroups['payment_groups'].filter(( /**
6251
6263
  * @param {?} paymentGroup
6252
6264
  * @return {?}
@@ -6269,7 +6281,7 @@
6269
6281
  * @param {?} error
6270
6282
  * @return {?}
6271
6283
  */function (error) {
6272
- _this.errorMessage = _this.errorHandlerService.getServerErrorMessage(true);
6284
+ _this.errorMessage = _this.errorHandlerService.getServerErrorMessage(true, false, '');
6273
6285
  }));
6274
6286
  }
6275
6287
  };
@@ -6446,7 +6458,7 @@
6446
6458
  * @param {?} res
6447
6459
  * @return {?}
6448
6460
  */function (res) {
6449
- _this.errorMessage = _this.errorHandlerService.getServerErrorMessage(false);
6461
+ _this.errorMessage = _this.errorHandlerService.getServerErrorMessage(false, false, '');
6450
6462
  /** @type {?} */
6451
6463
  var response = JSON.parse(res);
6452
6464
  if (response.success) {
@@ -6456,7 +6468,7 @@
6456
6468
  * @param {?} error
6457
6469
  * @return {?}
6458
6470
  */function (error) {
6459
- _this.errorMessage = _this.errorHandlerService.getServerErrorMessage(true);
6471
+ _this.errorMessage = _this.errorHandlerService.getServerErrorMessage(true, false, '');
6460
6472
  window.scrollTo(0, 0);
6461
6473
  _this.isConfirmButtondisabled = false;
6462
6474
  }));
@@ -6466,7 +6478,7 @@
6466
6478
  * @param {?} res1
6467
6479
  * @return {?}
6468
6480
  */function (res1) {
6469
- _this.errorMessage = _this.errorHandlerService.getServerErrorMessage(false);
6481
+ _this.errorMessage = _this.errorHandlerService.getServerErrorMessage(false, false, '');
6470
6482
  /** @type {?} */
6471
6483
  var response1 = JSON.parse(res1);
6472
6484
  if (response1.success) {
@@ -6476,7 +6488,7 @@
6476
6488
  * @param {?} res2
6477
6489
  * @return {?}
6478
6490
  */function (res2) {
6479
- _this.errorMessage = _this.errorHandlerService.getServerErrorMessage(false);
6491
+ _this.errorMessage = _this.errorHandlerService.getServerErrorMessage(false, false, '');
6480
6492
  /** @type {?} */
6481
6493
  var response2 = JSON.parse(res2);
6482
6494
  /** @type {?} */
@@ -6486,7 +6498,7 @@
6486
6498
  * @param {?} res3
6487
6499
  * @return {?}
6488
6500
  */function (res3) {
6489
- _this.errorMessage = _this.errorHandlerService.getServerErrorMessage(false);
6501
+ _this.errorMessage = _this.errorHandlerService.getServerErrorMessage(false, false, '');
6490
6502
  /** @type {?} */
6491
6503
  var response3 = JSON.parse(res3);
6492
6504
  if (response3.success) {
@@ -6497,7 +6509,7 @@
6497
6509
  * @return {?}
6498
6510
  */function (error) {
6499
6511
  _this.bulkScaningPaymentService.patchBSChangeStatus(_this.unAllocatedPayment.dcn_reference, 'COMPLETE').subscribe();
6500
- _this.errorMessage = _this.errorHandlerService.getServerErrorMessage(true);
6512
+ _this.errorMessage = _this.errorHandlerService.getServerErrorMessage(true, false, '');
6501
6513
  window.scrollTo(0, 0);
6502
6514
  _this.isConfirmButtondisabled = false;
6503
6515
  }));
@@ -6507,7 +6519,7 @@
6507
6519
  * @return {?}
6508
6520
  */function (error) {
6509
6521
  _this.bulkScaningPaymentService.patchBSChangeStatus(_this.unAllocatedPayment.dcn_reference, 'COMPLETE').subscribe();
6510
- _this.errorMessage = _this.errorHandlerService.getServerErrorMessage(true);
6522
+ _this.errorMessage = _this.errorHandlerService.getServerErrorMessage(true, false, '');
6511
6523
  window.scrollTo(0, 0);
6512
6524
  _this.isConfirmButtondisabled = false;
6513
6525
  }));
@@ -6516,7 +6528,7 @@
6516
6528
  * @param {?} error
6517
6529
  * @return {?}
6518
6530
  */function (error) {
6519
- _this.errorMessage = _this.errorHandlerService.getServerErrorMessage(true);
6531
+ _this.errorMessage = _this.errorHandlerService.getServerErrorMessage(true, false, '');
6520
6532
  window.scrollTo(0, 0);
6521
6533
  _this.isConfirmButtondisabled = false;
6522
6534
  }));
@@ -6574,7 +6586,7 @@
6574
6586
  * @param {?} unassignedPayments
6575
6587
  * @return {?}
6576
6588
  */function (unassignedPayments) {
6577
- _this.errorMessage = _this.errorHandlerService.getServerErrorMessage(false);
6589
+ _this.errorMessage = _this.errorHandlerService.getServerErrorMessage(false, false, '');
6578
6590
  _this.unAllocatedPayment = unassignedPayments['data'].payments.filter(( /**
6579
6591
  * @param {?} payment
6580
6592
  * @return {?}
@@ -6595,7 +6607,7 @@
6595
6607
  * @param {?} error
6596
6608
  * @return {?}
6597
6609
  */function (error) {
6598
- _this.errorMessage = _this.errorHandlerService.getServerErrorMessage(true);
6610
+ _this.errorMessage = _this.errorHandlerService.getServerErrorMessage(true, false, '');
6599
6611
  }));
6600
6612
  };
6601
6613
  /**
@@ -8067,7 +8079,7 @@
8067
8079
  this.isStartDateLesthanEndDate = false;
8068
8080
  this.isDateBetwnMonth = false;
8069
8081
  this.isDateRangeBetnWeek = false;
8070
- this.errorMessage = this.errorHandlerService.getServerErrorMessage(false);
8082
+ this.errorMessage = this.errorHandlerService.getServerErrorMessage(false, false, '');
8071
8083
  this.paymentGroups = [];
8072
8084
  }
8073
8085
  /**
@@ -8177,7 +8189,7 @@
8177
8189
  * @param {?} response
8178
8190
  * @return {?}
8179
8191
  */function (response) {
8180
- _this.errorMessage = _this.errorHandlerService.getServerErrorMessage(false);
8192
+ _this.errorMessage = _this.errorHandlerService.getServerErrorMessage(false, false, '');
8181
8193
  /** @type {?} */
8182
8194
  var result = JSON.parse(response);
8183
8195
  /** @type {?} */
@@ -8217,7 +8229,7 @@
8217
8229
  * @return {?}
8218
8230
  */function (error) {
8219
8231
  _this.isDownLoadButtondisabled = false;
8220
- _this.errorMessage = _this.errorHandlerService.getServerErrorMessage(true);
8232
+ _this.errorMessage = _this.errorHandlerService.getServerErrorMessage(true, false, '');
8221
8233
  }));
8222
8234
  }
8223
8235
  else if (selectedReportName === 'PAYMENT_FAILURE_EVENT') {
@@ -8225,7 +8237,7 @@
8225
8237
  * @param {?} response
8226
8238
  * @return {?}
8227
8239
  */function (response) {
8228
- _this.errorMessage = _this.errorHandlerService.getServerErrorMessage(false);
8240
+ _this.errorMessage = _this.errorHandlerService.getServerErrorMessage(false, false, '');
8229
8241
  /** @type {?} */
8230
8242
  var result = { data: JSON.parse(response)['payment_failure_report_list'] };
8231
8243
  /** @type {?} */
@@ -8247,7 +8259,16 @@
8247
8259
  * @return {?}
8248
8260
  */function (error) {
8249
8261
  _this.isDownLoadButtondisabled = false;
8250
- _this.errorMessage = _this.errorHandlerService.getServerErrorMessage(true);
8262
+ /** @type {?} */
8263
+ var errorContent = error.replace(/[^a-zA-Z ]/g, '').trim();
8264
+ /** @type {?} */
8265
+ var statusCode = error.replace(/[^a-zA-Z0-9 ]/g, '').trim().split(' ')[0];
8266
+ if (statusCode === '404') {
8267
+ _this.errorMessage = _this.errorHandlerService.getServerErrorMessage(true, true, errorContent);
8268
+ }
8269
+ else {
8270
+ _this.errorMessage = _this.errorHandlerService.getServerErrorMessage(true, false, '');
8271
+ }
8251
8272
  }));
8252
8273
  }
8253
8274
  else {
@@ -8255,7 +8276,7 @@
8255
8276
  * @param {?} response
8256
8277
  * @return {?}
8257
8278
  */function (response) {
8258
- _this.errorMessage = _this.errorHandlerService.getServerErrorMessage(false);
8279
+ _this.errorMessage = _this.errorHandlerService.getServerErrorMessage(false, false, '');
8259
8280
  /** @type {?} */
8260
8281
  var result = JSON.parse(response);
8261
8282
  /** @type {?} */
@@ -8284,7 +8305,7 @@
8284
8305
  * @return {?}
8285
8306
  */function (error) {
8286
8307
  _this.isDownLoadButtondisabled = false;
8287
- _this.errorMessage = _this.errorHandlerService.getServerErrorMessage(true);
8308
+ _this.errorMessage = _this.errorHandlerService.getServerErrorMessage(true, false, '');
8288
8309
  }));
8289
8310
  }
8290
8311
  };