Skip to content

Commit

Permalink
fixing markeplateAccessToken function
Browse files Browse the repository at this point in the history
  • Loading branch information
joelibaceta committed Nov 16, 2018
1 parent 4b348e8 commit 2ef3900
Showing 1 changed file with 18 additions and 5 deletions.
23 changes: 18 additions & 5 deletions px-dotnet/Core/MPBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,9 @@ protected static List<T> FillArrayWithResponseData<T>(Type clazz, MPAPIResponse
for (int i = 0; i < jsonArray.Count(); i++)
{
T resource = (T)MPCoreUtils.GetResourceFromJson<T>(clazz, (JObject)jsonArray[i]);

resource.DumpLog();

resource._lastKnownJson = MPCoreUtils.GetJsonFromResource(resource);
resourceArray.Add(resource);
}
Expand Down Expand Up @@ -601,8 +604,9 @@ public static string ParsePath<T>(string path, Dictionary<string, string> mapPar
bool search = !path.Contains(':') && mapParams != null && mapParams.Any();

string param_pattern = @":([a-z0-9_]+)";
MatchCollection matches = Regex.Matches(path, param_pattern);

MatchCollection matches = Regex.Matches(path, param_pattern);



foreach (Match param in matches)
{
Expand All @@ -626,7 +630,9 @@ public static string ParsePath<T>(string path, Dictionary<string, string> mapPar
path = path.Replace(param.Value, resource_value.ToString());
}
}





// URL
result.Insert(0, SDK.BaseUrl);
Expand All @@ -636,11 +642,18 @@ public static string ParsePath<T>(string path, Dictionary<string, string> mapPar
string accessToken;

// Access Token
if (string.IsNullOrEmpty(resource.MarketplaceAccessToken)) {
if (resource == null){
accessToken = SDK.GetAccessToken();
} else {
accessToken = resource.MarketplaceAccessToken;
if (string.IsNullOrEmpty(resource.MarketplaceAccessToken))
{
accessToken = SDK.GetAccessToken();
} else {
accessToken = resource.MarketplaceAccessToken;
}
}

Console.Out.WriteLine("STOP");


if (!string.IsNullOrEmpty(accessToken))
Expand Down

0 comments on commit 2ef3900

Please sign in to comment.