Feat(booking-job): Loop detect payment merchant
All checks were successful
ktm-booking-bot/ktm-booking-bot/pipeline/head This commit looks good

This commit is contained in:
2022-10-28 00:51:00 +08:00
parent a6b2ffa1e8
commit 8be27ce214

View File

@@ -322,6 +322,9 @@ func chooseAndMakePayment(timerCtx context.Context, creditCardType, creditCard,
log.Println("Waiting for payment gateway to load.") log.Println("Waiting for payment gateway to load.")
time.Sleep(time.Second * 5) time.Sleep(time.Second * 5)
foundPage := false
for !foundPage {
for _, currPage := range browser.MustPages() { for _, currPage := range browser.MustPages() {
currPage.MustWaitLoad() currPage.MustWaitLoad()
@@ -334,6 +337,8 @@ func chooseAndMakePayment(timerCtx context.Context, creditCardType, creditCard,
} }
if strings.Contains(currTitle, "Payment Acceptance") { if strings.Contains(currTitle, "Payment Acceptance") {
log.Println("Page found.")
foundPage = true
page = currPage page = currPage
} }
} }
@@ -347,6 +352,9 @@ func chooseAndMakePayment(timerCtx context.Context, creditCardType, creditCard,
default: default:
} }
time.Sleep(time.Second * 1)
}
expiryMonth := strings.Split(creditCardExpiry, "/")[0] expiryMonth := strings.Split(creditCardExpiry, "/")[0]
expiryYear := strings.Split(creditCardExpiry, "/")[1] expiryYear := strings.Split(creditCardExpiry, "/")[1]