This is an automated email from the ASF dual-hosted git repository.

ofuks pushed a commit to branch DLAB-1123
in repository https://gitbox.apache.org/repos/asf/incubator-dlab.git

commit 4b9edb4dc70033aa8edafe6845ffd4d714f8913d
Author: Oleh Fuks <olegfuk...@gmail.com>
AuthorDate: Thu Sep 26 11:40:38 2019 +0300

    [DLAB-1123]: Fixed billing issues
---
 .../java/com/epam/dlab/billing/gcp/service/BillingServiceImpl.java    | 2 +-
 .../src/main/java/com/epam/dlab/billing/gcp/util/BillingUtils.java    | 4 +++-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git 
a/services/billing-gcp/src/main/java/com/epam/dlab/billing/gcp/service/BillingServiceImpl.java
 
b/services/billing-gcp/src/main/java/com/epam/dlab/billing/gcp/service/BillingServiceImpl.java
index 3b11a06..cfcfbf4 100644
--- 
a/services/billing-gcp/src/main/java/com/epam/dlab/billing/gcp/service/BillingServiceImpl.java
+++ 
b/services/billing-gcp/src/main/java/com/epam/dlab/billing/gcp/service/BillingServiceImpl.java
@@ -158,7 +158,7 @@ public class BillingServiceImpl implements BillingService {
 
                return BillingData.builder()
                                .displayName(billableResource.getDisplayName())
-                               .cost(bd.getCost().doubleValue())
+                               .cost(bd.getCost().setScale(2, 
BigDecimal.ROUND_HALF_UP).doubleValue())
                                .currency(bd.getCurrency())
                                .product(bd.getProduct())
                                .project(billableResource.getProject())
diff --git 
a/services/billing-gcp/src/main/java/com/epam/dlab/billing/gcp/util/BillingUtils.java
 
b/services/billing-gcp/src/main/java/com/epam/dlab/billing/gcp/util/BillingUtils.java
index d94559c..86c9333 100644
--- 
a/services/billing-gcp/src/main/java/com/epam/dlab/billing/gcp/util/BillingUtils.java
+++ 
b/services/billing-gcp/src/main/java/com/epam/dlab/billing/gcp/util/BillingUtils.java
@@ -62,7 +62,9 @@ public class BillingUtils {
        public static Stream<BillingData> 
exploratoryBillingDataStream(UserInstance userInstance) {
                final Stream<BillingData> computationalStream = 
userInstance.getComputationalResources()
                                .stream()
-                               .flatMap(cr -> 
Stream.of(computationalBillableResource(userInstance, cr)));
+                               .flatMap(cr -> 
Stream.of(computationalBillableResource(userInstance, cr),
+                                               
withExploratoryName(userInstance).displayName(cr.getComputationalName() + ":" + 
VOLUME_PRIMARY).dlabId(String.format(VOLUME_PRIMARY_FORMAT, 
cr.getComputationalId()))
+                                                               
.resourceType(BillingData.ResourceType.VOLUME).computationalName(cr.getComputationalName()).build()));
                final String exploratoryId = userInstance.getExploratoryId();
                final String primaryVolumeId = 
String.format(VOLUME_PRIMARY_FORMAT, exploratoryId);
                final String secondaryVolumeId = 
String.format(VOLUME_SECONDARY_FORMAT, exploratoryId);


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@dlab.apache.org
For additional commands, e-mail: commits-h...@dlab.apache.org

Reply via email to