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

  1. //
  2. // AddAccountService.swift
  3. // GME Remit
  4. //
  5. // Created by InKwon Devik Kim on 12/04/2019.
  6. //Copyright © 2019 Gobal Money Express Co. Ltd. All rights reserved.
  7. //
  8. import Foundation
  9. import Alamofire
  10. class AddAccountService: AddAccountServiceType {
  11. // MARK: Properties
  12. // MARK: Initialization
  13. // MARK: Data management
  14. func fetchBankList(
  15. success: @escaping ([BankInformation]?) -> Void,
  16. failure: @escaping (Error) -> Void
  17. ) {
  18. APIRouter.fetchBankList
  19. .request(
  20. success: { (response: KFTCBankList) in
  21. if (response.errorCode ?? "") == "1" {
  22. let error = NSError.init(
  23. domain: "Network",
  24. code: 0,
  25. userInfo: [NSLocalizedDescriptionKey : response.msg ?? ""]
  26. )
  27. failure(error)
  28. } else {
  29. success(response.data)
  30. }
  31. },
  32. failure: failure
  33. )
  34. }
  35. func verifyAccountService(
  36. using model: VerifyAccountRequestModel,
  37. success: @escaping () -> Void,
  38. failure: @escaping (Error) -> Void) {
  39. APIRouter.checkRealName(model: model)
  40. .request(
  41. success: { (response: KFTCVerifyAccount) in
  42. if (response.errorCode ?? "") == "1" {
  43. let error = NSError.init(
  44. domain: "Network",
  45. code: 0,
  46. userInfo: [NSLocalizedDescriptionKey : response.message ?? ""]
  47. )
  48. failure(error)
  49. } else {
  50. success()
  51. }
  52. },
  53. failure: failure
  54. )
  55. }
  56. func fetchKftcUrlService(
  57. url: String,
  58. header: [String: String],
  59. success: @escaping (String?) -> Void,
  60. failure: @escaping (Error) -> Void) {
  61. APIRouter.fetchKFTCURL(url: url)
  62. .kftcRequest(
  63. header: header,
  64. success: { (response: KFTCURL) in
  65. success(response.value)
  66. },
  67. failure: failure
  68. )
  69. }
  70. }