资源简介

基于Eclipse编写的在线支付软件,该软件可对接易宝支付网站,完成在线支付功能。

资源截图

代码片段和文件信息

package com.jnu.agchen.servlet;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.jnu.agchen.util.ConfigInfo;
import com.jnu.agchen.util.PaymentUtil;

public class PaymentRequest extends HttpServlet {

public void doGet(HttpServletRequest request HttpServletResponse response)
throws ServletException IOException {
this.doPost(request response);
}

public void doPost(HttpServletRequest request HttpServletResponse response)
throws ServletException IOException {

request.setCharacterEncoding(“gbk“);

//接收用户输入的信息,生成发给易宝支付网关的请求信息
String p0_Cmd = “Buy“; //业务类型,在线支付固定为Buy
String p1_MerId = ConfigInfo.getValue(“p1_MerId“); //商户编号
String p2_Order = request.getParameter(“orderid“); //商户订单号
String p3_Amt = request.getParameter(“account“); //支付金额
String p4_Cur = “CNY“; //交易币种人民币CNY
String p5_Pid = ““; //商品名称
String p6_Pcat = ““; //商品种类
String p7_Pdesc = ““; //商品描述
String p8_Url = ConfigInfo.getValue(“p8_Url“); //商户接收支付成功数据的地址
String p9_SAF = “0“; //需要填写送货地址 0:不需要 1:需要
String pa_MP = ““; //商户扩展信息
String pd_FrpId = request.getParameter(“pd_FrpId“); //银行编码
String pr_NeedResponse = “0“; //应答机制 0:不需要应答机制 1:需要应答机制
String keyValue = ConfigInfo.getValue(“keyValue“); //商户密钥

String hmac = PaymentUtil.buildHmac(p0_Cmd p1_MerId p2_Order p3_Amt p4_Cur p5_Pid p6_Pcat p7_Pdesc 
p8_Url p9_SAF pa_MP pd_FrpId pr_NeedResponse keyValue); //MD5-HMAC验证码

//将所有的信息放到request范围内,将填入到发送到支付网关的Form中
request.setAttribute(“p0_Cmd“ p0_Cmd);
request.setAttribute(“p1_MerId“ p1_MerId);
request.setAttribute(“p2_Order“ p2_Order);
request.setAttribute(“p3_Amt“ p3_Amt);
request.setAttribute(“p4_Cur“ p4_Cur);
request.setAttribute(“p5_Pid“ p5_Pid);
request.setAttribute(“p6_Pcat“ p6_Pcat);
request.setAttribute(“p7_Pdesc“ p7_Pdesc);
request.setAttribute(“p8_Url“ p8_Url);
request.setAttribute(“p9_SAF“ p9_SAF);
request.setAttribute(“pa_MP“ pa_MP);
request.setAttribute(“pd_FrpId“ pd_FrpId);
request.setAttribute(“pr_NeedResponse“ pr_NeedResponse);
request.setAttribute(“keyValue“ keyValue);
request.setAttribute(“hmac“ hmac);

request.getRequestDispatcher(“/connection.jsp“).forward(request response);
}
}

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件       1231  2010-08-18 13:11  PaymentSimple\.project

     文件       2801  2010-08-18 14:56  PaymentSimple\src\com\jnu\agchen\servlet\PaymentRequest.java

     文件       4063  2010-08-18 15:31  PaymentSimple\src\com\jnu\agchen\servlet\PaymentResultResponse.java

     文件       2611  2010-08-18 07:43  PaymentSimple\src\com\jnu\agchen\util\DigestUtil.java

     文件       4062  2010-08-18 15:14  PaymentSimple\src\com\jnu\agchen\util\PaymentUtil.java

     文件        578  2010-08-18 12:27  PaymentSimple\src\com\jnu\agchen\util\ConfigInfo.java

     文件        422  2010-08-18 14:03  PaymentSimple\src\merchantInfo.properties

     文件       2521  2010-08-18 14:56  PaymentSimple\WebRoot\WEB-INF\classes\com\jnu\agchen\servlet\PaymentRequest.class

     文件       3470  2010-08-18 15:31  PaymentSimple\WebRoot\WEB-INF\classes\com\jnu\agchen\servlet\PaymentResultResponse.class

     文件       2873  2010-08-18 12:39  PaymentSimple\WebRoot\WEB-INF\classes\com\jnu\agchen\util\DigestUtil.class

     文件       2296  2010-08-18 15:14  PaymentSimple\WebRoot\WEB-INF\classes\com\jnu\agchen\util\PaymentUtil.class

     文件        856  2010-08-18 12:39  PaymentSimple\WebRoot\WEB-INF\classes\com\jnu\agchen\util\ConfigInfo.class

     文件        422  2010-08-18 14:03  PaymentSimple\WebRoot\WEB-INF\classes\merchantInfo.properties

     文件       1226  2010-08-18 13:55  PaymentSimple\WebRoot\WEB-INF\web.xml

     文件         39  2010-08-18 06:59  PaymentSimple\WebRoot\meta-INF\MANIFEST.MF

     文件       3598  2010-08-18 13:33  PaymentSimple\WebRoot\index.jsp

     文件       1907  2010-08-18 15:32  PaymentSimple\WebRoot\connection.jsp

     文件        294  2010-08-18 15:29  PaymentSimple\WebRoot\paymentresult.jsp

     文件        312  2010-08-18 06:59  PaymentSimple\.mymetadata

     文件        340  2010-08-18 06:59  PaymentSimple\.classpath

     文件        107  2010-08-18 12:39  PaymentSimple\.settings\org.eclipse.core.resources.prefs

     目录          0  2010-08-18 07:01  PaymentSimple\WebRoot\WEB-INF\classes\com\jnu\agchen\servlet

     目录          0  2010-08-18 07:24  PaymentSimple\WebRoot\WEB-INF\classes\com\jnu\agchen\util

     目录          0  2010-08-18 07:01  PaymentSimple\WebRoot\WEB-INF\classes\com\jnu\agchen

     目录          0  2010-08-18 07:01  PaymentSimple\src\com\jnu\agchen\servlet

     目录          0  2010-08-18 07:24  PaymentSimple\src\com\jnu\agchen\util

     目录          0  2010-08-18 07:01  PaymentSimple\WebRoot\WEB-INF\classes\com\jnu

     目录          0  2010-08-18 07:01  PaymentSimple\src\com\jnu\agchen

     目录          0  2010-08-18 07:01  PaymentSimple\WebRoot\WEB-INF\classes\com

     目录          0  2010-08-18 07:01  PaymentSimple\src\com\jnu

............此处省略13个文件信息

评论

共有 条评论