package com.nq;
|
|
import com.nq.common.ServerResponse;
|
import com.nq.pay.PayUtil;
|
import com.nq.utils.timeutil.DateTimeUtil;
|
import com.nq.utils.http.HttpClientUtil;
|
import com.nq.utils.SignAPI;
|
import com.nq.utils.SignUtil;
|
import org.apache.commons.collections.map.HashedMap;
|
|
import java.util.Map;
|
|
import static com.nq.utils.timeutil.DateTimeUtil.STANDARD_FORMAT;
|
|
public class Text {
|
public static void main(String[] args) {
|
|
}
|
|
|
public ServerResponse rechargMethodTop3(String ordersn, String payAmt){
|
Map<String,String> map = new HashedMap();
|
map.put("version","1.0");
|
map.put("mch_id","400019556");
|
map.put("notify_url","http://www.jumptalk.net:8091/api/pay/flyNotify.do");
|
map.put("mch_order_no",ordersn);
|
map.put("pay_type","122");
|
map.put("trade_amount",payAmt);
|
map.put("order_date", DateTimeUtil.getCurrentDate(STANDARD_FORMAT));
|
map.put("goods_name","充值");
|
String signStr = SignUtil.sortData(map);
|
map.put("sign_type","MD5");
|
try {
|
map.put("sign", SignAPI.sign(signStr, PayUtil.DOWN_TOKEN_TPO1));
|
String reponse = HttpClientUtil.doPost(PayUtil.PAY_DOWN_ORDER_TOP1, map, "utf-8");
|
com.alibaba.fastjson.JSONObject object = com.alibaba.fastjson.JSONObject.parseObject(reponse);
|
if(object.getString("respCode").equals("SUCCESS")){
|
return ServerResponse.createBySuccess(object.getString("payInfo"));
|
}else {
|
return ServerResponse.createBySuccessMsg("Contact customer service");
|
}
|
}catch (Exception e){
|
e.printStackTrace();
|
}
|
return ServerResponse.createByError();
|
}
|
}
|