invoiced / invoiced-dotnet Goto Github PK
View Code? Open in Web Editor NEWOfficial .NET client library for the Invoiced API
Home Page: https://developer.invoiced.com/api/?csharp
License: MIT License
Official .NET client library for the Invoiced API
Home Page: https://developer.invoiced.com/api/?csharp
License: MIT License
When I instantiate the client and I make a call to Invoices.ListAll, I get an System.UriFormatException: 'Invalid URI: The hostname could not be parsed.'
Here is the code (API key removed)
var connection = new Connection("{API KEY}", Invoiced.Environment.sandbox);
var invoices = connection.NewInvoice().ListAll();
Debugging shows uri is coming out as /invoices (missing base portion).
The Retrieve method in AbstractEntity.cs does not have an overload to pass in query parameters. This is required for e.g. retrieving a payment with ?include=applied_to (see https://www.invoiced.com/resources/docs/api/#retrieve-a-payment).
Updating a singular customer's via Save(string) or SaveAll() updated_at field results in response of:
{"{"type":"invalid_request","message":"Mass assignment of updated_at on Customer is not allowed"}"}
Hi, the customer object serialization is buggy.
Actually when SENDING a customer, the "taxes" element is a List of string.
When RECEIVING a customer, it is List of Tax.
This means that the API cannot be used to create a customer with a certain set of tax rates.
We fixed this by temporarily forking the repository and setting the data type of "taxes" to List of object (see smintio@c5ee331)
This does not solve the issue with querying taxes, but it allows us to at least create the customer, and deserialization of the object works as well.
Hi,
I am looking to use this to pull invoices with expanded customers which is possible with the api. By the looks of the type for customer (long?), i would have to make subsequent call(s) to get the customer data. Is this correct?
There are multiple issues.
The first is that the call to GetNextUrl is not returning the same value as when you directly ask for the next url from the LinkURLs dictionary:
? all.GetNextURL()
"https://api.sandbox.invoiced.com/invoices?page=1"
? all.LinkURLS("next")
"https://api.sandbox.invoiced.com/invoices?page=2"
This makes no sense to me as looking at the source code, the code I run in the immediate window in Visual Studio should be same. How these two are coming back different is a mystery. I guess that I'll try a fork of the code and try to step through it to see what is happening here.
The second issue as that using the provided URL to get the next page of values throws an exception:
"The remote name could not be resolved: 'api.sandbox.invoiced.comhttps'" is the message returned from the inner web exception.
The relevant stack trace that I can get is:
at Invoiced.Connection.ExecuteRequest(HttpMethod method, String url, String jsonBody)
at Invoiced.Connection.GetList(String url, Dictionary2 queryParams) at Invoiced.AbstractEntity
1.List(String nextUrl, Dictionary2 queryParams, JsonConverter customConverter) at Invoiced.AbstractEntity
1.ListAll(String nextUrl, Dictionary`2 queryParams, JsonConverter customConverter)
Yes, that's formatted for Visual Basic, the language of choice at my employer.
I don't understand how the remote name is getting mangled that badly while using the sandbox environment.
Asynchronous methods are the recommended pattern for network operations. I noticed that the ExecuteRequest
method was internally creating an awaiter to execute operations synchronously. My latest pull request #12 adds async methods that let the calling code control this. My client code can then queue multiple operations up to run in parallel instead of forcing serial operations.
I have a pretty basic function that updates a customer:
public Task<CustomerResponse> UpdateCustomerAsync(long id, CustomerRequest request)
{
var customer = _connection.NewCustomer().Retrieve(id);
customer.Name = request.Name;
customer.Address1 = request.Address1;
customer.Email = request.Email;
customer.SaveAll();
return Task.FromResult(customer.Adapt<CustomerResponse>());
}
when customer.SaveAll() is called the following exception is thrown:
Invoiced.InvalidRequestException
{"type":"invalid_request","message":"Missing `invoiced_token` parameter!","param":"payment_source"}
at Invoiced.Connection.ProcessResponse(HttpResponseMessage response)
at Invoiced.Connection.Patch(String endpoint, String jsonBody)
at Invoiced.AbstractEntity`1.SaveAll()
The method is written based on a code example from the docs so I don't think there's a problem with my function. Am I missing something obvious here?
Also the parameter 'invoiced_token' is marked optional in the docs, so that confuses me even more
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.