Coder Social home page Coder Social logo

sdk-net's People

Contributors

ahmadnazir avatar alex1308 avatar bokdamgaard avatar chrsadk avatar code-troll avatar fabianbadoi avatar gattazr avatar headcookie avatar hougaard avatar janflora avatar jpa-penneo avatar lhotrifork avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

sdk-net's Issues

Document type options format has changed

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.

RestSharp is not an dependency

Issue

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.

Fix

Open the Nuget package manager and install the regular RestSharp (not RestSharpSigned).

Other

I would've created a pull request, but I'm not sure if removing RestSharpSigned would break anything.

How to manually send out validations

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.

Signer.GetEventLog fails due to CaseFile being null

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.

Exception when trying to delete signers for a case file

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.

caseFile.GetSigners() leads to an invalid enpoint for getting signer types

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>

Supporting higher versions of Rest Sharp

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:

https://docs.microsoft.com/en-us/nuget/consume-packages/package-references-in-project-files#floating-versions

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?

Assigning case file templates to case files

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?

Calling CaseFile::persist() multiple times has side effects

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

Add methods for writing meta data as key/value pairs

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.

Supply docment as raw data instead of a file

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.

Default value for sensitive data option

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.

Update SDK to netcore2.0 and net461

With this change:

  • .NET Framework 4.0 will no longer be supported.
  • Minimum requirement for usage will be .NET Framework 4.6.1 or .NET Core 2.0.
  • Newtonsoft.Json will be updated to 11.0.2
  • RestSharp will be updated to 106.3.1
  • NUnit will be updated to 3.10.1
  • SDK version will be 2.0

Making rest calls directly to the server

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.

Find* functions for the CaseFiles are not working

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]()

Set and update the parent of a folder

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:

image

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)

Add validation to folder

We need to expose functionality to save validations into folders. This is already supported in the API.

Use unix timestamps for filtering on dates

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

getPdf() : Fail gracefully if document doesn't exist

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.

DocumentOption - format is not correct

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.

'Object reference not set' error, in version 1.0.17.0

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

Issue while retrieving Child Folders

I always get null value while trying to retrieve folders child folders, seems like ChildFolders property doesn't working.
Query.Find(folderId).ChildFolders.

Social security number and vatin are missing for the Signer

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 :

Some values are not present for entities after fetching them

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:

  • CaseFile : CaseFileTemplate
  • Document : DocumentType

Getting case files from a folder fails

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

Document SetPdf() method doesn't work

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

Document options format has changed

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.

Validated Name of the Signer

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.