package org.jeecg.modules.apiservice.impl;

import org.jeecg.common.api.vo.Result;
import org.jeecg.modules.apiservice.OrderApiService;
import org.jeecg.modules.pay.MpWxPayService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.math.BigDecimal;


@Service
public class OrderApiServiceImpl implements OrderApiService {


    //支付接口
    @Autowired
    private MpWxPayService mpWxPayService;



    //创建订单
    @Override
    public Result<?> createOrder()
    {
        return null;
    }

    //立即支付
    @Override
    public Result<?> payOrder()
    {

        String s = new BigDecimal(0.01).multiply(new BigDecimal(100)).toString();
        int i1 = Double.valueOf(s).intValue();
        Object appOrder = mpWxPayService.createOrder(
                "购买测试" ,
                "127.0.0.1",
                System.currentTimeMillis()+"",
                i1,
                System.currentTimeMillis()+"",
                "ozfsp7eFo_CvJdX5jl5fi4pR5AhI",
                "{}");
        //返回支付结果
        return Result.OK("微信支付回调成功",appOrder);
    }





}
