toPaymentMethod

Converts the data string to a PaymentMethod instance.

when (forageApiResponse) {
is ForageApiResponse.Success -> {
val paymentMethod = forageApiResponse.toPaymentMethod()
// Unpack paymentMethod.ref, paymentMethod.card, etc.
val card = paymentMethod.card
// Unpack card.last4, ...
if (card is EbtCard) {
// Unpack ebtCard.usState, ...
}
}
}

Return

A PaymentMethod instance.