Giter Club home page Giter Club logo

guistracini.mandae's Introduction

Mandaê SDK .NET

🇧🇷🚚 Mandaê API .NET client wrapper

Para a versão em português, por favor siga me.

GitHub license Time tracker GitHub issues by-label

Mandae logo

This is an unofficial client for the Mandaê API V2


CI/CD

Build status Last commit Tests Coverage Code Smells LoC
Build status GitHub last commit AppVeyor tests (branch) Coverage Code Smells Lines of Code

Code Quality (main branch)

Codacy Badge Codacy Badge

codecov CodeFactor

Maintainability Test Coverage

Quality Gate Status Maintainability Rating

Technical Debt Duplicated Lines (%)

Reliability Rating Security Rating

Bugs Vulnerabilities

DeepSource


Installation

Github Releases

GitHub last release Github All Releases

Download the latest zip file from the Release page.

Nuget package manager

Package Version Downloads
GuiStracini.Mandae GuiStracini.Mandae NuGet Version GuiStracini.Mandae NuGet Downloads

Features

This client supports the following operations/features of the API:

  1. Get rates for a delivery (postal code and package dimensions)
  2. Schedule a collect (register a collect in the customer distribution centre with one or more packages. Each package can have one or more items/SKU)
  3. Get tracking data of a shipment (Get all tracking data available from one package - tracking code is set by the customer or provided by webhook)
  4. WebHooks schema ready (The webhooks models, ready for implementation)
  5. Experimental Querying orders (API V1 - non-public API)
  6. Experimental Querying occurrences (API V1 - non-public API). Issue #1 GitHub labels
  7. Experimental Querying reverses (API V1 - non-public API). Issue #2 GitHub labels
  8. Experimental Request reverse (API V1 - non-public API). Issue #3 GitHub labels

Usage

Setup the MandaeClient

Initializes a new instance of MandaeClient class.

Example:

//Request your API token to [email protected] 
//Each environment has its own API token!
var apiToken = "my API token";

//Call the constructor with the API token and the API environment (SANDBOX | PRODUCTION).
//var client = new MandaeClient(apiToken); //<= Environment.SANDBOX is the default environment.
var client = new MandaeClient(apiToken, Environment.PRODUCTION);

Get rates for a package/delivery

Get the rates (Rápido & Econômico) values and delivery time for a specified postal code and package dimensions.

Example:

//The MandaeClient
var client = new MandaeClient("my API token");

//The RatesModel
var delivery = new RatesModel {
    PostalCode = "22041080",
    ...
}
var rates = client.GetRates(delivery);
var fast = rates.ShippingServices.Single(s => s.Name == "Rápido");
var economic = rates.ShippingServices.Single(s => s.Name == "Econômico");
var option = ShippingService.ECONOMICO;
if(fast.Price < economic.Price)
    option = ShippingService.RAPIDO;

//The OrderModel (order collect request model)
var order = new OrderModel { ... };
order.Items = new [] {
    new NewItem 
    {
        ....
        ShippingService = option
    }
};
var order = client.RegisterOrderCollectRequest(order);

Schedule a collect request

Schedule a collect request (pickup in a distribution center/origin location).

Inform which type of Vehicle, when, which rate (Rapido | Economico) and the order items (a.k.a packages or clients orders).

Each package means an order/volume, that can have one or more items (SKUs).

Example:

//The MandaeClient
var client = new MandaeClient("my API token");

//The OrderModel (order collect request model)
var order = new OrderModel { ... };
order.Items = new [] {
    new NewItem 
    {
        ....
        ShippingService = option
    }
};

//Makes the request
var order = client.RegisterOrderCollectRequest(order);
**
//order.Id is the id for further use (maybe cancel the request ?)

Get tracking of a package

Example:

//The MandaeClient
var client = new MandaeClient("my API token");

//The tracking identifier (Generated by the Mandae or sent by the order collection request
var trackingId = "MyCompany-00001";
var tracking = client.GetTracking(tracking);
//tracking.CarrierName;
//tracking.CarrierCode;
//tracking.Events;

Querying orders (API V1 - Search) EXPERIMENTAL/NON-PUBLIC API

For the V1 you'll need to use the e-mail/password combination of the Mandaê panel to log in V1 API.

Example:

//The MandaeClient
var client = new MandaeClient("V2 API token");
client.ConfigureV1Authentication("[email protected]", "password");
var trackingCode = "XYZ000001";//The tracking code of some order
var result = client.Search(SearchMethod.TRACKING_CODE, trackingCode);
if(result.Total == 1)
    Console.WriteLine(result.Orders.Single().SituationDescription);    

Release notes

  • Release v6.0.0 and higher DEPRECATED methods: Get Latest Order
  • Release v5.0.0 and higher DEPRECATED methods: Large Request, Cancel Request, Cancel Item Request
  • Release v3.0.0 and higher changes the V1 authentication method. Now use your e-mail/password of the Mandaê panel to log in to the V1 API.
  • Release v1.4.1 and higher also includes an experimental (non-public) V1 endpoint for search/querying orders (the same interface as available through the Mandaê administration panel).

Warning

The API V1 is not officially public, so there is no warranty that it will still be working


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.