From afd5e7baff08439489fb8c0f8b8ce24025bed097 Mon Sep 17 00:00:00 2001 From: Milos Despotovic Date: Wed, 4 Dec 2024 10:16:17 -0800 Subject: [PATCH 1/5] Fix refunddate keyerror --- .../request_api/services/applicationfeeservice.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/request-management-api/request_api/services/applicationfeeservice.py b/request-management-api/request_api/services/applicationfeeservice.py index 89b25042d..9e81220c4 100644 --- a/request-management-api/request_api/services/applicationfeeservice.py +++ b/request-management-api/request_api/services/applicationfeeservice.py @@ -90,7 +90,7 @@ def __prepareapplicationfee(self, requestid, data={}, getprevious=True): applicationfee.orderid = data.get('orderid', None) applicationfee.transactionnumber = data.get('transactionnumber', None) applicationfee.refundamount = data.get('refundamount', None) - if data['refunddate'] and isinstance(data['refunddate'], str) and len(data['refunddate']) < 11 and data['refunddate'].count('-') == 2: + if 'refunddate' in data and isinstance(data['refunddate'], str) and len(data['refunddate']) < 11 and data['refunddate'].count('-') == 2: parseddateobject = data['refunddate'].split('-') datetime_object = datetime(int(parseddateobject[0]), int(parseddateobject[1]), int(parseddateobject[2]), 17, 0, 0) applicationfee.refunddate = datetime_object From 24804864a2abcc7387addda3f05e74e942d119eb Mon Sep 17 00:00:00 2001 From: Milos Despotovic Date: Wed, 4 Dec 2024 11:02:53 -0800 Subject: [PATCH 2/5] Fix error when saving new app fee with refund amount --- .../request_api/services/applicationfeeservice.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/request-management-api/request_api/services/applicationfeeservice.py b/request-management-api/request_api/services/applicationfeeservice.py index 9e81220c4..90418afbb 100644 --- a/request-management-api/request_api/services/applicationfeeservice.py +++ b/request-management-api/request_api/services/applicationfeeservice.py @@ -17,7 +17,7 @@ def saveapplicationfee(self, requestid, ministryrequestid, data, userid = 'syste if result.success == True and applicationfeeservice().applicationfeestatushaschanged(requestid): applicationfeeformevent().createfeestatuschangeevent(requestid, ministryrequestid, data, userid, username) if result.success == True and applicationfeeservice().applicationfeerefundupdated(requestid): - applicationfeeformevent().createfeerefundevent(requestid, ministryrequestid, applicationfee.refundamount, userid, username) + applicationfeeformevent().createfeerefundevent(requestid, ministryrequestid, data['refundamount'], userid, username) return result def getapplicationfee(self, requestid, ministryrequestid = None): From 9c42b17364c5cdea923a2f6d270726cae7240b5f Mon Sep 17 00:00:00 2001 From: Milos Despotovic Date: Wed, 4 Dec 2024 11:42:36 -0800 Subject: [PATCH 3/5] Add style for app fee receipt link --- .../src/components/FOI/customComponents/Fees/index.scss | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/forms-flow-web/src/components/FOI/customComponents/Fees/index.scss b/forms-flow-web/src/components/FOI/customComponents/Fees/index.scss index aec8518b6..2f6975c35 100644 --- a/forms-flow-web/src/components/FOI/customComponents/Fees/index.scss +++ b/forms-flow-web/src/components/FOI/customComponents/Fees/index.scss @@ -178,6 +178,12 @@ font-size: 20px; margin-top: 2px; } + .receipt-link { + cursor: pointer; + } + .receipt-delete { + cursor: pointer; + } } @media (max-width: 1444px) { From eb4719454b3b16bc55aee4bad994fdbbcb70c056 Mon Sep 17 00:00:00 2001 From: Milos Despotovic Date: Wed, 4 Dec 2024 11:42:50 -0800 Subject: [PATCH 4/5] Add style for app fee receipt link --- .../FOI/customComponents/Fees/Tabs/ApplicationFeeTab.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/forms-flow-web/src/components/FOI/customComponents/Fees/Tabs/ApplicationFeeTab.tsx b/forms-flow-web/src/components/FOI/customComponents/Fees/Tabs/ApplicationFeeTab.tsx index 56898ae59..3e4c35969 100644 --- a/forms-flow-web/src/components/FOI/customComponents/Fees/Tabs/ApplicationFeeTab.tsx +++ b/forms-flow-web/src/components/FOI/customComponents/Fees/Tabs/ApplicationFeeTab.tsx @@ -363,14 +363,15 @@ export const ApplicationFeeTab = ({ const uploadedReceiptsField = formData?.receipts.map((receipt: any) => { if (receipt.isactive) { return ( -
+
{ getReceiptFile(receipt?.receiptfilename, receipt?.receiptfilepath)} } >{receipt.receiptfilename ? receipt.receiptfilename : 'view online payment receipt'} setFormData((values: any) => ({...values, ['receipts']: [...formData?.receipts.filter((r: any) => r.receiptfilename != receipt.receiptfilename), {...receipt, isactive: false}]}))} > From bf4a57d3b947a217ef454cbb66acf282ead3c449 Mon Sep 17 00:00:00 2001 From: Milos Despotovic Date: Wed, 4 Dec 2024 11:44:17 -0800 Subject: [PATCH 5/5] Update validations --- .../FOI/customComponents/Fees/index.tsx | 21 ++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/forms-flow-web/src/components/FOI/customComponents/Fees/index.tsx b/forms-flow-web/src/components/FOI/customComponents/Fees/index.tsx index 571c93aac..f97da7733 100644 --- a/forms-flow-web/src/components/FOI/customComponents/Fees/index.tsx +++ b/forms-flow-web/src/components/FOI/customComponents/Fees/index.tsx @@ -221,10 +221,15 @@ export const Fees = ({ } const validateFields = () => { - if (applicationFeeFormData?.paymentSource != 'creditcardonline') { - if (applicationFeeFormData?.paymentDate == null || applicationFeeFormData?.paymentDate == '') return false; - if (applicationFeeFormData?.amountPaid == 0) return false; - if (applicationFeeFormData?.paymentSource == 'init') return false; + if (!_.isEqual(initialApplicationFeeFormData?.applicationFeeStatus, applicationFeeFormData?.applicationFeeStatus)) { + if (applicationFeeFormData?.applicationFeeStatus == 'na-ige' || applicationFeeFormData?.applicationFeeStatus == 'appfeeowing') return true; + if (applicationFeeFormData?.applicationFeeStatus == 'paid') { + if (applicationFeeFormData?.paymentSource != 'creditcardonline') { + if (applicationFeeFormData?.paymentDate == null || applicationFeeFormData?.paymentDate == '') return false; + if (applicationFeeFormData?.amountPaid == 0) return false; + if (applicationFeeFormData?.paymentSource == 'init') return false; + } + } } if (validateBalancePaymentMethod() || validateEstimatePaymentMethod()) { return false; @@ -245,10 +250,12 @@ export const Fees = ({ if (!validateApplicationFeeAmountPaid()) { return false; } - if (!validateApplicationFeeRefundAmount() || !applicationFeeFormData?.refundDate) { - return false; + if (!_.isEqual(initialApplicationFeeFormData?.refundAmount, applicationFeeFormData?.refundAmount) || + !_.isEqual(initialApplicationFeeFormData?.refundDate, applicationFeeFormData?.refundDate)) { + if (!validateApplicationFeeRefundAmount() || !applicationFeeFormData?.refundDate) { + return false; + } } - if (receiptFileUpload && receiptFileUpload.length > 0) return true; return !_.isEqual(initialCFRFormData, CFRFormData) || !_.isEqual(initialApplicationFeeFormData, applicationFeeFormData);