dave08
03/24/2019, 4:50 PM@FromJson fun fromJson(json: String): PaymentResult =
when(json.getInteger("id")) {
200 -> jsonAdapter.fromJson(json)!!
403 -> PaymentResult.PaymentSuccededWithRegistrationNotCompleted
401 -> PaymentResult.CouponOrProductNotFound
402 -> PaymentResult.PaymentNotAccepted(json.getString("error"))
420 -> PaymentResult.SellerIdNotValid
else -> error("Invalid response from Odoo")
}