Getting more info abount transaction ad move js partial to js file

This commit is contained in:
2024-08-07 14:35:30 +02:00
parent 625929cf25
commit 1372542620
7 changed files with 109 additions and 185 deletions

View File

@ -3,6 +3,7 @@ package cards
import (
"github.com/stripe/stripe-go/v79"
"github.com/stripe/stripe-go/v79/paymentintent"
"github.com/stripe/stripe-go/v79/paymentmethod"
)
type Card struct {
@ -48,6 +49,28 @@ func (c *Card) CreatePaymentIntent(
return pi, "", nil
}
// GetPaymentMethod gets the payment method by payment intend id
func (c *Card) GetPaymentMethod(s string) (*stripe.PaymentMethod, error) {
stripe.Key = c.Secret
pm, err := paymentmethod.Get(s, nil)
if err != nil {
return nil, err
}
return pm, nil
}
// RetrievePaymentMethod gets an existing payment intent by id
func (c *Card) RetrievePaymentIntent(id string) (*stripe.PaymentIntent, error) {
stripe.Key = c.Secret
pi, err := paymentintent.Get(id, nil)
if err != nil {
return nil, err
}
return pi, nil
}
func cardErrorMessage(code stripe.ErrorCode) string {
msg := ""