Refactor base URL for the payment success, failure, and notification
This commit is contained in:
parent
e4636592c5
commit
148d9075da
|
@ -80,14 +80,15 @@ func makeReservation(w http.ResponseWriter, r *http.Request, user *auth.User, co
|
||||||
|
|
||||||
schema := httplib.Protocol(r)
|
schema := httplib.Protocol(r)
|
||||||
authority := httplib.Host(r)
|
authority := httplib.Host(r)
|
||||||
|
baseURL := fmt.Sprintf("%s://%s/%s/booking", schema, authority, user.Locale.Language)
|
||||||
request := &redsys.Request{
|
request := &redsys.Request{
|
||||||
TransactionType: redsys.TransactionTypeCharge,
|
TransactionType: redsys.TransactionTypeCharge,
|
||||||
Amount: f.Cart.Total,
|
Amount: f.Cart.Total,
|
||||||
OrderNumber: randomOrderNumber(),
|
OrderNumber: randomOrderNumber(),
|
||||||
Product: "Test Booking",
|
Product: "Test Booking",
|
||||||
SuccessURL: fmt.Sprintf("%s://%s/%s/booking/success", schema, authority, user.Locale.Language),
|
SuccessURL: fmt.Sprintf("%s/success", baseURL),
|
||||||
FailureURL: fmt.Sprintf("%s://%s/%s/booking/failure", schema, authority, user.Locale.Language),
|
FailureURL: fmt.Sprintf("%s/failure", baseURL),
|
||||||
NotificationURL: fmt.Sprintf("%s://%s/%s/booking/notification", schema, authority, user.Locale.Language),
|
NotificationURL: fmt.Sprintf("%s/notification", baseURL),
|
||||||
ConsumerLanguage: user.Locale.Language,
|
ConsumerLanguage: user.Locale.Language,
|
||||||
}
|
}
|
||||||
signed, err := redsys.SignRequest(r.Context(), conn, company, request)
|
signed, err := redsys.SignRequest(r.Context(), conn, company, request)
|
||||||
|
|
Loading…
Reference in New Issue