本文整理汇总了TypeScript中utils/claimFeatureToggles.ClaimFeatureToggles类的典型用法代码示例。如果您正苦于以下问题:TypeScript ClaimFeatureToggles类的具体用法?TypeScript ClaimFeatureToggles怎么用?TypeScript ClaimFeatureToggles使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ClaimFeatureToggles类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: renderView
ErrorHandling.apply(async (req: express.Request, res: express.Response, next: express.NextFunction): Promise<void> => {
const form: Form<DefendantEvidence> = req.body
if (form.hasErrors()) {
renderView(form, res)
} else {
const claim: Claim = res.locals.claim
const draft: Draft<ResponseDraft> = res.locals.responseDraft
const user: User = res.locals.user
form.model.removeExcessRows()
if (ClaimFeatureToggles.isFeatureEnabledOnClaim(claim) && draft.document.isResponsePartiallyAdmitted()) {
draft.document.partialAdmission.evidence = form.model
await new DraftService().save(draft, user.bearerToken)
res.redirect(Paths.taskListPage.evaluateUri({ externalId: claim.externalId }))
} else {
draft.document.evidence = form.model
await new DraftService().save(draft, user.bearerToken)
if (draft.document.isResponseRejected()) {
res.redirect(Paths.taskListPage.evaluateUri({ externalId: claim.externalId }))
} else {
res.redirect(Paths.impactOfDisputePage.evaluateUri({ externalId: claim.externalId }))
}
}
}
})
示例2: buildBeforeYouStartSection
static buildBeforeYouStartSection (draft: ResponseDraft, claim: Claim, now: moment.Moment): TaskList {
const tasks: TaskListItem[] = []
const externalId: string = claim.externalId
if (!ClaimFeatureToggles.isFeatureEnabledOnClaim(claim)
&& (draft.isResponsePartiallyAdmitted() || draft.isResponseFullyAdmitted())) {
delete draft.response.type
}
tasks.push(
new TaskListItem(
'Confirm your details',
Paths.defendantYourDetailsPage.evaluateUri({ externalId: externalId }),
YourDetails.isCompleted(draft)
)
)
if (!isPastDeadline(now, claim.responseDeadline)) {
tasks.push(
new TaskListItem(
'Decide if you need more time to respond',
Paths.moreTimeRequestPage.evaluateUri({ externalId: externalId }),
MoreTimeNeededTask.isCompleted(draft, claim.moreTimeRequested)
)
)
}
return new TaskList('Before you start', tasks)
}
示例3: requestHandler
static requestHandler (req: express.Request, res: express.Response, next: express.NextFunction) {
const claim: Claim = res.locals.claim
if (!ClaimFeatureToggles.isFeatureEnabledOnClaim(claim, 'directionsQuestionnaire')) {
logger.warn('State guard: direction questionnaire feature not found - redirecting to dashboard')
res.redirect(DashboardPaths.dashboardPage.uri)
} else {
next()
}
}
示例4: renderView
function renderView (res: express.Response): void {
const user: User = res.locals.user
const claim: Claim = res.locals.claim
res.render(Paths.freeMediationPage.associatedView, {
otherParty: claim.otherPartyName(user),
defendant: user.id === claim.defendantId,
mediationPilot: ClaimFeatureToggles.isFeatureEnabledOnClaim(res.locals.claim, 'mediationPilot')
})
}
示例5: buildSubmitSection
static buildSubmitSection (claim: Claim, draft: ResponseDraft, externalId: string, features: string[]): TaskList {
const tasks: TaskListItem[] = []
if (!draft.isResponsePopulated()
|| draft.isResponseRejectedFullyWithDispute()
|| TaskListBuilder.isRejectedFullyBecausePaidClaimAmount(claim, draft)
|| (ClaimFeatureToggles.isFeatureEnabledOnClaim(claim) && TaskListBuilder.isRejectedFullyBecausePaidMoreThenClaimAmount(claim, draft))
|| (ClaimFeatureToggles.isFeatureEnabledOnClaim(claim) && TaskListBuilder.isRejectedFullyBecausePaidLessThanClaimAmountAndExplanationGiven(claim, draft))
|| draft.isResponseFullyAdmitted()
|| draft.isResponsePartiallyAdmitted()) {
tasks.push(
new TaskListItem(
'Check and submit your response',
Paths.checkAndSendPage.evaluateUri({ externalId: externalId }),
false
)
)
return new TaskList('Submit', tasks)
}
return undefined
}
示例6: async
async (req: express.Request, res: express.Response, next: express.NextFunction) => {
const draft: Draft<ResponseDraft> = res.locals.responseDraft
const claim: Claim = res.locals.claim
let timeline
if (ClaimFeatureToggles.isFeatureEnabledOnClaim(claim) && draft.document.isResponsePartiallyAdmitted()) {
timeline = draft.document.partialAdmission.timeline
} else {
timeline = draft.document.timeline
}
renderView(new Form(timeline), res)
})
示例7: isApplicableFor
static isApplicableFor (claim: Claim, draft: ResponseDraft): boolean {
if (!ClaimFeatureToggles.isFeatureEnabledOnClaim(claim)) {
return false
}
if (!draft) {
throw new Error('Response draft is required')
}
const fullAdmissionHasStatementOfMeans = draft.isResponseFullyAdmittedWithPayBySetDate() || draft.isResponseFullyAdmittedWithInstalments()
const parAdmissionHasStatementOfMeans = draft.isResponsePartiallyAdmittedWithPayBySetDate() || draft.isResponsePartiallyAdmittedWithInstalments()
return (
(draft.isResponseFullyAdmitted() && fullAdmissionHasStatementOfMeans)
|| (draft.isResponsePartiallyAdmitted() && parAdmissionHasStatementOfMeans)
)
&& !draft.defendantDetails.partyDetails.isBusiness()
}
示例8: renderView
function renderView (form: Form<StatementOfTruth>, res: express.Response): void {
const claim: Claim = res.locals.claim
const draft: Draft<ResponseDraft> = res.locals.responseDraft
const mediationDraft: Draft<MediationDraft> = res.locals.mediationDraft
res.render(Paths.checkAndSendPage.associatedView, {
claim: claim,
form: form,
draft: draft.document,
signatureType: signatureTypeFor(claim, draft),
statementOfMeansIsApplicable: StatementOfMeansFeature.isApplicableFor(claim, draft.document),
admissionsApplicable: ClaimFeatureToggles.isFeatureEnabledOnClaim(claim),
mediationEnabled: FeatureToggles.isEnabled('mediation'),
mediationDraft: mediationDraft.document
})
}
示例9: FreeMediation
ErrorHandling.apply(async (req: express.Request, res: express.Response) => {
const user: User = res.locals.user
const draft: Draft<MediationDraft> = res.locals.mediationDraft
draft.document.willYouTryMediation = new FreeMediation(
req.body.mediationYes ? FreeMediationOption.YES : FreeMediationOption.NO
)
await new DraftService().save(draft, user.bearerToken)
const { externalId } = req.params
if (ClaimFeatureToggles.isFeatureEnabledOnClaim(res.locals.claim, 'mediationPilot')) {
res.redirect(Paths.mediationAgreementPage.evaluateUri({ externalId }))
} else {
res.redirect(Paths.willYouTryMediation.evaluateUri({ externalId }))
}
}))
示例10: renderView
ErrorHandling.apply(async (req: express.Request, res: express.Response): Promise<void> => {
const form: Form<HowMuchHaveYouPaid> = req.body
if (form.hasErrors()) {
renderView(form, res)
} else {
const claim: Claim = res.locals.claim
const draft: Draft<ResponseDraft> = res.locals.responseDraft
const user: User = res.locals.user
draft.document.rejectAllOfClaim.howMuchHaveYouPaid = form.model
const { externalId } = req.params
const paidLessThanClaimed = form.model.amount < claim.totalAmountTillToday
const admissionsEnabled = ClaimFeatureToggles.isFeatureEnabledOnClaim(claim)
if (!paidLessThanClaimed) {
delete draft.document.rejectAllOfClaim.whyDoYouDisagree
delete draft.document.timeline
delete draft.document.evidence
delete draft.document.freeMediation
}
await new DraftService().save(draft, user.bearerToken)
if (paidLessThanClaimed) {
if (admissionsEnabled) {
res.redirect(FullRejectionPaths.youHavePaidLessPage.evaluateUri({ externalId: externalId }))
} else {
res.redirect(Paths.sendYourResponseByEmailPage.evaluateUri({ externalId: externalId }))
}
} else if (admissionsEnabled) {
res.redirect(Paths.taskListPage.evaluateUri({ externalId: externalId }))
} else {
res.redirect(Paths.sendYourResponseByEmailPage.evaluateUri({ externalId: externalId }))
}
}
}))