Upgraded to latest aero version
This commit is contained in:
@ -7,7 +7,7 @@ import (
|
||||
)
|
||||
|
||||
// Cancel ...
|
||||
func Cancel(ctx *aero.Context) string {
|
||||
func Cancel(ctx aero.Context) error {
|
||||
token := ctx.Query("token")
|
||||
fmt.Println("cancel", token)
|
||||
|
||||
|
@ -5,12 +5,13 @@ import (
|
||||
|
||||
"github.com/aerogo/aero"
|
||||
"github.com/animenotifier/arn"
|
||||
"github.com/animenotifier/notify.moe/assets"
|
||||
"github.com/animenotifier/notify.moe/utils"
|
||||
paypalsdk "github.com/logpacker/PayPal-Go-SDK"
|
||||
)
|
||||
|
||||
// CreatePayment creates the PayPal payment, typically via a JSON API route.
|
||||
func CreatePayment(ctx *aero.Context) string {
|
||||
func CreatePayment(ctx aero.Context) error {
|
||||
// Make sure the user is logged in
|
||||
user := utils.GetUser(ctx)
|
||||
|
||||
@ -60,8 +61,8 @@ func CreatePayment(ctx *aero.Context) string {
|
||||
Description: "Top Up Balance",
|
||||
}},
|
||||
RedirectURLs: &paypalsdk.RedirectURLs{
|
||||
ReturnURL: "https://" + ctx.App.Config.Domain + "/paypal/success",
|
||||
CancelURL: "https://" + ctx.App.Config.Domain + "/paypal/cancel",
|
||||
ReturnURL: "https://" + assets.Domain + "/paypal/success",
|
||||
CancelURL: "https://" + assets.Domain + "/paypal/cancel",
|
||||
},
|
||||
}
|
||||
|
||||
|
@ -8,6 +8,7 @@ import (
|
||||
"github.com/aerogo/aero"
|
||||
"github.com/animenotifier/arn"
|
||||
"github.com/animenotifier/arn/stringutils"
|
||||
"github.com/animenotifier/notify.moe/assets"
|
||||
"github.com/animenotifier/notify.moe/components"
|
||||
"github.com/animenotifier/notify.moe/utils"
|
||||
)
|
||||
@ -16,7 +17,7 @@ const adminID = "4J6qpK1ve"
|
||||
|
||||
// Success is called once the payment has been confirmed by the user on the PayPal website.
|
||||
// However, the actual payment still needs to be executed and can fail.
|
||||
func Success(ctx *aero.Context) string {
|
||||
func Success(ctx aero.Context) error {
|
||||
user := utils.GetUser(ctx)
|
||||
|
||||
if user == nil {
|
||||
@ -90,7 +91,7 @@ func Success(ctx *aero.Context) string {
|
||||
Title: user.Nick + " bought " + strconv.Itoa(payment.Gems()) + " gems",
|
||||
Message: user.Nick + " paid " + payment.Amount + " " + payment.Currency + " making his new balance " + strconv.Itoa(user.Balance),
|
||||
Icon: user.AvatarLink("large"),
|
||||
Link: "https://" + ctx.App.Config.Domain + "/api/paypalpayment/" + payment.ID,
|
||||
Link: "https://" + assets.Domain + "/api/paypalpayment/" + payment.ID,
|
||||
Type: arn.NotificationTypePurchase,
|
||||
})
|
||||
}()
|
||||
|
Reference in New Issue
Block a user