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

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.
@@ -7290,6 +7290,7 @@ const WrapPaymentComponent = props => {
7290
7290
  },
7291
7291
  enabled: allowFetchBill
7292
7292
  });
7293
+ console.log('reciept_data in citizen response', reciept_data);
7293
7294
  const {
7294
7295
  data: generatePdfKey
7295
7296
  } = Digit.Hooks.useCommonMDMS(newTenantId, "common-masters", "ReceiptKey", {
@@ -7304,6 +7305,14 @@ const WrapPaymentComponent = props => {
7304
7305
  refetchOnWindowFocus: false
7305
7306
  });
7306
7307
  const payments = data === null || data === void 0 ? void 0 : data.payments;
7308
+ const {
7309
+ printReceipt: printBillReceipt
7310
+ } = Digit.Hooks.usePrintBillReceipt({
7311
+ tenantId,
7312
+ setLoader: setPrinting,
7313
+ t,
7314
+ pdfkey: generatePdfKey
7315
+ });
7307
7316
  useEffect(() => {
7308
7317
  return () => {
7309
7318
  localStorage.setItem("BillPaymentEnabled", "false");
@@ -7419,6 +7428,7 @@ const WrapPaymentComponent = props => {
7419
7428
  const fee = paymentData === null || paymentData === void 0 ? void 0 : paymentData.totalAmountPaid;
7420
7429
  console.log("fee here here", fee);
7421
7430
  const amountinwords = amountToWords(fee);
7431
+ console.log('amountinwords', amountinwords);
7422
7432
  let response = {
7423
7433
  filestoreIds: [(_payments$Payments$ = payments.Payments[0]) === null || _payments$Payments$ === void 0 ? void 0 : _payments$Payments$.fileStoreId]
7424
7434
  };
@@ -7462,7 +7472,7 @@ const WrapPaymentComponent = props => {
7462
7472
  ...paymentData
7463
7473
  }]
7464
7474
  }, generatePdfKeyForWs);
7465
- } else if (paymentData.paymentDetails[0].businessService.includes("BPA") || paymentData.paymentDetails[0].businessService.includes("clu") || paymentData.paymentDetails[0].businessService.includes("layout")) {
7475
+ } else if (paymentData.paymentDetails[0].businessService.includes("BPA") || paymentData.paymentDetails[0].businessService.includes("clu") || paymentData.paymentDetails[0].businessService.includes("LAYOUT")) {
7466
7476
  const designation = ulbType === "Municipal Corporation" ? "Municipal Commissioner" : "Executive Officer";
7467
7477
  let updatedpayments;
7468
7478
  if (paymentData.paymentDetails[0].businessService.includes("BPAREG")) {
@@ -7488,6 +7498,7 @@ const WrapPaymentComponent = props => {
7488
7498
  } else {
7489
7499
  updatedpayments = {
7490
7500
  ...paymentData,
7501
+ BPA: [bpaData === null || bpaData === void 0 ? void 0 : bpaData[0]],
7491
7502
  additionalDetails: {
7492
7503
  ...paymentData.additionalDetails,
7493
7504
  designation: designation,
@@ -7507,9 +7518,11 @@ const WrapPaymentComponent = props => {
7507
7518
  }]
7508
7519
  }, generatePdfKey);
7509
7520
  } else {
7521
+ console.log('this else triggered');
7510
7522
  response = await Digit.PaymentService.generatePdf(tenantId, {
7511
7523
  Payments: [{
7512
- ...paymentData
7524
+ ...paymentData,
7525
+ amountinwords
7513
7526
  }]
7514
7527
  }, generatePdfKey);
7515
7528
  }
@@ -7522,7 +7535,21 @@ const WrapPaymentComponent = props => {
7522
7535
  fileStoreIds: response.filestoreIds[0]
7523
7536
  });
7524
7537
  if (fileStore && fileStore[response.filestoreIds[0]]) {
7525
- window.open(fileStore[response.filestoreIds[0]], "_blank");
7538
+ const receiptUrl = fileStore[response.filestoreIds[0]];
7539
+ if (business_service === "obpas_noc") {
7540
+ const urlObj = new URL(receiptUrl);
7541
+ const downloadUrl = `${window.origin}${urlObj.pathname}${urlObj.search}`;
7542
+ try {
7543
+ const res = await fetch(downloadUrl);
7544
+ const blob = await res.blob();
7545
+ downloadPdf(blob, `receipt_${receiptNumber || "obpas_noc"}.pdf`);
7546
+ } catch (err) {
7547
+ console.log(err, "error in receipt download");
7548
+ window.open(downloadUrl, "_blank");
7549
+ }
7550
+ } else {
7551
+ window.open(receiptUrl, "_blank");
7552
+ }
7526
7553
  }
7527
7554
  setPrinting(false);
7528
7555
  };
@@ -7550,6 +7577,40 @@ const WrapPaymentComponent = props => {
7550
7577
  });
7551
7578
  }
7552
7579
  };
7580
+ const printPetReceipt = async () => {
7581
+ if (printing) return;
7582
+ setPrinting(true);
7583
+ const payments = await Digit.PaymentService.getReciept(tenantId, business_service, {
7584
+ receiptNumbers: receiptNumber
7585
+ });
7586
+ try {
7587
+ var _applicationDetails$P, _payments$Payments$2;
7588
+ const applicationDetails = await Digit.PTRService.search({
7589
+ tenantId,
7590
+ filters: {
7591
+ applicationNumber: consumerCode
7592
+ }
7593
+ });
7594
+ const application = applicationDetails === null || applicationDetails === void 0 ? void 0 : (_applicationDetails$P = applicationDetails.PetRegistrationApplications) === null || _applicationDetails$P === void 0 ? void 0 : _applicationDetails$P[0];
7595
+ let fileStoreId = (_payments$Payments$2 = payments.Payments[0]) === null || _payments$Payments$2 === void 0 ? void 0 : _payments$Payments$2.fileStoreId;
7596
+ if (!fileStoreId) {
7597
+ var _payments$Payments;
7598
+ let response = await Digit.PaymentService.generatePdf(tenantId, {
7599
+ Payments: [{
7600
+ ...((payments === null || payments === void 0 ? void 0 : (_payments$Payments = payments.Payments) === null || _payments$Payments === void 0 ? void 0 : _payments$Payments[0]) || {}),
7601
+ application
7602
+ }]
7603
+ }, "petservice-receipt");
7604
+ fileStoreId = response === null || response === void 0 ? void 0 : response.filestoreIds[0];
7605
+ }
7606
+ const fileStore = await Digit.PaymentService.printReciept(tenantId, {
7607
+ fileStoreIds: fileStoreId
7608
+ });
7609
+ window.open(fileStore[fileStoreId], "_blank");
7610
+ } finally {
7611
+ setPrinting(false);
7612
+ }
7613
+ };
7553
7614
  const downloadPdf = (blob, fileName) => {
7554
7615
  if (window.mSewaApp && window.mSewaApp.isMsewaApp() && window.mSewaApp.downloadBase64File) {
7555
7616
  var reader = new FileReader();
@@ -7665,13 +7726,13 @@ const WrapPaymentComponent = props => {
7665
7726
  let application = challan;
7666
7727
  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
7728
  if (!fileStoreId) {
7668
- var _payments$Payments;
7729
+ var _payments$Payments2;
7669
7730
  const payments = await Digit.PaymentService.getReciept(tenantId, business_service, {
7670
7731
  receiptNumbers: receiptNumber
7671
7732
  });
7672
7733
  let response = await Digit.PaymentService.generatePdf(tenantId, {
7673
7734
  Payments: [{
7674
- ...((payments === null || payments === void 0 ? void 0 : (_payments$Payments = payments.Payments) === null || _payments$Payments === void 0 ? void 0 : _payments$Payments[0]) || {}),
7735
+ ...((payments === null || payments === void 0 ? void 0 : (_payments$Payments2 = payments.Payments) === null || _payments$Payments2 === void 0 ? void 0 : _payments$Payments2[0]) || {}),
7675
7736
  challan: application
7676
7737
  }]
7677
7738
  }, "challangeneration-receipt");
@@ -7689,15 +7750,28 @@ const WrapPaymentComponent = props => {
7689
7750
  if (chbPermissionLoading) return;
7690
7751
  setChbPermissionLoading(true);
7691
7752
  try {
7692
- var _applicationDetails$c, _applicationDetails$c2, _applicationDetails$c3, _applicationDetails$c4, _applicationDetails$c5, _applicationDetails$c6, _applicationDetails$A3, _applicationDetails$A4;
7753
+ var _applicationDetails$c, _challanDetails$addit, _challanDetails$addit2, _challanDetails$addre, _applicationDetails$A3, _applicationDetails$A4;
7693
7754
  const applicationDetails = await Digit.ChallanGenerationService.search({
7694
7755
  tenantId,
7695
7756
  filters: {
7696
7757
  challanNo: consumerCode
7697
7758
  }
7698
7759
  });
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);
7760
+ const challanDetails = applicationDetails === null || applicationDetails === void 0 ? void 0 : (_applicationDetails$c = applicationDetails.challans) === null || _applicationDetails$c === void 0 ? void 0 : _applicationDetails$c[0];
7761
+ const latitude = challanDetails === null || challanDetails === void 0 ? void 0 : (_challanDetails$addit = challanDetails.additionalDetail) === null || _challanDetails$addit === void 0 ? void 0 : _challanDetails$addit.latitude;
7762
+ const longitude = challanDetails === null || challanDetails === void 0 ? void 0 : (_challanDetails$addit2 = challanDetails.additionalDetail) === null || _challanDetails$addit2 === void 0 ? void 0 : _challanDetails$addit2.longitude;
7763
+ const addressFallback = challanDetails === null || challanDetails === void 0 ? void 0 : (_challanDetails$addre = challanDetails.address) === null || _challanDetails$addre === void 0 ? void 0 : _challanDetails$addre.addressLine1;
7764
+ let location = addressFallback;
7765
+ if (latitude && longitude) {
7766
+ try {
7767
+ const geoLocation = await getLocationName(latitude, longitude);
7768
+ if (geoLocation) {
7769
+ location = geoLocation;
7770
+ }
7771
+ } catch (err) {
7772
+ console.warn("Reverse geocoding failed, using address fallback", err);
7773
+ }
7774
+ }
7701
7775
  const challan = {
7702
7776
  ...applicationDetails,
7703
7777
  ...challanEmpData
@@ -7706,14 +7780,14 @@ const WrapPaymentComponent = props => {
7706
7780
  let application = challan;
7707
7781
  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
7782
  if (!fileStoreId) {
7709
- var _payments$Payments2;
7783
+ var _payments$Payments3;
7710
7784
  const payments = await Digit.PaymentService.getReciept(tenantId, business_service, {
7711
7785
  receiptNumbers: receiptNumber
7712
7786
  });
7713
7787
  let response = await Digit.PaymentService.generatePdf(tenantId, {
7714
7788
  challan: {
7715
7789
  ...application,
7716
- ...((payments === null || payments === void 0 ? void 0 : (_payments$Payments2 = payments.Payments) === null || _payments$Payments2 === void 0 ? void 0 : _payments$Payments2[0]) || {}),
7790
+ ...((payments === null || payments === void 0 ? void 0 : (_payments$Payments3 = payments.Payments) === null || _payments$Payments3 === void 0 ? void 0 : _payments$Payments3[0]) || {}),
7717
7791
  location
7718
7792
  }
7719
7793
  }, "challan-notice");
@@ -7753,13 +7827,14 @@ const WrapPaymentComponent = props => {
7753
7827
  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
7828
  const generatePdfKeyForTL = "chb-permissionletter";
7755
7829
  if (!fileStoreId) {
7756
- var _payments$Payments3;
7830
+ var _payments$Payments4;
7757
7831
  const payments = await Digit.PaymentService.getReciept(tenantId, business_service, {
7758
7832
  receiptNumbers: receiptNumber
7759
7833
  });
7834
+ const pdfPayments = fixAdjustedAmount(payments === null || payments === void 0 ? void 0 : (_payments$Payments4 = payments.Payments) === null || _payments$Payments4 === void 0 ? void 0 : _payments$Payments4[0]);
7760
7835
  const response = await Digit.PaymentService.generatePdf(tenantId, {
7761
7836
  Payments: [{
7762
- ...((payments === null || payments === void 0 ? void 0 : (_payments$Payments3 = payments.Payments) === null || _payments$Payments3 === void 0 ? void 0 : _payments$Payments3[0]) || {}),
7837
+ ...pdfPayments,
7763
7838
  ...application
7764
7839
  }]
7765
7840
  }, generatePdfKeyForTL);
@@ -7805,13 +7880,14 @@ const WrapPaymentComponent = props => {
7805
7880
  };
7806
7881
  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
7882
  if (!fileStoreId) {
7808
- var _payments$Payments4, _response, _response2;
7883
+ var _payments$Payments5, _response, _response2;
7884
+ const pdfPayments = fixAdjustedAmount(payments === null || payments === void 0 ? void 0 : (_payments$Payments5 = payments.Payments) === null || _payments$Payments5 === void 0 ? void 0 : _payments$Payments5[0]);
7809
7885
  let response = {
7810
7886
  filestoreIds: [payments === null || payments === void 0 ? void 0 : payments.fileStoreId]
7811
7887
  };
7812
7888
  response = await Digit.PaymentService.generatePdf(tenantId, {
7813
7889
  Payments: [{
7814
- ...((payments === null || payments === void 0 ? void 0 : (_payments$Payments4 = payments.Payments) === null || _payments$Payments4 === void 0 ? void 0 : _payments$Payments4[0]) || {}),
7890
+ ...pdfPayments,
7815
7891
  ...application
7816
7892
  }]
7817
7893
  }, "chbservice-receipt");
@@ -7848,13 +7924,13 @@ const WrapPaymentComponent = props => {
7848
7924
  let application = applicationDetails === null || applicationDetails === void 0 ? void 0 : (_applicationDetails$A5 = applicationDetails.Applications) === null || _applicationDetails$A5 === void 0 ? void 0 : _applicationDetails$A5[0];
7849
7925
  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
7926
  if (!fileStoreId) {
7851
- var _payments$Payments5;
7927
+ var _payments$Payments6;
7852
7928
  const payments = await Digit.PaymentService.getReciept(tenantId, business_service, {
7853
7929
  receiptNumbers: receiptNumber
7854
7930
  });
7855
7931
  let response = await Digit.PaymentService.generatePdf(tenantId, {
7856
7932
  Payments: [{
7857
- ...((payments === null || payments === void 0 ? void 0 : (_payments$Payments5 = payments.Payments) === null || _payments$Payments5 === void 0 ? void 0 : _payments$Payments5[0]) || {}),
7933
+ ...((payments === null || payments === void 0 ? void 0 : (_payments$Payments6 = payments.Payments) === null || _payments$Payments6 === void 0 ? void 0 : _payments$Payments6[0]) || {}),
7858
7934
  ...application
7859
7935
  }]
7860
7936
  }, "ndc-receipt");
@@ -7883,13 +7959,13 @@ const WrapPaymentComponent = props => {
7883
7959
  let application = new_data;
7884
7960
  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
7961
  if (!fileStoreId) {
7886
- var _payments$Payments6;
7962
+ var _payments$Payments7;
7887
7963
  const payments = await Digit.PaymentService.getReciept(tenantId, business_service, {
7888
7964
  receiptNumbers: receiptNumber
7889
7965
  });
7890
7966
  let response = await Digit.PaymentService.generatePdf(tenantId, {
7891
7967
  Payments: [{
7892
- ...((payments === null || payments === void 0 ? void 0 : (_payments$Payments6 = payments.Payments) === null || _payments$Payments6 === void 0 ? void 0 : _payments$Payments6[0]) || {}),
7968
+ ...((payments === null || payments === void 0 ? void 0 : (_payments$Payments7 = payments.Payments) === null || _payments$Payments7 === void 0 ? void 0 : _payments$Payments7[0]) || {}),
7893
7969
  ...application
7894
7970
  }]
7895
7971
  }, "adv-bill");
@@ -7945,7 +8021,7 @@ const WrapPaymentComponent = props => {
7945
8021
  gap: "4px"
7946
8022
  };
7947
8023
  const printRecieptNew = async payment => {
7948
- var _payments$Payments$2;
8024
+ var _payments$Payments$3;
7949
8025
  const tenantId = Digit.ULBService.getCurrentTenantId();
7950
8026
  const state = Digit.ULBService.getStateId();
7951
8027
  let paymentArray = [];
@@ -7953,7 +8029,7 @@ const WrapPaymentComponent = props => {
7953
8029
  receiptNumbers: payment.Payments[0].paymentDetails[0].receiptNumber
7954
8030
  });
7955
8031
  let response = {
7956
- filestoreIds: [(_payments$Payments$2 = payments.Payments[0]) === null || _payments$Payments$2 === void 0 ? void 0 : _payments$Payments$2.fileStoreId]
8032
+ filestoreIds: [(_payments$Payments$3 = payments.Payments[0]) === null || _payments$Payments$3 === void 0 ? void 0 : _payments$Payments$3.fileStoreId]
7957
8033
  };
7958
8034
  {
7959
8035
  let assessmentYear = "",
@@ -8206,27 +8282,7 @@ const WrapPaymentComponent = props => {
8206
8282
  month: "2-digit",
8207
8283
  year: "numeric"
8208
8284
  })
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", {
8285
+ })), business_service == "sv-services" ? /*#__PURE__*/React.createElement("div", {
8230
8286
  className: "primary-label-btn d-grid",
8231
8287
  style: {
8232
8288
  marginLeft: "unset",
@@ -8421,6 +8477,63 @@ const WrapPaymentComponent = props => {
8421
8477
  marginTop: "10px",
8422
8478
  marginLeft: "100px"
8423
8479
  }
8480
+ }))) : null, business_service === "rl-services" || business_service === "GC.ONE_TIME_FEE" ? /*#__PURE__*/React.createElement("div", {
8481
+ style: {
8482
+ display: "flex",
8483
+ justifyContent: "flex-end",
8484
+ gap: "20px",
8485
+ marginRight: "20px",
8486
+ marginTop: "15px",
8487
+ marginBottom: "15px"
8488
+ }
8489
+ }, /*#__PURE__*/React.createElement("div", {
8490
+ className: "primary-label-btn d-grid",
8491
+ onClick: printing ? undefined : () => printBillReceipt({
8492
+ businessService: business_service,
8493
+ receiptNumber: receiptNumber || consumerCode,
8494
+ rootKey: "PAYMENTS",
8495
+ billOrPaymentResponse: reciept_data
8496
+ })
8497
+ }, printing ? /*#__PURE__*/React.createElement(Loader, null) : /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement("svg", {
8498
+ xmlns: "http://www.w3.org/2000/svg",
8499
+ height: "24",
8500
+ viewBox: "0 0 24 24",
8501
+ width: "24"
8502
+ }, /*#__PURE__*/React.createElement("path", {
8503
+ d: "M0 0h24v24H0z",
8504
+ fill: "none"
8505
+ }), /*#__PURE__*/React.createElement("path", {
8506
+ 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"
8507
+ })), t("CHB_FEE_RECEIPT")))) : null, business_service == "pet-services" ? /*#__PURE__*/React.createElement("div", {
8508
+ style: {
8509
+ display: "flex",
8510
+ alignItems: "center",
8511
+ justifyContent: "space-between",
8512
+ flexWrap: "wrap",
8513
+ gap: "20px"
8514
+ }
8515
+ }, /*#__PURE__*/React.createElement("div", {
8516
+ style: IconWrapperStyle,
8517
+ onClick: printing ? undefined : printPetReceipt
8518
+ }, printing ? /*#__PURE__*/React.createElement(Loader, null) : /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement("svg", {
8519
+ xmlns: "http://www.w3.org/2000/svg",
8520
+ height: "24px",
8521
+ viewBox: "0 0 24 24",
8522
+ width: "24px",
8523
+ fill: "#a82227"
8524
+ }, /*#__PURE__*/React.createElement("path", {
8525
+ d: "M0 0h24v24H0V0z",
8526
+ fill: "none"
8527
+ }), /*#__PURE__*/React.createElement("path", {
8528
+ d: "M19 9h-4V3H9v6H5l7 7 7-7zm-8 2V5h2v6h1.17L12 13.17 9.83 11H11zm-6 7h14v2H5z"
8529
+ })), t("CHB_FEE_RECEIPT"))), business_service == "pet-services" && /*#__PURE__*/React.createElement(Link, {
8530
+ to: `/digit-ui/citizen`
8531
+ }, /*#__PURE__*/React.createElement(SubmitBar, {
8532
+ label: t("CORE_COMMON_GO_TO_HOME"),
8533
+ style: {
8534
+ marginTop: "10px",
8535
+ marginLeft: "100px"
8536
+ }
8424
8537
  }))) : null, business_service == "sv-services" && /*#__PURE__*/React.createElement(Link, {
8425
8538
  to: `/digit-ui/citizen`
8426
8539
  }, /*#__PURE__*/React.createElement(SubmitBar, {
@@ -8457,7 +8570,7 @@ const WrapPaymentComponent = props => {
8457
8570
  to: `/digit-ui/citizen`
8458
8571
  }, /*#__PURE__*/React.createElement(SubmitBar, {
8459
8572
  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", {
8573
+ }))) : !(business_service === "adv-services" || business_service === "pet-services" || business_service === "chb-services" || business_service === "NDC" || business_service === "Challan_Generation" || business_service === "rl-services" || business_service === "GC.ONE_TIME_FEE") && /*#__PURE__*/React.createElement("div", {
8461
8574
  style: {
8462
8575
  display: "flex",
8463
8576
  justifyContent: "space-between",
@@ -8465,13 +8578,9 @@ const WrapPaymentComponent = props => {
8465
8578
  flexWrap: "wrap",
8466
8579
  gap: "20px"
8467
8580
  }
8468
- }, printing ? /*#__PURE__*/React.createElement(Loader, null) : /*#__PURE__*/React.createElement(SubmitBar, {
8581
+ }, business_service !== "TL" && (printing ? /*#__PURE__*/React.createElement(Loader, null) : /*#__PURE__*/React.createElement(SubmitBar, {
8469
8582
  onSubmit: printReciept,
8470
8583
  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
8584
  })), /*#__PURE__*/React.createElement(Link, {
8476
8585
  to: `/digit-ui/citizen`
8477
8586
  }, /*#__PURE__*/React.createElement(SubmitBar, {
@@ -8530,7 +8639,7 @@ const CitizenPayment = ({
8530
8639
  const isResponse = window.location.href.includes("/response");
8531
8640
  const isMobile = window.Digit.Utils.browser.isMobile();
8532
8641
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("div", {
8533
- className: "bills-citizen-wrapper"
8642
+ className: "card"
8534
8643
  }, /*#__PURE__*/React.createElement(Switch, null, /*#__PURE__*/React.createElement(AppContainer, null, !isResponse ? /*#__PURE__*/React.createElement("div", {
8535
8644
  style: window.location.href.includes("application-overview") || isMobile ? {
8536
8645
  marginLeft: "10px"
@@ -10499,8 +10608,8 @@ var _DataView = DataView;
10499
10608
  var Promise$1 = _getNative(_root, 'Promise');
10500
10609
  var _Promise = Promise$1;
10501
10610
 
10502
- var Set = _getNative(_root, 'Set');
10503
- var _Set = Set;
10611
+ var Set$1 = _getNative(_root, 'Set');
10612
+ var _Set = Set$1;
10504
10613
 
10505
10614
  var WeakMap = _getNative(_root, 'WeakMap');
10506
10615
  var _WeakMap = WeakMap;
@@ -10939,7 +11048,7 @@ const BillDetailsFormConfig = (props, t) => ({
10939
11048
  }
10940
11049
  }]
10941
11050
  }],
10942
- "WSReconnection": [{
11051
+ WSReconnection: [{
10943
11052
  head: t("COMMON_PAY_SCREEN_HEADER"),
10944
11053
  body: [{
10945
11054
  withoutLabel: true,
@@ -10957,7 +11066,7 @@ const BillDetailsFormConfig = (props, t) => ({
10957
11066
  }
10958
11067
  }]
10959
11068
  }],
10960
- "SWReconnection": [{
11069
+ SWReconnection: [{
10961
11070
  head: t("COMMON_PAY_SCREEN_HEADER"),
10962
11071
  body: [{
10963
11072
  withoutLabel: true,
@@ -11216,16 +11325,22 @@ const BillDetails$1 = ({
11216
11325
  }, year_bill.amount));
11217
11326
  })));
11218
11327
  };
11328
+ const isTL = businessService === "TL";
11329
+ console.log("billDetails==||||", billDetails);
11219
11330
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(StatusTable, null, !checkFSM && bill && config.details.map((obj, index) => {
11220
11331
  const value = obj.keyPath.reduce((acc, key) => {
11221
11332
  if (typeof key === "function") acc = key(acc);else acc = acc[key];
11222
11333
  return acc;
11223
11334
  }, bill);
11224
- return /*#__PURE__*/React.createElement(Row, {
11335
+ return /*#__PURE__*/React.createElement(Row, Object.assign({
11225
11336
  key: index + "bill",
11226
11337
  label: t(obj.keyValue),
11227
11338
  text: value
11228
- });
11339
+ }, isTL ? {
11340
+ textStyle: {
11341
+ textAlign: "right"
11342
+ }
11343
+ } : {}));
11229
11344
  })), checkFSM ? /*#__PURE__*/React.createElement(StatusTable, null, /*#__PURE__*/React.createElement(Row, {
11230
11345
  label: t("ES_PAYMENT_DETAILS_AMOUNT_PER_TRIP"),
11231
11346
  textStyle: {
@@ -11266,11 +11381,18 @@ const BillDetails$1 = ({
11266
11381
  }, /*#__PURE__*/React.createElement(Row, {
11267
11382
  label: t("ES_PAYMENT_TAXHEADS"),
11268
11383
  textStyle: {
11269
- fontWeight: "bold"
11384
+ fontWeight: "bold",
11385
+ ...(isTL ? {
11386
+ textAlign: "right",
11387
+ maxWidth: "none",
11388
+ width: "40%"
11389
+ } : {})
11270
11390
  },
11271
11391
  text: t("ES_PAYMENT_AMOUNT")
11272
11392
  }), /*#__PURE__*/React.createElement("hr", {
11273
- style: {
11393
+ style: isTL ? {
11394
+ width: "100%"
11395
+ } : {
11274
11396
  width: "40%"
11275
11397
  },
11276
11398
  className: "underline"
@@ -11281,7 +11403,11 @@ const BillDetails$1 = ({
11281
11403
  labelStyle: {
11282
11404
  fontWeight: "normal"
11283
11405
  },
11284
- textStyle: {
11406
+ textStyle: isTL ? {
11407
+ textAlign: "right",
11408
+ maxWidth: "none",
11409
+ width: "40%"
11410
+ } : {
11285
11411
  textAlign: "right",
11286
11412
  maxWidth: "100px"
11287
11413
  },
@@ -11292,20 +11418,31 @@ const BillDetails$1 = ({
11292
11418
  labelStyle: {
11293
11419
  fontWeight: "normal"
11294
11420
  },
11295
- textStyle: {
11421
+ textStyle: isTL ? {
11422
+ textAlign: "right",
11423
+ maxWidth: "none",
11424
+ width: "40%"
11425
+ } : {
11296
11426
  textAlign: "right",
11297
11427
  maxWidth: "100px"
11298
11428
  },
11299
11429
  label: t("COMMON_ARREARS"),
11300
11430
  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
11431
  }) : null, /*#__PURE__*/React.createElement("hr", {
11302
- style: {
11432
+ style: isTL ? {
11433
+ width: "100%"
11434
+ } : {
11303
11435
  width: "40%"
11304
11436
  },
11305
11437
  className: "underline"
11306
11438
  }), /*#__PURE__*/React.createElement(Row, {
11307
11439
  label: t("CS_PAYMENT_TOTAL_AMOUNT"),
11308
- textStyle: {
11440
+ textStyle: isTL ? {
11441
+ fontWeight: "bold",
11442
+ textAlign: "right",
11443
+ maxWidth: "none",
11444
+ width: "40%"
11445
+ } : {
11309
11446
  fontWeight: "bold",
11310
11447
  textAlign: "right",
11311
11448
  maxWidth: "100px"
@@ -11460,6 +11597,7 @@ const CollectPayment = props => {
11460
11597
  } = useParams();
11461
11598
  console.log("businessService", businessService);
11462
11599
  const tenantId = Digit.ULBService.getCurrentTenantId();
11600
+ const location = useLocation();
11463
11601
  const search = useLocation().search;
11464
11602
  if (window.location.href.includes("ISWSAPP")) consumerCode = new URLSearchParams(search).get("applicationNumber");
11465
11603
  if (window.location.href.includes("ISWSCON") || ModuleWorkflow === "WS") consumerCode = decodeURIComponent(consumerCode);
@@ -11482,6 +11620,7 @@ const CollectPayment = props => {
11482
11620
  enabled: businessService !== null && businessService !== void 0 && (_businessService$toUp = businessService.toUpperCase()) !== null && _businessService$toUp !== void 0 && _businessService$toUp.includes("FSM") ? true : false
11483
11621
  });
11484
11622
  const advanceBill = applicationData === null || applicationData === void 0 ? void 0 : applicationData.advanceAmount;
11623
+ const [formState, setFormState] = useState({});
11485
11624
  const {
11486
11625
  cardConfig
11487
11626
  } = useCardPaymentDetails(props, t);
@@ -11506,8 +11645,10 @@ const CollectPayment = props => {
11506
11645
  const {
11507
11646
  qrConfig
11508
11647
  } = useQRDetails(props, t);
11509
- const [formState, setFormState] = useState({});
11510
11648
  const [toast, setToast] = useState(null);
11649
+ const isChallanGeneration = location.pathname.includes("Challan_Generation");
11650
+ const isPetService = location.pathname.includes("pet-services");
11651
+ console.log("isPetService", isPetService);
11511
11652
  useEffect(() => {
11512
11653
  if (paymentdetails !== null && paymentdetails !== void 0 && paymentdetails.Bill && paymentdetails.Bill.length === 0) {
11513
11654
  setToast({
@@ -11522,25 +11663,28 @@ const CollectPayment = props => {
11522
11663
  }, {
11523
11664
  code: "CHEQUE",
11524
11665
  label: t("COMMON_MASTERS_PAYMENTMODE_CHEQUE")
11525
- }, {
11666
+ }, ...(!(isChallanGeneration || isPetService) ? [{
11526
11667
  code: "CARD",
11527
11668
  label: t("COMMON_MASTERS_PAYMENTMODE_CREDIT/DEBIT CARD")
11528
- }, {
11669
+ }] : []), {
11529
11670
  code: "DD",
11530
11671
  label: "Demand Draft"
11531
- }, {
11672
+ }, ...(isChallanGeneration || isPetService ? [{
11673
+ code: "ONLINE",
11674
+ label: "Online"
11675
+ }] : []), ...(!(isChallanGeneration || isPetService) ? [{
11532
11676
  code: "OFFLINE_NEFT",
11533
11677
  label: "NEFT"
11534
- }, {
11678
+ }] : []), ...(!(isChallanGeneration || isPetService) ? [{
11535
11679
  code: "OFFLINE_RTGS",
11536
11680
  label: "RTGS"
11537
- }, {
11681
+ }] : []), ...(!(isChallanGeneration || isPetService) ? [{
11538
11682
  code: "POSTAL_ORDER",
11539
11683
  label: "Postal Order"
11540
- }, {
11684
+ }] : []), ...(!(isChallanGeneration || isPetService) ? [{
11541
11685
  code: "QR_CODE",
11542
11686
  label: "QR Code"
11543
- }];
11687
+ }] : [])];
11544
11688
  const formConfigMap = {
11545
11689
  CHEQUE: chequeConfig,
11546
11690
  CARD: cardConfig,
@@ -11567,7 +11711,11 @@ const CollectPayment = props => {
11567
11711
  name: t("COMMON_OWNER")
11568
11712
  });
11569
11713
  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;
11714
+ var _data$paymentMode, _data$amount, _data$amount6, _data$amount7, _data$paymentMode2, _data$paymentModeDeta, _recieptRequest$Payme2, _recieptRequest$Payme3, _recieptRequest$Payme4, _recieptRequest$Payme5, _recieptRequest$Payme6;
11715
+ if ((data === null || data === void 0 ? void 0 : (_data$paymentMode = data.paymentMode) === null || _data$paymentMode === void 0 ? void 0 : _data$paymentMode.code) == "ONLINE") {
11716
+ history.push(`/digit-ui/employee/payment/challan/collect/${businessService}/${consumerCode}/${tenantId}?tenantId=${tenantId}`);
11717
+ return;
11718
+ }
11571
11719
  bill.totalAmount = Math.round(bill.totalAmount);
11572
11720
  data.paidBy = data.paidBy.code;
11573
11721
  if (BillDetailsFormConfig({
@@ -11617,7 +11765,7 @@ const CollectPayment = props => {
11617
11765
  if (data.ManualRecieptDetails.manualReceiptNumber) {
11618
11766
  recieptRequest.Payment.paymentDetails[0].manualReceiptNumber = ManualRecieptDetails.manualReceiptNumber;
11619
11767
  }
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;
11768
+ 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
11769
  if (data.paymentModeDetails) {
11622
11770
  var _recieptRequest$Payme;
11623
11771
  recieptRequest.Payment = {
@@ -11789,7 +11937,7 @@ const CollectPayment = props => {
11789
11937
  });
11790
11938
  console.log("ModuleWorkflow", ModuleWorkflow);
11791
11939
  const getFormConfig = () => {
11792
- var _formState$paymentMod, _conf;
11940
+ var _formState$paymentMod, _formState$paymentMod2;
11793
11941
  const isGCService = businessService === null || businessService === void 0 ? void 0 : businessService.startsWith("GC");
11794
11942
  if (BillDetailsFormConfig({
11795
11943
  consumerCode,
@@ -11798,7 +11946,9 @@ const CollectPayment = props => {
11798
11946
  config.splice(0, 1);
11799
11947
  }
11800
11948
  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);
11949
+ if ((formState === null || formState === void 0 ? void 0 : (_formState$paymentMod2 = formState.paymentMode) === null || _formState$paymentMod2 === void 0 ? void 0 : _formState$paymentMod2.code) !== "ONLINE") {
11950
+ conf = conf.concat(cashConfig);
11951
+ }
11802
11952
  return BillDetailsFormConfig({
11803
11953
  consumerCode,
11804
11954
  businessService
@@ -11843,46 +11993,388 @@ const CollectPayment = props => {
11843
11993
  }));
11844
11994
  };
11845
11995
 
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);
11996
+ const SelectPaymentType$2 = props => {
11997
+ var _menuList$PAYMENT, _menuList$PAYMENT$Pay, _menuList$PAYMENT2, _menuList$PAYMENT2$Pa, _menuList$PAYMENT2$Pa2;
11998
+ const {
11999
+ state = {}
12000
+ } = useLocation();
12001
+ const userInfo = Digit.UserService.getUser();
12002
+ const [showToast, setShowToast] = useState(null);
12003
+ const [showOwnerToast, setShowOwnerToast] = useState(null);
12004
+ const {
12005
+ tenantId: __tenantId,
12006
+ authorization,
12007
+ workflow: wrkflow,
12008
+ consumerCode: connectionNo
12009
+ } = Digit.Hooks.useQueryParams();
12010
+ const paymentAmount = state === null || state === void 0 ? void 0 : state.paymentAmount;
12011
+ const {
12012
+ t
12013
+ } = useTranslation();
12014
+ const history = useHistory();
12015
+ const {
12016
+ pathname,
12017
+ search
12018
+ } = useLocation();
12019
+ let {
12020
+ consumerCode,
12021
+ businessService
12022
+ } = useParams();
12023
+ const tenantId = (state === null || state === void 0 ? void 0 : state.tenantId) || __tenantId || Digit.ULBService.getCurrentTenantId();
12024
+ const stateTenant = Digit.ULBService.getStateId();
12025
+ const {
12026
+ control,
12027
+ handleSubmit,
12028
+ setValue
12029
+ } = useForm();
12030
+ const {
12031
+ data: menuList,
12032
+ isLoading
12033
+ } = Digit.Hooks.useCustomMDMS(tenantId, "PAYMENT", [{
12034
+ name: "PaymentGateway"
12035
+ }]);
12036
+ console.log("menuList", menuList);
12037
+ const [isPaymentLoading, setPaymentLoading] = useState(false);
12038
+ const {
12039
+ data: paymentdetails,
12040
+ isLoading: paymentLoading
12041
+ } = Digit.Hooks.useFetchPayment({
12042
+ tenantId: tenantId,
12043
+ consumerCode: wrkflow === "WNS" ? connectionNo : consumerCode,
12044
+ businessService
12045
+ }, {});
12046
+ if (window.location.href.includes("ISWSCON") || wrkflow === "WNS") consumerCode = decodeURIComponent(consumerCode);
12047
+ if (wrkflow === "WNS") consumerCode = stringReplaceAll(consumerCode, "+", "/");
12048
+ useEffect(() => {
12049
+ if (paymentdetails !== null && paymentdetails !== void 0 && paymentdetails.Bill && paymentdetails.Bill.length == 0) {
12050
+ setShowToast({
12051
+ key: true,
12052
+ label: "CS_BILL_NOT_FOUND"
12053
+ });
11874
12054
  }
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);
11883
- return new Date(timestamp + amount);
11884
- }
11885
-
12055
+ }, [paymentdetails]);
12056
+ useEffect(() => {
12057
+ localStorage.setItem("BillPaymentEnabled", "true");
12058
+ }, []);
12059
+ const {
12060
+ name,
12061
+ mobileNumber
12062
+ } = state;
12063
+ const billDetails = paymentdetails !== null && paymentdetails !== void 0 && paymentdetails.Bill ? paymentdetails === null || paymentdetails === void 0 ? void 0 : paymentdetails.Bill[0] : {};
12064
+ console.log(billDetails, "BILL");
12065
+ const userOptions = ["OWNER", "OTHER"];
12066
+ const onSubmit = async d => {
12067
+ if (!(d !== null && d !== void 0 && d.name) || (d === null || d === void 0 ? void 0 : d.name.trim()) === "") {
12068
+ setShowOwnerToast({
12069
+ key: true,
12070
+ label: t("PAYMENT_NAME_MANDATORY_MESSAGE")
12071
+ });
12072
+ return;
12073
+ }
12074
+ const mobileRegex = /^[6-9]\d{9}$/;
12075
+ if (!(d !== null && d !== void 0 && d.mobileNumber) || (d === null || d === void 0 ? void 0 : d.mobileNumber.trim()) === "") {
12076
+ setShowOwnerToast({
12077
+ key: true,
12078
+ label: t("PAYMENT_MOBILE_NUMBER_MANDATORY_MESSAGE")
12079
+ });
12080
+ return;
12081
+ } else if (!mobileRegex.test(d.mobileNumber)) {
12082
+ setShowOwnerToast({
12083
+ key: true,
12084
+ label: t("ERR_INVALID_MOBILE")
12085
+ });
12086
+ return;
12087
+ }
12088
+ setPaymentLoading(true);
12089
+ const baseURL = document.location.origin;
12090
+ console.log("BASEURLINPAYMENT", baseURL);
12091
+ const filterData = {
12092
+ Transaction: {
12093
+ tenantId: billDetails === null || billDetails === void 0 ? void 0 : billDetails.tenantId,
12094
+ txnAmount: paymentAmount || billDetails.totalAmount,
12095
+ module: businessService,
12096
+ businessService: businessService,
12097
+ billId: billDetails.id,
12098
+ consumerCode: consumerCode,
12099
+ productInfo: "Common Payment",
12100
+ gateway: d === null || d === void 0 ? void 0 : d.paymentType,
12101
+ taxAndPayments: [{
12102
+ taxAmount: paymentAmount || billDetails.totalAmount,
12103
+ billId: billDetails.id,
12104
+ amountPaid: paymentAmount || billDetails.totalAmount,
12105
+ businessService: businessService
12106
+ }],
12107
+ user: {
12108
+ name: d === null || d === void 0 ? void 0 : d.name,
12109
+ mobileNumber: d === null || d === void 0 ? void 0 : d.mobileNumber,
12110
+ tenantId: billDetails === null || billDetails === void 0 ? void 0 : billDetails.tenantId
12111
+ },
12112
+ callbackUrl: `${baseURL}/digit-ui/employee/payment/challan/success/${businessService}/${consumerCode}`,
12113
+ additionalDetails: {
12114
+ isWhatsapp: false,
12115
+ paidBy: d === null || d === void 0 ? void 0 : d.paidBy
12116
+ }
12117
+ }
12118
+ };
12119
+ console.log("coming here", filterData);
12120
+ try {
12121
+ const data = await Digit.PaymentService.createCitizenReciept(billDetails === null || billDetails === void 0 ? void 0 : billDetails.tenantId, filterData);
12122
+ console.log("data=========", data);
12123
+ if (paymentAmount === 0 || billDetails.totalAmount === 0) {
12124
+ var _data$ResponseInfo;
12125
+ setPaymentLoading(false);
12126
+ if ((data === null || data === void 0 ? void 0 : (_data$ResponseInfo = data.ResponseInfo) === null || _data$ResponseInfo === void 0 ? void 0 : _data$ResponseInfo.status) === "SUCCESSFUL") {
12127
+ var _data$Transaction;
12128
+ window.location.href = data === null || data === void 0 ? void 0 : (_data$Transaction = data.Transaction) === null || _data$Transaction === void 0 ? void 0 : _data$Transaction.callbackUrl;
12129
+ } else {
12130
+ window.location.href = "/digit-ui/citizen/payment/failure";
12131
+ }
12132
+ return;
12133
+ }
12134
+ if ((d === null || d === void 0 ? void 0 : d.paymentType) === gatewayType.RAZORPAY) {
12135
+ displayRazorpay(data);
12136
+ } else {
12137
+ setPaymentLoading(false);
12138
+ }
12139
+ } catch (error) {
12140
+ var _error$response, _error$response$data, _error$response$data$;
12141
+ console.log("error", error);
12142
+ let messageToShow = "CS_PAYMENT_UNKNOWN_ERROR_ON_SERVER";
12143
+ 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]) {
12144
+ var _error$response2, _error$response2$data, _error$response2$data2;
12145
+ const {
12146
+ code,
12147
+ message
12148
+ } = (_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];
12149
+ messageToShow = code;
12150
+ }
12151
+ setPaymentLoading(false);
12152
+ setShowToast({
12153
+ key: true,
12154
+ label: t(messageToShow)
12155
+ });
12156
+ }
12157
+ };
12158
+ async function displayRazorpay(getOrderData) {
12159
+ const res = await loadScript(RAZORPAY_LOADSCRIPT_URL);
12160
+ if (!res) {
12161
+ alert("Razorpay SDK failed to load. Are you online?");
12162
+ return;
12163
+ }
12164
+ function getQueryVariable(variable) {
12165
+ const query = lodash.get(getOrderData, TRANSACTION_REDIRECTURL);
12166
+ var vars = query.split("&");
12167
+ for (var i = 0; i < vars.length; i++) {
12168
+ var pair = vars[i].split("=");
12169
+ if (pair[0] == variable) {
12170
+ return pair[1];
12171
+ }
12172
+ }
12173
+ return false;
12174
+ }
12175
+ const options = {
12176
+ key: getQueryVariable(MERCHENT_KEY),
12177
+ amount: lodash.get(getOrderData, TRANSACTION_AMMOUNT) * 100,
12178
+ name: POPUP_DIPSPLAY_NAME,
12179
+ description: lodash.get(getOrderData, TRANSACTION_BUSINESSSERVICE) + " Charge Collection",
12180
+ image: POPUP_DIPSPLAY_IMAGE,
12181
+ order_id: getQueryVariable(ORDER_ID),
12182
+ handler: async function (response) {
12183
+ const data = {
12184
+ razorpayPaymentId: response.razorpay_payment_id,
12185
+ razorpayOrderId: response.razorpay_order_id,
12186
+ razorpaySignature: response.razorpay_signature
12187
+ };
12188
+ 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;
12189
+ },
12190
+ prefill: {
12191
+ name: lodash.get(getOrderData, TRANSACTION_USERNAME),
12192
+ email: lodash.get(getOrderData, TRANSACTION_USER_EMAIL),
12193
+ contact: lodash.get(getOrderData, TRANSACTION_USER_MOBILE)
12194
+ },
12195
+ theme: {
12196
+ color: "#61dafb"
12197
+ }
12198
+ };
12199
+ const paymentObject = new window.Razorpay(options);
12200
+ setPaymentLoading(false);
12201
+ paymentObject.open();
12202
+ }
12203
+ function loadScript(src) {
12204
+ return new Promise(resolve => {
12205
+ const script = document.createElement("script");
12206
+ script.src = src;
12207
+ script.onload = () => {
12208
+ resolve(true);
12209
+ };
12210
+ script.onerror = () => {
12211
+ resolve(false);
12212
+ };
12213
+ document.body.appendChild(script);
12214
+ });
12215
+ }
12216
+ if (authorization === "true" && !userInfo.access_token) {
12217
+ localStorage.clear();
12218
+ sessionStorage.clear();
12219
+ window.location.href = `/digit-ui/citizen/login?from=${encodeURIComponent(pathname + search)}`;
12220
+ }
12221
+ if (paymentLoading || isPaymentLoading || isLoading) {
12222
+ window.scrollTo({
12223
+ top: 0,
12224
+ behavior: "smooth"
12225
+ });
12226
+ return /*#__PURE__*/React.createElement(Loader, null);
12227
+ }
12228
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("form", {
12229
+ style: {
12230
+ padding: "20px"
12231
+ },
12232
+ onSubmit: handleSubmit(onSubmit)
12233
+ }, /*#__PURE__*/React.createElement(Header, null, t("PAYMENT_CS_HEADER")), /*#__PURE__*/React.createElement(Card, null, /*#__PURE__*/React.createElement("div", {
12234
+ className: "payment-amount-info",
12235
+ style: {
12236
+ marginBottom: "26px"
12237
+ }
12238
+ }, /*#__PURE__*/React.createElement(CardLabel, {
12239
+ className: "dark"
12240
+ }, 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, {
12241
+ name: "paymentType",
12242
+ 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,
12243
+ control: control,
12244
+ render: props => {
12245
+ var _menuList$PAYMENT3, _menuList$PAYMENT3$Pa;
12246
+ return /*#__PURE__*/React.createElement(RadioButtons, {
12247
+ selectedOption: props.value,
12248
+ 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),
12249
+ onSelect: props.onChange
12250
+ });
12251
+ }
12252
+ })), /*#__PURE__*/React.createElement("div", {
12253
+ className: "card"
12254
+ }, /*#__PURE__*/React.createElement("div", {
12255
+ className: "payment-amount-info",
12256
+ style: {
12257
+ marginBottom: "26px"
12258
+ }
12259
+ }, /*#__PURE__*/React.createElement(CardLabel, {
12260
+ className: "dark"
12261
+ }, t("PAYMENT_CS_PAYER_DETAILS"))), /*#__PURE__*/React.createElement(LabelFieldPair, null, /*#__PURE__*/React.createElement(CardLabel, {
12262
+ className: "card-label-smaller"
12263
+ }, `${t("PAYMENT_CS_PAID_BY")} * `), /*#__PURE__*/React.createElement(Controller, {
12264
+ name: "paidBy",
12265
+ defaultValue: userOptions[0],
12266
+ control: control,
12267
+ render: props => /*#__PURE__*/React.createElement(Dropdown, {
12268
+ className: "text-input-width",
12269
+ selected: props.value,
12270
+ option: userOptions,
12271
+ select: val => {
12272
+ if (val === "OWNER") {
12273
+ props.onChange(val);
12274
+ setValue("name", name || (billDetails === null || billDetails === void 0 ? void 0 : billDetails.payerName) || "");
12275
+ setValue("mobileNumber", mobileNumber || (billDetails === null || billDetails === void 0 ? void 0 : billDetails.mobileNumber) || "");
12276
+ } else if (val === "OTHER") {
12277
+ props.onChange(val);
12278
+ setValue("name", "");
12279
+ setValue("mobileNumber", "");
12280
+ }
12281
+ }
12282
+ })
12283
+ })), /*#__PURE__*/React.createElement(LabelFieldPair, null, /*#__PURE__*/React.createElement(CardLabel, {
12284
+ className: "card-label-smaller"
12285
+ }, `${t("PAYMENT_CS_PAYER_NAME")} * `), /*#__PURE__*/React.createElement("div", {
12286
+ className: "field"
12287
+ }, /*#__PURE__*/React.createElement(Controller, {
12288
+ control: control,
12289
+ name: "name",
12290
+ defaultValue: name || (billDetails === null || billDetails === void 0 ? void 0 : billDetails.payerName) || "",
12291
+ render: props => /*#__PURE__*/React.createElement(TextInput, {
12292
+ className: "text-input-width",
12293
+ value: props.value,
12294
+ onChange: e => {
12295
+ props.onChange(e.target.value);
12296
+ }
12297
+ })
12298
+ }))), /*#__PURE__*/React.createElement(LabelFieldPair, null, /*#__PURE__*/React.createElement(CardLabel, {
12299
+ className: "card-label-smaller"
12300
+ }, `${t("PAYMENT_CS_PAYER_NUMBER")} * `), /*#__PURE__*/React.createElement("div", {
12301
+ className: "field"
12302
+ }, /*#__PURE__*/React.createElement(Controller, {
12303
+ control: control,
12304
+ name: "mobileNumber",
12305
+ defaultValue: mobileNumber || (billDetails === null || billDetails === void 0 ? void 0 : billDetails.mobileNumber) || "",
12306
+ render: props => /*#__PURE__*/React.createElement(MobileNumber, {
12307
+ value: props.value,
12308
+ onChange: e => {
12309
+ props.onChange(e);
12310
+ },
12311
+ componentInFront: /*#__PURE__*/React.createElement("div", {
12312
+ className: "employee-card-input employee-card-input--front numberdisplay"
12313
+ }, "+91")
12314
+ })
12315
+ })))), !showToast && /*#__PURE__*/React.createElement(Card, null, /*#__PURE__*/React.createElement(SubmitBar, {
12316
+ label: t("PAYMENT_CS_BUTTON_LABEL"),
12317
+ submit: true
12318
+ }))), /*#__PURE__*/React.createElement(InfoBanner, {
12319
+ label: t("CS_COMMON_INFO"),
12320
+ text: t("CS_PAYMENT_REDIRECT_NOTICE")
12321
+ }), showToast && /*#__PURE__*/React.createElement(Toast, {
12322
+ error: showToast.key,
12323
+ label: t(showToast.label),
12324
+ onClose: () => {
12325
+ setShowToast(null);
12326
+ },
12327
+ isDleteBtn: true
12328
+ }), showOwnerToast && /*#__PURE__*/React.createElement(Toast, {
12329
+ isDleteBtn: true,
12330
+ error: showOwnerToast.key,
12331
+ label: t(showOwnerToast.label),
12332
+ onClose: () => {
12333
+ setShowOwnerToast(null);
12334
+ }
12335
+ }));
12336
+ };
12337
+
12338
+ function toInteger(dirtyNumber) {
12339
+ if (dirtyNumber === null || dirtyNumber === true || dirtyNumber === false) {
12340
+ return NaN;
12341
+ }
12342
+ var number = Number(dirtyNumber);
12343
+ if (isNaN(number)) {
12344
+ return number;
12345
+ }
12346
+ return number < 0 ? Math.ceil(number) : Math.floor(number);
12347
+ }
12348
+
12349
+ function requiredArgs(required, args) {
12350
+ if (args.length < required) {
12351
+ throw new TypeError(required + ' argument' + (required > 1 ? 's' : '') + ' required, but only ' + args.length + ' present');
12352
+ }
12353
+ }
12354
+
12355
+ function toDate(argument) {
12356
+ requiredArgs(1, arguments);
12357
+ var argStr = Object.prototype.toString.call(argument);
12358
+ if (argument instanceof Date || typeof argument === 'object' && argStr === '[object Date]') {
12359
+ return new Date(argument.getTime());
12360
+ } else if (typeof argument === 'number' || argStr === '[object Number]') {
12361
+ return new Date(argument);
12362
+ } else {
12363
+ if ((typeof argument === 'string' || argStr === '[object String]') && typeof console !== 'undefined') {
12364
+ 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");
12365
+ console.warn(new Error().stack);
12366
+ }
12367
+ return new Date(NaN);
12368
+ }
12369
+ }
12370
+
12371
+ function addMilliseconds(dirtyDate, dirtyAmount) {
12372
+ requiredArgs(2, arguments);
12373
+ var timestamp = toDate(dirtyDate).getTime();
12374
+ var amount = toInteger(dirtyAmount);
12375
+ return new Date(timestamp + amount);
12376
+ }
12377
+
11886
12378
  function getTimezoneOffsetInMilliseconds(date) {
11887
12379
  var utcDate = new Date(Date.UTC(date.getFullYear(), date.getMonth(), date.getDate(), date.getHours(), date.getMinutes(), date.getSeconds(), date.getMilliseconds()));
11888
12380
  utcDate.setUTCFullYear(date.getFullYear());
@@ -13338,8 +13830,9 @@ const convertEpochToDate$1 = dateEpoch => {
13338
13830
  }
13339
13831
  };
13340
13832
  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;
13833
+ var _location$pathname, _receiptNumber, _JSON$parse, _JSON$parse$value, _JSON$parse$value$inf, _dataCheck$payments, _dataCheck$payments$P, _dataCheck$payments$P2, _dataCheck$payments$P3, _data$, _data$2, _data$8, _data$9, _data$0, _data$1, _data$10, _data$11, _data$12, _data$13, _data$14;
13342
13834
  const history = useHistory();
13835
+ const location = useLocation();
13343
13836
  const {
13344
13837
  t
13345
13838
  } = useTranslation();
@@ -13349,19 +13842,30 @@ const SuccessfulPayment$1 = props => {
13349
13842
  } = Digit.Hooks.useQueryParams();
13350
13843
  const [displayMenu, setDisplayMenu] = useState(false);
13351
13844
  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");
13845
+ 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
13846
  const combineResponseFSM = isFSMResponse ? `${t("PAYMENT_COLLECT_LABEL")} / ${t("PAYMENT_COLLECT")}` : t("PAYMENT_LOCALIZATION_RESPONSE");
13354
13847
  const [printing, setPrinting] = useState(false);
13355
13848
  const [chbPermissionLoading, setChbPermissionLoading] = useState(false);
13356
13849
  props.setLink(combineResponseFSM);
13850
+ const checkParam = useParams();
13851
+ const queryParams = new URLSearchParams(location.search);
13852
+ const [allowFetchBill, setallowFetchBill] = useState(false);
13853
+ const egPgTxnId = queryParams.get("eg_pg_txnid");
13854
+ const razorpayPaymentId = queryParams.get("razorpayPaymentId");
13855
+ const razorpayOrderId = queryParams.get("razorpayOrderId");
13856
+ const razorpaySignature = queryParams.get("razorpaySignature");
13357
13857
  let {
13358
13858
  consumerCode,
13359
13859
  receiptNumber,
13360
13860
  businessService
13361
13861
  } = useParams();
13362
- console.log("consummennene", consumerCode);
13862
+ 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"));
13863
+ console.log("checkParam", checkParam);
13864
+ console.log("egPgTxnId", egPgTxnId);
13865
+ console.log("businessService", businessService);
13363
13866
  const tenantId = Digit.ULBService.getCurrentTenantId();
13364
- receiptNumber = receiptNumber.replace(/%2F/g, "/");
13867
+ receiptNumber = (_receiptNumber = receiptNumber) === null || _receiptNumber === void 0 ? void 0 : _receiptNumber.replace(/%2F/g, "/");
13868
+ console.log('receiptNumber in response page', receiptNumber);
13365
13869
  const {
13366
13870
  data = {},
13367
13871
  isLoading: isBpaSearchLoading,
@@ -13381,6 +13885,40 @@ const SuccessfulPayment$1 = props => {
13381
13885
  const selectedTenantData = cities.data.find(item => item.city.districtTenantCode === loginCity);
13382
13886
  ulbType = selectedTenantData === null || selectedTenantData === void 0 ? void 0 : (_selectedTenantData$c = selectedTenantData.city) === null || _selectedTenantData$c === void 0 ? void 0 : _selectedTenantData$c.ulbGrade;
13383
13887
  }
13888
+ const {
13889
+ isLoading,
13890
+ data: dataCheck,
13891
+ isError
13892
+ } = Digit.Hooks.usePaymentUpdate({
13893
+ egId: egPgTxnId
13894
+ }, businessService, {
13895
+ enabled: !!egPgTxnId,
13896
+ retry: false,
13897
+ staleTime: Infinity,
13898
+ refetchOnWindowFocus: false
13899
+ });
13900
+ 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;
13901
+ const {
13902
+ data: reciept_data,
13903
+ isLoading: recieptDataLoading
13904
+ } = Digit.Hooks.useRecieptSearch({
13905
+ tenantId,
13906
+ businessService: businessService,
13907
+ receiptNumbers: checkRecieptNumber
13908
+ }, {
13909
+ retry: false,
13910
+ staleTime: Infinity,
13911
+ refetchOnWindowFocus: false,
13912
+ select: dat => {
13913
+ return dat.Payments[0];
13914
+ },
13915
+ enabled: allowFetchBill
13916
+ });
13917
+ useEffect(() => {
13918
+ if (dataCheck && dataCheck.txnStatus && dataCheck.txnStatus !== "FAILURE") {
13919
+ setallowFetchBill(true);
13920
+ }
13921
+ }, [dataCheck]);
13384
13922
  const mutation = Digit.Hooks.chb.useChbCreateAPI(tenantId, false);
13385
13923
  const FSM_EDITOR = Digit.UserService.hasAccess("FSM_EDITOR_EMP") || false;
13386
13924
  function onActionSelect(action) {
@@ -13441,29 +13979,19 @@ const SuccessfulPayment$1 = props => {
13441
13979
  } = Digit.Hooks.useCommonMDMS(tenantId, "common-masters", "ReceiptKey", {
13442
13980
  select: data => {
13443
13981
  var _data$commonMasters, _data$commonMasters$u, _data$commonMasters$u2;
13444
- return businessService === "GC.ONE_TIME_FEE" ? "garbage-receipt" : businessService === "rl-services" ? "rentandlease-receipt" : ((_data$commonMasters = data["common-masters"]) === null || _data$commonMasters === void 0 ? void 0 : (_data$commonMasters$u = _data$commonMasters.uiCommonPay) === null || _data$commonMasters$u === void 0 ? void 0 : (_data$commonMasters$u2 = _data$commonMasters$u.filter(({
13982
+ return businessService === "GC.ONE_TIME_FEE" || businessService === "GC" ? "garbage-receipt" : businessService === "rl-services" ? "rentandlease-receipt" : ((_data$commonMasters = data["common-masters"]) === null || _data$commonMasters === void 0 ? void 0 : (_data$commonMasters$u = _data$commonMasters.uiCommonPay) === null || _data$commonMasters$u === void 0 ? void 0 : (_data$commonMasters$u2 = _data$commonMasters$u.filter(({
13445
13983
  code
13446
13984
  }) => 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
13985
  }
13448
13986
  });
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
- };
13987
+ const {
13988
+ printReceipt: printBillReceipt
13989
+ } = Digit.Hooks.usePrintBillReceipt({
13990
+ tenantId,
13991
+ setLoader: setPrinting,
13992
+ t,
13993
+ pdfkey: generatePdfKey
13994
+ });
13467
13995
  const convertDateToEpoch = (dateString, dayStartOrEnd = "dayend") => {
13468
13996
  try {
13469
13997
  const parts = dateString.match(/(\d{4})-(\d{1,2})-(\d{1,2})/);
@@ -13539,15 +14067,28 @@ const SuccessfulPayment$1 = props => {
13539
14067
  if (chbPermissionLoading) return;
13540
14068
  setChbPermissionLoading(true);
13541
14069
  try {
13542
- var _applicationDetails$c, _applicationDetails$c2, _applicationDetails$c3, _applicationDetails$c4, _applicationDetails$c5, _applicationDetails$c6, _applicationDetails$A3, _applicationDetails$A4;
14070
+ var _applicationDetails$c, _challanDetails$addit, _challanDetails$addit2, _challanDetails$addre, _applicationDetails$A3, _applicationDetails$A4;
13543
14071
  const applicationDetails = await Digit.ChallanGenerationService.search({
13544
14072
  tenantId,
13545
14073
  filters: {
13546
14074
  challanNo: consumerCode
13547
14075
  }
13548
14076
  });
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);
14077
+ const challanDetails = applicationDetails === null || applicationDetails === void 0 ? void 0 : (_applicationDetails$c = applicationDetails.challans) === null || _applicationDetails$c === void 0 ? void 0 : _applicationDetails$c[0];
14078
+ const latitude = challanDetails === null || challanDetails === void 0 ? void 0 : (_challanDetails$addit = challanDetails.additionalDetail) === null || _challanDetails$addit === void 0 ? void 0 : _challanDetails$addit.latitude;
14079
+ const longitude = challanDetails === null || challanDetails === void 0 ? void 0 : (_challanDetails$addit2 = challanDetails.additionalDetail) === null || _challanDetails$addit2 === void 0 ? void 0 : _challanDetails$addit2.longitude;
14080
+ const addressFallback = challanDetails === null || challanDetails === void 0 ? void 0 : (_challanDetails$addre = challanDetails.address) === null || _challanDetails$addre === void 0 ? void 0 : _challanDetails$addre.addressLine1;
14081
+ let location = addressFallback;
14082
+ if (latitude && longitude) {
14083
+ try {
14084
+ const geoLocation = await getLocationName(latitude, longitude);
14085
+ if (geoLocation) {
14086
+ location = geoLocation;
14087
+ }
14088
+ } catch (err) {
14089
+ console.warn("Reverse geocoding failed, using address fallback", err);
14090
+ }
14091
+ }
13551
14092
  const challan = {
13552
14093
  ...applicationDetails,
13553
14094
  ...challanEmpData
@@ -13607,9 +14148,10 @@ const SuccessfulPayment$1 = props => {
13607
14148
  const payments = await Digit.PaymentService.getReciept(tenantId, businessService, {
13608
14149
  receiptNumbers: receiptNumber
13609
14150
  });
14151
+ const pdfPayments = fixAdjustedAmount(payments === null || payments === void 0 ? void 0 : (_payments$Payments3 = payments.Payments) === null || _payments$Payments3 === void 0 ? void 0 : _payments$Payments3[0]);
13610
14152
  const response = await Digit.PaymentService.generatePdf(tenantId, {
13611
14153
  Payments: [{
13612
- ...((payments === null || payments === void 0 ? void 0 : (_payments$Payments3 = payments.Payments) === null || _payments$Payments3 === void 0 ? void 0 : _payments$Payments3[0]) || {}),
14154
+ ...pdfPayments,
13613
14155
  ...application
13614
14156
  }]
13615
14157
  }, generatePdfKeyForTL);
@@ -13655,16 +14197,17 @@ const SuccessfulPayment$1 = props => {
13655
14197
  };
13656
14198
  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;
13657
14199
  if (!fileStoreId) {
13658
- var _payments$Payments$3, _payments$Payments4, _response, _response2;
14200
+ var _payments$Payments4, _payments$Payments$3, _response, _response2;
13659
14201
  const payments = await Digit.PaymentService.getReciept(tenantId, businessService, {
13660
14202
  receiptNumbers: receiptNumber
13661
14203
  });
14204
+ const pdfPayments = fixAdjustedAmount(payments === null || payments === void 0 ? void 0 : (_payments$Payments4 = payments.Payments) === null || _payments$Payments4 === void 0 ? void 0 : _payments$Payments4[0]);
13662
14205
  let response = {
13663
14206
  filestoreIds: [(_payments$Payments$3 = payments.Payments[0]) === null || _payments$Payments$3 === void 0 ? void 0 : _payments$Payments$3.fileStoreId]
13664
14207
  };
13665
14208
  response = await Digit.PaymentService.generatePdf(tenantId, {
13666
14209
  Payments: [{
13667
- ...((payments === null || payments === void 0 ? void 0 : (_payments$Payments4 = payments.Payments) === null || _payments$Payments4 === void 0 ? void 0 : _payments$Payments4[0]) || {}),
14210
+ ...pdfPayments,
13668
14211
  ...application
13669
14212
  }]
13670
14213
  }, "chbservice-receipt");
@@ -13727,13 +14270,21 @@ const SuccessfulPayment$1 = props => {
13727
14270
  receiptNumbers: receiptNumber
13728
14271
  });
13729
14272
  try {
13730
- var _payments$Payments$4;
14273
+ var _applicationDetails$P, _payments$Payments$4;
14274
+ const applicationDetails = await Digit.PTRService.search({
14275
+ tenantId,
14276
+ filters: {
14277
+ applicationNumber: consumerCode
14278
+ }
14279
+ });
14280
+ const application = applicationDetails === null || applicationDetails === void 0 ? void 0 : (_applicationDetails$P = applicationDetails.PetRegistrationApplications) === null || _applicationDetails$P === void 0 ? void 0 : _applicationDetails$P[0];
13731
14281
  let fileStoreId = (_payments$Payments$4 = payments.Payments[0]) === null || _payments$Payments$4 === void 0 ? void 0 : _payments$Payments$4.fileStoreId;
13732
14282
  if (!fileStoreId) {
13733
14283
  var _payments$Payments6;
13734
14284
  let response = await Digit.PaymentService.generatePdf(tenantId, {
13735
14285
  Payments: [{
13736
- ...((payments === null || payments === void 0 ? void 0 : (_payments$Payments6 = payments.Payments) === null || _payments$Payments6 === void 0 ? void 0 : _payments$Payments6[0]) || {})
14286
+ ...((payments === null || payments === void 0 ? void 0 : (_payments$Payments6 = payments.Payments) === null || _payments$Payments6 === void 0 ? void 0 : _payments$Payments6[0]) || {}),
14287
+ application
13737
14288
  }]
13738
14289
  }, "pet-receipt-employee");
13739
14290
  fileStoreId = response === null || response === void 0 ? void 0 : response.filestoreIds[0];
@@ -13782,6 +14333,30 @@ const SuccessfulPayment$1 = props => {
13782
14333
  setPrinting(false);
13783
14334
  }
13784
14335
  };
14336
+ const printMCollectReceipt = async () => {
14337
+ if (printing) return;
14338
+ setPrinting(true);
14339
+ try {
14340
+ var _payments$Payments8, _payments$Payments8$, _payments$Payments9, _payments$Payments9$;
14341
+ const payments = await Digit.PaymentService.getReciept(tenantId, businessService, {
14342
+ consumerCodes: consumerCode
14343
+ });
14344
+ let response = {
14345
+ 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]
14346
+ };
14347
+ 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)) {
14348
+ response = await Digit.PaymentService.generatePdf(tenantId, {
14349
+ Payments: payments.Payments
14350
+ }, generatePdfKey || "consolidatedreceipt");
14351
+ }
14352
+ const fileStore = await Digit.PaymentService.printReciept(tenantId, {
14353
+ fileStoreIds: response.filestoreIds[0]
14354
+ });
14355
+ window.open(fileStore[response.filestoreIds[0]], "_blank");
14356
+ } finally {
14357
+ setPrinting(false);
14358
+ }
14359
+ };
13785
14360
  const svCertificate = async () => {
13786
14361
  const state = tenantId;
13787
14362
  const applicationDetails = await Digit.SVService.search({
@@ -14195,18 +14770,18 @@ const SuccessfulPayment$1 = props => {
14195
14770
  });
14196
14771
  window.open(fileStore[response.filestoreIds[0]], "_blank");
14197
14772
  };
14198
- if (businessService !== null && businessService !== void 0 && businessService.includes("BPA") && isBpaSearchLoading) return /*#__PURE__*/React.createElement(Loader, null);
14773
+ if (isLoading || recieptDataLoading) return /*#__PURE__*/React.createElement(Loader, null);
14199
14774
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Card, null, /*#__PURE__*/React.createElement(Banner, {
14200
14775
  message: getMessage(),
14201
14776
  info: t("PAYMENT_LOCALIZATION_RECIEPT_NO"),
14202
- applicationNumber: receiptNumber,
14777
+ applicationNumber: receiptNumber || checkRecieptNumber,
14203
14778
  successful: true
14204
14779
  }), /*#__PURE__*/React.createElement(CardText, null, getCardText()), generatePdfKey ? /*#__PURE__*/React.createElement("div", {
14205
14780
  style: {
14206
14781
  display: "flex",
14207
14782
  justifyContent: "space-evenly"
14208
14783
  }
14209
- }, businessService !== "chb-services" && businessService !== "adv-services" && businessService !== "pet-services" && businessService !== "NDC" && businessService !== "Challan_Generation" && /*#__PURE__*/React.createElement("div", {
14784
+ }, businessService !== "chb-services" && businessService !== "adv-services" && businessService !== "GC.ONE_TIME_FEE" && businessService !== "GC" && businessService !== "pet-services" && businessService !== "NDC" && businessService !== "Challan_Generation" && businessService !== "rl-services" && !isMCollectService && /*#__PURE__*/React.createElement("div", {
14210
14785
  className: "primary-label-btn d-grid",
14211
14786
  style: {
14212
14787
  marginLeft: "unset",
@@ -14223,23 +14798,7 @@ const SuccessfulPayment$1 = props => {
14223
14798
  fill: "none"
14224
14799
  }), /*#__PURE__*/React.createElement("path", {
14225
14800
  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", {
14801
+ })), t("CS_COMMON_PRINT_RECEIPT"))), businessService == "sv-services" ? /*#__PURE__*/React.createElement("div", {
14243
14802
  className: "primary-label-btn d-grid",
14244
14803
  style: {
14245
14804
  marginLeft: "unset",
@@ -14400,6 +14959,55 @@ const SuccessfulPayment$1 = props => {
14400
14959
  fill: "none"
14401
14960
  }), /*#__PURE__*/React.createElement("path", {
14402
14961
  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"
14962
+ })), t("CHB_FEE_RECEIPT")))) : null, isMCollectService ? /*#__PURE__*/React.createElement("div", {
14963
+ style: {
14964
+ display: "flex",
14965
+ justifyContent: "flex-end",
14966
+ gap: "20px",
14967
+ marginRight: "20px",
14968
+ marginTop: "15px",
14969
+ marginBottom: "15px"
14970
+ }
14971
+ }, /*#__PURE__*/React.createElement("div", {
14972
+ className: "primary-label-btn d-grid",
14973
+ onClick: printing ? undefined : printMCollectReceipt
14974
+ }, printing ? /*#__PURE__*/React.createElement(Loader, null) : /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement("svg", {
14975
+ xmlns: "http://www.w3.org/2000/svg",
14976
+ height: "24",
14977
+ viewBox: "0 0 24 24",
14978
+ width: "24"
14979
+ }, /*#__PURE__*/React.createElement("path", {
14980
+ d: "M0 0h24v24H0z",
14981
+ fill: "none"
14982
+ }), /*#__PURE__*/React.createElement("path", {
14983
+ 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"
14984
+ })), t("CS_COMMON_PRINT_RECEIPT")))) : null, businessService === "rl-services" || businessService === "GC.ONE_TIME_FEE" || businessService === "GC" ? /*#__PURE__*/React.createElement("div", {
14985
+ style: {
14986
+ display: "flex",
14987
+ justifyContent: "flex-end",
14988
+ gap: "20px",
14989
+ marginRight: "20px",
14990
+ marginTop: "15px",
14991
+ marginBottom: "15px"
14992
+ }
14993
+ }, /*#__PURE__*/React.createElement("div", {
14994
+ className: "primary-label-btn d-grid",
14995
+ onClick: printing ? undefined : () => printBillReceipt({
14996
+ businessService: businessService,
14997
+ receiptNumber: receiptNumber,
14998
+ rootKey: "PAYMENTS",
14999
+ billOrPaymentResponse: reciept_data
15000
+ })
15001
+ }, printing ? /*#__PURE__*/React.createElement(Loader, null) : /*#__PURE__*/React.createElement(Fragment, null, /*#__PURE__*/React.createElement("svg", {
15002
+ xmlns: "http://www.w3.org/2000/svg",
15003
+ height: "24",
15004
+ viewBox: "0 0 24 24",
15005
+ width: "24"
15006
+ }, /*#__PURE__*/React.createElement("path", {
15007
+ d: "M0 0h24v24H0z",
15008
+ fill: "none"
15009
+ }), /*#__PURE__*/React.createElement("path", {
15010
+ 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
15011
  })), t("CHB_FEE_RECEIPT")))) : null, businessService == "Challan_Generation" ? /*#__PURE__*/React.createElement("div", {
14404
15012
  style: {
14405
15013
  display: "flex",
@@ -14751,8 +15359,15 @@ const EmployeePayment = ({
14751
15359
  path: `${currentPath}/collect/:businessService/:consumerCode`
14752
15360
  }, /*#__PURE__*/React.createElement(CollectPayment, Object.assign({}, commonProps, {
14753
15361
  basePath: currentPath
15362
+ }))), /*#__PURE__*/React.createElement(Route, {
15363
+ path: `${currentPath}/challan/collect/:businessService/:consumerCode`
15364
+ }, /*#__PURE__*/React.createElement(SelectPaymentType$2, Object.assign({}, commonProps, {
15365
+ basePath: currentPath,
15366
+ stateCode: stateCode
14754
15367
  }))), /*#__PURE__*/React.createElement(Route, {
14755
15368
  path: `${currentPath}/success/:businessService/:receiptNumber/:consumerCode`
15369
+ }, /*#__PURE__*/React.createElement(SuccessfulPayment$1, commonProps)), /*#__PURE__*/React.createElement(Route, {
15370
+ path: `${currentPath}/challan/success/:businessService/:consumerCode`
14756
15371
  }, /*#__PURE__*/React.createElement(SuccessfulPayment$1, commonProps)), /*#__PURE__*/React.createElement(Route, {
14757
15372
  path: `${currentPath}/integration/:moduleName/:pageName`
14758
15373
  }, /*#__PURE__*/React.createElement(IFrameInterface, commonProps)), /*#__PURE__*/React.createElement(Route, {
@@ -14916,7 +15531,7 @@ const amountToWords = num => {
14916
15531
  return res.trim();
14917
15532
  };
14918
15533
  let [r, p] = num.toString().split(".").map(x => +x || 0);
14919
- return (r ? toWords(r) + " Rupees" : "") + (p ? (r ? " and " : "") + toWords(p) + " Paise" : "") || "Zero Rupees";
15534
+ return (r ? "Rupees " + toWords(r) : "") + (p ? (r ? " and " : "") + toWords(p) + " Paise" : "") || "Rupees Zero ";
14920
15535
  };
14921
15536
  const ChallanData = (tenantId, consumerCode) => {
14922
15537
  var _wfData$data, _wfData$data$processI, _officerInstance$assi, _employeeData$data, _employeeData$data$Em, _officerRaw$assignmen, _officerRaw$user;
@@ -14964,6 +15579,46 @@ const formatDate = dateStr => {
14964
15579
  const [year, month, day] = dateStr.split("-");
14965
15580
  return `${day}/${month}/${year}`;
14966
15581
  };
15582
+ const REQUIRED_TAX_CODES = ["CHB_SECURITY_DEPOSIT", "SGST", "CHB_COW_CESS", "BOOKING_FEES", "CHB_DISCOUNT", "CGST"];
15583
+ const formatAmount = (value, code) => {
15584
+ const num = Number(value) || 0;
15585
+ if (code === "CHB_DISCOUNT") {
15586
+ return Math.abs(num).toLocaleString("en-IN");
15587
+ }
15588
+ return Math.max(0, num).toLocaleString("en-IN");
15589
+ };
15590
+ const fixAdjustedAmount = (payments = {}) => ({
15591
+ ...payments,
15592
+ totalAmountPaid: Math.max(0, Number(payments === null || payments === void 0 ? void 0 : payments.totalAmountPaid) || 0).toLocaleString("en-IN"),
15593
+ totalDue: Math.max(0, Number(payments === null || payments === void 0 ? void 0 : payments.totalDue) || 0).toLocaleString("en-IN"),
15594
+ paymentDetails: ((payments === null || payments === void 0 ? void 0 : payments.paymentDetails) || []).map(pd => {
15595
+ var _pd$bill;
15596
+ return {
15597
+ ...pd,
15598
+ totalAmountPaid: Math.max(0, Number(pd === null || pd === void 0 ? void 0 : pd.totalAmountPaid) || 0).toLocaleString("en-IN"),
15599
+ bill: {
15600
+ ...(pd === null || pd === void 0 ? void 0 : pd.bill),
15601
+ billDetails: ((pd === null || pd === void 0 ? void 0 : (_pd$bill = pd.bill) === null || _pd$bill === void 0 ? void 0 : _pd$bill.billDetails) || []).map(bd => {
15602
+ var _REQUIRED_TAX_CODES$f, _ref;
15603
+ const existing = (bd === null || bd === void 0 ? void 0 : bd.billAccountDetails) || [];
15604
+ const existingCodes = new Set(existing === null || existing === void 0 ? void 0 : existing.map(acc => acc === null || acc === void 0 ? void 0 : acc.taxHeadCode));
15605
+ const missing = REQUIRED_TAX_CODES === null || REQUIRED_TAX_CODES === void 0 ? void 0 : (_REQUIRED_TAX_CODES$f = REQUIRED_TAX_CODES.filter(code => !existingCodes.has(code))) === null || _REQUIRED_TAX_CODES$f === void 0 ? void 0 : _REQUIRED_TAX_CODES$f.map(code => ({
15606
+ taxHeadCode: code,
15607
+ adjustedAmount: formatAmount(0, code)
15608
+ }));
15609
+ const updatedAccounts = (_ref = [...existing, ...missing]) === null || _ref === void 0 ? void 0 : _ref.map(acc => ({
15610
+ ...acc,
15611
+ adjustedAmount: formatAmount(acc === null || acc === void 0 ? void 0 : acc.adjustedAmount, acc === null || acc === void 0 ? void 0 : acc.taxHeadCode)
15612
+ }));
15613
+ return {
15614
+ ...bd,
15615
+ billAccountDetails: updatedAccounts
15616
+ };
15617
+ })
15618
+ }
15619
+ };
15620
+ })
15621
+ });
14967
15622
 
14968
- export { ChallanData, PaymentLinks, PaymentModule, amountToWords, formatDate, getCurrentEpoch, getLocationName, groupKeyForCart, paymentConfigs, transformBookingResponseToBookingData };
15623
+ export { ChallanData, PaymentLinks, PaymentModule, amountToWords, fixAdjustedAmount, formatDate, getCurrentEpoch, getLocationName, groupKeyForCart, paymentConfigs, transformBookingResponseToBookingData };
14969
15624
  //# sourceMappingURL=index.modern.js.map