@Override public void onEvent(Event event, Object source, Object data) { final Order order = (Order) source; Map<String, Object> payload = Maps.newHashMap(); payload.put("customer", order.getCustomer().getEmail()); payload.put("order", order.getSlug()); webhooks.notifyHook(new OrderPaid(), payload); } }
context.put("orderId", order.getSlug()); context.put("grandTotal", grandTotal);
context.put("orderId", order.getSlug()); context.put("grandTotal", grandTotal); context.put("additionalInformation", order.getAdditionalInformation());
@Override public void update(@Valid Order order) throws EntityDoesNotExistException, InvalidEntityException { this.dao.begin(); Order originalOrder = this.findBySlug(order.getSlug()); if (originalOrder == null) { this.dao.commit(); throw new EntityDoesNotExistException(); } order.setId(originalOrder.getId()); Integer updatedRows = this.dao.updateOrder(order); this.dao.commit(); if (updatedRows <= 0) { throw new StoreException("No rows was updated when updating order"); } }
public OrderRepresentation(DateTimeZone tenantZone, Order order) { this.slug = order.getSlug(); if (order.getCreationDate() != null) { this.creationDate = new DateTime(order.getCreationDate().getTime(), tenantZone); } if (order.getUpdateDate() != null) { this.updateDate = new DateTime(order.getUpdateDate().getTime(), tenantZone); } this.currency = order.getCurrency(); this.numberOfItems = order.getNumberOfItems(); this.itemsTotal = order.getItemsTotal(); this.shipping = order.getShipping(); this.grandTotal = order.getGrandTotal(); this.status = order.getStatus(); this.additionalInformation = order.getAdditionalInformation(); this.data = order.getOrderData(); if (order.getBillingAddress() != null) { this.setBillingAddress(new AddressRepresentation(order.getBillingAddress())); } if (order.getDeliveryAddress() != null) { this.setDeliveryAddress(new AddressRepresentation(order.getDeliveryAddress())); } if (order.getCustomer() != null) { this.setCustomer(new CustomerRepresentation(order.getCustomer())); } }