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

5 years ago
5 years ago
5 years ago
  1. //
  2. // CommonServiceType.swift
  3. // GME Remit
  4. //
  5. // Created by InKwon James Kim on 30/07/2019.
  6. // Copyright © 2019 Gobal Money Express Co. Ltd. All rights reserved.
  7. //
  8. import Foundation
  9. protocol CommonServiceType: ApiServiceType {
  10. func isValidate(
  11. userName: String,
  12. idNumber: String,
  13. idType: String,
  14. success: @escaping (Bool, String?) -> Void,
  15. failure: @escaping (Error) -> Void
  16. )
  17. }
  18. extension CommonServiceType {
  19. func isValidate(
  20. userName: String = "",
  21. idNumber: String = "",
  22. idType: String = "",
  23. success: @escaping (Bool, String?) -> Void,
  24. failure: @escaping (Error) -> Void
  25. ) {
  26. APIRouter.validation(
  27. userName: userName,
  28. idNumber: idNumber,
  29. idType: idType
  30. )
  31. .request(
  32. needsAuthorization: false,
  33. success: { (response: ResponseMessage) in
  34. if (response.errorCode ?? "") == "1" {
  35. success(false, response.message)
  36. } else {
  37. success(true, nil)
  38. }
  39. },
  40. failure: { failure($0)}
  41. )
  42. }
  43. }