@mseva/digit-ui-module-common 1.1.88-dev.1.3 → 1.1.88-dev.1.30

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.
@@ -7304,6 +7304,14 @@ const WrapPaymentComponent = props => {
7304
7304
  refetchOnWindowFocus: false
7305
7305
  });
7306
7306
  const payments = data === null || data === void 0 ? void 0 : data.payments;
7307
+ const {
7308
+ printReceipt: printBillReceipt
7309
+ } = Digit.Hooks.usePrintBillReceipt({
7310
+ tenantId,
7311
+ setLoader: setPrinting,
7312
+ t,
7313
+ pdfkey: generatePdfKey
7314
+ });
7307
7315
  useEffect(() => {
7308
7316
  return () => {
7309
7317
  localStorage.setItem("BillPaymentEnabled", "false");
@@ -7419,6 +7427,7 @@ const WrapPaymentComponent = props => {
7419
7427
  const fee = paymentData === null || paymentData === void 0 ? void 0 : paymentData.totalAmountPaid;
7420
7428
  console.log("fee here here", fee);
7421
7429
  const amountinwords = amountToWords(fee);
7430
+ console.log('amountinwords', amountinwords);
7422
7431
  let response = {
7423
7432
  filestoreIds: [(_payments$Payments$ = payments.Payments[0]) === null || _payments$Payments$ === void 0 ? void 0 : _payments$Payments$.fileStoreId]
7424
7433
  };
@@ -7462,7 +7471,7 @@ const WrapPaymentComponent = props => {
7462
7471
  ...paymentData
7463
7472
  }]
7464
7473
  }, generatePdfKeyForWs);
7465
- } else if (paymentData.paymentDetails[0].businessService.includes("BPA") || paymentData.paymentDetails[0].businessService.includes("clu") || paymentData.paymentDetails[0].businessService.includes("layout")) {
7474
+ } else if (paymentData.paymentDetails[0].businessService.includes("BPA") || paymentData.paymentDetails[0].businessService.includes("clu") || paymentData.paymentDetails[0].businessService.includes("LAYOUT")) {
7466
7475
  const designation = ulbType === "Municipal Corporation" ? "Municipal Commissioner" : "Executive Officer";
7467
7476
  let updatedpayments;
7468
7477
  if (paymentData.paymentDetails[0].businessService.includes("BPAREG")) {
@@ -7488,6 +7497,7 @@ const WrapPaymentComponent = props => {
7488
7497
  } else {
7489
7498
  updatedpayments = {
7490
7499
  ...paymentData,
7500
+ BPA: [bpaData === null || bpaData === void 0 ? void 0 : bpaData[0]],
7491
7501
  additionalDetails: {
7492
7502
  ...paymentData.additionalDetails,
7493
7503
  designation: designation,
@@ -7507,9 +7517,11 @@ const WrapPaymentComponent = props => {
7507
7517
  }]
7508
7518
  }, generatePdfKey);
7509
7519
  } else {
7520
+ console.log('this else triggered');
7510
7521
  response = await Digit.PaymentService.generatePdf(tenantId, {
7511
7522
  Payments: [{
7512
- ...paymentData
7523
+ ...paymentData,
7524
+ amountinwords
7513
7525
  }]
7514
7526
  }, generatePdfKey);
7515
7527
  }
@@ -7522,7 +7534,21 @@ const WrapPaymentComponent = props => {
7522
7534
  fileStoreIds: response.filestoreIds[0]
7523
7535
  });
7524
7536
  if (fileStore && fileStore[response.filestoreIds[0]]) {
7525
- window.open(fileStore[response.filestoreIds[0]], "_blank");
7537
+ const receiptUrl = fileStore[response.filestoreIds[0]];
7538
+ if (business_service === "obpas_noc") {
7539
+ const urlObj = new URL(receiptUrl);
7540
+ const downloadUrl = `${window.origin}${urlObj.pathname}${urlObj.search}`;
7541
+ try {
7542
+ const res = await fetch(downloadUrl);
7543
+ const blob = await res.blob();
7544
+ downloadPdf(blob, `receipt_${receiptNumber || "obpas_noc"}.pdf`);
7545
+ } catch (err) {
7546
+ console.log(err, "error in receipt download");
7547
+ window.open(downloadUrl, "_blank");
7548
+ }
7549
+ } else {
7550
+ window.open(receiptUrl, "_blank");
7551
+ }
7526
7552
  }
7527
7553
  setPrinting(false);
7528
7554
  };
@@ -7550,6 +7576,40 @@ const WrapPaymentComponent = props => {
7550
7576
  });
7551
7577
  }
7552
7578
  };
7579
+ const printPetReceipt = async () => {
7580
+ if (printing) return;
7581
+ setPrinting(true);
7582
+ const payments = await Digit.PaymentService.getReciept(tenantId, business_service, {
7583
+ receiptNumbers: receiptNumber
7584
+ });
7585
+ try {
7586
+ var _applicationDetails$P, _payments$Payments$2;
7587
+ const applicationDetails = await Digit.PTRService.search({
7588
+ tenantId,
7589
+ filters: {
7590
+ applicationNumber: consumerCode
7591
+ }
7592
+ });
7593
+ const application = applicationDetails === null || applicationDetails === void 0 ? void 0 : (_applicationDetails$P = applicationDetails.PetRegistrationApplications) === null || _applicationDetails$P === void 0 ? void 0 : _applicationDetails$P[0];
7594
+ let fileStoreId = (_payments$Payments$2 = payments.Payments[0]) === null || _payments$Payments$2 === void 0 ? void 0 : _payments$Payments$2.fileStoreId;
7595
+ if (!fileStoreId) {
7596
+ var _payments$Payments;
7597
+ let response = await Digit.PaymentService.generatePdf(tenantId, {
7598
+ Payments: [{
7599
+ ...((payments === null || payments === void 0 ? void 0 : (_payments$Payments = payments.Payments) === null || _payments$Payments === void 0 ? void 0 : _payments$Payments[0]) || {}),
7600
+ application
7601
+ }]
7602
+ }, "petservice-receipt");
7603
+ fileStoreId = response === null || response === void 0 ? void 0 : response.filestoreIds[0];
7604
+ }
7605
+ const fileStore = await Digit.PaymentService.printReciept(tenantId, {
7606
+ fileStoreIds: fileStoreId
7607
+ });
7608
+ window.open(fileStore[fileStoreId], "_blank");
7609
+ } finally {
7610
+ setPrinting(false);
7611
+ }
7612
+ };
7553
7613
  const downloadPdf = (blob, fileName) => {
7554
7614
  if (window.mSewaApp && window.mSewaApp.isMsewaApp() && window.mSewaApp.downloadBase64File) {
7555
7615
  var reader = new FileReader();
@@ -7665,13 +7725,13 @@ const WrapPaymentComponent = props => {
7665
7725
  let application = challan;
7666
7726
  let fileStoreId = applicationDetails === null || applicationDetails === void 0 ? void 0 : (_applicationDetails$A = applicationDetails.Applications) === null || _applicationDetails$A === void 0 ? void 0 : (_applicationDetails$A2 = _applicationDetails$A[0]) === null || _applicationDetails$A2 === void 0 ? void 0 : _applicationDetails$A2.paymentReceiptFilestoreId;
7667
7727
  if (!fileStoreId) {
7668
- var _payments$Payments;
7728
+ var _payments$Payments2;
7669
7729
  const payments = await Digit.PaymentService.getReciept(tenantId, business_service, {
7670
7730
  receiptNumbers: receiptNumber
7671
7731
  });
7672
7732
  let response = await Digit.PaymentService.generatePdf(tenantId, {
7673
7733
  Payments: [{
7674
- ...((payments === null || payments === void 0 ? void 0 : (_payments$Payments = payments.Payments) === null || _payments$Payments === void 0 ? void 0 : _payments$Payments[0]) || {}),
7734
+ ...((payments === null || payments === void 0 ? void 0 : (_payments$Payments2 = payments.Payments) === null || _payments$Payments2 === void 0 ? void 0 : _payments$Payments2[0]) || {}),
7675
7735
  challan: application
7676
7736
  }]
7677
7737
  }, "challangeneration-receipt");
@@ -7689,15 +7749,28 @@ const WrapPaymentComponent = props => {
7689
7749
  if (chbPermissionLoading) return;
7690
7750
  setChbPermissionLoading(true);
7691
7751
  try {
7692
- var _applicationDetails$c, _applicationDetails$c2, _applicationDetails$c3, _applicationDetails$c4, _applicationDetails$c5, _applicationDetails$c6, _applicationDetails$A3, _applicationDetails$A4;
7752
+ var _applicationDetails$c, _challanDetails$addit, _challanDetails$addit2, _challanDetails$addre, _applicationDetails$A3, _applicationDetails$A4;
7693
7753
  const applicationDetails = await Digit.ChallanGenerationService.search({
7694
7754
  tenantId,
7695
7755
  filters: {
7696
7756
  challanNo: consumerCode
7697
7757
  }
7698
7758
  });
7699
- const location = await getLocationName(applicationDetails === null || applicationDetails === void 0 ? void 0 : (_applicationDetails$c = applicationDetails.challans) === null || _applicationDetails$c === void 0 ? void 0 : (_applicationDetails$c2 = _applicationDetails$c[0]) === null || _applicationDetails$c2 === void 0 ? void 0 : (_applicationDetails$c3 = _applicationDetails$c2.additionalDetail) === null || _applicationDetails$c3 === void 0 ? void 0 : _applicationDetails$c3.latitude, applicationDetails === null || applicationDetails === void 0 ? void 0 : (_applicationDetails$c4 = applicationDetails.challans) === null || _applicationDetails$c4 === void 0 ? void 0 : (_applicationDetails$c5 = _applicationDetails$c4[0]) === null || _applicationDetails$c5 === void 0 ? void 0 : (_applicationDetails$c6 = _applicationDetails$c5.additionalDetail) === null || _applicationDetails$c6 === void 0 ? void 0 : _applicationDetails$c6.longitude);
7700
- console.log("location", location);
7759
+ const challanDetails = applicationDetails === null || applicationDetails === void 0 ? void 0 : (_applicationDetails$c = applicationDetails.challans) === null || _applicationDetails$c === void 0 ? void 0 : _applicationDetails$c[0];
7760
+ const latitude = challanDetails === null || challanDetails === void 0 ? void 0 : (_challanDetails$addit = challanDetails.additionalDetail) === null || _challanDetails$addit === void 0 ? void 0 : _challanDetails$addit.latitude;
7761
+ const longitude = challanDetails === null || challanDetails === void 0 ? void 0 : (_challanDetails$addit2 = challanDetails.additionalDetail) === null || _challanDetails$addit2 === void 0 ? void 0 : _challanDetails$addit2.longitude;
7762
+ const addressFallback = challanDetails === null || challanDetails === void 0 ? void 0 : (_challanDetails$addre = challanDetails.address) === null || _challanDetails$addre === void 0 ? void 0 : _challanDetails$addre.addressLine1;
7763
+ let location = addressFallback;
7764
+ if (latitude && longitude) {
7765
+ try {
7766
+ const geoLocation = await getLocationName(latitude, longitude);
7767
+ if (geoLocation) {
7768
+ location = geoLocation;
7769
+ }
7770
+ } catch (err) {
7771
+ console.warn("Reverse geocoding failed, using address fallback", err);
7772
+ }
7773
+ }
7701
7774
  const challan = {
7702
7775
  ...applicationDetails,
7703
7776
  ...challanEmpData
@@ -7706,14 +7779,14 @@ const WrapPaymentComponent = props => {
7706
7779
  let application = challan;
7707
7780
  let fileStoreId = applicationDetails === null || applicationDetails === void 0 ? void 0 : (_applicationDetails$A3 = applicationDetails.Applications) === null || _applicationDetails$A3 === void 0 ? void 0 : (_applicationDetails$A4 = _applicationDetails$A3[0]) === null || _applicationDetails$A4 === void 0 ? void 0 : _applicationDetails$A4.paymentReceiptFilestoreId;
7708
7781
  if (!fileStoreId) {
7709
- var _payments$Payments2;
7782
+ var _payments$Payments3;
7710
7783
  const payments = await Digit.PaymentService.getReciept(tenantId, business_service, {
7711
7784
  receiptNumbers: receiptNumber
7712
7785
  });
7713
7786
  let response = await Digit.PaymentService.generatePdf(tenantId, {
7714
7787
  challan: {
7715
7788
  ...application,
7716
- ...((payments === null || payments === void 0 ? void 0 : (_payments$Payments2 = payments.Payments) === null || _payments$Payments2 === void 0 ? void 0 : _payments$Payments2[0]) || {}),
7789
+ ...((payments === null || payments === void 0 ? void 0 : (_payments$Payments3 = payments.Payments) === null || _payments$Payments3 === void 0 ? void 0 : _payments$Payments3[0]) || {}),
7717
7790
  location
7718
7791
  }
7719
7792
  }, "challan-notice");
@@ -7753,13 +7826,13 @@ const WrapPaymentComponent = props => {
7753
7826
  let fileStoreId = applicationDetails === null || applicationDetails === void 0 ? void 0 : (_applicationDetails$h = applicationDetails.hallsBookingApplication) === null || _applicationDetails$h === void 0 ? void 0 : (_applicationDetails$h2 = _applicationDetails$h[0]) === null || _applicationDetails$h2 === void 0 ? void 0 : _applicationDetails$h2.permissionLetterFilestoreId;
7754
7827
  const generatePdfKeyForTL = "chb-permissionletter";
7755
7828
  if (!fileStoreId) {
7756
- var _payments$Payments3;
7829
+ var _payments$Payments4;
7757
7830
  const payments = await Digit.PaymentService.getReciept(tenantId, business_service, {
7758
7831
  receiptNumbers: receiptNumber
7759
7832
  });
7760
7833
  const response = await Digit.PaymentService.generatePdf(tenantId, {
7761
7834
  Payments: [{
7762
- ...((payments === null || payments === void 0 ? void 0 : (_payments$Payments3 = payments.Payments) === null || _payments$Payments3 === void 0 ? void 0 : _payments$Payments3[0]) || {}),
7835
+ ...((payments === null || payments === void 0 ? void 0 : (_payments$Payments4 = payments.Payments) === null || _payments$Payments4 === void 0 ? void 0 : _payments$Payments4[0]) || {}),
7763
7836
  ...application
7764
7837
  }]
7765
7838
  }, generatePdfKeyForTL);
@@ -7805,13 +7878,13 @@ const WrapPaymentComponent = props => {
7805
7878
  };
7806
7879
  let fileStoreId = applicationDetails === null || applicationDetails === void 0 ? void 0 : (_applicationDetails$h3 = applicationDetails.hallsBookingApplication) === null || _applicationDetails$h3 === void 0 ? void 0 : (_applicationDetails$h4 = _applicationDetails$h3[0]) === null || _applicationDetails$h4 === void 0 ? void 0 : _applicationDetails$h4.paymentReceiptFilestoreId;
7807
7880
  if (!fileStoreId) {
7808
- var _payments$Payments4, _response, _response2;
7881
+ var _payments$Payments5, _response, _response2;
7809
7882
  let response = {
7810
7883
  filestoreIds: [payments === null || payments === void 0 ? void 0 : payments.fileStoreId]
7811
7884
  };
7812
7885
  response = await Digit.PaymentService.generatePdf(tenantId, {
7813
7886
  Payments: [{
7814
- ...((payments === null || payments === void 0 ? void 0 : (_payments$Payments4 = payments.Payments) === null || _payments$Payments4 === void 0 ? void 0 : _payments$Payments4[0]) || {}),
7887
+ ...((payments === null || payments === void 0 ? void 0 : (_payments$Payments5 = payments.Payments) === null || _payments$Payments5 === void 0 ? void 0 : _payments$Payments5[0]) || {}),
7815
7888
  ...application
7816
7889
  }]
7817
7890
  }, "chbservice-receipt");
@@ -7848,13 +7921,13 @@ const WrapPaymentComponent = props => {
7848
7921
  let application = applicationDetails === null || applicationDetails === void 0 ? void 0 : (_applicationDetails$A5 = applicationDetails.Applications) === null || _applicationDetails$A5 === void 0 ? void 0 : _applicationDetails$A5[0];
7849
7922
  let fileStoreId = applicationDetails === null || applicationDetails === void 0 ? void 0 : (_applicationDetails$A6 = applicationDetails.Applications) === null || _applicationDetails$A6 === void 0 ? void 0 : (_applicationDetails$A7 = _applicationDetails$A6[0]) === null || _applicationDetails$A7 === void 0 ? void 0 : _applicationDetails$A7.paymentReceiptFilestoreId;
7850
7923
  if (!fileStoreId) {
7851
- var _payments$Payments5;
7924
+ var _payments$Payments6;
7852
7925
  const payments = await Digit.PaymentService.getReciept(tenantId, business_service, {
7853
7926
  receiptNumbers: receiptNumber
7854
7927
  });
7855
7928
  let response = await Digit.PaymentService.generatePdf(tenantId, {
7856
7929
  Payments: [{
7857
- ...((payments === null || payments === void 0 ? void 0 : (_payments$Payments5 = payments.Payments) === null || _payments$Payments5 === void 0 ? void 0 : _payments$Payments5[0]) || {}),
7930
+ ...((payments === null || payments === void 0 ? void 0 : (_payments$Payments6 = payments.Payments) === null || _payments$Payments6 === void 0 ? void 0 : _payments$Payments6[0]) || {}),
7858
7931
  ...application
7859
7932
  }]
7860
7933
  }, "ndc-receipt");
@@ -7883,13 +7956,13 @@ const WrapPaymentComponent = props => {
7883
7956
  let application = new_data;
7884
7957
  let fileStoreId = applicationDetails === null || applicationDetails === void 0 ? void 0 : (_applicationDetails$B = applicationDetails.BookingApplication) === null || _applicationDetails$B === void 0 ? void 0 : (_applicationDetails$B2 = _applicationDetails$B[0]) === null || _applicationDetails$B2 === void 0 ? void 0 : _applicationDetails$B2.paymentReceiptFilestoreId;
7885
7958
  if (!fileStoreId) {
7886
- var _payments$Payments6;
7959
+ var _payments$Payments7;
7887
7960
  const payments = await Digit.PaymentService.getReciept(tenantId, business_service, {
7888
7961
  receiptNumbers: receiptNumber
7889
7962
  });
7890
7963
  let response = await Digit.PaymentService.generatePdf(tenantId, {
7891
7964
  Payments: [{
7892
- ...((payments === null || payments === void 0 ? void 0 : (_payments$Payments6 = payments.Payments) === null || _payments$Payments6 === void 0 ? void 0 : _payments$Payments6[0]) || {}),
7965
+ ...((payments === null || payments === void 0 ? void 0 : (_payments$Payments7 = payments.Payments) === null || _payments$Payments7 === void 0 ? void 0 : _payments$Payments7[0]) || {}),
7893
7966
  ...application
7894
7967
  }]
7895
7968
  }, "adv-bill");
@@ -7945,7 +8018,7 @@ const WrapPaymentComponent = props => {
7945
8018
  gap: "4px"
7946
8019
  };
7947
8020
  const printRecieptNew = async payment => {
7948
- var _payments$Payments$2;
8021
+ var _payments$Payments$3;
7949
8022
  const tenantId = Digit.ULBService.getCurrentTenantId();
7950
8023
  const state = Digit.ULBService.getStateId();
7951
8024
  let paymentArray = [];
@@ -7953,7 +8026,7 @@ const WrapPaymentComponent = props => {
7953
8026
  receiptNumbers: payment.Payments[0].paymentDetails[0].receiptNumber
7954
8027
  });
7955
8028
  let response = {
7956
- filestoreIds: [(_payments$Payments$2 = payments.Payments[0]) === null || _payments$Payments$2 === void 0 ? void 0 : _payments$Payments$2.fileStoreId]
8029
+ filestoreIds: [(_payments$Payments$3 = payments.Payments[0]) === null || _payments$Payments$3 === void 0 ? void 0 : _payments$Payments$3.fileStoreId]
7957
8030
  };
7958
8031
  {
7959
8032
  let assessmentYear = "",
@@ -8206,27 +8279,7 @@ const WrapPaymentComponent = props => {
8206
8279
  month: "2-digit",
8207
8280
  year: "numeric"
8208
8281
  })
8209
- })), business_service == "TL" ? /*#__PURE__*/React.createElement("div", {
8210
- className: "primary-label-btn d-grid",
8211
- style: {
8212
- marginLeft: "unset",
8213
- marginRight: "20px",
8214
- marginTop: "15px",
8215
- marginBottom: "15px"
8216
- },
8217
- onClick: printReciept
8218
- }, /*#__PURE__*/React.createElement("svg", {
8219
- xmlns: "http://www.w3.org/2000/svg",
8220
- height: "24px",
8221
- viewBox: "0 0 24 24",
8222
- width: "24px",
8223
- fill: "#a82227"
8224
- }, /*#__PURE__*/React.createElement("path", {
8225
- d: "M0 0h24v24H0V0z",
8226
- fill: "none"
8227
- }), /*#__PURE__*/React.createElement("path", {
8228
- d: "M19 9h-4V3H9v6H5l7 7 7-7zm-8 2V5h2v6h1.17L12 13.17 9.83 11H11zm-6 7h14v2H5z"
8229
- })), t("TL_RECEIPT")) : null, business_service == "sv-services" ? /*#__PURE__*/React.createElement("div", {
8282
+ })), business_service == "sv-services" ? /*#__PURE__*/React.createElement("div", {
8230
8283
  className: "primary-label-btn d-grid",
8231
8284
  style: {
8232
8285
  marginLeft: "unset",
@@ -8421,6 +8474,62 @@ const WrapPaymentComponent = props => {
8421
8474
  marginTop: "10px",
8422
8475
  marginLeft: "100px"
8423
8476
  }
8477
+ }))) : null, business_service === "rl-services" || business_service === "GC.ONE_TIME_FEE" ? /*#__PURE__*/React.createElement("div", {
8478
+ style: {
8479
+ display: "flex",
8480
+ justifyContent: "flex-end",
8481
+ gap: "20px",
8482
+ marginRight: "20px",
8483
+ marginTop: "15px",
8484
+ marginBottom: "15px"
8485
+ }
8486
+ }, /*#__PURE__*/React.createElement("div", {
8487
+ className: "primary-label-btn d-grid",
8488
+ onClick: printing ? undefined : () => printBillReceipt({
8489
+ businessService: business_service,
8490
+ receiptNumber: receiptNumber,
8491
+ rootKey: "PAYMENTS"
8492
+ })
8493
+ }, printing ? /*#__PURE__*/React.createElement(Loader, null) : /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement("svg", {
8494
+ xmlns: "http://www.w3.org/2000/svg",
8495
+ height: "24",
8496
+ viewBox: "0 0 24 24",
8497
+ width: "24"
8498
+ }, /*#__PURE__*/React.createElement("path", {
8499
+ d: "M0 0h24v24H0z",
8500
+ fill: "none"
8501
+ }), /*#__PURE__*/React.createElement("path", {
8502
+ d: "M19 8H5c-1.66 0-3 1.34-3 3v6h4v4h12v-4h4v-6c0-1.66-1.34-3-3-3zm-3 11H8v-5h8v5zm3-7c-.55 0-1-.45-1-1s.45-1 1-1 1 .45 1 1-.45 1-1 1zm-1-9H6v4h12V3z"
8503
+ })), t("CHB_FEE_RECEIPT")))) : null, business_service == "pet-services" ? /*#__PURE__*/React.createElement("div", {
8504
+ style: {
8505
+ display: "flex",
8506
+ alignItems: "center",
8507
+ justifyContent: "space-between",
8508
+ flexWrap: "wrap",
8509
+ gap: "20px"
8510
+ }
8511
+ }, /*#__PURE__*/React.createElement("div", {
8512
+ style: IconWrapperStyle,
8513
+ onClick: printing ? undefined : printPetReceipt
8514
+ }, printing ? /*#__PURE__*/React.createElement(Loader, null) : /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement("svg", {
8515
+ xmlns: "http://www.w3.org/2000/svg",
8516
+ height: "24px",
8517
+ viewBox: "0 0 24 24",
8518
+ width: "24px",
8519
+ fill: "#a82227"
8520
+ }, /*#__PURE__*/React.createElement("path", {
8521
+ d: "M0 0h24v24H0V0z",
8522
+ fill: "none"
8523
+ }), /*#__PURE__*/React.createElement("path", {
8524
+ d: "M19 9h-4V3H9v6H5l7 7 7-7zm-8 2V5h2v6h1.17L12 13.17 9.83 11H11zm-6 7h14v2H5z"
8525
+ })), t("CHB_FEE_RECEIPT"))), business_service == "pet-services" && /*#__PURE__*/React.createElement(Link, {
8526
+ to: `/digit-ui/citizen`
8527
+ }, /*#__PURE__*/React.createElement(SubmitBar, {
8528
+ label: t("CORE_COMMON_GO_TO_HOME"),
8529
+ style: {
8530
+ marginTop: "10px",
8531
+ marginLeft: "100px"
8532
+ }
8424
8533
  }))) : null, business_service == "sv-services" && /*#__PURE__*/React.createElement(Link, {
8425
8534
  to: `/digit-ui/citizen`
8426
8535
  }, /*#__PURE__*/React.createElement(SubmitBar, {
@@ -8457,7 +8566,7 @@ const WrapPaymentComponent = props => {
8457
8566
  to: `/digit-ui/citizen`
8458
8567
  }, /*#__PURE__*/React.createElement(SubmitBar, {
8459
8568
  label: t("CORE_COMMON_GO_TO_HOME")
8460
- }))) : !(business_service === "adv-services" || business_service === "chb-services" || business_service === "NDC" || business_service === "Challan_Generation") && /*#__PURE__*/React.createElement("div", {
8569
+ }))) : !(business_service === "GC.ONE_TIME_FEE") && /*#__PURE__*/React.createElement("div", {
8461
8570
  style: {
8462
8571
  display: "flex",
8463
8572
  justifyContent: "space-between",
@@ -8465,13 +8574,9 @@ const WrapPaymentComponent = props => {
8465
8574
  flexWrap: "wrap",
8466
8575
  gap: "20px"
8467
8576
  }
8468
- }, printing ? /*#__PURE__*/React.createElement(Loader, null) : /*#__PURE__*/React.createElement(SubmitBar, {
8577
+ }, business_service !== "TL" && (printing ? /*#__PURE__*/React.createElement(Loader, null) : /*#__PURE__*/React.createElement(SubmitBar, {
8469
8578
  onSubmit: printReciept,
8470
8579
  label: t("CS_DOWNLOAD_RECEIPT")
8471
- }), business_service === "TL" && /*#__PURE__*/React.createElement(Link, {
8472
- to: `/digit-ui/citizen`
8473
- }, /*#__PURE__*/React.createElement(SubmitBar, {
8474
- label: t("CORE_COMMON_GO_TO_HOME")
8475
8580
  })), /*#__PURE__*/React.createElement(Link, {
8476
8581
  to: `/digit-ui/citizen`
8477
8582
  }, /*#__PURE__*/React.createElement(SubmitBar, {
@@ -8530,7 +8635,7 @@ const CitizenPayment = ({
8530
8635
  const isResponse = window.location.href.includes("/response");
8531
8636
  const isMobile = window.Digit.Utils.browser.isMobile();
8532
8637
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
8533
- className: "bills-citizen-wrapper"
8638
+ className: "card"
8534
8639
  }, /*#__PURE__*/React.createElement(Switch, null, /*#__PURE__*/React.createElement(AppContainer, null, !isResponse ? /*#__PURE__*/React.createElement("div", {
8535
8640
  style: window.location.href.includes("application-overview") || isMobile ? {
8536
8641
  marginLeft: "10px"
@@ -10939,7 +11044,7 @@ const BillDetailsFormConfig = (props, t) => ({
10939
11044
  }
10940
11045
  }]
10941
11046
  }],
10942
- "WSReconnection": [{
11047
+ WSReconnection: [{
10943
11048
  head: t("COMMON_PAY_SCREEN_HEADER"),
10944
11049
  body: [{
10945
11050
  withoutLabel: true,
@@ -10957,7 +11062,7 @@ const BillDetailsFormConfig = (props, t) => ({
10957
11062
  }
10958
11063
  }]
10959
11064
  }],
10960
- "SWReconnection": [{
11065
+ SWReconnection: [{
10961
11066
  head: t("COMMON_PAY_SCREEN_HEADER"),
10962
11067
  body: [{
10963
11068
  withoutLabel: true,
@@ -11216,16 +11321,22 @@ const BillDetails$1 = ({
11216
11321
  }, year_bill.amount));
11217
11322
  })));
11218
11323
  };
11324
+ const isTL = businessService === "TL";
11325
+ console.log("billDetails==||||", billDetails);
11219
11326
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(StatusTable, null, !checkFSM && bill && config.details.map((obj, index) => {
11220
11327
  const value = obj.keyPath.reduce((acc, key) => {
11221
11328
  if (typeof key === "function") acc = key(acc);else acc = acc[key];
11222
11329
  return acc;
11223
11330
  }, bill);
11224
- return /*#__PURE__*/React.createElement(Row, {
11331
+ return /*#__PURE__*/React.createElement(Row, Object.assign({
11225
11332
  key: index + "bill",
11226
11333
  label: t(obj.keyValue),
11227
11334
  text: value
11228
- });
11335
+ }, isTL ? {
11336
+ textStyle: {
11337
+ textAlign: "right"
11338
+ }
11339
+ } : {}));
11229
11340
  })), checkFSM ? /*#__PURE__*/React.createElement(StatusTable, null, /*#__PURE__*/React.createElement(Row, {
11230
11341
  label: t("ES_PAYMENT_DETAILS_AMOUNT_PER_TRIP"),
11231
11342
  textStyle: {
@@ -11266,11 +11377,18 @@ const BillDetails$1 = ({
11266
11377
  }, /*#__PURE__*/React.createElement(Row, {
11267
11378
  label: t("ES_PAYMENT_TAXHEADS"),
11268
11379
  textStyle: {
11269
- fontWeight: "bold"
11380
+ fontWeight: "bold",
11381
+ ...(isTL ? {
11382
+ textAlign: "right",
11383
+ maxWidth: "none",
11384
+ width: "40%"
11385
+ } : {})
11270
11386
  },
11271
11387
  text: t("ES_PAYMENT_AMOUNT")
11272
11388
  }), /*#__PURE__*/React.createElement("hr", {
11273
- style: {
11389
+ style: isTL ? {
11390
+ width: "100%"
11391
+ } : {
11274
11392
  width: "40%"
11275
11393
  },
11276
11394
  className: "underline"
@@ -11281,7 +11399,11 @@ const BillDetails$1 = ({
11281
11399
  labelStyle: {
11282
11400
  fontWeight: "normal"
11283
11401
  },
11284
- textStyle: {
11402
+ textStyle: isTL ? {
11403
+ textAlign: "right",
11404
+ maxWidth: "none",
11405
+ width: "40%"
11406
+ } : {
11285
11407
  textAlign: "right",
11286
11408
  maxWidth: "100px"
11287
11409
  },
@@ -11292,20 +11414,31 @@ const BillDetails$1 = ({
11292
11414
  labelStyle: {
11293
11415
  fontWeight: "normal"
11294
11416
  },
11295
- textStyle: {
11417
+ textStyle: isTL ? {
11418
+ textAlign: "right",
11419
+ maxWidth: "none",
11420
+ width: "40%"
11421
+ } : {
11296
11422
  textAlign: "right",
11297
11423
  maxWidth: "100px"
11298
11424
  },
11299
11425
  label: t("COMMON_ARREARS"),
11300
11426
  text: "₹ " + (arrears === null || arrears === void 0 ? void 0 : (_arrears$toFixed2 = arrears.toFixed) === null || _arrears$toFixed2 === void 0 ? void 0 : _arrears$toFixed2.call(arrears, 2)) || Number(0).toFixed(2)
11301
11427
  }) : null, /*#__PURE__*/React.createElement("hr", {
11302
- style: {
11428
+ style: isTL ? {
11429
+ width: "100%"
11430
+ } : {
11303
11431
  width: "40%"
11304
11432
  },
11305
11433
  className: "underline"
11306
11434
  }), /*#__PURE__*/React.createElement(Row, {
11307
11435
  label: t("CS_PAYMENT_TOTAL_AMOUNT"),
11308
- textStyle: {
11436
+ textStyle: isTL ? {
11437
+ fontWeight: "bold",
11438
+ textAlign: "right",
11439
+ maxWidth: "none",
11440
+ width: "40%"
11441
+ } : {
11309
11442
  fontWeight: "bold",
11310
11443
  textAlign: "right",
11311
11444
  maxWidth: "100px"
@@ -11460,6 +11593,7 @@ const CollectPayment = props => {
11460
11593
  } = useParams();
11461
11594
  console.log("businessService", businessService);
11462
11595
  const tenantId = Digit.ULBService.getCurrentTenantId();
11596
+ const location = useLocation();
11463
11597
  const search = useLocation().search;
11464
11598
  if (window.location.href.includes("ISWSAPP")) consumerCode = new URLSearchParams(search).get("applicationNumber");
11465
11599
  if (window.location.href.includes("ISWSCON") || ModuleWorkflow === "WS") consumerCode = decodeURIComponent(consumerCode);
@@ -11482,6 +11616,7 @@ const CollectPayment = props => {
11482
11616
  enabled: businessService !== null && businessService !== void 0 && (_businessService$toUp = businessService.toUpperCase()) !== null && _businessService$toUp !== void 0 && _businessService$toUp.includes("FSM") ? true : false
11483
11617
  });
11484
11618
  const advanceBill = applicationData === null || applicationData === void 0 ? void 0 : applicationData.advanceAmount;
11619
+ const [formState, setFormState] = useState({});
11485
11620
  const {
11486
11621
  cardConfig
11487
11622
  } = useCardPaymentDetails(props, t);
@@ -11506,8 +11641,10 @@ const CollectPayment = props => {
11506
11641
  const {
11507
11642
  qrConfig
11508
11643
  } = useQRDetails(props, t);
11509
- const [formState, setFormState] = useState({});
11510
11644
  const [toast, setToast] = useState(null);
11645
+ const isChallanGeneration = location.pathname.includes("Challan_Generation");
11646
+ const isPetService = location.pathname.includes("pet-services");
11647
+ console.log("isPetService", isPetService);
11511
11648
  useEffect(() => {
11512
11649
  if (paymentdetails !== null && paymentdetails !== void 0 && paymentdetails.Bill && paymentdetails.Bill.length === 0) {
11513
11650
  setToast({
@@ -11522,25 +11659,28 @@ const CollectPayment = props => {
11522
11659
  }, {
11523
11660
  code: "CHEQUE",
11524
11661
  label: t("COMMON_MASTERS_PAYMENTMODE_CHEQUE")
11525
- }, {
11662
+ }, ...(!(isChallanGeneration || isPetService) ? [{
11526
11663
  code: "CARD",
11527
11664
  label: t("COMMON_MASTERS_PAYMENTMODE_CREDIT/DEBIT CARD")
11528
- }, {
11665
+ }] : []), {
11529
11666
  code: "DD",
11530
11667
  label: "Demand Draft"
11531
- }, {
11668
+ }, ...(isChallanGeneration || isPetService ? [{
11669
+ code: "ONLINE",
11670
+ label: "Online"
11671
+ }] : []), ...(!(isChallanGeneration || isPetService) ? [{
11532
11672
  code: "OFFLINE_NEFT",
11533
11673
  label: "NEFT"
11534
- }, {
11674
+ }] : []), ...(!(isChallanGeneration || isPetService) ? [{
11535
11675
  code: "OFFLINE_RTGS",
11536
11676
  label: "RTGS"
11537
- }, {
11677
+ }] : []), ...(!(isChallanGeneration || isPetService) ? [{
11538
11678
  code: "POSTAL_ORDER",
11539
11679
  label: "Postal Order"
11540
- }, {
11680
+ }] : []), ...(!(isChallanGeneration || isPetService) ? [{
11541
11681
  code: "QR_CODE",
11542
11682
  label: "QR Code"
11543
- }];
11683
+ }] : [])];
11544
11684
  const formConfigMap = {
11545
11685
  CHEQUE: chequeConfig,
11546
11686
  CARD: cardConfig,
@@ -11567,7 +11707,11 @@ const CollectPayment = props => {
11567
11707
  name: t("COMMON_OWNER")
11568
11708
  });
11569
11709
  const onSubmit = async data => {
11570
- var _data$amount, _data$amount6, _data$amount7, _data$paymentMode, _data$paymentModeDeta, _recieptRequest$Payme2, _recieptRequest$Payme3, _recieptRequest$Payme4, _recieptRequest$Payme5, _recieptRequest$Payme6;
11710
+ var _data$paymentMode, _data$amount, _data$amount6, _data$amount7, _data$paymentMode2, _data$paymentModeDeta, _recieptRequest$Payme2, _recieptRequest$Payme3, _recieptRequest$Payme4, _recieptRequest$Payme5, _recieptRequest$Payme6;
11711
+ if ((data === null || data === void 0 ? void 0 : (_data$paymentMode = data.paymentMode) === null || _data$paymentMode === void 0 ? void 0 : _data$paymentMode.code) == "ONLINE") {
11712
+ history.push(`/digit-ui/employee/payment/challan/collect/${businessService}/${consumerCode}/${tenantId}?tenantId=${tenantId}`);
11713
+ return;
11714
+ }
11571
11715
  bill.totalAmount = Math.round(bill.totalAmount);
11572
11716
  data.paidBy = data.paidBy.code;
11573
11717
  if (BillDetailsFormConfig({
@@ -11617,7 +11761,7 @@ const CollectPayment = props => {
11617
11761
  if (data.ManualRecieptDetails.manualReceiptNumber) {
11618
11762
  recieptRequest.Payment.paymentDetails[0].manualReceiptNumber = ManualRecieptDetails.manualReceiptNumber;
11619
11763
  }
11620
- recieptRequest.Payment.paymentMode = data === null || data === void 0 ? void 0 : (_data$paymentMode = data.paymentMode) === null || _data$paymentMode === void 0 ? void 0 : _data$paymentMode.code;
11764
+ recieptRequest.Payment.paymentMode = data === null || data === void 0 ? void 0 : (_data$paymentMode2 = data.paymentMode) === null || _data$paymentMode2 === void 0 ? void 0 : _data$paymentMode2.code;
11621
11765
  if (data.paymentModeDetails) {
11622
11766
  var _recieptRequest$Payme;
11623
11767
  recieptRequest.Payment = {
@@ -11789,7 +11933,7 @@ const CollectPayment = props => {
11789
11933
  });
11790
11934
  console.log("ModuleWorkflow", ModuleWorkflow);
11791
11935
  const getFormConfig = () => {
11792
- var _formState$paymentMod, _conf;
11936
+ var _formState$paymentMod, _formState$paymentMod2;
11793
11937
  const isGCService = businessService === null || businessService === void 0 ? void 0 : businessService.startsWith("GC");
11794
11938
  if (BillDetailsFormConfig({
11795
11939
  consumerCode,
@@ -11798,7 +11942,9 @@ const CollectPayment = props => {
11798
11942
  config.splice(0, 1);
11799
11943
  }
11800
11944
  let conf = config.concat(formConfigMap[formState === null || formState === void 0 ? void 0 : (_formState$paymentMod = formState.paymentMode) === null || _formState$paymentMod === void 0 ? void 0 : _formState$paymentMod.code] || []);
11801
- conf = (_conf = conf) === null || _conf === void 0 ? void 0 : _conf.concat(cashConfig);
11945
+ if ((formState === null || formState === void 0 ? void 0 : (_formState$paymentMod2 = formState.paymentMode) === null || _formState$paymentMod2 === void 0 ? void 0 : _formState$paymentMod2.code) !== "ONLINE") {
11946
+ conf = conf.concat(cashConfig);
11947
+ }
11802
11948
  return BillDetailsFormConfig({
11803
11949
  consumerCode,
11804
11950
  businessService
@@ -11843,43 +11989,385 @@ const CollectPayment = props => {
11843
11989
  }));
11844
11990
  };
11845
11991
 
11846
- function toInteger(dirtyNumber) {
11847
- if (dirtyNumber === null || dirtyNumber === true || dirtyNumber === false) {
11848
- return NaN;
11849
- }
11850
- var number = Number(dirtyNumber);
11851
- if (isNaN(number)) {
11852
- return number;
11853
- }
11854
- return number < 0 ? Math.ceil(number) : Math.floor(number);
11855
- }
11856
-
11857
- function requiredArgs(required, args) {
11858
- if (args.length < required) {
11859
- throw new TypeError(required + ' argument' + (required > 1 ? 's' : '') + ' required, but only ' + args.length + ' present');
11860
- }
11861
- }
11862
-
11863
- function toDate(argument) {
11864
- requiredArgs(1, arguments);
11865
- var argStr = Object.prototype.toString.call(argument);
11866
- if (argument instanceof Date || typeof argument === 'object' && argStr === '[object Date]') {
11867
- return new Date(argument.getTime());
11868
- } else if (typeof argument === 'number' || argStr === '[object Number]') {
11869
- return new Date(argument);
11870
- } else {
11871
- if ((typeof argument === 'string' || argStr === '[object String]') && typeof console !== 'undefined') {
11872
- console.warn("Starting with v2.0.0-beta.1 date-fns doesn't accept strings as date arguments. Please use `parseISO` to parse strings. See: https://git.io/fjule");
11873
- console.warn(new Error().stack);
11992
+ const SelectPaymentType$2 = props => {
11993
+ var _menuList$PAYMENT, _menuList$PAYMENT$Pay, _menuList$PAYMENT2, _menuList$PAYMENT2$Pa, _menuList$PAYMENT2$Pa2;
11994
+ const {
11995
+ state = {}
11996
+ } = useLocation();
11997
+ const userInfo = Digit.UserService.getUser();
11998
+ const [showToast, setShowToast] = useState(null);
11999
+ const [showOwnerToast, setShowOwnerToast] = useState(null);
12000
+ const {
12001
+ tenantId: __tenantId,
12002
+ authorization,
12003
+ workflow: wrkflow,
12004
+ consumerCode: connectionNo
12005
+ } = Digit.Hooks.useQueryParams();
12006
+ const paymentAmount = state === null || state === void 0 ? void 0 : state.paymentAmount;
12007
+ const {
12008
+ t
12009
+ } = useTranslation();
12010
+ const history = useHistory();
12011
+ const {
12012
+ pathname,
12013
+ search
12014
+ } = useLocation();
12015
+ let {
12016
+ consumerCode,
12017
+ businessService
12018
+ } = useParams();
12019
+ const tenantId = (state === null || state === void 0 ? void 0 : state.tenantId) || __tenantId || Digit.ULBService.getCurrentTenantId();
12020
+ const stateTenant = Digit.ULBService.getStateId();
12021
+ const {
12022
+ control,
12023
+ handleSubmit,
12024
+ setValue
12025
+ } = useForm();
12026
+ const {
12027
+ data: menuList,
12028
+ isLoading
12029
+ } = Digit.Hooks.useCustomMDMS(tenantId, "PAYMENT", [{
12030
+ name: "PaymentGateway"
12031
+ }]);
12032
+ console.log("menuList", menuList);
12033
+ const [isPaymentLoading, setPaymentLoading] = useState(false);
12034
+ const {
12035
+ data: paymentdetails,
12036
+ isLoading: paymentLoading
12037
+ } = Digit.Hooks.useFetchPayment({
12038
+ tenantId: tenantId,
12039
+ consumerCode: wrkflow === "WNS" ? connectionNo : consumerCode,
12040
+ businessService
12041
+ }, {});
12042
+ if (window.location.href.includes("ISWSCON") || wrkflow === "WNS") consumerCode = decodeURIComponent(consumerCode);
12043
+ if (wrkflow === "WNS") consumerCode = stringReplaceAll(consumerCode, "+", "/");
12044
+ useEffect(() => {
12045
+ if (paymentdetails !== null && paymentdetails !== void 0 && paymentdetails.Bill && paymentdetails.Bill.length == 0) {
12046
+ setShowToast({
12047
+ key: true,
12048
+ label: "CS_BILL_NOT_FOUND"
12049
+ });
11874
12050
  }
11875
- return new Date(NaN);
11876
- }
11877
- }
11878
-
11879
- function addMilliseconds(dirtyDate, dirtyAmount) {
11880
- requiredArgs(2, arguments);
11881
- var timestamp = toDate(dirtyDate).getTime();
11882
- var amount = toInteger(dirtyAmount);
12051
+ }, [paymentdetails]);
12052
+ useEffect(() => {
12053
+ localStorage.setItem("BillPaymentEnabled", "true");
12054
+ }, []);
12055
+ const {
12056
+ name,
12057
+ mobileNumber
12058
+ } = state;
12059
+ const billDetails = paymentdetails !== null && paymentdetails !== void 0 && paymentdetails.Bill ? paymentdetails === null || paymentdetails === void 0 ? void 0 : paymentdetails.Bill[0] : {};
12060
+ console.log(billDetails, "BILL");
12061
+ const userOptions = ["OWNER", "OTHER"];
12062
+ const onSubmit = async d => {
12063
+ if (!(d !== null && d !== void 0 && d.name) || (d === null || d === void 0 ? void 0 : d.name.trim()) === "") {
12064
+ setShowOwnerToast({
12065
+ key: true,
12066
+ label: t("PAYMENT_NAME_MANDATORY_MESSAGE")
12067
+ });
12068
+ return;
12069
+ }
12070
+ const mobileRegex = /^[6-9]\d{9}$/;
12071
+ if (!(d !== null && d !== void 0 && d.mobileNumber) || (d === null || d === void 0 ? void 0 : d.mobileNumber.trim()) === "") {
12072
+ setShowOwnerToast({
12073
+ key: true,
12074
+ label: t("PAYMENT_MOBILE_NUMBER_MANDATORY_MESSAGE")
12075
+ });
12076
+ return;
12077
+ } else if (!mobileRegex.test(d.mobileNumber)) {
12078
+ setShowOwnerToast({
12079
+ key: true,
12080
+ label: t("ERR_INVALID_MOBILE")
12081
+ });
12082
+ return;
12083
+ }
12084
+ setPaymentLoading(true);
12085
+ const baseURL = document.location.origin;
12086
+ console.log("BASEURLINPAYMENT", baseURL);
12087
+ const filterData = {
12088
+ Transaction: {
12089
+ tenantId: billDetails === null || billDetails === void 0 ? void 0 : billDetails.tenantId,
12090
+ txnAmount: paymentAmount || billDetails.totalAmount,
12091
+ module: businessService,
12092
+ businessService: businessService,
12093
+ billId: billDetails.id,
12094
+ consumerCode: consumerCode,
12095
+ productInfo: "Common Payment",
12096
+ gateway: d === null || d === void 0 ? void 0 : d.paymentType,
12097
+ taxAndPayments: [{
12098
+ taxAmount: paymentAmount || billDetails.totalAmount,
12099
+ billId: billDetails.id,
12100
+ amountPaid: paymentAmount || billDetails.totalAmount,
12101
+ businessService: businessService
12102
+ }],
12103
+ user: {
12104
+ name: d === null || d === void 0 ? void 0 : d.name,
12105
+ mobileNumber: d === null || d === void 0 ? void 0 : d.mobileNumber,
12106
+ tenantId: billDetails === null || billDetails === void 0 ? void 0 : billDetails.tenantId
12107
+ },
12108
+ callbackUrl: `${baseURL}/digit-ui/employee/payment/challan/success/${businessService}/${consumerCode}`,
12109
+ additionalDetails: {
12110
+ isWhatsapp: false,
12111
+ paidBy: d === null || d === void 0 ? void 0 : d.paidBy
12112
+ }
12113
+ }
12114
+ };
12115
+ console.log("coming here", filterData);
12116
+ try {
12117
+ const data = await Digit.PaymentService.createCitizenReciept(billDetails === null || billDetails === void 0 ? void 0 : billDetails.tenantId, filterData);
12118
+ console.log("data=========", data);
12119
+ if (paymentAmount === 0 || billDetails.totalAmount === 0) {
12120
+ var _data$ResponseInfo;
12121
+ setPaymentLoading(false);
12122
+ if ((data === null || data === void 0 ? void 0 : (_data$ResponseInfo = data.ResponseInfo) === null || _data$ResponseInfo === void 0 ? void 0 : _data$ResponseInfo.status) === "SUCCESSFUL") {
12123
+ var _data$Transaction;
12124
+ window.location.href = data === null || data === void 0 ? void 0 : (_data$Transaction = data.Transaction) === null || _data$Transaction === void 0 ? void 0 : _data$Transaction.callbackUrl;
12125
+ } else {
12126
+ window.location.href = "/digit-ui/citizen/payment/failure";
12127
+ }
12128
+ return;
12129
+ }
12130
+ if ((d === null || d === void 0 ? void 0 : d.paymentType) === gatewayType.RAZORPAY) {
12131
+ displayRazorpay(data);
12132
+ } else {
12133
+ setPaymentLoading(false);
12134
+ }
12135
+ } catch (error) {
12136
+ var _error$response, _error$response$data, _error$response$data$;
12137
+ console.log("error", error);
12138
+ let messageToShow = "CS_PAYMENT_UNKNOWN_ERROR_ON_SERVER";
12139
+ if ((_error$response = error.response) !== null && _error$response !== void 0 && (_error$response$data = _error$response.data) !== null && _error$response$data !== void 0 && (_error$response$data$ = _error$response$data.Errors) !== null && _error$response$data$ !== void 0 && _error$response$data$[0]) {
12140
+ var _error$response2, _error$response2$data, _error$response2$data2;
12141
+ const {
12142
+ code,
12143
+ message
12144
+ } = (_error$response2 = error.response) === null || _error$response2 === void 0 ? void 0 : (_error$response2$data = _error$response2.data) === null || _error$response2$data === void 0 ? void 0 : (_error$response2$data2 = _error$response2$data.Errors) === null || _error$response2$data2 === void 0 ? void 0 : _error$response2$data2[0];
12145
+ messageToShow = code;
12146
+ }
12147
+ setPaymentLoading(false);
12148
+ setShowToast({
12149
+ key: true,
12150
+ label: t(messageToShow)
12151
+ });
12152
+ }
12153
+ };
12154
+ async function displayRazorpay(getOrderData) {
12155
+ const res = await loadScript(RAZORPAY_LOADSCRIPT_URL);
12156
+ if (!res) {
12157
+ alert("Razorpay SDK failed to load. Are you online?");
12158
+ return;
12159
+ }
12160
+ function getQueryVariable(variable) {
12161
+ const query = lodash.get(getOrderData, TRANSACTION_REDIRECTURL);
12162
+ var vars = query.split("&");
12163
+ for (var i = 0; i < vars.length; i++) {
12164
+ var pair = vars[i].split("=");
12165
+ if (pair[0] == variable) {
12166
+ return pair[1];
12167
+ }
12168
+ }
12169
+ return false;
12170
+ }
12171
+ const options = {
12172
+ key: getQueryVariable(MERCHENT_KEY),
12173
+ amount: lodash.get(getOrderData, TRANSACTION_AMMOUNT) * 100,
12174
+ name: POPUP_DIPSPLAY_NAME,
12175
+ description: lodash.get(getOrderData, TRANSACTION_BUSINESSSERVICE) + " Charge Collection",
12176
+ image: POPUP_DIPSPLAY_IMAGE,
12177
+ order_id: getQueryVariable(ORDER_ID),
12178
+ handler: async function (response) {
12179
+ const data = {
12180
+ razorpayPaymentId: response.razorpay_payment_id,
12181
+ razorpayOrderId: response.razorpay_order_id,
12182
+ razorpaySignature: response.razorpay_signature
12183
+ };
12184
+ window.location = lodash.get(getOrderData, TRANSACTION_CALLBACKURL) + RAZORPAY_CALLBACK_URL_KEYS.PAYMENT_ID + data.razorpayPaymentId + RAZORPAY_CALLBACK_URL_KEYS.ORDER_ID + data.razorpayOrderId + RAZORPAY_CALLBACK_URL_KEYS.SIGNATURE + data.razorpaySignature;
12185
+ },
12186
+ prefill: {
12187
+ name: lodash.get(getOrderData, TRANSACTION_USERNAME),
12188
+ email: lodash.get(getOrderData, TRANSACTION_USER_EMAIL),
12189
+ contact: lodash.get(getOrderData, TRANSACTION_USER_MOBILE)
12190
+ },
12191
+ theme: {
12192
+ color: "#61dafb"
12193
+ }
12194
+ };
12195
+ const paymentObject = new window.Razorpay(options);
12196
+ setPaymentLoading(false);
12197
+ paymentObject.open();
12198
+ }
12199
+ function loadScript(src) {
12200
+ return new Promise(resolve => {
12201
+ const script = document.createElement("script");
12202
+ script.src = src;
12203
+ script.onload = () => {
12204
+ resolve(true);
12205
+ };
12206
+ script.onerror = () => {
12207
+ resolve(false);
12208
+ };
12209
+ document.body.appendChild(script);
12210
+ });
12211
+ }
12212
+ if (authorization === "true" && !userInfo.access_token) {
12213
+ localStorage.clear();
12214
+ sessionStorage.clear();
12215
+ window.location.href = `/digit-ui/citizen/login?from=${encodeURIComponent(pathname + search)}`;
12216
+ }
12217
+ if (paymentLoading || isPaymentLoading || isLoading) {
12218
+ window.scrollTo({
12219
+ top: 0,
12220
+ behavior: "smooth"
12221
+ });
12222
+ return /*#__PURE__*/React.createElement(Loader, null);
12223
+ }
12224
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("form", {
12225
+ style: {
12226
+ padding: "20px"
12227
+ },
12228
+ onSubmit: handleSubmit(onSubmit)
12229
+ }, /*#__PURE__*/React.createElement(Header, null, t("PAYMENT_CS_HEADER")), /*#__PURE__*/React.createElement(Card, null, /*#__PURE__*/React.createElement("div", {
12230
+ className: "payment-amount-info",
12231
+ style: {
12232
+ marginBottom: "26px"
12233
+ }
12234
+ }, /*#__PURE__*/React.createElement(CardLabel, {
12235
+ className: "dark"
12236
+ }, t("PAYMENT_CS_TOTAL_AMOUNT_DUE")), /*#__PURE__*/React.createElement(CardSectionHeader, null, " ", "\u20B9 ", paymentAmount !== undefined ? Number(paymentAmount).toFixed(2) : Number(billDetails === null || billDetails === void 0 ? void 0 : billDetails.totalAmount).toFixed(2))), /*#__PURE__*/React.createElement(CardLabel, null, t("PAYMENT_CS_SELECT_METHOD")), (menuList === null || menuList === void 0 ? void 0 : (_menuList$PAYMENT = menuList.PAYMENT) === null || _menuList$PAYMENT === void 0 ? void 0 : (_menuList$PAYMENT$Pay = _menuList$PAYMENT.PaymentGateway) === null || _menuList$PAYMENT$Pay === void 0 ? void 0 : _menuList$PAYMENT$Pay.length) && /*#__PURE__*/React.createElement(Controller, {
12237
+ name: "paymentType",
12238
+ defaultValue: menuList === null || menuList === void 0 ? void 0 : (_menuList$PAYMENT2 = menuList.PAYMENT) === null || _menuList$PAYMENT2 === void 0 ? void 0 : (_menuList$PAYMENT2$Pa = _menuList$PAYMENT2.PaymentGateway) === null || _menuList$PAYMENT2$Pa === void 0 ? void 0 : (_menuList$PAYMENT2$Pa2 = _menuList$PAYMENT2$Pa[0]) === null || _menuList$PAYMENT2$Pa2 === void 0 ? void 0 : _menuList$PAYMENT2$Pa2.gateway,
12239
+ control: control,
12240
+ render: props => {
12241
+ var _menuList$PAYMENT3, _menuList$PAYMENT3$Pa;
12242
+ return /*#__PURE__*/React.createElement(RadioButtons, {
12243
+ selectedOption: props.value,
12244
+ options: menuList === null || menuList === void 0 ? void 0 : (_menuList$PAYMENT3 = menuList.PAYMENT) === null || _menuList$PAYMENT3 === void 0 ? void 0 : (_menuList$PAYMENT3$Pa = _menuList$PAYMENT3.PaymentGateway) === null || _menuList$PAYMENT3$Pa === void 0 ? void 0 : _menuList$PAYMENT3$Pa.map(item => item === null || item === void 0 ? void 0 : item.gateway),
12245
+ onSelect: props.onChange
12246
+ });
12247
+ }
12248
+ })), /*#__PURE__*/React.createElement("div", {
12249
+ className: "card"
12250
+ }, /*#__PURE__*/React.createElement("div", {
12251
+ className: "payment-amount-info",
12252
+ style: {
12253
+ marginBottom: "26px"
12254
+ }
12255
+ }, /*#__PURE__*/React.createElement(CardLabel, {
12256
+ className: "dark"
12257
+ }, t("PAYMENT_CS_PAYER_DETAILS"))), /*#__PURE__*/React.createElement(LabelFieldPair, null, /*#__PURE__*/React.createElement(CardLabel, {
12258
+ className: "card-label-smaller"
12259
+ }, `${t("PAYMENT_CS_PAID_BY")} * `), /*#__PURE__*/React.createElement(Controller, {
12260
+ name: "paidBy",
12261
+ defaultValue: userOptions[0],
12262
+ control: control,
12263
+ render: props => /*#__PURE__*/React.createElement(Dropdown, {
12264
+ className: "text-input-width",
12265
+ selected: props.value,
12266
+ option: userOptions,
12267
+ select: val => {
12268
+ if (val === "OWNER") {
12269
+ props.onChange(val);
12270
+ setValue("name", name || (billDetails === null || billDetails === void 0 ? void 0 : billDetails.payerName) || "");
12271
+ setValue("mobileNumber", mobileNumber || (billDetails === null || billDetails === void 0 ? void 0 : billDetails.mobileNumber) || "");
12272
+ } else if (val === "OTHER") {
12273
+ props.onChange(val);
12274
+ setValue("name", "");
12275
+ setValue("mobileNumber", "");
12276
+ }
12277
+ }
12278
+ })
12279
+ })), /*#__PURE__*/React.createElement(LabelFieldPair, null, /*#__PURE__*/React.createElement(CardLabel, {
12280
+ className: "card-label-smaller"
12281
+ }, `${t("PAYMENT_CS_PAYER_NAME")} * `), /*#__PURE__*/React.createElement("div", {
12282
+ className: "field"
12283
+ }, /*#__PURE__*/React.createElement(Controller, {
12284
+ control: control,
12285
+ name: "name",
12286
+ defaultValue: name || (billDetails === null || billDetails === void 0 ? void 0 : billDetails.payerName) || "",
12287
+ render: props => /*#__PURE__*/React.createElement(TextInput, {
12288
+ className: "text-input-width",
12289
+ value: props.value,
12290
+ onChange: e => {
12291
+ props.onChange(e.target.value);
12292
+ }
12293
+ })
12294
+ }))), /*#__PURE__*/React.createElement(LabelFieldPair, null, /*#__PURE__*/React.createElement(CardLabel, {
12295
+ className: "card-label-smaller"
12296
+ }, `${t("PAYMENT_CS_PAYER_NUMBER")} * `), /*#__PURE__*/React.createElement("div", {
12297
+ className: "field"
12298
+ }, /*#__PURE__*/React.createElement(Controller, {
12299
+ control: control,
12300
+ name: "mobileNumber",
12301
+ defaultValue: mobileNumber || (billDetails === null || billDetails === void 0 ? void 0 : billDetails.mobileNumber) || "",
12302
+ render: props => /*#__PURE__*/React.createElement(MobileNumber, {
12303
+ value: props.value,
12304
+ onChange: e => {
12305
+ props.onChange(e);
12306
+ },
12307
+ componentInFront: /*#__PURE__*/React.createElement("div", {
12308
+ className: "employee-card-input employee-card-input--front numberdisplay"
12309
+ }, "+91")
12310
+ })
12311
+ })))), !showToast && /*#__PURE__*/React.createElement(Card, null, /*#__PURE__*/React.createElement(SubmitBar, {
12312
+ label: t("PAYMENT_CS_BUTTON_LABEL"),
12313
+ submit: true
12314
+ }))), /*#__PURE__*/React.createElement(InfoBanner, {
12315
+ label: t("CS_COMMON_INFO"),
12316
+ text: t("CS_PAYMENT_REDIRECT_NOTICE")
12317
+ }), showToast && /*#__PURE__*/React.createElement(Toast, {
12318
+ error: showToast.key,
12319
+ label: t(showToast.label),
12320
+ onClose: () => {
12321
+ setShowToast(null);
12322
+ },
12323
+ isDleteBtn: true
12324
+ }), showOwnerToast && /*#__PURE__*/React.createElement(Toast, {
12325
+ isDleteBtn: true,
12326
+ error: showOwnerToast.key,
12327
+ label: t(showOwnerToast.label),
12328
+ onClose: () => {
12329
+ setShowOwnerToast(null);
12330
+ }
12331
+ }));
12332
+ };
12333
+
12334
+ function toInteger(dirtyNumber) {
12335
+ if (dirtyNumber === null || dirtyNumber === true || dirtyNumber === false) {
12336
+ return NaN;
12337
+ }
12338
+ var number = Number(dirtyNumber);
12339
+ if (isNaN(number)) {
12340
+ return number;
12341
+ }
12342
+ return number < 0 ? Math.ceil(number) : Math.floor(number);
12343
+ }
12344
+
12345
+ function requiredArgs(required, args) {
12346
+ if (args.length < required) {
12347
+ throw new TypeError(required + ' argument' + (required > 1 ? 's' : '') + ' required, but only ' + args.length + ' present');
12348
+ }
12349
+ }
12350
+
12351
+ function toDate(argument) {
12352
+ requiredArgs(1, arguments);
12353
+ var argStr = Object.prototype.toString.call(argument);
12354
+ if (argument instanceof Date || typeof argument === 'object' && argStr === '[object Date]') {
12355
+ return new Date(argument.getTime());
12356
+ } else if (typeof argument === 'number' || argStr === '[object Number]') {
12357
+ return new Date(argument);
12358
+ } else {
12359
+ if ((typeof argument === 'string' || argStr === '[object String]') && typeof console !== 'undefined') {
12360
+ console.warn("Starting with v2.0.0-beta.1 date-fns doesn't accept strings as date arguments. Please use `parseISO` to parse strings. See: https://git.io/fjule");
12361
+ console.warn(new Error().stack);
12362
+ }
12363
+ return new Date(NaN);
12364
+ }
12365
+ }
12366
+
12367
+ function addMilliseconds(dirtyDate, dirtyAmount) {
12368
+ requiredArgs(2, arguments);
12369
+ var timestamp = toDate(dirtyDate).getTime();
12370
+ var amount = toInteger(dirtyAmount);
11883
12371
  return new Date(timestamp + amount);
11884
12372
  }
11885
12373
 
@@ -13338,8 +13826,9 @@ const convertEpochToDate$1 = dateEpoch => {
13338
13826
  }
13339
13827
  };
13340
13828
  const SuccessfulPayment$1 = props => {
13341
- var _location, _location$pathname, _JSON$parse, _JSON$parse$value, _JSON$parse$value$inf, _data$, _data$2, _data$8, _data$9, _data$0, _data$1, _data$10, _data$11, _data$12, _data$13, _data$14;
13829
+ var _location$pathname, _receiptNumber, _JSON$parse, _JSON$parse$value, _JSON$parse$value$inf, _data$, _data$2, _dataCheck$payments, _dataCheck$payments$P, _dataCheck$payments$P2, _dataCheck$payments$P3, _data$8, _data$9, _data$0, _data$1, _data$10, _data$11, _data$12, _data$13, _data$14;
13342
13830
  const history = useHistory();
13831
+ const location = useLocation();
13343
13832
  const {
13344
13833
  t
13345
13834
  } = useTranslation();
@@ -13349,19 +13838,28 @@ const SuccessfulPayment$1 = props => {
13349
13838
  } = Digit.Hooks.useQueryParams();
13350
13839
  const [displayMenu, setDisplayMenu] = useState(false);
13351
13840
  const [selectedAction, setSelectedAction] = useState(null);
13352
- const isFSMResponse = (_location = location) === null || _location === void 0 ? void 0 : (_location$pathname = _location.pathname) === null || _location$pathname === void 0 ? void 0 : _location$pathname.includes("payment/success/FSM.TRIP_CHARGES");
13841
+ const isFSMResponse = location === null || location === void 0 ? void 0 : (_location$pathname = location.pathname) === null || _location$pathname === void 0 ? void 0 : _location$pathname.includes("payment/success/FSM.TRIP_CHARGES");
13353
13842
  const combineResponseFSM = isFSMResponse ? `${t("PAYMENT_COLLECT_LABEL")} / ${t("PAYMENT_COLLECT")}` : t("PAYMENT_LOCALIZATION_RESPONSE");
13354
13843
  const [printing, setPrinting] = useState(false);
13355
13844
  const [chbPermissionLoading, setChbPermissionLoading] = useState(false);
13356
13845
  props.setLink(combineResponseFSM);
13846
+ const checkParam = useParams();
13847
+ const queryParams = new URLSearchParams(location.search);
13848
+ const egPgTxnId = queryParams.get("eg_pg_txnid");
13849
+ const razorpayPaymentId = queryParams.get("razorpayPaymentId");
13850
+ const razorpayOrderId = queryParams.get("razorpayOrderId");
13851
+ const razorpaySignature = queryParams.get("razorpaySignature");
13357
13852
  let {
13358
13853
  consumerCode,
13359
13854
  receiptNumber,
13360
13855
  businessService
13361
13856
  } = useParams();
13362
- console.log("consummennene", consumerCode);
13857
+ const isMCollectService = (businessService === null || businessService === void 0 ? void 0 : businessService.includes(".")) && !(businessService !== null && businessService !== void 0 && businessService.includes("FSM")) && !(businessService !== null && businessService !== void 0 && businessService.includes("WS")) && !(businessService !== null && businessService !== void 0 && businessService.includes("SW")) && !(businessService !== null && businessService !== void 0 && businessService.includes("GC")) && !(businessService !== null && businessService !== void 0 && businessService.includes("BPA"));
13858
+ console.log("checkParam", checkParam);
13859
+ console.log("egPgTxnId", egPgTxnId);
13860
+ console.log("businessService", businessService);
13363
13861
  const tenantId = Digit.ULBService.getCurrentTenantId();
13364
- receiptNumber = receiptNumber.replace(/%2F/g, "/");
13862
+ receiptNumber = (_receiptNumber = receiptNumber) === null || _receiptNumber === void 0 ? void 0 : _receiptNumber.replace(/%2F/g, "/");
13365
13863
  const {
13366
13864
  data = {},
13367
13865
  isLoading: isBpaSearchLoading,
@@ -13381,6 +13879,18 @@ const SuccessfulPayment$1 = props => {
13381
13879
  const selectedTenantData = cities.data.find(item => item.city.districtTenantCode === loginCity);
13382
13880
  ulbType = selectedTenantData === null || selectedTenantData === void 0 ? void 0 : (_selectedTenantData$c = selectedTenantData.city) === null || _selectedTenantData$c === void 0 ? void 0 : _selectedTenantData$c.ulbGrade;
13383
13881
  }
13882
+ const {
13883
+ isLoading,
13884
+ data: dataCheck,
13885
+ isError
13886
+ } = Digit.Hooks.usePaymentUpdate({
13887
+ egId: egPgTxnId
13888
+ }, businessService, {
13889
+ enabled: !!egPgTxnId,
13890
+ retry: false,
13891
+ staleTime: Infinity,
13892
+ refetchOnWindowFocus: false
13893
+ });
13384
13894
  const mutation = Digit.Hooks.chb.useChbCreateAPI(tenantId, false);
13385
13895
  const FSM_EDITOR = Digit.UserService.hasAccess("FSM_EDITOR_EMP") || false;
13386
13896
  function onActionSelect(action) {
@@ -13446,24 +13956,14 @@ const SuccessfulPayment$1 = props => {
13446
13956
  }) => businessService === null || businessService === void 0 ? void 0 : businessService.includes(code))[0]) === null || _data$commonMasters$u2 === void 0 ? void 0 : _data$commonMasters$u2.receiptKey) || "consolidatedreceipt";
13447
13957
  }
13448
13958
  });
13449
- const printCertificate = async () => {
13450
- const tenantId = Digit.ULBService.getCurrentTenantId();
13451
- const state = Digit.ULBService.getStateId();
13452
- const applicationDetails = await Digit.TLService.search({
13453
- applicationNumber: consumerCode,
13454
- tenantId
13455
- });
13456
- const generatePdfKeyForTL = "tlcertificate";
13457
- if (applicationDetails) {
13458
- let response = await Digit.PaymentService.generatePdf(state, {
13459
- Licenses: applicationDetails === null || applicationDetails === void 0 ? void 0 : applicationDetails.Licenses
13460
- }, generatePdfKeyForTL);
13461
- const fileStore = await Digit.PaymentService.printReciept(state, {
13462
- fileStoreIds: response.filestoreIds[0]
13463
- });
13464
- window.open(fileStore[response.filestoreIds[0]], "_blank");
13465
- }
13466
- };
13959
+ const {
13960
+ printReceipt: printBillReceipt
13961
+ } = Digit.Hooks.usePrintBillReceipt({
13962
+ tenantId,
13963
+ setLoader: setPrinting,
13964
+ t,
13965
+ pdfkey: generatePdfKey
13966
+ });
13467
13967
  const convertDateToEpoch = (dateString, dayStartOrEnd = "dayend") => {
13468
13968
  try {
13469
13969
  const parts = dateString.match(/(\d{4})-(\d{1,2})-(\d{1,2})/);
@@ -13539,15 +14039,28 @@ const SuccessfulPayment$1 = props => {
13539
14039
  if (chbPermissionLoading) return;
13540
14040
  setChbPermissionLoading(true);
13541
14041
  try {
13542
- var _applicationDetails$c, _applicationDetails$c2, _applicationDetails$c3, _applicationDetails$c4, _applicationDetails$c5, _applicationDetails$c6, _applicationDetails$A3, _applicationDetails$A4;
14042
+ var _applicationDetails$c, _challanDetails$addit, _challanDetails$addit2, _challanDetails$addre, _applicationDetails$A3, _applicationDetails$A4;
13543
14043
  const applicationDetails = await Digit.ChallanGenerationService.search({
13544
14044
  tenantId,
13545
14045
  filters: {
13546
14046
  challanNo: consumerCode
13547
14047
  }
13548
14048
  });
13549
- const location = await getLocationName(applicationDetails === null || applicationDetails === void 0 ? void 0 : (_applicationDetails$c = applicationDetails.challans) === null || _applicationDetails$c === void 0 ? void 0 : (_applicationDetails$c2 = _applicationDetails$c[0]) === null || _applicationDetails$c2 === void 0 ? void 0 : (_applicationDetails$c3 = _applicationDetails$c2.additionalDetail) === null || _applicationDetails$c3 === void 0 ? void 0 : _applicationDetails$c3.latitude, applicationDetails === null || applicationDetails === void 0 ? void 0 : (_applicationDetails$c4 = applicationDetails.challans) === null || _applicationDetails$c4 === void 0 ? void 0 : (_applicationDetails$c5 = _applicationDetails$c4[0]) === null || _applicationDetails$c5 === void 0 ? void 0 : (_applicationDetails$c6 = _applicationDetails$c5.additionalDetail) === null || _applicationDetails$c6 === void 0 ? void 0 : _applicationDetails$c6.longitude);
13550
- console.log('location', location);
14049
+ const challanDetails = applicationDetails === null || applicationDetails === void 0 ? void 0 : (_applicationDetails$c = applicationDetails.challans) === null || _applicationDetails$c === void 0 ? void 0 : _applicationDetails$c[0];
14050
+ const latitude = challanDetails === null || challanDetails === void 0 ? void 0 : (_challanDetails$addit = challanDetails.additionalDetail) === null || _challanDetails$addit === void 0 ? void 0 : _challanDetails$addit.latitude;
14051
+ const longitude = challanDetails === null || challanDetails === void 0 ? void 0 : (_challanDetails$addit2 = challanDetails.additionalDetail) === null || _challanDetails$addit2 === void 0 ? void 0 : _challanDetails$addit2.longitude;
14052
+ const addressFallback = challanDetails === null || challanDetails === void 0 ? void 0 : (_challanDetails$addre = challanDetails.address) === null || _challanDetails$addre === void 0 ? void 0 : _challanDetails$addre.addressLine1;
14053
+ let location = addressFallback;
14054
+ if (latitude && longitude) {
14055
+ try {
14056
+ const geoLocation = await getLocationName(latitude, longitude);
14057
+ if (geoLocation) {
14058
+ location = geoLocation;
14059
+ }
14060
+ } catch (err) {
14061
+ console.warn("Reverse geocoding failed, using address fallback", err);
14062
+ }
14063
+ }
13551
14064
  const challan = {
13552
14065
  ...applicationDetails,
13553
14066
  ...challanEmpData
@@ -13727,13 +14240,21 @@ const SuccessfulPayment$1 = props => {
13727
14240
  receiptNumbers: receiptNumber
13728
14241
  });
13729
14242
  try {
13730
- var _payments$Payments$4;
14243
+ var _applicationDetails$P, _payments$Payments$4;
14244
+ const applicationDetails = await Digit.PTRService.search({
14245
+ tenantId,
14246
+ filters: {
14247
+ applicationNumber: consumerCode
14248
+ }
14249
+ });
14250
+ const application = applicationDetails === null || applicationDetails === void 0 ? void 0 : (_applicationDetails$P = applicationDetails.PetRegistrationApplications) === null || _applicationDetails$P === void 0 ? void 0 : _applicationDetails$P[0];
13731
14251
  let fileStoreId = (_payments$Payments$4 = payments.Payments[0]) === null || _payments$Payments$4 === void 0 ? void 0 : _payments$Payments$4.fileStoreId;
13732
14252
  if (!fileStoreId) {
13733
14253
  var _payments$Payments6;
13734
14254
  let response = await Digit.PaymentService.generatePdf(tenantId, {
13735
14255
  Payments: [{
13736
- ...((payments === null || payments === void 0 ? void 0 : (_payments$Payments6 = payments.Payments) === null || _payments$Payments6 === void 0 ? void 0 : _payments$Payments6[0]) || {})
14256
+ ...((payments === null || payments === void 0 ? void 0 : (_payments$Payments6 = payments.Payments) === null || _payments$Payments6 === void 0 ? void 0 : _payments$Payments6[0]) || {}),
14257
+ application
13737
14258
  }]
13738
14259
  }, "pet-receipt-employee");
13739
14260
  fileStoreId = response === null || response === void 0 ? void 0 : response.filestoreIds[0];
@@ -13782,6 +14303,30 @@ const SuccessfulPayment$1 = props => {
13782
14303
  setPrinting(false);
13783
14304
  }
13784
14305
  };
14306
+ const printMCollectReceipt = async () => {
14307
+ if (printing) return;
14308
+ setPrinting(true);
14309
+ try {
14310
+ var _payments$Payments8, _payments$Payments8$, _payments$Payments9, _payments$Payments9$;
14311
+ const payments = await Digit.PaymentService.getReciept(tenantId, businessService, {
14312
+ consumerCodes: consumerCode
14313
+ });
14314
+ let response = {
14315
+ filestoreIds: [payments === null || payments === void 0 ? void 0 : (_payments$Payments8 = payments.Payments) === null || _payments$Payments8 === void 0 ? void 0 : (_payments$Payments8$ = _payments$Payments8[0]) === null || _payments$Payments8$ === void 0 ? void 0 : _payments$Payments8$.fileStoreId]
14316
+ };
14317
+ if (!(payments !== null && payments !== void 0 && (_payments$Payments9 = payments.Payments) !== null && _payments$Payments9 !== void 0 && (_payments$Payments9$ = _payments$Payments9[0]) !== null && _payments$Payments9$ !== void 0 && _payments$Payments9$.fileStoreId)) {
14318
+ response = await Digit.PaymentService.generatePdf(tenantId, {
14319
+ Payments: payments.Payments
14320
+ }, generatePdfKey || "consolidatedreceipt");
14321
+ }
14322
+ const fileStore = await Digit.PaymentService.printReciept(tenantId, {
14323
+ fileStoreIds: response.filestoreIds[0]
14324
+ });
14325
+ window.open(fileStore[response.filestoreIds[0]], "_blank");
14326
+ } finally {
14327
+ setPrinting(false);
14328
+ }
14329
+ };
13785
14330
  const svCertificate = async () => {
13786
14331
  const state = tenantId;
13787
14332
  const applicationDetails = await Digit.SVService.search({
@@ -14195,18 +14740,19 @@ const SuccessfulPayment$1 = props => {
14195
14740
  });
14196
14741
  window.open(fileStore[response.filestoreIds[0]], "_blank");
14197
14742
  };
14198
- if (businessService !== null && businessService !== void 0 && businessService.includes("BPA") && isBpaSearchLoading) return /*#__PURE__*/React.createElement(Loader, null);
14743
+ if (isLoading) return /*#__PURE__*/React.createElement(Loader, null);
14744
+ const checkRecieptNumber = dataCheck === null || dataCheck === void 0 ? void 0 : (_dataCheck$payments = dataCheck.payments) === null || _dataCheck$payments === void 0 ? void 0 : (_dataCheck$payments$P = _dataCheck$payments.Payments) === null || _dataCheck$payments$P === void 0 ? void 0 : (_dataCheck$payments$P2 = _dataCheck$payments$P[0]) === null || _dataCheck$payments$P2 === void 0 ? void 0 : (_dataCheck$payments$P3 = _dataCheck$payments$P2.paymentDetails[0]) === null || _dataCheck$payments$P3 === void 0 ? void 0 : _dataCheck$payments$P3.receiptNumber;
14199
14745
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Card, null, /*#__PURE__*/React.createElement(Banner, {
14200
14746
  message: getMessage(),
14201
14747
  info: t("PAYMENT_LOCALIZATION_RECIEPT_NO"),
14202
- applicationNumber: receiptNumber,
14748
+ applicationNumber: receiptNumber || checkRecieptNumber,
14203
14749
  successful: true
14204
14750
  }), /*#__PURE__*/React.createElement(CardText, null, getCardText()), generatePdfKey ? /*#__PURE__*/React.createElement("div", {
14205
14751
  style: {
14206
14752
  display: "flex",
14207
14753
  justifyContent: "space-evenly"
14208
14754
  }
14209
- }, businessService !== "chb-services" && businessService !== "adv-services" && businessService !== "pet-services" && businessService !== "NDC" && businessService !== "Challan_Generation" && /*#__PURE__*/React.createElement("div", {
14755
+ }, businessService !== "chb-services" && businessService !== "adv-services" && businessService !== "GC.ONE_TIME_FEE" && businessService !== "pet-services" && businessService !== "NDC" && businessService !== "Challan_Generation" && businessService !== "rl-services" && !isMCollectService && /*#__PURE__*/React.createElement("div", {
14210
14756
  className: "primary-label-btn d-grid",
14211
14757
  style: {
14212
14758
  marginLeft: "unset",
@@ -14223,23 +14769,7 @@ const SuccessfulPayment$1 = props => {
14223
14769
  fill: "none"
14224
14770
  }), /*#__PURE__*/React.createElement("path", {
14225
14771
  d: "M19 8H5c-1.66 0-3 1.34-3 3v6h4v4h12v-4h4v-6c0-1.66-1.34-3-3-3zm-3 11H8v-5h8v5zm3-7c-.55 0-1-.45-1-1s.45-1 1-1 1 .45 1 1-.45 1-1 1zm-1-9H6v4h12V3z"
14226
- })), t("CS_COMMON_PRINT_RECEIPT"))), businessService == "TL" ? /*#__PURE__*/React.createElement("div", {
14227
- className: "primary-label-btn d-grid",
14228
- style: {
14229
- marginLeft: "unset"
14230
- },
14231
- onClick: printCertificate
14232
- }, /*#__PURE__*/React.createElement("svg", {
14233
- xmlns: "http://www.w3.org/2000/svg",
14234
- height: "24",
14235
- viewBox: "0 0 24 24",
14236
- width: "24"
14237
- }, /*#__PURE__*/React.createElement("path", {
14238
- d: "M0 0h24v24H0z",
14239
- fill: "none"
14240
- }), /*#__PURE__*/React.createElement("path", {
14241
- d: "M19 8H5c-1.66 0-3 1.34-3 3v6h4v4h12v-4h4v-6c0-1.66-1.34-3-3-3zm-3 11H8v-5h8v5zm3-7c-.55 0-1-.45-1-1s.45-1 1-1 1 .45 1 1-.45 1-1 1zm-1-9H6v4h12V3z"
14242
- })), t("CS_COMMON_PRINT_CERTIFICATE")) : null, businessService == "sv-services" ? /*#__PURE__*/React.createElement("div", {
14772
+ })), t("CS_COMMON_PRINT_RECEIPT"))), businessService == "sv-services" ? /*#__PURE__*/React.createElement("div", {
14243
14773
  className: "primary-label-btn d-grid",
14244
14774
  style: {
14245
14775
  marginLeft: "unset",
@@ -14400,6 +14930,54 @@ const SuccessfulPayment$1 = props => {
14400
14930
  fill: "none"
14401
14931
  }), /*#__PURE__*/React.createElement("path", {
14402
14932
  d: "M19 8H5c-1.66 0-3 1.34-3 3v6h4v4h12v-4h4v-6c0-1.66-1.34-3-3-3zm-3 11H8v-5h8v5zm3-7c-.55 0-1-.45-1-1s.45-1 1-1 1 .45 1 1-.45 1-1 1zm-1-9H6v4h12V3z"
14933
+ })), t("CHB_FEE_RECEIPT")))) : null, isMCollectService ? /*#__PURE__*/React.createElement("div", {
14934
+ style: {
14935
+ display: "flex",
14936
+ justifyContent: "flex-end",
14937
+ gap: "20px",
14938
+ marginRight: "20px",
14939
+ marginTop: "15px",
14940
+ marginBottom: "15px"
14941
+ }
14942
+ }, /*#__PURE__*/React.createElement("div", {
14943
+ className: "primary-label-btn d-grid",
14944
+ onClick: printing ? undefined : printMCollectReceipt
14945
+ }, printing ? /*#__PURE__*/React.createElement(Loader, null) : /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement("svg", {
14946
+ xmlns: "http://www.w3.org/2000/svg",
14947
+ height: "24",
14948
+ viewBox: "0 0 24 24",
14949
+ width: "24"
14950
+ }, /*#__PURE__*/React.createElement("path", {
14951
+ d: "M0 0h24v24H0z",
14952
+ fill: "none"
14953
+ }), /*#__PURE__*/React.createElement("path", {
14954
+ d: "M19 8H5c-1.66 0-3 1.34-3 3v6h4v4h12v-4h4v-6c0-1.66-1.34-3-3-3zm-3 11H8v-5h8v5zm3-7c-.55 0-1-.45-1-1s.45-1 1-1 1 .45 1 1-.45 1-1 1zm-1-9H6v4h12V3z"
14955
+ })), t("CS_COMMON_PRINT_RECEIPT")))) : null, businessService === "rl-services" || businessService === "GC.ONE_TIME_FEE" ? /*#__PURE__*/React.createElement("div", {
14956
+ style: {
14957
+ display: "flex",
14958
+ justifyContent: "flex-end",
14959
+ gap: "20px",
14960
+ marginRight: "20px",
14961
+ marginTop: "15px",
14962
+ marginBottom: "15px"
14963
+ }
14964
+ }, /*#__PURE__*/React.createElement("div", {
14965
+ className: "primary-label-btn d-grid",
14966
+ onClick: printing ? undefined : () => printBillReceipt({
14967
+ businessService: businessService,
14968
+ receiptNumber: receiptNumber,
14969
+ rootKey: "PAYMENTS"
14970
+ })
14971
+ }, printing ? /*#__PURE__*/React.createElement(Loader, null) : /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement("svg", {
14972
+ xmlns: "http://www.w3.org/2000/svg",
14973
+ height: "24",
14974
+ viewBox: "0 0 24 24",
14975
+ width: "24"
14976
+ }, /*#__PURE__*/React.createElement("path", {
14977
+ d: "M0 0h24v24H0z",
14978
+ fill: "none"
14979
+ }), /*#__PURE__*/React.createElement("path", {
14980
+ d: "M19 8H5c-1.66 0-3 1.34-3 3v6h4v4h12v-4h4v-6c0-1.66-1.34-3-3-3zm-3 11H8v-5h8v5zm3-7c-.55 0-1-.45-1-1s.45-1 1-1 1 .45 1 1-.45 1-1 1zm-1-9H6v4h12V3z"
14403
14981
  })), t("CHB_FEE_RECEIPT")))) : null, businessService == "Challan_Generation" ? /*#__PURE__*/React.createElement("div", {
14404
14982
  style: {
14405
14983
  display: "flex",
@@ -14751,8 +15329,15 @@ const EmployeePayment = ({
14751
15329
  path: `${currentPath}/collect/:businessService/:consumerCode`
14752
15330
  }, /*#__PURE__*/React.createElement(CollectPayment, Object.assign({}, commonProps, {
14753
15331
  basePath: currentPath
15332
+ }))), /*#__PURE__*/React.createElement(Route, {
15333
+ path: `${currentPath}/challan/collect/:businessService/:consumerCode`
15334
+ }, /*#__PURE__*/React.createElement(SelectPaymentType$2, Object.assign({}, commonProps, {
15335
+ basePath: currentPath,
15336
+ stateCode: stateCode
14754
15337
  }))), /*#__PURE__*/React.createElement(Route, {
14755
15338
  path: `${currentPath}/success/:businessService/:receiptNumber/:consumerCode`
15339
+ }, /*#__PURE__*/React.createElement(SuccessfulPayment$1, commonProps)), /*#__PURE__*/React.createElement(Route, {
15340
+ path: `${currentPath}/challan/success/:businessService/:consumerCode`
14756
15341
  }, /*#__PURE__*/React.createElement(SuccessfulPayment$1, commonProps)), /*#__PURE__*/React.createElement(Route, {
14757
15342
  path: `${currentPath}/integration/:moduleName/:pageName`
14758
15343
  }, /*#__PURE__*/React.createElement(IFrameInterface, commonProps)), /*#__PURE__*/React.createElement(Route, {
@@ -14916,7 +15501,7 @@ const amountToWords = num => {
14916
15501
  return res.trim();
14917
15502
  };
14918
15503
  let [r, p] = num.toString().split(".").map(x => +x || 0);
14919
- return (r ? toWords(r) + " Rupees" : "") + (p ? (r ? " and " : "") + toWords(p) + " Paise" : "") || "Zero Rupees";
15504
+ return (r ? "Rupees " + toWords(r) : "") + (p ? (r ? " and " : "") + toWords(p) + " Paise" : "") || "Rupees Zero ";
14920
15505
  };
14921
15506
  const ChallanData = (tenantId, consumerCode) => {
14922
15507
  var _wfData$data, _wfData$data$processI, _officerInstance$assi, _employeeData$data, _employeeData$data$Em, _officerRaw$assignmen, _officerRaw$user;