com.alipay.api.response.AlipayFundTransToaccountTransferResponse Java Examples

The following examples show how to use com.alipay.api.response.AlipayFundTransToaccountTransferResponse. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AlipayTransferResult.java    From anyline with Apache License 2.0 5 votes vote down vote up
public AlipayTransferResult(AlipayFundTransToaccountTransferResponse res){ 
	setSuccess(res.isSuccess()); 
	setCode(res.getCode()); 
	setSub_code(res.getSubCode()); 
	setMsg(res.getMsg()); 
	setSub_msg(res.getSubMsg()); 
	 
	setOut_biz_no(res.getOutBizNo()); 
	setOrder_id(res.getOrderId()); 
	setPay_date(res.getPayDate()); 
}
 
Example #2
Source File: AliPayService.java    From java-pay with Apache License 2.0 5 votes vote down vote up
/**
 * 支付宝提现
 *
 * @param orderId
 */
public Result deposit(Long orderId) {
    // 校验订单信息
    Order order = orderService.findOne(orderId);
    if (order.getStatus() != OrderStatus.CREATE.getStatus()) {
        log.error(ExceptionMessage.ORDER_STATUS_INCORRECTNESS + " orderId: {}", orderId);
        throw new ValidateException(ExceptionMessage.ORDER_STATUS_INCORRECTNESS);
    }

    AlipayFundTransToaccountTransferModel transferModel = new AlipayFundTransToaccountTransferModel();

    transferModel.setOutBizNo(1 + RandomUtil.randomNum(15));
    transferModel.setAmount(order.getTotalFee().toString());
    transferModel.setPayeeAccount("real account");
    transferModel.setPayeeRealName("real name");
    transferModel.setPayerShowName("from name");
    transferModel.setRemark("remark");
    transferModel.setPayeeType("ALIPAY_LOGONID");
    try {
        AlipayFundTransToaccountTransferRequest request = new AlipayFundTransToaccountTransferRequest();
        request.setBizModel(transferModel);
        AlipayFundTransToaccountTransferResponse response = alipayClient.execute(request);
    } catch (AlipayApiException e) {
        log.info("ali deposit error message:{}", e.getMessage());
        return Result.success(ExceptionMessage.ALI_DEPOSIT_SUCCESS);
    }
    return Result.error(ExceptionMessage.ALI_DEPOSIT_FAILED);
}
 
Example #3
Source File: AlipayFundTransToaccountTransferRequest.java    From alipay-sdk-java-all with Apache License 2.0 4 votes vote down vote up
public Class<AlipayFundTransToaccountTransferResponse> getResponseClass() {
	return AlipayFundTransToaccountTransferResponse.class;
}
 
Example #4
Source File: AlipayFundTransToaccountTransferRequest.java    From alipay-sdk with Apache License 2.0 4 votes vote down vote up
public Class<AlipayFundTransToaccountTransferResponse> getResponseClass() {
	return AlipayFundTransToaccountTransferResponse.class;
}
 
Example #5
Source File: PayChannel4AliServiceImpl.java    From xxpay-master with MIT License 4 votes vote down vote up
/**
 * 支付宝转账,文档:https://docs.open.alipay.com/api_28/alipay.fund.trans.toaccount.transfer
 * @param jsonParam
 * @return
 */
@Override
public Map doAliTransReq(String jsonParam) {
    String logPrefix = "【支付宝转账】";
    BaseParam baseParam = JsonUtil.getObjectFromJson(jsonParam, BaseParam.class);
    Map<String, Object> bizParamMap = baseParam.getBizParamMap();
    if (ObjectValidUtil.isInvalid(bizParamMap)) {
        _log.warn("{}失败, {}. jsonParam={}", logPrefix, RetEnum.RET_PARAM_NOT_FOUND.getMessage(), jsonParam);
        return RpcUtil.createFailResult(baseParam, RetEnum.RET_PARAM_NOT_FOUND);
    }
    JSONObject transOrderObj = baseParam.isNullValue("transOrder") ? null : JSONObject.parseObject(bizParamMap.get("transOrder").toString());
    TransOrder transOrder = JSON.toJavaObject(transOrderObj, TransOrder.class);
    if (ObjectValidUtil.isInvalid(transOrder)) {
        _log.warn("{}失败, {}. jsonParam={}", logPrefix, RetEnum.RET_PARAM_INVALID.getMessage(), jsonParam);
        return RpcUtil.createFailResult(baseParam, RetEnum.RET_PARAM_INVALID);
    }
    String transOrderId = transOrder.getTransOrderId();
    String mchId = transOrder.getMchId();
    String channelId = transOrder.getChannelId();
    PayChannel payChannel = baseService4TransOrder.baseSelectPayChannel(mchId, channelId);
    alipayConfig.init(payChannel.getParam());
    AlipayClient client = new DefaultAlipayClient(alipayConfig.getUrl(), alipayConfig.getApp_id(), alipayConfig.getRsa_private_key(), AlipayConfig.FORMAT, AlipayConfig.CHARSET, alipayConfig.getAlipay_public_key(), AlipayConfig.SIGNTYPE);
    AlipayFundTransToaccountTransferRequest request = new AlipayFundTransToaccountTransferRequest();
    AlipayFundTransToaccountTransferModel model = new AlipayFundTransToaccountTransferModel();
    model.setOutBizNo(transOrderId);
    model.setPayeeType("ALIPAY_LOGONID");                            // 收款方账户类型
    model.setPayeeAccount(transOrder.getChannelUser());              // 收款方账户
    model.setAmount(AmountUtil.convertCent2Dollar(transOrder.getAmount().toString()));
    model.setPayerShowName("支付转账");
    model.setPayeeRealName(transOrder.getUserName());
    model.setRemark(transOrder.getRemarkInfo());
    request.setBizModel(model);
    Map<String, Object> map = new HashMap<>();
    map.put("transOrderId", transOrderId);
    map.put("isSuccess", false);
    try {
        AlipayFundTransToaccountTransferResponse response = client.execute(request);
        if(response.isSuccess()) {
            map.put("isSuccess", true);
            map.put("channelOrderNo", response.getOrderId());
        }else {
            //出现业务错误
            _log.info("{}返回失败", logPrefix);
            _log.info("sub_code:{},sub_msg:{}", response.getSubCode(), response.getSubMsg());
            map.put("channelErrCode", response.getSubCode());
            map.put("channelErrMsg", response.getSubMsg());
        }
    } catch (AlipayApiException e) {
        _log.error(e, "");
    }
    return RpcUtil.createBizResult(baseParam, map);
}
 
Example #6
Source File: AlipayFundTransToaccountTransferRequest.java    From pay with Apache License 2.0 4 votes vote down vote up
public Class<AlipayFundTransToaccountTransferResponse> getResponseClass() {
	return AlipayFundTransToaccountTransferResponse.class;
}