WeixinService.java 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155
  1. package com.fuint.common.service;
  2. import com.alibaba.fastjson.JSONObject;
  3. import com.fuint.framework.exception.BusinessCheckException;
  4. import com.fuint.framework.web.ResponseObject;
  5. import com.fuint.repository.model.MtOrder;
  6. import com.fuint.repository.model.MtUser;
  7. import javax.servlet.http.HttpServletRequest;
  8. import javax.servlet.http.HttpServletResponse;
  9. import java.math.BigDecimal;
  10. import java.util.Map;
  11. import java.util.Date;
  12. /**
  13. * 微信相关业务接口
  14. *
  15. * Created by FSQ
  16. * CopyRight https://www.fuint.cn
  17. */
  18. public interface WeixinService {
  19. /**
  20. * 获取微信登录token
  21. *
  22. * @param merchantId 商户ID
  23. * @param useCache 是否从缓存中读取
  24. * @return
  25. * */
  26. String getAccessToken(Integer merchantId, boolean useCache) throws BusinessCheckException ;
  27. /**
  28. * 提交预支付订单
  29. *
  30. * @param userInfo 会员信息
  31. * @param orderInfo 订单信息
  32. * @param payAmount 支付金额
  33. * @param authCode 支付二维码
  34. * @param giveAmount 赠送金额
  35. * @param ip 支付发起IP
  36. * @param platform 支付平台
  37. * @param isWechat 是否微信客户端
  38. * @return
  39. * */
  40. ResponseObject createPrepayOrder(MtUser userInfo, MtOrder orderInfo, Integer payAmount, String authCode, Integer giveAmount, String ip, String platform, String isWechat) throws BusinessCheckException;
  41. /**
  42. * 处理返回的xml数据
  43. *
  44. * @param request 请求体
  45. * @return
  46. * */
  47. Map<String,String> processResXml(HttpServletRequest request);
  48. /**
  49. * 处理返回的xml数据
  50. *
  51. * @param response 返回相应
  52. * @param flag 标签
  53. * @return
  54. * */
  55. void processRespXml(HttpServletResponse response, boolean flag);
  56. /**
  57. * 获取微信个人信息
  58. *
  59. * @param merchantId 商户ID
  60. * @param code 登录编码
  61. * @return
  62. * */
  63. JSONObject getWxProfile(Integer merchantId, String code) throws BusinessCheckException;
  64. /**
  65. * 获取微信openId
  66. *
  67. * @param merchantId 商户ID
  68. * @param code 登录编码
  69. * @return
  70. * */
  71. JSONObject getWxOpenId(Integer merchantId, String code) throws BusinessCheckException;
  72. /**
  73. * 获取会员微信绑定的手机号
  74. *
  75. * @param encryptedData 加密的编码(前端返回)
  76. * @param sessionKey
  77. * @param iv
  78. * @return
  79. * */
  80. String getPhoneNumber(String encryptedData, String sessionKey, String iv);
  81. /**
  82. * 发送订阅消息
  83. *
  84. * @param merchantId 商户ID
  85. * @param userId 会员ID
  86. * @param toUserOpenId 会员openID
  87. * @param key 消息编码
  88. * @param page 跳转页面
  89. * @param params 发送参数
  90. * @param sendTime 发送时间
  91. * @return
  92. * */
  93. Boolean sendSubscribeMessage(Integer merchantId, Integer userId, String toUserOpenId, String key, String page, Map<String,Object> params, Date sendTime) throws BusinessCheckException;
  94. /**
  95. * 发送订阅消息
  96. *
  97. * @param merchantId 商户ID
  98. * @param reqDataJsonStr 发送参数
  99. * @return
  100. * */
  101. Boolean doSendSubscribeMessage(Integer merchantId, String reqDataJsonStr);
  102. /**
  103. * 查询支付订单
  104. *
  105. * @param storeId 店铺ID
  106. * @param transactionId 交易单号
  107. * @param orderSn 订单号
  108. * @return
  109. * */
  110. Map<String, String> queryPaidOrder(Integer storeId, String transactionId, String orderSn);
  111. /**
  112. * 发起售后
  113. *
  114. * @param storeId 店铺ID
  115. * @param orderSn 订单号
  116. * @param totalAmount 订单总金额
  117. * @param refundAmount 售后金额
  118. * @param platform 平台
  119. * @return
  120. * */
  121. Boolean doRefund(Integer storeId, String orderSn, BigDecimal totalAmount, BigDecimal refundAmount, String platform) throws BusinessCheckException;
  122. /**
  123. * 生成店铺二维码
  124. *
  125. * @param merchantId 商户ID
  126. * @param storeId 店铺ID
  127. * @param width 宽度
  128. * @return
  129. * */
  130. String createStoreQrCode(Integer merchantId, Integer storeId, Integer width);
  131. /**
  132. * 开通微信卡券
  133. *
  134. * @param merchantId 商户ID
  135. * @param storeId 店铺ID
  136. * @return
  137. * */
  138. String createWxCard(Integer merchantId, Integer storeId);
  139. }