11package it .eng .dome .billing .proxy .controller ;
22
33import java .time .OffsetDateTime ;
4- <<<<<<< HEAD
5- import java .util .ArrayList ;
6- import java .util .List ;
7- =======
84import java .time .format .DateTimeFormatter ;
95import java .util .ArrayList ;
106import java .util .Arrays ;
117import java .util .HashMap ;
128import java .util .List ;
139import java .util .Map ;
1410import java .util .Objects ;
15- >>>>>>> billing -proxy -instantBill
1611
1712import org .slf4j .Logger ;
1813import org .slf4j .LoggerFactory ;
2722import com .fasterxml .jackson .databind .JsonNode ;
2823import com .fasterxml .jackson .databind .ObjectMapper ;
2924import com .fasterxml .jackson .databind .node .ObjectNode ;
30- <<<<<<< HEAD
31- import it .eng .dome .brokerage .billing .dto .BillingRequestDTO ;
32- import it .eng .dome .tmforum .tmf637 .v4 .model .Product ;
33- import it .eng .dome .tmforum .tmf637 .v4 .model .ProductOfferingPriceRef ;
34- import it .eng .dome .tmforum .tmf637 .v4 .model .ProductPrice ;
35- import it .eng .dome .tmforum .tmf678 .v4 .model .TimePeriod ;
36- =======
3725
38- >>>>>>> billing -proxy -instantBill
3926import it .eng .dome .billing .proxy .service .BillingProxyService ;
4027import it .eng .dome .billing .proxy .service .BillingService ;
4128import it .eng .dome .brokerage .billing .dto .BillingRequestDTO ;
@@ -90,18 +77,13 @@ public String calculatePricePreview(@RequestBody String orderJson) throws Throwa
9077 * @throws Throwable If an error occurs during the calculation of the bill for the Product
9178 */
9279 @ RequestMapping (value = "/bill" , method = RequestMethod .POST , produces = "application/json" , consumes = "application/json" )
93- <<<<<<< HEAD
94- public String calculateBill (@ RequestBody BillingRequestDTO billRequestDTO ) throws Throwable {
95- logger .info ("Received billingRequestDTO to calculate the bill" );
96- =======
9780 public String calculateBill (@ RequestBody String billRequestDTO ) throws Throwable {
9881 logger .info ("Received request to calculate the bill" );
9982
10083 // Gets the AppliedCustomerBillingRate list invoking the billing-engine
10184 String billsWithPrice = billing .bill (billRequestDTO );
10285 logger .debug ("Billing payload with price:\n " + billsWithPrice );
10386
104- >>>>>>> billing -proxy -instantBill
10587
10688 // Gets the AppliedCustomerBillingRate list with taxes invoking the invoicing-service
10789 //1) Get ApplyTaxesRequestDTO as a json string
@@ -116,32 +98,7 @@ public String calculateBill(@RequestBody String billRequestDTO) throws Throwable
11698 logger .info ("Calculate Invoicing (bill) to apply Taxes" );
11799 return billing .billApplyTaxes (appyTaxesRequestJsonStr );
118100 }
119-
120101
121- @ RequestMapping (value = "/instantBill" , method = RequestMethod .POST , produces = "application/json" , consumes = "application/json" )
122- public String calculateInstantBill (@ RequestBody Product product ) throws Throwable {
123- logger .info ("Received product request to calculate the instantBill" );
124-
125- OffsetDateTime now = OffsetDateTime .now ();
126- TimePeriod tp = new TimePeriod ().startDateTime (now ).endDateTime (now );
127- String productId = product .getId ();
128- //TODO come recuperare il ProductPrice
129- ArrayList <ProductPrice > productPriceList = new ArrayList <ProductPrice >();
130-
131- ProductPrice pp = new ProductPrice ();
132- ProductOfferingPriceRef popr = new ProductOfferingPriceRef ();
133- popr .setId ("urn:ngsi-ld:product-offering-price:38b293a6-92db-4ca3-8fe6-54a6e4a9e12c" );
134- pp .setPriceType ("recurring" );
135- pp .setProductOfferingPrice (popr );
136- productPriceList .add (pp );
137-
138- BillingRequestDTO billRequestDTO = new BillingRequestDTO (product , tp , productPriceList );
139- String json = getBillRequestDTOtoJson (billRequestDTO );
140- String billWithPrice = billing .bill (json );
141-
142- logger .info ("Calculate Invoicing (instantBill) to apply Taxes" );
143- return billing .billApplyTaxes (billWithPrice );
144- }
145102
146103 /**
147104 * The POST /billing/instantBill REST API is invoked to calculate the bill of a Product (TMF637-v4) with taxes considering as startdate now.\n
@@ -388,4 +345,4 @@ private String toLowerCaseStatus(String json, String path) {
388345 return lower ;
389346 }
390347 }
391- }
348+ }
0 commit comments