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.
 
 
 
 

81 lines
1.9 KiB

//
// AddAccountService.swift
// GME Remit
//
// Created by InKwon Devik Kim on 12/04/2019.
//Copyright © 2019 Gobal Money Express Co. Ltd. All rights reserved.
//
import Foundation
import Alamofire
class AddAccountService: AddAccountServiceType {
// MARK: Properties
// MARK: Initialization
// MARK: Data management
func fetchBankList(
success: @escaping ([BankInformation]?) -> Void,
failure: @escaping (Error) -> Void
) {
APIRouter.fetchBankList
.request(
success: { (response: KFTCBankList) in
if (response.errorCode ?? "") == "1" {
let error = NSError.init(
domain: "Network",
code: 0,
userInfo: [NSLocalizedDescriptionKey : response.msg ?? ""]
)
failure(error)
} else {
success(response.data)
}
},
failure: failure
)
}
func verifyAccountService(
using model: VerifyAccountRequestModel,
success: @escaping () -> Void,
failure: @escaping (Error) -> Void) {
APIRouter.checkRealName(model: model)
.request(
success: { (response: KFTCVerifyAccount) in
if (response.errorCode ?? "") == "1" {
let error = NSError.init(
domain: "Network",
code: 0,
userInfo: [NSLocalizedDescriptionKey : response.message ?? ""]
)
failure(error)
} else {
success()
}
},
failure: failure
)
}
func fetchKftcUrlService(
url: String,
header: [String: String],
success: @escaping (String?) -> Void,
failure: @escaping (Error) -> Void) {
APIRouter.fetchKFTCURL(url: url)
.kftcRequest(
header: header,
success: { (response: KFTCURL) in
success(response.value)
},
failure: failure
)
}
}