All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.kushkipagos.android.Transaction.kt Maven / Gradle / Ivy

There is a newer version: 1.8.1
Show newest version
package com.kushkipagos.android

import org.json.JSONException
import org.json.JSONObject

class Transaction(responseBody: String) {

    var code: String
    var message: String
    var token: String = ""
    var isSuccessful: Boolean = false
    val jsonResponse: JSONObject = JSONObject(responseBody)

    init {
        try {
            code = "000"
            message = ""
            token = jsonResponse.getString("token")
            if (token != "") isSuccessful = "000" == code
            else {
                code = jsonResponse.getString("code")
                message = jsonResponse.getString("message")
            }
        } catch (jsonException: JSONException) {
            code = jsonResponse.getString("code")
            message = jsonResponse.getString("message")
        }

    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy