接着上一篇博客,咱们暂时完成了手机端的部分支付代码,接下来,咱们继续写后台的代码。html
后台基本须要到如下几个参数,我都将他们写在了properties文件中:前端
AliPay.payURL = https://openapi.alipay.com/gateway.do
商户公钥
AliPay.publicKey = xxx // 支付宝公钥
AliPay.appId = xxx //APPid
AliPay.timeoutExpress = xxx 超时时间
AliPay.notifyUrl = http://xxx 异步通知地址,后台写的一个接口供支付宝服务器推送支付结果,前端的支付结果最终取决于支付宝推送的结果。java
附:在个人项目里,支付流程是这样子的
首先手机端选择商品、数量等信息,完成下单。此时,在数据库,有一条下单记录,该条记录在半小时内有效,用户需在半小时内完成支付,不然该笔交易将失败。在有效时间内,用户选择支付时,后台提供获取支付宝预付单的接口,手机端拿到预付单后,再调起支付宝发起支付,手机端支付完成后,再次调用后台的真实支付结果,最后展现给用户。ios
咱们的重点是支付,因此下单的接口就略过。下面:数据库
/** * 拉取支付宝预付单 */
@ValidatePermission(value = PermissionValidateType.Validate)
@Override
public BaseResult<Orders> getAliPay(BaseRequest<Orders> baseRequest)
{
LogUtil.debugLog(logger, baseRequest);
BaseResult<Orders> baseResult = new BaseResult<>();
Orders orders = baseRequest.getData(); // 获取订单的实体
Double price = orders.getOrderAmount();
if (price <= 0) // 一些必要的验证,防止抓包恶意修改支付金额
{
baseResult.setState(-999);
baseResult.setMsg("付款金额错误!");
baseResult.setSuccess(false);
return baseResult;
}
try
{
AlipayClient alipayClient = PayCommonUtil.getAliClient();
AlipayTradeAppPayRequest request = new AlipayTradeAppPayRequest();
AlipayTradeAppPayModel model = new AlipayTradeAppPayModel();
model.setOutTradeNo(orders.getId() + "");// 订单号。
model.setTimeoutExpress(PropertyUtil.getInstance().getProperty("AliPay.timeoutExpress"));// 设置未付款支付宝交易的超时时间,一旦超时,该笔交易就会自动被关闭。当用户进入支付宝收银台页面(不包括登陆页面),会触发即刻建立支付宝交易,此时开始计时。取值范围:1m~15d。m-分钟,h-小时,d-天,1c-当天(1c-当天的状况下,不管交易什么时候建立,都在0点关闭)。
// 该参数数值不接受小数点, 如 1.5h,可转换为 90m。
model.setTotalAmount("0.01");// 订单总金额,单位为元,精确到小数点后两位,取值范围[0.01,100000000]这里调试每次支付1分钱,在项目上线前应将此处改成订单的总金额
model.setProductCode("QUICK_MSECURITY_PAY");// 销售产品码,商家和支付宝签约的产品码,为固定值QUICK_MSECURITY_PAY
request.setBizModel(model);
request.setNotifyUrl(PropertyUtil.getInstance().getProperty("AliPay.notifyUrl")); // 设置后台异步通知的地址,在手机端支付成功后支付宝会通知后台,手机端的真实支付结果依赖于此地址
// 根据不一样的产品
model.setBody(xxx);// 对一笔交易的具体描述信息。若是是多种商品,请将商品描述字符串累加传给body。
model.setSubject("商品的标题/交易标题/订单标题/订单关键字等");
break;
// 这里和普通的接口调用不一样,使用的是sdkExecute
AlipayTradeAppPayResponse response = alipayClient.sdkExecute(request);
// 能够直接给客户端请求,无需再作处理。
orders.setAliPayOrderString(response.getBody());
baseResult.setData(orders);
} catch (Exception e)
{
e.printStackTrace();
baseResult.setState(-999);
baseResult.setMsg("程序异常!");
baseResult.setSuccess(false);
logger.error(e.getMessage());
}
return baseResult;
}
在上面一段代码中,咱们已经将支付宝服务端生成的预付单信息返回给了客户端,至此,客户端已经能够支付。支付结果支付宝将会异步给后台通知,下面是异步通知的代码:json
/** * 支付宝异步通知 */
@ValidatePermission
@RequestMapping(value = "/notify/ali", method = RequestMethod.POST, consumes = "application/json", produces = "text/html;charset=UTF-8")
@ResponseBody
public String ali(HttpServletRequest request)
{
Map<String, String> params = new HashMap<String, String>();
Map<String, String[]> requestParams = request.getParameterMap();
for (Iterator<String> iter = requestParams.keySet().iterator(); iter.hasNext();)
{
String name = (String) iter.next();
String[] values = requestParams.get(name);
String valueStr = "";
for (int i = 0; i < values.length; i++)
{
valueStr = (i == values.length - 1) ? valueStr + values[i] : valueStr + values[i] + ",";
}
logger.debug("name:" + name + " value:" + valueStr);
// 乱码解决,这段代码在出现乱码时使用。
// valueStr = new String(valueStr.getBytes("ISO-8859-1"), "utf-8");
params.put(name, valueStr);
}
// 切记alipaypublickey是支付宝的公钥,请去open.alipay.com对应应用下查看。
boolean flag = true; // 校验公钥正确性防止意外
try
{
flag = AlipaySignature.rsaCheckV1(params, PropertyUtil.getInstance().getProperty("AliPay.AliPay.publicKey"),
"utf-8", "RSA2");
} catch (AlipayApiException e)
{
e.printStackTrace();
}
if (flag)
{
Integer ordersId = Integer.parseInt(params.get("out_trade_no"));
String tradeStatus = params.get("trade_status");
Orders orders = new Orders();
orders.setId(ordersId);
orders.setPayWay("2"); // 支付方式为支付宝
// orders.setOrderState("1"); // 订单状态位已支付
switch (tradeStatus) // 判断交易结果
{
case "TRADE_FINISHED": // 完成
orders.setOrderState("1");
break;
case "TRADE_SUCCESS": // 完成
orders.setOrderState("1");
break;
case "WAIT_BUYER_PAY": // 待支付
orders.setOrderState("0");
break;
case "TRADE_CLOSED": // 交易关闭
orders.setOrderState("0");
break;
default:
break;
}
ordersService.updateByPrimaryKeySelective(orders); // 更新后台交易状态
}
SimpleDateFormat f = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
SimpleDateFormat f1 = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.S");
AlipayNotice alipayNotice = new AlipayNotice();
try // set一堆日期和属性
{
alipayNotice.setAppId(params.get("app_id"));
alipayNotice.setBody(params.get("body"));
alipayNotice.setBuyerId(params.get("buyer_id"));
alipayNotice.setBuyerLogonId(params.get("buyer_logon_id"));
alipayNotice.setBuyerPayAmount(Double.parseDouble(params.get("buyer_pay_amount")));
alipayNotice.setCharset(params.get("charset"));
alipayNotice.setFundBillList(params.get("fund_bill_list"));
alipayNotice.setGmtClose(f.parse(params.get("gmt_close")));
alipayNotice.setGmtCreate(f.parse(params.get("gmt_create")));
alipayNotice.setGmtPayment(f.parse(params.get("gmt_payment")));
alipayNotice.setGmtRefund(f1.parse(params.get("gmt_refund")));
alipayNotice.setNotifyTime(f.parse(params.get("notify_time")));
} catch (ParseException e)
{
PayCommonUtil.saveE("C\\logs\\aliParseException", e); // 因为须要在外网测试,因此将错误日志保存一下方便调试
logger.error("--------------------------------日期转换异常");
e.printStackTrace();
}
try
{
alipayNotice.setInvoiceAmount(Double.parseDouble(params.get("invoice_amount")));
alipayNotice.setNotifyId(params.get("notify_id"));
alipayNotice.setNotifyType(params.get("notify_type"));
alipayNotice.setOutBizNo(params.get("out_biz_no"));
alipayNotice.setOutTradeNo(params.get("out_trade_no"));
alipayNotice.setPassbackParams(params.get("passback_params"));
alipayNotice.setPointAmount(Double.parseDouble(params.get("point_amount")));
alipayNotice.setReceiptAmount(Double.parseDouble(params.get("receipt_amount")));
alipayNotice.setRefundFee(Double.parseDouble(params.get("refund_fee")));
alipayNotice.setSellerEmail(params.get("seller_email"));
alipayNotice.setSellerId(params.get("seller_id"));
alipayNotice.setSign(params.get("sign"));
alipayNotice.setSignType(params.get("sign_type"));
alipayNotice.setSubject(params.get("subject"));
alipayNotice.setTotalAmount(Double.parseDouble(params.get("total_amount")));
alipayNotice.setTradeNo(params.get("trade_no"));
alipayNotice.setTradeStatus(params.get("trade_status"));
alipayNotice.setVersion(params.get("version"));
alipayNotice.setVoucherDetailList(params.get("voucher_detail_list"));
alipayNotice.setCreateTime(new Date());
PayCommonUtil.saveLog("C\\logs\\支付宝实体类.txt", alipayNotice.toString());
int res = alipayNoticeMapper.insertSelective(alipayNotice); // 保存结果
PayCommonUtil.saveLog("C\\logs\\支付宝结果.txt", res + "");
return "success";
} catch (Exception e)
{
PayCommonUtil.saveE("C\\logs\\支付宝异常了.txt", e);
}
logger.debug("----------------------------执行到了最后!!!--------------");
return "success";
}
至此,支付宝支付的核心代码已完成。因为在外网调试,不少地方不太方便因此我只能将他们保存txt查看异常,若是有更好的办法请留言一块儿改进。api
这里用到了大量的工具类:(也包含了微信的工具类)我直接贴出来给你们作参考,也能够点击这里下载,(如今下载必须扣积分,积分多的能够直接下),有不足之处但愿你们提出来共同进步。服务器
package com.loveFly.utils;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.io.PrintWriter;
import java.io.StringWriter;
import java.io.UnsupportedEncodingException;
import java.net.ConnectException;
import java.net.URL;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Iterator;
import java.util.Map;
import java.util.Random;
import java.util.Set;
import java.util.SortedMap;
import java.util.TreeMap;
import javax.net.ssl.HttpsURLConnection;
import javax.net.ssl.SSLContext;
import javax.net.ssl.SSLSocketFactory;
import javax.net.ssl.TrustManager;
import javax.servlet.http.HttpServletRequest;
import com.alibaba.fastjson.JSONObject;
import com.alipay.api.AlipayClient;
import com.alipay.api.DefaultAlipayClient;
public class PayCommonUtil {
public static final String TIME = "yyyyMMddHHmmss";
/** * 建立支付宝交易对象 */
public static AlipayClient getAliClient()
{
AlipayClient alipayClient = new DefaultAlipayClient(PropertyUtil.getInstance().getProperty("AliPay.payURL"),
PropertyUtil.getInstance().getProperty("AliPay.appId"),
PropertyUtil.getInstance().getProperty("AliPay.privateKey"), "json", "utf-8",
PropertyUtil.getInstance().getProperty("AliPay.publicKey"), "RSA2");
return alipayClient;
}
/** * 建立微信交易对象 */
public static SortedMap<Object, Object> getWXPrePayID()
{
SortedMap<Object, Object> parameters = new TreeMap<Object, Object>();
parameters.put("appid", PropertyUtil.getInstance().getProperty("WxPay.appid"));
parameters.put("mch_id", PropertyUtil.getInstance().getProperty("WxPay.mchid"));
parameters.put("nonce_str", PayCommonUtil.CreateNoncestr());
parameters.put("fee_type", "CNY");
parameters.put("notify_url", PropertyUtil.getInstance().getProperty("WxPay.notifyurl"));
parameters.put("trade_type", "APP");
return parameters;
}
/** * 再次签名,支付 */
public static SortedMap<Object, Object> startWXPay(String result)
{
try
{
Map<String, String> map = XMLUtil.doXMLParse(result);
SortedMap<Object, Object> parameterMap = new TreeMap<Object, Object>();
parameterMap.put("appid", PropertyUtil.getInstance().getProperty("WxPay.appid"));
parameterMap.put("partnerid", PropertyUtil.getInstance().getProperty("WxPay.mchid"));
parameterMap.put("prepayid", map.get("prepay_id"));
parameterMap.put("package", "Sign=WXPay");
parameterMap.put("noncestr", PayCommonUtil.CreateNoncestr());
// 原本生成的时间戳是13位,可是ios必须是10位,因此截取了一下
parameterMap.put("timestamp",
Long.parseLong(String.valueOf(System.currentTimeMillis()).toString().substring(0, 10)));
String sign = PayCommonUtil.createSign("UTF-8", parameterMap);
parameterMap.put("sign", sign);
return parameterMap;
} catch (Exception e)
{
e.printStackTrace();
}
return null;
}
/** * 建立随机数 * * @param length * @return */
public static String CreateNoncestr()
{
String chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
String res = "";
for (int i = 0; i < 16; i++)
{
Random rd = new Random();
res += chars.charAt(rd.nextInt(chars.length() - 1));
}
return res;
}
/** * 是否签名正确,规则是:按参数名称a-z排序,遇到空值的参数不参加签名。 * * @return boolean */
public static boolean isTenpaySign(String characterEncoding, SortedMap<Object, Object> packageParams)
{
StringBuffer sb = new StringBuffer();
Set es = packageParams.entrySet();
Iterator it = es.iterator();
while (it.hasNext())
{
Map.Entry entry = (Map.Entry) it.next();
String k = (String) entry.getKey();
String v = (String) entry.getValue();
if (!"sign".equals(k) && null != v && !"".equals(v))
{
sb.append(k + "=" + v + "&");
}
}
sb.append("key=" + PropertyUtil.getInstance().getProperty("WxPay.key"));
// 算出摘要
String mysign = MD5Util.MD5Encode(sb.toString(), characterEncoding).toLowerCase();
String tenpaySign = ((String) packageParams.get("sign")).toLowerCase();
// System.out.println(tenpaySign + " " + mysign);
return tenpaySign.equals(mysign);
}
/** * @Description:建立sign签名 * @param characterEncoding * 编码格式 * @param parameters * 请求参数 * @return */
public static String createSign(String characterEncoding, SortedMap<Object, Object> parameters)
{
StringBuffer sb = new StringBuffer();
Set es = parameters.entrySet();
Iterator it = es.iterator();
while (it.hasNext())
{
Map.Entry entry = (Map.Entry) it.next();
String k = (String) entry.getKey();
Object v = entry.getValue();
if (null != v && !"".equals(v) && !"sign".equals(k) && !"key".equals(k))
{
sb.append(k + "=" + v + "&");
}
}
sb.append("key=" + PropertyUtil.getInstance().getProperty("WxPay.key"));
String sign = MD5Util.MD5Encode(sb.toString(), characterEncoding).toUpperCase();
return sign;
}
/** * @Description:将请求参数转换为xml格式的string * @param parameters * 请求参数 * @return */
public static String getRequestXml(SortedMap<Object, Object> parameters)
{
StringBuffer sb = new StringBuffer();
sb.append("<xml>");
Set es = parameters.entrySet();
Iterator it = es.iterator();
while (it.hasNext())
{
Map.Entry entry = (Map.Entry) it.next();
String k = (String) entry.getKey();
String v = (String) entry.getValue();
if ("attach".equalsIgnoreCase(k) || "body".equalsIgnoreCase(k))
{
sb.append("<" + k + ">" + "<![CDATA[" + v + "]]></" + k + ">");
} else
{
sb.append("<" + k + ">" + v + "</" + k + ">");
}
}
sb.append("</xml>");
return sb.toString();
}
/** * @Description:返回给微信的参数 * @param return_code * 返回编码 * @param return_msg * 返回信息 * @return */
public static String setXML(String return_code, String return_msg)
{
return "<xml><return_code><![CDATA[" + return_code + "]]></return_code><return_msg><![CDATA[" + return_msg
+ "]]></return_msg></xml>";
}
/** * 发送https请求 * * @param requestUrl * 请求地址 * @param requestMethod * 请求方式(GET、POST) * @param outputStr * 提交的数据 * @return 返回微信服务器响应的信息 */
public static String httpsRequest(String requestUrl, String requestMethod, String outputStr)
{
try
{
// 建立SSLContext对象,并使用咱们指定的信任管理器初始化
TrustManager[] tm =
{ new TrustManagerUtil() };
SSLContext sslContext = SSLContext.getInstance("SSL", "SunJSSE");
sslContext.init(null, tm, new java.security.SecureRandom());
// 从上述SSLContext对象中获得SSLSocketFactory对象
SSLSocketFactory ssf = sslContext.getSocketFactory();
URL url = new URL(requestUrl);
HttpsURLConnection conn = (HttpsURLConnection) url.openConnection();
// conn.setSSLSocketFactory(ssf);
conn.setDoOutput(true);
conn.setDoInput(true);
conn.setUseCaches(false);
// 设置请求方式(GET/POST)
conn.setRequestMethod(requestMethod);
conn.setRequestProperty("content-type", "application/x-www-form-urlencoded");
// 当outputStr不为null时向输出流写数据
if (null != outputStr)
{
OutputStream outputStream = conn.getOutputStream();
// 注意编码格式
outputStream.write(outputStr.getBytes("UTF-8"));
outputStream.close();
}
// 从输入流读取返回内容
InputStream inputStream = conn.getInputStream();
InputStreamReader inputStreamReader = new InputStreamReader(inputStream, "UTF-8");
BufferedReader bufferedReader = new BufferedReader(inputStreamReader);
String str = null;
StringBuffer buffer = new StringBuffer();
while ((str = bufferedReader.readLine()) != null)
{
buffer.append(str);
}
// 释放资源
bufferedReader.close();
inputStreamReader.close();
inputStream.close();
inputStream = null;
conn.disconnect();
return buffer.toString();
} catch (ConnectException ce)
{
// log.error("链接超时:{}", ce);
} catch (Exception e)
{
// log.error("https请求异常:{}", e);
}
return null;
}
/** * 发送https请求 * * @param requestUrl * 请求地址 * @param requestMethod * 请求方式(GET、POST) * @param outputStr * 提交的数据 * @return JSONObject(经过JSONObject.get(key)的方式获取json对象的属性值) */
public static JSONObject httpsRequest(String requestUrl, String requestMethod)
{
JSONObject jsonObject = null;
try
{
// 建立SSLContext对象,并使用咱们指定的信任管理器初始化
TrustManager[] tm =
{ new TrustManagerUtil() };
SSLContext sslContext = SSLContext.getInstance("SSL", "SunJSSE");
sslContext.init(null, tm, new java.security.SecureRandom());
// 从上述SSLContext对象中获得SSLSocketFactory对象
SSLSocketFactory ssf = sslContext.getSocketFactory();
URL url = new URL(requestUrl);
HttpsURLConnection conn = (HttpsURLConnection) url.openConnection();
// conn.setSSLSocketFactory(ssf);
conn.setDoOutput(true);
conn.setDoInput(true);
conn.setUseCaches(false);
conn.setConnectTimeout(3000);
// 设置请求方式(GET/POST)
conn.setRequestMethod(requestMethod);
// conn.setRequestProperty("content-type",
// "application/x-www-form-urlencoded");
// 当outputStr不为null时向输出流写数据
// 从输入流读取返回内容
InputStream inputStream = conn.getInputStream();
InputStreamReader inputStreamReader = new InputStreamReader(inputStream, "UTF-8");
BufferedReader bufferedReader = new BufferedReader(inputStreamReader);
String str = null;
StringBuffer buffer = new StringBuffer();
while ((str = bufferedReader.readLine()) != null)
{
buffer.append(str);
}
// 释放资源
bufferedReader.close();
inputStreamReader.close();
inputStream.close();
inputStream = null;
conn.disconnect();
jsonObject = JSONObject.parseObject(buffer.toString());
} catch (ConnectException ce)
{
// log.error("链接超时:{}", ce);
} catch (Exception e)
{
System.out.println(e);
// log.error("https请求异常:{}", e);
}
return jsonObject;
}
public static String urlEncodeUTF8(String source)
{
String result = source;
try
{
result = java.net.URLEncoder.encode(source, "utf-8");
} catch (UnsupportedEncodingException e)
{
e.printStackTrace();
}
return result;
}
/** * 接收微信的异步通知 * * @throws IOException */
public static String reciverWx(HttpServletRequest request) throws IOException
{
InputStream inputStream;
StringBuffer sb = new StringBuffer();
inputStream = request.getInputStream();
String s;
BufferedReader in = new BufferedReader(new InputStreamReader(inputStream, "UTF-8"));
while ((s = in.readLine()) != null)
{
sb.append(s);
}
in.close();
inputStream.close();
return sb.toString();
}
/** * 产生num位的随机数 * * @return */
public static String getRandByNum(int num)
{
String length = "1";
for (int i = 0; i < num; i++)
{
length += "0";
}
Random rad = new Random();
String result = rad.nextInt(Integer.parseInt(length)) + "";
if (result.length() != num)
{
return getRandByNum(num);
}
return result;
}
/** * 返回当前时间字符串 * * @return yyyyMMddHHmmss */
public static String getDateStr()
{
SimpleDateFormat sdf = new SimpleDateFormat(TIME);
return sdf.format(new Date());
}
/** * 将日志保存至指定路径 * * @param path * @param str */
public static void saveLog(String path, String str)
{
File file = new File(path);
FileOutputStream fos = null;
try
{
fos = new FileOutputStream(path);
fos.write(str.getBytes());
fos.close();
} catch (FileNotFoundException e)
{
e.printStackTrace();
} catch (IOException e)
{
e.printStackTrace();
}
}
public static void saveE(String path, Exception exception)
{
try {
int i = 1 / 0;
} catch (final Exception e) {
try {
new PrintWriter(new BufferedWriter(new FileWriter(
path, true)), true).println(new Object() {
public String toString() {
StringWriter stringWriter = new StringWriter();
PrintWriter writer = new PrintWriter(stringWriter);
e.printStackTrace(writer);
StringBuffer buffer = stringWriter.getBuffer();
return buffer.toString();
}
});
} catch (IOException e1) {
e1.printStackTrace();
}
}
}
}
这里我本身建了一个类记录支付宝的通知内容并保存在后台数据库:AlipayNotice微信
public class AlipayNotice {
/** * ID */
private Integer id;
/** * 通知时间 */
private Date notifyTime;
/** * 通知类型 */
private String notifyType;
/** * 通知校验ID */
private String notifyId;
/** * 支付宝分配给开发者的应用Id */
private String appId;
/** * 编码格式 */
private String charset;
/** * 接口版本 */
private String version;
/** * 签名类型 */
private String signType;
/** * 签名 */
private String sign;
/** * 支付宝交易号 */
private String tradeNo;
/** * 商户订单号 */
private String outTradeNo;
/** * 商户业务号 */
private String outBizNo;
/** * 买家支付宝用户号 */
private String buyerId;
/** * 买家支付宝帐号 */
private String buyerLogonId;
/** * 卖家支付宝用户号 */
private String sellerId;
/** * 卖家支付宝帐号 */
private String sellerEmail;
/** * 交易状态 */
private String tradeStatus;
/** * 订单金额 */
private Double totalAmount;
/** * 实收金额 */
private Double receiptAmount;
/** * 开票金额 */
private Double invoiceAmount;
/** * 付款金额 */
private Double buyerPayAmount;
/** * 集分宝金额 */
private Double pointAmount;
/** * 总退款金额 */
private Double refundFee;
/** * 订单标题 */
private String subject;
/** * 商品描述 */
private String body;
/** * 交易建立时间 */
private Date gmtCreate;
/** * 交易付款时间 */
private Date gmtPayment;
/** * 交易退款时间 */
private Date gmtRefund;
/** * 交易结束时间 */
private Date gmtClose;
/** * 支付金额信息 */
private String fundBillList;
/** * 回传参数 */
private String passbackParams;
/** * 优惠券信息 */
private String voucherDetailList;
/** * 数据插入时间 */
private Date createTime;
/** * ID */
public Integer getId() {
return id;
}
/** * ID */
public void setId(Integer id) {
this.id = id;
}
/** * 通知时间 */
public Date getNotifyTime() {
return notifyTime;
}
/** * 通知时间 */
public void setNotifyTime(Date notifyTime) {
this.notifyTime = notifyTime;
}
/** * 通知类型 */
public String getNotifyType() {
return notifyType;
}
/** * 通知类型 */
public void setNotifyType(String notifyType) {
this.notifyType = notifyType == null ? null : notifyType.trim();
}
/** * 通知校验ID */
public String getNotifyId() {
return notifyId;
}
/** * 通知校验ID */
public void setNotifyId(String notifyId) {
this.notifyId = notifyId == null ? null : notifyId.trim();
}
/** * 支付宝分配给开发者的应用Id */
public String getAppId() {
return appId;
}
/** * 支付宝分配给开发者的应用Id */
public void setAppId(String appId) {
this.appId = appId == null ? null : appId.trim();
}
/** * 编码格式 */
public String getCharset() {
return charset;
}
/** * 编码格式 */
public void setCharset(String charset) {
this.charset = charset == null ? null : charset.trim();
}
/** * 接口版本 */
public String getVersion() {
return version;
}
/** * 接口版本 */
public void setVersion(String version) {
this.version = version == null ? null : version.trim();
}
/** * 签名类型 */
public String getSignType() {
return signType;
}
/** * 签名类型 */
public void setSignType(String signType) {
this.signType = signType == null ? null : signType.trim();
}
/** * 签名 */
public String getSign() {
return sign;
}
/** * 签名 */
public void setSign(String sign) {
this.sign = sign == null ? null : sign.trim();
}
/** * 支付宝交易号 */
public String getTradeNo() {
return tradeNo;
}
/** * 支付宝交易号 */
public void setTradeNo(String tradeNo) {
this.tradeNo = tradeNo == null ? null : tradeNo.trim();
}
/** * 商户订单号 */
public String getOutTradeNo() {
return outTradeNo;
}
/** * 商户订单号 */
public void setOutTradeNo(String outTradeNo) {
this.outTradeNo = outTradeNo == null ? null : outTradeNo.trim();
}
/** * 商户业务号 */
public String getOutBizNo() {
return outBizNo;
}
/** * 商户业务号 */
public void setOutBizNo(String outBizNo) {
this.outBizNo = outBizNo == null ? null : outBizNo.trim();
}
/** * 买家支付宝用户号 */
public String getBuyerId() {
return buyerId;
}
/** * 买家支付宝用户号 */
public void setBuyerId(String buyerId) {
this.buyerId = buyerId == null ? null : buyerId.trim();
}
/** * 买家支付宝帐号 */
public String getBuyerLogonId() {
return buyerLogonId;
}
/** * 买家支付宝帐号 */
public void setBuyerLogonId(String buyerLogonId) {
this.buyerLogonId = buyerLogonId == null ? null : buyerLogonId.trim();
}
/** * 卖家支付宝用户号 */
public String getSellerId() {
return sellerId;
}
/** * 卖家支付宝用户号 */
public void setSellerId(String sellerId) {
this.sellerId = sellerId == null ? null : sellerId.trim();
}
/** * 卖家支付宝帐号 */
public String getSellerEmail() {
return sellerEmail;
}
/** * 卖家支付宝帐号 */
public void setSellerEmail(String sellerEmail) {
this.sellerEmail = sellerEmail == null ? null : sellerEmail.trim();
}
/** * 交易状态 */
public String getTradeStatus() {
return tradeStatus;
}
/** * 交易状态 */
public void setTradeStatus(String tradeStatus) {
this.tradeStatus = tradeStatus == null ? null : tradeStatus.trim();
}
/** * 订单金额 */
public Double getTotalAmount() {
return totalAmount;
}
/** * 订单金额 */
public void setTotalAmount(Double totalAmount) {
this.totalAmount = totalAmount;
}
/** * 实收金额 */
public Double getReceiptAmount() {
return receiptAmount;
}
/** * 实收金额 */
public void setReceiptAmount(Double receiptAmount) {
this.receiptAmount = receiptAmount;
}
/** * 开票金额 */
public Double getInvoiceAmount() {
return invoiceAmount;
}
/** * 开票金额 */
public void setInvoiceAmount(Double invoiceAmount) {
this.invoiceAmount = invoiceAmount;
}
/** * 付款金额 */
public Double getBuyerPayAmount() {
return buyerPayAmount;
}
/** * 付款金额 */
public void setBuyerPayAmount(Double buyerPayAmount) {
this.buyerPayAmount = buyerPayAmount;
}
/** * 集分宝金额 */
public Double getPointAmount() {
return pointAmount;
}
/** * 集分宝金额 */
public void setPointAmount(Double pointAmount) {
this.pointAmount = pointAmount;
}
/** * 总退款金额 */
public Double getRefundFee() {
return refundFee;
}
/** * 总退款金额 */
public void setRefundFee(Double refundFee) {
this.refundFee = refundFee;
}
/** * 订单标题 */
public String getSubject() {
return subject;
}
/** * 订单标题 */
public void setSubject(String subject) {
this.subject = subject == null ? null : subject.trim();
}
/** * 商品描述 */
public String getBody() {
return body;
}
/** * 商品描述 */
public void setBody(String body) {
this.body = body == null ? null : body.trim();
}
/** * 交易建立时间 */
public Date getGmtCreate() {
return gmtCreate;
}
/** * 交易建立时间 */
public void setGmtCreate(Date gmtCreate) {
this.gmtCreate = gmtCreate;
}
/** * 交易付款时间 */
public Date getGmtPayment() {
return gmtPayment;
}
/** * 交易付款时间 */
public void setGmtPayment(Date gmtPayment) {
this.gmtPayment = gmtPayment;
}
/** * 交易退款时间 */
public Date getGmtRefund() {
return gmtRefund;
}
/** * 交易退款时间 */
public void setGmtRefund(Date gmtRefund) {
this.gmtRefund = gmtRefund;
}
/** * 交易结束时间 */
public Date getGmtClose() {
return gmtClose;
}
/** * 交易结束时间 */
public void setGmtClose(Date gmtClose) {
this.gmtClose = gmtClose;
}
/** * 支付金额信息 */
public String getFundBillList() {
return fundBillList;
}
/** * 支付金额信息 */
public void setFundBillList(String fundBillList) {
this.fundBillList = fundBillList == null ? null : fundBillList.trim();
}
/** * 回传参数 */
public String getPassbackParams() {
return passbackParams;
}
/** * 回传参数 */
public void setPassbackParams(String passbackParams) {
this.passbackParams = passbackParams == null ? null : passbackParams.trim();
}
/** * 优惠券信息 */
public String getVoucherDetailList() {
return voucherDetailList;
}
/** * 优惠券信息 */
public void setVoucherDetailList(String voucherDetailList) {
this.voucherDetailList = voucherDetailList == null ? null : voucherDetailList.trim();
}
/** * 数据插入时间 */
public Date getCreateTime() {
return createTime;
}
/** * 数据插入时间 */
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
到此支付宝支付流程已经走完,若是你对支付流程不是很了解,建议先多看看流程图,会对你在处理业务逻辑上有很大的帮助。markdown