Search in sources :

Example 1 with PaySendRedpack

use of com.github.liuweijw.business.pay.domain.PaySendRedpack in project fw-cloud-framework by liuweijw.

the class PaySendRedpackController method sendRedpack.

@RequestMapping(value = "/sendRedpack")
public R<Map<String, Object>> sendRedpack(@RequestBody PaySendRedpackReqBean paySendRedpackReqBean) {
    PaySendRedpack paySendRedpack = new PaySendRedpack();
    WxPaySendRedpackRequestBuilder wxPaySendRedpackRequestBuilder = WxPaySendRedpackRequest.newBuilder();
    R<Boolean> validateResult = validateSendRedpackReqParams(paySendRedpackReqBean, paySendRedpack, wxPaySendRedpackRequestBuilder);
    if (!validateResult.getData()) {
        log.info(JSON.toJSONString(validateResult));
        Map<String, Object> returnMap = PayUtil.makeRetData(PayUtil.makeRetMap(PayConstant.RETURN_VALUE_SUCCESS, validateResult.getMsg(), null, null, null), paySendRedpack.getResKey());
        log.info(JSON.toJSONString(returnMap));
        return new R<Map<String, Object>>().data(returnMap).failure();
    }
    return wxSendRedpackService.sendRedpack(paySendRedpack, wxPaySendRedpackRequestBuilder.build());
}
Also used : R(com.github.liuweijw.commons.base.R) WxPaySendRedpackRequestBuilder(com.github.binarywang.wxpay.bean.request.WxPaySendRedpackRequest.WxPaySendRedpackRequestBuilder) JSONObject(com.alibaba.fastjson.JSONObject) PaySendRedpack(com.github.liuweijw.business.pay.domain.PaySendRedpack) RequestMapping(org.springframework.web.bind.annotation.RequestMapping)

Aggregations

JSONObject (com.alibaba.fastjson.JSONObject)1 WxPaySendRedpackRequestBuilder (com.github.binarywang.wxpay.bean.request.WxPaySendRedpackRequest.WxPaySendRedpackRequestBuilder)1 PaySendRedpack (com.github.liuweijw.business.pay.domain.PaySendRedpack)1 R (com.github.liuweijw.commons.base.R)1 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)1