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.

89 lines
2.6 KiB

  1. //
  2. // SendMoneyReceiptWireframe.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 UIKit
  9. class SendMoneyReceiptWireframe {
  10. weak var view: UIViewController!
  11. var transactionId: String?
  12. var controlNo: String?
  13. var isFromTransactionReport = false
  14. var shouldShowCancelAmmendButton = false
  15. let mailboxwireFrame = MessageComposeWireframe()
  16. var receiptType: ReceiptType = .overseas
  17. }
  18. extension SendMoneyReceiptWireframe: SendMoneyReceiptWireframeInput {
  19. var storyboardName: String {return "SendMoneyReceipt"}
  20. func getMainView() -> UIViewController {
  21. let service = SendMoneyReceiptService()
  22. let interactor = SendMoneyReceiptInteractor(service: service, transactionId: self.transactionId ?? "")
  23. let presenter = SendMoneyReceiptPresenter()
  24. let viewController = viewControllerFromStoryboard(of: SendMoneyReceiptViewController.self)
  25. viewController.controlNo = self.controlNo // todo: refractor later
  26. viewController.transactionId = self.transactionId // todo: refractor later
  27. viewController.shouldShowCancelAmmendButton = self.shouldShowCancelAmmendButton
  28. viewController.isFromTransactionHistory = self.isFromTransactionReport
  29. viewController.receiptType = receiptType
  30. viewController.presenter = presenter
  31. interactor.output = presenter
  32. presenter.interactor = interactor
  33. presenter.wireframe = self
  34. presenter.view = viewController
  35. self.view = viewController
  36. return viewController
  37. }
  38. func openReciept(
  39. type: ReceiptType = ReceiptType.overseas,
  40. transactionId: String,
  41. source: UINavigationController
  42. ) {
  43. receiptType = type
  44. isFromTransactionReport = false
  45. self.transactionId = transactionId
  46. self.pushMainView(in: source)
  47. }
  48. func openRecieptFromTransactionReport(
  49. type: ReceiptType = ReceiptType.overseas,
  50. controlNo: String,
  51. transactionId: String,
  52. shouldShowCancelAmmendButton: Bool,
  53. source: UINavigationController
  54. ) {
  55. receiptType = type
  56. isFromTransactionReport = true
  57. self.transactionId = transactionId
  58. self.shouldShowCancelAmmendButton = shouldShowCancelAmmendButton
  59. self.controlNo = controlNo
  60. self.pushMainView(in: source)
  61. }
  62. func dismiss() {
  63. self.view.navigationController?.popViewController(animated: true)
  64. }
  65. func openMail(controlNO: String, transactionId: String, type: MailBoxType) {
  66. if let navigation = self.view.navigationController {
  67. mailboxwireFrame.openMail(
  68. controlNO: controlNO,
  69. transactionId: transactionId,
  70. type: type,
  71. source: navigation
  72. )
  73. }
  74. }
  75. }