src/main/java/org/edgegallery/appstore/interfaces/order/facade/OrderServiceFacade.java
public ResponseEntity<ResponseObject> createOrder(String userId, String userName, CreateOrderReqDto addOrderReqDto,
        String token) {
        Release release = appService.getRelease(addOrderReqDto.getAppId(), addOrderReqDto.getAppPackageId());
        if (!Consts.SUPER_ADMIN_NAME.equals(userName) && userId.equals(release.getUser().getUserId())) {
            LOGGER.error("User can not subscribe to its own app, order creation failed");
            throw new AppException("User can not subscribe to its own app", ResponseConst.RET_SUBSCRIBE_OWN_APP);
        }
        String orderId = UUID.randomUUID().toString();
        String orderNum = orderService.generateOrderNum();
        Order order = new Order(orderId, orderNum, userId, userName, addOrderReqDto);
        orderService.setOrderDetail(order, EnumOrderOperation.CREATED.getChinese(),
            EnumOrderOperation.CREATED.getEnglish());
        orderRepository.addOrder(order);
        LOGGER.info("Created order successfully");
        orderService.startActivatingOrder(release, order, token, userId);
        return ResponseEntity.ok(new ResponseObject(CreateOrderRspDto.builder().orderId(orderId).orderNum(orderNum)
            .build(), new ErrorMessage(ResponseConst.RET_SUCCESS,null), "Created order Successfully"));

    }
/**
     * create order.
     *
     * @param userId user id
     * @param userName user name
     * @param addOrderReqDto request body
     * @return result
     */
create order.
@param userId user id
@param userName user name
@param addOrderReqDto request body
@return result
create order . @param userId user id @param userName user name @param addOrderReqDto request body @return result
public ResponseEntity<ResponseObject> createOrder(String userId, String userName, CreateOrderReqDto addOrderReqDto,
        String token) {
        Release release = appService.getRelease(addOrderReqDto.getAppId(), addOrderReqDto.getAppPackageId());
        if (!Consts.SUPER_ADMIN_NAME.equals(userName) && userId.equals(release.getUser().getUserId())) {
            LOGGER.error("User can not subscribe to its own app, order creation failed");
            throw new AppException("User can not subscribe to its own app", ResponseConst.RET_SUBSCRIBE_OWN_APP);
        }
        String orderId = UUID.randomUUID().toString();
        String orderNum = orderService.generateOrderNum();
        Order order = new Order(orderId, orderNum, userId, userName, addOrderReqDto);
        orderService.setOrderDetail(order, EnumOrderOperation.CREATED.getChinese(),
            EnumOrderOperation.CREATED.getEnglish());
        orderRepository.addOrder(order);
        LOGGER.info("Created order successfully");
        orderService.startActivatingOrder(release, order, token, userId);
        return ResponseEntity.ok(new ResponseObject(CreateOrderRspDto.builder().orderId(orderId).orderNum(orderNum)
            .build(), new ErrorMessage(ResponseConst.RET_SUCCESS,null), "Created order Successfully"));
    }
public ResponseEntity < ResponseObject > createOrder ( String userId , String userName , CreateOrderReqDto addOrderReqDto , String token ) { Release release = appService . getRelease ( addOrderReqDto . getAppId ( ) , addOrderReqDto . getAppPackageId ( ) ) ; if ( ! Consts . SUPER_ADMIN_NAME . equals ( userName ) && userId . equals ( release . getUser ( ) . getUserId ( ) ) ) { LOGGER . error ( "User can not subscribe to its own app, order creation failed" ) ; throw new AppException ( "User can not subscribe to its own app" , ResponseConst . RET_SUBSCRIBE_OWN_APP ) ; } String orderId = UUID . randomUUID ( ) . toString ( ) ; String orderNum = orderService . generateOrderNum ( ) ; Order order = new Order ( orderId , orderNum , userId , userName , addOrderReqDto ) ; orderService . setOrderDetail ( order , EnumOrderOperation . CREATED . getChinese ( ) , EnumOrderOperation . CREATED . getEnglish ( ) ) ; orderRepository . addOrder ( order ) ; LOGGER . info ( "Created order successfully" ) ; orderService . startActivatingOrder ( release , order , token , userId ) ; return ResponseEntity . ok ( new ResponseObject ( CreateOrderRspDto . builder ( ) . orderId ( orderId ) . orderNum ( orderNum ) . build ( ) , new ErrorMessage ( ResponseConst . RET_SUCCESS , null ) , "Created order Successfully" ) ) ; }
create order.
create order .