Skip to content

Commit

Permalink
Fix one payment option method at return
Browse files Browse the repository at this point in the history
  • Loading branch information
oltv00 committed Oct 16, 2018
1 parent 1d1cbb7 commit 3cb8150
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,18 @@ extension TokenizationPresenter: TokenizationStrategyOutput {
moduleOutput: strongSelf)
}
}

func didFinish(on module: TokenizationStrategyInput) {
handleOnePaymentOptionMethodAtReturn()
}

func handleOnePaymentOptionMethodAtReturn() {
if paymentOptionsCount == 1 {
close()
} else {
presentPaymentMethodsModule()
}
}
}

// MARK: - TokenizationViewOutput
Expand Down Expand Up @@ -456,7 +468,7 @@ extension TokenizationPresenter: YandexAuthModuleOutput {
func didFailFetchYamoneyPaymentMethods(on module: YandexAuthModuleInput) {}

func didCancelAuthorizeInYandex(on module: YandexAuthModuleInput) {
presentPaymentMethodsModule()
handleOnePaymentOptionMethodAtReturn()
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ extension ApplePayStrategy: TokenizationStrategyInput {

func paymentAuthorizationViewControllerDidFinish(_ controller: PKPaymentAuthorizationViewController) {
if case .failed = paymentResult {
output?.presentPaymentMethodsModule()
output?.didFinish(on: self)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ protocol TokenizationStrategyOutput: class {

func presentErrorWithMessage(_ message: String)

func didFinish(on module: TokenizationStrategyInput)

// MARK: - ApplePay

func presentApplePay()
Expand Down

0 comments on commit 3cb8150

Please sign in to comment.