// // SendMoneyExchangeRateContainer.swift // GMERemittance // // Created by gme_2 on 31/08/2018. // Copyright © 2018 Gobal Money Express Co. Ltd. All rights reserved. // import Foundation import ObjectMapper class SendMoneyExchangeRateModel: Mappable { var id: String? var transferFee: String? var exchangeRate: String? var apiExchangeRate: String? var recipientAmount: String? var senderAmount: String? var senderCurrency: String? var reciepientCurrency: String? var calcBy: String? var forexId:String? var transferAmount: String? var autodebitSendingAmount: String? var schemeId: String? var couponType: String? var couponName: String? var discountType: String? var discountPercent: String? var discountValue: String? var discountedServiceFee: String? init() {} required init?(map: Map) { } func mapping(map: Map) { id <- map["Id"] transferFee <- map["scCharge"] exchangeRate <- map["exRateDisplay"] recipientAmount <- map["pAmt"] senderAmount <- map["collAmt"] senderCurrency <- map["collCurr"] calcBy <- map["calcBy"] forexId <- map["EXRATEID"] apiExchangeRate <- map["exRate"] transferAmount <- map["sAmt"] reciepientCurrency <- map["pCurr"] schemeId <- map["schemeId"] couponType <- map["couponType"] couponName <- map["couponName"] discountType <- map["discountType"] discountPercent <- map["discountPercent"] discountValue <- map["discountValue"] discountedServiceFee <- map["discountedServiceFee"] } var formattedCouponName: String { guard let id = schemeId, id != "", let name = couponName, let type = discountType, let value = discountValue?.likeCommaMoney() else { return "0" } if type == "1", let percent = discountPercent { return "\(name) \(percent)% (-\(value) KRW)" } return "\(name) (-\(value) KRW)" } } class SendMoneyExchangeRateModelContainer: Mappable { var errorCode: String? var message: String? var id: String? var data: SendMoneyExchangeRateModel? required init?(map: Map) { } func mapping(map: Map) { errorCode <- map["ErrorCode"] id <- map["Id"] message <- map["Msg"] data <- map["Data"] } }