From d8f8ce8ca91700742ab39e9f9ace9631f47d75c0 Mon Sep 17 00:00:00 2001 From: gme_2 Date: Fri, 14 Sep 2018 10:14:10 +0900 Subject: [PATCH] added kyc model --- GMERemittance.xcodeproj/project.pbxproj | 4 ++ GMERemittance/Model/KycModel.swift | 64 +++++++++++++++++++ .../Service/kycForm1ServiceType.swift | 6 +- .../View/kycForm1ViewController.swift | 2 +- 4 files changed, 72 insertions(+), 4 deletions(-) create mode 100644 GMERemittance/Model/KycModel.swift diff --git a/GMERemittance.xcodeproj/project.pbxproj b/GMERemittance.xcodeproj/project.pbxproj index 9d99580b..e6ea80a3 100644 --- a/GMERemittance.xcodeproj/project.pbxproj +++ b/GMERemittance.xcodeproj/project.pbxproj @@ -366,6 +366,7 @@ D937038421490C3800D93077 /* KycForm1ViewInterface.swift in Sources */ = {isa = PBXBuildFile; fileRef = D937036E21490C3800D93077 /* KycForm1ViewInterface.swift */; }; D937038521490C3800D93077 /* KycForm1.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = D937036F21490C3800D93077 /* KycForm1.storyboard */; }; D937038621490C3800D93077 /* KycForm1ViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = D937037021490C3800D93077 /* KycForm1ViewController.swift */; }; + D94173B3214B40ED00D04BE5 /* KycModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = D94173B2214B40ED00D04BE5 /* KycModel.swift */; }; D945F11D213E1D5100A24824 /* SendMoneyReceiptModuleInterface.swift in Sources */ = {isa = PBXBuildFile; fileRef = D945F10A213E1D5100A24824 /* SendMoneyReceiptModuleInterface.swift */; }; D945F11E213E1D5100A24824 /* SendMoneyReceiptService.swift in Sources */ = {isa = PBXBuildFile; fileRef = D945F10D213E1D5100A24824 /* SendMoneyReceiptService.swift */; }; D945F11F213E1D5100A24824 /* SendMoneyReceiptServiceType.swift in Sources */ = {isa = PBXBuildFile; fileRef = D945F10E213E1D5100A24824 /* SendMoneyReceiptServiceType.swift */; }; @@ -871,6 +872,7 @@ D937036E21490C3800D93077 /* KycForm1ViewInterface.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = KycForm1ViewInterface.swift; sourceTree = ""; }; D937036F21490C3800D93077 /* KycForm1.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = KycForm1.storyboard; sourceTree = ""; }; D937037021490C3800D93077 /* KycForm1ViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = KycForm1ViewController.swift; sourceTree = ""; }; + D94173B2214B40ED00D04BE5 /* KycModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KycModel.swift; sourceTree = ""; }; D945F10A213E1D5100A24824 /* SendMoneyReceiptModuleInterface.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SendMoneyReceiptModuleInterface.swift; sourceTree = ""; }; D945F10D213E1D5100A24824 /* SendMoneyReceiptService.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SendMoneyReceiptService.swift; sourceTree = ""; }; D945F10E213E1D5100A24824 /* SendMoneyReceiptServiceType.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SendMoneyReceiptServiceType.swift; sourceTree = ""; }; @@ -2974,6 +2976,7 @@ D945F128213E4A9D00A24824 /* SendMoneyReciept.swift */, D96A5001214668A000CFD507 /* RegisterRequestModel.swift */, D92C24A621477EA600F6876F /* ResponseMessage.swift */, + D94173B2214B40ED00D04BE5 /* KycModel.swift */, ); path = Model; sourceTree = ""; @@ -4146,6 +4149,7 @@ D95B5E4B21315C57000C0B33 /* EmptyTableViewCell.swift in Sources */, 04CAEC2D1FEBAEB400C819D4 /* KYCViewModel.swift in Sources */, 9F03D22E1FECFC52002E132E /* RecipientTranscationViewController.swift in Sources */, + D94173B3214B40ED00D04BE5 /* KycModel.swift in Sources */, D95B7047213FB5F10053CC3D /* WebLinksViewController.swift in Sources */, A270F08D2075C74300B78D00 /* AgentCountryList.swift in Sources */, 9FA09740200E129500F3B5EC /* CommentsViewController.swift in Sources */, diff --git a/GMERemittance/Model/KycModel.swift b/GMERemittance/Model/KycModel.swift new file mode 100644 index 00000000..b0013419 --- /dev/null +++ b/GMERemittance/Model/KycModel.swift @@ -0,0 +1,64 @@ +// +// KycModel.swift +// GMERemittance +// +// Created by gme_2 on 14/09/2018. +// Copyright © 2018 Gobal Money Express Co. Ltd. All rights reserved. +// + +import Foundation +import ObjectMapper + + +class KycModelContainer: Mappable { + var errorCode: String? + var message: String? + var id: String? + var data: KycModel? + + required init?(map: Map) { + + } + + func mapping(map: Map) { + errorCode <- map["ErrorCode"] + message <- map["Msg"] + id <- map["Id"] + data <- map["Data"] + } +} + +class KycModel: Mappable { + var nativeCountry: [KeyValueModel]? + var city: [KeyValueModel]? + var occupation: [KeyValueModel]? + var bank: [KeyValueModel]? + var idType: [KeyValueModel]? + + required init?(map: Map) { + + } + + func mapping(map: Map) { + nativeCountry <- map["NativeCountry"] + city <- map["City"] + occupation <- map["Occupation"] + bank <- map["Bank"] + idType <- map["IdType"] + } +} + + +class KeyValueModel: Mappable { + var id: String? + var text: String? + + required init?(map: Map) { + + } + + func mapping(map: Map) { + id <- map["id"] + text <- map["text"] + } +} diff --git a/GMERemittance/Module/New Group/kycForm1/Application Logic/Service/kycForm1ServiceType.swift b/GMERemittance/Module/New Group/kycForm1/Application Logic/Service/kycForm1ServiceType.swift index 69f6fc1e..a62614ec 100644 --- a/GMERemittance/Module/New Group/kycForm1/Application Logic/Service/kycForm1ServiceType.swift +++ b/GMERemittance/Module/New Group/kycForm1/Application Logic/Service/kycForm1ServiceType.swift @@ -15,13 +15,13 @@ protocol KycForm1ServiceType: class { protocol FetchKycInformation: ApiServiceType { - func fetch(success: @escaping (SendMoneyModel?) -> (), failure: @escaping (Error) -> () ) + func fetch(success: @escaping (KycModel?) -> (), failure: @escaping (Error) -> () ) } extension FetchKycInformation { - func fetch(success: @escaping (SendMoneyModel?) -> (), failure: @escaping (Error) -> () ) { + func fetch(success: @escaping (KycModel?) -> (), failure: @escaping (Error) -> () ) { let url = baseUrl + "mobile/loadform/receiver" - auth.request(method: .get, url: url, params: nil, success: { (response: SendMoneyInformationContainer) in + auth.request(method: .get, url: url, params: nil, success: { (response: KycModelContainer) in if (response.errorCode ?? "") == "1" { let error = NSError.init(domain: "Network", code: 0, userInfo: [NSLocalizedDescriptionKey : response.message ?? ""]) failure(error) diff --git a/GMERemittance/Module/New Group/kycForm1/User Interface/View/kycForm1ViewController.swift b/GMERemittance/Module/New Group/kycForm1/User Interface/View/kycForm1ViewController.swift index c89a4c85..a23802e0 100644 --- a/GMERemittance/Module/New Group/kycForm1/User Interface/View/kycForm1ViewController.swift +++ b/GMERemittance/Module/New Group/kycForm1/User Interface/View/kycForm1ViewController.swift @@ -271,7 +271,7 @@ extension KycForm1ViewController: KycForm1ViewInterface { if let topMostTextField = self.textfields.filter({ $0.tag == tag }).first { - + // Todo // scroll to view here }