diff --git a/GoCardlessSdk/Api/ApiClient.cs b/GoCardlessSdk/Api/ApiClient.cs index ee25664..208d077 100644 --- a/GoCardlessSdk/Api/ApiClient.cs +++ b/GoCardlessSdk/Api/ApiClient.cs @@ -131,7 +131,7 @@ private static Dictionary ToHash(object obj) { var client = new RestClient { - BaseUrl = ApiUrl, + BaseUrl = new Uri(ApiUrl), UserAgent = GoCardless.UserAgent }; var serializer = new Newtonsoft.Json.JsonSerializer diff --git a/GoCardlessSdk/Connect/ConnectClient.cs b/GoCardlessSdk/Connect/ConnectClient.cs index 0e78394..85b0190 100644 --- a/GoCardlessSdk/Connect/ConnectClient.cs +++ b/GoCardlessSdk/Connect/ConnectClient.cs @@ -5,6 +5,7 @@ using GoCardlessSdk.Helpers; using Newtonsoft.Json; using RestSharp; +using RestSharp.Authenticators; namespace GoCardlessSdk.Connect { @@ -40,11 +41,11 @@ private static Utils.HashParams SignParams(Utils.HashParams @params) private static string GenerateNewLimitUrl(string type, object requestResource, string redirectUri = null, string cancelUri = null, string state = null) { - var hash = new Utils.HashParams - { - {"client_id", GoCardless.AccountDetails.AppId}, - {"nonce", GoCardless.GenerateNonce()}, - {"timestamp", GoCardless.GetUtcNow().IsoFormatTime()}, + var hash = new Utils.HashParams + { + {"client_id", GoCardless.AccountDetails.AppId}, + {"nonce", GoCardless.GenerateNonce()}, + {"timestamp", GoCardless.GetUtcNow().IsoFormatTime()}, }; hash = requestResource.ToHashParams(hash, type); @@ -149,7 +150,7 @@ public ConfirmResource ConfirmResource(NameValueCollection requestContent) var client = new RestClient { - BaseUrl = ApiClient.ApiUrl, + BaseUrl = new Uri(ApiClient.ApiUrl), UserAgent = GoCardless.UserAgent }; var serializer = new JsonSerializer @@ -161,7 +162,7 @@ public ConfirmResource ConfirmResource(NameValueCollection requestContent) var response = client.Execute(request); if (response.StatusCode != HttpStatusCode.OK) { - throw new ApiException("Unexpected response : " + (int)response.StatusCode + " " + response.StatusCode); + throw new ApiException("Unexpected response : " + (int)response.StatusCode + " " + response.StatusCode) { StatusCode = response.StatusCode }; } return resource; diff --git a/GoCardlessSdk/Exceptions.cs b/GoCardlessSdk/Exceptions.cs index dce919b..6e23a90 100644 --- a/GoCardlessSdk/Exceptions.cs +++ b/GoCardlessSdk/Exceptions.cs @@ -11,6 +11,8 @@ public ApiException(string message) : base(message) public JObject Content { get; set; } public string RawContent { get; set; } + + public System.Net.HttpStatusCode StatusCode { get; set; } } public class ClientException : Exception { diff --git a/GoCardlessSdk/GoCardlessSdk.csproj b/GoCardlessSdk/GoCardlessSdk.csproj index 91d446c..08a3e06 100644 --- a/GoCardlessSdk/GoCardlessSdk.csproj +++ b/GoCardlessSdk/GoCardlessSdk.csproj @@ -34,11 +34,13 @@ 4 - - ..\packages\Newtonsoft.Json.5.0.2\lib\net35\Newtonsoft.Json.dll + + ..\..\TipsTrade Applications\packages\Newtonsoft.Json.9.0.1\lib\net35\Newtonsoft.Json.dll + True - - ..\packages\RestSharp.104.1\lib\net35\RestSharp.dll + + ..\..\TipsTrade Applications\packages\RestSharp.105.2.3\lib\net35\RestSharp.dll + True diff --git a/GoCardlessSdk/Partners/PartnerClient.cs b/GoCardlessSdk/Partners/PartnerClient.cs index 103acf2..a100af7 100644 --- a/GoCardlessSdk/Partners/PartnerClient.cs +++ b/GoCardlessSdk/Partners/PartnerClient.cs @@ -3,6 +3,7 @@ using Newtonsoft.Json; using Newtonsoft.Json.Linq; using RestSharp; +using RestSharp.Authenticators; namespace GoCardlessSdk.Partners { @@ -36,7 +37,7 @@ public MerchantAccessTokenResponse ParseCreateMerchantResponse(string redirectUr var client = new RestClient { - BaseUrl = GoCardless.BaseUrl, + BaseUrl = new System.Uri( GoCardless.BaseUrl), UserAgent = GoCardless.UserAgent }; client.Authenticator = new HttpBasicAuthenticator(GoCardless.AccountDetails.AppId, GoCardless.AccountDetails.AppSecret); @@ -54,7 +55,8 @@ public MerchantAccessTokenResponse ParseCreateMerchantResponse(string redirectUr { throw new ApiException("Invalid response getting access token from " + tokenUrl) { - Content = JObject.Parse(response.Content) + Content = JObject.Parse(response.Content), + StatusCode = response.StatusCode, }; } } diff --git a/GoCardlessSdk/WebHooks/GoCardlessRequest.cs b/GoCardlessSdk/WebHooks/GoCardlessRequest.cs index cc7accd..4210c39 100644 --- a/GoCardlessSdk/WebHooks/GoCardlessRequest.cs +++ b/GoCardlessSdk/WebHooks/GoCardlessRequest.cs @@ -18,6 +18,7 @@ public class Payload public class Bill { public string Id { get; set; } + public string PayoutId { get; set; } public string Status { get; set; } public string SourceType { get; set; } public string SourceId { get; set; } diff --git a/GoCardlessSdk/packages.config b/GoCardlessSdk/packages.config index 230d023..1e88ec5 100644 --- a/GoCardlessSdk/packages.config +++ b/GoCardlessSdk/packages.config @@ -1,5 +1,5 @@  - - + + \ No newline at end of file diff --git a/Sample.Mvc3/Sample.Mvc3.csproj b/Sample.Mvc3/Sample.Mvc3.csproj index 886055b..761a0fe 100644 --- a/Sample.Mvc3/Sample.Mvc3.csproj +++ b/Sample.Mvc3/Sample.Mvc3.csproj @@ -21,6 +21,7 @@ 4.0 + true true