|
|
@@ -3,20 +3,26 @@ package com.sckw.payment.service;
|
|
|
import com.alibaba.fastjson2.JSONArray;
|
|
|
import com.alibaba.fastjson2.JSONObject;
|
|
|
import com.alibaba.fastjson2.TypeReference;
|
|
|
+import com.sckw.core.utils.CollectionUtils;
|
|
|
import com.sckw.core.utils.OkHttpUtils;
|
|
|
-import com.sckw.core.utils.StringUtils;
|
|
|
import com.sckw.payment.api.model.constant.ChannelEnum;
|
|
|
-import com.sckw.payment.api.model.dto.MemberDetail;
|
|
|
-import com.sckw.payment.api.model.dto.R;
|
|
|
-import com.sckw.payment.api.model.dto.WalletDto;
|
|
|
+import com.sckw.payment.api.model.dto.*;
|
|
|
+import com.sckw.payment.api.model.dto.common.BusinessNo;
|
|
|
+import com.sckw.payment.api.model.dto.common.R;
|
|
|
+import com.sckw.payment.api.model.dto.page.CashPage;
|
|
|
+import com.sckw.payment.api.model.dto.page.PrePayIndexPage;
|
|
|
+import com.sckw.payment.api.model.dto.page.RecordPage;
|
|
|
import com.sckw.payment.model.constant.PayCenterEnum;
|
|
|
+import jakarta.validation.constraints.NotBlank;
|
|
|
import jakarta.validation.constraints.NotNull;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
|
+import org.springframework.cloud.context.config.annotation.RefreshScope;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
+import org.springframework.validation.annotation.Validated;
|
|
|
|
|
|
-import java.util.List;
|
|
|
-import java.util.Objects;
|
|
|
+import java.util.*;
|
|
|
|
|
|
/**
|
|
|
* 转发中台接口
|
|
|
@@ -26,6 +32,8 @@ import java.util.Objects;
|
|
|
*/
|
|
|
@Service
|
|
|
@Slf4j
|
|
|
+@RefreshScope
|
|
|
+@Validated
|
|
|
public class PayCenterService {
|
|
|
@Value("${payCenter.address}")
|
|
|
private String payCenterAddr;
|
|
|
@@ -42,6 +50,72 @@ public class PayCenterService {
|
|
|
return ok;
|
|
|
}
|
|
|
|
|
|
+ private String getHttp(PayCenterEnum payCenterEnum, Map<String, Object> para) {
|
|
|
+ log.info("{}入参->{}", payCenterEnum.getDesc(), JSONObject.toJSONString(para));
|
|
|
+ OkHttpUtils okHttpUtils = OkHttpUtils.builder().url(payCenterAddr + payCenterEnum.getAddr());
|
|
|
+ if (!CollectionUtils.isEmpty(para)) {
|
|
|
+ for (Map.Entry<String, Object> p : para.entrySet()) {
|
|
|
+ //跳过非空参数
|
|
|
+ if (Objects.isNull(p.getValue())) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ if (p.getValue() instanceof ChannelEnum channelEnum) {
|
|
|
+ okHttpUtils.addPara(p.getKey(), channelEnum.getChannel());
|
|
|
+ } else {
|
|
|
+ okHttpUtils.addPara(p.getKey(), (String) p.getValue());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ String sync;
|
|
|
+ try {
|
|
|
+ sync = okHttpUtils.get().sync();
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("中台服务异常", e.getCause());
|
|
|
+ throw new RuntimeException("支付服务异常!");
|
|
|
+ }
|
|
|
+ log.info("{}返回值->{}", payCenterEnum.getDesc(), sync);
|
|
|
+ return changeRes(sync);
|
|
|
+ }
|
|
|
+
|
|
|
+ private String postHttp(PayCenterEnum payCenterEnum, Map<String, Object> para) {
|
|
|
+ log.info("{}入参->{}", payCenterEnum.getDesc(), JSONObject.toJSONString(para));
|
|
|
+ OkHttpUtils okHttpUtils = OkHttpUtils.builder().url(payCenterAddr + payCenterEnum.getAddr());
|
|
|
+ if (!CollectionUtils.isEmpty(para)) {
|
|
|
+ for (Map.Entry<String, Object> p : para.entrySet()) {
|
|
|
+ //跳过非空参数
|
|
|
+ if (Objects.isNull(p.getValue())) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ if (p.getValue() instanceof ChannelEnum channelEnum) {
|
|
|
+ okHttpUtils.addBodyPara(p.getKey(), channelEnum.getChannel());
|
|
|
+ } else {
|
|
|
+ okHttpUtils.addBodyPara(p.getKey(), (String) p.getValue());
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ String sync;
|
|
|
+ try {
|
|
|
+ sync = okHttpUtils.post(true).sync();
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.error("中台服务异常", e.getCause());
|
|
|
+ throw new RuntimeException("支付服务异常!");
|
|
|
+ }
|
|
|
+ log.info("{}返回值->{}", payCenterEnum.getDesc(), sync);
|
|
|
+ return changeRes(sync);
|
|
|
+ }
|
|
|
+
|
|
|
+ private String changeRes(String sync) {
|
|
|
+ JSONObject jsonObject = JSONObject.parseObject(sync);
|
|
|
+ //我的泛型是对象 返回值有可能 是对象或数组 {} []
|
|
|
+ //data:[]->转换成 data:null 进入if
|
|
|
+ Object data = jsonObject.get("data");
|
|
|
+ if (Objects.nonNull(data) && data instanceof JSONArray d && d.isEmpty()) {
|
|
|
+ jsonObject.put("data", null);
|
|
|
+ sync = jsonObject.toJSONString();
|
|
|
+ }
|
|
|
+ return sync;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 会员详情
|
|
|
*
|
|
|
@@ -49,23 +123,12 @@ public class PayCenterService {
|
|
|
* @param channel
|
|
|
* @return
|
|
|
*/
|
|
|
- public R<MemberDetail> memberDetail(String uid, ChannelEnum channel) {
|
|
|
- log.info("{}入参->uid:{} channel:{}", PayCenterEnum.DETAIL.getDesc(), uid, channel);
|
|
|
- String sync = OkHttpUtils.builder().url(payCenterAddr + PayCenterEnum.DETAIL.getAddr()).addPara("uid", uid).addPara("channel", channel.getChannel()).get().sync();
|
|
|
- log.info("{}返回值:{}", PayCenterEnum.DETAIL.getDesc(), sync);
|
|
|
- return JSONObject.parseObject(sync, new TypeReference<R<MemberDetail>>() {
|
|
|
- });
|
|
|
- }
|
|
|
-
|
|
|
- public R<MemberDetail> withdraw(String uid, String view, String orderNo) {
|
|
|
- log.info("{}入参->uid:{} view:{} orderNo:{}", PayCenterEnum.WITHDRAW.getDesc(), uid, view, orderNo);
|
|
|
- String sync = OkHttpUtils.builder().url(payCenterAddr + PayCenterEnum.WITHDRAW.getAddr())
|
|
|
- .addPara("uid", uid)
|
|
|
- .addPara("view", view)
|
|
|
- .addPara("orderNo", orderNo)
|
|
|
- .get().sync();
|
|
|
- log.info("{}返回值:{}", PayCenterEnum.WITHDRAW.getDesc(), sync);
|
|
|
- return JSONObject.parseObject(sync, new TypeReference<R<MemberDetail>>() {
|
|
|
+ public R<MemberDetail> memberDetail(String uid, @NotNull(message = "渠道类型不能为空") ChannelEnum channel) {
|
|
|
+ String sync = getHttp(PayCenterEnum.MEMBER_DETAIL, new HashMap<>() {{
|
|
|
+ put("uid", uid);
|
|
|
+ put("channel", channel);
|
|
|
+ }});
|
|
|
+ return JSONObject.parseObject(sync, new TypeReference<>() {
|
|
|
});
|
|
|
}
|
|
|
|
|
|
@@ -78,18 +141,436 @@ public class PayCenterService {
|
|
|
* @return
|
|
|
*/
|
|
|
public R<List<WalletDto>> wallet(@NotNull String uid, ChannelEnum channel, String filter) {
|
|
|
- log.info("钱包清单入参->uid:{} channel:{} filter:{}", uid, channel, filter);
|
|
|
- OkHttpUtils okHttpUtils = OkHttpUtils.builder().url(payCenterAddr + PayCenterEnum.WALLET.getAddr())
|
|
|
- .addPara("uid", uid);
|
|
|
- if (Objects.nonNull(channel)) {
|
|
|
- okHttpUtils.addPara("channel", channel.getChannel());
|
|
|
- }
|
|
|
- if (StringUtils.isNotBlank(filter)) {
|
|
|
- okHttpUtils.addPara("filter", filter);
|
|
|
- }
|
|
|
- String sync = okHttpUtils.get().sync();
|
|
|
- log.info("钱包清单返回值:{}", sync);
|
|
|
+ String sync = getHttp(PayCenterEnum.MEMBER_WALLET, new HashMap<>() {{
|
|
|
+ put("uid", uid);
|
|
|
+ put("channel", channel);
|
|
|
+ put("filter", filter);
|
|
|
+ }});
|
|
|
return parseArray(sync, WalletDto.class);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 提现详情
|
|
|
+ *
|
|
|
+ * @param uid
|
|
|
+ * @param view
|
|
|
+ * @param orderNo
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public R<CashDetail> withdrawDetail(@NotBlank(message = "提现用户不能为空") String uid, @NotBlank(message = "") String view, @NotBlank(message = "订单编号不能为空") String orderNo) {
|
|
|
+ String sync = getHttp(PayCenterEnum.WITHDRAW_DETAIL, new HashMap<>() {{
|
|
|
+ put("uid", uid);
|
|
|
+ put("view", view);
|
|
|
+ put("order_no", orderNo);
|
|
|
+ }});
|
|
|
+ return JSONObject.parseObject(sync, new TypeReference<>() {
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 提现清单
|
|
|
+ *
|
|
|
+ * @param uid
|
|
|
+ * @param channel
|
|
|
+ * @param page
|
|
|
+ * @param pageSize
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public R<CashPage> withdrawIndex(@NotBlank(message = "提现用户不能为空") String uid, @NotNull(message = "支付渠道不能为空") ChannelEnum channel, @NotNull(message = "分页参数不能为空") Integer page, @NotNull(message = "分页大小参数不能为空") Integer pageSize) {
|
|
|
+ String sync = getHttp(PayCenterEnum.WITHDRAW_INDEX, new HashMap<>() {{
|
|
|
+ put("uid", uid);
|
|
|
+ put("channel", channel);
|
|
|
+ put("page", page);
|
|
|
+ put("pageSize", pageSize);
|
|
|
+ }});
|
|
|
+ return JSONObject.parseObject(sync, new TypeReference<>() {
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 订单状态
|
|
|
+ *
|
|
|
+ * @param type
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public R<Map<String, String>> withdrawStatus(String type) {
|
|
|
+ if (StringUtils.isBlank(type)) {
|
|
|
+ type = "order";
|
|
|
+ }
|
|
|
+ String finalType = type;
|
|
|
+ String sync = getHttp(PayCenterEnum.WITHDRAW_STATUS, new HashMap<>() {{
|
|
|
+ put("type", finalType);
|
|
|
+ }});
|
|
|
+ return JSONObject.parseObject(sync, new TypeReference<>() {
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 取消提现
|
|
|
+ *
|
|
|
+ * @param uid
|
|
|
+ * @param orderNo
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public R<Object> withdrawCancel(@NotBlank(message = "提现用户不能为空") String uid, @NotBlank(message = "体现订单号不能为空") String orderNo) {
|
|
|
+ String sync = postHttp(PayCenterEnum.WITHDRAW_CANCEL, new HashMap<>() {{
|
|
|
+ put("uid", uid);
|
|
|
+ put("order_no", orderNo);
|
|
|
+ }});
|
|
|
+ return JSONObject.parseObject(sync, new TypeReference<>() {
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 申请提现
|
|
|
+ *
|
|
|
+ * @param uid
|
|
|
+ * @param channel
|
|
|
+ * @param money
|
|
|
+ * @param remarks
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public R<Order> withdrawTake(@NotBlank(message = "提现用户不能为空") String uid, @NotBlank(message = "渠道不能为空") ChannelEnum channel, @NotBlank(message = "金额(分)不能为空") Long money, @NotBlank(message = "备注不能为空") String remarks) {
|
|
|
+ String sync = postHttp(PayCenterEnum.WITHDRAW_TAKE, new HashMap<>() {{
|
|
|
+ put("uid", uid);
|
|
|
+ put("channel", channel);
|
|
|
+ put("money", money);
|
|
|
+ put("remarks", remarks);
|
|
|
+ }});
|
|
|
+ return JSONObject.parseObject(sync, new TypeReference<>() {
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 统计信息
|
|
|
+ *
|
|
|
+ * @param uid
|
|
|
+ * @param channel
|
|
|
+ * @param filter
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public R<WalletInfo> totalInfo(@NotBlank(message = "用户不能为空") String uid, @NotBlank(message = "渠道不能为空") ChannelEnum channel, @NotBlank(message = "乙方用户不能为空") String filter) {
|
|
|
+ String sync = getHttp(PayCenterEnum.TOTAL_INFO, new HashMap<>() {{
|
|
|
+ put("uid", uid);
|
|
|
+ put("channel", channel);
|
|
|
+ put("filter", filter);
|
|
|
+ }});
|
|
|
+ return JSONObject.parseObject(sync, new TypeReference<>() {
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 操作记录-下载
|
|
|
+ *
|
|
|
+ * @param uid
|
|
|
+ * @param channel
|
|
|
+ * @param filter
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public R<OperateDown> operateDownload(String uid, ChannelEnum channel, String filter) {
|
|
|
+ String sync = getHttp(PayCenterEnum.OPERATE_DOWNLOAD, new HashMap<>() {{
|
|
|
+ put("uid", uid);
|
|
|
+ put("channel", channel);
|
|
|
+ put("filter", filter);
|
|
|
+ }});
|
|
|
+ return JSONObject.parseObject(sync, new TypeReference<>() {
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 操作记录-分类
|
|
|
+ *
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public R<Map<String, String>> operateCategory() {
|
|
|
+ String sync = getHttp(PayCenterEnum.OPERATE_CATEGORY, new HashMap<>());
|
|
|
+ return JSONObject.parseObject(sync, new TypeReference<>() {
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 操作记录
|
|
|
+ *
|
|
|
+ * @param uid
|
|
|
+ * @param channel
|
|
|
+ * @param page
|
|
|
+ * @param pageSize
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public R<Operate> operateIndex(String uid, ChannelEnum channel, Integer page, Integer pageSize) {
|
|
|
+ String sync = getHttp(PayCenterEnum.OPERATE_INDEX, new HashMap<>() {{
|
|
|
+ put("uid", uid);
|
|
|
+ put("channel", channel);
|
|
|
+ put("page", page);
|
|
|
+ put("pageSize", pageSize);
|
|
|
+ }});
|
|
|
+ return JSONObject.parseObject(sync, new TypeReference<>() {
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 钱包日志类型
|
|
|
+ *
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public R<Map<String, String>> logCategory() {
|
|
|
+ String sync = getHttp(PayCenterEnum.LOG_CATEGORY, new HashMap<>());
|
|
|
+ return JSONObject.parseObject(sync, new TypeReference<>() {
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取钱包使用明细
|
|
|
+ *
|
|
|
+ * @param uid
|
|
|
+ * @param filter
|
|
|
+ * @param page
|
|
|
+ * @param pageSize
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public R<RecordPage> record(String uid, String filter, Integer page, Integer pageSize) {
|
|
|
+ String sync = getHttp(PayCenterEnum.RECORD, new HashMap<>() {{
|
|
|
+ put("uid", uid);
|
|
|
+ put("filter", filter);
|
|
|
+ put("page", page);
|
|
|
+ put("pageSize", pageSize);
|
|
|
+ }});
|
|
|
+ return JSONObject.parseObject(sync, new TypeReference<>() {
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 余额转出
|
|
|
+ *
|
|
|
+ * @param uid
|
|
|
+ * @param channel
|
|
|
+ * @param money
|
|
|
+ * @param filter
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public R<Object> transfer(String uid, ChannelEnum channel, Long money, String filter) {
|
|
|
+ String sync = postHttp(PayCenterEnum.TRANSFER, new HashMap<>() {{
|
|
|
+ put("uid", uid);
|
|
|
+ put("channel", channel);
|
|
|
+ put("money", money);
|
|
|
+ put("filter", filter);
|
|
|
+ }});
|
|
|
+ return JSONObject.parseObject(sync, new TypeReference<>() {
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 预付订单详情
|
|
|
+ *
|
|
|
+ * @param orderNo
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public R<CashDetail> advancePayDetail(String orderNo) {
|
|
|
+ String sync = getHttp(PayCenterEnum.ADVANCE_PAY_DETAIL, new HashMap<>() {{
|
|
|
+ put("order_no", orderNo);
|
|
|
+ }});
|
|
|
+ return JSONObject.parseObject(sync, new TypeReference<>() {
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 发起预付
|
|
|
+ *
|
|
|
+ * @param uid 乙方uid
|
|
|
+ * @param channel 渠道
|
|
|
+ * @param filter 甲方uid
|
|
|
+ * @param money 金额,分
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public R<Order> advancePayApply(String uid, ChannelEnum channel, String filter, Long money) {
|
|
|
+ String sync = postHttp(PayCenterEnum.ADVANCE_PAY_APPLY, new HashMap<>() {{
|
|
|
+ put("uid", uid);
|
|
|
+ put("channel", channel);
|
|
|
+ put("money", money);
|
|
|
+ put("filter", filter);
|
|
|
+ }});
|
|
|
+ return JSONObject.parseObject(sync, new TypeReference<>() {
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ /***
|
|
|
+ * 预付订单清单
|
|
|
+ * @param uid
|
|
|
+ * @param channel
|
|
|
+ * @param filter
|
|
|
+ * @param page
|
|
|
+ * @param pageSize
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public R<PrePayIndexPage> advancePayIndex(String uid, ChannelEnum channel, String filter, Integer page, Integer pageSize) {
|
|
|
+ String sync = getHttp(PayCenterEnum.ADVANCE_PAY_INDEX, new HashMap<>() {{
|
|
|
+ put("uid", uid);
|
|
|
+ put("channel", channel);
|
|
|
+ put("filter", filter);
|
|
|
+ put("page", page);
|
|
|
+ put("pageSize", pageSize);
|
|
|
+ }});
|
|
|
+ return JSONObject.parseObject(sync, new TypeReference<>() {
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 预付订单状态
|
|
|
+ *
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public R<List<String>> advancePayStatus() {
|
|
|
+ String sync = getHttp(PayCenterEnum.ADVANCE_PAY_STATUS, new HashMap<>());
|
|
|
+ return JSONObject.parseObject(sync, new TypeReference<>() {
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取通道清单
|
|
|
+ *
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public R<List<Channel>> index() {
|
|
|
+ String sync = getHttp(PayCenterEnum.INDEX, new HashMap<>());
|
|
|
+ return parseArray(sync, Channel.class);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 订单记录
|
|
|
+ *
|
|
|
+ * @param uid
|
|
|
+ * @param channel
|
|
|
+ * @param filter
|
|
|
+ * @param page
|
|
|
+ * @param pageSize
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public R<PayRecordPage> memberPayIndex(String uid, ChannelEnum channel, String filter, Integer page, Integer pageSize) {
|
|
|
+ String sync = getHttp(PayCenterEnum.MEMBER_PAY_INDEX, new HashMap<>() {{
|
|
|
+ put("uid", uid);
|
|
|
+ put("channel", channel);
|
|
|
+ put("filter", filter);
|
|
|
+ put("page", page);
|
|
|
+ put("pageSize", pageSize);
|
|
|
+ }});
|
|
|
+ return JSONObject.parseObject(sync, new TypeReference<>() {
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 创建/更新账户
|
|
|
+ *
|
|
|
+ * @param memberCreate
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public R<MemberRes> memberIndex(MemberCreate memberCreate) {
|
|
|
+ Map<String, Object> map = JSONObject.parseObject(JSONObject.toJSONString(memberCreate), new TypeReference<>() {
|
|
|
+ });
|
|
|
+ String sync = postHttp(PayCenterEnum.MEMBER_INDEX, map);
|
|
|
+ return JSONObject.parseObject(sync, new TypeReference<>() {
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 在线充值
|
|
|
+ *
|
|
|
+ * @param buyUid 付款方/乙方/买货方 账户
|
|
|
+ * @param sellUid 收款方/甲方/供货方 账户
|
|
|
+ * @param channel 渠道方
|
|
|
+ * @param money 金额,单位分
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public R<PayIndex> payIndex(String buyUid, String sellUid, ChannelEnum channel, Long money) {
|
|
|
+ String sync = postHttp(PayCenterEnum.PAY_INDEX, new HashMap<>() {{
|
|
|
+ put("buyUid", buyUid);
|
|
|
+ put("sellUid", sellUid);
|
|
|
+ put("channel", channel);
|
|
|
+ put("money", money);
|
|
|
+ }});
|
|
|
+
|
|
|
+ return JSONObject.parseObject(sync, new TypeReference<>() {
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 冻结资金
|
|
|
+ *
|
|
|
+ * @param uid 付款方uid
|
|
|
+ * @param channel 支付通道
|
|
|
+ * @param money 冻结金额,单位分
|
|
|
+ * @param filter 收款方uid
|
|
|
+ * @param businessNo 流水号
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public R<Freeze> walletFreeze(String uid, ChannelEnum channel, String filter, Long money, String businessNo) {
|
|
|
+ String sync = postHttp(PayCenterEnum.WALLET_FREEZE, new HashMap<>() {{
|
|
|
+ put("uid", uid);
|
|
|
+ put("filter", filter);
|
|
|
+ put("channel", channel);
|
|
|
+ put("money", money);
|
|
|
+ put("businessNo", businessNo);
|
|
|
+ }});
|
|
|
+ return JSONObject.parseObject(sync, new TypeReference<>() {
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 解冻金额
|
|
|
+ *
|
|
|
+ * @param businessNo
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public R<BusinessNo> walletUnFreeze(String businessNo) {
|
|
|
+ String sync = postHttp(PayCenterEnum.WALLET_UNFREEZE, new HashMap<>() {{
|
|
|
+ put("business_no", businessNo);
|
|
|
+ }});
|
|
|
+ return JSONObject.parseObject(sync, new TypeReference<>() {
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 清分
|
|
|
+ *
|
|
|
+ * @param buyUid
|
|
|
+ * @param sellUid
|
|
|
+ * @param channel
|
|
|
+ * @param money
|
|
|
+ * @param batchPayList
|
|
|
+ * @param businessNo
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public R<BusinessNo> payAgentPay(String buyUid, String sellUid, ChannelEnum channel, Long money, List<PatchPay> batchPayList, String businessNo) {
|
|
|
+ String sync = postHttp(PayCenterEnum.PAY_AGENT_PAY, new HashMap<>() {{
|
|
|
+ put("buy_uid", buyUid);
|
|
|
+ put("sell_uid", sellUid);
|
|
|
+ put("channel", channel);
|
|
|
+ put("money", money);
|
|
|
+ put("batch_pay_list", JSONObject.toJSONString(batchPayList));
|
|
|
+ put("business_no", businessNo);
|
|
|
+ }});
|
|
|
+ return JSONObject.parseObject(sync, new TypeReference<>() {
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 创建钱包
|
|
|
+ *
|
|
|
+ * @param uid
|
|
|
+ * @param channel
|
|
|
+ * @param filter
|
|
|
+ * @param nickname
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public R<Object> walletIndex(@NotBlank(message = "uid不能为空") String uid,
|
|
|
+ @NotNull(message = "支付渠道不能为空") ChannelEnum channel,
|
|
|
+ @NotBlank(message = "filter不能为空") String filter, String nickname) {
|
|
|
+ String sync = postHttp(PayCenterEnum.WALLET_INDEX, new HashMap<>() {{
|
|
|
+ put("uid", uid);
|
|
|
+ put("channel", channel);
|
|
|
+ put("filter", filter);
|
|
|
+ put("nickname", nickname);
|
|
|
+ }});
|
|
|
+ return JSONObject.parseObject(sync, new TypeReference<>() {
|
|
|
+ });
|
|
|
+ }
|
|
|
}
|