add more
Some checks failed
Build and Publish / BuildAndDeployAmd64 (push) Successful in 35s
Build and Publish / BuildAndDeployArm64 (push) Has been cancelled

This commit is contained in:
matst80
2025-11-28 08:10:08 +01:00
parent d8db3c9289
commit 23160479b3
2 changed files with 11 additions and 0 deletions

View File

@@ -366,10 +366,19 @@ func getOriginalHost(r *http.Request) string {
return r.Host
}
func getClientIp(r *http.Request) string {
ip := r.Header.Get("X-Forwarded-For")
if ip == "" {
ip = r.RemoteAddr
}
return ip
}
func (s *PoolServer) CreateOrUpdateCheckout(r *http.Request, id cart.CartId) (*CheckoutOrder, error) {
host := getOriginalHost(r)
country := getCountryFromHost(host)
meta := &CheckoutMeta{
ClientIp: getClientIp(r),
SiteUrl: fmt.Sprintf("https://%s", host),
Country: country,
Currency: getCurrency(country),
@@ -729,6 +738,7 @@ func (s *PoolServer) AdyenSessionHandler(w http.ResponseWriter, r *http.Request,
host := getOriginalHost(r)
country := getCountryFromHost(host)
meta := &CheckoutMeta{
ClientIp: getClientIp(r),
SiteUrl: fmt.Sprintf("https://%s", host),
Country: country,
Currency: getCurrency(country),