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
- Variables
- func InsertPaymentTransactionTx(db *sql.Tx, paymentTx PaymentTransaction) error
- func InsertPaymentTx(db *sql.Tx, p *Payment) error
- type Driver
- func (d *Driver) Attach(ctx *service.Context, mux *mux.Router) error
- func (d *Driver) Callback(w http.ResponseWriter, r *http.Request)
- func (d *Driver) InitPayment(p *payment.Payment, method *payment_method.Method) (http.Handler, error)
- func (d *Driver) PaymentInfo() http.Handler
- func (d *Driver) Status(w http.ResponseWriter, r *http.Request)
- type Payment
- type PaymentTransaction
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
Types ¶
type Driver ¶
type Driver struct {
// contains filtered or unexported fields
}
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 (*Driver) PaymentInfo ¶
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)
Click to show internal directories.
Click to hide internal directories.