package com.java.sdk.demo;
import com.alipay.v3.ApiException;
import com.alipay.v3.ApiClient;
import com.alipay.v3.util.model.AlipayConfig;
import com.alipay.v3.Configuration;
import com.alipay.v3.api.AlipayOpenAgentSignstatusApi;
import com.alipay.v3.model.*;
import java.io.File;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class AlipayOpenAgentSignstatusApiQuery {
public static void main(String[] args) throws ApiException {
ApiClient defaultClient = Configuration.getDefaultApiClient();
// 初始化alipay参数(全局设置一次)
AlipayConfig alipayConfig = new AlipayConfig();
alipayConfig.setServerUrl("https://openapi.alipay.com");
alipayConfig.setAppId("<-- 请填写您的AppId,例如:2019091767145019 -->");
alipayConfig.setPrivateKey("<-- 请填写您的应用私钥,例如:MIIEvQIBADANB ... ... -->");
alipayConfig.setAlipayPublicKey("<-- 请填写您的支付宝公钥,例如:MIIBIjANBg... -->");
defaultClient.setAlipayConfig(alipayConfig);
AlipayOpenAgentSignstatusApi api = new AlipayOpenAgentSignstatusApi();
AlipayOpenAgentSignstatusQueryModel data = new AlipayOpenAgentSignstatusQueryModel();
List<String> productCodes = new ArrayList<String>();
productCodes.add("I1011000100000000001");
data.setProductCodes(productCodes);
data.setPid("支付宝账号:2088123451234543或手机号:13811111111或邮箱:123@xxx.com");
try {
AlipayOpenAgentSignstatusQueryResponseModel response = api.query(data);
} catch (ApiException e) {
AlipayOpenAgentSignstatusQueryDefaultResponse errorObject = (AlipayOpenAgentSignstatusQueryDefaultResponse) e.getErrorObject();
System.out.println("调用失败:" + errorObject);
}
}
}