org.zeroexchange.money.currency.che
Class CHECreditManager

java.lang.Object
  extended by org.zeroexchange.money.currency.AbstractCurrencyManager
      extended by org.zeroexchange.money.currency.che.CHECreditManager
All Implemented Interfaces:
DataProcessor, EventProcessor<UserLogged>, CurrencyManager

@Transactional
public class CHECreditManager
extends AbstractCurrencyManager
implements EventProcessor<UserLogged>

Author:
black

Constructor Summary
CHECreditManager()
           
 
Method Summary
 void freeAmount(BigDecimal amount, ZECurrency currencyCode, User user)
          Frees amount of money in the specified currency.
 BigDecimal getAllowedDebt(ZECurrency currencyCode, User user)
          Returns maximal value of user's allowed debt.
 BigDecimal getAvailableAmount(ZECurrency currencyCode, User user)
          Returns available amount of the specified current user for the specified code.
protected  BigDecimal getPaymentsSum(ZECurrency currencyCode, User user)
          Returns payments sum value.
 Class<UserLogged> getProcessingClass()
          Class of the message that is processed by current listener.
 String[] getSupportedCurrencyCodes()
          Return currencies codes that are supported by current provider.
 boolean isMoneyMovementEnabled(ZECurrency currencyCode)
          Returns true if the money movement is enabled.
 void onEvent(UserLogged event)
          Cleans up user's zero payments on user's login.
 void reserveAmount(BigDecimal amount, ZECurrency currencyCode, User user)
          Reserves amount of money in the specified currency.
 void setDebtRate(BigDecimal debtRate)
           
 void setFlatness(double flatness)
           
 void writeOn(BigDecimal amount, ZECurrency currencyCode, User consumer)
          Writes on amount of money in the specified currency.
 
Methods inherited from class org.zeroexchange.money.currency.AbstractCurrencyManager
getHourPrice, getHourRate, getMaxRate, isOutlayAllowed, setMaxRate, setMinimalAveragePrice, setMinRate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CHECreditManager

public CHECreditManager()
Method Detail

setFlatness

public void setFlatness(double flatness)

setDebtRate

public void setDebtRate(BigDecimal debtRate)

getSupportedCurrencyCodes

public String[] getSupportedCurrencyCodes()
Return currencies codes that are supported by current provider.

Specified by:
getSupportedCurrencyCodes in interface CurrencyManager

getAvailableAmount

public BigDecimal getAvailableAmount(ZECurrency currencyCode,
                                     User user)
Returns available amount of the specified current user for the specified code.

Specified by:
getAvailableAmount in interface CurrencyManager

getPaymentsSum

protected BigDecimal getPaymentsSum(ZECurrency currencyCode,
                                    User user)
Returns payments sum value.


reserveAmount

public void reserveAmount(BigDecimal amount,
                          ZECurrency currencyCode,
                          User user)
Reserves amount of money in the specified currency.

Specified by:
reserveAmount in interface CurrencyManager

freeAmount

public void freeAmount(BigDecimal amount,
                       ZECurrency currencyCode,
                       User user)
Frees amount of money in the specified currency.

Specified by:
freeAmount in interface CurrencyManager

writeOn

public void writeOn(BigDecimal amount,
                    ZECurrency currencyCode,
                    User consumer)
Writes on amount of money in the specified currency.

Specified by:
writeOn in interface CurrencyManager

isMoneyMovementEnabled

public boolean isMoneyMovementEnabled(ZECurrency currencyCode)
Returns true if the money movement is enabled.

Specified by:
isMoneyMovementEnabled in interface CurrencyManager

getAllowedDebt

public BigDecimal getAllowedDebt(ZECurrency currencyCode,
                                 User user)
Returns maximal value of user's allowed debt.

Specified by:
getAllowedDebt in interface CurrencyManager

getProcessingClass

public Class<UserLogged> getProcessingClass()
Class of the message that is processed by current listener.

Specified by:
getProcessingClass in interface DataProcessor

onEvent

@Transactional
public void onEvent(UserLogged event)
Cleans up user's zero payments on user's login.

Specified by:
onEvent in interface EventProcessor<UserLogged>


Copyright © 2013. All Rights Reserved.