| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- package openapi.tools.nuonuo;
- import net.sf.json.JSONObject;
- import nuonuo.open.sdk.NNOpenSDK;
- import java.util.UUID;
- /**
- * 请求Api
- * <p>
- * 【这是一个Eclipse工程, JDK支持1.7+】
- */
- public class OpenApi {
- public static String appKey = "10509984";
- public static String taxnum = "339901999999500";
- public static String appSecret = "CAFB9D5A7E2141C3";
- public static String token = "370743d065d1e97e3c124315wjiqpvai";
- /**
- * 请求开放平台api
- * <p>
- * 请求地址, 详见 https://open.nuonuo.com/#/dev-doc/sdk-usage
- */
- public JSONObject requestApi(String method, String content) {
- // 参数配置
- // String taxnum = "339901999999821";//授权企业税号, 商户填""
- // String appKey = "SD79341075";
- // String appSecret = "SDAE0618F8514F14";
- // String method = "nuonuo.ElectronInvoice.requestBillingNew";
- // String token = "29a9a279edab1bb28e4cc40pigwd7sls";
- // String content = "填写API私有请求参数, 标准JSON格式";
- // String urhttps://www.chuanglan.com/control/loginl = "https://sdk.nuonuo.com/open/v1/services";// 票据识别请使用https://sdk.nuonuo.com/open/v2/ocr
- // String appSecret = "SDA63AFA88C6468C";
- //String url = "https://sandbox.nuonuocs.cn/open/v1/services";
- String url = "https://sdk.nuonuo.com/open/v1/services";
- String senid = UUID.randomUUID().toString().replace("-", ""); // 唯一标识,由企业自己生成32位随机码
- // 接口调用
- NNOpenSDK sdk = NNOpenSDK.getIntance();
- String json = sdk.sendPostSyncRequest(url, senid, appKey, appSecret, OpenToken.getMerchantToken(), taxnum, method, content);
- // 响应报文解析
- System.out.println("【API请求】");
- System.out.println(json);
- return JSONObject.fromObject(json);
- }
- }
|