Browse Source

link UI

pull/1/head
InKwon James Kim 5 years ago
parent
commit
03babc26df
  1. 76
      GME Remit/APIs/Router/APIRouter.swift
  2. BIN
      GME Remit/Modules/.DS_Store
  3. 99
      GME Remit/Modules/PowerCallModules/PhoneCardRecharge/User Interface/View/PhoneCardRecharge.storyboard
  4. 73
      GME Remit/Modules/PowerCallModules/PhoneCardRecharge/User Interface/View/PhoneCardRechargeViewController.swift
  5. 9
      GME Remit/Modules/PowerCallModules/PhoneCardRecharge/User Interface/View/ViewModel/PhoneCardRechargeViewModel.swift
  6. 32
      GME RemitTests/APITest.swift

76
GME Remit/APIs/Router/APIRouter.swift

@ -11,19 +11,21 @@ import Alamofire
import Localize_Swift
import ObjectMapper
import RxSwift
enum APIRouter {
// MARK: - Login
// MARK: - Login
case accesscode(username: String, password: String)
case customerProfile(firebaseToken: String)
// MARK: - Register
// MARK: - Register
case customerRegister(registerModel: RegisterRequestModel, firebaseToken: String)
case passwordReset(userName: String)
case validation(userName: String, idNumber: String, idType: String)
case countriesServices
case calculateDefExRate(model: ExchangeRateRequestModel)
// MARK: - KFTC
// MARK: - KFTC
case getKFTCParamers(username: String)
case deleteAutoDebitAccount(username: String, kftcLogID: String)
case renewalToken(username: String)
@ -36,7 +38,7 @@ enum APIRouter {
case fetchRecipientName(bankCode: String, accountNumber: String)
case sendDomesticRemit(model: DomesticRemitRequestModel)
// MARK: - Receiver
// MARK: - Receiver
case fetchRecipients(senderID: String)
case dynamicReceiver(username: String, countryID: String, serviceTypeID: String)
case fetchCountriesAndServiceTypes(username: String)
@ -101,7 +103,7 @@ extension APIRouter: ApiServiceType {
needsAuthorization: Bool = true,
success: @escaping () -> Void,
failure: @escaping (Error) -> Void
) {
) {
guard
let isReachable = NetworkReachabilityManager()?.isReachable,
isReachable else {
@ -119,17 +121,16 @@ extension APIRouter: ApiServiceType {
parameters: self.parameters,
encoding: encoding,
headers: needsAuthorization ? afterLoginHeader : beforeLoginHeader
)
.handle(
success: { (response: ResponseContainer<Void>) in
if (response.errorCode ?? "") == "1" {
let error = NSError(domain: "Network", code: 0, message: response.message ?? "")
failure(error)
} else {
success()
}
},
failure: failure
).handle(
success: { (response: ResponseContainer<Void>) in
if (response.errorCode ?? "") == "1" {
let error = NSError(domain: "Network", code: 0, message: response.message ?? "")
failure(error)
} else {
success()
}
},
failure: failure
)
}
@ -138,7 +139,7 @@ extension APIRouter: ApiServiceType {
needsAuthorization: Bool = true,
success: @escaping (Element) -> Void,
failure: @escaping (Error) -> Void
) {
) {
guard
let isReachable = NetworkReachabilityManager()?.isReachable,
isReachable else {
@ -156,22 +157,21 @@ extension APIRouter: ApiServiceType {
parameters: self.parameters,
encoding: encoding,
headers: needsAuthorization ? afterLoginHeader : beforeLoginHeader
)
.handle(
success: { (response: ResponseContainer<Element>) in
if (response.errorCode ?? "") == "1" {
let error = NSError(domain: "Network", code: 0, message: response.message ?? "")
).handle(
success: { (response: ResponseContainer<Element>) in
if (response.errorCode ?? "") == "1" {
let error = NSError(domain: "Network", code: 0, message: response.message ?? "")
failure(error)
} else {
guard let data = response.data else {
let error = NSError(domain: "Network", code: 0, message: "Data is nil")
failure(error)
} else {
guard let data = response.data else {
let error = NSError(domain: "Network", code: 0, message: "Data is nil")
failure(error)
return
}
success(data)
return
}
},
failure: failure
success(data)
}
},
failure: failure
)
}
@ -198,7 +198,7 @@ extension APIRouter: ApiServiceType {
parameters: self.parameters,
encoding: encoding,
headers: needsAuthorization ? afterLoginHeader : beforeLoginHeader
)
)
.handle(
success: { (response: ResponseContainerObject<Element>) in
if (response.errorCode ?? "") == "1" {
@ -240,7 +240,7 @@ extension APIRouter: ApiServiceType {
parameters: self.parameters,
encoding: encoding,
headers: needsAuthorization ? afterLoginHeader : beforeLoginHeader
)
)
.handle(
success: { (response: ResponseContainerArray<Element>) in
if (response.errorCode ?? "") == "1" {
@ -274,7 +274,7 @@ extension APIRouter: ApiServiceType {
message: "No Internet connection found. Check your connection."
)
return failure(error)
}
}
manager.request(
self.endpoint,
@ -300,7 +300,7 @@ extension APIRouter: ApiServiceType {
message: "No Internet connection found. Check your connection."
)
return failure(error)
}
}
manager.request(
self.endpoint,
@ -351,11 +351,11 @@ extension APIRouter: ApiServiceType {
params.value.data(
using: String.Encoding.utf8,
allowLossyConversion: false
)!,
)!,
withName: params.key
)
}
},
},
to: URLString,
method: method,
headers: needsAuthorization ? afterLoginHeader : beforeLoginHeader,
@ -371,7 +371,7 @@ extension APIRouter: ApiServiceType {
)
failure(error)
}
}
}
)
}
}

BIN
GME Remit/Modules/.DS_Store

99
GME Remit/Modules/PowerCallModules/PhoneCardRecharge/User Interface/View/PhoneCardRecharge.storyboard

@ -29,7 +29,7 @@
<rect key="frame" x="0.0" y="44" width="375" height="866"/>
<subviews>
<view contentMode="scaleToFill" placeholderIntrinsicWidth="375" placeholderIntrinsicHeight="956" translatesAutoresizingMaskIntoConstraints="NO" id="bLc-vG-GQk">
<rect key="frame" x="0.0" y="0.0" width="375" height="1156"/>
<rect key="frame" x="0.0" y="0.0" width="375" height="1376"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="JUk-Ex-adc">
<rect key="frame" x="0.0" y="0.0" width="375" height="126"/>
@ -56,7 +56,7 @@
<rect key="frame" x="305" y="0.0" width="50" height="50"/>
<subviews>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="f16-ev-BiQ">
<rect key="frame" x="5" y="5" width="40" height="40"/>
<rect key="frame" x="10" y="10" width="30" height="30"/>
<constraints>
<constraint firstAttribute="width" secondItem="f16-ev-BiQ" secondAttribute="height" multiplier="1:1" id="kfz-P6-H7h"/>
</constraints>
@ -66,10 +66,10 @@
</subviews>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<constraints>
<constraint firstItem="f16-ev-BiQ" firstAttribute="leading" secondItem="UlE-zC-uwt" secondAttribute="leading" constant="5" id="6iy-Wx-QF4"/>
<constraint firstAttribute="trailing" secondItem="f16-ev-BiQ" secondAttribute="trailing" constant="5" id="LLi-oV-ERz"/>
<constraint firstAttribute="bottom" secondItem="f16-ev-BiQ" secondAttribute="bottom" constant="5" id="O60-Ug-9V8"/>
<constraint firstItem="f16-ev-BiQ" firstAttribute="top" secondItem="UlE-zC-uwt" secondAttribute="top" constant="5" id="X8x-WC-kRT"/>
<constraint firstItem="f16-ev-BiQ" firstAttribute="leading" secondItem="UlE-zC-uwt" secondAttribute="leading" constant="10" id="6iy-Wx-QF4"/>
<constraint firstAttribute="trailing" secondItem="f16-ev-BiQ" secondAttribute="trailing" constant="10" id="LLi-oV-ERz"/>
<constraint firstAttribute="bottom" secondItem="f16-ev-BiQ" secondAttribute="bottom" constant="10" id="O60-Ug-9V8"/>
<constraint firstItem="f16-ev-BiQ" firstAttribute="top" secondItem="UlE-zC-uwt" secondAttribute="top" constant="10" id="X8x-WC-kRT"/>
</constraints>
</view>
</subviews>
@ -87,19 +87,19 @@
<rect key="frame" x="0.0" y="75.5" width="355" height="20.5"/>
<subviews>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="My Cash" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="3sX-PN-Zns">
<rect key="frame" x="0.0" y="0.0" width="61" height="20.5"/>
<rect key="frame" x="0.0" y="0.0" width="67.5" height="20.5"/>
<fontDescription key="fontDescription" name="SanFranciscoDisplay-Regular" family="San Francisco Display" pointSize="17"/>
<color key="textColor" name="ThemeText"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" verticalHuggingPriority="251" text="₩" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="nhP-WU-Prr">
<rect key="frame" x="61" y="0.0" width="253" height="20.5"/>
<rect key="frame" x="67.5" y="0.0" width="244.5" height="20.5"/>
<fontDescription key="fontDescription" name="SanFranciscoDisplay-Regular" family="San Francisco Display" pointSize="17"/>
<color key="textColor" name="ThemeText"/>
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="252" verticalHuggingPriority="251" text="2,000" textAlignment="right" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="ao5-ep-Uh6">
<rect key="frame" x="314" y="0.0" width="41" height="20.5"/>
<rect key="frame" x="312" y="0.0" width="43" height="20.5"/>
<fontDescription key="fontDescription" name="SanFranciscoDisplay-Regular" family="San Francisco Display" pointSize="17"/>
<color key="textColor" name="ThemeText"/>
<nil key="highlightedColor"/>
@ -142,10 +142,10 @@
</constraints>
</view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="3x2-QU-b5r">
<rect key="frame" x="0.0" y="206" width="375" height="950"/>
<rect key="frame" x="0.0" y="206" width="375" height="1170"/>
<subviews>
<stackView opaque="NO" contentMode="scaleToFill" axis="vertical" translatesAutoresizingMaskIntoConstraints="NO" id="rcN-b3-Pc0">
<rect key="frame" x="10" y="0.0" width="355" height="950"/>
<rect key="frame" x="10" y="0.0" width="355" height="1170"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="CmC-Q1-ZRq">
<rect key="frame" x="0.0" y="0.0" width="355" height="80"/>
@ -167,51 +167,69 @@
<state key="normal" title="₩ 10,000">
<color key="titleColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</state>
<connections>
<action selector="touchAmountButton:" destination="HSb-ou-7T5" eventType="touchUpInside" id="U8e-tv-wKp"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="nN1-tj-eIz">
<button opaque="NO" tag="1" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="nN1-tj-eIz">
<rect key="frame" x="118.5" y="0.0" width="108" height="30"/>
<color key="backgroundColor" name="ThemeRed"/>
<fontDescription key="fontDescription" name="SanFranciscoDisplay-Regular" family="San Francisco Display" pointSize="17"/>
<state key="normal" title="₩ 20,000">
<color key="titleColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</state>
<connections>
<action selector="touchAmountButton:" destination="HSb-ou-7T5" eventType="touchUpInside" id="gb8-cj-ypm"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="4iN-hh-fc8">
<button opaque="NO" tag="2" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="4iN-hh-fc8">
<rect key="frame" x="236.5" y="0.0" width="108.5" height="30"/>
<color key="backgroundColor" name="ThemeRed"/>
<fontDescription key="fontDescription" name="SanFranciscoDisplay-Regular" family="San Francisco Display" pointSize="17"/>
<state key="normal" title="₩ 30,000">
<color key="titleColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</state>
<connections>
<action selector="touchAmountButton:" destination="HSb-ou-7T5" eventType="touchUpInside" id="xUH-OS-vSo"/>
</connections>
</button>
</subviews>
</stackView>
<stackView opaque="NO" contentMode="scaleToFill" distribution="fillEqually" spacing="10" translatesAutoresizingMaskIntoConstraints="NO" id="LgA-9x-Nqk">
<rect key="frame" x="0.0" y="40" width="345" height="30"/>
<subviews>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="eMU-67-9FG">
<button opaque="NO" tag="3" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="eMU-67-9FG">
<rect key="frame" x="0.0" y="0.0" width="108.5" height="30"/>
<color key="backgroundColor" name="ThemeRed"/>
<fontDescription key="fontDescription" name="SanFranciscoDisplay-Regular" family="San Francisco Display" pointSize="17"/>
<state key="normal" title="₩ 40,000">
<color key="titleColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</state>
<connections>
<action selector="touchAmountButton:" destination="HSb-ou-7T5" eventType="touchUpInside" id="S6y-Z8-agi"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="YN1-ij-fqB">
<button opaque="NO" tag="4" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="YN1-ij-fqB">
<rect key="frame" x="118.5" y="0.0" width="108" height="30"/>
<color key="backgroundColor" name="ThemeRed"/>
<fontDescription key="fontDescription" name="SanFranciscoDisplay-Regular" family="San Francisco Display" pointSize="17"/>
<state key="normal" title="₩ 50,000">
<color key="titleColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</state>
<connections>
<action selector="touchAmountButton:" destination="HSb-ou-7T5" eventType="touchUpInside" id="a0J-rz-RbZ"/>
</connections>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="0NT-dR-BSe">
<button opaque="NO" tag="5" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" buttonType="roundedRect" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="0NT-dR-BSe">
<rect key="frame" x="236.5" y="0.0" width="108.5" height="30"/>
<color key="backgroundColor" name="ThemeRed"/>
<fontDescription key="fontDescription" name="SanFranciscoDisplay-Regular" family="San Francisco Display" pointSize="17"/>
<state key="normal" title="₩ 60,000">
<color key="titleColor" white="1" alpha="1" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
</state>
<connections>
<action selector="touchAmountButton:" destination="HSb-ou-7T5" eventType="touchUpInside" id="fTo-gr-XTc"/>
</connections>
</button>
</subviews>
</stackView>
@ -236,7 +254,7 @@
<rect key="frame" x="0.0" y="0.0" width="345" height="50"/>
<subviews>
<textField opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" text="7 Mobile" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="O2g-I1-ksu" customClass="ValidationTextField" customModule="GME_Remit" customModuleProvider="target">
<rect key="frame" x="0.0" y="14" width="295" height="22"/>
<rect key="frame" x="0.0" y="14.5" width="295" height="21.5"/>
<color key="textColor" name="ThemeText"/>
<fontDescription key="fontDescription" name="SanFranciscoDisplay-Regular" family="San Francisco Display" pointSize="17"/>
<textInputTraits key="textInputTraits"/>
@ -266,7 +284,7 @@
<rect key="frame" x="0.0" y="60" width="345" height="50"/>
<subviews>
<textField opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="left" contentVerticalAlignment="center" text="band Data 1.5G (38,000)" textAlignment="natural" minimumFontSize="17" translatesAutoresizingMaskIntoConstraints="NO" id="12I-NP-LBC" customClass="ValidationTextField" customModule="GME_Remit" customModuleProvider="target">
<rect key="frame" x="0.0" y="14" width="295" height="22"/>
<rect key="frame" x="0.0" y="14.5" width="295" height="21.5"/>
<color key="textColor" name="ThemeText"/>
<fontDescription key="fontDescription" name="SanFranciscoDisplay-Regular" family="San Francisco Display" pointSize="17"/>
<textInputTraits key="textInputTraits"/>
@ -301,10 +319,10 @@
</constraints>
</view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="Tcd-5I-gDG">
<rect key="frame" x="0.0" y="200" width="355" height="750"/>
<rect key="frame" x="0.0" y="200" width="355" height="300"/>
<subviews>
<tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" rowHeight="-1" estimatedRowHeight="-1" sectionHeaderHeight="28" sectionFooterHeight="28" translatesAutoresizingMaskIntoConstraints="NO" id="j5d-Ms-jH7">
<rect key="frame" x="0.0" y="0.0" width="355" height="750"/>
<rect key="frame" x="0.0" y="0.0" width="355" height="300"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="custom" customColorSpace="genericGamma22GrayColorSpace"/>
<color key="separatorColor" name="ThemeSeparate"/>
<prototypes>
@ -359,10 +377,17 @@
<constraints>
<constraint firstItem="j5d-Ms-jH7" firstAttribute="top" secondItem="Tcd-5I-gDG" secondAttribute="top" id="9K0-j2-TUx"/>
<constraint firstAttribute="trailing" secondItem="j5d-Ms-jH7" secondAttribute="trailing" id="9eN-fm-Hcy"/>
<constraint firstAttribute="height" relation="greaterThanOrEqual" constant="300" id="Ecr-aI-jL5"/>
<constraint firstAttribute="bottom" secondItem="j5d-Ms-jH7" secondAttribute="bottom" id="IQY-76-NeN"/>
<constraint firstItem="j5d-Ms-jH7" firstAttribute="leading" secondItem="Tcd-5I-gDG" secondAttribute="leading" id="Ilu-XI-OZr"/>
</constraints>
</view>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="100" text="" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="euR-3e-5qe">
<rect key="frame" x="0.0" y="500" width="355" height="670"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<nil key="textColor"/>
<nil key="highlightedColor"/>
</label>
</subviews>
</stackView>
</subviews>
@ -412,21 +437,41 @@
</subviews>
<color key="backgroundColor" name="ThemeMainBackground"/>
<constraints>
<constraint firstItem="TJE-ol-Hx6" firstAttribute="top" secondItem="HAO-OX-Hu1" secondAttribute="bottom" constant="20" id="G44-Nv-98V"/>
<constraint firstItem="TJE-ol-Hx6" firstAttribute="leading" secondItem="O1T-1R-Sun" secondAttribute="leading" constant="10" id="PGA-uY-y5K"/>
<constraint firstItem="O1T-1R-Sun" firstAttribute="trailing" secondItem="TJE-ol-Hx6" secondAttribute="trailing" constant="10" id="RMX-u9-1H7"/>
<constraint firstItem="HAO-OX-Hu1" firstAttribute="top" secondItem="O1T-1R-Sun" secondAttribute="top" id="jLt-96-gsu"/>
<constraint firstItem="TJE-ol-Hx6" firstAttribute="bottom" secondItem="O1T-1R-Sun" secondAttribute="bottom" constant="-20" id="roR-Ck-dP5"/>
<constraint firstItem="HAO-OX-Hu1" firstAttribute="leading" secondItem="O1T-1R-Sun" secondAttribute="leading" id="xLV-X6-bkw"/>
<constraint firstItem="HAO-OX-Hu1" firstAttribute="trailing" secondItem="O1T-1R-Sun" secondAttribute="trailing" id="zPT-MP-gTt"/>
<constraint firstItem="TJE-ol-Hx6" firstAttribute="top" secondItem="HAO-OX-Hu1" secondAttribute="bottom" constant="20" id="9jr-Lo-Yzw"/>
<constraint firstItem="HAO-OX-Hu1" firstAttribute="leading" secondItem="O1T-1R-Sun" secondAttribute="leading" id="BQ8-IF-P85"/>
<constraint firstItem="HAO-OX-Hu1" firstAttribute="top" secondItem="O1T-1R-Sun" secondAttribute="top" id="fAH-AL-wb7"/>
<constraint firstItem="TJE-ol-Hx6" firstAttribute="leading" secondItem="O1T-1R-Sun" secondAttribute="leading" constant="10" id="lGO-pe-H2H"/>
<constraint firstItem="O1T-1R-Sun" firstAttribute="trailing" secondItem="HAO-OX-Hu1" secondAttribute="trailing" id="qkz-Ja-EYD"/>
<constraint firstItem="O1T-1R-Sun" firstAttribute="trailing" secondItem="TJE-ol-Hx6" secondAttribute="trailing" constant="10" id="rdQ-fx-Eym"/>
<constraint firstItem="O1T-1R-Sun" firstAttribute="bottom" secondItem="TJE-ol-Hx6" secondAttribute="bottom" constant="20" id="vo2-2C-yMF"/>
</constraints>
<viewLayoutGuide key="safeArea" id="O1T-1R-Sun"/>
</view>
<navigationItem key="navigationItem" title="Prepaid Phone Card Recharge" id="3H9-66-Lec"/>
<size key="freeformSize" width="375" height="1000"/>
<connections>
<outlet property="amountButton1" destination="uxJ-Fa-1i9" id="zwT-7e-KKv"/>
<outlet property="amountButton2" destination="nN1-tj-eIz" id="R3U-lV-BO5"/>
<outlet property="amountButton3" destination="4iN-hh-fc8" id="qfd-t0-1wS"/>
<outlet property="amountButton4" destination="eMU-67-9FG" id="JHu-tK-gO3"/>
<outlet property="amountButton5" destination="YN1-ij-fqB" id="qoy-GK-c20"/>
<outlet property="amountButton6" destination="0NT-dR-BSe" id="I0s-Vf-Qkw"/>
<outlet property="carrierPlanDropDownImage" destination="Lwy-bY-DFd" id="mPF-Fi-Hja"/>
<outlet property="carrierPlanTextField" destination="12I-NP-LBC" id="ik6-hV-eZ0"/>
<outlet property="carrierTypeDropDownImage" destination="WTp-OG-aoY" id="jFV-pT-ynU"/>
<outlet property="carrierTypeTextField" destination="O2g-I1-ksu" id="ayr-JH-N5h"/>
<outlet property="contactButton" destination="f16-ev-BiQ" id="5EN-7E-38p"/>
<outlet property="dataOnlyContainerView" destination="Tcd-5I-gDG" id="SOV-6N-xyA"/>
<outlet property="dataOnlyTableView" destination="j5d-Ms-jH7" id="uXJ-ar-GcA"/>
<outlet property="fixedChargeContainerView" destination="irB-sa-xqC" id="R07-eK-uNN"/>
<outlet property="mainContainerView" destination="3x2-QU-b5r" id="J1j-8a-Kgh"/>
<outlet property="mobileTextField" destination="ekR-3Q-LvL" id="JVx-jg-5E2"/>
<outlet property="mycashAmountLabel" destination="ao5-ep-Uh6" id="sr1-kN-VVf"/>
<outlet property="mycashLabel" destination="3sX-PN-Zns" id="HIt-QI-r9u"/>
<outlet property="nextButton" destination="TJE-ol-Hx6" id="a16-oT-5De"/>
<outlet property="regularTypeButtonsStackView" destination="2jz-Oc-Za2" id="kM8-r5-a61"/>
<outlet property="regularTypeContainerView" destination="CmC-Q1-ZRq" id="JQg-XT-9YC"/>
<outlet property="typeSegment" destination="Xt5-tG-WPd" id="bk5-Gb-IQW"/>
</connections>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="8je-5K-XuW" userLabel="First Responder" sceneMemberID="firstResponder"/>

73
GME Remit/Modules/PowerCallModules/PhoneCardRecharge/User Interface/View/PhoneCardRechargeViewController.swift

@ -16,11 +16,40 @@ class PhoneCardRechargeViewController: UIViewController {
var viewModel: PhoneCardRechargeViewModel!
private let disposeBag = DisposeBag()
private let selectedAmountButton = BehaviorSubject<Int>(value: 0)
// MARK: Computed Properties
// MARK: IBOutlets
@IBOutlet weak var mobileTextField: ValidationTextField!
@IBOutlet weak var contactButton: UIButton!
@IBOutlet private weak var mobileTextField: ValidationTextField!
@IBOutlet private weak var contactButton: UIButton!
@IBOutlet private weak var mycashLabel: UILabel!
@IBOutlet private weak var mycashAmountLabel: UILabel!
@IBOutlet private weak var typeSegment: UISegmentedControl!
@IBOutlet private weak var mainContainerView: UIView!
// Regular Type
@IBOutlet private weak var regularTypeContainerView: UIView!
@IBOutlet private weak var regularTypeButtonsStackView: UIStackView!
@IBOutlet private weak var amountButton1: UIButton!
@IBOutlet private weak var amountButton2: UIButton!
@IBOutlet private weak var amountButton3: UIButton!
@IBOutlet private weak var amountButton4: UIButton!
@IBOutlet private weak var amountButton5: UIButton!
@IBOutlet private weak var amountButton6: UIButton!
// Monthly Fixed Charge Type
@IBOutlet private weak var fixedChargeContainerView: UIView!
@IBOutlet private weak var carrierTypeTextField: ValidationTextField!
@IBOutlet private weak var carrierTypeDropDownImage: UIImageView!
@IBOutlet private weak var carrierPlanTextField: ValidationTextField!
@IBOutlet private weak var carrierPlanDropDownImage: UIImageView!
// Data Only
@IBOutlet private weak var dataOnlyContainerView: UIView!
@IBOutlet private weak var dataOnlyTableView: UITableView!
@IBOutlet private weak var nextButton: UIButton!
// MARK: VC's Life cycle
override func viewDidLoad() {
@ -29,7 +58,9 @@ class PhoneCardRechargeViewController: UIViewController {
}
// MARK: IBActions
@IBAction func touchAmountButton(_ sender: UIButton) {
selectedAmountButton.onNext(sender.tag)
}
}
// MARK: Other Functions
@ -39,8 +70,18 @@ extension PhoneCardRechargeViewController {
setBinding()
}
@objc private func selectType(sender: UISegmentedControl) {
// switch sender.selectedSegmentIndex
}
private func setBinding() {
let input = PhoneCardRechargeViewModel.Input()
let input = PhoneCardRechargeViewModel.Input(
contactOpenTrigger: contactButton.rx.tap.asDriver(),
amountButtons: selectedAmountButton.asDriverOnErrorJustComplete(),
selectType: typeSegment.rx.selectedSegmentIndex.asDriverOnErrorJustComplete(),
carrierTypeDropDownTrigger: carrierTypeTextField.rx.controlEvent(.editingDidBegin).asDriver(),
carrierPlanDrowDownTrigger: carrierPlanTextField.rx.controlEvent(.editingDidBegin).asDriver()
)
let output = viewModel.transform(input: input)
output.isError
@ -52,5 +93,29 @@ extension PhoneCardRechargeViewController {
.drive(
onNext: { $0 ? self.showProgressHud() : self.hideProgressHud() }
).disposed(by: disposeBag)
typeSegment.rx.selectedSegmentIndex
.bind {
switch $0 {
case 0:
self.regularTypeContainerView.isHidden = false
self.fixedChargeContainerView.isHidden = true
self.dataOnlyContainerView.isHidden = true
case 1:
self.regularTypeContainerView.isHidden = true
self.fixedChargeContainerView.isHidden = false
self.dataOnlyContainerView.isHidden = true
case 2:
self.regularTypeContainerView.isHidden = true
self.fixedChargeContainerView.isHidden = true
self.dataOnlyContainerView.isHidden = false
default:
self.regularTypeContainerView.isHidden = false
self.fixedChargeContainerView.isHidden = true
self.dataOnlyContainerView.isHidden = true
}
}
.disposed(by: disposeBag)
}
}

9
GME Remit/Modules/PowerCallModules/PhoneCardRecharge/User Interface/View/ViewModel/PhoneCardRechargeViewModel.swift

@ -12,7 +12,14 @@ import RxCocoa
class PhoneCardRechargeViewModel: ViewModelType {
var presenter: PhoneCardRechargeModuleInterface?
struct Input {}
struct Input {
let contactOpenTrigger: Driver<Void>
let amountButtons: Driver<Int>
let selectType: Driver<Int>
let carrierTypeDropDownTrigger: Driver<Void>
let carrierPlanDrowDownTrigger: Driver<Void>
}
struct Output {
let isError: Driver<Error>
let isProgress: Driver<Bool>

32
GME RemitTests/APITest.swift

@ -249,11 +249,11 @@ class APITest: XCTestCase {
success: {
print($0)
expt.fulfill()
},
},
failure: {
expt.fulfill()
XCTAssert(false, $0.localizedDescription)
}
}
)
wait(for: [expt], timeout: 5.0)
}
@ -268,11 +268,11 @@ class APITest: XCTestCase {
success: {
print($0)
expt.fulfill()
},
},
failure: {
expt.fulfill()
XCTAssert(false, $0.localizedDescription)
}
}
)
wait(for: [expt], timeout: 5.0)
}
@ -287,12 +287,32 @@ class APITest: XCTestCase {
success: {
print($0)
expt.fulfill()
},
},
failure: {
expt.fulfill()
XCTAssert(false, $0.localizedDescription)
}
}
)
wait(for: [expt], timeout: 5.0)
}
func testObservableAPI() {
let expt = expectation(description: "testObservableAPI")
_ = APIRouter
.accesscode(username: DebugManager.shared.testAccountID, password: DebugManager.shared.testAccountPW)
.json(needsAuthorization: false)
.debug()
.subscribe(
onNext: { (response: User) in
XCTAssert(response.accessCode != nil)
expt.fulfill()
},
onError: {
print($0)
XCTAssert(false, $0.localizedDescription)
expt.fulfill()
})
wait(for: [expt], timeout: 5.0)
}
}
Loading…
Cancel
Save