Update pool-server.go
This commit is contained in:
@@ -335,11 +335,20 @@ func getInventoryRequests(items []*cart.CartItem) []inventory.ReserveRequest {
|
|||||||
return requests
|
return requests
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func getOriginalHost(r *http.Request) string {
|
||||||
|
proxyHost := r.Header.Get("X-Forwarded-Host")
|
||||||
|
if proxyHost != "" {
|
||||||
|
return proxyHost
|
||||||
|
}
|
||||||
|
return r.Host
|
||||||
|
}
|
||||||
|
|
||||||
func (s *PoolServer) CreateOrUpdateCheckout(r *http.Request, id cart.CartId) (*CheckoutOrder, error) {
|
func (s *PoolServer) CreateOrUpdateCheckout(r *http.Request, id cart.CartId) (*CheckoutOrder, error) {
|
||||||
country := getCountryFromHost(r.Host)
|
host := getOriginalHost(r)
|
||||||
|
country := getCountryFromHost(host)
|
||||||
meta := &CheckoutMeta{
|
meta := &CheckoutMeta{
|
||||||
Terms: fmt.Sprintf("https://%s/terms", r.Host),
|
Terms: fmt.Sprintf("https://%s/terms", host),
|
||||||
Checkout: fmt.Sprintf("https://%s/checkout?order_id={checkout.order.id}", r.Host),
|
Checkout: fmt.Sprintf("https://%s/checkout?order_id={checkout.order.id}", host),
|
||||||
Confirmation: fmt.Sprintf("https://%s/confirmation/{checkout.order.id}", r.Host),
|
Confirmation: fmt.Sprintf("https://%s/confirmation/{checkout.order.id}", r.Host),
|
||||||
Country: country,
|
Country: country,
|
||||||
Currency: getCurrency(country),
|
Currency: getCurrency(country),
|
||||||
|
|||||||
Reference in New Issue
Block a user