feat: support Stripe payment provider (#2204)

* feat: add stripe payment provider

* feat: support stripe payment

* feat: delete todo comment

* feat: remove description struct

* feat: change outOrderId->orderId
This commit is contained in:
haiwu
2023-08-15 00:16:30 +08:00
committed by GitHub
parent abaf4ca8d9
commit 2ff9020884
13 changed files with 230 additions and 14 deletions

View File

@ -24,6 +24,7 @@ const (
PaymentStatePaid PaymentState = "Paid"
PaymentStateCreated PaymentState = "Created"
PaymentStateCanceled PaymentState = "Canceled"
PaymentStateTimeout PaymentState = "Timeout"
PaymentStateError PaymentState = "Error"
)
@ -32,13 +33,13 @@ type NotifyResult struct {
PaymentStatus PaymentState
NotifyMessage string
ProviderName string
ProductName string
ProductDisplayName string
ProviderName string
Price float64
Currency string
OutOrderId string
OrderId string
}
type PaymentProvider interface {
@ -75,6 +76,12 @@ func GetPaymentProvider(typ string, clientId string, clientSecret string, host s
return nil, err
}
return pp, nil
} else if typ == "Stripe" {
pp, err := NewStripePaymentProvider(clientId, clientSecret)
if err != nil {
return nil, err
}
return pp, nil
}
return nil, nil