当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript MomentFactory.maxDate方法代码示例

本文整理汇总了TypeScript中shared/momentFactory.MomentFactory.maxDate方法的典型用法代码示例。如果您正苦于以下问题:TypeScript MomentFactory.maxDate方法的具体用法?TypeScript MomentFactory.maxDate怎么用?TypeScript MomentFactory.maxDate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在shared/momentFactory.MomentFactory的用法示例。


在下文中一共展示了MomentFactory.maxDate方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: createPaymentPlanFromClaimAdmission

  private static createPaymentPlanFromClaimAdmission (response: FullAdmissionResponse | PartialAdmissionResponse,
                                                      totalAmount: number,
                                                      draft: DraftClaimantResponse): PaymentPlan {
    const paymentIntention: PI = response.paymentIntention
    if (!paymentIntention) {
      return undefined
    }

    if (paymentIntention.repaymentPlan) {
      return PaymentPlanHelper.createPaymentPlanFromInstallment(
        totalAmount,
        paymentIntention.repaymentPlan.instalmentAmount,
        Frequency.of(paymentIntention.repaymentPlan.paymentSchedule),
        paymentIntention.repaymentPlan.firstPaymentDate
      )
    }

    if (draft.courtDetermination.disposableIncome <= 0) {
      return PaymentPlanHelper.createPaymentPlanFromStartDate(MomentFactory.maxDate())
    }

    if (paymentIntention.paymentOption === PaymentOption.BY_SPECIFIED_DATE) {
      const instalmentAmount: number = draft.courtDetermination.disposableIncome / Frequency.WEEKLY.monthlyRatio
      return PaymentPlanHelper.createPaymentPlanFromInstallment(totalAmount, instalmentAmount, Frequency.WEEKLY, calculateMonthIncrement(MomentFactory.currentDate()))
    }
  }
开发者ID:hmcts,项目名称:cmc-citizen-frontend,代码行数:26,代码来源:paymentPlanHelper.ts

示例2: generateCourtCalculatedPaymentIntention

  static generateCourtCalculatedPaymentIntention (draft: DraftClaimantResponse, claim: Claim) {
    const courtCalculatedPaymentIntention = new PaymentIntention()
    const paymentPlanFromDefendantFinancialStatement: PaymentPlan = PaymentPlanHelper.createPaymentPlanFromDefendantFinancialStatement(claim, draft)
    if (!paymentPlanFromDefendantFinancialStatement) {
      return undefined
    }

    if (paymentPlanFromDefendantFinancialStatement.startDate.isSame(MomentFactory.maxDate())) {
      courtCalculatedPaymentIntention.paymentOption = PaymentOption.BY_SPECIFIED_DATE
      courtCalculatedPaymentIntention.paymentDate = MomentFactory.maxDate()
    } else {
      courtCalculatedPaymentIntention.paymentOption = PaymentOption.INSTALMENTS
      courtCalculatedPaymentIntention.repaymentPlan = {
        firstPaymentDate: paymentPlanFromDefendantFinancialStatement.startDate,
        instalmentAmount: _.round(paymentPlanFromDefendantFinancialStatement.instalmentAmount,2),
        paymentSchedule: Frequency.toPaymentSchedule(paymentPlanFromDefendantFinancialStatement.frequency),
        completionDate: paymentPlanFromDefendantFinancialStatement.calculateLastPaymentDate(),
        paymentLength: paymentPlanFromDefendantFinancialStatement.calculatePaymentLength()
      }
    }
    return courtCalculatedPaymentIntention
  }
开发者ID:hmcts,项目名称:cmc-citizen-frontend,代码行数:22,代码来源:payment-plan.ts

示例3: createPaymentPlanFromDefendantFinancialStatement

  static createPaymentPlanFromDefendantFinancialStatement (claim: Claim, draft: DraftClaimantResponse): PaymentPlan {
    const response = claim.response as FullAdmissionResponse | PartialAdmissionResponse
    const frequency: Frequency = response.paymentIntention.paymentOption === PaymentOption.INSTALMENTS ?
      Frequency.of(response.paymentIntention.repaymentPlan.paymentSchedule) : Frequency.WEEKLY

    if (claim.claimData.defendant.isBusiness()) {
      return undefined
    }

    if (response === undefined) {
      throw new Error('Claim does not have response attached')
    }
    if (response.statementOfMeans === undefined) {
      throw new Error(`Claim response does not have financial statement attached`)
    }

    const instalmentAmount: number = Math.min(draft.courtDetermination.disposableIncome / frequency.monthlyRatio, claim.totalAmountTillToday)
    if (instalmentAmount < 1) {
      return PaymentPlanHelper.createPaymentPlanFromStartDate(MomentFactory.maxDate())
    }

    return PaymentPlanHelper.createPaymentPlanFromInstallment(AdmissionHelper.getAdmittedAmount(claim), instalmentAmount, frequency, calculateMonthIncrement(MomentFactory.currentDate()))
  }
开发者ID:hmcts,项目名称:cmc-citizen-frontend,代码行数:23,代码来源:paymentPlanHelper.ts

示例4: it

 it('just over the threshold', () => {
   draft.courtDetermination.disposableIncome = parseFloat(Frequency.WEEKLY.monthlyRatio.toFixed(2)) + 0.01
   const paymentPlan = PaymentPlanHelper.createPaymentPlanFromDefendantFinancialStatement(claim, draft)
   expect(paymentPlan.startDate.toISOString()).not.to.equal(MomentFactory.maxDate().toISOString())
 })
开发者ID:hmcts,项目名称:cmc-citizen-frontend,代码行数:5,代码来源:paymentPlanHelper.ts

示例5:

      firstPaymentDate: MomentFactory.currentDate().add(80, 'days').toISOString(),
      paymentSchedule: PaymentSchedule.EACH_WEEK,
      completionDate: MomentFactory.currentDate().add(100, 'days').toISOString(),
      paymentLength: '1'
    }
  }
}

export const fullAdmissionWithPaymentByInstalmentsDataWithUnReasonablePaymentSchedule = {
  ...baseResponseData,
  ...baseFullAdmissionData,
  paymentIntention: {
    paymentOption: PaymentOption.INSTALMENTS,
    repaymentPlan: {
      instalmentAmount: 100,
      firstPaymentDate: MomentFactory.maxDate().toISOString(),
      paymentSchedule: PaymentSchedule.EACH_WEEK,
      completionDate: MomentFactory.maxDate().toISOString(),
      paymentLength: '1'
    }
  }
}

export const partialAdmissionWithPaymentByInstalmentsData = {
  ...baseResponseData,
  ...basePartialAdmissionData,
  ...basePartialEvidencesAndTimeLines,
  defence: 'i have paid more than enough',
  ...basePayByInstalmentsData,
  amount: 3000
}
开发者ID:hmcts,项目名称:cmc-citizen-frontend,代码行数:31,代码来源:responseData.ts

示例6: it

 it('should return a claimant in favour of defendant decision type when claimant offers better date and court calculated is max date', () => {
   let claimantPaymentDate = moment(new Date()).add(3, 'days')
   let defendantPaymentDate = moment(new Date()).add(1, 'days')
   expect(CourtDecision.calculateDecision(defendantPaymentDate, claimantPaymentDate, MomentFactory.maxDate())).to.equal(DecisionType.CLAIMANT_IN_FAVOUR_OF_DEFENDANT)
 })
开发者ID:hmcts,项目名称:cmc-citizen-frontend,代码行数:5,代码来源:courtDecision.ts


注:本文中的shared/momentFactory.MomentFactory.maxDate方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。