This commit is contained in:
Lemon
2023-05-27 11:55:54 +08:00
4 changed files with 55 additions and 11 deletions

View File

@@ -309,6 +309,14 @@ public class PayController extends BaseController {
return response; return response;
} }
/**
* 汇付支付退款
*/
public RestApiResponse<?> adapayRefund(HttpServletRequest request, @RequestBody WeChatRefundDTO dto) {
return null;
}
/** /**
* 汇付支付回调 * 汇付支付回调
* <a href="https://api.jsowellcloud.com/uniapp/pay/adapayCallback">...</a> * <a href="https://api.jsowellcloud.com/uniapp/pay/adapayCallback">...</a>

View File

@@ -2,6 +2,8 @@ import cn.hutool.json.JSONUtil;
import com.alibaba.fastjson2.JSON; import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONObject; import com.alibaba.fastjson2.JSONObject;
import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.PropertyNamingStrategies;
import com.google.common.collect.ImmutableMap; import com.google.common.collect.ImmutableMap;
import com.jsowell.JsowellApplication; import com.jsowell.JsowellApplication;
import com.jsowell.common.constant.CacheConstants; import com.jsowell.common.constant.CacheConstants;
@@ -138,6 +140,20 @@ public class SpringBootTestController {
static final String ALGORITHM_MAC = "HmacMD5"; static final String ALGORITHM_MAC = "HmacMD5";
@Autowired
private AdapayCallbackRecordService adapayCallbackRecordService;
@Test
public void testSaveCallback() throws JsonProcessingException {
String data = "{\"app_id\":\"app_d0c80cb1-ffc8-48cb-a030-fe9bec823aaa\",\"created_time\":\"20230527100758\",\"description\":\"{\\\"type\\\":\\\"balance\\\",\\\"memberId\\\":\\\"29336349\\\"}\",\"end_time\":\"20230527100810\",\"expend\":{\"bank_type\":\"OTHERS\",\"open_id\":\"o8jhot6PJF93EPhNISsXi28dKdS8\",\"sub_open_id\":\"o4REX5MprZfTaLnVNxfdOY-wnwGI\"},\"fee_amt\":\"0.00\",\"id\":\"002212023052710075810508353847861903360\",\"order_no\":\"4c457bd474334d5eaf82f4795265b6ad\",\"out_trans_id\":\"4200001864202305270647556621\",\"party_order_id\":\"02212305273647819807712\",\"pay_amt\":\"0.01\",\"pay_channel\":\"wx_lite\",\"real_amt\":\"0.01\",\"share_eq\":\"Y\",\"status\":\"succeeded\",\"wx_user_id\":\"\"}";
JSONObject jsonObject = JSON.parseObject(data);
ObjectMapper mapper = new ObjectMapper();
mapper.setPropertyNamingStrategy(PropertyNamingStrategies.SNAKE_CASE);
AdapayCallbackRecord adapayCallbackRecord = mapper.readValue(jsonObject.toJSONString(), AdapayCallbackRecord.class);
adapayCallbackRecord.setExpend(jsonObject.getString("expend"));
adapayCallbackRecordService.saveAdapayCallbackRecord(adapayCallbackRecord);
}
@Test @Test
public void testGenerateLianlianToken() throws UnsupportedEncodingException { public void testGenerateLianlianToken() throws UnsupportedEncodingException {
String OperatorID = "425010765"; String OperatorID = "425010765";

View File

@@ -1,6 +1,10 @@
package com.jsowell.pile.domain; package com.jsowell.pile.domain;
import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable; import java.io.Serializable;
import java.math.BigDecimal; import java.math.BigDecimal;
@@ -11,11 +15,16 @@ import java.util.Date;
* @author * @author
*/ */
@Data @Data
@NoArgsConstructor
@AllArgsConstructor
@Builder
public class AdapayCallbackRecord implements Serializable { public class AdapayCallbackRecord implements Serializable {
/** /**
* 主键id * 主键id
*/ */
private String id; private Integer id;
private String paymentId;
/** /**
* 汇付商户appId * 汇付商户appId
@@ -37,7 +46,8 @@ public class AdapayCallbackRecord implements Serializable {
*/ */
private String endTime; private String endTime;
private Object expend; @JsonIgnore
private String expend;
private BigDecimal feeAmt; private BigDecimal feeAmt;
@@ -73,4 +83,5 @@ public class AdapayCallbackRecord implements Serializable {
private String delFlag; private String delFlag;
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
} }

View File

@@ -2,7 +2,8 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.jsowell.pile.mapper.AdapayCallbackRecordMapper"> <mapper namespace="com.jsowell.pile.mapper.AdapayCallbackRecordMapper">
<resultMap id="BaseResultMap" type="com.jsowell.pile.domain.AdapayCallbackRecord"> <resultMap id="BaseResultMap" type="com.jsowell.pile.domain.AdapayCallbackRecord">
<id column="id" jdbcType="VARCHAR" property="id" /> <id column="id" property="id" />
<result column="payment_id" jdbcType="VARCHAR" property="paymentId" />
<result column="app_id" jdbcType="VARCHAR" property="appId" /> <result column="app_id" jdbcType="VARCHAR" property="appId" />
<result column="description" jdbcType="VARCHAR" property="description" /> <result column="description" jdbcType="VARCHAR" property="description" />
<result column="created_time" jdbcType="VARCHAR" property="createdTime" /> <result column="created_time" jdbcType="VARCHAR" property="createdTime" />
@@ -22,7 +23,7 @@
<result column="del_flag" jdbcType="VARCHAR" property="delFlag" /> <result column="del_flag" jdbcType="VARCHAR" property="delFlag" />
</resultMap> </resultMap>
<sql id="Base_Column_List"> <sql id="Base_Column_List">
id, app_id, description, created_time, end_time, expend, fee_amt, order_no, out_trans_id, id, payment_id, app_id, description, created_time, end_time, expend, fee_amt, order_no, out_trans_id,
party_order_id, pay_amt, pay_channel, real_amt, share_eq, `status`, wx_user_id, create_time, party_order_id, pay_amt, pay_channel, real_amt, share_eq, `status`, wx_user_id, create_time,
del_flag del_flag
</sql> </sql>
@@ -37,22 +38,23 @@
where id = #{id,jdbcType=VARCHAR} where id = #{id,jdbcType=VARCHAR}
</delete> </delete>
<insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.jsowell.pile.domain.AdapayCallbackRecord" useGeneratedKeys="true"> <insert id="insert" keyColumn="id" keyProperty="id" parameterType="com.jsowell.pile.domain.AdapayCallbackRecord" useGeneratedKeys="true">
insert into adapay_callback_record (app_id, description, created_time, insert into adapay_callback_record (payment_id, app_id, description, created_time,
end_time, expend, fee_amt, end_time, expend, fee_amt,
order_no, out_trans_id, party_order_id, order_no, out_trans_id, party_order_id,
pay_amt, pay_channel, real_amt, pay_amt, pay_channel, real_amt,
share_eq, `status`, wx_user_id, share_eq, `status`, wx_user_id)
create_time, del_flag) values (#{paymentId,jdbcType=VARCHAR},#{appId,jdbcType=VARCHAR}, #{description,jdbcType=VARCHAR}, #{createdTime,jdbcType=VARCHAR},
values (#{appId,jdbcType=VARCHAR}, #{description,jdbcType=VARCHAR}, #{createdTime,jdbcType=VARCHAR},
#{endTime,jdbcType=VARCHAR}, #{expend,jdbcType=OTHER}, #{feeAmt,jdbcType=DECIMAL}, #{endTime,jdbcType=VARCHAR}, #{expend,jdbcType=OTHER}, #{feeAmt,jdbcType=DECIMAL},
#{orderNo,jdbcType=VARCHAR}, #{outTransId,jdbcType=VARCHAR}, #{partyOrderId,jdbcType=VARCHAR}, #{orderNo,jdbcType=VARCHAR}, #{outTransId,jdbcType=VARCHAR}, #{partyOrderId,jdbcType=VARCHAR},
#{payAmt,jdbcType=DECIMAL}, #{payChannel,jdbcType=VARCHAR}, #{realAmt,jdbcType=DECIMAL}, #{payAmt,jdbcType=DECIMAL}, #{payChannel,jdbcType=VARCHAR}, #{realAmt,jdbcType=DECIMAL},
#{shareEq,jdbcType=VARCHAR}, #{status,jdbcType=VARCHAR}, #{wxUserId,jdbcType=VARCHAR}, #{shareEq,jdbcType=VARCHAR}, #{status,jdbcType=VARCHAR}, #{wxUserId,jdbcType=VARCHAR})
#{createTime,jdbcType=TIMESTAMP}, #{delFlag,jdbcType=VARCHAR})
</insert> </insert>
<insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.jsowell.pile.domain.AdapayCallbackRecord" useGeneratedKeys="true"> <insert id="insertSelective" keyColumn="id" keyProperty="id" parameterType="com.jsowell.pile.domain.AdapayCallbackRecord" useGeneratedKeys="true">
insert into adapay_callback_record insert into adapay_callback_record
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
<if test="paymentId != null">
payment_id,
</if>
<if test="appId != null"> <if test="appId != null">
app_id, app_id,
</if> </if>
@@ -106,6 +108,9 @@
</if> </if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="paymentId != null">
#{paymentId,jdbcType=VARCHAR},
</if>
<if test="appId != null"> <if test="appId != null">
#{appId,jdbcType=VARCHAR}, #{appId,jdbcType=VARCHAR},
</if> </if>
@@ -162,6 +167,9 @@
<update id="updateByPrimaryKeySelective" parameterType="com.jsowell.pile.domain.AdapayCallbackRecord"> <update id="updateByPrimaryKeySelective" parameterType="com.jsowell.pile.domain.AdapayCallbackRecord">
update adapay_callback_record update adapay_callback_record
<set> <set>
<if test="paymentId != null">
payment_id = #{paymentId,jdbcType=VARCHAR},
</if>
<if test="appId != null"> <if test="appId != null">
app_id = #{appId,jdbcType=VARCHAR}, app_id = #{appId,jdbcType=VARCHAR},
</if> </if>
@@ -218,7 +226,8 @@
</update> </update>
<update id="updateByPrimaryKey" parameterType="com.jsowell.pile.domain.AdapayCallbackRecord"> <update id="updateByPrimaryKey" parameterType="com.jsowell.pile.domain.AdapayCallbackRecord">
update adapay_callback_record update adapay_callback_record
set app_id = #{appId,jdbcType=VARCHAR}, set payment_id = #{paymentId,jdbcType=VARCHAR},
app_id = #{appId,jdbcType=VARCHAR},
description = #{description,jdbcType=VARCHAR}, description = #{description,jdbcType=VARCHAR},
created_time = #{createdTime,jdbcType=VARCHAR}, created_time = #{createdTime,jdbcType=VARCHAR},
end_time = #{endTime,jdbcType=VARCHAR}, end_time = #{endTime,jdbcType=VARCHAR},