it('Accept court decision favouring claimant payment intent', () => { const draftClaimantResponse = createDraftClaimantResponseWithCourtDecisionType( payByInstallmentsIntent, DecisionType.CLAIMANT, FormaliseRepaymentPlanOption.REQUEST_COUNTY_COURT_JUDGEMENT, intentionOfPaymentByInstalments, intentionOfPaymentInFullBySetDate) expect(converter.convertToClaimantResponse(draftClaimantResponse, false)).to.deep.eq( { 'type': 'ACCEPTATION', 'amountPaid': 10, 'formaliseOption': 'CCJ', 'claimantPaymentIntention': { 'paymentOption': 'INSTALMENTS', 'repaymentPlan': { 'firstPaymentDate': new LocalDate(2018, 12, 31).toMoment(), 'instalmentAmount': 100, 'paymentSchedule': 'EVERY_MONTH', 'paymentLength': '', 'completionDate': new LocalDate(2019, 12, 30).toMoment() } }, 'courtDetermination': { courtDecision: intentionOfPaymentByInstalments, courtPaymentIntention: intentionOfPaymentInFullBySetDate, disposableIncome: 1000, decisionType: DecisionType.CLAIMANT } }) })
it('Reject court decision to pay by instalments and refer to judge', () => { const draftClaimantResponse = createDraftClaimantResponseWithCourtDecisionType( payImmediatelyIntent, DecisionType.COURT, FormaliseRepaymentPlanOption.REFER_TO_JUDGE, intentionOfPaymentByInstalments, intentionOfPaymentInFullBySetDate) draftClaimantResponse.rejectionReason = new RejectionReason('rejected reason') expect(converter.convertToClaimantResponse(draftClaimantResponse, false)).to.deep.eq( { 'type': 'ACCEPTATION', 'amountPaid': 10, 'claimantPaymentIntention': { 'paymentOption': 'IMMEDIATELY', 'paymentDate': MomentFactory.currentDate().add(5,'days') }, 'courtDetermination': { courtDecision: intentionOfPaymentByInstalments, courtPaymentIntention: intentionOfPaymentInFullBySetDate, rejectionReason: 'rejected reason', disposableIncome: 1000, decisionType: DecisionType.COURT }, 'formaliseOption': 'REFER_TO_JUDGE' }) })
it('rejection with mediation missing ', () => { expect(converter.convertToClaimantResponse(createDraftClaimantResponseForFullRejection(), false)).to.deep.eq({ 'type': 'REJECTION', 'amountPaid': 10, 'reason': 'Rejection reason is..', 'freeMediation': 'no' }) })
it('Accept defendant offer with settlement', () => { const draftClaimantResponse = createDraftClaimantResponseBaseForAcceptance(null,YesNoOption.YES) draftClaimantResponse.formaliseRepaymentPlan = new FormaliseRepaymentPlan(FormaliseRepaymentPlanOption.SIGN_SETTLEMENT_AGREEMENT) expect(converter.convertToClaimantResponse(draftClaimantResponse, false)).to.deep.eq({ 'type': 'ACCEPTATION', 'amountPaid': 10, 'formaliseOption': 'SETTLEMENT' }) })
it('Accept defendant offer with CCJ', () => { const draftClaimantResponse = createDraftClaimantResponseBaseForAcceptance(null,YesNoOption.YES) draftClaimantResponse.formaliseRepaymentPlan = new FormaliseRepaymentPlan(FormaliseRepaymentPlanOption.REQUEST_COUNTY_COURT_JUDGEMENT) expect(converter.convertToClaimantResponse(draftClaimantResponse, false)).to.deep.eq({ 'type': 'ACCEPTATION', 'amountPaid': 10, 'formaliseOption': 'CCJ' }) })
it('Should convert to rejection when given a no option in part payment received', () => { const draftClaimantResponse = new DraftClaimantResponse() draftClaimantResponse.partPaymentReceived = new PartPaymentReceived(YesNoOption.NO) expect(converter.convertToClaimantResponse(draftClaimantResponse, false)).to.deep.eq({ 'type': 'REJECTION', 'freeMediation': 'no', 'paymentReceived': 'no' }) })
it('rejection with mediation with reason', () => { const draftClaimantResponse = createDraftClaimantResponseForFullRejection() draftClaimantResponse.freeMediation = new FreeMediation('yes') draftClaimantResponse.courtDetermination.rejectionReason = new RejectionReason('rejected') expect(converter.convertToClaimantResponse(draftClaimantResponse, false)).to.deep.eq({ 'type': 'REJECTION', 'amountPaid': 10, 'freeMediation': 'yes', 'reason': 'rejected' }) })
it('rejection from non acceptance of states paid', () => { const draftClaimantResponse = new DraftClaimantResponse() draftClaimantResponse.accepted = new ClaimSettled(YesNoOption.NO) draftClaimantResponse.partPaymentReceived = new PartPaymentReceived(YesNoOption.YES) expect(converter.convertToClaimantResponse(draftClaimantResponse, false)).to.deep.eq({ 'type': 'REJECTION', 'freeMediation': 'no', 'paymentReceived': 'yes', 'settleForAmount': 'no' }) })
it('If defendant is a business and claimant rejects defendant payment plan for alternative means then refer to judge', () => { const draftClaimantResponse = createDraftClaimantResponseBaseForAcceptance(YesNoOption.YES, YesNoOption.YES) draftClaimantResponse.formaliseRepaymentPlan = new FormaliseRepaymentPlan(FormaliseRepaymentPlanOption.REFER_TO_JUDGE) draftClaimantResponse.alternatePaymentMethod = payImmediatelyIntent draftClaimantResponse.paidAmount = undefined expect(converter.convertToClaimantResponse(draftClaimantResponse, true)).to.deep.eq( { 'type': 'ACCEPTATION', 'claimantPaymentIntention': { 'paymentOption': 'IMMEDIATELY', 'paymentDate': MomentFactory.currentDate().add(5,'days') }, 'formaliseOption': 'REFER_TO_JUDGE' }) })
it('rejection with mediation with nil amount paid', () => { const draftClaimantResponse: DraftClaimantResponse = new DraftClaimantResponse() draftClaimantResponse.settleAdmitted = new SettleAdmitted(YesNoOption.NO) draftClaimantResponse.paidAmount = new PaidAmount(PaidAmountOption.NO,0,100) draftClaimantResponse.freeMediation = new FreeMediation('yes') draftClaimantResponse.courtDetermination = new CourtDetermination( intentionOfPaymentByInstalments, intentionOfPaymentInFullBySetDate, new RejectionReason('Rejection reason is..'), 1000, DecisionType.COURT) expect(converter.convertToClaimantResponse(draftClaimantResponse, false)).to.deep.eq({ 'type': 'REJECTION', 'amountPaid': 0, 'freeMediation': 'yes', 'reason': 'Rejection reason is..' }) })