Skip to content

Commit

Permalink
Merge pull request #18 in IL/yandex-checkout-payments-swift from ~TVE…
Browse files Browse the repository at this point in the history
…RDOKHLEB/yandex-checkout-payments-swift:task/b2b/fix-re-opening-one-contract to master

* commit '3cb8150c9a7ab8d5d5e3712867290dcdce4c5afa':
  Fix one payment option method at return
  • Loading branch information
oltv00 committed Oct 16, 2018
2 parents 1d1cbb7 + 3cb8150 commit a311e49
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 a311e49

Please sign in to comment.