packages/wx-abc/lib/pay.js
function xml2json(method, body){
  body = util.xml2json(body);

  if(body.return_code!=='SUCCESS'){
    throw new Error(util.format('api error to call %s: %s', method, body.return_msg));
  }
  if(body.result_code!=='SUCCESS'){
    throw new Error(util.format('business error to call %s: %s %s', method, body.err_code, body.err_code_des));
  }
  return body;
}
function xml2json(method, body){
  body = util.xml2json(body);

  if(body.return_code!=='SUCCESS'){
    throw new Error(util.format('api error to call %s: %s', method, body.return_msg));
  }
  if(body.result_code!=='SUCCESS'){
    throw new Error(util.format('business error to call %s: %s %s', method, body.err_code, body.err_code_des));
  }
  return body;
}
function xml2json ( method , body ) { body = util . xml2json ( body ) ; if ( body . return_code !== 'SUCCESS' ) { throw new Error ( util . format ( 'api error to call %s: %s' , method , body . return_msg ) ) ; } if ( body . result_code !== 'SUCCESS' ) { throw new Error ( util . format ( 'business error to call %s: %s %s' , method , body . err_code , body . err_code_des ) ) ; } return body ; }
convert response xml to json
convert response xml to json