public String processOrder(Order order, PaymentInfo payment, ShippingInfo shipping) { CreditCardPayment ccp = new CreditCardPayment(); ccp.setCardholderName(payment.getCardholder_name()); ccp.setCcNum(payment.getCc_num()); ccp.setCcv(payment.getCcv()); ccp.setExp(payment.getExp()); int paymentNumber = Integer.parseInt(service.getPaymentProcessorPort().processPayment(ccp)); if (paymentNumber >= 0) { payment.setConformationNumber(paymentNumber); order.setStatus("Pending"); entityManager.persist(order); entityManager.persist(payment); entityManager.persist(shipping); entityManager.flush(); } else { System.out.println("paymentNumber < 0"); } payment.setCustomer_order_id_fk(order.getId()); shipping.setCustomer_order_id_fk(order.getId()); entityManager.persist(payment); entityManager.persist(order); entityManager.flush(); notifyUser(); return "" + order.getId(); }
public Boolean validateItemAvailability(Order order) { InventoryService sl = ServiceLocator.getInventoryService(); sl.validateQuantity(order.getOrderList()); return true; // return true; }