Coder Social home page Coder Social logo

invoiced / invoiced-dotnet Goto Github PK

View Code? Open in Web Editor NEW
2.0 5.0 8.0 182 KB

Official .NET client library for the Invoiced API

Home Page: https://developer.invoiced.com/api/?csharp

License: MIT License

C# 100.00%
invoiced dotnet csharp api billing nuget

invoiced-dotnet's People

Contributors

adam-invoiced avatar andrew-invoiced avatar andriy-invoiced avatar dependabot[bot] avatar gutse avatar jaredtking avatar martinjsoles avatar ppone avatar var1ap avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

invoiced-dotnet's Issues

Invoices.ListAll throwing Invalid URI

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).

Updating updated_at in customer object

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"}"}

Customer object serialization buggy

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.

Is there support for the expand feature of the API?

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?

ListAll method fails when populating the nextUrl argument from the GetNextUrl

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.AbstractEntity1.List(String nextUrl, Dictionary2 queryParams, JsonConverter customConverter) at Invoiced.AbstractEntity1.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.

Add Async methods

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.

Customer.SaveAll() throws InvalidRequestException

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

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.