contract PostDeliveryCrowdsale is TimedCrowdsale {
  using SafeMath for uint256;

  mapping(address => uint256) public balances;

  /**
   * @dev Withdraw tokens only after whitelisted ends and after crowdsale ends.
   */
   
  
  function withdrawTokens() public {
   require(hasClosed());
    uint256 amount = balances[msg.sender];
    require(amount > 0);
    balances[msg.sender] = 0;
    _deliverTokens(msg.sender, amount);
  }
  
  
   function failedWhitelist(address _beneficiary) internal  {
    require(_beneficiary != address(0));
    uint256 amount = balances[_beneficiary];
    balances[_beneficiary] = 0;
  }
  function getInvestorDepositAmount(address _investor) public constant returns(uint256 paid){
     
     return balances[_investor];
 }

  /**
   * @dev Overrides parent by storing balances instead of issuing tokens right away.
   * @param _beneficiary Token purchaser
   * @param _tokenAmount Amount of tokens purchased
   */
  function _processPurchase(address _beneficiary, uint256 _tokenAmount) internal {
    balances[_beneficiary] = balances[_beneficiary].add(_tokenAmount);
  }

}
/**
 * @title PostDeliveryCrowdsale
 * @dev Crowdsale that locks tokens from withdrawal until it whitelisted and crowdsale ends.
 */
function withdrawTokens() public {
 require(hasClosed());
  uint256 amount = balances[msg.sender];
  require(amount > 0);
  balances[msg.sender] = 0;
  _deliverTokens(msg.sender, amount);
}

/**
 * @dev Withdraw tokens only after whitelisted ends and after crowdsale ends.
 */