Add logic for Afterpay flow when order amount is low

This commit is contained in:
JennyNou 2026-03-12 10:13:22 -04:00
parent 8cca6f5afc
commit b1bea6a0e8

View file

@ -1,6 +1,7 @@
import { Locator, Page } from "@playwright/test"; import { Locator, Page } from "@playwright/test";
import { BasePage } from "./BasePage"; import { BasePage } from "./BasePage";
import { IPaymentDetails } from "@business-logic/types/CustomerDetails"; import { IClaimDetails, IPaymentDetails } from "@business-logic/types/CustomerDetails";
import { ServicePackage } from "@business-logic/types/Enums";
export class AfterpayPage extends BasePage { export class AfterpayPage extends BasePage {
readonly page: Page; readonly page: Page;
@ -33,9 +34,12 @@ export class AfterpayPage extends BasePage {
await this.submitButton.click(); await this.submitButton.click();
} }
async executeAfterpayPayment(paymentDetails: IPaymentDetails) { async executeAfterpayPayment(paymentDetails: IPaymentDetails, claimDetails: IClaimDetails, servicePackage: ServicePackage) {
await this.login(paymentDetails.password!); await this.login(paymentDetails.password!);
if (claimDetails.policyDeductible === 50 && servicePackage === ServicePackage.GlassOnly) {
await this.confirmButton.click();
} else {
// For orders greater than $50, user will have 2 options to choose from: monthly with interest or biweekly without interest // For orders greater than $50, user will have 2 options to choose from: monthly with interest or biweekly without interest
await this.selectAfterpayWithoutInterestButton.waitFor({ state: 'visible' }); await this.selectAfterpayWithoutInterestButton.waitFor({ state: 'visible' });
@ -46,9 +50,7 @@ export class AfterpayPage extends BasePage {
await this.selectAfterpayWithInterestButton.click(); await this.selectAfterpayWithInterestButton.click();
await this.continueAfterpayButton.click(); await this.continueAfterpayButton.click();
} }
await this.confirmButton.click(); await this.confirmButton.click();
}
} }
} }