Last active
December 18, 2020 21:44
-
-
Save lucapiccinelli/f5e4957aeb88cf4e4f4baa012ae77bfb 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
data class BuyCryptoInfo( | |
val username: String, | |
val phoneNumber: PhoneNumber, | |
val creditCard: CreditCard, | |
val kycVerification: KycVerificationData){ | |
companion object{ | |
fun from1(user: CryptoUser): BuyCryptoInfo? = with(user){ | |
if(phoneNumber != null && creditCard != null && kycVerification != null) | |
BuyCryptoInfo(username, phoneNumber, creditCard, kycVerification) | |
else null | |
} | |
fun from2(user: CryptoUser): BuyCryptoInfo? = with(user){ | |
phoneNumber?.let { | |
creditCard?.let { | |
kycVerification?.let { | |
BuyCryptoInfo(username, phoneNumber, creditCard, kycVerification) | |
}}} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment