git-svn-id: svn://losandesgames.com/alfheim-website@50 15359d88-9307-4e75-a9c1-e5686e5897df

This commit is contained in:
vfs committed 2025-10-03 23:19:06 +00:00
1 parent 391becf14e
commit 45e568a824
38 files changed
+14 -811

No files matched your search

+8 -8
View File
@@ -377,7 +377,7 @@ func subscribe(w http.ResponseWriter, r *http.Request) {
}
}
func subscribe_stripe(w http.ResponseWriter, r *http.Request) {
func subscribeStripe(w http.ResponseWriter, r *http.Request) {
id := authenticatedUser(w, r)
account, err := users.GetAccount(id)
@@ -412,7 +412,7 @@ func subscribe_stripe(w http.ResponseWriter, r *http.Request) {
}
}
func managebilling(w http.ResponseWriter, r *http.Request) {
func manageBilling(w http.ResponseWriter, r *http.Request) {
id := authenticatedUser(w, r)
account, err := users.GetAccount(id)
if err != nil {
@@ -510,11 +510,11 @@ func webhooks(w http.ResponseWriter, r *http.Request) {
w.WriteHeader(http.StatusOK)
}
func handle_checkout_session_completed(checkoutsession stripe.CheckoutSession) error {
func handle_checkout_session_completed(checkoutSession stripe.CheckoutSession) error {
//toprint, _ := json.MarshalIndent(checkoutSession, "", " ")
//log.Println(string(toprint))
subscription, err := subscription.Get(checkoutsession.Subscription.ID, nil)
subscription, err := subscription.Get(checkoutSession.Subscription.ID, nil)
if err != nil {
log.Println(err)
return err
@@ -542,19 +542,19 @@ func handle_checkout_session_completed(checkoutsession stripe.CheckoutSession) e
// status = paused
//}
subscriptions.Insert(checkoutsession.Customer.ID, subscription.ID, checkoutsession.ID, subscription.Status)
subscriptions.Insert(checkoutSession.Customer.ID, subscription.ID, checkoutSession.ID, subscription.Status)
return nil
}
func handle_payment_method_attached(paymentmethod stripe.PaymentMethod) error {
func handlePaymentMethodAttached(paymentMethod stripe.PaymentMethod) error {
//toprint, _ := json.MarshalIndent(setupintent, "", " ")
//log.Println(string(toprint))
// make this the new customer's default payment method
params := &stripe.CustomerParams{}
params.DefaultSource = &paymentmethod.ID
/*result*/ _, err := customer.Update(paymentmethod.Customer.ID, params)
params.DefaultSource = &paymentMethod.ID
/*result*/ _, err := customer.Update(paymentMethod.Customer.ID, params)
//log.Println(result)
if err != nil {
log.Println(err)
+2 -2
View File
@@ -98,8 +98,8 @@ func main() {
mux.HandleFunc("/register", register)
mux.HandleFunc("/account", requireAuthenticatedUser(account))
mux.HandleFunc("/deleteaccount", requireAuthenticatedUser(deleteAccount))
mux.HandleFunc("/subscribe", requireAuthenticatedUser(subscribe_stripe))
mux.HandleFunc("/managebilling", requireAuthenticatedUser(managebilling))
mux.HandleFunc("/subscribe", requireAuthenticatedUser(subscribeStripe))
mux.HandleFunc("/managebilling", requireAuthenticatedUser(manageBilling))
mux.HandleFunc("/webhook", webhooks)
if *production {