package com.hzs.retail.sale.provider;

import com.hzs.common.core.domain.R;
import com.hzs.retail.sale.IRetailOrderServiceApi;
import com.hzs.retail.sale.controller.service.IRetailOrderService;
import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired;

/**
 * 新零售订单dubbo服务
 */
@Slf4j
@DubboService
public class RetailOrderServiceProvider implements IRetailOrderServiceApi {

    @Autowired
    private IRetailOrderService iRetailOrderService;

    @Override
    public R<?> onlinePaymentCallBack(Long pkMember, String orderCode) {
        try {
            String str = iRetailOrderService.onlinePaymentCallBack(pkMember, orderCode);
            if (null == str) {
                return R.ok();
            }
            return R.fail(str);
        } catch (Exception e) {
            log.error("支付回调订单处理异常. pkMember: {}, orderCode: {}", pkMember, orderCode, e);
            return R.fail("订单回调处理异常：" + e.getMessage());
        }
    }

}
