Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion controller/topup.go
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,11 @@ func RequestEpay(c *gin.Context) {
}

callBackAddress := service.GetCallbackAddress()
returnUrl, _ := url.Parse(system_setting.ServerAddress + "/console/log")
returnPath := "/console/log"
if common.GetTheme() == "default" {
returnPath = "/usage-logs"
}
returnUrl, _ := url.Parse(system_setting.ServerAddress + returnPath)
notifyUrl, _ := url.Parse(callBackAddress + "/api/user/epay/notify")
tradeNo := fmt.Sprintf("%s%d", common.GetRandomString(6), time.Now().Unix())
tradeNo = fmt.Sprintf("USR%dNO%s", id, tradeNo)
Expand Down
12 changes: 9 additions & 3 deletions controller/topup_stripe.go
Original file line number Diff line number Diff line change
Expand Up @@ -346,12 +346,18 @@ func genStripeLink(referenceId string, customerId string, email string, amount i

stripe.Key = setting.StripeApiSecret

// Use custom URLs if provided, otherwise use defaults
// Use custom URLs if provided, otherwise use defaults based on the active frontend theme
successPath := "/console/log"
cancelPath := "/console/topup"
if common.GetTheme() == "default" {
successPath = "/usage-logs"
cancelPath = "/wallet"
}
if successURL == "" {
successURL = system_setting.ServerAddress + "/console/log"
successURL = system_setting.ServerAddress + successPath
}
if cancelURL == "" {
cancelURL = system_setting.ServerAddress + "/console/topup"
cancelURL = system_setting.ServerAddress + cancelPath
}

params := &stripe.CheckoutSessionParams{
Expand Down