Browse Source

shown success message

pull/1/head
gme_2 6 years ago
parent
commit
ee22704aa3
  1. 6
      GMERemittance/Extension/UIViewControllerExtension.swift
  2. 1
      GMERemittance/Module/EditReciepient/User Interface/View/EditReciepientViewController.swift
  3. 2
      GMERemittance/Module/SendMoneyVerification/Application Logic/Interactor/SendMoneyVerificationInteractorIO.swift
  4. 6
      GMERemittance/Module/SendMoneyVerification/Application Logic/Service/SendMoneyVerificationServiceType.swift
  5. 2
      GMERemittance/Module/SendMoneyVerification/User Interface/Presenter/SendMoneyVerificationPresenter.swift
  6. 7
      GMERemittance/Module/SendMoneyVerification/User Interface/View/SendMoneyVerificationViewController.swift
  7. 2
      GMERemittance/Module/SendMoneyVerification/User Interface/View/SendMoneyVerificationViewInterface.swift

6
GMERemittance/Extension/UIViewControllerExtension.swift

@ -45,6 +45,12 @@ extension UIViewController {
self.present(alertController, animated: true, completion: nil) self.present(alertController, animated: true, completion: nil)
} }
func alertWithOk(message: String?, title: String? = "Error", okTitle: String? = "Ok", style: UIAlertControllerStyle? = .alert, OkStyle: UIAlertActionStyle = .default, okAction: (()->())? = nil) {
let alertController = getAlert(message: message, title: title, style: style)
alertController.addAction(title: okTitle,style: OkStyle, handler: okAction)
self.present(alertController, animated: true, completion: nil)
}
private func getAlert(message: String?, title: String?, style: UIAlertControllerStyle? = .alert) -> UIAlertController { private func getAlert(message: String?, title: String?, style: UIAlertControllerStyle? = .alert) -> UIAlertController {
return UIAlertController(title: title, message: message, preferredStyle: style ?? .alert) return UIAlertController(title: title, message: message, preferredStyle: style ?? .alert)
} }

1
GMERemittance/Module/EditReciepient/User Interface/View/EditReciepientViewController.swift

@ -83,7 +83,6 @@ class EditReciepientViewController: UIViewController {
override func viewDidLoad() { override func viewDidLoad() {
super.viewDidLoad() super.viewDidLoad()
self.setup() self.setup()
self.setup()
self.setupDelegates() self.setupDelegates()
self.setupTargets() self.setupTargets()
self.presenter?.viewIsReady() self.presenter?.viewIsReady()

2
GMERemittance/Module/SendMoneyVerification/Application Logic/Interactor/SendMoneyVerificationInteractorIO.swift

@ -12,5 +12,5 @@ protocol SendMoneyVerificationInteractorInput: class {
protocol SendMoneyVerificationInteractorOutput: class { protocol SendMoneyVerificationInteractorOutput: class {
func show(error: Error) func show(error: Error)
func show(model: SendMoneySubmitModel?)
func show(model: SendMoneySubmitModelContainer?)
} }

6
GMERemittance/Module/SendMoneyVerification/Application Logic/Service/SendMoneyVerificationServiceType.swift

@ -14,19 +14,19 @@ protocol SendMoneyVerificationServiceType: class, SendMoneyVerificationSubmitApi
protocol SendMoneyVerificationSubmitApi: ApiServiceType { protocol SendMoneyVerificationSubmitApi: ApiServiceType {
func submit(params: [String: String], success: @escaping (SendMoneySubmitModel?) -> (), failure: @escaping (Error) -> ())
func submit(params: [String: String], success: @escaping (SendMoneySubmitModelContainer?) -> (), failure: @escaping (Error) -> ())
} }
extension SendMoneyVerificationSubmitApi { extension SendMoneyVerificationSubmitApi {
func submit(params: [String: String], success: @escaping (SendMoneySubmitModel?) -> (), failure: @escaping (Error) -> ()) {
func submit(params: [String: String], success: @escaping (SendMoneySubmitModelContainer?) -> (), failure: @escaping (Error) -> ()) {
let url = baseUrl + "mobile/sendmoney/dotransaction" let url = baseUrl + "mobile/sendmoney/dotransaction"
self.auth.request(method: .post, url: url, params: params, success: { (response: SendMoneySubmitModelContainer) in self.auth.request(method: .post, url: url, params: params, success: { (response: SendMoneySubmitModelContainer) in
if (response.errorCode ?? "") == "1" { if (response.errorCode ?? "") == "1" {
let error = NSError.init(domain: "Network", code: 0, userInfo: [NSLocalizedDescriptionKey : response.message ?? ""]) let error = NSError.init(domain: "Network", code: 0, userInfo: [NSLocalizedDescriptionKey : response.message ?? ""])
failure(error) failure(error)
}else { }else {
let model = response.data
let model = response
success(model) success(model)
} }
}) { (error) in }) { (error) in

2
GMERemittance/Module/SendMoneyVerification/User Interface/Presenter/SendMoneyVerificationPresenter.swift

@ -38,7 +38,7 @@ extension SendMoneyVerificationPresenter: SendMoneyVerificationInteractorOutput
self.view?.show(error: error.localizedDescription) self.view?.show(error: error.localizedDescription)
} }
func show(model: SendMoneySubmitModel?) {
func show(model: SendMoneySubmitModelContainer?) {
self.view?.hideLoading() self.view?.hideLoading()
self.view?.show(model: model) self.view?.show(model: model)
} }

7
GMERemittance/Module/SendMoneyVerification/User Interface/View/SendMoneyVerificationViewController.swift

@ -140,8 +140,11 @@ class SendMoneyVerificationViewController: UITableViewController {
// MARK: SendMoneyVerificationViewInterface // MARK: SendMoneyVerificationViewInterface
extension SendMoneyVerificationViewController: SendMoneyVerificationViewInterface { extension SendMoneyVerificationViewController: SendMoneyVerificationViewInterface {
func show(model: SendMoneySubmitModel?) {
print(model?.charge)
func show(model: SendMoneySubmitModelContainer?) {
self.alertWithOk(message: model?.message , title: "Alert!", okTitle: "OK", style: UIAlertControllerStyle.alert, OkStyle: .default) {
print("go to reciept")
}
} }
func show(error: String) { func show(error: String) {

2
GMERemittance/Module/SendMoneyVerification/User Interface/View/SendMoneyVerificationViewInterface.swift

@ -10,5 +10,5 @@ protocol SendMoneyVerificationViewInterface: class {
func show(error: String) func show(error: String)
func showLoading() func showLoading()
func hideLoading() func hideLoading()
func show(model: SendMoneySubmitModel?)
func show(model: SendMoneySubmitModelContainer?)
} }
Loading…
Cancel
Save