You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
iceraven-browser/app/src/main/java/org/mozilla/fenix/settings/creditcards/interactor/CreditCardsManagementIntera...

48 lines
1.5 KiB
Kotlin

/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
package org.mozilla.fenix.settings.creditcards.interactor
import mozilla.components.concept.storage.CreditCard
import org.mozilla.fenix.settings.creditcards.controller.CreditCardsManagementController
/**
* Interface for the credit cards management Interactor.
*/
interface CreditCardsManagementInteractor {
/**
* Navigates to the credit card editor to edit the selected credit card. Called when a user
* taps on a credit card item.
*
* @param creditCard The selected [CreditCard] to edit.
*/
fun onSelectCreditCard(creditCard: CreditCard)
/**
* Navigates to the credit card editor to add a new credit card. Called when a user
* taps on 'Add credit card' button.
*/
fun onAddCreditCardClick()
}
/**
* The default implementation of [CreditCardsManagementInteractor].
*
* @param controller An instance of [CreditCardsManagementController] which will be delegated for
* all user interactions.
*/
class DefaultCreditCardsManagementInteractor(
private val controller: CreditCardsManagementController
) : CreditCardsManagementInteractor {
override fun onSelectCreditCard(creditCard: CreditCard) {
controller.handleCreditCardClicked(creditCard)
}
override fun onAddCreditCardClick() {
controller.handleAddCreditCardClicked()
}
}