Esempio n. 1
0
 @Override
 public void allowPayout(
     Context respCtx,
     Game game,
     PayoutLevelAllowRequest[] levelAllowRequests,
     BigDecimal actualPayout)
     throws ApplicationException {
   // verify whether the game has been allocated
   MerchantCommission comm =
       this.getMerchantCommissionDao()
           .getByMerchantAndGame(respCtx.getTransaction().getMerchantId(), game.getId());
   if (comm == null || !comm.isAllowPayout()) {
     throw new SystemException(
         SystemException.CODE_OPERATOR_PAYOUT_NOPRIVILEDGE,
         "operator(id="
             + respCtx.getOperatorId()
             + ") has no priviledge to payout ticket of game '"
             + game.getId()
             + "', allocate the game to its merchant(id="
             + respCtx.getTransaction().getMerchantId()
             + ") first.");
   }
   GameType gameType = GameType.fromType(game.getType());
   // only need to check the prize group constraints of operator
   PrizeGroup prizeGroup = respCtx.getOperator().getPrizeGroup();
   if (!prizeGroup.isPayoutAllowed()) {
     throw new ApplicationException(
         SystemException.CODE_MERCHANT_UNALLOWED_PAY,
         "Operator(" + respCtx.getOperator() + ") doesn't allow payout.");
   }
   // ** both conditions must be satisfied
   // by payout limit
   if (new BigDecimal("0").compareTo(actualPayout) != 0) {
     this.verifyPayoutByLimit(respCtx, actualPayout, respCtx.getOperator());
   }
   // for odds and fix-prize game, no need to check prize level.
   if (!gameType.isFixedPrize()) {
     // by prize level
     if (levelAllowRequests != null) {
       for (PayoutLevelAllowRequest levelAllowRequest : levelAllowRequests) {
         this.verifyPayoutByLevel(
             respCtx,
             respCtx.getOperator(),
             levelAllowRequest.getRequestedPrizeLevels(),
             levelAllowRequest.getGameType(),
             levelAllowRequest.getPrizeGroupType());
       }
     }
   }
 }
Esempio n. 2
0
 @Override
 public List<GameType> supportedGameType(long merchantId) throws ApplicationException {
   List<MerchantCommission> mcList = this.getMerchantCommissionDao().getByMerchant(merchantId);
   List<GameType> gameTypes = new LinkedList<GameType>();
   for (MerchantCommission mc : mcList) {
     Game game = mc.getGame();
     // remove duplicated item.
     if (game != null) {
       GameType gameType = GameType.fromType(game.getType());
       if (!gameTypes.contains(gameType)) {
         gameTypes.add(gameType);
       }
     }
   }
   return gameTypes;
 }