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


TypeScript PaymentPlan.create方法代码示例

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


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

示例1: createPaymentPlanFromInstallment

  private static createPaymentPlanFromInstallment (totalAmount: number, instalmentAmount: number, frequency: Frequency, firstPaymentDate: Moment): PaymentPlan {
    if (!totalAmount || !instalmentAmount || !frequency) {
      return undefined
    }

    return PaymentPlan.create(totalAmount, instalmentAmount, frequency, firstPaymentDate)
  }
开发者ID:hmcts,项目名称:cmc-citizen-frontend,代码行数:7,代码来源:paymentPlanHelper.ts

示例2: validate

  .get(AppPaths.paymentPlanCalculation.uri, (req, res) => {

    const totalAmount: string = req.query['total-amount']
    const instalmentAmount: string = req.query['instalment-amount']
    const frequencyInWeeks: string = req.query['frequency-in-weeks']

    const error: string = validate(totalAmount, instalmentAmount, frequencyInWeeks)

    if (error) {
      return res.status(HttpStatus.UNPROCESSABLE_ENTITY).json({
        error: {
          status: HttpStatus.UNPROCESSABLE_ENTITY,
          message: error
        }
      })
    }

    const frequency: Frequency = Frequency.ofWeekly(Number(frequencyInWeeks))
    const paymentPlan: PaymentPlan = PaymentPlan.create(Number(totalAmount), Number(instalmentAmount), frequency)

    return res.status(HttpStatus.OK).json({
      paymentPlan: {
        paymentLength: paymentPlan.calculatePaymentLength(),
        lastPaymentDate: paymentPlan.calculateLastPaymentDate().toJSON()
      }
    })
  })
开发者ID:hmcts,项目名称:cmc-citizen-frontend,代码行数:27,代码来源:payment-plan-calculation.ts

示例3: it

    it('should return the payment plan converted to monthly frequency', () => {
      const instalmentAmount = 100

      const paymentPlan = PaymentPlan.create(TOTAL_AMOUNT, instalmentAmount, Frequency.WEEKLY)
      const convertedPaymentPlan = paymentPlan.convertTo(Frequency.MONTHLY)

      expect(convertedPaymentPlan.instalmentAmount).to.equal(433.3333333333333)
      expect(convertedPaymentPlan.frequency).to.equal(Frequency.MONTHLY)
    })
开发者ID:hmcts,项目名称:cmc-citizen-frontend,代码行数:9,代码来源:paymentPlan.ts

示例4: it

 it('should return correct paymentPlan from defendants financial statement ', () => {
   expect(PaymentPlanHelper.createPaymentPlanFromDefendantFinancialStatement(claim, draft)).to.deep
     .equal(PaymentPlan.create(200, 200, Frequency.WEEKLY, calculateMonthIncrement(MomentFactory.currentDate())))
 })
开发者ID:hmcts,项目名称:cmc-citizen-frontend,代码行数:4,代码来源:paymentPlanHelper.ts

示例5: expect

 starting from ${test.fromDate.format('YYYY-MM-DD')}`, () => {
     const paymentPlan = PaymentPlan.create(test.claimAmount, test.instalmentAmount,
       Frequency.of(frequency), test.fromDate)
     expect(paymentPlan.calculateLastPaymentDate().format('YYYY-MM-DD'))
       .to.equal(MomentFactory.parse(test.expected[frequency]).format('YYYY-MM-DD'))
   })
开发者ID:hmcts,项目名称:cmc-citizen-frontend,代码行数:6,代码来源:paymentPlan.ts

示例6: createPaymentPlanFromStartDate

 private static createPaymentPlanFromStartDate (firstPaymentDate: Moment): PaymentPlan {
   return PaymentPlan.create(0, 0, Frequency.WEEKLY, firstPaymentDate)
 }
开发者ID:hmcts,项目名称:cmc-citizen-frontend,代码行数:3,代码来源:paymentPlanHelper.ts


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