inkpro/smartweb-api

API wrapper to smartwebs soap platform

v1.0.3 2022-01-17 18:59 UTC

This package is auto-updated.

Last update: 2024-05-18 00:08:09 UTC


README

Documentation for the API can be found here: https://api.hostedshop.dk/doc/
Smartweb uses a soap client to pool from their servers.

The easiest way to initiate:

$client = new \inkpro\smartwebapi\Client(["Username"=>"myuser", "Password"=>"mypassword"]);

If you need to specify a wsdl url, you can do like this:

$client = new \inkpro\smartwebapi\Client(
    ["Username"=>"myuser", "Password"=>"mypassword"],
    "https://customwsdl.url"
);

For available methods, take a look in /src/Client.php. Usage of available methods:

Retrieves all products

$products = $client->getAllProducts();

Retrieves a product

$product = $client->getProduct();

Updates a product

@param object $product Product object, should include either Id or ItemNumber prop.
$status = $client->updateProduct($product);

Deletes a product

$status = $client->deleteProduct($id);

Retrieves all categories

$categories = $client->getAllCategories();

Retrieves a category

$category = $client->getCategory($categoryId);

Retrieves all users.

$users = $client->getUsers();

Retrieves all newsletter users.

$users = $client->getNewsletterUsers();

UnSubscribe user from newsletter.

$status = $client->unsubscribeNewsletterUser($user);

Gets a user by id.

$user = $client->getUser($id);

Gets a user by email.

$user = $client->getUserByEmail($email);

Creates a user

@param object $user User object, corresponding to smartweb UserCreate schema.
* @see https://api.smart-web.dk/doc/Hosted%20Solution%20API/UserCreate.html
$status = $client->createUser($user);

Create order

@param object $order OrderData object, corresponding to smartweb Order_Create schema.
$status = $client->createOrder($order);

Get Order

$order = $client->getOrder($orderId);

Retrieves all Orders

* @param DateTime $start The first date to get orders from.
* @param DateTime $end The last date to get orders from.
* @param array $status The status codes of the orders you want to get.
$orders = $client->getOrders($start, $end, $status);

Gets all orders made by a certain user.

$orders = $client->getUsersOrders($userId);

Updates the comment on an order.

* @param $order Order to update.
$status = $client->updateOrderComment($order, $comment);

Updates the status on an order.

* @param $order Order to update.
$status = $client->updateOrderStatus($order, $status);

Creates invoice from an order.

* @param $order Order
* @param int $maturity_interval The amount of days from today's date to set the maturity date for the Invoice (0, 8, 14 or 30 days).
$status = $client->createInvoice($order, $maturity_interval);

Gets all images linked to a product id.

$images = $client->getProductImages($productId, $shopId);

Gets all orderlines from a certain order.

$orderLines = $client->getOrderLines($orderId);

Gets all orderlines from a certain order.

$orderLines = $client->getOrderLines($orderId);

Updates orderline status

* @param OrderLine $order_line Orderline to update. Must have Id property.
$status = $client->updateOrderLineStatus($orderline, $status);

Retrieves a customer

$order = $client->getCustomer($orderId);