diff --git a/GMERemittance/AppDelegate.swift b/GMERemittance/AppDelegate.swift index 0973d48f..f973bde2 100644 --- a/GMERemittance/AppDelegate.swift +++ b/GMERemittance/AppDelegate.swift @@ -19,7 +19,7 @@ import AlamofireNetworkActivityLogger import IQKeyboardManagerSwift import LGSideMenuController -let server: Server = .stagging +let server: Server = .uat @UIApplicationMain class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterDelegate, MessagingDelegate { diff --git a/GMERemittance/Library/WebLinks/WebLinksViewController.swift b/GMERemittance/Library/WebLinks/WebLinksViewController.swift index 2dc94e3e..914c228b 100644 --- a/GMERemittance/Library/WebLinks/WebLinksViewController.swift +++ b/GMERemittance/Library/WebLinks/WebLinksViewController.swift @@ -63,6 +63,7 @@ class WebLinksViewController: UIViewController { if NetworkReachabilityManager()?.isReachable == true { if let url = URL.init(string: self.url ?? "") { let request = URLRequest(url: url) + webView?.loadRequest(request) } }else { diff --git a/GMERemittance/Library/WebLinks/WkWebView/WkWebViewController.swift b/GMERemittance/Library/WebLinks/WkWebView/WkWebViewController.swift index 9503ffdf..a55f0c81 100644 --- a/GMERemittance/Library/WebLinks/WkWebView/WkWebViewController.swift +++ b/GMERemittance/Library/WebLinks/WkWebView/WkWebViewController.swift @@ -39,16 +39,19 @@ class WkWebViewController: UIViewController { let headers = self.headers ?? [] - print(self.url) - if let myURL = URL(string: self.url ?? "") { - var myRequest = URLRequest(url: myURL) + + let _url = (self.url ?? "").addingPercentEncoding(withAllowedCharacters: .urlQueryAllowed)! +// var urlStr : String = url.stringByAddingPercentEscapesUsingEncoding(NSUTF8StringEncoding)! - headers.forEach({ - myRequest.setValue($0.key ?? "", forHTTPHeaderField: $0.value ?? "") - - }) - - print(myRequest.allHTTPHeaderFields) + if let myURL = URL(string: _url) { + var myRequest = URLRequest(url: myURL) +// +// headers.forEach({ +// myRequest.setValue($0.key ?? "", forHTTPHeaderField: $0.value ?? "") +// +// }) +// +// print(myRequest.allHTTPHeaderFields) webView.load(myRequest) } } @@ -76,5 +79,16 @@ extension WkWebViewController: WKUIDelegate, WKNavigationDelegate { // activityIndicator?.isHidden = true activityIndicator?.stopAnimating() } + + func webView(_ webView: WKWebView, runJavaScriptAlertPanelWithMessage message: String, initiatedByFrame frame: WKFrameInfo, completionHandler: @escaping () -> Void) { + let alertController = UIAlertController(title: message, message: nil, + preferredStyle: UIAlertController.Style.alert); + + alertController.addAction(UIAlertAction(title: "OK", style: UIAlertAction.Style.cancel) { + _ in completionHandler()} + ); + + self.present(alertController, animated: true, completion: {}); + } } diff --git a/GMERemittance/Model/Account.swift b/GMERemittance/Model/Account.swift index bcffb557..ad1b4d7a 100644 --- a/GMERemittance/Model/Account.swift +++ b/GMERemittance/Model/Account.swift @@ -134,3 +134,36 @@ class KftcHeader: Mappable { value <- map["Value"] } } + + +//class KFTCURLContainer: Mappable { +// var errorCode: String? +// var message: String? +// var id: String? +// var data: KFTCURL? +// +// required init?(map: Map) { +// +// } +// +// func mapping(map: Map) { +// errorCode <- map["ErrorCode"] +// message <- map["Msg"] +// id <- map["Id"] +// data <- map["Data"] +// } +//} + + + +class KFTCURL: Mappable { + var value: String? + + required init?(map: Map) { + + } + + func mapping(map: Map) { + value <- map["location"] + } +} diff --git a/GMERemittance/Module/AutoDebit/Application Logic/Service/AutoDebitService.swift b/GMERemittance/Module/AutoDebit/Application Logic/Service/AutoDebitService.swift index 86f2932a..cfc651d1 100644 --- a/GMERemittance/Module/AutoDebit/Application Logic/Service/AutoDebitService.swift +++ b/GMERemittance/Module/AutoDebit/Application Logic/Service/AutoDebitService.swift @@ -70,3 +70,18 @@ extension DeleteAccountService { } +protocol FetchKftcUrlService: ApiServiceType { + func fetchKftcUrlService(url: String, header: [String: String], success: @escaping (String?) -> (), failure: @escaping (Error) -> ()) +} + +extension FetchKftcUrlService { + func fetchKftcUrlService(url: String, header: [String: String], success: @escaping (String?) -> (), failure: @escaping (Error) -> ()) { + auth.kftcRequest(method: .get, header: header, url: url, params: nil, encoding: URLEncoding.default, success: { (response: KFTCURL) in + success(response.value) + }) { (error) in + failure(error) + } + } +} + + diff --git a/GMERemittance/Module/AutoDebit/User Interface/View/AutoDebitViewController.swift b/GMERemittance/Module/AutoDebit/User Interface/View/AutoDebitViewController.swift index ddff1b1a..54328c86 100644 --- a/GMERemittance/Module/AutoDebit/User Interface/View/AutoDebitViewController.swift +++ b/GMERemittance/Module/AutoDebit/User Interface/View/AutoDebitViewController.swift @@ -39,12 +39,28 @@ class AutoDebitViewController: UIViewController { var languages: [KftcLanguage]? var header: [KftcHeader]? var url: String? + var selectedLanguage: KftcLanguage? { didSet { if var url = self.url { let string = "&lang=\(selectedLanguage?.key ?? "")" url.append(string) - openWkWebViewWith(url: url) + var _header: [String: String] = [:] + self.header?.forEach({ (header) in + _header[header.key ?? ""] = header.value ?? "" + }) + + self.fetchKftcUrlService(url: url, header: _header , success: { (location) in + print(location) + guard let location = location else { + print("cannot get location from server") + return + } + self.openWkWebViewWith(url: location) + }) { (error) in + self.alert(message: error.localizedDescription) + } + } } } @@ -221,4 +237,7 @@ extension AutoDebitViewController: FetchAccountList, DeleteAccountService { extension AutoDebitViewController: AutoDebitViewInterface { } -//AutoDebitViewController + +extension AutoDebitViewController: FetchKftcUrlService { + +} diff --git a/GMERemittance/Module/SendMoney/SendMoneyReceipt/User Interface/View/SendMoneyReceiptViewController.swift b/GMERemittance/Module/SendMoney/SendMoneyReceipt/User Interface/View/SendMoneyReceiptViewController.swift index 592f2399..216b00ca 100644 --- a/GMERemittance/Module/SendMoney/SendMoneyReceipt/User Interface/View/SendMoneyReceiptViewController.swift +++ b/GMERemittance/Module/SendMoney/SendMoneyReceipt/User Interface/View/SendMoneyReceiptViewController.swift @@ -46,6 +46,7 @@ class SendMoneyReceiptViewController: UIViewController { var presenter: SendMoneyReceiptModuleInterface? var hudDelegate: HUDStatusDelegate? var shouldShowCancelAmmendButton = false + var fromSendMoney = false var controlNo: String? var transactionId: String? var type: MailBoxType? @@ -79,9 +80,9 @@ class SendMoneyReceiptViewController: UIViewController { // MARK: IBActions @IBAction func done(_ sender: UIButton) { if (self.shouldShowCancelAmmendButton) { - self.navigationController?.popToRootViewController(animated: true) - }else { self.navigationController?.popViewController(animated: true) + }else { + self.navigationController?.popToRootViewController(animated: true) } } // MARK: Other Functions diff --git a/GMERemittance/Module/SendMoney/SendMoneyReceipt/User Interface/Wireframe/SendMoneyReceiptWireframe.swift b/GMERemittance/Module/SendMoney/SendMoneyReceipt/User Interface/Wireframe/SendMoneyReceiptWireframe.swift index e1684ae6..161a4e23 100644 --- a/GMERemittance/Module/SendMoney/SendMoneyReceipt/User Interface/Wireframe/SendMoneyReceiptWireframe.swift +++ b/GMERemittance/Module/SendMoney/SendMoneyReceipt/User Interface/Wireframe/SendMoneyReceiptWireframe.swift @@ -40,11 +40,13 @@ extension SendMoneyReceiptWireframe: SendMoneyReceiptWireframeInput { func openReciept(transactionId: String, source: UINavigationController) { self.transactionId = transactionId + self.isFromTransactionReport = false self.pushMainView(in: source) } func openRecieptFromTransactionReport(controlNo: String, transactionId: String, shouldShowCancelAmmendButton: Bool, source: UINavigationController) { self.transactionId = transactionId + self.isFromTransactionReport = shouldShowCancelAmmendButton self.controlNo = controlNo self.pushMainView(in: source) } diff --git a/GMERemittance/Module/SendMoney/SendMoneyVerification/User Interface/Wireframe/SendMoneyVerificationWireframe.swift b/GMERemittance/Module/SendMoney/SendMoneyVerification/User Interface/Wireframe/SendMoneyVerificationWireframe.swift index 383628c1..414d0f5b 100644 --- a/GMERemittance/Module/SendMoney/SendMoneyVerification/User Interface/Wireframe/SendMoneyVerificationWireframe.swift +++ b/GMERemittance/Module/SendMoney/SendMoneyVerification/User Interface/Wireframe/SendMoneyVerificationWireframe.swift @@ -36,7 +36,6 @@ extension SendMoneyVerificationWireframe: SendMoneyVerificationWireframeInput { func openReciept(transactionId: String) { if let navigation = self.view.navigationController { reciptWireframe.openReciept(transactionId: transactionId, source: navigation) - } } diff --git a/GMERemittance/RestApiManager.swift b/GMERemittance/RestApiManager.swift index abbddfbe..efea3fc8 100644 --- a/GMERemittance/RestApiManager.swift +++ b/GMERemittance/RestApiManager.swift @@ -70,8 +70,7 @@ class RestApiMananger { ] } - - + // ccr @@ -93,6 +92,40 @@ class RestApiMananger { } } + func kftcRequest(method: HTTPMethod, header: [String: String], url: String, params: [String: Any]?, encoding: ParameterEncoding = JSONEncoding.default, needsAuthorization: Bool = true, success: @escaping (T) -> (), failure: @escaping (Error) -> ()) { + if NetworkReachabilityManager()?.isReachable ?? false { + manager.request( + url, + method: method, + parameters: params, + encoding: encoding, + headers: header + ).handle(success: success, failure: failure) + }else { + let error = NSError.init(domain: "NETWORK_REACHABILITY_DOMAIN", code: 0, userInfo: [NSLocalizedDescriptionKey : "No Internet connection found. 
Check your connection."]) + failure(error) + } + } + + + +// +// func kftcRequest(method: HTTPMethod, header: [String: Any], url: String, params: [String: Any]?, encoding: ParameterEncoding = JSONEncoding.default, needsAuthorization: Bool = true, success: @escaping (T) -> (), failure: @escaping (Error) -> ()) { +// if NetworkReachabilityManager()?.isReachable ?? false { +// +// manager.request( +// url, +// method: method, +// parameters: params, +// encoding: encoding, +// headers: header +// ).handle(success: success, failure: failure) +// }else { +// let error = NSError.init(domain: "NETWORK_REACHABILITY_DOMAIN", code: 0, userInfo: [NSLocalizedDescriptionKey : "No Internet connection found. 
 +//Check your connection."]) +// failure(error) + + func requestMultipart( method: HTTPMethod, _ URLString: URLConvertible, diff --git a/GMERemittance/SideMenu/SideMenuViewController.swift b/GMERemittance/SideMenu/SideMenuViewController.swift index 0c9c68ca..f450e212 100644 --- a/GMERemittance/SideMenu/SideMenuViewController.swift +++ b/GMERemittance/SideMenu/SideMenuViewController.swift @@ -70,8 +70,8 @@ class SideMenuViewController: UIViewController { let shouldShowWithdrawButton = Utility.pennyTestVerified() && Utility.isVerifiedUser() self.withdrawButton.isHidden = !shouldShowWithdrawButton -// self.manageAccountStackView.isHidden = !shouldShowWithdrawButton - self.manageAccountStackView.isHidden = true + self.manageAccountStackView.isHidden = !shouldShowWithdrawButton + self.view.backgroundColor = AppConstants.themeRedColor self.roundedBgView.layer.cornerRadius = 20 self.labelBalance.text = "0" @@ -84,7 +84,7 @@ class SideMenuViewController: UIViewController { self.labelBalance.text = balance let shouldShowWithdrawButton = Utility.pennyTestVerified() && Utility.isVerifiedUser() self.withdrawButton.isHidden = !shouldShowWithdrawButton -// self.manageAccountStackView.isHidden = !shouldShowWithdrawButton + self.manageAccountStackView.isHidden = !shouldShowWithdrawButton }