|
@ -24,7 +24,7 @@ enum RechargeType: Int { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
enum PaymentType: String { |
|
|
enum PaymentType: String { |
|
|
case wallet = "GME Wallet" |
|
|
|
|
|
|
|
|
case wallet = "wallet" |
|
|
case autodebit = "autodebit" |
|
|
case autodebit = "autodebit" |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
@ -90,6 +90,7 @@ class PhoneCardRechargePresenter: ViewModelType { |
|
|
private let fixedModel = BehaviorSubject<[MainCardInformation]>(value: []) |
|
|
private let fixedModel = BehaviorSubject<[MainCardInformation]>(value: []) |
|
|
private let dataOnlyModel = BehaviorSubject<[MainCardInformation]>(value: []) |
|
|
private let dataOnlyModel = BehaviorSubject<[MainCardInformation]>(value: []) |
|
|
private var accountType: String? |
|
|
private var accountType: String? |
|
|
|
|
|
private var accounts: Account? |
|
|
|
|
|
|
|
|
func transform(input: Input) -> Output { |
|
|
func transform(input: Input) -> Output { |
|
|
Driver.combineLatest(input.viewWillAppear, input.selectedMobile, input.selectedRechargeType) |
|
|
Driver.combineLatest(input.viewWillAppear, input.selectedMobile, input.selectedRechargeType) |
|
@ -110,6 +111,7 @@ class PhoneCardRechargePresenter: ViewModelType { |
|
|
.drive(onNext: { |
|
|
.drive(onNext: { |
|
|
let fintechUseNumber = $0?.fintechUseNumber ?? "" |
|
|
let fintechUseNumber = $0?.fintechUseNumber ?? "" |
|
|
let type = $0?.type ?? "autodebit" |
|
|
let type = $0?.type ?? "autodebit" |
|
|
|
|
|
self.accountType = type |
|
|
self.progressLinker.onNext(true) |
|
|
self.progressLinker.onNext(true) |
|
|
self.interactor?.fetchBalanceForPowerCall(type: type, fintechUseNumber: fintechUseNumber) |
|
|
self.interactor?.fetchBalanceForPowerCall(type: type, fintechUseNumber: fintechUseNumber) |
|
|
}).disposed(by: disposeBag) |
|
|
}).disposed(by: disposeBag) |
|
@ -167,11 +169,15 @@ class PhoneCardRechargePresenter: ViewModelType { |
|
|
input.nextTap |
|
|
input.nextTap |
|
|
.withLatestFrom(combinedInput.asDriverOnErrorJustComplete()) {$1} |
|
|
.withLatestFrom(combinedInput.asDriverOnErrorJustComplete()) {$1} |
|
|
.map { ( _, mobile, type, priceModel, _, carrierPlan, dataOnlyType) -> RechargeModel? in |
|
|
.map { ( _, mobile, type, priceModel, _, carrierPlan, dataOnlyType) -> RechargeModel? in |
|
|
|
|
|
|
|
|
switch type { |
|
|
switch type { |
|
|
|
|
|
|
|
|
case .regular: |
|
|
case .regular: |
|
|
|
|
|
|
|
|
return RechargeModel( |
|
|
return RechargeModel( |
|
|
paymentType: self.accountType ?? "", |
|
|
|
|
|
|
|
|
paymentType: self.accounts?.type ?? "", |
|
|
|
|
|
fintechUseNo: self.accounts?.fintechUseNumber ?? "", |
|
|
|
|
|
bankName: self.accounts?.bankName ?? "", |
|
|
type: type.value, |
|
|
type: type.value, |
|
|
chargeType: "", |
|
|
chargeType: "", |
|
|
cardName: "", |
|
|
cardName: "", |
|
@ -180,7 +186,9 @@ class PhoneCardRechargePresenter: ViewModelType { |
|
|
) |
|
|
) |
|
|
case .fixed: |
|
|
case .fixed: |
|
|
return RechargeModel( |
|
|
return RechargeModel( |
|
|
paymentType: self.accountType ?? "", |
|
|
|
|
|
|
|
|
paymentType: self.accounts?.type ?? "", |
|
|
|
|
|
fintechUseNo: self.accounts?.fintechUseNumber ?? "", |
|
|
|
|
|
bankName: self.accounts?.bankName ?? "", |
|
|
type: type.value, |
|
|
type: type.value, |
|
|
chargeType: carrierPlan?.cardType ?? "", |
|
|
chargeType: carrierPlan?.cardType ?? "", |
|
|
cardName: carrierPlan?.cardName ?? "", |
|
|
cardName: carrierPlan?.cardName ?? "", |
|
@ -189,7 +197,9 @@ class PhoneCardRechargePresenter: ViewModelType { |
|
|
) |
|
|
) |
|
|
case .dataOnly: |
|
|
case .dataOnly: |
|
|
return RechargeModel( |
|
|
return RechargeModel( |
|
|
paymentType: self.accountType ?? "", |
|
|
|
|
|
|
|
|
paymentType: self.accounts?.type ?? "", |
|
|
|
|
|
fintechUseNo: self.accounts?.fintechUseNumber ?? "", |
|
|
|
|
|
bankName: self.accounts?.bankName ?? "", |
|
|
type: type.value, |
|
|
type: type.value, |
|
|
chargeType: dataOnlyType?.cardCode ?? "", |
|
|
chargeType: dataOnlyType?.cardCode ?? "", |
|
|
cardName: dataOnlyType?.cardName ?? "", |
|
|
cardName: dataOnlyType?.cardName ?? "", |
|
@ -232,6 +242,7 @@ extension PhoneCardRechargePresenter: PhoneCardRechargeInteractorOutput { |
|
|
progressLinker.onNext(false) |
|
|
progressLinker.onNext(false) |
|
|
bankModel.onNext(model) |
|
|
bankModel.onNext(model) |
|
|
let selectedModel = model.first(where: {$0.type == "wallet"}) |
|
|
let selectedModel = model.first(where: {$0.type == "wallet"}) |
|
|
|
|
|
accounts = selectedModel |
|
|
selectedPaymentMode.onNext(selectedModel) |
|
|
selectedPaymentMode.onNext(selectedModel) |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|