Skip to content

Commit

Permalink
Merge pull request #5019 from bcgov/dev-ST-FOIMOD-2894
Browse files Browse the repository at this point in the history
Changes to resolve payment issue + Merge (rootcause)
  • Loading branch information
sumathi-thirumani authored Jan 24, 2024
2 parents 33d0210 + 5806919 commit b972819
Showing 1 changed file with 24 additions and 7 deletions.
31 changes: 24 additions & 7 deletions request-management-api/request_api/services/requestservice.py
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,8 @@ def postcorrespondenceeventtoworkflow(
attributes,
)



def calculateduedate(self, ministryrequestid, foirequest, paymentdate):
duedate_includeoffhold, cfrduedate_includeoffhold = self.__isincludeoffhold()
onhold_extend_days = duecalculator().getbusinessdaysbetween(foirequest["onholdTransitionDate"], paymentdate)
Expand All @@ -262,21 +264,36 @@ def calculateduedate(self, ministryrequestid, foirequest, paymentdate):
calc_cfrduedate = duecalculator().addbusinessdays(foirequest["cfrDueDate"], cfrduedate_extend_days)
return calc_duedate, calc_cfrduedate

def __skipduedatecalculation(self, ministryrequestid, offholddate):



def __skipduedatecalculation(self, ministryrequestid, offholddate, currentstatus="", nextstatename=""):
previousoffholddate = FOIMinistryRequest.getlastoffholddate(ministryrequestid)
if (
currentstatus not in (None, "")
and currentstatus == StateName.onhold.value
and nextstatename not in (None, "")
and currentstatus == nextstatename
):
return True
if previousoffholddate not in (None, ""):
previouspaymentdate_pst = datetimehandler().convert_to_pst(
previousoffholddate
)
if (
datetimehandler().getdate(previouspaymentdate_pst).date()
== datetimehandler().getdate(offholddate).date()
):
return True
foiministry_request = FOIMinistryRequest.getrequest(ministryrequestid)
request_reopened = self.__hasreopened(ministryrequestid, "ministryrequest")
if previousoffholddate not in (None, ''):
previouspaymentdate_pst = datetimehandler().convert_to_pst(previousoffholddate)
if datetimehandler().getdate(previouspaymentdate_pst).date() == datetimehandler().getdate(offholddate).date():
return True
if foiministry_request['isoipcreview'] == True and request_reopened:
return True
return False

def __isincludeoffhold(self):
payment_config_str = os.getenv("PAYMENT_CONFIG",'')
if payment_config_str in (None, ''):
payment_config_str = os.getenv("PAYMENT_CONFIG","")
if payment_config_str in (None, ""):
return True, True
_paymentconfig = json.loads(payment_config_str)
duedate_includeoffhold = True if _paymentconfig["duedate"]["includeoffhold"] == "Y" else False
Expand Down

0 comments on commit b972819

Please sign in to comment.