package com.neusoft.smart.pos.payment.repository;

import com.neusoft.smart.pos.dto.payment.request.PostInitFacePayRequest;
import com.neusoft.smart.pos.payment.persistent.ext.domain.*;
import com.neusoft.smart.pos.payorder.persistent.domain.MchPayChannel;
import com.neusoft.smart.pos.payorder.persistent.domain.PayOrder;
import com.neusoft.smart.pos.payorder.persistent.domain.PayTypeDict;
import lombok.val;
import org.springframework.stereotype.Component;

/**
 * @author cy
 * @date 2020-02-12
 * @description 支付管理使用Repository
 */

@Component("emptyPayRepository")
public class EmptyPayRepository implements IThirdPayRepository {
    @Override
    public String createPayOrderToThirdPlatform(PayOrder payOrder, MchPayChannel mchPayChannel, PayTypeDict payTypeDict) {
        return "";
    }

    @Override
    public ThirdPlatformQueryOrder queryPayOrderFromThirdPlatform(PayOrder payOrder, MchPayChannel mchPayChannel) {
        return null;
    }

    @Override
    public ThirdPlatformCancelOrder cannelPayOrderFromThirdPlatform(PayOrder payOrder, MchPayChannel mchPayChannel) {
        val thirdPlatformCancelOrder = new ThirdPlatformCancelOrder();
        thirdPlatformCancelOrder.setMcode(payOrder.getMcode());
        thirdPlatformCancelOrder.setMOrderNumber(payOrder.getmOrderNumber());
        thirdPlatformCancelOrder.setPayType(payOrder.getPayType());
        thirdPlatformCancelOrder.setCancelStatus("1");
        return null;
    }

    @Override
    public ThirdPlatformRefundOrder refundPayOrderFromThirdPlatform(PayOrder payOrder, String refundNumber, Long refundAmount, MchPayChannel mchPayChannel, PayTypeDict payTypeDict) {
        val thirdPlatformOrder = new ThirdPlatformRefundOrder();
        thirdPlatformOrder.setMcode(payOrder.getMcode());
        thirdPlatformOrder.setMOrderNumber(payOrder.getmOrderNumber());
        thirdPlatformOrder.setPayType(payOrder.getPayType());
        thirdPlatformOrder.setRefundAmount(refundAmount);
        thirdPlatformOrder.setRefundStatus("2");
        return thirdPlatformOrder;
    }

    @Override
    public ThirdPlatformReverseOrder reversePayOrderFromThirdPlatform(PayOrder payOrder, String orderNumber, MchPayChannel mchPayChannel) {
        val thirdPlatformReverseOrder = new ThirdPlatformReverseOrder();
        thirdPlatformReverseOrder.setMcode(payOrder.getMcode());
        thirdPlatformReverseOrder.setMOrderNumber(orderNumber);
        thirdPlatformReverseOrder.setPayType(payOrder.getPayType());
        thirdPlatformReverseOrder.setReverseStatus("2");
        return thirdPlatformReverseOrder;
    }

    @Override
    public ThirdPlatformInitFacePay initFacePay(PostInitFacePayRequest initFacePayRequest, MchPayChannel mchPayChannel, PayTypeDict payTypeDict) {
        return null;
    }

    @Override
    public ThirdPlatformInitFacePay initFaceLive(PostInitFacePayRequest initFacePayRequest, MchPayChannel mchPayChannel, PayTypeDict payTypeDict) {
        return null;
    }

    @Override
    public boolean IsSupportPartialRefund() {
        return false;
    }
}
