Skip to content

Commit

Permalink
Merge pull request #772 from DTS-STN/develop
Browse files Browse the repository at this point in the history
Sync Main branch with Develop
  • Loading branch information
MarcoGoC authored Jun 20, 2023
2 parents 87958ca + ed3bd9c commit 54e9fcd
Show file tree
Hide file tree
Showing 5 changed files with 101 additions and 32 deletions.
26 changes: 26 additions & 0 deletions helm/charts/eligibility-estimator/templates/prod_ingress.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{{- if .Values.ingress.prod_enabled -}}
{{- $fullName := include "fullname" . -}}
{{- $svcPort := .Values.service.port -}}
apiVersion: v1
items:
- apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
annotations:
appgw.ingress.kubernetes.io/ssl-redirect: "true"
kubernetes.io/ingress.class: azure/application-gateway
appgw.ingress.kubernetes.io/appgw-ssl-certificate: {{ .Values.ingress.ssl_cert }}
name: {{ $fullName }}-prod
spec:
rules:
- host: {{ .Values.ingress.prod_url }}
http:
paths:
- backend:
service:
name: {{ $fullName }}
port:
number: {{ $svcPort }}
path: /
pathType: ImplementationSpecific
{{- end }}
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ service:
prometheus.io/path: /api/metrics
prometheus.io/port: "3000"
ingress:
prod_enabled: {{ requiredEnv "PROD_ENABLED" }}
ssl_cert: service_canada_ca
prod_url: {{ requiredEnv "SUB_DOMAIN" }}.{{ requiredEnv "BASE_DOMAIN" }}
enabled: true
annotations:
{{ if (eq .Environment.Name "prototype")}}
Expand Down
86 changes: 61 additions & 25 deletions utils/api/benefitHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -636,19 +636,6 @@ export class BenefitHandler {
true
)

// adds partner calculation when InvSeparated = true
if (
partnerGis.entitlement?.result > 0 &&
(this.input.partner?.partnerBenefitStatus.value ===
PartnerBenefitStatus.OAS_GIS ||
this.input.partner?.partnerBenefitStatus.value ===
PartnerBenefitStatus.HELP_ME)
) {
partnerGis.cardDetail.collapsedText.push(
this.translations.detailWithHeading.partnerEligible
)
}

this.setValueForAllResults(allResults, 'client', 'gis', clientGis)
this.setValueForAllResults(allResults, 'partner', 'gis', partnerGis)
}
Expand Down Expand Up @@ -879,9 +866,7 @@ export class BenefitHandler {
} else {
allResults.partner.gis.eligibility = partnerGis.eligibility
allResults.partner.gis.entitlement = partnerGis.entitlement
allResults.partner.gis.cardDetail.collapsedText.push(
this.translations.detailWithHeading.partnerEligible
)

if (
allResults.partner.gis.entitlement.result > 0 &&
allResults.client.gis.entitlement.result <= 0
Expand All @@ -891,6 +876,63 @@ export class BenefitHandler {
.calculatedBasedOnIndividualIncome
)

// If client is eligible for ALW, need to recalculate estimate based on individual income
if (clientAlw.eligibility.result === 'eligible') {
if (
this.input.client.income.client >=
legalValues.alw.alwIncomeLimit
) {
const tempClientAlw = new AlwBenefit(
this.input.client,
this.translations,
false,
false
)
this.setValueForAllResults(
allResults,
'client',
'alw',
tempClientAlw
)

// overwrite eligibility and cardDetails for correct text in card
allResults.client.alw.eligibility = {
result: ResultKey.ELIGIBLE,
reason: ResultReason.NONE,
detail: this.translations.detail.alwEligibleIncomeTooHigh,
}
} else {
const tempClientAlw = new AlwBenefit(
this.input.client,
this.translations,
false,
true
)
this.setValueForAllResults(
allResults,
'client',
'alw',
tempClientAlw
)

// overwrite eligibility and cardDetails for correct text in card
allResults.client.alw.eligibility = {
result: ResultKey.ELIGIBLE,
reason: ResultReason.NONE,
detail: this.translations.detail.eligible,
}

// cardDetails
allResults.client.alw.eligibility.detail,
(allResults.client.alw.cardDetail.mainText = `${this.translations.detail.eligible} ${this.translations.detail.expectToReceive}`)

allResults.client.alw.cardDetail.collapsedText.push(
this.translations.detailWithHeading
.calculatedBasedOnIndividualIncome
)
}
}

if (
this.input.partner.invSeparated &&
allResults.partner.gis.entitlement.result > 0 &&
Expand All @@ -903,11 +945,6 @@ export class BenefitHandler {

allResults.client.alw.entitlement.result =
applicantAlwCalcSingle

allResults.client.alw.cardDetail.collapsedText.push(
this.translations.detailWithHeading
.calculatedBasedOnIndividualIncome
)
}
}
}
Expand Down Expand Up @@ -988,12 +1025,14 @@ export class BenefitHandler {
allResults.client.gis.entitlement.type = EntitlementResultType.FULL
}

// the push below prob can be moved to the else condition above but no time to test all scenarios
if (
(allResults.client.gis.eligibility.reason === ResultReason.NONE ||
allResults.client.gis.eligibility.reason ===
ResultReason.INCOME) &&
clientGis.entitlement.result > 0 &&
this.rawInput.partnerLegalStatus === LegalStatus.YES
(this.rawInput.partnerLegalStatus === LegalStatus.YES ||
this.rawInput.partnerLegalStatus === undefined)
) {
allResults.client.gis.cardDetail.collapsedText.push(
this.translations.detailWithHeading
Expand Down Expand Up @@ -1063,9 +1102,6 @@ export class BenefitHandler {
allResults.partner.gis.entitlement.result > 0 &&
initialPartnerBenefitStatus !== PartnerBenefitStatus.NONE
) {
allResults.partner.gis.cardDetail.collapsedText.push(
this.translations.detailWithHeading.partnerEligible
)
if (allResults.client.gis.entitlement.result <= 0) {
allResults.partner.gis.cardDetail.collapsedText.push(
this.translations.detailWithHeading
Expand Down
10 changes: 8 additions & 2 deletions utils/api/benefits/alwBenefit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,19 @@ import { EntitlementFormula } from './entitlementFormula'

export class AlwBenefit extends BaseBenefit<EntitlementResultGeneric> {
partner: Boolean
single: Boolean
relevantIncome: number
constructor(
input: ProcessedInput,
translations: Translations,
partner?: Boolean
partner?: Boolean,
single?: Boolean
) {
super(input, translations, BenefitKey.alw)
this.partner = partner
this.relevantIncome = single
? this.input.income.client
: this.input.income.relevant
}

protected getEligibility(): EligibilityResult {
Expand Down Expand Up @@ -243,7 +249,7 @@ export class AlwBenefit extends BaseBenefit<EntitlementResultGeneric> {
*/
protected formulaResult(): number {
const formulaResult = new EntitlementFormula(
this.input.income.relevant,
this.relevantIncome,
this.input.maritalStatus,
this.input.partnerBenefitStatus,
this.input.age
Expand Down
8 changes: 3 additions & 5 deletions utils/api/benefits/gisBenefit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -322,11 +322,9 @@ export class GisBenefit extends BaseBenefit<EntitlementResultGeneric> {
this.translations.detailWithHeading.partnerEligibleButAnsweredNo
)
} else {
if (!this.input.invSeparated) {
cardCollapsedText.push(
this.translations.detailWithHeading.partnerEligible
)
}
cardCollapsedText.push(
this.translations.detailWithHeading.partnerEligible
)
}
}
}
Expand Down

0 comments on commit 54e9fcd

Please sign in to comment.