Skip to content

Commit

Permalink
Merge pull request #873 from hmcts/PAY-6926
Browse files Browse the repository at this point in the history
PAY-6926: Calculate the AMOUNT DUE and OVERPAYMENTS for Upfront and R…
  • Loading branch information
Thor-tech-of-metal authored May 21, 2024
2 parents 5360b98 + 692ffe3 commit 23458a4
Show file tree
Hide file tree
Showing 12 changed files with 512 additions and 160 deletions.
1 change: 0 additions & 1 deletion acceptance-tests/test/end-to-end/pages/add_fees.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ module.exports = {
if (jurisdiction2 === 'family_court'){
I.see('Family Court');
}
I.see('Family Court');
I.click('Select');
I.wait(CCPBConstants.fiveSecondWaitTime);
let numOfElements = await I.grabNumberOfVisibleElements('//input[@id=\'fee-version0\']');
Expand Down
39 changes: 25 additions & 14 deletions acceptance-tests/test/end-to-end/pages/case_transactions.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,9 @@ module.exports = {
this.validateTransactionPageForSuccessPayment(caseNumber);
I.see(caseTitle);
},
checkBulkCaseSuccessPaymentNotPaid(caseNumber, caseTitle) {
checkBulkCaseSuccessPaymentPartiallyPaid(caseNumber, caseTitle, allocationStatus) {
I.wait(CCPBConstants.fiveSecondWaitTime);
this.validateTransactionPageForSuccessPaymentNotPaid(caseNumber);
this.validateTransactionPageForSuccessPaymentPartiallyPaid(caseNumber, allocationStatus);
I.see(caseTitle);
},
checkBulkCaseNonPaidPayment(caseNumber, caseTitle, allocationStatus) {
Expand All @@ -138,10 +138,10 @@ module.exports = {
I.see(caseTitle);
// I.see(amoundDue);
},
checkBulkCaseSurplusOrShortfallSuccessPaymentNotPaid(caseNumber, caseTitle,
allocationStatus, amoundDue) {
checkBulkCaseShortfallSuccessPaymentPartiallyPaid(caseNumber, caseTitle,
allocationStatus, amoundDue) {
I.wait(CCPBConstants.fiveSecondWaitTime);
this.validateTransactionPageForSuccessPaymentNotPaid(caseNumber, allocationStatus);
this.validateTransactionPageForSuccessPaymentPartiallyPaid(caseNumber, allocationStatus);
I.see(caseTitle);
I.see(amoundDue);
},
Expand Down Expand Up @@ -369,7 +369,7 @@ module.exports = {
I.see('Paid');
I.see('Success');
},
validateTransactionPageForSuccessPaymentNotPaid(caseNumber) {
validateTransactionPageForSuccessPaymentPartiallyPaid(caseNumber, allocationStatus) {
I.see(caseNumber);
I.see('Total payments');
I.see('Total remissions');
Expand All @@ -388,8 +388,7 @@ module.exports = {
// I.see('Calculated amount');
// I.see('Amount due');
// I.see('Action');
// I.see(allocationStatus);
I.see('Partially paid');
I.see(allocationStatus);
I.see('Success');
},
validateTransactionPageForOverPayments() {
Expand All @@ -400,16 +399,14 @@ module.exports = {
I.wait(CCPBConstants.fiveSecondWaitTime);
I.click(this.locators.allocate_new_service_request);
},
validateTransactionPageForOverPaymentsRemissionsRefunds(refunds,refundRefRemissions,refundRefOverPayments) {
validateTransactionPageForRefunds(refunds,refundRefOverPayments) {
I.see(refunds);
I.see(refundRefRemissions);
I.see(refundRefOverPayments);
I.see('Refunds');
I.see('Approved');
I.see(300.00');
I.see(100.00');
I.see(280.00');
I.see(220.00');
I.see('Overpayment');
I.see('Retrospective remission');
I.see('System/technical error');
},
validateTransactionPageForPartialPayments() {
Expand Down Expand Up @@ -444,13 +441,27 @@ module.exports = {
I.see('Not paid');
I.see('Success');
},
validateTransactionPageForRemission(remissionCode, feeCode, remissionAmount) {
validatePaymentDetailsPageForRemission(remissionCode, feeCode, remissionAmount) {
I.click(this.locators.view_details_for_status_paid);
I.see(remissionCode);
I.see(feeCode);
I.see(remissionAmount);
},

async validateCaseTransactionsDetails(totalPayments, unallocatedPayments, totalRemissions, amountDue, overPayment) {
I.see('Total payments');
// let actualTotalPayments = await I.grabTextFrom('//*[@id="content"]/div/app-payment-history/ccpay-payment-lib/ccpay-case-transactions/div/main/div/div[1]/div/table/tbody/tr/td[1]');
I.seeTextEquals(totalPayments, '//*[@id="content"]/div/app-payment-history/ccpay-payment-lib/ccpay-case-transactions/div/main/div/div[1]/div/table/tbody/tr/td[1]');
I.see('Unallocated payments');
I.seeTextEquals(unallocatedPayments, '//*[@id="content"]/div/app-payment-history/ccpay-payment-lib/ccpay-case-transactions/div/main/div/div[1]/div/table/tbody/tr/td[2]');
I.see('Total remissions');
I.seeTextEquals(totalRemissions, '//*[@id="content"]/div/app-payment-history/ccpay-payment-lib/ccpay-case-transactions/div/main/div/div[1]/div/table/tbody/tr/td[3]');
I.see('Amount due');
I.seeTextEquals(amountDue, '//*[@id="content"]/div/app-payment-history/ccpay-payment-lib/ccpay-case-transactions/div/main/div/div[1]/div/table/tbody/tr/td[4]');
I.see('Over payment');
I.seeTextEquals(overPayment, '//*[@id="content"]/div/app-payment-history/ccpay-payment-lib/ccpay-case-transactions/div/main/div/div[1]/div/table/tbody/tr/td[5]');
},

async getReceiptReference() {
I.click(this.locators.view_details_for_status_paid);
I.wait(CCPBConstants.fiveSecondWaitTime);
Expand Down
6 changes: 3 additions & 3 deletions acceptance-tests/test/end-to-end/pages/confirm_association.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ module.exports = {

},

verifyConfirmAssociationFullPayment(feeCode, volume, totalAmount, amount) {
verifyConfirmAssociationFullPayment(feeCode, volume, amountToBeAllocated, FeeAmount) {
I.see('Confirm allocation');
I.waitForText('Amount to be allocated: '.concat(totalAmount), CCPBConstants.tenSecondWaitTime);
I.waitForText('Amount to be allocated: '.concat(amountToBeAllocated), CCPBConstants.tenSecondWaitTime);
I.see('Code');
I.see('Description');
I.see('Volume');
Expand All @@ -35,7 +35,7 @@ module.exports = {
I.see(feeCode);
I.see(PaybubbleStaticData.fee_description[feeCode]);
I.see(volume);
I.see(amount);
I.see(FeeAmount);
I.see('Amount left to be allocated £0.00');
I.see('Confirm');
},
Expand Down
10 changes: 7 additions & 3 deletions acceptance-tests/test/end-to-end/pages/initiate_refunds.js
Original file line number Diff line number Diff line change
Expand Up @@ -484,11 +484,14 @@ module.exports = {
I.click('Return to case');
},

verifyRemissionSubmittedPage() {
verifyRemissionSubmittedPage(isContinueButtonEnabled = true) {
I.see('Remission added');
I.see('The amount to be refunded should be £100.00');
I.click('Continue');

if (isContinueButtonEnabled) {
I.click('Continue');
} else {
I.dontSeeElement('Continue')
}
},

async verifyRefundSubmittedPage(refundAmount) {
Expand Down Expand Up @@ -694,6 +697,7 @@ module.exports = {
},

verifyApproverReviewRefundsDetailsPage(refundsData, previewNotificationFlag = false, refundNotificationPreviewData = null) {
I.waitForText(refundsData.refundNotificationType, 10);
I.see('Review refund details');
I.see('Payment to be refunded');
I.see(refundsData.refundReference);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
module.exports = {
fee_description: {
FEE0002: 'Filing an application for a divorce, nullity or civil partnership dissolution',
FEE0362: 'Appeal (deduction from earnings order)'
FEE0362: 'Appeal (deduction from earnings order)',
FEE0219: 'Application for a grant of probate (Estate over 5000 GBP)',
FEE0475: 'Where the party filing the request is legally aided'
}
};
2 changes: 1 addition & 1 deletion acceptance-tests/test/end-to-end/pages/refunds_list.js
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@ module.exports = {
I.see('Notes');
I.see('Refund initiated and sent to team leader');
I.see('Sent to middle office');
I.see('Approved by middle office');
I.see('Sent to Middle Office for Processing');
I.see('Unable to apply refund to Card');
I.see('Refund approved by system');

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ module.exports = {
CCDCaseNumber: 16,
minTimeout: 1000,
maxTimeout: 3000,
defaultNumberOfRetries: 2,
defaultNumberOfRetries: 0,
oneMinute: 60
};
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ const miscUtils = require('../helpers/misc');
const stringUtils = require('../helpers/string_utils');

const testConfig = require('./config/CCPBConfig');
const apiUtils = require("../helpers/utils");

// const successResponse = 202;

Expand Down Expand Up @@ -141,9 +142,9 @@ Scenario('Normal ccd case cheque payment partial allocation 2 fees added with a
ConfirmAssociation.selectShortfallReasonExplainatoryAndUser('Help with Fees', 'Contact applicant');
ConfirmAssociation.confirmPayment();
I.wait(CCPBATConstants.tenSecondWaitTime);
CaseTransaction.checkBulkCaseSuccessPaymentNotPaid(ccdCaseNumberFormatted, 'Case reference', 'Allocated');
CaseTransaction.checkBulkCaseSuccessPaymentPartiallyPaid(ccdCaseNumberFormatted, 'Case reference', 'Partially paid');
CaseTransaction.checkIfBulkScanPaymentsAllocated(dcnNumber);
CaseTransaction.validateTransactionPageForRemission('HWF-A1B-23C', 'FEE0002', '£100.00');
CaseTransaction.validatePaymentDetailsPageForRemission('HWF-A1B-23C', 'FEE0002', '£100.00');
I.Logout();
}).tag('@pipeline @nightly');

Expand Down Expand Up @@ -334,15 +335,15 @@ Scenario('Ccd case search with exception record postal order payment shortfall p
ConfirmAssociation.selectShortfallReasonExplainatoryAndUser('Help with Fees', 'Contact applicant');
ConfirmAssociation.confirmPayment();
I.wait(CCPBATConstants.fiveSecondWaitTime);
CaseTransaction.checkBulkCaseSurplusOrShortfallSuccessPaymentNotPaid(ccdCaseNumberFormatted, 'Case reference', 'Allocated', '£100.00');
CaseTransaction.checkBulkCaseShortfallSuccessPaymentPartiallyPaid(ccdCaseNumberFormatted, 'Case reference', 'Partially paid', '£100.00');
CaseTransaction.checkIfBulkScanPaymentsAllocated(dcnNumber);
// Search using receipt number
const receiptSearch = await CaseTransaction.getReceiptReference();
CaseSearch.navigateToCaseTransaction();
logger.info(`The value of the Payment Reference : ${receiptSearch}`);
I.wait(CCPBATConstants.tenSecondWaitTime);
await miscUtils.multipleSearchForRefunds(CaseSearch, CaseTransaction, I, receiptSearch);
CaseTransaction.checkBulkCaseSuccessPaymentNotPaid(ccdCaseNumberFormatted, 'Case reference', 'Allocated');
CaseTransaction.checkBulkCaseSuccessPaymentPartiallyPaid(ccdCaseNumberFormatted, 'Case reference', 'Partially paid');
PaymentHistory.navigateToPaymentHistory();
I.wait(CCPBATConstants.fiveSecondWaitTime);
await miscUtils.multipleSearchForRefunds(CaseSearch, CaseTransaction, I, receiptSearch);
Expand Down Expand Up @@ -378,6 +379,48 @@ Scenario('Exception search with ccd record postal order payment surplus payment'
I.Logout();
}).tag('@pipeline @nightly');

Scenario('Fully Paid Fee with Upfront Remission CANNOT be Refunded', async({ I, CaseSearch, CaseTransaction, AddFees, FeesSummary, ConfirmAssociation, Remission }) => {
I.login(testConfig.TestProbateCaseWorkerUserName, testConfig.TestProbateCaseWorkerPassword);
const totalAmount = 173;
const ccdAndDcn = await bulkScanApiCalls.bulkScanNormalCcd('AA08', totalAmount, 'cheque');
const ccdCaseNumber = ccdAndDcn[1];
const dcnNumber = ccdAndDcn[0];
logger.info(`The value of the ccdCaseNumber from the test: ${ccdCaseNumber}`);
logger.info(`The value of the dcnNumber : ${dcnNumber}`);
const ccdCaseNumberFormatted = stringUtils.getCcdCaseInFormat(ccdCaseNumber);
await miscUtils.multipleSearch(CaseSearch, I, ccdCaseNumber);
I.wait(CCPBATConstants.fiveSecondWaitTime);
CaseTransaction.checkBulkCase(ccdCaseNumberFormatted, 'Case reference');
CaseTransaction.checkUnallocatedPayments('1', dcnNumber, '£173.00', 'cheque');
CaseTransaction.allocateToNewFee();
await AddFees.addFeesAmount('273.00', 'family', 'probate_registry');
FeesSummary.verifyFeeSummaryBulkScan(ccdCaseNumberFormatted, 'FEE0219', '273.00', false);
I.wait(CCPBATConstants.fiveSecondWaitTime);
FeesSummary.deductRemission();
I.wait(CCPBATConstants.fiveSecondWaitTime);
Remission.processRemission('FEE0219', '173');
Remission.confirmProcessRemission();
I.wait(CCPBATConstants.tenSecondWaitTime);
FeesSummary.verifyFeeSummaryAfterRemission('FEE0219', '£273.00', '£100.00', '£173.00');
FeesSummary.allocateBulkPayment();
ConfirmAssociation.verifyConfirmAssociationFullPayment('FEE0219', '1', '£173.00', '£273.00');
ConfirmAssociation.confirmPayment();
I.wait(CCPBATConstants.tenSecondWaitTime);
CaseTransaction.checkBulkCaseSuccessPayment(ccdCaseNumberFormatted, 'Case reference');
CaseTransaction.checkIfBulkScanPaymentsAllocated(dcnNumber);
await CaseTransaction.validateCaseTransactionsDetails('£173.00', '0', '£100.00', '£0.00', '£0.00');
CaseTransaction.validatePaymentDetailsPageForRemission('HWF-A1B-23C', 'FEE0219', '£100.00');
await apiUtils.rollbackPaymentDateByCCDCaseNumber(ccdCaseNumber);
I.click('Back');
I.wait(CCPBATConstants.fiveSecondWaitTime);
await I.click('(//*[text()[contains(.,"Review")]])[2]');
I.wait(CCPBATConstants.tenSecondWaitTime);
I.dontSeeElement('Issue refund');
I.dontSeeElement('Add remission');
I.dontSeeElement('Add refund');
I.Logout();
}).tag('@pipeline @nightly');

Scenario('Download reports in paybubble', ({ I, Reports }) => {
logger.info('Here is the Logger');
I.login(testConfig.TestProbateCaseWorkerUserName, testConfig.TestProbateCaseWorkerPassword);
Expand Down
Loading

0 comments on commit 23458a4

Please sign in to comment.