刚开始注意点
- 银联demo中的lib中和项目中的lib重复的可以删掉,目前只留这几个可以正常运行
chinapaysecure.jar
ISFJ_v2_0_119_2_BAISC_JDK14
UTILS-0.1.2-SNAPSHOT.jar
- 银联demo数据通过页面直接传表单给银联,所以信息会通过网页泄露。所以我们可以通过在controller层来把数据传给银联。
1.固定数据放到 unionpayConfig.properties
中
unionpay.version=20170419
unionpay.accessType=0
unionpay.merId=000091911258565
unionpay.productType=00020004
unionpay.busiType=0001
unionpay.curryNo=USD
unionpay.merResv=MerResv
unionpay.tranType=0001
unionpay.merPageUrl=http://zhangshu.wicp.vip/shopping/member/index
unionpay.merBgUrl=http://zhangshu.wicp.vip/shopping/payment/union_pay_success
- 写一个
UnionPay
实体类存放要发给银联的数据
- applicationContext.xml中配置一个依赖注入
加入unionpayConfig.properties配置
<!--加载配置文件-->
<context:property-placeholder location="classpath*:/shopxx.properties,classpath*:/unionpayConfig.properties"
ignore-resource-not-found="true" ignore-unresolvable="true" />
<bean id="unionPay" class="net.shopxx.entity.union.UnionPay">
<property name="version" value="${unionpay.version}"/>
<property name="accessType" value="${unionpay.accessType}"/>
<property name="merId" value="${unionpay.merId}"/>
<property name="productType" value="${unionpay.productType}"/>
<property name="busiType" value="${unionpay.busiType}"/>
<property name="curryNo" value="${unionpay.curryNo}"/>
<property name="merResv" value="${unionpay.merResv}"/>
<property name="tranType" value="${unionpay.tranType}"/>
<property name="merPageUrl" value="${unionpay.merPageUrl}"/>
<property name="merBgUrl" value="${unionpay.merBgUrl}"/>
</bean>
- 支付: 金额元分之间转换工具类点这里