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.
46 lines
1.0 KiB
46 lines
1.0 KiB
//
|
|
// CommonServiceType.swift
|
|
// GME Remit
|
|
//
|
|
// Created by InKwon James Kim on 30/07/2019.
|
|
// Copyright © 2019 Gobal Money Express Co. Ltd. All rights reserved.
|
|
//
|
|
|
|
import Foundation
|
|
|
|
protocol CommonServiceType: ApiServiceType {
|
|
func isValidate(
|
|
userName: String,
|
|
idNumber: String,
|
|
idType: String,
|
|
success: @escaping (Bool, String?) -> Void,
|
|
failure: @escaping (Error) -> Void
|
|
)
|
|
}
|
|
|
|
extension CommonServiceType {
|
|
func isValidate(
|
|
userName: String = "",
|
|
idNumber: String = "",
|
|
idType: String = "",
|
|
success: @escaping (Bool, String?) -> Void,
|
|
failure: @escaping (Error) -> Void
|
|
) {
|
|
APIRouter.validation(
|
|
userName: userName,
|
|
idNumber: idNumber,
|
|
idType: idType
|
|
)
|
|
.request(
|
|
needsAuthorization: false,
|
|
success: { (response: ResponseMessage) in
|
|
if (response.errorCode ?? "") == "1" {
|
|
success(false, response.message)
|
|
} else {
|
|
success(true, nil)
|
|
}
|
|
},
|
|
failure: { failure($0)}
|
|
)
|
|
}
|
|
}
|