package cn.pluss.platform.util;

import java.util.HashMap;
import java.util.Map;

import com.alipay.api.AlipayApiException;
import com.alipay.api.AlipayClient;
import com.alipay.api.DefaultAlipayClient;
import com.alipay.api.request.AlipayOpenAgentCreateRequest;
import com.alipay.api.response.AlipayOpenAgentCreateResponse;

public class AliMerchantBatchNoUtil {

	private static final String PRIVATE_KEY_STRING = "MIIEvAIBADANBgkqhkiG9w0BAQEFAASCBKYwggSiAgEAAoIBAQCN1NubOHroItIz7eLWWBDprPzToDr1cggn/V90ghPaoBWgmnZhD/CejX+KxHmQVQLEBVN6ehQgNSVGBj0hSHxkj1OCCU7Eu9qAIqRzkWY1RkZKoKOIcJbU+yL20XTs3kATgNm5jx8ejVQDsNqekS1bBrRX6xlU/mjMVFtKoZC/Vpv8yAmP6R9onkum4O0OgCWARKC40NuYVp9hPUgRpWJ/NIPSlO4j8zIPYFkjfsh84c8moVLZdhYDDbbEY3vnHutDa0A3d5f4MI4qXBZ6tW5wO5WG93U5E5jat73RUzBOc0zN+3U/Rsk+gq722ChLj4/ifp0NLqgjbKecs4wlM8A3AgMBAAECggEAQ1QjuAjU17QIA1zPTR9bUAKttqyesHukgY9XLBC/6g4KlkYdIjCV8j6LqE1iw/CHMpSwrziaqztvaVF23YDyhC5B3z4Z5Wyj6iYH2VDRq0KkBbNCTnfcMljRnUeLcRKEan3FXcAibrd6hZIEBjg2xrplDENvsBhhmXYGLGSMOTfoRFlc1DhvPdr3qxR9mljD2YcvIrxDVDPZ3P4wTcsIM6xZmXGrsFbI0sGxgm4a4fzMLUYxSvuMtc+auwasQ/393Le/kjdVBWr/hBJZbGIU5/NQN0EesOJD6dIFU07wDDuy4LYLVVjSN3EiynWfMJIrvLbnR1sMgKJ775wY61hIaQKBgQC/mFKwZdZvzsqnEMQmUfkUT5+v8BJvS4JApPpt+O2GMUAKoynk220U0rJW/QyEkTz6A/lR8ZStT6TyM14ulpOYDMJquZqSCoIHMrIdjhZRMqAVONUJHsYVvpLQLbJaDDEaCksnWE+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lwWerVucDuVhvd1OROY2re90VMwTnNMzft1P0bJPoKu9tgoS4+P4n6dDS6oI2ynnLOMJTPANwIDAQAB";
	public static void getBatchNo() {
		
		Map<String, Object> dataMap = new HashMap<String, Object>();
		
		
		
		
		
		
		
		
		
		AlipayClient alipayClient = new DefaultAlipayClient("https://openapi.alipay.com/gateway.do","2019092467786259",PRIVATE_KEY_STRING,"json","GBK",PUBLIC_KEY_STRING,"RSA2");
		AlipayOpenAgentCreateRequest request = new AlipayOpenAgentCreateRequest();
		request.setBizContent("{" +
		"\"account\":\"test@alipay.com\"," +
		"\"contact_info\":{" +
		"\"contact_name\":\"张三\"," +
		"\"contact_mobile\":\"18866668888\"," +
		"\"contact_email\":\"zhangsan@alipy.com\"" +
		"    }," +
		"\"order_ticket\":\"00ee2d475f374ad097ee0f1ac223fX00\"" +
		"  }");
		AlipayOpenAgentCreateResponse response = null;
		try {
			response = alipayClient.execute(request);
		} catch (AlipayApiException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
			System.out.println(e.getMessage());
		}
		if(response.isSuccess()){
		System.out.println("调用成功："+response.getBatchNo());
		} else {
		System.out.println("调用失败");

	}
}
}
