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.

34 lines
939 B

5 years ago
  1. //
  2. // SetupRecipientService.swift
  3. // GME Remit
  4. //
  5. // Created by InKwon James Kim on 09/08/2019.
  6. //Copyright © 2019 Gobal Money Express Co. Ltd. All rights reserved.
  7. //
  8. import Foundation
  9. class SetupRecipientService: SetupRecipientServiceType {
  10. func fetchDynamicReceiverFields(
  11. of country: String,
  12. success: @escaping ([FieldModel]) -> Void,
  13. failure: @escaping (Error) -> Void
  14. ) {
  15. let username = GMEDB.shared.user.string(.userId) ?? ""
  16. APIRouter.dynamicReceiver(username: username, country: country)
  17. .request(
  18. success: { (response: DynamicReceiverContainerModel) in
  19. if response.errorCode != "0" {
  20. let error = NSError(
  21. domain: "Network",
  22. code: 0,
  23. message: response.message ?? ""
  24. )
  25. failure(error)
  26. }
  27. success(response.data?.dynamicField ?? [])
  28. },
  29. failure: failure
  30. )
  31. }
  32. }