package controllers

import (
	"boss/internal/service"
	"strings"

	"github.com/beego/beego/v2/server/web"
)

type SendNotify struct {
	web.Controller
}

func (c *SendNotify) SendNotifyToMerchant() {
	ctx := c.Ctx.Request.Context()
	bankOrderId := strings.TrimSpace(c.GetString("bankOrderId"))
	se := new(service.SendNotifyMerchantService)
	keyDataJSON := se.SendNotifyToMerchant(ctx, bankOrderId)

	c.Data["json"] = keyDataJSON
	_ = c.ServeJSON()
}

func (c *SendNotify) SelfSendNotify() {
	ctx := c.Ctx.Request.Context()
	bankOrderId := strings.TrimSpace(c.GetString("bankOrderId"))

	se := new(service.SendNotifyMerchantService)
	keyDataJSON := se.SelfSendNotify(ctx, bankOrderId)
	c.Data["json"] = keyDataJSON
	_ = c.ServeJSON()
}
