Assert.isTrue(order.getPaymentId() == null, "Payment has already been created");
Assert.isTrue(!Arrays.asList(OrderStatus.PAYMENT_CREATED,
OrderStatus.PAYMENT_CONNECTED,
OrderStatus.PAYMENT_SUCCEEDED,
OrderStatus.PAYMENT_PENDING).contains(order.getStatus()), "Payment has already been created");
<BUG>Assert.isTrue(order.getStatus() == OrderStatus.ACCOUNT_CONNECTED, "Account must be connected first");
OrderService orderService = order.getModule(OrderModule.class).getDefaultService();</BUG>
order.setStatus(OrderStatus.PAYMENT_PENDING);
order = orderService.update(order);
Payment payment = new Payment();

Assert.isTrue(order.getPaymentId() == null, "Payment has already been created");
Assert.isTrue(!Arrays.asList(OrderStatus.PAYMENT_CREATED,
OrderStatus.PAYMENT_CONNECTED,
OrderStatus.PAYMENT_SUCCEEDED,
OrderStatus.PAYMENT_PENDING).contains(order.getStatus()), "Payment has already been created");
Assert.isTrue(order.getStatus() == OrderStatus.RESERVATION_SUCCEEDED,
"Inventory reservations for the order must be made first before creating a payment");
OrderService orderService = order.getModule(OrderModule.class).getDefaultService();
order.setStatus(OrderStatus.PAYMENT_PENDING);
order = orderService.update(order);
Payment payment = new Payment();
