package com.jeesharp.business.modules.pay.application.api;

import com.jeesharp.business.modules.pay.api.PayCenterApi;
import com.jeesharp.business.modules.pay.dto.BasicPayOrderData;
import com.jeesharp.business.modules.pay.dto.PayWechatPrepayRouteSnapshotDTO;
import com.jeesharp.business.modules.pay.listener.upevent.PayOrderService;
import com.jeesharp.business.modules.pay.vo.PayWechatPublicConfigVO;
import com.jeesharp.business.modules.pay.vo.WechatJsapiPrepayVO;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;

import java.util.Map;

/**
 * {@link PayCenterApi} 实现，委托支付中心领域服务 {@link PayOrderService}。
 *
 * @author jeesharp
 * @since 2026-06-12
 */
@Service
@AllArgsConstructor
public class PayCenterApiImpl implements PayCenterApi {

    private final PayOrderService payOrderService;

    @Override
    public WechatJsapiPrepayVO wechatJsapiPrepay(BasicPayOrderData payOrderData) {
        return payOrderService.wechatJsapiPrepay(payOrderData);
    }

    @Override
    public PayWechatPrepayRouteSnapshotDTO previewWechatJsapiRoute(BasicPayOrderData payOrderData) {
        return payOrderService.previewWechatJsapiRoute(payOrderData);
    }

    @Override
    public PayWechatPublicConfigVO getWechatPublicConfig() {
        return payOrderService.getWechatPublicConfig();
    }

    @Override
    public PayWechatPublicConfigVO getWechatPublicConfig(String tenantId) {
        return payOrderService.getWechatPublicConfig(tenantId);
    }

    @Override
    public Map<String, Object> wechatParsePayNotify(String rawBody, Map<String, String> headers) {
        return payOrderService.wechatParsePayNotify(rawBody, headers);
    }
}
