epay

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: May 10, 2018 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BillResponse

type BillResponse struct {
	Successful        bool
	UnknownSubscriber bool
	Amount            int
}

BillResponse is representing the response from the billing

func (*BillResponse) Status

func (br *BillResponse) Status() Status

Status gets bill response status

type Gateway

type Gateway interface {
	// GetCurrentBill returns the current bill of the provided customer.
	GetCurrentBill(customerID, transactionID string) (*BillResponse, error)

	// PayBill pays bill using the provided amount
	PayBill(customerID, transactionID string, Amount int) (*PaymentResponse, error)
}

Gateway is a generic gateway to the remote billing system

type PaymentResponse

type PaymentResponse struct {
	AlreadyPaid bool
	Successful  bool
}

PaymentResponse is representing the response of payment in the billing system.

func (*PaymentResponse) Status

func (pr *PaymentResponse) Status() Status

Status gets payment response status

type Server

type Server struct {
	// contains filtered or unexported fields
}

Server is representing an implementation of the epay server

func NewServer

func NewServer() *Server

NewServer creates a new instance of the EpayServer

func (*Server) Serve

func (s *Server) Serve(l net.Listener, gateway Gateway) error

Serve serves the incoming connections received from the provided listener

func (*Server) Stop

func (s *Server) Stop()

Stop stops listening of incomming connections and terminates server instance

type Status

type Status string

Status is representing the response status which is returned back to the epay processor

const (
	// BillReturned indicates that bill is returned successfully
	BillReturned Status = "00"
	// NoCurrentBill indicates that subscriber doesn't have current bill
	NoCurrentBill Status = "62"
	// UnknownSubscriber indicates that subscriber ID was broken
	UnknownSubscriber Status = "14"

	// PaymentProcessed indicates that payment was processed successfully
	PaymentProcessed Status = "00"
	// PaymentAlreadyProcessed indicates that payment was already processed
	PaymentAlreadyProcessed Status = "94"
	// CommonError indicates an error which was occurred during payment
	CommonError Status = "96"
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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