Skip to content

Commit

Permalink
Added mcollect receipt key
Browse files Browse the repository at this point in the history
  • Loading branch information
deepa-s-13 committed Mar 8, 2024
1 parent bf087f3 commit 6196630
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -99,13 +99,13 @@ const EmployeeChallan = (props) => {

const challanDownload = {
order: 1,
label: t("PDF_STATIC_LABEL_CONSOLIDATED_RECEIPT_LETTER_HEAD"),
label: t("UC_CHALLAN"),
onClick: () => downloadAndPrintChallan(challanno),
};

const receiptDownload = {
order: 2,
label: t("RECEIPT"),
label: t("Receipt"),
onClick: () => downloadAndPrintReciept(challanDetails?.businessService, challanno),
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,17 @@ export const downloadAndPrintChallan = async (challanNo, mode = "download") => {

export const downloadAndPrintReciept = async (bussinessService, consumerCode, mode = "download") => {
const tenantId = Digit.ULBService.getCurrentTenantId();
const response = await Digit.MCollectService.receipt_download(bussinessService, consumerCode, tenantId);
const data = await Digit.PaymentService.getReciept(tenantId, bussinessService,{ consumerCodes: consumerCode });
const payments=data?.Payments[0];
let response=null;
if (payments?.fileStoreIdS ) {
response = { filestoreIds: [payments?.fileStoreId] };
}
else{
response = await Digit.PaymentService.generatePdf(tenantId, { Payments: [{...payments}] }, "consolidatedreceipt");
}
const fileStore = await Digit.PaymentService.printReciept(tenantId, { fileStoreIds: response.filestoreIds[0] });
window.open(fileStore[response?.filestoreIds[0]], "_blank");
const responseStatus = parseInt(response.status, 10);
if (responseStatus === 201 || responseStatus === 200) {
let fileName =
Expand Down

0 comments on commit 6196630

Please sign in to comment.