@Override public void addOrderAttributeToOrder(Long orderId, String orderAttributeKey, String orderAttributeValue) throws PaymentException { Order currentCart = CartState.getCart(); Long currentCartId = currentCart.getId(); if (orderId != null && !currentCartId.equals(orderId)) { logWarningIfCartMismatch(currentCartId, orderId); currentCart = orderService.findOrderById(orderId); } OrderAttribute orderAttribute = new OrderAttributeImpl(); orderAttribute.setName(orderAttributeKey); orderAttribute.setValue(orderAttributeValue); orderAttribute.setOrder(currentCart); currentCart.getOrderAttributes().put(orderAttributeKey, orderAttribute); try { orderService.save(currentCart, false); } catch (PricingException e) { throw new PaymentException(e); } }
OrderAttribute channelAttribute = new OrderAttributeImpl(); channelAttribute.setName("channel"); channelAttribute.setValue(channel);