|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.sponsorpay.sdk.android.publisher.AbstractResponse
public abstract class AbstractResponse
Encloses a basic response received from the SponsorPay API and methods to perform parsing of the returned JSON-encoded data.
| Nested Class Summary | |
|---|---|
static class |
AbstractResponse.RequestErrorType
Types of error condition which a request / response might result in. |
| Field Summary | |
|---|---|
protected static java.lang.String |
ERROR_CODE_KEY
|
protected static java.lang.String |
ERROR_MESSAGE_KEY
|
protected java.lang.String |
mErrorCode
Error code provided by the server. |
protected java.lang.String |
mErrorMessage
Error message provided by the server. |
protected AbstractResponse.RequestErrorType |
mErrorType
Type of error condition in which the request / response has resulted. |
protected java.lang.String |
mResponseBody
Body of the HTTP response. |
protected java.lang.String |
mResponseSignature
Server-provided signature of the response. |
protected int |
mResponseStatusCode
Status code of the HTTP response. |
| Constructor Summary | |
|---|---|
AbstractResponse()
|
|
| Method Summary | |
|---|---|
java.lang.String |
getErrorCode()
Gets the error code returned by the server. |
java.lang.String |
getErrorMessage()
Gets the error message returned by the server. |
AbstractResponse.RequestErrorType |
getErrorType()
Gets the error condition in which this request / response has resulted. |
boolean |
hasErrorStatusCode()
Returns true if the response contains an HTTP status code out of the 200s. |
abstract void |
invokeOnErrorCallback()
Implement to invoke the response-type-specific on error callback notification. |
abstract void |
invokeOnSuccessCallback()
Implement to invoke the response-type-specific on success callback notification. |
void |
parseAndCallListener(java.lang.String securityToken)
Performs a second-stage error checking, parses the response and invokes the relevant method of the listener registered with #setResponseListener(SPCurrencyServerListener). |
void |
parseErrorResponse()
Parses a response containing a non-successful HTTP status code. |
abstract void |
parseSuccessfulResponse()
Implement to parse a successful-HTTP-status-code containing response. |
void |
setResponseData(int responseStatusCode,
java.lang.String responseBody,
java.lang.String responseSignature)
Sets the raw response data. |
boolean |
verifySignature(java.lang.String securityToken)
Verify calculate the signature of the response with the provided security token and compare it against the server-provided response signature. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected static final java.lang.String ERROR_CODE_KEY
protected static final java.lang.String ERROR_MESSAGE_KEY
protected int mResponseStatusCode
protected java.lang.String mResponseBody
protected java.lang.String mResponseSignature
protected AbstractResponse.RequestErrorType mErrorType
protected java.lang.String mErrorCode
protected java.lang.String mErrorMessage
| Constructor Detail |
|---|
public AbstractResponse()
| Method Detail |
|---|
public abstract void parseSuccessfulResponse()
public abstract void invokeOnSuccessCallback()
public abstract void invokeOnErrorCallback()
public void setResponseData(int responseStatusCode,
java.lang.String responseBody,
java.lang.String responseSignature)
responseStatusCode - HTTP status code returned by the server.responseBody - Body of the HTTP response.responseSignature - Signature of the response extracted from the response headers.public boolean verifySignature(java.lang.String securityToken)
securityToken - Security token which will be used to calculate the signature.
public boolean hasErrorStatusCode()
public void parseErrorResponse()
public void parseAndCallListener(java.lang.String securityToken)
#setResponseListener(SPCurrencyServerListener).
securityToken - Security token used to verify the authenticity of the response.public AbstractResponse.RequestErrorType getErrorType()
AbstractResponse.RequestErrorType.public java.lang.String getErrorCode()
public java.lang.String getErrorMessage()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||