Search in sources :

Example 6 with Order

use of com.stardata.starshop2.ordercontext.command.domain.order.Order in project starshop by beautautumn.

the class OrderAppService method autoConfirm.

public void autoConfirm() {
    List<Order> orders = managingService.getConfirmExpired();
    for (Order order : orders) {
        managingService.closeOrder(order);
        OrderClosedEvent orderEvent = new OrderClosedEvent(order);
        orderEventPublisher.publish(orderEvent);
    }
}
Also used : WxPrepayOrder(com.stardata.starshop2.ordercontext.command.domain.order.WxPrepayOrder) Order(com.stardata.starshop2.ordercontext.command.domain.order.Order)

Example 7 with Order

use of com.stardata.starshop2.ordercontext.command.domain.order.Order in project starshop by beautautumn.

the class OrderAppService method create.

public OrderResponse create(SessionUser loginUser, Long shopId, OrderSubmitRequest request) {
    Order order = request.toOrder(loginUser.getId(), shopId);
    managingService.submitOrder(LongIdentity.from(loginUser.getId()), order);
    return OrderResponse.from(order);
}
Also used : WxPrepayOrder(com.stardata.starshop2.ordercontext.command.domain.order.WxPrepayOrder) Order(com.stardata.starshop2.ordercontext.command.domain.order.Order)

Example 8 with Order

use of com.stardata.starshop2.ordercontext.command.domain.order.Order in project starshop by beautautumn.

the class OrderAppService method handleWxPayNotify.

public String handleWxPayNotify(OrderPayResultRequest request) {
    try {
        WxPayResult wxPayResult = request.toWxPayResult();
        Order order = managingService.makeOrderEffectively(wxPayResult);
        OrderPaidEvent orderEvent = new OrderPaidEvent(order);
        orderEventPublisher.publish(orderEvent);
        return WxPayNotifyResponse.success("成功");
    } catch (Exception e) {
        return WxPayNotifyResponse.fail(e.getMessage());
    }
}
Also used : WxPrepayOrder(com.stardata.starshop2.ordercontext.command.domain.order.WxPrepayOrder) Order(com.stardata.starshop2.ordercontext.command.domain.order.Order) WxPayResult(com.stardata.starshop2.ordercontext.command.domain.order.WxPayResult)

Example 9 with Order

use of com.stardata.starshop2.ordercontext.command.domain.order.Order in project starshop by beautautumn.

the class OrderManagingService method getConfirmExpired.

public List<Order> getConfirmExpired() {
    BizParameter parameter = parameterRepository.instanceOf("max_minutes_remain_toconfirm");
    int maxMinutes = parameter.toInteger();
    return orderRepository.findConfirmExpired(maxMinutes);
}
Also used : BizParameter(com.stardata.starshop2.sharedcontext.domain.BizParameter)

Example 10 with Order

use of com.stardata.starshop2.ordercontext.command.domain.order.Order in project starshop by beautautumn.

the class OrderManagingService method getPayExpired.

public List<Order> getPayExpired() {
    BizParameter parameter = parameterRepository.instanceOf("max_minutes_remain_topay");
    int maxMinutes = parameter.toInteger();
    return orderRepository.findPayExpired(maxMinutes);
}
Also used : BizParameter(com.stardata.starshop2.sharedcontext.domain.BizParameter)

Aggregations

Order (com.stardata.starshop2.ordercontext.command.domain.order.Order)9 WxPrepayOrder (com.stardata.starshop2.ordercontext.command.domain.order.WxPrepayOrder)9 LongIdentity (com.stardata.starshop2.sharedcontext.domain.LongIdentity)3 BizParameter (com.stardata.starshop2.sharedcontext.domain.BizParameter)2 WxPayResult (com.stardata.starshop2.ordercontext.command.domain.order.WxPayResult)1