Documentation
¶
Index ¶
- Constants
- Variables
- func NewPrepaidGateway(db *sql.DB, instanceID string, initConf interface{}) (payment.PrepaidGateway, error)
- type PrepaidGateway
- func (pg *PrepaidGateway) CheckoutForm(pr payment.PaymentRequest) (HTMLCheckoutForm string, err error)
- func (pg *PrepaidGateway) IsRefundable(referenceID string) bool
- func (pg *PrepaidGateway) OnStatusChange(UpdateHandler func(referenceID string, newResult payment.PaymentResult)) error
- func (pg *PrepaidGateway) PaymentResult(referenceID string) (result payment.PaymentResult, err error)
- func (pg *PrepaidGateway) Refund(rr payment.RefundRequest) error
Constants ¶
View Source
const ( PREPAID_GATEWAY uint = iota BILLINGAGREEMENT_GATEWAY )
Variables ¶
View Source
var ( ErrBadInitConf error = errors.New("paypal: bad initConf") ErrOrderNotPaid error = errors.New("paypal: order is not in paid state") ErrRepeatedRefund error = errors.New("paypal: refund amount exceeds paid amount") ErrNoCaptureID error = errors.New("paypal: no capture ID associated or there was an error when fetching capture ID") ExampleInitConf = map[string]string{ "clientID": `ARRirLbsebmjl6qOiWuhTQFOhko6HCd-BucbAOnHjtzO5ZZRtG1RxC6SmB18b5fEAmj_oLZTKn8znK1Q`, "secretID": `EKdLMEUSbkwUkC3i4MqtbNE5Oq4cSdTOjat4sEV4NiaMHt5LNr25843yy2v90B3jW0iIjEB32eztDP-a`, "apiBase": `https://api-m.sandbox.paypal.com`, "orderSqlTable": `prepaid_paypal_orders_2`, "returnURL": `https://ulysses.tunnel.work/billing.html`, } )
Functions ¶
func NewPrepaidGateway ¶
func NewPrepaidGateway(db *sql.DB, instanceID string, initConf interface{}) (payment.PrepaidGateway, error)
NewPrepaidGateway() is a payment.PrepaidGatewayGen
Types ¶
type PrepaidGateway ¶
type PrepaidGateway struct {
// Handler func used to notify the Ulysses server
UpdateHandler func(referenceID string, newResult payment.PaymentResult)
// contains filtered or unexported fields
}
func (*PrepaidGateway) CheckoutForm ¶
func (pg *PrepaidGateway) CheckoutForm(pr payment.PaymentRequest) (HTMLCheckoutForm string, err error)
CheckoutForm() is called when frontend requests a Checkout Form to be rendered
func (*PrepaidGateway) IsRefundable ¶
func (pg *PrepaidGateway) IsRefundable(referenceID string) bool
IsRefundable() checks if an order is eligible for at least a partial refund.
func (*PrepaidGateway) OnStatusChange ¶
func (pg *PrepaidGateway) OnStatusChange(UpdateHandler func(referenceID string, newResult payment.PaymentResult)) error
func (*PrepaidGateway) PaymentResult ¶
func (pg *PrepaidGateway) PaymentResult(referenceID string) (result payment.PaymentResult, err error)
PaymentResult() is called by Ulysses to ACTIVELY verify an order's payment status on the contradictory, please see OnStatusChange() where Ulysses waits for payment gateway to report the payment result.
func (*PrepaidGateway) Refund ¶
func (pg *PrepaidGateway) Refund(rr payment.RefundRequest) error
Refund the transaction according to a request built by caller
Source Files
¶
Click to show internal directories.
Click to hide internal directories.