Giter VIP home page Giter VIP logo

active-ants's Introduction

Active Ants API client

This package provides a wrapper for the ActiveAnts ShopApi. This package was developed by Afosto to make a reliable connection between Afosto (Retail Software) and Active Ants and provides all the basic functionality.

Installation

To install, use composer:

composer require afosto/active-ants

Usage

First get an account at ActiveAnts and obtain a username and password for the ShopApi.

Start the app with the following code. The application will obtain an authorization-token, retreive settings and cache these in the cache folder.

App::start($endpoint, $username, $password, $cacheDirectory);

Below you'll find a subset of the available methods.

Create a product

$product = Product::model()
        ->setName('testProduct')
        ->setSku('testSku');

if ($product->save()) {
    echo "Product was saved";
}

Create an order

$item = OrderItem::model()
        ->setSku('testSku')
        ->setGrossPrice(1.21)
        ->setName('Test Product')
        ->setTaxRate(21);

$address = Address::model()
        ->setName('Afosto SaaS BV')
        ->setAddress('Protonstraat', 9, 'a')
        ->setCity('Groningen')
        ->setCountry('NL')
        ->setPostalcode('9743AL');

$order = Order::model()
        ->setEmail('[email protected]')
        ->setOrderId('#1')
        ->setPhoneNumber('0507119519')
        ->addOrderItem($item)
        ->setBillingAddress($address)
        ->setShippingAddress($address);

if ($order->save()) {
    echo "Order was saved";
}

Get stock for all products

foreach (Stock::model()->findAll() as $stock) {
    echo $stock->sku . ': ' . $stock->stock . "\n";
}

active-ants's People

Contributors

bakkerpeter avatar terraskye avatar

Watchers

 avatar

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.