package cokr.xit.ens.modules.common.ctgy.mblpage.presentation;

import cokr.xit.ens.core.utils.CmmnUtil;
import cokr.xit.ens.modules.common.ctgy.intgrnbill.support.entity.Bill;
import cokr.xit.ens.modules.common.domain.SendMast;
import com.google.gson.Gson;
import org.springframework.beans.factory.annotation.Value;

import java.util.HashMap;
import java.util.Map;


public abstract class MblPageControllerSupport {
    private Gson gson = new Gson();
    @Value("${xit.mblpage.payinf.host}")
    private String payInfHost;

    /**
     * 페이버튼 결제정보
     *
     * @param bill
     * @param sendMast
     * @return
     */
    protected String getJsonPayBtnInf(Bill bill, SendMast sendMast) {
        if (CmmnUtil.isEmpty(bill))
            return null;

        Map<String, String> payBtnInf = new HashMap<>();
        payBtnInf.put("billUid", bill.getBillUid());
        payBtnInf.put("billSe", bill.getBillSeCd().getCode());
        payBtnInf.put("postSe", sendMast.getPostSe().getCode());
        payBtnInf.put("payInfHost", payInfHost);

        return gson.toJson(payBtnInf);
    }
}
