var APIBase = require("../../api.base");
var system = require("../../../system");

class TestAPI extends APIBase {
  constructor() {
    super();
    this.orderSve = system.getObject("service.saas.orderSve");
  }

  async statusNotify(pobj, query, req) {
    if (!pobj.source_no) {
      return system.getResult(null, "订单号不存在");
    }
    if (pobj.status == "1190") {
      let data = {
        id: pobj.source_no,
        sve_deliver_express_no: pobj.guest_mail_no,
        sve_deliver_express_img: pobj.guest_mail_img
      };
      // 客户交付
      return await this.orderSve.sveDeliver(data);
    } else if (pobj.status == "1000000") {
      let data = {
        id: pobj.source_no,
        sve_businessmen_company_id: pobj.company_id,
        sve_businessmen_customer_id: pobj.customer_id,
        sve_businessmen_name: pobj.name,
        sve_businessmen_credit_code: pobj.credit_code,
      };
      // 客户交付
      return await this.orderSve.sveBusinessmen(data);
    }
    return pobj;
  }

  exam() {
    return "";
  }

  classDesc() {
    return {
      groupName: "",
      groupDesc: "",
      name: "",
      desc: "",
      exam: "",
    };
  }

  methodDescs() {
    return [
      {
        methodDesc: "",
        methodName: "",
        paramdescs: [
          {
            paramDesc: "",
            paramName: "",
            paramType: "",
            defaultValue: "",
          }
        ],
        rtnTypeDesc: "",
        rtnType: ""
      }
    ];
  }
}

module.exports = TestAPI;