Documentation
¶
Overview ¶
Package adapterpattern implements the Adapter Design Pattern that allows incompatible interfaces to work together by converting the interface of one type into another that client expects.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckStatus ¶
func CheckStatus(paymentProcessor PaymentProcessor) string
func Checkout ¶
func Checkout(paymentProcessor PaymentProcessor, amount float32, currency string)
Checkout tester
func GetTransactionID ¶
func GetTransactionID(paymentProcessor PaymentProcessor) string
Types ¶
type CustomPaymentProcessor ¶
type CustomPaymentProcessor struct {
// contains filtered or unexported fields
}
func NewCustomPaymentProcessor ¶
func NewCustomPaymentProcessor() *CustomPaymentProcessor
func (*CustomPaymentProcessor) PaymentStatus ¶
func (p *CustomPaymentProcessor) PaymentStatus() string
func (*CustomPaymentProcessor) ProcessPayment ¶
func (p *CustomPaymentProcessor) ProcessPayment(amount float32, currency string) bool
func (*CustomPaymentProcessor) TransactionID ¶
func (p *CustomPaymentProcessor) TransactionID() string
type LegacyAdapter ¶
type LegacyAdapter struct {
// contains filtered or unexported fields
}
Adaptee - LegacyProcessor Target type - PaymentProcessor We need some type(Adapter) to convert/translate between Adaptee & Target type LegacyAdapter compose LegacyProcessor and then translate between type
func NewLegacyAdapter ¶
func NewLegacyAdapter() *LegacyAdapter
func (*LegacyAdapter) PaymentStatus ¶
func (l *LegacyAdapter) PaymentStatus() string
func (*LegacyAdapter) ProcessPayment ¶
func (l *LegacyAdapter) ProcessPayment(amount float32, currency string) bool
func (*LegacyAdapter) TransactionID ¶
func (l *LegacyAdapter) TransactionID() string
type LegacyProcessor ¶
type LegacyProcessor struct {
// contains filtered or unexported fields
}
func (*LegacyProcessor) CheckStatus ¶
func (l *LegacyProcessor) CheckStatus(refID uint64) int16
func (*LegacyProcessor) ExecuteTransaction ¶
func (l *LegacyProcessor) ExecuteTransaction(amount float64, currency string) uint64
func (*LegacyProcessor) GetReferenceNumber ¶
func (l *LegacyProcessor) GetReferenceNumber() uint64
Click to show internal directories.
Click to hide internal directories.