一、项目背景
随着科技的快速发展和互联网的普及,人们的生活方式发生了翻天覆地的变化。特别是在支付领域,传统的现金支付方式逐渐被电子支付所取代。支付宝和微信作为中国两大移动支付巨头,凭借其便捷、高效的特点,深受用户的喜爱。然而,传统的租赁业务往往伴随着押金的问题,这不仅增加了用户的经济负担,也影响了租赁业务的效率。因此,支付宝和微信纷纷推出了免押系统,旨在通过技术创新,优化租赁流程,提升用户体验。
二、项目功能结构
支付宝和微信的免押系统采用了先进的信用评估技术,通过用户的支付行为、社交关系、履约记录等多维度数据,构建出用户的信用画像。基于这一画像,系统能够判断用户的信用等级,从而决定是否为其提供免押服务。
在功能结构上,免押系统主要分为以下几个模块:
-
信用评估模块:该模块负责收集和分析用户数据,生成信用评分。通过机器学习和大数据分析技术,系统能够实时更新用户的信用状态,确保评估结果的准确性和时效性。
-
免押服务申请模块:用户在使用租赁服务时,可以通过支付宝或微信平台提交免押申请。系统会根据用户的信用评分,自动判断是否批准其申请。
-
风险监控模块:该模块负责对免押服务进行实时监控,一旦发现异常行为或风险事件,系统会立即采取措施,保障租赁双方的权益。
-
数据报告与分析模块:系统定期生成免押服务的数据报告,帮助运营者了解服务的使用情况、用户反馈等信息,为优化服务提供依据。
三、项目用途
支付宝和微信的免押系统具有广泛的用途,主要体现在以下几个方面:
-
优化租赁流程:通过免押系统,用户可以更加便捷地获取租赁服务,无需再为押金问题而烦恼。同时,租赁方也能减少押金管理的工作量,提高业务效率。
-
提升用户体验:免押服务降低了用户的经济负担,增强了用户对支付宝和微信平台的信任感和满意度。这种优质的用户体验有助于吸引更多用户,进一步提升平台的竞争力。
-
推动信用体系建设:免押系统以信用评估为基础,通过实际应用推动社会信用体系的完善。随着越来越多的人和机构参与到信用体系中来,社会的整体信用水平将得到提升。
四、项目前景
支付宝和微信的免押系统作为移动支付领域的一大创新,具有广阔的发展前景。随着技术的不断进步和数据的不断积累,免押系统的信用评估能力将越来越强,服务范围也将不断扩大。未来,免押系统有望覆盖更多领域,如共享单车、共享汽车、房屋租赁等,为更多用户提供便捷、高效的免押服务。
同时,随着社会信用体系的不断完善,免押服务将成为社会信任的重要体现。通过免押服务,人们可以更加便捷地获取各种资源和服务,推动社会的和谐发展。
package cn.eangaie.appcloud.controller;
import cn.eangaie.appcloud.entity.*;
import cn.eangaie.appcloud.service.*;
import cn.eangaie.appcloud.util.*;
import com.alipay.api.AlipayApiException;
import com.alipay.api.response.AlipayMerchantItemFileUploadResponse;
import com.alipay.api.response.AlipayTradeCreateResponse;
import com.alipay.api.response.AlipayTradeQueryResponse;
import com.baomidou.mybatisplus.mapper.EntityWrapper;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.lang.Nullable;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.math.BigDecimal;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* @author Ean
* @version 0.1.0
* @Description
* @create 2020-08-21 15:02
* @since 0.1.0
**/
@RestController
@Api(tags = "支付宝支付相关控制处理器")
@RequestMapping("my/")
@Slf4j
public class MyPayController {
final
MyService myService;
final
OrderService orderService;
final
TradeRecService tradeRecService;
@Value("${my.notify.freeze_notify_url}")
private String freezeNotifyUrl;
@Value("${my.notify.stagePayUrl}")
private String stagePayUrl;
@Value("${my.notify.firstStagePayUrl}")
private String firstStagePayUrl;
@Value("${my.notify.buyoutNotify}")
private String buyoutNotify;
@Value("${my.notify.MerchantApplyNotify}")
private String MerchantApplyNotify;
@Value("${my.notify.kprenNotify}")
private String kprenNotify;
final
StageBillService stageBillService;
final
OrderbackService orderbackService;
@Autowired
PayMapService payMapService;
@Autowired
MerchantApplayService merchantApplayService;
@Autowired
DistLineService distLineService;
@Autowired
MessageUtil messageUtil;
@Autowired
ExtraService extraService;
@Autowired
OrderTemplate orderTemplate;
@Autowired
DeductionRecordService deductionRecordService;
@Autowired
AttrService attrService;
@Autowired
CommissionService commissionService;
public MyPayController(MyService myService, OrderService orderService, TradeRecService tradeRecService, OrderbackService orderbackService, StageBillService stageBillService) {
this.myService = myService;
this.orderService = orderService;
this.tradeRecService = tradeRecService;
this.orderbackService = orderbackService;
this.stageBillService = stageBillService;
}
/**
* @return cn.eangaie.appcloud.entity.Result
* @Author Ean
* @Description 冻结查询接口,成功返回code0。失败-1
* @Date 17:07 2021/7/3 0003
* @Param [orderNo, orderRequestNo]
**/
@ApiOperation("冻结查询接口,成功返回code0。失败-1")
@PostMapping("freezeQuery")
public Result freezeQuery(String orderNo, String orderRequestNo) {
try {
String res = myService.queryRes(orderNo, orderRequestNo);
if (null != res) {
return ResultUtil.success();
}
} catch (AlipayApiException e) {
e.printStackTrace();
}
return ResultUtil.error(-1, "冻结失败");
}
/**
* @return cn.eangaie.appcloud.entity.Result
* @Author Ean
* @Description 在用--首期扣款接口。首期金额由前端计算。采用支付宝支付的方式。有对应的回调接口处理后续操作。
* @Date 9:44 2021/6/23 0023
* @Param [orderId]
**/
@ApiOperation("第一期支付,原先的接口是从预授权里边扣除,现在改成了使用支付宝支付的方式")
@PostMapping("firstTradeV2")
public Result firstTradeV2(String orderId) {
if (StringUtils.isNotBlank(orderId) && StringUtils.isNotEmpty(orderId)) {
Order order = orderService.selectById(orderId);
if (null != order) {
String tradeNo = CommonUtil.getNo();
String title = "首期账单", desc = "首期账单记录", note = "";
int periods = 1;
StageBill stageBill = stageBillService.initBillOrUpdate(title, desc, note, order.getOrderId(), order.getOrderNo(), order.getOrderRequestNo(), order.getOrderAuthNo(), order.getUserId(), order.getOrderDeposit(), order.getOrderDeposit(), order.getOrderFirstAmount() + Integer.valueOf(order.getGoodExpenses()), periods, tradeNo);
log.info("[ " + order.getOrderNo() + " ]创建首期订单[ " + stageBill.toString() + " ]");
int firstAmount = order.getOrderFirstAmount();
log.info("订单< " + order.getOrderNo() + " >执行首期扣款。本次扣款交易号< " + tradeNo + " >---本次扣款金额< " + firstAmount + " >");
if (firstAmount == 0) {
return ResultUtil.error(-1, "订单非分期订单,或首期扣款费用不允许为0");
}
String HbFqNum = null;
if (null != order.getHbFqNum()) {
HbFqNum = order.getHbFqNum();
}
String HbFqSellerPercent = null;
if (null != order.getHbFqSellerPercent()) {
HbFqSellerPercent = order.getHbFqSellerPercent();
}
String res = myService.myPay(stageBill.getStageBillAmout(), order.getUserUuid(), "首期租金支付", tradeNo, firstStagePayUrl, HbFqNum, HbFqSellerPercent).getTradeNo();
return ResultUtil.success(res);
}
return ResultUtil.error(-1, "订单不允许为空!");
}
return ResultUtil.error(-1, "订单id不允许为空!");
}
@ApiOperation("订单扣除金额,成功则会创建扣除记录并更新订单剩余押金字段")
@PostMapping("orderDudect")
public Result orderDudect(int orderId, int amount) {
Order order = orderService.selectById(orderId);
if (null != order) {
String outTradeNo = CommonUtil.getNo();
try {
String res = myService.tradepay(outTradeNo, order.getOrderAuthNo(), amount, order.getUserUuid(), "后台手动扣除", null, "");
if (null == res) {
throw new AlipayApiException();
} else {
log.info("订单[ " + order.getOrderNo() + " ]发起扣款,本次扣款编号[ " + outTradeNo + " ],本次扣款金额[ " + BigDecimal.valueOf(amount).divide(BigDecimal.valueOf(100)).setScale(2).doubleValue() + " ]");
order.setOrderRestDeposit(order.getOrderRestDeposit() - amount);
order.setOrderFinalpay(order.getOrderFinalpay() + amount);
orderService.updateById(order);
tradeRecService.insertRec(outTradeNo, order.getOrderNo(), amount, "后台手动扣除", 1);
Long curr = System.currentTimeMillis();
merchantApplayService.addMarchantIncome(order.getMerchantUserId(), amount, order, "扣除押金费用");
// merchantApplayService.addMerchantBalance(order.getMerchantUserId(),amount);
distLineService.insertRec(order.getOrderId(), order.getUserId(), amount, String.valueOf(curr));
return ResultUtil.success("扣款成功");
}
} catch (AlipayApiException e) {
e.printStackTrace();
deductionRecordService.createItem(order.getOrderNo(), outTradeNo, null, amount, order.getMerchantUserId());
myService.closeOrder(outTradeNo);
// log.error("订单[ " + order.getOrderNo() + "] 扣款解冻失败 本次扣款[ " + BigDecimal.valueOf(amount).divide(BigDecimal.valueOf(100)).setScale(2) + " ]分");
return ResultUtil.error(-1, "退款异常,请联系管理员");
}
}
return ResultUtil.error(-1, "订单不存在");
}
@ApiOperation("取消订单并解冻退款,订单只扣除第一期的情况下才允许调用。该接口之后退款第一期并解冻押金,然后将订单变为已取消的状态")
@PostMapping("orderCancleAndRefu")
public Result orderCancleAndRefu(int orderId) {
Order order = orderService.selectById(orderId);
String res = myService.orderCancleAndRefu(orderId);
if ("ok".equals(res)) {
Map<String, String> resMap = new HashMap<>();
resMap.put("商品名称", order.getGoodTitle());
messageUtil.sendKuaiDi100Msg(order.getUserTel(), resMap, "7075");
/*订单中心同步状态*/
try {
myService.alipayMerchantOrderSync(orderTemplate.ClOSED(order));
} catch (Exception e) {
e.printStackTrace();
}
/*退款增加Attr库存*/
String[] arr = CommonUtil.strToArr(order.getAttrIdList());
if (arr.length > 0) {
List<Attr> attrList = attrService.selectList(new EntityWrapper<Attr>().in("attr_id", arr));
if (attrList.size() > 0) {
int i = 0;
int num = order.getAttrNum();
for (Attr attr : attrList) {
attr = attr.selectById();
order.setAttrIdList(attr.getAttrId() + ",");
attr.setAttrNum(attr.getAttrNum() + num);
attrList.set(i++, attr);
}
attrService.updateAllColumnBatchById(attrList);
}
}
List<Commission> commissionList = commissionService.selectList(new EntityWrapper<Commission>().eq("order_no", order.getOrderNo()));
if (commissionList.size() > 0) {
int i = 0;
for (Commission commission : commissionList) {
commission = commission.selectById();
commission.setStatus(2);
commissionList.set(i++, commission);
}
commissionService.updateAllColumnBatchById(commissionList);
}
return ResultUtil.success();
}
return ResultUtil.error(-1, res);
}
@ApiOperation("前端取消支付订单租金 解冻订单")
@PostMapping("cancelOrderAndRefund")
public Result cancelOrderAndRefund(int orderId) {
Order order = orderService.selectById(orderId);
String res = myService.orderCancleAndRefu(orderId);
if ("ok".equals(res)) {
try {
myService.alipayMerchantOrderSync(orderTemplate.ClOSED(order));
} catch (Exception e) {
e.printStackTrace();
}
return ResultUtil.success();
}
return ResultUtil.error(-1, res);
}
@ApiOperation("归还解冻。如果逾期,会自动扣除违约金,并新增扣款记录")
@PostMapping("refuAndUnfreeze")
public Result refuAndUnfreeze(int orderId) {
Order order = orderService.selectById(orderId);
Long end = null;
Long curr = null;
Long t = null;
if (order.getStatus() == 9) {
if (null != order.getOrderEnd() && null != order.getOrderBackTime()) {//租赁中买断没有时间
curr = order.getOrderBackTime();//使用归还时间字段计算逾期金额
end = order.getOrderEnd();
t = curr - end;
} else {
t = 0L;
}
} else {
end = order.getOrderEnd();
curr = TimeUtil.getToDayStemp();//获取今天凌晨的时间戳
t = curr - end;
}
long t1 = 24 * 60 * 60 * 1000L;
int day = (int) (t / t1);
if ((order.getStatus() == 5 || order.getStatus() == 9) && t > 0 && t >= t1) {//逾期
if (day >= 30) {//超出30天。禁用用户的平台免押权限
orderService.banUserExemptPermission(order);
}
// int amount = order.getAttrAmount() * day * order.getAttrNum();
int amount = order.getPenalAmount() * day;
if (amount > order.getOrderRestDeposit()) {
amount = order.getOrderRestDeposit();
}
String outTradeNo = CommonUtil.getNo();
try {
Integer resAmount = new BigDecimal(myService.queryRes(order.getOrderNo(), order.getOrderRequestNo())).multiply(BigDecimal.valueOf(100)).intValue();
if (amount >= resAmount) {
amount = resAmount;
}
if (amount == 0) {
orderService.resetOrderUserExepmtStatus(order);
order.setOrderBeamo(amount);
order.setStatus(7);
order.updateById();
/*订单中心同步状态*/
try {
myService.alipayMerchantOrderSync(orderTemplate.EXERCISED(order));
} catch (Exception e) {
e.printStackTrace();
}
return ResultUtil.success("解冻成功!");
} else {
String res = myService.tradepay(outTradeNo, order.getOrderAuthNo(), amount, order.getUserUuid(), "扣除违约金并解冻", "complete", null);
if (null != res) {
order.setOrderRestDeposit(0);
order.setOrderFinalpay(order.getOrderFinalpay() + amount);
order.setOrderBeamo(order.getOrderBeamo()+amount);
order.setStatus(7);
order.updateById();
orderService.resetOrderUserExepmtStatus(order);
tradeRecService.insertRec(outTradeNo, order.getOrderNo(), amount, "扣除违约金", 1);
// merchantBack(order, amount);
/*订单中心同步状态*/
try {
myService.alipayMerchantOrderSync(orderTemplate.RETURN_OVERDUE(order));
} catch (Exception e) {
e.printStackTrace();
}
/*抽佣*/
merchantApplayService.addMarchantIncome(order.getMerchantUserId(), amount, order, "扣除逾期费用");
return ResultUtil.success("解冻成功!");
} else {
throw new AlipayApiException();
}
}
} catch (AlipayApiException e) {
e.printStackTrace();
deductionRecordService.createItem(order.getOrderNo(), outTradeNo, null, amount, order.getMerchantUserId());
// myService.closeOrder(outTradeNo);
// log.error("订单[ " + order.getOrderNo() + "] 扣款解冻失败 本次扣款[ " + BigDecimal.valueOf(amount).divide(BigDecimal.valueOf(100)).setScale(2) + " ]分");
return ResultUtil.error(-1, "金额超出,或信息异常,请联系管理员查看订单情况");
}
}
if (order.getStatus() == 9) {
try {
String outTradeNo = CommonUtil.getRamdonNo();
Integer resAmount = new BigDecimal(myService.queryResAuth(order.getOrderNo(), order.getOrderRequestNo(),order.getOrderAuthNo())).multiply(BigDecimal.valueOf(100)).intValue();
if (0 != resAmount) {
String res = myService.unfreeze(outTradeNo, order.getOrderAuthNo(), resAmount, "解冻剩余押金");
if (null != res) {
orderService.resetOrderUserExepmtStatus(order);
order.setOrderRestDeposit(0);
order.setStatus(7);
order.updateById();
/*订单中心同步状态*/
try {
myService.alipayMerchantOrderSync(orderTemplate.EXERCISED(order));
} catch (Exception e) {
e.printStackTrace();
}
return ResultUtil.success("解冻成功!");
}
} else {
order.setOrderRestDeposit(0);
order.setStatus(7);
order.updateById();
orderService.resetOrderUserExepmtStatus(order);
/*订单中心同步状态*/
try {
myService.alipayMerchantOrderSync(orderTemplate.EXERCISED(order));
} catch (Exception e) {
e.printStackTrace();
}
return ResultUtil.success("解冻成功!");
}
} catch (AlipayApiException e) {
e.printStackTrace();
log.error("订单[ " + order.getOrderNo() + "]解冻失败");
return ResultUtil.error(-1, "解冻失败");
}
}
return ResultUtil.error(-1, "订单不存在");
}
private void merchantBack(Order order, int amount) {
Integer merchantUserId = order.getMerchantUserId();
User user = null;
if (null != merchantUserId && -1 != merchantUserId) {
user = new User().selectById(merchantUserId);
}
/*订单创建不需要添加分销记录,直接在订单变成租赁中的时候才添加进分销队列*/
if (null != user) {
user.setUserBalance(user.getUserBalance() + amount);
user.setUserTotalBalance(user.getUserTotalBalance() + amount);
user.updateById();
}
}
/**
* @return cn.eangaie.appcloud.entity.Result
* @Author Ean
* @Description
* @Date 11:01 2021/4/29 0029
* @Param [orderId]
**/
@ApiOperation("订单冻结接口")
@PostMapping("orderFreezeDeposit")
public Result orderFreezeDeposit(int orderId) {
Order order = orderService.selectById(orderId);
// int firstAmount = order.getOrderFirstAmount();
if (null == order) {
return ResultUtil.error(-1, "订单不存在");
}
String res = null;
try {
String category = order.getZmCategory();
if (null == category) {
category = "RENT_DIGITAL";
}
res = myService.freeze(order.getOrderNo(), order.getOrderRequestNo(), order.getOrderDeposit(), freezeNotifyUrl, category);
} catch (AlipayApiException e) {
e.printStackTrace();
return ResultUtil.error(-1, "获取冻结字符串失败");
}
if (null == res) {
return ResultUtil.error(-1, "获取冻结字符串失败");
}
return ResultUtil.success(res, "返回的预授权额度是押金+首期租金(orderFirstAmount)");
}
@ApiOperation("支付宝直接支付接口,sub是订单标题,比如: 押金支付 type=1->直接买断 type=2->租赁中买断 type=3->商户申请买断")
@PostMapping("myPay")
public Result myPay(int amount, String uuid, String sub, String outTradeNo, @Nullable Integer type, @Nullable Integer buyoutOrderId) {
Map map = new HashMap();
String stagePayUrl = null;
if (null != type) {
if (null != type && (type == 1 || type == 2)) {
stagePayUrl = buyoutNotify;
map.put("buyoutOrderId", buyoutOrderId);
map.put("type", type);
map.put("amount", amount);
map.put("outTradeNo", outTradeNo);
}
if (type == 3) {
stagePayUrl = MerchantApplyNotify;
}
if (type == 4) {
stagePayUrl = kprenNotify;
}
}
AlipayTradeCreateResponse response = myService.myPay(amount, uuid, sub, outTradeNo, stagePayUrl, null, null);
if (null == response) {
return ResultUtil.error(-1, "支付调用失败");
}
String res = response.getTradeNo();
payMapService.create(response.getOutTradeNo(), map);
return ResultUtil.success(res);
}
/**
* @return cn.eangaie.appcloud.entity.Result
* @Author Ean
* @Description 分期账单前端主动支付调用的接口, 新增了回调链接, 后端来更新账单状态
* @Date 15:22 2021/4/29 0029
* @Param [amount, uuid, sub, outTradeNo:分期账单的账单编号]
**/
@ApiOperation("分期账单前端主动支付调用的接口")
@PostMapping("stageBillPay")
public Result stageBillPay(int amount, String uuid, String sub, String outTradeNo) {
StageBill stageBill = stageBillService.selectOne(new EntityWrapper().eq("stage_bill_no", outTradeNo));
stageBill.setStageBillNo(CommonUtil.getNo());
stageBill.updateById();
AlipayTradeCreateResponse res = myService.myPay(amount, uuid, sub, stageBill.getStageBillNo(), stagePayUrl, null, null);
if (null == res) {
return ResultUtil.error(-1, "支付调用失败");
}
return ResultUtil.success(res.getTradeNo());
}
@ApiOperation("同步交易记录,1-履约 2-违约")
@GetMapping("syncTradeRec")
public Result syncTradeRec(int tradeRecId, int syncType) {
TradeRec tradeRec = tradeRecService.selectById(tradeRecId);
if (null != tradeRec) {
String reqNo = CommonUtil.getNo();
try {
String status = syncType == 1 ? "COMPLETE" : "VIOLATED";
String info = "{\"status\":\"" + status + "\"}";
myService.sync(tradeRec.getTradeNo(), reqNo, info);
return ResultUtil.success();
} catch (AlipayApiException e) {
e.printStackTrace();
return ResultUtil.error(-1, "调用支付宝同步接口异常");
}
}
return ResultUtil.error(-1, "记录不存在");
}
/**
* 退款解冻
*/
@PostMapping("han/unfreeze")
public Result unfreeze(String authNo, int amount) {
String outTradeNo = CommonUtil.getNo();
String body = "押金解冻";
String res = null;
try {
res = myService.unfreeze(authNo, amount, body);
} catch (AlipayApiException e) {
e.printStackTrace();
return ResultUtil.error(-1, "解冻异常");
}
return ResultUtil.success(res);
}
/**
* 退款解冻
*/
@PostMapping("han/freeze")
public Result freeze(String orderNo, String orderRequestNo, int amount, String category) {
String body = "押金冻结";
String res = null;
try {
if (null == category) {
category = "RENT_DIGITAL";
}
res = myService.freeze(orderNo, orderRequestNo, amount, null, category);
} catch (AlipayApiException e) {
e.printStackTrace();
return ResultUtil.error(-1, "订单冻结异常");
}
return ResultUtil.success(res);
}
/**
* 退款解冻
*/
@PostMapping("han/cusTrade")
public Result cusTrade(String authNo, int amount, String uuid, String authConfirm) {
String body = "【测试】-扣除";
String no = CommonUtil.getNo();
String res = myService.tradepay(no, authNo, amount, uuid, body, authConfirm, null);
if (null == res) {
log.error("authNo[ " + authNo + " ]转支付扣款调用失败");
}
AlipayTradeQueryResponse queryRes = null;
try {
queryRes = myService.tradeQuery(no);
String tradeStatus = queryRes.getTradeStatus();
String code = queryRes.getCode();
if (code.equals("10000") && null != tradeStatus) {
} else if (code.equals("40004")) {
} else {
return ResultUtil.error(-1, "查询调用失败");
}
return ResultUtil.success(queryRes);
} catch (AlipayApiException e) {
e.printStackTrace();
return ResultUtil.error(-1, "查询调用失败");
}
}
@ApiOperation("订单中心商品文件上传接口")
@GetMapping({"FileUpload"})
public Result FileUpload() throws AlipayApiException {
AlipayMerchantItemFileUploadResponse response = this.myService.alipayMerchantItemFileUpload();
if (response.getCode().equals("10000") && null != response.getMaterialId()) {
Extra extra = extraService.selectOne(new EntityWrapper<Extra>().eq("extra_type", 987));
extra.setExtraCon(response.getMaterialId());
extra.updateById();
return ResultUtil.success();
} else {
return ResultUtil.error(-1, response.getSubMsg());
}
}
}
总之,支付宝和微信的免押系统以其独特的优势和广阔的应用前景,必将在未来的发展中发挥越来越重要的作用。我们期待这一创新技术能够为用户带来更多便利,为社会创造更多价值。
@Override
public String freeze(String outOrderNo, String outRequestNo, int amount, String notifyUrl, String category) throws AlipayApiException {
BigDecimal _amount = BigDecimal.valueOf(amount).divide(BigDecimal.valueOf(100)).setScale(2);
AlipayClient alipayClient = new DefaultAlipayClient("https://openapi.alipay.com/gateway.do", appid, private_key, "json", "utf-8", public_key, "RSA2");
AlipayFundAuthOrderAppFreezeRequest request = new AlipayFundAuthOrderAppFreezeRequest();
AlipayFundAuthOrderAppFreezeModel model = new AlipayFundAuthOrderAppFreezeModel();
model.setOrderTitle("押金冻结");
model.setOutOrderNo(outOrderNo);
model.setOutRequestNo(outRequestNo);
model.setPayeeUserId(sellerId);//payee_user_id,Payee_logon_id不能同时为空
model.setProductCode("PRE_AUTH_ONLINE");//PRE_AUTH_ONLINE为固定值,不要替换
model.setAmount(String.valueOf(_amount));
//需要支持信用授权,该字段必传
model.setExtraParam("{\"category\":\"RENT_HOME_CARE\",\"serviceId\":\"2023022100000000000095194600\"}"); //outStoreAlias将在用户端信用守护、支付信息、账单详情页展示
request.setBizModel(model);
request.setNotifyUrl(notifyUrl);//异步通知地址,必填,该接口只通过该参数进行异步通知
AlipayFundAuthOrderAppFreezeResponse response = alipayClient.sdkExecute(request);//注意这里是sdkExecute,可以获取签名参数
if (response.isSuccess()) {
return response.getBody();
} else {
log.error("outOrderNo为< " + outOrderNo + " >的订单冻结失败");
}
return null;
}