paymentprovider

package
v0.0.0-...-0642f7a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 12, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ConfigPaymentProvider

type ConfigPaymentProvider struct {
	Secret     string `env:"PAYMENT_SECRET`
	Live       bool   `env:"PAYMENT_LIVE"`
	MerchId    string `env:"PAYMENT_MERCH_ID"`
	PublicKey  string `env:"PAYMENT_PUBLIC_KEY"`
	PrivateKey string `env:"PAYMENT_PRIVATE_KEY"`
}

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"
)

func (ErrorCode) Error

func (e ErrorCode) Error() string

type ProviderStripe

type ProviderStripe struct {
}

func NewProvider

func NewProvider(paymentConfig *ConfigPaymentProvider) (*ProviderStripe, error)

NewProvider creates and prepare the stripe ProviderStripe

func (*ProviderStripe) Charge

func (*ProviderStripe) ProviderId

func (p *ProviderStripe) ProviderId() paymentpb.PaymentProvider

func (*ProviderStripe) Refund

func (p *ProviderStripe) Refund(_ context.Context, chargeId string, amount uint64, _ paymentpb.Currency, reason paymentpb.RefundReason) (*paymentpb.Refund, error)

func (*ProviderStripe) SupportedCards

func (p *ProviderStripe) SupportedCards() []paymentpb.CardType

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL