Merge pull request #13 in MM/mpin-sdk-core from feature/bad_user_agent to master
* commit 'e6825711ab78d6220cccf5eaff92c016caf15b8a':
Add BAD_USER_AGENT sdk status code
diff --git a/src/mpin_sdk.cpp b/src/mpin_sdk.cpp
index 5cfe7a4..d438156 100644
--- a/src/mpin_sdk.cpp
+++ b/src/mpin_sdk.cpp
@@ -401,7 +401,14 @@
}
else if(httpStatus >= 400)
{
- m_mpinStatus.SetStatusCode(Status::HTTP_REQUEST_ERROR);
+ if (httpStatus == HTTP_NOT_ACCEPTABLE)
+ {
+ m_mpinStatus.SetStatusCode(Status::BAD_USER_AGENT);
+ }
+ else
+ {
+ m_mpinStatus.SetStatusCode(Status::HTTP_REQUEST_ERROR);
+ }
}
else if(httpStatus >= 300)
{
diff --git a/src/mpin_sdk.h b/src/mpin_sdk.h
index fdaa2ba..37aa636 100644
--- a/src/mpin_sdk.h
+++ b/src/mpin_sdk.h
@@ -127,6 +127,7 @@
INCORRECT_ACCESS_NUMBER, // Remote/local error - wrong access number (checksum failed or RPS returned 412)
HTTP_SERVER_ERROR, // Remote error, that was not reduced to one of the above - the remote server returned internal server error status (5xx)
HTTP_REQUEST_ERROR, // Remote error, that was not reduced to one of the above - invalid data sent to server, the remote server returned 4xx error status
+ BAD_USER_AGENT, // Remote error - user agent not supported
};
Status();
@@ -282,6 +283,7 @@
static const int HTTP_BAD_REQUEST = 400;
static const int HTTP_UNAUTHORIZED = 401;
static const int HTTP_FORBIDDEN = 403;
+ static const int HTTP_NOT_ACCEPTABLE = 406;
static const int HTTP_REQUEST_TIMEOUT = 408;
static const int HTTP_GONE = 410;
static const int HTTP_PRECONDITION_FAILED = 412;