package ppos

import (
	"PPOSUtils/utils"
)

//NewJwtUnion 令牌：联盟商户子系统
func NewJwtUnion() *wtUnion {
	return &wtUnion{}
}

type wtUnion struct {
	JwtCompany
}

func (that *wtUnion) init() {
	if that.paramsMp == nil {
		that.JwtCompany.init()
	}
}

//生成应用令牌
func (that *wtUnion) CreateJwt(params ...utils.Mp) (string, error) {
	//
	that.init()
	_jwtString, _err := that.JwtCompany.CreateJwt(params...)
	if _err != nil {
		return "", _err
	}
	return _jwtString, nil
}

func (that *wtUnion) ParseParams() (utils.Mp, error) {
	//
	that.init()
	if _, _err := that.JwtCompany.ParseParams(); _err != nil {
		return nil, _err
	}
	return that.paramsMp, nil
}
