``` @FromJson fun fromJson(json: String): PaymentR...
# squarelibraries
d
Copy code
@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")
		}