package payment

import (
	"errors"
	"github.com/gin-gonic/gin"
	"strings"
)

type IPay interface {
	// Callback 支付完成后的回调
	Callback(c *gin.Context) (orderSn string, err error)
	// OrderInfo 查找订单信息
	OrderInfo() error
	// ReplyContent 回复给上游的相应内容
	ReplyContent() string
}

// Dispatch 匹配支付方式
func Dispatch(payChannel string) (IPay, error) {
	payChannel = strings.ToUpper(payChannel)
	switch payChannel {
	case "SY":
		return NewSYPay(), nil
	default:
		return nil, errors.New("支付方式为找到")
	}
}
