Class BillingServiceImpl
- java.lang.Object
-
- co.mastermindcms.modules.services.BillingServiceImpl
-
- All Implemented Interfaces:
BillingService
@Service public class BillingServiceImpl extends java.lang.Object implements BillingService
-
-
Field Summary
Fields Modifier and Type Field Description private CommerceItemService
commerceItemService
private CommerceProperties
commerceProperties
-
Constructor Summary
Constructors Constructor Description BillingServiceImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.math.BigDecimal
calculateBruttoAmount(java.util.List<CommerceItem> items, Order.Tax tax)
Calculates gross amount in cents for order.java.math.BigDecimal
calculateItemsTotalAmount(java.util.Collection<CommerceItem> items)
Sums prices of commerce items.java.math.BigDecimal
calculateItemsTotalBruttoAmount(java.math.BigDecimal amount, java.math.BigDecimal taxAmount)
Calculates gross amount for order.java.math.BigDecimal
calculateNettoAmount(java.util.List<CommerceItem> items)
Calculates net amount in cents for order.java.math.BigDecimal
calculatePayoutAmount(Order order)
Calculates amount in cents for payout.java.math.BigDecimal
calculateServiceFee(java.math.BigDecimal amount)
Calculates service fee for given amount.java.math.BigDecimal
calculateServiceFeeBruttoAmount(Order order)
Calculates amount in cents for service fee.java.math.BigDecimal
calculateServiceFeeNettoAmount(Order order)
Calculates service fee for given amount.java.math.BigDecimal
calculateTaxAmount(java.math.BigDecimal amount, java.math.BigDecimal taxRate)
Calculates tax amount for order.java.math.BigDecimal
getServiceFee()
Service fee coefficient.
-
-
-
Field Detail
-
commerceItemService
@Autowired private CommerceItemService commerceItemService
-
commerceProperties
@Autowired private CommerceProperties commerceProperties
-
-
Method Detail
-
getServiceFee
public java.math.BigDecimal getServiceFee()
Description copied from interface:BillingService
Service fee coefficient.- Specified by:
getServiceFee
in interfaceBillingService
- Returns:
- coefficient
-
calculateServiceFee
public java.math.BigDecimal calculateServiceFee(java.math.BigDecimal amount)
Description copied from interface:BillingService
Calculates service fee for given amount.- Specified by:
calculateServiceFee
in interfaceBillingService
- Parameters:
amount
- amount- Returns:
- service fee
-
calculateServiceFeeNettoAmount
public java.math.BigDecimal calculateServiceFeeNettoAmount(Order order)
Description copied from interface:BillingService
Calculates service fee for given amount.- Specified by:
calculateServiceFeeNettoAmount
in interfaceBillingService
- Parameters:
order
- order- Returns:
- net service fee amount
-
calculateServiceFeeBruttoAmount
public java.math.BigDecimal calculateServiceFeeBruttoAmount(Order order)
Description copied from interface:BillingService
Calculates amount in cents for service fee.- Specified by:
calculateServiceFeeBruttoAmount
in interfaceBillingService
- Parameters:
order
- order- Returns:
- gross service fee amount
-
calculatePayoutAmount
public java.math.BigDecimal calculatePayoutAmount(Order order)
Description copied from interface:BillingService
Calculates amount in cents for payout.- Specified by:
calculatePayoutAmount
in interfaceBillingService
- Parameters:
order
- order- Returns:
- payout amount in coins/cents
-
calculateItemsTotalAmount
public java.math.BigDecimal calculateItemsTotalAmount(java.util.Collection<CommerceItem> items)
Description copied from interface:BillingService
Sums prices of commerce items.- Specified by:
calculateItemsTotalAmount
in interfaceBillingService
- Parameters:
items
- items- Returns:
- items total amount
-
calculateItemsTotalBruttoAmount
public java.math.BigDecimal calculateItemsTotalBruttoAmount(java.math.BigDecimal amount, java.math.BigDecimal taxAmount)
Description copied from interface:BillingService
Calculates gross amount for order.- Specified by:
calculateItemsTotalBruttoAmount
in interfaceBillingService
- Parameters:
amount
- net amounttaxAmount
- tax amount- Returns:
- gross amount
-
calculateTaxAmount
public java.math.BigDecimal calculateTaxAmount(java.math.BigDecimal amount, java.math.BigDecimal taxRate)
Description copied from interface:BillingService
Calculates tax amount for order.- Specified by:
calculateTaxAmount
in interfaceBillingService
- Parameters:
amount
- net amounttaxRate
- tax rate in decimals- Returns:
- tax amount
-
calculateBruttoAmount
public java.math.BigDecimal calculateBruttoAmount(java.util.List<CommerceItem> items, Order.Tax tax)
Description copied from interface:BillingService
Calculates gross amount in cents for order.- Specified by:
calculateBruttoAmount
in interfaceBillingService
- Parameters:
items
- commerce itemstax
- tax object- Returns:
- gross amount in coins/cents
-
calculateNettoAmount
public java.math.BigDecimal calculateNettoAmount(java.util.List<CommerceItem> items)
Description copied from interface:BillingService
Calculates net amount in cents for order.- Specified by:
calculateNettoAmount
in interfaceBillingService
- Parameters:
items
- commerce items- Returns:
- net amount in coins/cents
-
-