Browse Source

viper route added

pull/1/head
gme_2 6 years ago
parent
commit
ab7d3af896
  1. 12
      GMERemittance/Module/SendMoneyReceipt/Application Logic/Interactor/SendMoneyReceiptInteractor.swift
  2. 3
      GMERemittance/Module/SendMoneyReceipt/Application Logic/Interactor/SendMoneyReceiptInteractorIO.swift
  3. 6
      GMERemittance/Module/SendMoneyReceipt/Application Logic/Service/SendMoneyReceiptServiceType.swift
  4. 8
      GMERemittance/Module/SendMoneyReceipt/User Interface/Presenter/SendMoneyReceiptPresenter.swift
  5. 2
      GMERemittance/Module/SendMoneyReceipt/User Interface/View/SendMoneyReceiptViewInterface.swift

12
GMERemittance/Module/SendMoneyReceipt/Application Logic/Interactor/SendMoneyReceiptInteractor.swift

@ -30,7 +30,15 @@ class SendMoneyReceiptInteractor {
extension SendMoneyReceiptInteractor: SendMoneyReceiptInteractorInput {
func viewIsReady() {
// fetch recipt
print("transaction id is: \(transactionId)")
self.service.fetch(transactionId: self.transactionId, success: { (model) in
if let _model = model {
self.output?.show(model: _model)
}else {
let error = NSError.init(domain: "SendMoneyReceiptInteractor", code: 0, userInfo: [NSLocalizedDescriptionKey : "INVALID API FROM SERVER"])
self.output?.show(error: error)
}
}) { (error) in
self.output?.show(error: error)
}
}
}

3
GMERemittance/Module/SendMoneyReceipt/Application Logic/Interactor/SendMoneyReceiptInteractorIO.swift

@ -11,5 +11,6 @@ protocol SendMoneyReceiptInteractorInput: class {
}
protocol SendMoneyReceiptInteractorOutput: class {
func show(model: SendMoneyReciept)
func show(error: Error)
}

6
GMERemittance/Module/SendMoneyReceipt/Application Logic/Service/SendMoneyReceiptServiceType.swift

@ -8,17 +8,17 @@
import Foundation
protocol SendMoneyReceiptServiceType: class, FetchRecieptList {
protocol SendMoneyReceiptServiceType: class, FetchSendMoneyRecieptList {
}
protocol FetchRecieptList: ApiServiceType {
protocol FetchSendMoneyRecieptList: ApiServiceType {
func fetch(transactionId: String, success: @escaping (SendMoneyReciept?) -> (), failure: @escaping (Error) -> ())
}
extension FetchRecieptList {
extension FetchSendMoneyRecieptList {
func fetch(transactionId: String, success: @escaping (SendMoneyReciept?) -> (), failure: @escaping (Error) -> ()) {
let url = baseUrl + "mobile/receipt/" + transactionId
self.auth.request(method: .get, url: url, params: nil, success: { (response: SendMoneyRecieptContainer) in

8
GMERemittance/Module/SendMoneyReceipt/User Interface/Presenter/SendMoneyReceiptPresenter.swift

@ -30,5 +30,13 @@ extension SendMoneyReceiptPresenter: SendMoneyReceiptModuleInterface {
// MARK: SendMoneyReceipt interactor output interface
extension SendMoneyReceiptPresenter: SendMoneyReceiptInteractorOutput {
func show(model: SendMoneyReciept) {
self.view?.show(model: model)
}
func show(error: Error) {
self.view?.show(error: error.localizedDescription)
}
}

2
GMERemittance/Module/SendMoneyReceipt/User Interface/View/SendMoneyReceiptViewInterface.swift

@ -7,4 +7,6 @@
//
protocol SendMoneyReceiptViewInterface: class {
func show(error: String)
func show(model: SendMoneyReciept)
}
Loading…
Cancel
Save