Skip to content
This repository was archived by the owner on Feb 19, 2019. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion GoCardlessSdk/Api/ApiClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ private static Dictionary<string, object> ToHash(object obj)
{
var client = new RestClient
{
BaseUrl = ApiUrl,
BaseUrl = new Uri(ApiUrl),
UserAgent = GoCardless.UserAgent
};
var serializer = new Newtonsoft.Json.JsonSerializer
Expand Down
15 changes: 8 additions & 7 deletions GoCardlessSdk/Connect/ConnectClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using GoCardlessSdk.Helpers;
using Newtonsoft.Json;
using RestSharp;
using RestSharp.Authenticators;

namespace GoCardlessSdk.Connect
{
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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
Expand All @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions GoCardlessSdk/Exceptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down
10 changes: 6 additions & 4 deletions GoCardlessSdk/GoCardlessSdk.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,13 @@
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="Newtonsoft.Json">
<HintPath>..\packages\Newtonsoft.Json.5.0.2\lib\net35\Newtonsoft.Json.dll</HintPath>
<Reference Include="Newtonsoft.Json, Version=9.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
<HintPath>..\..\TipsTrade Applications\packages\Newtonsoft.Json.9.0.1\lib\net35\Newtonsoft.Json.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="RestSharp">
<HintPath>..\packages\RestSharp.104.1\lib\net35\RestSharp.dll</HintPath>
<Reference Include="RestSharp, Version=105.2.3.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\TipsTrade Applications\packages\RestSharp.105.2.3\lib\net35\RestSharp.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.Configuration" />
Expand Down
6 changes: 4 additions & 2 deletions GoCardlessSdk/Partners/PartnerClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using RestSharp;
using RestSharp.Authenticators;

namespace GoCardlessSdk.Partners
{
Expand Down Expand Up @@ -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);
Expand All @@ -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,
};
}
}
Expand Down
1 change: 1 addition & 0 deletions GoCardlessSdk/WebHooks/GoCardlessRequest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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; }
Expand Down
4 changes: 2 additions & 2 deletions GoCardlessSdk/packages.config
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Newtonsoft.Json" version="5.0.2" targetFramework="net35" />
<package id="RestSharp" version="104.1" targetFramework="net35" />
<package id="Newtonsoft.Json" version="9.0.1" targetFramework="net35" />
<package id="RestSharp" version="105.2.3" targetFramework="net35" />
</packages>
1 change: 1 addition & 0 deletions Sample.Mvc3/Sample.Mvc3.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
<UpgradeBackupLocation>
</UpgradeBackupLocation>
<OldToolsVersion>4.0</OldToolsVersion>
<MvcProjectUpgradeChecked>true</MvcProjectUpgradeChecked>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
Expand Down