title: How to handle cross domain logic in Domain Driven Design
body: <p>I am new in DDD and I am trying to use it in my Go REST API project. I am quite confuse about how to handle the situation when there are logic which may cross the domain.</p>
  
  <p>Let say I have the following folder structure where I have two domains (Customer and Order):</p>
  
  <pre><code>+.
  -- Customer
     +-- service
         +-- http
     +-- usecase
     +-- repository
  -- Order
     +-- service
         +-- http
     +-- usecase
     +-- repository
  </code></pre>
  
  <p>In general speaking, assume there is an endpoint in the <code>Order</code> domain that would provide a create order feature, then the http service should act as a router and call the corresponding <code>usecase</code> to handle the logic by adding order data to the <code>repository</code> (database).</p>
  
  <p>How about if I would like to add a new logic that customer will get certain <code>reward points</code> when they create an order. Assume there is a <code>CreateOrder</code> function in the usecase to create a new order into the database, but how should I interactive with the <code>Customer</code> domain so that I could add <code>reward points</code> to a customer?</p>
  
  <p>I am thinking of calling the Customer usecase function from the Order usecase function but I am not sure whether it will trigger the <code>circular import</code> issue.</p>