Browse Source

amont send in request otp

pull/1/head
gme_2 6 years ago
parent
commit
bb1d22eab1
  1. 4
      GMERemittance/Extension/StringExtension.swift
  2. 1
      GMERemittance/Model/SendMoneyExchangeRate.swift
  3. 6
      GMERemittance/Module/SendMoney/SendMoneyExchangeRate/User Interface/View/SendMoneyExchangeRateViewController.swift
  4. 2
      GMERemittance/Module/SendMoney/SendMoneyVerification/User Interface/View/SendMoneyVerificationViewController.swift
  5. 11
      GMERemittance/Module/SendMoneyCode/Application Logic/Interactor/SendMoneyCodeInteractor.swift
  6. 8
      GMERemittance/Module/SendMoneyCode/Application Logic/Service/SendMoneyCodeServiceType.swift
  7. 6
      GMERemittance/Module/SendMoneyCode/User Interface/Wireframe/SendMoneyCodeWireframe.swift
  8. 2
      GMERemittance/UrlManager.swift

4
GMERemittance/Extension/StringExtension.swift

@ -25,6 +25,10 @@ extension String {
return components(separatedBy: .whitespaces).joined()
}
func stringRemovingComma() -> String {
return components(separatedBy: ",").joined()
}
func getDateFromDateTime() -> String {
return components(separatedBy: .whitespaces)[0]
}

1
GMERemittance/Model/SendMoneyExchangeRate.swift

@ -21,6 +21,7 @@ class SendMoneyExchangeRateModel: Mappable {
var calcBy: String?
var forexId:String?
var transferAmount: String?
var autodebitSendingAmount: String?
init() {}

6
GMERemittance/Module/SendMoney/SendMoneyExchangeRate/User Interface/View/SendMoneyExchangeRateViewController.swift

@ -55,6 +55,7 @@ class SendMoneyExchangeRateViewController: UIViewController {
// MARK: Properties
var plainSendingAmount: String?
var action: ActionBehaviour? {
didSet {
@ -172,9 +173,14 @@ class SendMoneyExchangeRateViewController: UIViewController {
private func goToVerification() {
self.exchangeRateModel?.calcBy = self.calcBy
self.exchangeRateModel?.reciepientCurrency = self.selectedCurrencyViewModel?.currency ?? ""
self.exchangeRateModel?.autodebitSendingAmount = self.getPlainNumbers(number: self.senderTextField.text!)
self.actionDelegate?.calculated(model: self.exchangeRateModel)
self.actionDelegate?.continueToVerificationAction()
}
private func getPlainNumbers(number: String) -> String {
return number.stringRemovingComma()
}
func calculateExchangeRate(senderAmount: String, reciepientAmount: String, calcBy: String) {
let senderAmount = senderAmount // send sAmt amount

2
GMERemittance/Module/SendMoney/SendMoneyVerification/User Interface/View/SendMoneyVerificationViewController.swift

@ -227,7 +227,7 @@ class SendMoneyVerificationViewController: UITableViewController {
showQwertyTranskeyAction()
return
}
SendMoneyCodeWireframe().open(completion: self.otpEntered, source: self)
SendMoneyCodeWireframe().open(requestmodel: self.requestModel, completion: self.otpEntered, source: self)
}
func otpEntered(otp: String) {

11
GMERemittance/Module/SendMoneyCode/Application Logic/Interactor/SendMoneyCodeInteractor.swift

@ -14,11 +14,13 @@ class SendMoneyCodeInteractor {
weak var output: SendMoneyCodeInteractorOutput?
private let service: SendMoneyCodeServiceType
private var request: SendMoneyRequestModel?
// MARK: Initialization
init(service: SendMoneyCodeServiceType) {
init(service: SendMoneyCodeServiceType, request: SendMoneyRequestModel?) {
self.service = service
self.request = request
}
// MARK: Converting entities
@ -29,7 +31,12 @@ class SendMoneyCodeInteractor {
extension SendMoneyCodeInteractor: SendMoneyCodeInteractorInput {
func viewIsReady() {
let customerId = Utility.getMyUserName()
self.service.requestOtp(customerId: customerId, success: { (message) in
let params = [
"amount": request?.exchangeRateDetail?.autodebitSendingAmount ?? "",
"kftcId": request?.autoDebitAccount?.kftcLogId ?? "",
"userId": Utility.getMyUserName()
]
self.service.requestOtp(params: params, customerId: customerId, success: { (message) in
self.output?.show(message: message)
}) { (error) in
self.output?.show(error: error)

8
GMERemittance/Module/SendMoneyCode/Application Logic/Service/SendMoneyCodeServiceType.swift

@ -15,14 +15,14 @@ protocol SendMoneyCodeServiceType: class, OtpCodeRequestApiService {
protocol OtpCodeRequestApiService: ApiServiceType {
func requestOtp(customerId: String, success: @escaping (String) -> (), failure: @escaping (Error) -> ())
func requestOtp(params: [String: String], customerId: String, success: @escaping (String) -> (), failure: @escaping (Error) -> ())
}
extension OtpCodeRequestApiService {
func requestOtp(customerId: String, success: @escaping (String) -> (), failure: @escaping (Error) -> ()) {
let url = baseUrl + "/kftc/GetOTP/\(customerId)"
auth.request(method: .post, url: url, params: nil, encoding: JSONEncoding.default, success: { (response: SuccessMessageContainer) in
func requestOtp(params: [String: String], customerId: String, success: @escaping (String) -> (), failure: @escaping (Error) -> ()) {
let url = baseUrl + "/kftc/GetOTP"
auth.request(method: .post, url: url, params: params, encoding: JSONEncoding.default, success: { (response: SuccessMessageContainer) in
if (response.errorCode ?? "") == "1" {

6
GMERemittance/Module/SendMoneyCode/User Interface/Wireframe/SendMoneyCodeWireframe.swift

@ -11,6 +11,7 @@ import UIKit
class SendMoneyCodeWireframe {
weak var view: UIViewController!
var completion: ((String) -> ())?
var request: SendMoneyRequestModel?
}
extension SendMoneyCodeWireframe: SendMoneyCodeWireframeInput {
@ -19,7 +20,7 @@ extension SendMoneyCodeWireframe: SendMoneyCodeWireframeInput {
func getMainView() -> UIViewController {
let service = SendMoneyCodeService()
let interactor = SendMoneyCodeInteractor(service: service)
let interactor = SendMoneyCodeInteractor(service: service, request: self.request)
let presenter = SendMoneyCodePresenter()
let viewController = viewControllerFromStoryboard(of: SendMoneyCodeViewController.self)
viewController.completion = self.completion
@ -33,8 +34,9 @@ extension SendMoneyCodeWireframe: SendMoneyCodeWireframeInput {
return viewController
}
func open(completion: @escaping (String) -> (), source: UIViewController) {
func open(requestmodel: SendMoneyRequestModel?, completion: @escaping (String) -> (), source: UIViewController) {
self.completion = completion
self.request = requestmodel
self.openMainView(source: source)
}
}

2
GMERemittance/UrlManager.swift

@ -25,7 +25,7 @@ class UrlManager {
let oldUatServer = "http://gmeuat.gmeremit.com:5012/api/v1/"
let staggingServerUrl = "http://gmeuat.gmeremit.com:5022/api/"
let staggingServerUrl = "http://gmeuat.gmeremit.com:5026/api/"
let liveServerUrl = "https://mobileapi.gmeremit.com:8002/api/"
let uatServer = "http://gmeuat.gmeremit.com:5012/api/"

Loading…
Cancel
Save