diff --git a/.circleci/config.yml b/.circleci/config.yml index a66b80c..95db047 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -2,6 +2,7 @@ version: 2 jobs: build: + resource_class: riskified/container-agent docker: - image: mono @@ -42,6 +43,7 @@ jobs: - Riskified.SDK.*.nupkg deploy: + resource_class: riskified/container-agent docker: - image: mono steps: diff --git a/Riskified.SDK/Properties/AssemblyInfo.cs b/Riskified.SDK/Properties/AssemblyInfo.cs index 8c905cf..e6fc4e2 100644 --- a/Riskified.SDK/Properties/AssemblyInfo.cs +++ b/Riskified.SDK/Properties/AssemblyInfo.cs @@ -32,6 +32,8 @@ // by using the '*' as shown below: // [assembly: AssemblyVersion("1.0.*")] + [assembly: AssemblyVersion("3.8.0")] [assembly: AssemblyFileVersion("3.8.0")] + diff --git a/Riskified.SDK/Utils/HttpUtils.cs b/Riskified.SDK/Utils/HttpUtils.cs index e5719be..f1867d6 100644 --- a/Riskified.SDK/Utils/HttpUtils.cs +++ b/Riskified.SDK/Utils/HttpUtils.cs @@ -74,7 +74,6 @@ public static TRespObj JsonPostAndParseResponseToObject(Uri ri where TReqObj : class { var response = PostObject(riskifiedWebhookUrl, jsonObj, authToken, shopDomain); - var resObj = ParseObjectFromJsonResponse(response); return resObj; } @@ -105,22 +104,27 @@ private static HttpWebResponse PostObject(Uri riskifiedWebhookUrl, TReq if (wex.Response != null) { HttpWebResponse errorResponse = (HttpWebResponse)wex.Response; + HttpStatusCode statusCode = errorResponse.StatusCode; + + try { var errorObj = ParseObjectFromJsonResponse(errorResponse); - error = errorObj.Error.Message + " (Http Status code: " + errorResponse.StatusCode + ")"; + error = errorObj.Error.Message + " (Http Status code: " + statusCode + ")"; + } catch (Exception parseEx) { - if (errorResponse.StatusCode == HttpStatusCode.InternalServerError) + if (statusCode == HttpStatusCode.InternalServerError) error = "Server side error (500): "; - else if (errorResponse.StatusCode == HttpStatusCode.BadRequest) + else if (statusCode == HttpStatusCode.BadRequest) error = "Client side error (400): "; else - error = "Error occurred. Http status code " + errorResponse.StatusCode + ":"; + error = "Error occurred. Http status code " + statusCode + ":"; error += parseEx.Message; } + } LoggingServices.Error(error, wex); throw new RiskifiedTransactionException(error, wex); @@ -131,7 +135,6 @@ private static HttpWebResponse PostObject(Uri riskifiedWebhookUrl, TReq LoggingServices.Error(errorMsg, e); throw new RiskifiedTransactionException(errorMsg, e); } - return response; } @@ -184,8 +187,8 @@ private static T ParseObjectFromJsonResponse(WebResponse response) where T : finally { response.Close(); - } + } return JsonStringToObject(responseBody); }