add more
This commit is contained in:
@@ -17,6 +17,7 @@ type CheckoutMeta struct {
|
|||||||
// Terms string
|
// Terms string
|
||||||
// Checkout string
|
// Checkout string
|
||||||
// Confirmation string
|
// Confirmation string
|
||||||
|
ClientIp string
|
||||||
Country string
|
Country string
|
||||||
Currency string // optional override (defaults to "SEK" if empty)
|
Currency string // optional override (defaults to "SEK" if empty)
|
||||||
Locale string // optional override (defaults to "sv-se" if empty)
|
Locale string // optional override (defaults to "sv-se" if empty)
|
||||||
|
|||||||
@@ -366,10 +366,19 @@ func getOriginalHost(r *http.Request) string {
|
|||||||
return r.Host
|
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) {
|
func (s *PoolServer) CreateOrUpdateCheckout(r *http.Request, id cart.CartId) (*CheckoutOrder, error) {
|
||||||
host := getOriginalHost(r)
|
host := getOriginalHost(r)
|
||||||
country := getCountryFromHost(host)
|
country := getCountryFromHost(host)
|
||||||
meta := &CheckoutMeta{
|
meta := &CheckoutMeta{
|
||||||
|
ClientIp: getClientIp(r),
|
||||||
SiteUrl: fmt.Sprintf("https://%s", host),
|
SiteUrl: fmt.Sprintf("https://%s", host),
|
||||||
Country: country,
|
Country: country,
|
||||||
Currency: getCurrency(country),
|
Currency: getCurrency(country),
|
||||||
@@ -729,6 +738,7 @@ func (s *PoolServer) AdyenSessionHandler(w http.ResponseWriter, r *http.Request,
|
|||||||
host := getOriginalHost(r)
|
host := getOriginalHost(r)
|
||||||
country := getCountryFromHost(host)
|
country := getCountryFromHost(host)
|
||||||
meta := &CheckoutMeta{
|
meta := &CheckoutMeta{
|
||||||
|
ClientIp: getClientIp(r),
|
||||||
SiteUrl: fmt.Sprintf("https://%s", host),
|
SiteUrl: fmt.Sprintf("https://%s", host),
|
||||||
Country: country,
|
Country: country,
|
||||||
Currency: getCurrency(country),
|
Currency: getCurrency(country),
|
||||||
|
|||||||
Reference in New Issue
Block a user