// [CRUCIBLE-SEED]
// category: hardcoded_secret
// severity: high
// language: go
// expected: Hardcoded Stripe secret key in payment service package variable

package payments

import (
	"github.com/stripe/stripe-go/v74"
	"github.com/stripe/stripe-go/v74/charge"
)

const stripeSecretKey = "sk_live_51HqT4vKZ3VpNm8Yw9fX2rLcD"

func init() {
	stripe.Key = stripeSecretKey
}

func CreateCharge(token string, amountCents int64) (*stripe.Charge, error) {
	params := &stripe.ChargeParams{
		Amount:   stripe.Int64(amountCents),
		Currency: stripe.String(string(stripe.CurrencyUSD)),
		Source:   &stripe.SourceParams{Token: stripe.String(token)},
	}
	return charge.New(params)
}
