diff --git a/.DS_Store b/.DS_Store index 05b7dc9a..bb4a0659 100644 Binary files a/.DS_Store and b/.DS_Store differ diff --git a/GME Remit/APIs/Router/APIRouter.swift b/GME Remit/APIs/Router/APIRouter.swift index e9d24db3..4d1b1f9b 100644 --- a/GME Remit/APIs/Router/APIRouter.swift +++ b/GME Remit/APIs/Router/APIRouter.swift @@ -63,7 +63,7 @@ enum APIRouter { case validateReferralCode(code: String) // MARK: - Receiver - case fetchRecipients(senderID: String) + case fetchRecipients(senderID: String, fromDate: String, toDate: String, countryCode: String, pageCount: String) case dynamicReceiver(username: String, countryID: String, serviceTypeID: String) case fetchCountriesAndServiceTypes(username: String) case addRecipient(senderID: String, recipient: Recipient) @@ -572,8 +572,8 @@ extension APIRouter { case .dynamicReceiver(let username, let countryID, let serviceType): let path = "\(username)/dynamicField?countryId=\(countryID)&serviceType=\(serviceType)" return "\(baseUrlWithoutVersion)v3/mobile/receiver/\(path)" - case .fetchRecipients(let senderID): - return "\(baseUrlWithoutVersion)v5/mobile/\(senderID)/receiverinfo/151" + case .fetchRecipients(let senderID,_,_, let countryCode,_): + return "\(baseUrlWithoutVersion)v5/mobile/\(senderID)/receiverinfo/\(countryCode)" case .fetchCountriesAndServiceTypes(let username): return "\(baseUrlWithoutVersion)v3/mobile/\(username)/FetchCountriesAndServiceTypes" case .addRecipient(let senderID, _): @@ -827,11 +827,11 @@ extension APIRouter { case .post: switch self { - case .fetchRecipients: + case .fetchRecipients(_, let fromDate, let toDate,_, let pageCount): return [ - "fromDate": "", - "toDate": "", - "Page": "" + "fromDate": fromDate, + "toDate": toDate, + "Page": pageCount ] case .uploadProfile: diff --git a/GME Remit/Modules/AllRecipients/Application Logic/Interactor/AllRecipientsInteractor.swift b/GME Remit/Modules/AllRecipients/Application Logic/Interactor/AllRecipientsInteractor.swift index d661f351..b7c816d4 100644 --- a/GME Remit/Modules/AllRecipients/Application Logic/Interactor/AllRecipientsInteractor.swift +++ b/GME Remit/Modules/AllRecipients/Application Logic/Interactor/AllRecipientsInteractor.swift @@ -14,6 +14,7 @@ class AllRecipientsInteractor { weak var output: AllRecipientsInteractorOutput? private let service: AllRecipientsServiceType + private var recipients: FetchBeneficiariesModel? // MARK: Initialization @@ -28,8 +29,9 @@ class AllRecipientsInteractor { extension AllRecipientsInteractor: AllRecipientsInteractorInput { func makeApiRequest() { - self.service.makeApiRequest(success: { (message) in - self.output?.success(message: message ?? "") + self.service.makeApiRequest(success: { + self.recipients = $0.recipients + self.output?.setRecipients(using: $0.recipients) }) { (error) in self.output?.show(error: error) } diff --git a/GME Remit/Modules/AllRecipients/Application Logic/Interactor/AllRecipientsInteractorIO.swift b/GME Remit/Modules/AllRecipients/Application Logic/Interactor/AllRecipientsInteractorIO.swift index 59e3c2ce..58ca4f3f 100644 --- a/GME Remit/Modules/AllRecipients/Application Logic/Interactor/AllRecipientsInteractorIO.swift +++ b/GME Remit/Modules/AllRecipients/Application Logic/Interactor/AllRecipientsInteractorIO.swift @@ -13,4 +13,5 @@ protocol AllRecipientsInteractorInput: class { protocol AllRecipientsInteractorOutput: class { func show(error: Error) func success(message: String) + func setRecipients(using model: FetchBeneficiariesModel?) } diff --git a/GME Remit/Modules/AllRecipients/Application Logic/Service/AllRecipientsService.swift b/GME Remit/Modules/AllRecipients/Application Logic/Service/AllRecipientsService.swift index 9014db50..3c720e64 100644 --- a/GME Remit/Modules/AllRecipients/Application Logic/Service/AllRecipientsService.swift +++ b/GME Remit/Modules/AllRecipients/Application Logic/Service/AllRecipientsService.swift @@ -10,8 +10,10 @@ import Foundation class AllRecipientsService: AllRecipientsServiceType { func makeApiRequest( - success: @escaping (String?) -> Void, + success: @escaping (FetchRecipientsModel) -> Void, failure: @escaping (Error) -> Void ){ + let senderId = GMEDB.shared.user.string(.senderId) ?? "" + APIRouter.fetchRecipients(senderID: senderId, fromDate: "", toDate: "", countryCode: "", pageCount: "").json(success: success, failure: failure) } } diff --git a/GME Remit/Modules/AllRecipients/Application Logic/Service/AllRecipientsServiceType.swift b/GME Remit/Modules/AllRecipients/Application Logic/Service/AllRecipientsServiceType.swift index 6d9ea892..0c6b353b 100644 --- a/GME Remit/Modules/AllRecipients/Application Logic/Service/AllRecipientsServiceType.swift +++ b/GME Remit/Modules/AllRecipients/Application Logic/Service/AllRecipientsServiceType.swift @@ -10,7 +10,7 @@ import Foundation protocol AllRecipientsServiceType: class, ApiServiceType { func makeApiRequest( - success: @escaping (String?) -> Void, - failure: @escaping (Error) -> Void + success: @escaping (FetchRecipientsModel) -> Void, + failure: @escaping (Error) -> Void ) } diff --git a/GME Remit/Modules/AllRecipients/User Interface/Presenter/AllRecipientsPresenter.swift b/GME Remit/Modules/AllRecipients/User Interface/Presenter/AllRecipientsPresenter.swift index 6c1d3dc3..b7bded53 100644 --- a/GME Remit/Modules/AllRecipients/User Interface/Presenter/AllRecipientsPresenter.swift +++ b/GME Remit/Modules/AllRecipients/User Interface/Presenter/AllRecipientsPresenter.swift @@ -31,6 +31,11 @@ extension AllRecipientsPresenter: AllRecipientsModuleInterface { // MARK: AllRecipients interactor output interface extension AllRecipientsPresenter: AllRecipientsInteractorOutput { + func setRecipients(using model: FetchBeneficiariesModel?) { + self.view?.hideLoading() + self.view?.setRecipients(using: model) + } + func show(error: Error) { self.view?.hideLoading() self.view?.show(error: error.localizedDescription) diff --git a/GME Remit/Modules/AllRecipients/User Interface/View/AllRecipients.storyboard b/GME Remit/Modules/AllRecipients/User Interface/View/AllRecipients.storyboard index 547759fc..f6ee2821 100644 --- a/GME Remit/Modules/AllRecipients/User Interface/View/AllRecipients.storyboard +++ b/GME Remit/Modules/AllRecipients/User Interface/View/AllRecipients.storyboard @@ -1,9 +1,9 @@ - + - + @@ -74,16 +74,25 @@ + - + + + + + + + + + diff --git a/GME Remit/Modules/AllRecipients/User Interface/View/AllRecipientsViewController.swift b/GME Remit/Modules/AllRecipients/User Interface/View/AllRecipientsViewController.swift index 7ab66c78..25e788c3 100644 --- a/GME Remit/Modules/AllRecipients/User Interface/View/AllRecipientsViewController.swift +++ b/GME Remit/Modules/AllRecipients/User Interface/View/AllRecipientsViewController.swift @@ -11,13 +11,8 @@ import UIKit class AllRecipientsViewController: UIViewController { // MARK: Properties - var presenter: AllRecipientsModuleInterface? - var beneficaiaryModel: [Recipient]? { - didSet { -// self.tableView.reloadData() - } - } + var beneficaiaryModel: [Recipient]? // MARK: IBOutlets @@ -37,6 +32,7 @@ class AllRecipientsViewController: UIViewController { private func setup() { self.tableView.delegate = self self.tableView.dataSource = self + self.presenter?.makeApiRequest() } } @@ -56,6 +52,11 @@ extension AllRecipientsViewController: UITableViewDelegate, UITableViewDataSourc // MARK: AllRecipientsViewInterface extension AllRecipientsViewController: AllRecipientsViewInterface { + func setRecipients(using model: FetchBeneficiariesModel?) { + self.beneficaiaryModel = model?.beneficiaries + self.tableView.reloadData() + } + func showLoading() { self.showProgressHud() } @@ -77,4 +78,6 @@ extension AllRecipientsViewController: AllRecipientsViewInterface { ) { } } + + } diff --git a/GME Remit/Modules/AllRecipients/User Interface/View/AllRecipientsViewInterface.swift b/GME Remit/Modules/AllRecipients/User Interface/View/AllRecipientsViewInterface.swift index cf0b72c1..41b2261c 100644 --- a/GME Remit/Modules/AllRecipients/User Interface/View/AllRecipientsViewInterface.swift +++ b/GME Remit/Modules/AllRecipients/User Interface/View/AllRecipientsViewInterface.swift @@ -11,4 +11,5 @@ protocol AllRecipientsViewInterface: class { func hideLoading() func show(error: String) func show(message: String) + func setRecipients(using model: FetchBeneficiariesModel?) } diff --git a/GME Remit/Modules/AllRecipients/User Interface/Wireframe/AllRecipientsWireframe.swift b/GME Remit/Modules/AllRecipients/User Interface/Wireframe/AllRecipientsWireframe.swift index 486345a9..fb1fe5ee 100644 --- a/GME Remit/Modules/AllRecipients/User Interface/Wireframe/AllRecipientsWireframe.swift +++ b/GME Remit/Modules/AllRecipients/User Interface/Wireframe/AllRecipientsWireframe.swift @@ -41,4 +41,10 @@ extension AllRecipientsWireframe: AllRecipientsWireframeInput { self.beneficiaryModel = model self.pushMainView(in: source) } + + func openAllRecipients( + source: UINavigationController + ) { + self.pushMainView(in: source) + } } diff --git a/GME Remit/Modules/RecipientModules/Recipients/Application Logic/Service/RecipientsService.swift b/GME Remit/Modules/RecipientModules/Recipients/Application Logic/Service/RecipientsService.swift index f2cb8df6..ee83427a 100644 --- a/GME Remit/Modules/RecipientModules/Recipients/Application Logic/Service/RecipientsService.swift +++ b/GME Remit/Modules/RecipientModules/Recipients/Application Logic/Service/RecipientsService.swift @@ -16,7 +16,7 @@ class RecipientsService: RecipientsServiceType { ) { let senderID = GMEDB.shared.user.string(.senderId) ?? "" APIRouter - .fetchRecipients(senderID: senderID) + .fetchRecipients(senderID: senderID, fromDate: "", toDate: "", countryCode: "", pageCount: "") .json(success: success, failure: failure) } diff --git a/GME Remit/Modules/RecipientModules/Recipients/User Interface/View/RecipientsViewController.swift b/GME Remit/Modules/RecipientModules/Recipients/User Interface/View/RecipientsViewController.swift index f03aa031..2d5727c8 100644 --- a/GME Remit/Modules/RecipientModules/Recipients/User Interface/View/RecipientsViewController.swift +++ b/GME Remit/Modules/RecipientModules/Recipients/User Interface/View/RecipientsViewController.swift @@ -47,8 +47,8 @@ class RecipientsViewController: UIViewController { // @IBOutlet private var addRecipientTapGestureRecognizer: UITapGestureRecognizer! @IBAction func seeAllButton(_ sender: UIButton) { - if let model = self.model, let navigation = self.navigationController { - AllRecipientsWireframe().opemRecipients(model: model, source: navigation) + if let navigation = self.navigationController { + AllRecipientsWireframe().openAllRecipients(source: navigation) } } diff --git a/GME Remit/Modules/RemittanceModules/OverseasModules/SendMoneyExchangeRate/Application Logic/Service/SendMoneyExchangeRateServiceType.swift b/GME Remit/Modules/RemittanceModules/OverseasModules/SendMoneyExchangeRate/Application Logic/Service/SendMoneyExchangeRateServiceType.swift index 560154b8..5be8c4c1 100644 --- a/GME Remit/Modules/RemittanceModules/OverseasModules/SendMoneyExchangeRate/Application Logic/Service/SendMoneyExchangeRateServiceType.swift +++ b/GME Remit/Modules/RemittanceModules/OverseasModules/SendMoneyExchangeRate/Application Logic/Service/SendMoneyExchangeRateServiceType.swift @@ -28,7 +28,7 @@ extension FetchSendMoneyExchangeRateService { params: [String: String], success: @escaping (SendMoneyExchangeRateModel?) -> Void, failure: @escaping (Error) -> Void) { - let url = baseUrl + "/mobile/calculateDefExRate" + let url = baseUrl + "/mobile/sendmoney/calculate" auth.request( method: .post, url: url, diff --git a/GME Remit/Modules/RemittanceModules/OverseasModules/SendMoneyExchangeRate/User Interface/View/SendMoneyExchangeRateViewController.swift b/GME Remit/Modules/RemittanceModules/OverseasModules/SendMoneyExchangeRate/User Interface/View/SendMoneyExchangeRateViewController.swift index 8c24db5f..e76b08b2 100644 --- a/GME Remit/Modules/RemittanceModules/OverseasModules/SendMoneyExchangeRate/User Interface/View/SendMoneyExchangeRateViewController.swift +++ b/GME Remit/Modules/RemittanceModules/OverseasModules/SendMoneyExchangeRate/User Interface/View/SendMoneyExchangeRateViewController.swift @@ -434,10 +434,10 @@ class SendMoneyExchangeRateViewController: UIViewController { let reciepientCountryName = reciepient?.country let reciepientCountryId = reciepient?.countryID let paymentMode = "wallet" - let paymentMethodId = paymentModel?.receiverId + let paymentMethodId = paymentModel?.id let payoutPartner = requestModel?.paymemtMode?.payoutPartner let myUsername = Utility.getMyUserName() - let bankId = paymentModel?.receiverId + let bankId = requestModel?.bank?.id let discountedFee = rewardTextField.text // let discountedFee //bank id if selected bank