<commit_before>package paypal

import (
	"errors"
	"net/http"
	"strconv"

	"github.com/aerogo/aero"
	"github.com/animenotifier/arn"
	"github.com/animenotifier/notify.moe/components"
	"github.com/animenotifier/notify.moe/utils"
)

const adminID = "4J6qpK1ve"

// Success ...
func Success(ctx *aero.Context) string {
	user := utils.GetUser(ctx)

	if user == nil {
		return ctx.Error(http.StatusUnauthorized, "Not logged in", nil)
	}

	paymentID := ctx.Query("paymentId")
	token := ctx.Query("token")
	payerID := ctx.Query("PayerID")

	if paymentID == "" || payerID == "" || token == "" {
		return ctx.Error(http.StatusBadRequest, "Invalid parameters", errors.New("paymentId, token and PayerID are required"))
	}

	c, err := arn.PayPal()

	if err != nil {
		return ctx.Error(http.StatusInternalServerError, "Could not initiate PayPal client", err)
	}

	c.SetAccessToken(token)
	execute, err := c.ExecuteApprovedPayment(paymentID, payerID)

	if err != nil {<commit_msg>Fixed payments for PRO accounts<commit_after>package paypal

import (
	"errors"
	"net/http"
	"strconv"

	"github.com/aerogo/aero"
	"github.com/animenotifier/arn"
	"github.com/animenotifier/notify.moe/components"
	"github.com/animenotifier/notify.moe/utils"
)

const adminID = "4J6qpK1ve"

// Success ...
func Success(ctx *aero.Context) string {
	user := utils.GetUser(ctx)

	if user == nil {
		return ctx.Error(http.StatusUnauthorized, "Not logged in", nil)
	}

	paymentID := ctx.Query("paymentId")
	token := ctx.Query("token")
	payerID := ctx.Query("PayerID")

	if paymentID == "" || payerID == "" || token == "" {
		return ctx.Error(http.StatusBadRequest, "Invalid parameters", errors.New("paymentId, token and PayerID are required"))
	}

	c, err := arn.PayPal()

	if err != nil {
		return ctx.Error(http.StatusInternalServerError, "Could not initiate PayPal client", err)
	}

	// Get access token
	_, err = c.GetAccessToken()

	if err != nil {
		return ctx.Error(http.StatusInternalServerError, "Could not get PayPal access token", err)
	}

	// Execute payment
	execute, err := c.ExecuteApprovedPayment(paymentID, payerID)

	if err != nil {
{'fraction_non_alphanumeric': 0.150853889943074, 'fraction_numerical': 0.0028462998102466793, 'mean_word_length': 4.352791878172589, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6402391', 'n_tokens_mistral': 774, 'n_tokens_neox': 745, 'n_words': 164}