Giter Club home page Giter Club logo

shippo-csharp-client's People

Contributors

adriancollinsshippo avatar assislucas avatar dochoffiday avatar epistemancer avatar guozhen-la avatar jainankit avatar jfriedr avatar lennox-of-shippo avatar lucasamaral avatar manishtomar avatar mootrichard avatar mylifeisshan avatar sam-allen-shippo avatar sbeidas avatar ssong-shippo avatar vinhhv avatar wenwei1030 avatar zarlengotoptal avatar

Stargazers

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

Watchers

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

shippo-csharp-client's Issues

Shippo Client

Is anyone actively maintaining a Shippo C# client?

Support for Latest C# and Asp.Net (DotNetCore)

Currently, this package does not work with the most current version of DotNet and C#. DotNetCore, the latest version of C# and Asp.Net has been out for over a month. Please support it.

Poor Design

Here are some problems I ran into trying to do a simple address validation.

  • None of the Shippo properties are typed. This makes basic data entry impossible without referencing the documentation and is very error prone.
  • Examples sometimes use a factory method and sometimes use an object initializer. The first shipment example uses an object intializer while the validation uses a factory method. which one is correct ?
  • Address validation method takes a hashtable argument. Why am I responsible for converting your objects into hashtables ? Why not use an address object ?

Cannot create manifest

Attempting to create a Manifest using the client wrapper doesn't appear to be working correctly.

{"detail": 
  "Invalid transactions 2340e41cdd2047eca4582188779c6f6d for manifest request. 
Please check that the carrier (USPS) matches, 
that the transactions are of the same date (2017-06-21T19:24:26.127000+00:00), 
that the transactions have the correct zip code (92101), 
and that the transactions have not been assigned to a different manifest."}

The above is the error you get when trying to create a manifest using the below. The date, carrier, and zip code all are the same between the manifest and the transaction.

Using the following:

private static void RunManifestExample(APIResource resource)
        {
            ShippoCollection<CarrierAccount> carrierAccounts = resource.AllCarrierAccount ();
            string defaultCarrierAccount = "";
            foreach (CarrierAccount account in carrierAccounts) {
                if (account.Carrier.ToString () == "usps")
                    defaultCarrierAccount = account.ObjectId;
            }
            // to address
            Hashtable toAddressTable = new Hashtable ();
            toAddressTable.Add ("object_purpose", "PURCHASE");
            toAddressTable.Add ("name", "Mr. Hippo");
            toAddressTable.Add ("company", "Shippo");
            toAddressTable.Add ("street1", "215 Clayton St.");
            toAddressTable.Add ("city", "San Francisco");
            toAddressTable.Add ("state", "CA");
            toAddressTable.Add ("zip", "94117");
            toAddressTable.Add ("country", "US");
            toAddressTable.Add ("phone", "+1 555 341 9393");
            toAddressTable.Add ("email", "[email protected]");

            // from address
            Hashtable fromAddressTable = new Hashtable ();
            fromAddressTable.Add ("object_purpose", "PURCHASE");
            fromAddressTable.Add ("name", "Ms Hippo");
            fromAddressTable.Add ("company", "San Diego Zoo");
            fromAddressTable.Add ("street1", "2920 Zoo Drive");
            fromAddressTable.Add ("city", "San Diego");
            fromAddressTable.Add ("state", "CA");
            fromAddressTable.Add ("zip", "92101");
            fromAddressTable.Add ("country", "US");
            fromAddressTable.Add ("email", "[email protected]");
            fromAddressTable.Add ("phone", "+1 619 231 1515");
            fromAddressTable.Add ("metadata", "Customer ID 123456");

            // parcel
            Hashtable parcelTable = new Hashtable ();
            parcelTable.Add ("length", "5");
            parcelTable.Add ("width", "5");
            parcelTable.Add ("height", "5");
            parcelTable.Add ("distance_unit", "in");
            parcelTable.Add ("weight", "2");
            parcelTable.Add ("mass_unit", "lb");

            List<Hashtable> parcelArray = new List<Hashtable> ();
            parcelArray.Add (parcelTable);

            // shipment
            Hashtable shipmentTable = new Hashtable ();
            shipmentTable.Add ("address_to", toAddressTable);
            shipmentTable.Add ("address_from", fromAddressTable);
            shipmentTable.Add ("parcels", parcelArray);
            shipmentTable.Add ("object_purpose", "PURCHASE");
            shipmentTable.Add ("async", false);
            shipmentTable.Add ("carrier_accounts", new string [] { defaultCarrierAccount });

            // create Shipment object
            Console.WriteLine ("Creating Shipment object..");
            Shipment shipment = resource.CreateShipment (shipmentTable);

            // select desired shipping rate according to your business logic
            // we simply select the first rate in this example

            Console.WriteLine ("Getting shipping label..");
            Hashtable transactionParameters = new Hashtable ();
            transactionParameters.Add ("rate", shipment.Rates[0].ObjectId);
            transactionParameters.Add ("async", false);
            Transaction transaction = resource.CreateTransaction (transactionParameters);

            if (((String)transaction.Status).Equals ("SUCCESS", StringComparison.OrdinalIgnoreCase)) {
                Console.WriteLine ("Label url : " + transaction.LabelURL);
                Console.WriteLine ("Tracking number : " + transaction.TrackingNumber);

	            Hashtable manifestParams = new Hashtable ();
	            manifestParams.Add ("carrier_account", defaultCarrierAccount);
	            manifestParams.Add ("address_from", shipment.AddressFrom);
	            manifestParams.Add ("shipment_date", transaction.ObjectCreated);
	            manifestParams.Add ("transactions", new string[]{ transaction.ObjectId } );
	            manifestParams.Add ("async", false);

	            Manifest manifest = resource.CreateManifest(manifestParams);
            } else {
                Console.WriteLine ("An Error has occured while generating your label. Messages : " + transaction.Messages);
            }

        }

Official Nuget package

Hello,

would it be possible for you to publish an official Nuget package for the C# client? There are third party shippo clients available in Nuget but an official would be great.

Unable to Register Webhook Callback

I see you guys provide a way to register a tracking webhook that takes the carrier and tracking number. However, I don't see a way to register the webhook callback url and event type. Is this something that is only available through the Shippo Dashboard, or did I miss some code somewhere that will do this through an api call?

Missing ShipmentId on Rate Object as well as Insurance Amount

Hello,

There seems to be a lot of fields missing from objects in this library as compared to the objects outlined in the API documentation.

Rates are missing some key fields to generate labels properly. We are not getting the shipmentid off the rate object nor are we getting the insurance amount as a couple of examples.

Are there any plans to fix this besides pinging the API directly? I might have to fork and modify.

Thanks

Rate returns nothing when creating multi-pieces parcel

There is no rate return when creating multi-pieces parcel. Here is an example provided from its document.

        APIResource resource = new APIResource(token);

        Hashtable toAddressTable = new Hashtable();
        toAddressTable.Add("name", "Mr. Hippo");
        toAddressTable.Add("company", "Shippo");
        toAddressTable.Add("street1", "215 Clayton St.");
        toAddressTable.Add("city", "San Francisco");
        toAddressTable.Add("state", "CA");
        toAddressTable.Add("zip", "94117");
        toAddressTable.Add("country", "US");
        toAddressTable.Add("phone", "+1 555 341 9393");
        toAddressTable.Add("email", "[email protected]");

        Hashtable fromAddressTable = new Hashtable();
        fromAddressTable.Add("name", "Ms Hippo");
        fromAddressTable.Add("company", "San Diego Zoo");
        fromAddressTable.Add("street1", "2920 Zoo Drive");
        fromAddressTable.Add("city", "San Diego");
        fromAddressTable.Add("state", "CA");
        fromAddressTable.Add("zip", "92101");
        fromAddressTable.Add("country", "US");
        fromAddressTable.Add("email", "[email protected]");
        fromAddressTable.Add("phone", "+1 619 231 1515");
        fromAddressTable.Add("metadata", "Customer ID 123456");

        List<Hashtable> parcelsList = new List<Hashtable>();

        Hashtable parcelTable = new Hashtable();
        parcelTable.Add("length", "5");
        parcelTable.Add("width", "5");
        parcelTable.Add("height", "5");
        parcelTable.Add("distance_unit", "in");
        parcelTable.Add("weight", "2");
        parcelTable.Add("mass_unit", "lb");

        Hashtable parcelTableTwo = new Hashtable();
        parcelTableTwo.Add("length", "1");
        parcelTableTwo.Add("width", "1");
        parcelTableTwo.Add("height", "1");
        parcelTableTwo.Add("distance_unit", "in");
        parcelTableTwo.Add("weight", "2");
        parcelTableTwo.Add("mass_unit", "lb");

        parcelsList.Add(parcelTable);
        parcelsList.Add(parcelTableTwo);


        Hashtable shipmentTable = new Hashtable();
        shipmentTable.Add("address_to", toAddressTable);
        shipmentTable.Add("address_from", fromAddressTable);
        shipmentTable.Add("parcels", parcelsList);
        shipmentTable.Add("async", false);

       Shipment shipment = resource.CreateShipment(shipmentTable);

       Response.Write(shipment.Rates.Count().ToString()); // **output 0**

CreateShipment error with some API Tokens

I'm running the exact same sample code included in this projects for all 3 API Tokens.
My Profile Test: Success
My Profile Live: Success
My Customer's Live: Shippo.ShippoException: '{"parcel": ["This field is required."]}'
Inner Exception: WebException: The remote server returned an error: (400) Bad Request.

Any ideas?

Shippo-Field-Required-Error

is_residential

The Address object should expose an is_residential field

Tracking immutable class

Since tracking information is only for consumption and it is doesn't change it will be nice if the Track class along with its related classes are immutable.

ShippoExample crashes when trying to create shipment

I cloned the repo, opened it using VS Pro 2019, generated my shippo test API token and placed it in APIResource("mytesttoken"). Set my startup project as ShippoExample and pressed the Start button. It built with no error and started running, but the example C# app crashes at the line:

Shipment shipment = resource.CreateShipment(shipmentTable);

with the following (top few lines) from dump of the exception:

System.Net.WebException: The underlying connection was closed: An unexpected error occurred on a send. ---> System.IO.IOException: Unable to read data from the transport connection: An existing connection was forcibly closed by the remote host. ---> System.Net.Sockets.SocketException: An existing connection was forcibly closed by the remote host
at System.Net.Sockets.Socket.Receive(Byte[] buffer, Int32 offset, Int32 size, SocketFlags socketFlags)
at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size)
--- End of inner exception stack trace ---
at System.Net.Sockets.NetworkStream.Read(Byte[] buffer, Int32 offset, Int32 size)
at System.Net.FixedSizeReader.ReadPacket(Byte[] buffer, Int32 offset, Int32 count)
at System.Net.Security.SslState.StartReceiveBlob(Byte[] buffer, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.CheckCompletionBeforeNextReceive(ProtocolToken message, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.StartSendBlob(Byte[] incoming, Int32 count, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.ForceAuthentication(Boolean receiveFirst, Byte[] buffer, AsyncProtocolRequest asyncRequest)
at System.Net.Security.SslState.ProcessAuthentication(LazyAsyncResult lazyResult)

--

did I miss something? (I only changed the API token and added try catch to get more exception details....

Namespace error

Added Shippo.Dll to my project and still cant get it working. It keeps on saying NameSpace Shippo could not be found. Is it something i am doing wrong or its an issue?

Getting metadata associated with the transaction object

I've added metadata to every part of the transaction object creation, but I don't receive it back from the webhooks, its just null.

After extensive talks with Shippo support, (been at this for months testing packages and code changes), ultimately the only way for me to get the metadata sent to me was to also post to the tracks endpoint.

What this ended up causing was for me to receive double webhooks from Shippo due to posting to the tracks endpoint as well as having the label created through them.

Is there something I'm missing perhaps?

Cannot update to Shippo 2.0.0

Steps to reproduce:
In Visual Studio 2015

  1. Create Console application.
  2. Install Shippo 1.5.7
  3. Add code:
using Shippo;
namespace TestApp
{
    class Program
    {
        static void Main(string[] args)
        {
            Shipment x = new Shipment();
        }
    }
}
  1. Update Shippo to 2.0.0.0
  2. Rebuild.
  3. see following exception:
Severity	Code	Description	Project	File	Line	Suppression State
Error	CS0246	The type or namespace name 'Shippo' could not be found (are you missing a using directive or an assembly reference?)	TestApp	d:\dev\test\TestApp\TestApp\Program.cs	6	Active

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.