fritzpay

package
v0.0.0-...-b3f3fbb Latest Latest
Warning

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

Go to latest
Published: Jan 2, 2015 License: Apache-2.0 Imports: 18 Imported by: 1

Documentation

Overview

Package fritzpay provides the Test-/Demo-Payment Service Provider (PSP) FritzPay

This package demonstrates how to add new PSP drivers. This provider can also be used to test out the functionality of paymentd when interacting as an end-user with it.

Index

Constants

View Source
const (
	FritzpayDriverPath  = "/fritzpay"
	FritzpayTemplateDir = "fritzpay"
)
View Source
const (
	TransactionPSPInit  = "psp_init"
	TransactionInit     = "initialized"
	TransactionPSPError = "psp_error"
	TransactionOpen     = "open"
)
View Source
const Debug = false

Debug flag whether debugging is turned on

Variables

View Source
var (
	ErrDB       = errors.New("database error")
	ErrConflict = errors.New("conflict")
)
View Source
var (
	ErrPaymentNotFound     = errors.New("payment not found")
	ErrTransactionNotFound = errors.New("transaction not found")
)

Functions

func InsertPaymentTransactionTx

func InsertPaymentTransactionTx(db *sql.Tx, paymentTx PaymentTransaction) error

func InsertPaymentTx

func InsertPaymentTx(db *sql.Tx, p *Payment) error

Types

type Driver

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

func (*Driver) Attach

func (d *Driver) Attach(ctx *service.Context, mux *mux.Router) error

func (*Driver) Callback

func (d *Driver) Callback(w http.ResponseWriter, r *http.Request)

Callback handles callback from the "psp" (payment service provider; in this case a mock implementation)

It will always answer with a HTTP status 200 OK unless there was a data error We expect the PSP to re-send the callback notification if we answer with anything other than 200

func (*Driver) InitPayment

func (d *Driver) InitPayment(p *payment.Payment, method *payment_method.Method) (http.Handler, error)

func (*Driver) PaymentInfo

func (d *Driver) PaymentInfo() http.Handler

func (*Driver) Status

func (d *Driver) Status(w http.ResponseWriter, r *http.Request)

type Payment

type Payment struct {
	ID        int64
	ProjectID int64
	PaymentID int64
	Created   time.Time
	MethodKey string
}

func PaymentByPaymentIDTx

func PaymentByPaymentIDTx(db *sql.Tx, id payment.PaymentID) (Payment, error)

type PaymentTransaction

type PaymentTransaction struct {
	FritzpayPaymentID int64
	Timestamp         time.Time
	Status            string
	FritzpayID        sql.NullString
	Payload           sql.NullString
}

func PaymentTransactionCurrentByPaymentIDProviderTx

func PaymentTransactionCurrentByPaymentIDProviderTx(db *sql.Tx, id int64) (PaymentTransaction, error)

func PaymentTransactionCurrentByPaymentIDTx

func PaymentTransactionCurrentByPaymentIDTx(db *sql.Tx, id int64) (PaymentTransaction, error)

Jump to

Keyboard shortcuts

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