package com.iformall.service.msg.impl;

import com.alibaba.fastjson.JSON;
import com.iformall.domain.po.msg.BaseMsg;
import com.iformall.domain.po.msg.FmInsideNotifyPaySuccessMsg;
import com.iformall.enums.EnumPayWay;
import com.iformall.service.WxPayOrderService;
import com.iformall.service.msg.MsgSendService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Map;

/**
 *
 * @author Stormeye Wu
 * @date 2019/5/10
 */
@Service
public class FmInsideNotifyPaySuccessMsgServiceImpl implements MsgSendService {
    private final Logger logger = LoggerFactory.getLogger(this.getClass());

    @Autowired
    private WxPayOrderService wxPayOrderService;

    @Override
    public void send(BaseMsg baseMsg) throws Exception {
        FmInsideNotifyPaySuccessMsg msg = (FmInsideNotifyPaySuccessMsg)baseMsg;
        Map<String, String> paramMap = JSON.parseObject(msg.getJsonMsg(), Map.class);
        wxPayOrderService.notify(paramMap, EnumPayWay.getEnum(msg.getPayWay()));
    }
}
