Browse Source

Feat(booking-job): Loop detect payment merchant

master
Samuel Pua 3 years ago
parent
commit
8be27ce214
  1. 8
      backend/internal/ktmtrainbot/backgroundbookingjob.go

8
backend/internal/ktmtrainbot/backgroundbookingjob.go

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

Loading…
Cancel
Save