var APIBase = require("../../api.base");
var system = require("../../../system");
const Client = require('aliyun-api-gateway').Client;
const client = new Client('203756933','1hxwkxz2tyn80i3ucrdbchru59zpxibz');

class TradeTransferAPI extends APIBase {
    constructor() {
        super();
        this.tradetransferSve= system.getObject("service.transfer.tradetransferSve");
    }
    async acceptOrder(pobj, query) {
        return await this.tradetransferSve.createtransfer(pobj);
    }
    async closeOrder(pobj, query) {
        return await this.tradetransferSve.orderclose(pobj);

    }
    async queryOrderState(pobj, query) {
        return await this.tradetransferSve.ordersel(pobj);
    }
    async test(pobj, query){
        var url = 'http://jaxiya.gongsibao.com/orders/status';

        var result = await client.post(url, {
          data:{
            "BizId":"dd541635415234345",
            "UserName":"tom",
            "Mobile":"15900152417",
            "RegisterNumber":"1525555",
            "Classification":"02",
            "Price":"5000"
        },
          headers: {
            accept: 'application/json'
          }
        });
      
        console.log(JSON.stringify(result));
    }
    exam() {
        return "xxx";
    }
    classDesc() {
        return {
            groupName: "auth",
            groupDesc: "认证相关的包",
            name: "AccessAuthAPI",
            desc: "关于认证的类",
            exam: "",
        };
    }
    methodDescs() {
        return [
            {
                methodDesc: "生成访问token",
                methodName: "getAccessKey",
                paramdescs: [
                    {
                        paramDesc: "访问appkey",
                        paramName: "appkey",
                        paramType: "string",
                        defaultValue: "x",
                    },
                    {
                        paramDesc: "访问secret",
                        paramName: "secret",
                        paramType: "string",
                        defaultValue: null,
                    }
                ],
                rtnTypeDesc: "xxxx",
                rtnType: "xxx"
            }
        ];
    }
}
module.exports = TradeTransferAPI;