Package org.zeroexchange.model.resource.money

Examples of org.zeroexchange.model.resource.money.ZECurrency


            UnitOfMeasure uom = ((GoodResource)resource).getUnitOfMeasure();
            return uom == null ? unknownUOMKey : uom.name();
        } else if(resource instanceof ServiceResource) {
            return sessionUOMKey;
        } else if(resource instanceof MoneyResource) {
            ZECurrency currency = ((MoneyResource)resource).getCurrency();
            return currency == null ? unknownUOMKey : currency.name();
        }
        return unknownUOMKey;
    }
View Full Code Here


    public String getValueUOM(Resource resource) {
        if(resource == null) {
            return unknownUOMKey;
        }
        if(resource instanceof MoneyResource) {
            ZECurrency currency = ((MoneyResource) resource).getCurrency();
            return currency == null ? unknownUOMKey : currency.name();
        }
        return ZECurrency.CHE.name();
    }
View Full Code Here

    public void performAutoMovement(Collection<PayerData> payersData,
            Collection<User> consumers) {
        //Write off
        Map<ZECurrency, BigDecimal> currencyToAmount = new HashMap<ZECurrency, BigDecimal>();
        for(PayerData payerData: payersData) {
            ZECurrency payerCurrency = payerData.getCurrency();
            BigDecimal payerAmount = payerData.getAmount();
            CurrencyManager moneyAmountProvider = getCurrencyManager(payerCurrency);
            if(moneyAmountProvider != null) {
                moneyAmountProvider.writeOn(
                        payerData.getAmount().negate(), payerCurrency, payerData.getPayer());
                BigDecimal writeOffAmount = currencyToAmount.get(payerCurrency);
                currencyToAmount.put(payerCurrency,
                        writeOffAmount == null ? payerAmount : writeOffAmount.add(payerAmount));
            }
        }

        //Write on
        for(Map.Entry<ZECurrency, BigDecimal> entry: currencyToAmount.entrySet()) {
            ZECurrency currency = entry.getKey();
            BigDecimal writeOnValue = entry.getValue().divide(BigDecimal.valueOf(consumers.size()), RoundingMode.HALF_UP);
           
            for(User consumer: consumers) {
                CurrencyManager moneyAmountProvider = getCurrencyManager(currency);
                if(moneyAmountProvider != null) {
View Full Code Here

            return;
        }
        //List<PayerData> totalUsersEfforts = new ArrayList<PayerData>();
        for(PayerData payerData: usersEfforts) {
            User user =  payerData.getPayer();
            ZECurrency currency = payerData.getCurrency();
            BigDecimal userDebt = payerData.getAmount();
            CurrencyManager currencyManager = getCurrencyManager(currency);
            currencyManager.writeOn(userDebt, currency, user);
        }
    }
View Full Code Here

            BigDecimal workingHours = tenderData.getWorkingHours();
            supply.setHours(workingHours);
            PriceType priceType = tenderData.getPriceType();
            supply.setPriceType(priceType);
            ZECurrency currencyCode = moneyManager.getDefaultCurrency();
            supply.setCurrency(currencyCode);
            BigDecimal totalPrice = tenderData.getTotalPrice();
            supply.setTotalPrice(totalPrice);
            supply.setSupplyTime(tenderData.getSupplyTime());
        } else {
View Full Code Here

TOP

Related Classes of org.zeroexchange.model.resource.money.ZECurrency

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.