public CashMoneyTransactionDepositManager( final CashMoneyWalletManager cashMoneyWalletManager, final PluginDatabaseSystem pluginDatabaseSystem, final UUID pluginId, final CashMoneyTransactionDepositPluginRoot pluginRoot) throws CantStartPluginException { this.pluginDatabaseSystem = pluginDatabaseSystem; this.pluginId = pluginId; this.pluginRoot = pluginRoot; this.cashMoneyWalletManager = cashMoneyWalletManager; this.dao = new DepositCashMoneyTransactionDao(pluginDatabaseSystem, pluginId, pluginRoot); try { dao.initialize(); } catch (CantInitializeDepositCashMoneyTransactionDatabaseException e) { pluginRoot.reportError(UnexpectedPluginExceptionSeverity.DISABLES_THIS_PLUGIN, e); throw new CantStartPluginException(Plugins.BITDUBAI_CSH_MONEY_TRANSACTION_DEPOSIT); } catch (Exception e) { throw new CantStartPluginException( CantStartPluginException.DEFAULT_MESSAGE, FermatException.wrapException(e), null, null); } }
@Override public CashDepositTransaction createCashDepositTransaction( CashTransactionParameters depositParameters) throws CantCreateDepositTransactionException { CashMoneyWallet wallet; try { wallet = cashMoneyWalletManager.loadCashMoneyWallet(depositParameters.getPublicKeyWallet()); } catch (CantLoadCashMoneyWalletException e) { pluginRoot.reportError(UnexpectedPluginExceptionSeverity.DISABLES_THIS_PLUGIN, e); throw new CantCreateDepositTransactionException( CantCreateDepositTransactionException.DEFAULT_MESSAGE, e, "CashMoneyTransactionDepositManager", "Failed to load Cash Money Wallet"); } try { // TODO - Revisar el parametro transactionId en este metodo: // wallet.getAvailableBalance().credit(depositParameters.getTransactionId(), // depositParameters.getPublicKeyActor(), depositParameters.getPublicKeyPlugin(), // depositParameters.getAmount(), depositParameters.getMemo()); // TODO - Revisar el parametro transactionId en este metodo porque esta dado excepcion debido // a que es el mismo que el de la instruccion de mas arriba: // wallet.getBookBalance().credit(depositParameters.getTransactionId(), // depositParameters.getPublicKeyActor(), depositParameters.getPublicKeyPlugin(), // depositParameters.getAmount(), depositParameters.getMemo()); // TODO - Se le esta colocando un random ID pra que sea unico. Por favor revisar esto wallet .getAvailableBalance() .credit( UUID.randomUUID(), depositParameters.getPublicKeyActor(), depositParameters.getPublicKeyPlugin(), depositParameters.getAmount(), depositParameters.getMemo()); // TODO - Se le esta colocando un random ID pra que sea unico. Por favor revisar esto wallet .getBookBalance() .credit( UUID.randomUUID(), depositParameters.getPublicKeyActor(), depositParameters.getPublicKeyPlugin(), depositParameters.getAmount(), depositParameters.getMemo()); } catch (CantGetCashMoneyWalletBalanceException e) { pluginRoot.reportError(UnexpectedPluginExceptionSeverity.DISABLES_THIS_PLUGIN, e); throw new CantCreateDepositTransactionException( CantCreateDepositTransactionException.DEFAULT_MESSAGE, e, "CashMoneyTransactionDepositManager", "Failed to load Cash Money Wallet Balance"); } catch (CantRegisterCreditException e) { pluginRoot.reportError(UnexpectedPluginExceptionSeverity.DISABLES_THIS_PLUGIN, e); throw new CantCreateDepositTransactionException( CantCreateDepositTransactionException.DEFAULT_MESSAGE, e, "CashMoneyTransactionDepositManager", "Failed to register credit in Wallet Balance"); } return dao.createCashDepositTransaction(depositParameters); }