package com.jeesharp.business.pay.adapter;

import com.jeesharp.business.modules.food.application.FoodBookingOrderApplicationService;
import com.jeesharp.business.modules.food.dto.FoodConfirmPayDTO;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;

/**
 * 美食团购微信支付成功回调 → {@link FoodBookingOrderApplicationService#confirmPaySuccess}（含券核销、统一单同步）。
 *
 * @author jeesharp
 * @since 2026-06-09
 */
@Service
@AllArgsConstructor
public class FoodWechatPayCallbackAdapter implements WechatPayCallbackAdapter {

    private final FoodBookingOrderApplicationService foodBookingOrderApplicationService;

    @Override
    public MobilePayBizType bizType() {
        return MobilePayBizType.FOOD;
    }

    /** 美食团购支付成功确认：委托应用层核销冻券并同步统一单。 */
    @Override
    public void confirm(String orderId, String payOrderId, String thirdPartyTradeNo) {
        FoodConfirmPayDTO dto = new FoodConfirmPayDTO();
        dto.setOrderId(orderId);
        dto.setPayOrderId(payOrderId);
        dto.setThirdPartyTradeNo(thirdPartyTradeNo);
        foodBookingOrderApplicationService.confirmPaySuccess(dto);
    }
}
