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.

45 lines
1.3 KiB

  1. //
  2. // SendMoneyReceiptInteractor.swift
  3. // GMERemittance
  4. //
  5. // Created by gme_2 on 04/09/2018.
  6. //Copyright © 2018 Gobal Money Express Co. Ltd. All rights reserved.
  7. //
  8. import Foundation
  9. class SendMoneyReceiptInteractor {
  10. // MARK: Properties
  11. weak var output: SendMoneyReceiptInteractorOutput?
  12. private let service: SendMoneyReceiptServiceType
  13. var transactionId: String!
  14. // MARK: Initialization
  15. init(service: SendMoneyReceiptServiceType, transactionId: String) {
  16. self.service = service
  17. self.transactionId = transactionId
  18. }
  19. // MARK: Converting entities
  20. }
  21. // MARK: SendMoneyReceipt interactor input interface
  22. extension SendMoneyReceiptInteractor: SendMoneyReceiptInteractorInput {
  23. func viewIsReady() {
  24. self.service.fetch(transactionId: self.transactionId, success: { (model) in
  25. if let _model = model {
  26. _model.transactionId = self.transactionId
  27. self.output?.show(model: _model)
  28. }else {
  29. let error = NSError.init(domain: "SendMoneyReceiptInteractor", code: 0, userInfo: [NSLocalizedDescriptionKey : "INVALID API FROM SERVER"])
  30. self.output?.show(error: error)
  31. }
  32. }) { (error) in
  33. self.output?.show(error: error)
  34. }
  35. }
  36. }