package com.iformall.service.msg.impl;

import com.alibaba.fastjson.JSON;
import com.iformall.domain.po.msg.BaseMsg;
import com.iformall.domain.po.msg.FmInsideNotifyRefundSuccessMsg;
import com.iformall.enums.EnumPayWay;
import com.iformall.service.WxRefundOrderService;
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 FmInsideNotifyRefundSuccessMsgServiceImpl implements MsgSendService {
    private final Logger logger = LoggerFactory.getLogger(this.getClass());

    @Autowired
    private WxRefundOrderService wxRefundOrderService;

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