Documentation
¶
Index ¶
- Constants
- Variables
- func AmountToCentInt(amount float64) int64
- func CentToAmount(cent int64) float64
- func MapRefundStatus(status string) string
- func MappingStatus(status string) string
- func MoneyFeeToString(moneyFee float64) string
- func New() payment.Driver
- type Square
- func (a *Square) IsSupported(s config.Support) bool
- func (a *Square) Pay(ctx echo.Context, cfg *config.Pay) (*config.PayResponse, error)
- func (a *Square) PayNotify(ctx echo.Context) error
- func (a *Square) PayQuery(ctx echo.Context, cfg *config.Query) (*config.Result, error)
- func (a *Square) Refund(ctx echo.Context, cfg *config.Refund) (*config.Result, error)
- func (a *Square) RefundNotify(ctx echo.Context) error
- func (a *Square) RefundQuery(ctx echo.Context, cfg *config.Query) (*config.Result, error)
- func (a *Square) SetAccount(account *config.Account) payment.Driver
- func (a *Square) SetNotifyCallback(callback payment.NotifyCallback) payment.Driver
- func (a *Square) VerifySign(ctx echo.Context) error
Constants ¶
const Name = `square`
Variables ¶
var SupportedCurrencies = []string{
"USD", "CAD", "EUR", "GBP", "AUD", "JPY",
}
Functions ¶
func AmountToCentInt ¶
AmountToCentInt 金额转分为整数(Square要求整数分单位)
func MapRefundStatus ¶
MapRefundStatus 映射 Square 退款状态 状态文档: https://developer.square.com/reference/square/enums/RefundStatus
func MappingStatus ¶
MappingStatus 映射 Square 支付状态 状态文档: https://developer.square.com/reference/square/enums/PaymentStatus
Types ¶
type Square ¶
type Square struct {
// contains filtered or unexported fields
}
func (*Square) Pay ¶
Pay 创建支付链接(使用 Square Payments API + Web Payment SDK 流程) 文档: https://developer.squareup.com/reference/square/payments-api/create-payment
func (*Square) PayNotify ¶
PayNotify Square 通过 webhook 发送通知 文档: https://developer.square.com/docs/webhooks/overview
func (*Square) PayQuery ¶
PayQuery 查询支付状态 文档: https://developer.squareup.com/reference/square/payments-api/get-payment
func (*Square) Refund ¶
Refund 发起退款 文档: https://developer.squareup.com/reference/square/refunds-api/create-refund
func (*Square) RefundNotify ¶
RefundNotify 退款通知处理
func (*Square) RefundQuery ¶
RefundQuery 查询退款状态 文档: https://developer.squareup.com/reference/square/refunds-api/get-refund
func (*Square) SetNotifyCallback ¶
func (a *Square) SetNotifyCallback(callback payment.NotifyCallback) payment.Driver
func (*Square) VerifySign ¶
VerifySign 验证 Square Webhook 签名(HMAC-SHA256) 文档: https://developer.squareup.com/docs/webhooks/overview#step-2-verify-the-webhook-event-signature Square 发送: X-Square-Signature = HMAC-SHA256(notification_url + body, webhook_signature_key)