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.

40 lines
933 B

  1. //
  2. // GmeContactsService.swift
  3. // GMERemittance
  4. //
  5. // Created by gme_2 on 25/08/2018.
  6. //Copyright © 2018 Gobal Money Express Co. Ltd. All rights reserved.
  7. //
  8. import Foundation
  9. class GmeContactsService: GmeContactsServiceType {
  10. func fetchBranches(
  11. success: @escaping ([Branch]?) -> Void,
  12. failure: @escaping (Error) -> Void
  13. ) {
  14. let url = baseUrlWithoutVersion + "/v2/reward/branchInfo"
  15. auth.request(
  16. method: .post,
  17. url: url,
  18. params: nil,
  19. success: { (response: BranchContainer) in
  20. if (response.errorCode ?? "") == "1" {
  21. let error = NSError.init(
  22. domain: "Network",
  23. code: 0,
  24. userInfo: [NSLocalizedDescriptionKey : response.message ?? ""]
  25. )
  26. failure(error)
  27. } else {
  28. success(response.data)
  29. }
  30. },
  31. failure: { (error) in
  32. failure(error)
  33. }
  34. )
  35. }
  36. }