完成支付宝手机网站支付接入
This commit is contained in:
parent
79a32813b2
commit
0b3806bfb8
|
@ -44,12 +44,6 @@
|
|||
<artifactId>jstl</artifactId>
|
||||
<version>1.2</version>
|
||||
</dependency>
|
||||
<!-- zheng-upms-client -->
|
||||
<dependency>
|
||||
<groupId>com.zheng</groupId>
|
||||
<artifactId>zheng-upms-client</artifactId>
|
||||
<version>1.0.0</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<profiles>
|
||||
|
|
|
@ -0,0 +1,42 @@
|
|||
package com.zheng.pay.web.controller;
|
||||
|
||||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.alipay.api.AlipayClient;
|
||||
import com.alipay.api.request.AlipayTradeWapPayRequest;
|
||||
import com.zheng.common.base.BaseController;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseBody;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
/**
|
||||
* 支付宝
|
||||
* Created by ZhangShuzheng on 2017/04/04.
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/alipay")
|
||||
public class AlipayController extends BaseController {
|
||||
|
||||
@Autowired
|
||||
private AlipayClient alipayClient;
|
||||
|
||||
@Autowired
|
||||
private AlipayTradeWapPayRequest alipayRequest;
|
||||
|
||||
@RequestMapping("/pay")
|
||||
@ResponseBody
|
||||
public Object pay(HttpServletResponse response) throws Exception {
|
||||
JSONObject bizContent = new JSONObject();
|
||||
bizContent.put("out_trade_no", "pay20170404005030000000");
|
||||
bizContent.put("total_amount", "0.01");
|
||||
bizContent.put("subject", "Iphone6 16G");
|
||||
bizContent.put("seller_id", "2088123456789012");
|
||||
bizContent.put("product_code", "QUICK_WAP_PAY");
|
||||
alipayRequest.setBizContent(bizContent.toString());
|
||||
return alipayClient.pageExecute(alipayRequest).getBody();
|
||||
}
|
||||
|
||||
}
|
|
@ -1,8 +0,0 @@
|
|||
package com.zheng.pay.web.controller;
|
||||
|
||||
|
||||
public class AppController {
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -8,7 +8,7 @@
|
|||
<context:property-placeholder location="classpath:config.properties"/>
|
||||
|
||||
<!-- 支付宝手机网站支付 -->
|
||||
<bean id="alipayWebClient" class="com.alipay.api.DefaultAlipayClient">
|
||||
<bean id="alipayClient" class="com.alipay.api.DefaultAlipayClient">
|
||||
<constructor-arg value="${alipay.gateway}"/>
|
||||
<constructor-arg value="${alipay.appid}"/>
|
||||
<constructor-arg value="${alipay.rsa.private_key}"/>
|
||||
|
@ -17,5 +17,9 @@
|
|||
<constructor-arg value="${alipay.alipay_public_key}"/>
|
||||
<constructor-arg value="${alipay.sign_type}"/>
|
||||
</bean>
|
||||
<bean id="alipayRequest" class="com.alipay.api.request.AlipayTradeWapPayRequest">
|
||||
<property name="returnUrl" value="${alipay.returnUrl}"/>
|
||||
<property name="notifyUrl" value="${alipay.notifyUrl}"/>
|
||||
</bean>
|
||||
|
||||
</beans>
|
|
@ -1,10 +1,12 @@
|
|||
env=${profile.env}
|
||||
|
||||
alipay.appid=${alipay.appid}
|
||||
alipay.gateway=${alipay.gateway}
|
||||
alipay.rsa.private_key=${alipay.rsa.private_key}
|
||||
alipay.rsa.public_key=${alipay.rsa.public_key}
|
||||
alipay.alipay_public_key=${alipay.alipay_public_key}
|
||||
alipay.format=${alipay.format}
|
||||
alipay.charset=${alipay.charset}
|
||||
alipay.sign_type=${alipay.sign_type}
|
||||
alipay.appid=
|
||||
alipay.gateway=https://openapi.alipaydev.com/gateway.do
|
||||
alipay.rsa.private_key=
|
||||
alipay.rsa.public_key=
|
||||
alipay.alipay_public_key=
|
||||
alipay.format=json
|
||||
alipay.charset=UTF-8
|
||||
alipay.sign_type=RSA2
|
||||
alipay.returnUrl=http://pay.zhangshuzheng.cn/alipay/returnUrl
|
||||
alipay.notifyUrl=http://pay.zhangshuzheng.cn/alipay/notifyUrl
|
||||
|
|
|
@ -1,10 +1 @@
|
|||
profile.env=dev
|
||||
|
||||
alipay.appid=
|
||||
alipay.gateway=https://openapi.alipaydev.com/gateway.do
|
||||
alipay.rsa.private_key=
|
||||
alipay.rsa.public_key=
|
||||
alipay.alipay_public_key=
|
||||
alipay.format=json
|
||||
alipay.charset=UTF-8
|
||||
alipay.sign_type=RSA2
|
||||
profile.env=dev
|
Loading…
Reference in New Issue