Skip to content

Instantly share code, notes, and snippets.

@CyxouD
Created July 19, 2018 14:57
Show Gist options
  • Save CyxouD/3f42e4e50da87583b177ea8f70bd2d9d to your computer and use it in GitHub Desktop.
Save CyxouD/3f42e4e50da87583b177ea8f70bd2d9d to your computer and use it in GitHub Desktop.
Contract (interface) which declare action of Presenter and MVP View. In this case AddEditCardFragment will implement AddEditCardContract.View interface and AddEditCardPresenter will implement AddEditCardContract.Presenter interface
interface AddEditCardContract {
interface Presenter : BasePresenter {
fun getCreditCardLogo(creditCardNumber: String)
fun validateCreditCardNumber(creditCardNumber: String)
fun validateCreditCardHolder(creditCardHolder: String)
fun validateCreditCardExpiryDate(creditExpiryDate: String)
fun validateCreditCardCVV(creditCVV: String)
fun validateCreditCardTypeAndPriority(creditCardType: String, creditCardPriority: String)
fun saveCreditCard(number: String,
holderName: String,
expiryDate: String,
cvv: String,
type: CardType,
isAirplus: Boolean,
isPrimary: Boolean)
}
interface View : BaseView<Presenter> {
fun showCreditCardLogo(creditCardEnum: CreditCardEnum)
fun showNoCreditCardLogo()
fun showCreditCardNumberValidatedSuccessfully()
fun showCreditCardNumberFailedToValidate()
fun showCreditCardHolderValidatedSuccessfully()
fun showCreditCardHolderFailedToValidate()
fun showCreditCardExpiryDateValidatedSuccessfully()
fun showCreditCardExpiryDateFailedToValidate()
fun showCreditCardCvvValidatedSuccessfully()
fun showCreditCardCvvFailedToValidate()
fun showCreditCardPriorityAndTypeValidatedSuccessfully()
fun showCreditCardPriorityIsEmpty()
fun showCreditCardTypeIsEmpty()
fun showCreditCardSavedSuccessfully()
fun showCreditCardFailedToSave()
}
enum class CardType {
PERSONAL, BUSINESS
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment