Package pl.com.bottega.ecommerce.sales.domain.client

Examples of pl.com.bottega.ecommerce.sales.domain.client.Client


 
  @EventListener
  public void handle(OrderSubmittedEvent event){
    Purchase purchase = purchaseRepository.load(event.getOrderId());
   
    Client client = clientRepository.load(purchase.getClientData().getAggregateId());
    InvoiceRequest request  = invoiceRequestFactory.create(client, purchase);
    Invoice invoice = bookKeeper.issuance(request, taxAdvisor.suggestBestTax(client));
   
    invoiceRepository.save(invoice);
  }
View Full Code Here


    Reservation reservation = reservationRepository.load(command.getOrderId());
   
    Product product = productRepository.load(command.getProductId());
   
    if (! product.isAvailabe()){
      Client client = loadClient()
      product = suggestionService.suggestEquivalent(product, client);
    }
     
    reservation.add(product, command.getQuantity());
   
View Full Code Here

    Reservation reservation = reservationRepository.load(orderId);
   
    Product product = productRepository.load(productId);
   
    if (! product.isAvailabe()){
      Client client = loadClient()
      product = suggestionService.suggestEquivalent(product, client);
    }
     
    reservation.add(product, quantity);
   
View Full Code Here

     * Notice that this VO is not stored in Repo, it's stored on the Client Tier.
     */
    if (! newOffer.sameAs(seenOffer, 5))//TODO load delta from conf.
      throw new OfferChangedExcpetion(reservation.getAggregateId(), seenOffer, newOffer);
   
    Client client = loadClient();//create per logged client, not reservation owner         
    Purchase purchase = purchaseFactory.create(reservation.getAggregateId(), client, seenOffer);
       
    if (! client.canAfford(purchase.getTotalCost()))
      throw new DomainOperationException(client.getAggregateId(), "client has insufficent money");
   
    purchaseRepository.save(purchase);//Aggregate must be managed by persistence context before firing events (synchronous listeners may need to load it)
   
    /*
     * Sample model where one aggregate creates another. Client does not manage payment lifecycle, therefore application must manage it.
     */
    Payment payment = client.charge(purchase.getTotalCost());
    paymentRepository.save(payment);
   
    purchase.confirm()
    reservation.close();       
   
View Full Code Here

TOP

Related Classes of pl.com.bottega.ecommerce.sales.domain.client.Client

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.