package bus

import (
	"context"
	"fmt"
	"pay/db/model"

	"infish.cn/comm/pay"
)

const (
	ALIPAY    = 0
	WECHATPAY = 1
	SINGLE    = 0
	MULTI     = 1
)

type PayInf interface {
	Pay(context.Context, *pay.OrderMsg) (interface{}, error)
	Close(context.Context, *pay.OrderMsg) (bool, error)
	ReFundPay(ctx context.Context, refund *model.ReFund) (interface{}, error)
	ReFundQuery(ctx context.Context, refund *model.ReFund) (interface{}, error)
}

func PayMod(payType int, category int) PayInf {
	if category == SINGLE && payType == ALIPAY {
		fmt.Println("=================single aplipay====================")
		return NewSingleAliPay()
	} else if category == SINGLE && payType == WECHATPAY {
		fmt.Println("=================single wechat====================")
		return NewSingleWechatPay()

	} else if category == MULTI && payType == ALIPAY {
		fmt.Println("=================multi aplipay====================")
		return NewMutliAliPay()

	} else if category == MULTI && payType == WECHATPAY {
		fmt.Println("=================multi wechat====================")
		return NewMutliWechatPay()
	}
	return nil
}
