Improved documentation
This commit is contained in:
parent
8cc80d7e59
commit
fa6fca84a6
@ -11,5 +11,5 @@ func Cancel(ctx *aero.Context) string {
|
||||
token := ctx.Query("token")
|
||||
fmt.Println("cancel", token)
|
||||
|
||||
return ctx.HTML("cancel")
|
||||
return ctx.HTML("Payment has been canceled.")
|
||||
}
|
||||
|
@ -9,21 +9,22 @@ import (
|
||||
"github.com/logpacker/PayPal-Go-SDK"
|
||||
)
|
||||
|
||||
// CreatePayment ...
|
||||
// CreatePayment creates the PayPal payment, typically via a JSON API route.
|
||||
func CreatePayment(ctx *aero.Context) string {
|
||||
// Make sure the user is logged in
|
||||
user := utils.GetUser(ctx)
|
||||
|
||||
if user == nil {
|
||||
return ctx.Error(http.StatusUnauthorized, "Not logged in", nil)
|
||||
}
|
||||
|
||||
// Verify amount
|
||||
amount, err := ctx.Request().Body().String()
|
||||
|
||||
if err != nil {
|
||||
return ctx.Error(http.StatusBadRequest, "Could not read amount", err)
|
||||
}
|
||||
|
||||
// Verify amount
|
||||
switch amount {
|
||||
case "1000", "2000", "3000", "6000", "12000":
|
||||
// OK
|
||||
@ -45,34 +46,6 @@ func CreatePayment(ctx *aero.Context) string {
|
||||
return ctx.Error(http.StatusInternalServerError, "Could not get PayPal access token", err)
|
||||
}
|
||||
|
||||
// webprofile := paypalsdk.WebProfile{
|
||||
// Name: "Anime Notifier",
|
||||
// Presentation: paypalsdk.Presentation{
|
||||
// BrandName: "Anime Notifier",
|
||||
// LogoImage: "https://notify.moe/brand/220",
|
||||
// LocaleCode: "US",
|
||||
// },
|
||||
|
||||
// InputFields: paypalsdk.InputFields{
|
||||
// AllowNote: true,
|
||||
// NoShipping: paypalsdk.NoShippingDisplay,
|
||||
// AddressOverride: paypalsdk.AddrOverrideFromCall,
|
||||
// },
|
||||
|
||||
// FlowConfig: paypalsdk.FlowConfig{
|
||||
// LandingPageType: paypalsdk.LandingPageTypeBilling,
|
||||
// },
|
||||
// }
|
||||
|
||||
// result, err := c.CreateWebProfile(webprofile)
|
||||
// c.SetWebProfile(*result)
|
||||
|
||||
// if err != nil {
|
||||
// return ctx.Error(http.StatusInternalServerError, "Could not create PayPal web profile", err)
|
||||
// }
|
||||
|
||||
// total := amount[:len(amount)-2] + "." + amount[len(amount)-2:]
|
||||
|
||||
// Create payment
|
||||
p := paypalsdk.Payment{
|
||||
Intent: "sale",
|
||||
|
@ -13,7 +13,8 @@ import (
|
||||
|
||||
const adminID = "4J6qpK1ve"
|
||||
|
||||
// Success ...
|
||||
// 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 {
|
||||
user := utils.GetUser(ctx)
|
||||
|
||||
|
31
pages/paypal/webprofile.go
Normal file
31
pages/paypal/webprofile.go
Normal file
@ -0,0 +1,31 @@
|
||||
package paypal
|
||||
|
||||
// Web profile is currently disabled.
|
||||
|
||||
// webprofile := paypalsdk.WebProfile{
|
||||
// Name: "Anime Notifier",
|
||||
// Presentation: paypalsdk.Presentation{
|
||||
// BrandName: "Anime Notifier",
|
||||
// LogoImage: "https://notify.moe/brand/220",
|
||||
// LocaleCode: "US",
|
||||
// },
|
||||
|
||||
// InputFields: paypalsdk.InputFields{
|
||||
// AllowNote: true,
|
||||
// NoShipping: paypalsdk.NoShippingDisplay,
|
||||
// AddressOverride: paypalsdk.AddrOverrideFromCall,
|
||||
// },
|
||||
|
||||
// FlowConfig: paypalsdk.FlowConfig{
|
||||
// LandingPageType: paypalsdk.LandingPageTypeBilling,
|
||||
// },
|
||||
// }
|
||||
|
||||
// result, err := c.CreateWebProfile(webprofile)
|
||||
// c.SetWebProfile(*result)
|
||||
|
||||
// if err != nil {
|
||||
// return ctx.Error(http.StatusInternalServerError, "Could not create PayPal web profile", err)
|
||||
// }
|
||||
|
||||
// total := amount[:len(amount)-2] + "." + amount[len(amount)-2:]
|
Loading…
Reference in New Issue
Block a user