diff --git a/GMERemittance/Module/Auto refund/autoRefundService.swift b/GMERemittance/Module/Auto refund/autoRefundService.swift index aff468da..55b789b6 100644 --- a/GMERemittance/Module/Auto refund/autoRefundService.swift +++ b/GMERemittance/Module/Auto refund/autoRefundService.swift @@ -21,10 +21,15 @@ extension FetchAutoRefundInfo { func fetchAutoRefundInfo(username: String, success: @escaping (AutoRefund) -> (), failure: @escaping (Error) -> ()) { let url = baseUrl + "refund/\(username)" auth.request(method: .get, url: url, params: nil, encoding: URLEncoding.default, success: { (response: AutoRefundContainer) in - if let model = response.data { - success(model) + if (response.errorCode ?? "") == "1" { + let error = NSError.init(domain: "Network", code: 0, userInfo: [NSLocalizedDescriptionKey : response.message ?? ""]) + failure(error) }else { - let error = NSError.init(domain: "FetchAutoRefundInfo", code: 0, userInfo: [NSLocalizedDescriptionKey : "Could not parse json"]) + let model = response.data + if let model = response.data { success(model) }else { + let error = NSError.init(domain: "FetchAutoRefundInfo", code: 0, userInfo: [NSLocalizedDescriptionKey : "Could not parse json"]) + failure(error) + } } }) { (error) in failure(error) diff --git a/GMERemittance/Profile/Profile.storyboard b/GMERemittance/Profile/Profile.storyboard index 8d9a064e..773ab7ae 100644 --- a/GMERemittance/Profile/Profile.storyboard +++ b/GMERemittance/Profile/Profile.storyboard @@ -508,7 +508,11 @@ At least one capital letter, At least one number + + + + diff --git a/GMERemittance/Profile/ProfileChangePasswordViewController.swift b/GMERemittance/Profile/ProfileChangePasswordViewController.swift index d6fc8307..508b44bb 100644 --- a/GMERemittance/Profile/ProfileChangePasswordViewController.swift +++ b/GMERemittance/Profile/ProfileChangePasswordViewController.swift @@ -7,7 +7,7 @@ // import UIKit - +import Localize_Swift // there is not time to take this to viper archi. so applying mvc here. @@ -37,6 +37,10 @@ class ProfileChangePasswordViewController: UIViewController { @IBOutlet weak var topLabel: UILabel! @IBOutlet weak var contentView: UIView! + @IBOutlet weak var currentPasswowrdTitleLabel: UILabel! + @IBOutlet weak var newPasswordTitleLabel: UILabel! + @IBOutlet weak var confirmPasswordTitlelabel: UILabel! + @IBOutlet weak var saveButton: UIButton! // MARK:- Properties // keyboard @@ -90,7 +94,7 @@ class ProfileChangePasswordViewController: UIViewController { self.textFieldNewPassword.delegate = self self.textFieldConfirmPassword.delegate = self self.textFieldCurrentPassword.delegate = self - + configureLanguage() } override func viewWillAppear(_ animated: Bool) { @@ -103,6 +107,19 @@ class ProfileChangePasswordViewController: UIViewController { self.navigationItem.title = "" } + func configureLanguage() { + self.topLabel.text = "password_policy_text".localized() + self.textFieldCurrentPassword.placeholder = "current_password_placeholder_text".localized() + self.textFieldNewPassword.placeholder = "new_password_placeholder_text".localized() + self.textFieldConfirmPassword.placeholder = "confirm_password_text".localized() + self.newPasswordTitleLabel.text = "new_password_text".localized() + self.currentPasswowrdTitleLabel.text = "current_password_placeholder_text".localized() + self.confirmPasswordTitlelabel.text = "confirm_password_text".localized() + self.saveButton.setTitle("save_text", for: UIControlState.normal) + } + + + @IBAction func savePasswordChanges(_ sender: Any) { let currentPassword = self.encryptedOldPassword ?? "" let newPassword = self.encryptedPassword ?? ""