From 2d0ba21afaea092f6246bcc9a6e52be131a8cf38 Mon Sep 17 00:00:00 2001 From: InKwon James Kim Date: Mon, 9 Sep 2019 14:49:41 +0900 Subject: [PATCH] edit send money parent for bank name --- .../Wireframe/MainWireframe.swift | 1 + .../SendMoneyExchangeRateInteractor.swift | 28 ++++--- .../SendMoneyExchangeRateServiceType.swift | 45 +++++++---- .../View/SendMoneyParentViewController.swift | 4 + .../View/SendMoneyVerification.storyboard | 78 +++++++++---------- 5 files changed, 93 insertions(+), 63 deletions(-) diff --git a/GME Remit/Modules/Main/User Interface/Wireframe/MainWireframe.swift b/GME Remit/Modules/Main/User Interface/Wireframe/MainWireframe.swift index a49c8f27..8a5189e2 100644 --- a/GME Remit/Modules/Main/User Interface/Wireframe/MainWireframe.swift +++ b/GME Remit/Modules/Main/User Interface/Wireframe/MainWireframe.swift @@ -70,6 +70,7 @@ extension MainWireframe: MainWireframeInput { static func logoutWarningAlert(message: String) { guard let window = MainWireframe.shared?.window else {return} + window.rootViewController?.hideProgressHud() window.rootViewController?.alertWithOk( type: .error, diff --git a/GME Remit/Modules/SendMoneyModules/SendMoneyExchangeRate/Application Logic/Interactor/SendMoneyExchangeRateInteractor.swift b/GME Remit/Modules/SendMoneyModules/SendMoneyExchangeRate/Application Logic/Interactor/SendMoneyExchangeRateInteractor.swift index 94530bc0..7a3a255e 100644 --- a/GME Remit/Modules/SendMoneyModules/SendMoneyExchangeRate/Application Logic/Interactor/SendMoneyExchangeRateInteractor.swift +++ b/GME Remit/Modules/SendMoneyModules/SendMoneyExchangeRate/Application Logic/Interactor/SendMoneyExchangeRateInteractor.swift @@ -28,19 +28,27 @@ class SendMoneyExchangeRateInteractor { extension SendMoneyExchangeRateInteractor: SendMoneyExchangeRateInteractorInput { func calculate(params: [String : String]) { - self.service.calculate(params: params, success: { (model) in - if let model = model { - self.output?.show(model: model) - }else { - let error = NSError.init(domain: "SendMoneyExchangeRateInteractor", code: 0, userInfo: [NSLocalizedDescriptionKey : "Failed to map exchange rate from server"]) - self.output?.show(error: error) - } - }) { (error) in + self.service.calculate( + params: params, + success: { (model) in + if let model = model { + self.output?.show(model: model) + } else { + let error = NSError( + domain: "SendMoneyExchangeRateInteractor", + code: 0, + userInfo: [NSLocalizedDescriptionKey : "Failed to map exchange rate from server"] + ) + self.output?.show(error: error) + } + }, + failure: { (error) in self.output?.show(error: error) - } + } + ) } - func fetchCoupons(){ + func fetchCoupons() { service.fetchCoupons( success: {[weak self] in guard let `self` = self else { diff --git a/GME Remit/Modules/SendMoneyModules/SendMoneyExchangeRate/Application Logic/Service/SendMoneyExchangeRateServiceType.swift b/GME Remit/Modules/SendMoneyModules/SendMoneyExchangeRate/Application Logic/Service/SendMoneyExchangeRateServiceType.swift index d51f0ec9..09da62d3 100644 --- a/GME Remit/Modules/SendMoneyModules/SendMoneyExchangeRate/Application Logic/Service/SendMoneyExchangeRateServiceType.swift +++ b/GME Remit/Modules/SendMoneyModules/SendMoneyExchangeRate/Application Logic/Service/SendMoneyExchangeRateServiceType.swift @@ -16,22 +16,39 @@ protocol SendMoneyExchangeRateServiceType: class, FetchSendMoneyExchangeRateServ } protocol FetchSendMoneyExchangeRateService: ApiServiceType { - func calculate(params: [String: String], success: @escaping (SendMoneyExchangeRateModel?) -> (), failure: @escaping (Error) -> ()) + func calculate( + params: [String: String], + success: @escaping (SendMoneyExchangeRateModel?) -> Void, + failure: @escaping (Error) -> () + ) } extension FetchSendMoneyExchangeRateService { - func calculate(params: [String: String], success: @escaping (SendMoneyExchangeRateModel?) -> (), failure: @escaping (Error) -> ()) { - let url = baseUrl + "/mobile/sendmoney/calculate" - auth.request(method: .post, url: url, params: params, success: { (response: SendMoneyExchangeRateModelContainer) in - if (response.errorCode ?? "") == "1" { - let error = NSError.init(domain: "Network", code: 0, userInfo: [NSLocalizedDescriptionKey : response.message ?? ""]) - failure(error) - }else { - let model = response.data - success(model) - } - }) { (error) in - failure(error) + func calculate( + params: [String: String], + success: @escaping (SendMoneyExchangeRateModel?) -> Void, + failure: @escaping (Error) -> Void) { + let url = baseUrl + "/mobile/sendmoney/calculate" + auth.request( + method: .post, + url: url, + params: params, + success: { (response: SendMoneyExchangeRateModelContainer) in + if (response.errorCode ?? "") == "1" { + let error = NSError( + domain: "Network", + code: 0, + userInfo: [NSLocalizedDescriptionKey : response.message ?? ""] + ) + failure(error) + } else { + let model = response.data + success(model) } - } + }, + failure: { (error) in + failure(error) + } + ) + } } diff --git a/GME Remit/Modules/SendMoneyModules/SendMoneyParent/User Interface/View/SendMoneyParentViewController.swift b/GME Remit/Modules/SendMoneyModules/SendMoneyParent/User Interface/View/SendMoneyParentViewController.swift index bb42a938..71114bd5 100644 --- a/GME Remit/Modules/SendMoneyModules/SendMoneyParent/User Interface/View/SendMoneyParentViewController.swift +++ b/GME Remit/Modules/SendMoneyModules/SendMoneyParent/User Interface/View/SendMoneyParentViewController.swift @@ -86,9 +86,13 @@ class SendMoneyParentViewController: UIViewController { var receipient: Recipient? { didSet { self.requestModel.bank?.id = receipient?.agent?.id + self.requestModel.bank?.name = receipient?.agent?.name self.requestModel.bank?.payCurrency = receipient?.agent?.currency + self.requestModel.accountNumber = receipient?.agent?.accountNumber + self.requestModel.branch?.id = receipient?.agent?.branch?.id + self.requestModel.branch?.name = receipient?.agent?.branch?.name self.requestModel.paymemtMode?.id = receipient?.paymentMethod?.id self.requestModel.paymemtMode?.mode = receipient?.paymentMethod?.name diff --git a/GME Remit/Modules/SendMoneyModules/SendMoneyVerification/User Interface/View/SendMoneyVerification.storyboard b/GME Remit/Modules/SendMoneyModules/SendMoneyVerification/User Interface/View/SendMoneyVerification.storyboard index 08d33f69..ce682734 100644 --- a/GME Remit/Modules/SendMoneyModules/SendMoneyVerification/User Interface/View/SendMoneyVerification.storyboard +++ b/GME Remit/Modules/SendMoneyModules/SendMoneyVerification/User Interface/View/SendMoneyVerification.storyboard @@ -209,15 +209,15 @@ - - + + - + - + - + - - + + - + - + - + - + - + - + - + - + - + - + - + - -