package com.crm.pay.service.impl.pay;

import com.crm.pay.service.FinanceDepositService;
import com.crm.pay.service.TelegraphicPayService;
import com.crm.pay.service.impl.base.BasePayServiceImpl;
import com.crm.rely.backend.model.entity.finance.deposit.FinanceDepositAddEntity;
import com.crm.rely.backend.model.pojo.table.SysRemittanceChannelTable;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * @description:
 * @author: houn
 * @create: 2020-05-07 23:45
 */
@Slf4j
@Service
public class TelegraphicPayServiceImpl extends BasePayServiceImpl implements TelegraphicPayService {

    @Autowired
    private FinanceDepositService balanceService;

    @Override
    @Transactional(rollbackFor = Exception.class)
    public void pay(FinanceDepositAddEntity balanceSaveEntity) throws Exception {

        SysRemittanceChannelTable channel = getPayChannel(balanceSaveEntity.getPayType());

        balanceService.save(balanceSaveEntity, channel);
    }

}
