Advertisement
Guest User

Untitled

a guest
Feb 22nd, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. %dw 1.0
  2. %output application/dw
  3. %namespace ns0 http://soap.training.mulesoft.com/
  4.  
  5. %var exchangeRates = {
  6. USD: 1.00,
  7. EUR: 0.80,
  8. CAD: 1.20
  9. }
  10.  
  11. %var defaultCurrency = "USD"
  12.  
  13. %var calcTotalSeats = (planeType) ->
  14. 150 when planeType == "Boing 737" otherwise 300
  15.  
  16. %var calcTotalSeatsM = (planeType) ->
  17. planeType[-1..-3] as :number match {
  18. 737 -> 151,
  19. 777 -> 301,
  20. default -> "TBC"
  21. }
  22.  
  23. ---
  24. payload.ns0#listAllFlightsResponse.*return map {
  25. airline: $.@airlineName,
  26. ($ - "price"),
  27. price: $.price * exchangeRates[defaultCurrency],
  28. totalSeats: calcTotalSeats($.planeType),
  29. totalSeatsM: calcTotalSeatsM($.planeType)
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement