Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- %dw 1.0
- %output application/dw
- %namespace ns0 http://soap.training.mulesoft.com/
- %var exchangeRates = {
- USD: 1.00,
- EUR: 0.80,
- CAD: 1.20
- }
- %var defaultCurrency = "USD"
- %var calcTotalSeats = (planeType) ->
- 150 when planeType == "Boing 737" otherwise 300
- %var calcTotalSeatsM = (planeType) ->
- planeType[-1..-3] as :number match {
- 737 -> 151,
- 777 -> 301,
- default -> "TBC"
- }
- ---
- payload.ns0#listAllFlightsResponse.*return map {
- airline: $.@airlineName,
- ($ - "price"),
- price: $.price * exchangeRates[defaultCurrency],
- totalSeats: calcTotalSeats($.planeType),
- totalSeatsM: calcTotalSeatsM($.planeType)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement