Skip to content

Commit

Permalink
CIV-6955 pbav3 fix (#2378)
Browse files Browse the repository at this point in the history
Co-authored-by: miguelMolina3691 <[email protected]>
Co-authored-by: Kurt Plaschke <[email protected]>
Co-authored-by: skhajuria <[email protected]>
  • Loading branch information
4 people authored Mar 16, 2023
1 parent 5bfc29a commit 5456249
Show file tree
Hide file tree
Showing 11 changed files with 172 additions and 48 deletions.
16 changes: 9 additions & 7 deletions e2e/api/steps.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ const {removeFlagsFieldsFromFixture} = require('../helpers/caseFlagsFeatureHelpe

const data = {
INITIATE_GENERAL_APPLICATION: genAppClaimData.createGAData('Yes', null, '27500','FEE0442'),
CREATE_CLAIM: (mpScenario, claimAmount) => claimData.createClaim(mpScenario, claimAmount),
CREATE_CLAIM: (mpScenario, claimAmount, pbaV3) => claimData.createClaim(mpScenario, claimAmount, pbaV3),
CREATE_CLAIM_RESPONDENT_LIP: claimData.createClaimLitigantInPerson,
CREATE_CLAIM_RESPONDENT_LR_LIP: claimData.createClaimLRLIP,
CREATE_CLAIM_RESPONDENT_LIP_LIP: claimData.createClaimLIPLIP,
Expand Down Expand Up @@ -144,8 +144,8 @@ module.exports = {
caseId = null;
caseData = {};
mpScenario = multipartyScenario;

let createClaimData = data.CREATE_CLAIM(mpScenario, claimAmount);
const pbaV3 = await checkToggleEnabled(PBAv3);
let createClaimData = data.CREATE_CLAIM(mpScenario, claimAmount, pbaV3);
// Remove after court location toggle is removed
createClaimData = await replaceWithCourtNumberIfCourtLocationDynamicListIsNotEnabled(createClaimData);
createClaimData = await replaceLitigantFriendIfHNLFlagDisabled(createClaimData);
Expand All @@ -171,7 +171,7 @@ module.exports = {
null, 'Case data validation failed');
}

const pbaV3 = await checkToggleEnabled(PBAv3);


console.log('Is PBAv3 toggle on?: ' + pbaV3);

Expand Down Expand Up @@ -211,7 +211,7 @@ module.exports = {
mpScenario = multipartyScenario;
await apiRequest.setupTokens(user);
await apiRequest.startEvent(eventName);

const pbaV3 = await checkToggleEnabled(PBAv3);
let createClaimData;
switch (mpScenario){
case 'ONE_V_ONE':
Expand All @@ -224,6 +224,7 @@ module.exports = {
createClaimData = data.CREATE_CLAIM_RESPONDENT_LIP_LIP;
break;
}

// Remove after court location toggle is removed
createClaimData = await replaceWithCourtNumberIfCourtLocationDynamicListIsNotEnabled(createClaimData);
createClaimData = await replaceLitigantFriendIfHNLFlagDisabled(createClaimData);
Expand All @@ -234,7 +235,9 @@ module.exports = {
removeHNLFieldsFromUnspecClaimData(createClaimData);
}
//==============================================================

if (pbaV3) {
createClaimData.valid.ClaimValue.paymentTypePBA = 'PBAv3';
}
await validateEventPages(createClaimData);

let noCToggleEnabled = await checkNoCToggleEnabled();
Expand All @@ -249,7 +252,6 @@ module.exports = {
});

await waitForFinishedBusinessProcess(caseId);
const pbaV3 = await checkToggleEnabled(PBAv3);

console.log('Is PBAv3 toggle on?: ' + pbaV3);

Expand Down
8 changes: 4 additions & 4 deletions e2e/api/steps_LRspec.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ let caseId, eventName;
let caseData = {};

const data = {
CREATE_CLAIM: (scenario) => claimData.createClaim(scenario),
CREATE_CLAIM: (scenario, pbaV3) => claimData.createClaim(scenario, pbaV3),
DEFENDANT_RESPONSE: (response, camundaEvent) => require('../fixtures/events/defendantResponseSpec.js').respondToClaim(response, camundaEvent),
DEFENDANT_RESPONSE2: (response, camundaEvent) => require('../fixtures/events/defendantResponseSpec.js').respondToClaim2(response, camundaEvent),
DEFENDANT_RESPONSE_1v2: (response, camundaEvent) => require('../fixtures/events/defendantResponseSpec1v2.js').respondToClaim(response, camundaEvent),
Expand Down Expand Up @@ -133,14 +133,14 @@ module.exports = {
* @return {Promise<void>}
*/
createClaimWithRepresentedRespondent: async (user, scenario = 'ONE_V_ONE') => {

const pbaV3 = await checkToggleEnabled(PBAv3);
eventName = 'CREATE_CLAIM_SPEC';
caseId = null;
caseData = {};

let createClaimData = {};

createClaimData = data.CREATE_CLAIM(scenario);
createClaimData = data.CREATE_CLAIM(scenario, pbaV3);

// ToDo: Remove and delete function after hnl uplift released
const hnlEnabled = await checkToggleEnabled('hearing-and-listing-sdo');
Expand Down Expand Up @@ -171,7 +171,7 @@ module.exports = {
}

await waitForFinishedBusinessProcess(caseId);
const pbaV3 = await checkToggleEnabled(PBAv3);


console.log('Is PBAv3 toggle on?: ' + pbaV3);

Expand Down
7 changes: 4 additions & 3 deletions e2e/api/steps_LRspecFast.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,12 @@ const {assertCaseFlags} = require('../helpers/assertions/caseFlagsAssertions');
const {addAndAssertCaseFlag, getPartyFlags, getDefinedCaseFlagLocations, updateAndAssertCaseFlag} = require('./caseFlagsHelper');
const {CASE_FLAGS} = require('../fixtures/caseFlags');


let caseId, eventName;
let caseData = {};

const data = {
CREATE_CLAIM: (scenario) => claimData.createClaim(scenario),
CREATE_CLAIM: (scenario, pbaV3) => claimData.createClaim(scenario, pbaV3),
DEFENDANT_RESPONSE: (response, camundaEvent) => require('../fixtures/events/defendantResponseSpec.js').respondToClaim(response, camundaEvent),
DEFENDANT_RESPONSE_1v2: (response, camundaEvent) => require('../fixtures/events/defendantResponseSpec1v2Fast.js').respondToClaim(response, camundaEvent),
DEFENDANT_RESPONSE_2v1: (response, camundaEvent) => require('../fixtures/events/defendantResponseSpec2v1Fast.js').respondToClaim(response, camundaEvent),
Expand Down Expand Up @@ -116,7 +117,8 @@ module.exports = {

let createClaimData = {};

createClaimData = data.CREATE_CLAIM(scenario);
const pbaV3 = await checkToggleEnabled(PBAv3);
createClaimData = data.CREATE_CLAIM(scenario, pbaV3);

// ToDo: Remove and delete function after hnl uplift released
const hnlEnabled = await checkToggleEnabled('hearing-and-listing-sdo');
Expand All @@ -133,7 +135,6 @@ module.exports = {

await assertSubmittedEvent('PENDING_CASE_ISSUED');

const pbaV3 = await checkToggleEnabled(PBAv3);

await waitForFinishedBusinessProcess(caseId);
console.log('Is PBAv3 toggle on?: ' + pbaV3);
Expand Down
6 changes: 3 additions & 3 deletions e2e/api/steps_LRspecSmall.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ let caseId, eventName;
let caseData = {};

const data = {
CREATE_CLAIM: (scenario) => claimData.createClaim(scenario),
CREATE_CLAIM: (scenario, pbaV3) => claimData.createClaim(scenario, pbaV3),
DEFENDANT_RESPONSE: (response, camundaEvent) => require('../fixtures/events/defendantResponseSpecSmall.js').respondToClaim(response, camundaEvent),
DEFENDANT_RESPONSE_1v2: (response, camundaEvent) => require('../fixtures/events/defendantResponseSpec1v2.js').respondToClaim(response, camundaEvent),
CLAIMANT_RESPONSE: (mpScenario) => require('../fixtures/events/claimantResponseSpecSmall.js').claimantResponse(mpScenario),
Expand Down Expand Up @@ -69,9 +69,10 @@ module.exports = {
caseId = null;
caseData = {};

const pbaV3 = await checkToggleEnabled(PBAv3);
let createClaimData = {};

createClaimData = data.CREATE_CLAIM(scenario);
createClaimData = data.CREATE_CLAIM(scenario, pbaV3);

// ToDo: Remove and delete function after hnl uplift released
const hnlEnabled = await checkToggleEnabled('');
Expand All @@ -89,7 +90,6 @@ module.exports = {
await assertSubmittedEvent('PENDING_CASE_ISSUED');

await waitForFinishedBusinessProcess(caseId);
const pbaV3 = await checkToggleEnabled(PBAv3);

console.log('Is PBAv3 toggle on?: ' + pbaV3);

Expand Down
31 changes: 21 additions & 10 deletions e2e/fixtures/events/createClaim.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ let selectedPba = listElement('PBA0088192');
const validPba = listElement('PBA0088192');
const invalidPba = listElement('PBA0078095');

const createClaimData = (legalRepresentation, useValidPba, mpScenario, claimAmount = '30000') => {
const createClaimData = (pbaV3, legalRepresentation, useValidPba, mpScenario, claimAmount = '30000') => {
selectedPba = useValidPba ? validPba : invalidPba;
const claimData = {
References: {
Expand Down Expand Up @@ -200,7 +200,10 @@ const createClaimData = (legalRepresentation, useValidPba, mpScenario, claimAmou
claimValue: {
statementOfValueInPennies: JSON.stringify(claimAmount * 100)
},
claimFee: getClaimFee(claimAmount)
claimFee: getClaimFee(claimAmount),
...isPBAv3(pbaV3) ? {
paymentTypePBA: 'PBAv3'
} : {},
},
PbaNumber: {
applicantSolicitor1PbaAccounts: {
Expand All @@ -210,7 +213,7 @@ const createClaimData = (legalRepresentation, useValidPba, mpScenario, claimAmou
],
value: selectedPba

}
},
},
PaymentReference: {
claimIssuedPaymentDetails: {
Expand Down Expand Up @@ -344,8 +347,13 @@ const hasRespondent2 = (mpScenario) => {
|| mpScenario === 'ONE_V_TWO_LIPS';
};

const isPBAv3 = (pbaV3) => {
console.log( 'Pba value in create claim' + pbaV3);
return pbaV3;
};

module.exports = {
createClaim: (mpScenario = 'ONE_V_ONE', claimAmount) => {
createClaim: (mpScenario = 'ONE_V_ONE', claimAmount, pbaV3) => {
return {
midEventData: {
ClaimValue: {
Expand All @@ -363,7 +371,10 @@ module.exports = {
respondent1: respondent1WithPartyName,
...hasRespondent2(mpScenario) ? {
respondent2: respondent2WithPartyName
} : {}
} : {},
...isPBAv3(pbaV3) ? {
paymentTypePBA: 'PBAv3'
} : {},
},
ClaimantLitigationFriend: {
applicant1: applicant1WithPartyName,
Expand All @@ -378,7 +389,7 @@ module.exports = {
}
},
valid: {
...createClaimData('Yes', true, mpScenario, claimAmount),
...createClaimData(pbaV3,'Yes', true, mpScenario, claimAmount),
},
invalid: {
Upload: {
Expand Down Expand Up @@ -413,16 +424,16 @@ module.exports = {
},

createClaimLitigantInPerson: {
valid: createClaimData('No', true, 'ONE_V_ONE')
valid: createClaimData(false,'No', true, 'ONE_V_ONE')
},
createClaimLRLIP: {
valid: createClaimData('Yes', true, 'ONE_V_TWO_ONE_LEGAL_REP_ONE_LIP')
valid: createClaimData(false,'Yes', true, 'ONE_V_TWO_ONE_LEGAL_REP_ONE_LIP')
},
createClaimLIPLIP: {
valid: createClaimData('No', true, 'ONE_V_TWO_LIPS')
valid: createClaimData(false,'No', true, 'ONE_V_TWO_LIPS')
},
createClaimWithTerminatedPBAAccount: {
valid: createClaimData('Yes', false)
valid: createClaimData(false,'Yes', false)
},
createClaimRespondentSolFirmNotInMyHmcts: {
valid: {
Expand Down
31 changes: 25 additions & 6 deletions e2e/fixtures/events/createClaimSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,18 @@ const applicant1WithPartyName = {
partyTypeDisplayValue: 'Company',
};

const isPBAv3 = (pbaV3) => {
return pbaV3;
};

const solicitor1Email = '[email protected]';
const claimAmount = '150000';

const validPba = listElement('PBA0088192');
const invalidPba = listElement('PBA0078095');

module.exports = {
createClaim: (mpScenario) => {
createClaim: (mpScenario, pbaV3) => {
const userData = {
userInput: {
References: {
Expand Down Expand Up @@ -131,7 +135,10 @@ module.exports = {
InterestSummary: {
claimIssuedPaymentDetails: {
customerReference: 'Applicant reference'
}
},
...isPBAv3(pbaV3) ? {
paymentTypePBASpec: 'PBAv3'
} : {},
},
PbaNumber: {
applicantSolicitor1PbaAccounts: {
Expand Down Expand Up @@ -165,6 +172,9 @@ module.exports = {
InterestSummary: {
totalInterest: 0,
applicantSolicitor1PbaAccountsIsEmpty: 'No',
...isPBAv3(pbaV3) ? {
paymentTypePBASpec: 'PBAv3'
} : {},
}
},

Expand Down Expand Up @@ -192,7 +202,10 @@ module.exports = {
calculatedAmountInPence: 'string',
code: 'string',
version: 'string'
}
},
...isPBAv3 (pbaV3) ? {
paymentTypePBASpec: 'string'
} : {},
}
}
};
Expand Down Expand Up @@ -258,7 +271,10 @@ module.exports = {
InterestSummary: {
claimIssuedPaymentDetails: {
customerReference: 'Applicant reference'
}
},
...isPBAv3(pbaV3) ? {
paymentTypePBASpec: 'PBAv3'
} : {},
},
};

Expand Down Expand Up @@ -375,7 +391,7 @@ module.exports = {
return userData;
},

createClaimDataByPage: (mpScenario) => {
createClaimDataByPage: (mpScenario, pbaV3) => {
let userData = {
References: {
userInput: {
Expand Down Expand Up @@ -527,11 +543,14 @@ module.exports = {
userInput: {
claimIssuedPaymentDetails: {
customerReference: 'Applicant reference'
}
},
},
expected: {
totalInterest: 0,
applicantSolicitor1PbaAccountsIsEmpty: 'No',
...isPBAv3(pbaV3) ? {
paymentTypePBASpec: 'PBAv3'
} : {},
},
generated: {
applicantSolicitor1PbaAccounts: {
Expand Down
Loading

0 comments on commit 5456249

Please sign in to comment.