Last active
May 10, 2017 20:50
-
-
Save ZakTaccardi/4d0b11e186e336ec497551eb8f8dd111 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.example.taccardi.zak; | |
import android.support.annotation.NonNull; | |
import io.reactivex.Observable; | |
/** | |
* Use this class to lock (prevent charges to it) or unlock (allow charges) a card. | |
*/ | |
interface CardLockRepository { | |
/** | |
* @return emits updates about a card is locked with the the specified id. | |
* This will also emit whether the card is currently locked or unlocked as its first | |
* emission upon initial subscription | |
*/ | |
Observable<LockedStatus> updates(@NonNull CardId cardId); | |
/** | |
* @return emits the errors that may occur when an attempt to lock or unlock a card fails | |
*/ | |
Observable<CardLockUpdateError> errors(@NonNull CardId cardId); | |
/** | |
* Lock or unlock a card. | |
* | |
* @param lockOrUnlock specify {@link LockedStatus#LOCKED} to lock the card, | |
* or {@link LockedStatus#NOT_LOCKED} to unlocked | |
* @see {@link #updates(CardId)} for updates when this call succeeds | |
* @see {@link #errors(CardId)} for updates when this call fails | |
*/ | |
void lockOrUnlockCard(@NonNull CardId cardId, LockedStatus lockOrUnlock); | |
} | |
/** | |
* Whether or not a card is locked, or not locked. | |
*/ | |
enum LockedStatus { | |
/** | |
* Card has been locked, and CANNOT be used for payment. | |
*/ | |
LOCKED, | |
/** | |
* Card has been unlocked, and CANT be used for payment. | |
*/ | |
NOT_LOCKED | |
} | |
/** | |
* The errors that can occur from when attempting to lock or unlock a card. | |
*/ | |
final class CardLockUpdateError { | |
//details about error | |
} | |
/** | |
* Unique identifier for a card. | |
*/ | |
final class CardId { | |
//... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment