|
|
|
@ -5,6 +5,7 @@ import com.qniao.dam.api.command.paymentchannelorder.user.request.PrePayThirdPar |
|
|
|
import com.qniao.dam.api.command.paymentchannelorder.user.request.ThirdPartyField; |
|
|
|
import com.qniao.dam.application.service.paymentchannelorder.PaymentChannelOrderApplicationService; |
|
|
|
import com.qniao.dam.domain.aggregate.paymentchannelorder.entity.PaymentChannelOrder; |
|
|
|
import com.qniao.dam.infrastructure.utils.IPUtil; |
|
|
|
import com.qniao.framework.utils.ServletUtils; |
|
|
|
import io.swagger.annotations.Api; |
|
|
|
import io.swagger.annotations.ApiOperation; |
|
|
|
@ -12,6 +13,7 @@ import org.springframework.validation.annotation.Validated; |
|
|
|
import org.springframework.web.bind.annotation.*; |
|
|
|
|
|
|
|
import javax.annotation.Resource; |
|
|
|
import javax.servlet.http.HttpServletRequest; |
|
|
|
import java.util.List; |
|
|
|
import java.util.Map; |
|
|
|
|
|
|
|
@ -25,12 +27,14 @@ public class PaymentChannelOrderUserCommandController { |
|
|
|
|
|
|
|
@ApiOperation("用户发起第三方预支付") |
|
|
|
@PostMapping("/pre-pay/third-party") |
|
|
|
public Map<String, String> prePayThirdParty(@RequestBody @Validated PrePayThirdPartyDto dto, |
|
|
|
public Map<String, String> prePayThirdParty(HttpServletRequest request, |
|
|
|
@RequestBody @Validated PrePayThirdPartyDto dto, |
|
|
|
@RequestParam Long userId) { |
|
|
|
Long appFrom = Long.valueOf(ServletUtils.getAppId()); |
|
|
|
PaymentChannelOrder paymentChannelOrder = dto.trans2Domain(); |
|
|
|
paymentChannelOrder.setAppId(Long.valueOf(ServletUtils.getAppId())); |
|
|
|
List<ThirdPartyField> fieldList = ThirdPartyFieldAssembler.from(dto.getThirdPartyFields()); |
|
|
|
fieldList.add(new ThirdPartyField(ThirdPartyField.PAYER_CLIENT_IP, IPUtil.getIp(request))); |
|
|
|
//todo 付款单状态判断 订单支付方式是否满足 |
|
|
|
return paymentChannelOrderApplicationService.prePay(paymentChannelOrder, fieldList, appFrom); |
|
|
|
} |
|
|
|
|