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
1.2 KiB

5 years ago
5 years ago
5 years ago
5 years ago
  1. //
  2. // RewardService.swift
  3. // GME Remit
  4. //
  5. // Created by InKwon Devik Kim on 11/04/2019.
  6. //Copyright © 2019 Gobal Money Express Co. Ltd. All rights reserved.
  7. //
  8. import Foundation
  9. class RewardService: RewardServiceType {
  10. // MARK: Properties
  11. // MARK: Initialization
  12. // MARK: Data management
  13. // /api/v2/reward/productList
  14. func fetchProductList(
  15. success: @escaping ([RewardProduct]?) -> (),
  16. failure: @escaping (Error) -> ()
  17. ) {
  18. // let url = baseUrl + "/reward/productList"
  19. // let url = "http://gmeuat.gmeremit.com:5018/api/v2/reward/productList"
  20. let url = baseUrlWithoutVersion + "/v2/reward/productList"
  21. auth.request(method: .post, url: url, params: nil, success: { (response: RewardProductContainer) in
  22. if (response.errorCode ?? "") == "1" {
  23. let error = NSError.init(domain: "Network", code: 0, userInfo: [NSLocalizedDescriptionKey : response.msg ?? ""])
  24. failure(error)
  25. }else {
  26. let model = response.data
  27. success(model)
  28. }
  29. }) { (error) in
  30. failure(error)
  31. }
  32. }
  33. }