package com.fs.ybPay;

import com.fs.ybPay.domain.*;
import com.fs.ybPay.dto.*;
import com.fs.ybPay.service.impl.PayServiceImpl;

public class Test {
    public static void main(String[] args) {
        //测试

        createWx();
    }


    //创建支付宝订单
    public static void createZFb(){
        PayServiceImpl payService = new PayServiceImpl();
        ZfbJspayDTO order = new ZfbJspayDTO();
        // 使用setter方法为字段赋值
        order.setLowOrderId("zfb0001223566");
        order.setPayMoney("0.01");
        order.setBody("测试付款");
        order.setPayType("1");
        CreateZfbOrderResult zfbOrder = payService.createZfbOrder(order);
        System.out.println(zfbOrder);
    }

    //查询退款
    public static void getTui(){
        PayServiceImpl payService = new PayServiceImpl();
        RefundOrderDTO o = new RefundOrderDTO();
        o.setRefundNo("refund-1731578492836904960");
        QueryRefundResult refundOrder = payService.getRefundOrder(o);
        System.out.println(refundOrder);
    }
    //查询退款列表
    public static void getTuiList(){
        PayServiceImpl payService = new PayServiceImpl();
        RefundOrderListDTO o = new RefundOrderListDTO();
        o.setUpOrderId("917271927265854791681");
        QueryRefundListResult refundOrderList = payService.getRefundOrderList(o);

        System.out.println(refundOrderList);
    }

    //退款
    public static void tui(){
        PayServiceImpl payService = new PayServiceImpl();
        RefundDTO refundDTO = new RefundDTO();
        refundDTO.setLowRefundNo("tui-91733054684819755008");
        refundDTO.setUpOrderId("91733054684819755008");
        refundDTO.setRefundMoney("30");
        RefundResult refund = payService.refund(refundDTO);
        System.out.println(refund);
    }


    //获取订单信息
    public static void get(){
        PayServiceImpl payService = new PayServiceImpl();
        OrderQueryDTO o = new OrderQueryDTO();
      // o.setLowOrderId("inquiry-1733054674619072512");
        o.setUpOrderId("91734436706075152384");
        OrderResult order = payService.getOrder(o);
        System.out.println(order.getMessage());
        System.out.println(order);
    }
    //创建微信订单
    public static void createWx(){
        PayServiceImpl payService = new PayServiceImpl();
        WxJspayDTO p = new WxJspayDTO();
        // 使用setter方法为对象赋值
        p.setPayMoney("0.01");
        p.setLowOrderId("orderWx123456122111");
        p.setBody("商品描述");
       // p.setIsMinipg("1");
    //    p.setReturnUrl("http://dp2xf5.natappfree.cc/his/pay/xcx");
        p.setOpenId("oQzLO5QdScJTk7JQyXoD2Qi4bcFk");
        p.setAttach("附加信息");
      //  p.setStoreid("0");
        CreateWxOrderResult wxOrder = payService.createWxOrder(p);
        System.out.println(wxOrder);
    }

}
