Browse Source

add agreement api

pull/1/head
InKwon James Kim 5 years ago
parent
commit
43d89f7742
  1. 6
      GME Remit/APIs/Router/APIRouter.swift
  2. 12
      GME Remit/Modules/ManageAgreement/Application Logic/Interactor/ManageAgreementInteractor.swift
  3. 5
      GME Remit/Modules/ManageAgreement/Application Logic/Interactor/ManageAgreementInteractorIO.swift
  4. 9
      GME Remit/Modules/ManageAgreement/Application Logic/Service/ManageAgreementService.swift
  5. 6
      GME Remit/Modules/ManageAgreement/Application Logic/Service/ManageAgreementServiceType.swift
  6. 16
      GME Remit/Modules/ManageAgreement/User Interface/Presenter/ManageAgreementPresenter.swift
  7. 35
      GME Remit/Modules/ManageAgreement/User Interface/View/ManageAgreementViewController.swift
  8. 8
      GME Remit/Modules/RegisterModules/UserAuthentication/NewRegister/User Interface/View/NewRegister.storyboard
  9. 2
      GME Remit/Modules/RegisterModules/UserAuthentication/NewRegister/User Interface/View/NewRegisterViewController.swift

6
GME Remit/APIs/Router/APIRouter.swift

@ -82,6 +82,7 @@ enum APIRouter {
case requestPennyTestAtRegister(resend: String) case requestPennyTestAtRegister(resend: String)
case pennyTestSubmitAtRegister(accountNumber: String, certNumber: String) case pennyTestSubmitAtRegister(accountNumber: String, certNumber: String)
case fetchKFTCParameterForRegister case fetchKFTCParameterForRegister
case agreement(_ flag: Bool)
} }
// MARK: - Request // MARK: - Request
@ -450,7 +451,6 @@ extension APIRouter {
return "\(baseUrl)/mobile/sendmoney/load/branch/\(countryCode)/\(bankID)/?search=\(branchName)" return "\(baseUrl)/mobile/sendmoney/load/branch/\(countryCode)/\(bankID)/?search=\(branchName)"
case .validateAccount: case .validateAccount:
return "\(baseUrl)/mobile/sendmoney/validation/account" return "\(baseUrl)/mobile/sendmoney/validation/account"
case .domesticRemitStart: case .domesticRemitStart:
return "\(baseUrl)/kftc/DomeRemitStart" return "\(baseUrl)/kftc/DomeRemitStart"
case .getRecentHistories: case .getRecentHistories:
@ -499,6 +499,8 @@ extension APIRouter {
return "\(baseUrlWithoutVersion)/v4/GetKftcParameters/\(userID)" return "\(baseUrlWithoutVersion)/v4/GetKftcParameters/\(userID)"
case .pennyTestSubmitAtRegister: case .pennyTestSubmitAtRegister:
return "\(baseUrl)/mobile/pennytest/getcertified" return "\(baseUrl)/mobile/pennytest/getcertified"
case .agreement(_):
return ""
} }
} }
} }
@ -589,6 +591,8 @@ extension APIRouter {
return .get return .get
case .pennyTestSubmitAtRegister: case .pennyTestSubmitAtRegister:
return .post return .post
case .agreement:
return .get
} }
} }

12
GME Remit/Modules/ManageAgreement/Application Logic/Interactor/ManageAgreementInteractor.swift

@ -26,5 +26,15 @@ class ManageAgreementInteractor {
// MARK: ManageAgreement interactor input interface // MARK: ManageAgreement interactor input interface
extension ManageAgreementInteractor: ManageAgreementInteractorInput { extension ManageAgreementInteractor: ManageAgreementInteractorInput {
func agreement(_ flag: Bool) {
service.agreement(
flag,
success: {[weak self] in
self?.output?.resultAgreement()
},
failure: {[weak self] in
self?.output?.setError(with: $0)
}
)
}
} }

5
GME Remit/Modules/ManageAgreement/Application Logic/Interactor/ManageAgreementInteractorIO.swift

@ -7,9 +7,10 @@
// //
protocol ManageAgreementInteractorInput: class { protocol ManageAgreementInteractorInput: class {
func agreement(_ flag: Bool)
} }
protocol ManageAgreementInteractorOutput: class { protocol ManageAgreementInteractorOutput: class {
func resultAgreement()
func setError(with error: Error)
} }

9
GME Remit/Modules/ManageAgreement/Application Logic/Service/ManageAgreementService.swift

@ -9,5 +9,12 @@
import Foundation import Foundation
class ManageAgreementService: ManageAgreementServiceType { class ManageAgreementService: ManageAgreementServiceType {
func agreement(
_ flag: Bool,
success: @escaping () -> Void,
failure: @escaping (Error) -> Void
) {
success()
// APIRouter.agreement(flag).json(success: success, failure: failure)
}
} }

6
GME Remit/Modules/ManageAgreement/Application Logic/Service/ManageAgreementServiceType.swift

@ -7,5 +7,9 @@
// //
protocol ManageAgreementServiceType: class { protocol ManageAgreementServiceType: class {
func agreement(
_ flag: Bool,
success: @escaping () -> Void,
failure: @escaping (Error)-> Void
)
} }

16
GME Remit/Modules/ManageAgreement/User Interface/Presenter/ManageAgreementPresenter.swift

@ -13,7 +13,10 @@ class ManageAgreementPresenter: ViewModelType {
var interactor: ManageAgreementInteractorInput? var interactor: ManageAgreementInteractorInput?
var wireframe: ManageAgreementWireframeInput? var wireframe: ManageAgreementWireframeInput?
struct Input {}
struct Input {
let agreement: Observable<Bool>
let submit: Observable<Void>
}
struct Output { struct Output {
let isError: Driver<Error> let isError: Driver<Error>
@ -26,6 +29,11 @@ class ManageAgreementPresenter: ViewModelType {
private let errorLinker = PublishSubject<Error>() private let errorLinker = PublishSubject<Error>()
func transform(input: Input) -> Output { func transform(input: Input) -> Output {
input.submit.withLatestFrom(input.agreement) {$1}
.asObservable().subscribe(onNext: {[weak self] in
self?.interactor?.agreement($0)
}).disposed(by: disposeBag)
return Output( return Output(
isError: errorLinker.asDriverOnErrorJustComplete(), isError: errorLinker.asDriverOnErrorJustComplete(),
isProgress: progressLinker.asDriverOnErrorJustComplete() isProgress: progressLinker.asDriverOnErrorJustComplete()
@ -35,5 +43,11 @@ class ManageAgreementPresenter: ViewModelType {
// MARK: ManageAgreement interactor output interface // MARK: ManageAgreement interactor output interface
extension ManageAgreementPresenter: ManageAgreementInteractorOutput { extension ManageAgreementPresenter: ManageAgreementInteractorOutput {
func resultAgreement() {
wireframe?.goNewRegistration()
}
func setError(with error: Error) {
errorLinker.onNext(error)
}
} }

35
GME Remit/Modules/ManageAgreement/User Interface/View/ManageAgreementViewController.swift

@ -88,6 +88,16 @@ extension ManageAgreementViewController {
agreeButton.layer.cornerRadius = 5 agreeButton.layer.cornerRadius = 5
infoLabel.setLineSpacing(lineSpacing: 5) infoLabel.setLineSpacing(lineSpacing: 5)
navigationItem.hidesBackButton = true
let newBackButton = UIBarButtonItem(
image: UIImage(named: "backIconBlack"),
style: .plain,
target: self,
action: #selector(back(sender:))
)
navigationItem.leftBarButtonItem = newBackButton
} }
private func setUIBinding() { private func setUIBinding() {
@ -103,17 +113,22 @@ extension ManageAgreementViewController {
self?.agreeButton.isEnabled = isEnable self?.agreeButton.isEnabled = isEnable
self?.agreeButton.backgroundColor = isEnable ? .themeRed : .lightGray self?.agreeButton.backgroundColor = isEnable ? .themeRed : .lightGray
}).disposed(by: disposeBag) }).disposed(by: disposeBag)
agreeButton.rx.tap.bind {[weak self] in
guard let `self` = self else {return}
self.checkBox.isSelected = !self.checkBox.isSelected
}.disposed(by: disposeBag)
} }
private func setBinding() { private func setBinding() {
let input = ManageAgreementPresenter.Input()
let agreement = Observable.combineLatest([
checkBox.rx.isSelected,
checkBox2.rx.isSelected,
checkBox3.rx.isSelected,
checkBox4.rx.isSelected,
checkBox5.rx.isSelected,
checkBox6.rx.isSelected
]).map {$0.allSatisfy {$0}}
let input = ManageAgreementPresenter.Input(
agreement: agreement,
submit: agreeButton.rx.tap.mapToVoid()
)
let output = presenter.transform(input: input) let output = presenter.transform(input: input)
output.isError output.isError
@ -126,6 +141,10 @@ extension ManageAgreementViewController {
onNext: { $0 ? self.showProgressHud() : self.hideProgressHud() } onNext: { $0 ? self.showProgressHud() : self.hideProgressHud() }
).disposed(by: disposeBag) ).disposed(by: disposeBag)
} }
@objc func back(sender: UIBarButtonItem) {
navigationController?.popToRootViewController(animated: true)
}
} }
extension ManageAgreementViewController: CheckBoxDelegate { extension ManageAgreementViewController: CheckBoxDelegate {

8
GME Remit/Modules/RegisterModules/UserAuthentication/NewRegister/User Interface/View/NewRegister.storyboard

@ -38,7 +38,7 @@
<constraint firstAttribute="width" constant="35" id="H4w-Kt-VKU"/> <constraint firstAttribute="width" constant="35" id="H4w-Kt-VKU"/>
<constraint firstAttribute="height" constant="35" id="sa4-aQ-hFX"/> <constraint firstAttribute="height" constant="35" id="sa4-aQ-hFX"/>
</constraints> </constraints>
<fontDescription key="fontDescription" name="SanFranciscoDisplay-Medium" family="San Francisco Display" pointSize="17"/>
<fontDescription key="fontDescription" name="SanFranciscoDisplay-Medium" family="San Francisco Display" pointSize="20"/>
<state key="normal" title="1"> <state key="normal" title="1">
<color key="titleColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/> <color key="titleColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</state> </state>
@ -68,7 +68,7 @@
<button opaque="NO" tag="1" contentMode="scaleToFill" enabled="NO" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="evZ-O2-BrJ"> <button opaque="NO" tag="1" contentMode="scaleToFill" enabled="NO" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="evZ-O2-BrJ">
<rect key="frame" x="112.5" y="0.0" width="35" height="35"/> <rect key="frame" x="112.5" y="0.0" width="35" height="35"/>
<color key="backgroundColor" white="0.66666666666666663" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/> <color key="backgroundColor" white="0.66666666666666663" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<fontDescription key="fontDescription" name="SanFranciscoDisplay-Medium" family="San Francisco Display" pointSize="17"/>
<fontDescription key="fontDescription" name="SanFranciscoDisplay-Medium" family="San Francisco Display" pointSize="20"/>
<state key="normal" title="2"> <state key="normal" title="2">
<color key="titleColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/> <color key="titleColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</state> </state>
@ -98,7 +98,7 @@
<button opaque="NO" tag="2" contentMode="scaleToFill" enabled="NO" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="mK0-xl-sty"> <button opaque="NO" tag="2" contentMode="scaleToFill" enabled="NO" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="mK0-xl-sty">
<rect key="frame" x="225" y="0.0" width="35" height="35"/> <rect key="frame" x="225" y="0.0" width="35" height="35"/>
<color key="backgroundColor" white="0.66666666666666663" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/> <color key="backgroundColor" white="0.66666666666666663" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<fontDescription key="fontDescription" name="SanFranciscoDisplay-Medium" family="San Francisco Display" pointSize="17"/>
<fontDescription key="fontDescription" name="SanFranciscoDisplay-Medium" family="San Francisco Display" pointSize="20"/>
<state key="normal" title="3"> <state key="normal" title="3">
<color key="titleColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/> <color key="titleColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</state> </state>
@ -113,7 +113,7 @@
<constraint firstItem="yuy-WN-CNw" firstAttribute="width" secondItem="evZ-O2-BrJ" secondAttribute="width" id="tkM-uJ-nzQ"/> <constraint firstItem="yuy-WN-CNw" firstAttribute="width" secondItem="evZ-O2-BrJ" secondAttribute="width" id="tkM-uJ-nzQ"/>
</constraints> </constraints>
</stackView> </stackView>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Personal Information" textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="2" baselineAdjustment="alignBaselines" minimumScaleFactor="0.5" translatesAutoresizingMaskIntoConstraints="NO" id="8f2-5L-Ga0">
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Your Information" textAlignment="center" lineBreakMode="tailTruncation" numberOfLines="2" baselineAdjustment="alignBaselines" minimumScaleFactor="0.5" translatesAutoresizingMaskIntoConstraints="NO" id="8f2-5L-Ga0">
<rect key="frame" x="5" y="60" width="85" height="30"/> <rect key="frame" x="5" y="60" width="85" height="30"/>
<fontDescription key="fontDescription" name="SanFranciscoDisplay-Regular" family="San Francisco Display" pointSize="12"/> <fontDescription key="fontDescription" name="SanFranciscoDisplay-Regular" family="San Francisco Display" pointSize="12"/>
<color key="textColor" name="ThemeText"/> <color key="textColor" name="ThemeText"/>

2
GME Remit/Modules/RegisterModules/UserAuthentication/NewRegister/User Interface/View/NewRegisterViewController.swift

@ -52,7 +52,7 @@ class NewRegisterViewController: UIViewController {
override func viewWillAppear(_ animated: Bool) { override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated) super.viewWillAppear(animated)
title = "For remittance"
title = "Tell us about you for remittance"
setupNormalNavigation() setupNormalNavigation()
setupNavigationShadow(isUse: true) setupNavigationShadow(isUse: true)
navigationItem.setHidesBackButton(true, animated: true) navigationItem.setHidesBackButton(true, animated: true)

Loading…
Cancel
Save