package card_info_jd

import (
	"context"
	"kami/internal/consts"
	"kami/internal/service"

	"kami/api/card_info_jd/v1"
)

func (c *ControllerV1) JDConfigSet(ctx context.Context, req *v1.JDConfigSetReq) (res *v1.JDConfigSetRes, err error) {
	err = service.SysConfigDict().SetIsAllowRedeemCardDifferentAmount(ctx, consts.CardRedeemAccountCategoryWalMart, req.IsAllowDifferentAmount)
	err = service.SysConfigDict().SetRedeemCardMinAmount(ctx, consts.CardRedeemAccountCategoryWalMart, req.RedeemCardMinAmount)
	err = service.SysConfigDict().SetRedeemCardFailCallbackIsAllow(ctx, consts.CardRedeemAccountCategoryWalMart, req.IsAllowDifferentSucceedCallback)
	err = service.SysConfigDict().SetRedeemCardSucceedCallbackIsAllow(ctx, consts.CardRedeemAccountCategoryWalMart, req.IsAllowDifferentFailCallback)
	err = service.SysConfigDict().SetRedeemCardCompensatedAutoCallback(ctx, consts.CardRedeemAccountCategoryWalMart, req.IsAllowCompensatedCallback)
	service.SysConfigDict().SetRedeemCardRate(ctx, consts.CardRedeemAccountCategoryWalMart, req.RedeemCardRate)
	return
}
