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
993 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. // let url = "http://gmeuat.gmeremit.com:5018/api/v2/reward/branchInfo"
  16. auth.request(
  17. method: .post,
  18. url: url,
  19. params: nil,
  20. success: { (response: BranchContainer) in
  21. if (response.errorCode ?? "") == "1" {
  22. let error = NSError.init(
  23. domain: "Network",
  24. code: 0,
  25. userInfo: [NSLocalizedDescriptionKey : response.message ?? ""]
  26. )
  27. failure(error)
  28. }else {
  29. success(response.data)
  30. }
  31. }) { (error) in
  32. failure(error)
  33. }
  34. }
  35. }