package com.jeesharp.business.modules.member.service.impl;

import cn.hutool.core.util.StrUtil;
import com.jeesharp.business.modules.member.entity.AppIapOrder;
import com.jeesharp.business.modules.member.mapper.AppIapOrderMapper;
import com.jeesharp.business.modules.member.service.AppIapOrderService;
import com.jeesharp.business.modules.member.vo.AppIapOrderQueryVO;
import com.jeesharp.framework.mybatis.core.service.CrudService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * IAP 业务订单领域服务实现
 *
 * @author jeesharp
 */
@Service
@Transactional
public class AppIapOrderServiceImpl extends CrudService<AppIapOrderMapper, AppIapOrder, AppIapOrderQueryVO>
    implements AppIapOrderService {

    @Override
    public AppIapOrder getByOrderNo(String orderNo) {
        if (StrUtil.isBlank(orderNo)) {
            return null;
        }
        return baseMapper.selectByOrderNo(orderNo);
    }

    @Override
    public AppIapOrder getByPurchaseToken(String purchaseToken) {
        if (StrUtil.isBlank(purchaseToken)) {
            return null;
        }
        return baseMapper.selectByPurchaseToken(purchaseToken);
    }

    @Override
    public AppIapOrder getByHuaweiPurchaseOrderId(String huaweiPurchaseOrderId) {
        if (StrUtil.isBlank(huaweiPurchaseOrderId)) {
            return null;
        }
        return baseMapper.selectByHuaweiPurchaseOrderId(huaweiPurchaseOrderId);
    }
}
