-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #96 from TLI-Group-1/getClaimedOffers-and-getoffer…
…Details-return-carAndOfferInfo getClaimedOffers and getOfferDetails endpoints both return car info as well as offer info
- Loading branch information
Showing
19 changed files
with
164 additions
and
111 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
src/main/java/tech/autodirect/api/utils/MergeCarAndOffer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
package tech.autodirect.api.utils; | ||
|
||
import tech.autodirect.api.entities.EntCar; | ||
import tech.autodirect.api.entities.EntOffer; | ||
|
||
import java.util.HashMap; | ||
import java.util.Map; | ||
|
||
public class MergeCarAndOffer { | ||
/** | ||
* Merge car and offer entities into a single map. | ||
*/ | ||
public static Map<String, Object> mergeCarAndOffer(EntCar car, EntOffer offer) { | ||
return new HashMap<>() {{ | ||
// Car info | ||
put("car_id", car.getCarId()); | ||
put("brand", car.getBrand()); | ||
put("model", car.getModel()); | ||
put("year", car.getYear()); | ||
put("price", car.getPrice()); | ||
put("kms", car.getKms()); | ||
// Offer info | ||
put("offer_id", offer.getOfferId()); | ||
put("loan_amount", offer.getLoanAmount()); | ||
put("capital_sum", offer.getCapitalSum()); | ||
put("interest_sum", offer.getInterestSum()); | ||
put("total_sum", offer.getTotalSum()); | ||
put("interest_rate", offer.getInterestRate()); | ||
put("term_mo", offer.getTermMo()); | ||
put("installments", offer.getInstallments()); | ||
put("claimed", offer.isClaimed()); | ||
// Computed stuff | ||
put("payment_mo", offer.getTotalSum() / offer.getTermMo()); | ||
}}; | ||
} | ||
} |
Oops, something went wrong.