| | |
| | | import cc.mrbird.febs.mall.service.IApiMallMemberWalletService; |
| | | import cc.mrbird.febs.mall.service.ICommonService; |
| | | import cc.mrbird.febs.mall.vo.*; |
| | | import cc.mrbird.febs.pay.model.BrandWCPayRequestData; |
| | | import cc.mrbird.febs.pay.service.IXcxPayService; |
| | | import cn.hutool.core.bean.BeanUtil; |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import cn.hutool.core.util.IdUtil; |
| | |
| | | import cn.hutool.crypto.SecureUtil; |
| | | import cn.hutool.crypto.asymmetric.KeyType; |
| | | import cn.hutool.crypto.asymmetric.RSA; |
| | | import cn.hutool.json.JSONUtil; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | |
| | | return new FebsResponse().success().data(1); |
| | | } |
| | | |
| | | private final IXcxPayService iXcxPayService; |
| | | |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public FebsResponse rechargeWallet(ApiRechargeWalletDto apiRechargeWalletDto) { |
| | | Long memberId = LoginUserUtil.getLoginUser().getId(); |
| | | BigDecimal amount = apiRechargeWalletDto.getAmount(); |
| | | if(BigDecimal.ZERO.compareTo(amount)>0){ |
| | | return new FebsResponse().fail().message("请输入正确的充值金额"); |
| | | } |
| | | apiRechargeWalletDto.setMemberId(memberId); |
| | | BrandWCPayRequestData brandWCPayRequestData = null; |
| | | try { |
| | | brandWCPayRequestData = iXcxPayService.startRechargeWallet(apiRechargeWalletDto); |
| | | } catch (Exception e) { |
| | | throw new FebsException("支付失败"); |
| | | } |
| | | String wxResultStr = JSONUtil.toJsonStr(brandWCPayRequestData); |
| | | String payResultStr = brandWCPayRequestData.getPrepay_id(); |
| | | return new FebsResponse().success().message("充值即将到账"); |
| | | } |
| | | |
| | | private String getXcxLoginUrl(String code) { |
| | | String wechatLoginUrl =xcxProperties.getWecharLoginUrl(); |
| | | return String.format(wechatLoginUrl, xcxProperties.getXcxAppid(), xcxProperties.getXcxSecret(), code); |