penneo / sdk-net Goto Github PK
View Code? Open in Web Editor NEWLicense: Apache License 2.0
License: Apache License 2.0
The "options" property of the document type object has been deprecated in favor of the "opts" property. The "opts" property is real JSON.
Update the SDK to use the new property.
I was getting this error first time I was making an API call (.persist()
):
Could not load type 'RestSharp.Authenticators.IAuthenticator'
I saw that RestSharpSigned
was a dependency, but apparently that wasn't enough.
Open the Nuget package manager and install the regular RestSharp (not RestSharpSigned).
I would've created a pull request, but I'm not sure if removing RestSharpSigned would break anything.
We need to make sure that all the unit tests pass before merging new changes. Using docker containers on travis seems like the way to go.
I am trying to find out why the SignedAt value is not hydrated when we get a json response from the server.
If you look at:
https://github.com/Penneo/sdk-net/blob/master/Src/Penneo/(Model)/SignatureLine.cs#L46
.. could it be because we say internal set
instead of just set
?
If a customer chooses to send out a CPR validation not using the Penneo system to generate the emails, if someone tries to resend the validation from the web application, the result will be that the validation can't be send.
Investigate whether the email text and email subject can be set after the validation has been activated using the "send" method and the link has been extracted.
If this is possible, update the documentation to specify this as the default procedure when you want to handle email sending yourself.
Method needs to be implemented to extract the validation contents using the following URL:
/api/v1/validations/{id}/contents
Calling GetEventLog on a signer object loaded using e.g. Query.FindById results in the wrong url being invoked. This happens because the CaseFile of the signer is not set during de-serialization of the json when loading.
Nonces should be limited to only containing the following characters [a-zA-Z0-9].
The following exception is thrown when trying to delete the signers for a casefile:
Could not delete the Signer
Please look at the following code snippet that lead to the error:
var signer = caseFile.FindSigner(int.Parse(signerId));
signer.Delete();
However, if you explicitly set the case file on the signer, the error does not occur:
var signer = caseFile.FindSigner(int.Parse(signerId));
signer.CaseFile = caseFile; // manually setting the case file
signer.Delete();
It seems like when signers are fetched using the FindSigner method, the case file is not set for the signer.
The endpoint for getting the signer type roles is not formed properly if the signers are fetched using the caseFile.GetSigners() function. It works fine if caseFile.Signers is used.
Expected: /api/v1/casefiles/1/signers/1/signertypes
Actual: /api/v1/signers/1/signertypes
Example, the following C#
code leads to the correct result:
...
signers = caseFile.Signers;
...
var signers = caseFile.Signers;
leads to the correct formation of the endpoints: (extract of tcpdump):
$ sudo tcpdump -i docker0 -A | grep GET
.. GET /app_dev.php/api/v1/casefiles/1 HTTP/1.1
.. GET /app_dev.php/api/v1/casefiles/1/signers/1/signertypes HTTP/1.1
However, the following creates an invalid endpoint:
...
signers = caseFile.Signers;
...
signer.GetSignerTypes();
leads to:
$ sudo tcpdump -i docker0 -A | grep GET
GET /app_dev.php/api/v1/casefiles/1 HTTP/1.1
GET /app_dev.php/api/v1/signers/1/signertypes HTTP/1.1
<h2><span>2/2</span> <abbr title="Symfony\Component\HttpKernel\Exception\NotFoundHttpException">NotFoundHttpException</abbr>: No route found for "GET /api/v1/signers/1/signertypes"</h2>
It is not possible to use the .NET SDK if the project also depends on a different version of Rest Sharp. I am wondering if we can using floating version numbers for Rest Sharp e.g. any version that matches 15.*
can be used. This is discussed here:
The question here is whether Rest Sharp following semantic versioning or not. If it does, then specifying a wild card in the version number should work. Is there something that we can do about this?
We need to update the documentation to mention the dependency on Newtonsoft.Json.dll and RestSharp.dll. Also the specific library versions needed should be mentioned.
I have been going through the documentation at for creating casefiles. However, I can see that the case file template is not persisted when the SetCaseFileTemplate() function is called:
// Create a new case file
var myCaseFile = new CaseFile();
// Get the case file templates available to the authenticated user
var availableTemplates = myCaseFile.GetTemplates().Objects;
// Assign the first list item as the case file template
myCaseFile.SetCaseFileTemplate(availableTemplates.First());
Can you please elaborate?
Consider the example:
var cf = new CaseFile("Sample Case File")
{
VisibilityMode = 1,
SensitiveData = true
};
cf.Persist();
If I call persist
twice, the SensitiveData
value is disabled.
var cf = new CaseFile("Sample Case File")
{
VisibilityMode = 1,
SensitiveData = true
};
cf.Persist();
cf.Persist(); // Doesn't keep the current state of the object
We should support methods for writing case file and document meta data as key/value pairs. This is just helper functions that will just convert data back and forward between native objects and JSON objects (to be stored as a string through the API).
We should be aware that the values can be binary so doing a base64 encode/decode should be mandatory.
It would make sense that the user of the SDK is able to provide documents as raw data (eg. byte array) instead of having to supply a file. This is especially true, if the user generates documents for the sole purpose of sending them through Penneo.
The flag that determines whether a case file contains sensitive data can default to either set or unset at customer level. This default value is now readable through the API and should be used when creating a new case file object.
With this change:
Currently, the CallServer
function in the ApiConnector
can't be used since the class is internal. It would be really useful if that function were made public so that requests can be made which are not natively supported by the .net sdk.
The functions for finding case files are not working:
Find specific case file
Query.Find<CaseFile>(..);
returns
Penneo: Could not find the requested CaseFile (id = ..)
Find all case files
Query.FindAll<CaseFile>();
returns
Penneo: Internal problem encountered
at Penneo.Query.FindBy[T](Dictionary`2 criteria, Dictionary`2 orderBy, Nullable`1 limit, Nullable`1 offset)
at Penneo.Query.FindAll[T]()
The REST API also supports setting the parent of the folder. This isn't documented at the moment and the fixed documentation will be released in the coming days. It looks like this:
where the parent
can be the folderId
of the parent folder.
It should be possible to set the parent folder using the .NET SDK (both for POST AND PUT methods)
The following needs to be added:
Quarantined = 6,
Failed = 7
We need to be able to enable logging so that payloads for POST
/PUT
requests are logged as well as the response bodies for all requests.
We need to expose functionality to save validations into folders. This is already supported in the API.
The sdk doesn't use the unix timestamps for dates. Take the following code as an example:
var caseFiles = Query.FindBy<CaseFile>(
criteria: new Dictionary<string, object>(){ {"createdAfter", new DateTime(2015,10,21)} },
orderBy: new Dictionary<string, string>(){ {"created", "desc" } }
);
generates the url:
GET /api/v1/casefiles?createdAfter=10/21/2015 00:00:00&sort=created&order=desc
We need to update the documentation and add the following filters for case files and documents:
Rewrite the unit tests in nUnit or xUnit.
This guide might be a good place to start http://approache.com/blog/from-mstest-to-nunit/
In case the document isn't finalized and the getPdf()
method is called on an object, the sdk throws an exception:
Newtonsoft.Json.JsonSerializationException: Cannot deserialize the current JSON object (e.g. {\"name\":\"value\"}) into type 'System.String[]' because the type requires a JSON array (e.g. [1,2,3]) to deserialize correctly.\r\nTo fix this error either change the JSON to a JSON array (e.g. [1,2,3]) or change the deserialized type so that it is a normal .NET type (e.g. not a primitive type like integer, not a collection type like an array or List<T>) that can be deserialized from a JSON object. JsonObjectAttribute can also be added to the type to force it to deserialize from a JSON object.\r\nPath '', line 1, position 2.\r\n at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.CreateObject(JsonReader reader, Type objectType, JsonContract contract, JsonProperty member, JsonContainerContract containerContract, JsonProperty containerMember, Object existingValue)\r\n at Newtonsoft.Json.Serialization.JsonSerializerInternalReader.Deserialize(JsonReader reader, Type objectType, Boolean checkAdditionalContent)\r\n at Newtonsoft.Json.JsonSerializer.DeserializeInternal(JsonReader reader, Type objectType)\r\n at Newtonsoft.Json.JsonConvert.DeserializeObject(String value, Type type, JsonSerializerSettings settings)\r\n at Newtonsoft.Json.JsonConvert.DeserializeObject[T](String value, JsonSerializerSettings settings)\r\n at Penneo.Connector.ApiConnector.GetTextAssets(Entity obj, String assetName)\r\n at Penneo.Connector.ApiConnector.GetFileAssets(Entity obj, String assetName)\r\n at Penneo.Entity.GetFileAssets(String assetName)\r\n at Penneo.Document.GetPdf()
The user can implement a check for whether the document exists or not but the sdk should fail gracefully.
The document options are current persisted as:
[{"Name":"boardSignCount","Value":"5"}]
The right format is:
{"boardSignCount":5}
If several values are input, they should just be added to the object. Obviously duplicate names are not allowed.
Copied from Windows Application issue 14, because the actual issue is in the sdk.
With version 1.0.17.0 of Penneo.dll, the following error is thrown:
Object reference not set to an instance of an object.
at Penneo.Util.ReflectionUtil.ConvertToType(Type type, Object value)
at Penneo.Util.ReflectionUtil.SetPropertiesFromDictionary(Object obj, Dictionary`2 values)
at Penneo.Util.ReflectionUtil.SetPropertiesFromJson(Object obj, String json)
at Penneo.Connector.ApiConnector.WriteObject(Entity obj)
at Penneo.Entity.Persist()
at Mep.Bureau.Modules.ClientModule.Source.Model.Modules.Tabs.DigitalSignatureTab.Model.PenneoService.CreateCaseFile(String title, Nullable`1 sendAt, Nullable`1 expireAt, String metaData) in
xxxxxx\PenneoService.cs:line 84
Code:
var caseFile = new CaseFile(title)
{
SendAt = sendAt,
ExpireAt = expireAt,
MetaData = metaData
};
This works for version 1.0.15.1
I always get null value while trying to retrieve folders child folders, seems like ChildFolders property doesn't working.
Query.Find(folderId).ChildFolders.
Context data is not loaded before the printed document is added, which results in an error.
Social security number and Vatin for the signers are retrieved form the REST API but the Signer object is not hydrated with the values. Here is the code that I am testing with:
var cf = Query.Find<CaseFile>(234);
var signer = cf.FindSigner(201);
Console.WriteLine("Id : " + signer.Id);
Console.WriteLine("Name : " + signer.Name);
Console.WriteLine("SSN : " + signer.SocialSecurityNumber);
Console.WriteLine("VATIN : " + signer.VATIdentificationNumber);
Here is the output with logging enabled:
Trace: HTTP REQUEST GET: http://anr.dev.penneo.com:8000/app_dev.php/api/v1casefiles/234
Trace: HttpHeader - Content-type: application/json
Trace: HTTP RESPONSE GET: http://anr.dev.penneo.com:8000/app_dev.php/api/v1casefiles/234 (200 OK)
Trace: Content: {"userId":1,"customerId":1,"signers":[{"name":"John","sdkClassName":"Signer","id":201,"vatin":"80767013","onBehalfOf":"Acme","signingRequest":{"sdkClassName":"SigningRequest","id":201,"emailFormat":"text","status":0,"accessControl":false,"enableInsecureSigning":false}}],"sdkClassName":"CaseFile","id":234,"title":"Test","status":0,"documents":[],"signIteration":0,"visibilityMode":0,"documentDisplayMode":0,"sensitiveData":false,"created":"1495617024","encryptionModeSigned":"aws-kms","language":"en"}
Trace: HttpHeader - Server: nginx
Trace: HttpHeader - Content-Type: application/json
Trace: HttpHeader - Transfer-Encoding: chunked
Trace: HttpHeader - Connection: keep-alive
Trace: HttpHeader - Cache-Control: no-cache
Trace: HttpHeader - Date: Wed, 24 May 2017 09:13:46 GMT
Trace: HttpHeader - X-Debug-Token: bb310d
Trace: HttpHeader - X-Debug-Token-Link: http://anr.dev.penneo.com:8000/app_dev.php/_profiler/bb310d
Trace: HttpHeader - Set-Cookie: CSRF-token=7f2a846e5aa97323; path=/
Id : 201
Name : John
SSN :
VATIN :
Consider the case file. When I call the following:
var myCaseFile = Query.Find<CaseFile>(271184);
The the following doesn't return the correct template:
myCaseFile.CaseFileTemplate
This is not an exhaustive list:
CaseFileTemplate
DocumentType
The following code fails:
// Create new Case File
var folders = Query.FindAll<Folder>();
foreach (Folder f in folders)
{
var caseFiles = f.GetCaseFiles(); // results in invalid API call
}
Here is the call that is made:
GET /app_dev.php/api/v1/Penneo/SDK/CaseFile HTTP/1.1
The pdf is not persisted when the SetPdf()
method is used instead of the class constructor. Example:
CaseFile caseFile = ..
string title = "Test";
string pdfFilePath = ..
Document doc1 = new Document(caseFile, title, pdfFilePath);
doc1.MakeSignable();
doc1.Persist(); // persisted
Document doc2 = new Document(caseFile);
doc2.Title = title;
doc2.SetPdf(System.IO.File.ReadAllBytes(pdfFilePath));
doc2.MakeSignable();
doc2.Persist(); // NOT persisted
The "options" property of the document object has been deprecated in favor of the "opts" property. The "opts" property is real JSON.
Update the SDK to use the new property.
After the signer signs a document, the validated name is stored with the Signer. The REST API exposes the validated name but the SDK hasn't been updated accordingly.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.