diff --git a/GMERemittance/Module/New Group/Kyc/Application Logic/Service/KycServiceType.swift b/GMERemittance/Module/New Group/Kyc/Application Logic/Service/KycServiceType.swift index 56c38e55..a28d3e1b 100644 --- a/GMERemittance/Module/New Group/Kyc/Application Logic/Service/KycServiceType.swift +++ b/GMERemittance/Module/New Group/Kyc/Application Logic/Service/KycServiceType.swift @@ -7,6 +7,7 @@ // import Foundation +import Alamofire protocol KycServiceType: class { @@ -14,13 +15,23 @@ protocol KycServiceType: class { protocol KYCSubmitApiService: ApiServiceType { - func submit(param: [String: String], success: () -> (), failure: (Error) -> ()) + func submit(param: [String: String], success: @escaping (KYCResponse?) -> (), failure: @escaping( Error) -> ()) } extension KYCSubmitApiService { - func submit(param: [String: String], success: () -> (), failure: (Error) -> ()) { + func submit(param: [String: String], success: @escaping (KYCResponse?) -> (), failure: @escaping (Error) -> ()) { let url = baseUrl + "mobile/RegisterKyc" - + auth.request(method: .get, url: url, params: param, success: { (response: KYCResponseContainer) in + if (response.errorCode ?? "") == "1" { + let error = NSError.init(domain: "Network", code: 0, userInfo: [NSLocalizedDescriptionKey : response.message ?? ""]) + failure(error) + }else { + let model = response.data + success(model) + } + }) { (error) in + failure(error) + } } }