本文整理汇总了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)
}
示例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()
}
})
})
示例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)
})
示例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())))
})
示例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'))
})
示例6: createPaymentPlanFromStartDate
private static createPaymentPlanFromStartDate (firstPaymentDate: Moment): PaymentPlan {
return PaymentPlan.create(0, 0, Frequency.WEEKLY, firstPaymentDate)
}