Documentation ¶
Index ¶
- type ConfigPaymentProvider
- type ErrorCode
- type PaymentProvider
- type ProviderStripe
- func (p *ProviderStripe) Charge(_ context.Context, req *paymentpb.NewChargeRequest) (*paymentpb.NewChargeResponse, error)
- func (p *ProviderStripe) ProviderId() paymentpb.PaymentProvider
- func (p *ProviderStripe) Refund(_ context.Context, chargeId string, amount uint64, _ paymentpb.Currency, ...) (*paymentpb.Refund, error)
- func (p *ProviderStripe) SupportedCards() []paymentpb.CardType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ConfigPaymentProvider ¶
type ErrorCode ¶
type ErrorCode string
ErrorCode represents payment provider specific error
var ( // IncorrectNum incorrect cc num IncorrectNum ErrorCode = "incorrect_number" // InvalidNum invalid cc num InvalidNum ErrorCode = "invalid_number" // InvalidExpM invalid exp month InvalidExpM ErrorCode = "invalid_expiry_month" // InvalidExpY invalid exp year InvalidExpY ErrorCode = "invalid_expiry_year" // InvalidCvc invalid cvc number InvalidCvc ErrorCode = "invalid_cvc" // ExpiredCard card is expired ExpiredCard ErrorCode = "expired_card" // IncorrectCvc incorrect cvc IncorrectCvc ErrorCode = "incorrect_cvc" // IncorrectZip incorrect zip code IncorrectZip ErrorCode = "incorrect_zip" // CardDeclined card declined CardDeclined ErrorCode = "card_declined" // Missing missing information Missing ErrorCode = "missing" // ProcessingErr processing error ProcessingErr ErrorCode = "processing_error" // RateLimit reached call rate limit RateLimit ErrorCode = "rate_limit" )
type PaymentProvider ¶
type PaymentProvider interface { SupportedCards() []paymentpb.CardType ProviderId() paymentpb.PaymentProvider Charge(context.Context, *paymentpb.NewChargeRequest) (*paymentpb.NewChargeResponse, error) Refund(context.Context, string, uint64, paymentpb.Currency, paymentpb.RefundReason) (*paymentpb.Refund, error) }
type ProviderStripe ¶
type ProviderStripe struct { }
func NewProvider ¶
func NewProvider(paymentConfig *ConfigPaymentProvider) (*ProviderStripe, error)
NewProvider creates and prepare the stripe ProviderStripe
func (*ProviderStripe) Charge ¶
func (p *ProviderStripe) Charge(_ context.Context, req *paymentpb.NewChargeRequest) (*paymentpb.NewChargeResponse, error)
func (*ProviderStripe) ProviderId ¶
func (p *ProviderStripe) ProviderId() paymentpb.PaymentProvider
func (*ProviderStripe) SupportedCards ¶
func (p *ProviderStripe) SupportedCards() []paymentpb.CardType
Click to show internal directories.
Click to hide internal directories.