You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

80 lines
1.5 KiB

6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
  1. //
  2. // ExchangeModel.swift
  3. // GMERemittance
  4. //
  5. // Created by gme_2 on 21/08/2018.
  6. // Copyright © 2018 Gobal Money Express Co. Ltd. All rights reserved.
  7. //
  8. import Foundation
  9. import ObjectMapper
  10. class ExchangeRateModel: Mappable {
  11. var country: String?
  12. var countryCode: String?
  13. var currency: String?
  14. var countryId: String?
  15. var availableServices: [PaymentServiceType]?
  16. init() {}
  17. required init?(map: Map) {
  18. }
  19. func mapping(map: Map) {
  20. country <- map["country"]
  21. countryCode <- map["countryCode"]
  22. currency <- map["currency"]
  23. countryId <- map["countryId"]
  24. availableServices <- map["serviceAvailable"]
  25. }
  26. }
  27. extension ExchangeRateModel: TablePresenterProtocol {
  28. var cellTitle: String? {
  29. return "\(country ?? "") (\(currency ?? ""))"
  30. }
  31. var cellImage: UIImage? {
  32. return CountryEnum(rawValue: countryCode?.lowercased() ?? "")?.flag
  33. }
  34. }
  35. class PaymentServiceType: Mappable {
  36. var id: String?
  37. var type: String?
  38. var subtitle: String?
  39. init() {}
  40. required init?(map: Map) {
  41. }
  42. func mapping(map: Map) {
  43. id <- map["id"]
  44. type <- map["text"]
  45. subtitle <- map["description"]
  46. }
  47. }
  48. class ExchangeRateContainer: Mappable {
  49. var errorCode: String?
  50. var message: String?
  51. var id: String?
  52. var data: [ExchangeRateModel]?
  53. required init?(map: Map) {
  54. }
  55. func mapping(map: Map) {
  56. errorCode <- map["ErrorCode"]
  57. id <- map["Id"]
  58. message <- map["Msg"]
  59. data <- map["Data"]
  60. }
  61. }