Skip to content

Services

Bright Antwi Boasiako edited this page Mar 11, 2021 · 3 revisions

Table of contents

All functions on every Service return Response

Products

  • Functions
    • get( Request $request = null ): retrieve a list of products, see Request
    • showById( int $id, Request $request = null ): view product by id and you can use Request to exculde or include some fields.
    • showBySku( string $sku, Request $request = null ): view product by sku you can use Request to exculde or include some fields.
    • store( Product $product ): create a new product, see Product Model
    • update( Product $product ): update product, see Product Model
    • archive( int $id ): archive the product.
    • unarchived( int $id ): unarchived the product.
    • delete( int $id ): delete the product
    • restore( string $sku ): restore deleted product by sku
    • getDeleted(): retrieve a list of deleted products
    • import( Import $importProducts ): import products from a csv file, see Import Model
    • suppliers( int $id ): retrieve suppliers (supplier products) of the prodct
    • attributes( int $id ): retrieve all possible attributes for the product (direct, from attribute groups or through categories)
    • deleteAttributes( int $productId, array $attributes ): detach attributes from product
    • inventoryMovements( int $id ): retrieve a list of inventory movements for the product
    • setDefaultSupplier( int $id, int $supplierId ): mark supplier as default supplier to the product
    • assignAttributeGroups( int $id, array $attributeGroupIds ): assign attribute groups to the product.
    • constants(): constants data (product types, weight units, attribute types...)
    • activityLog( int $id ): retrieve a list of product activity log
    • inventory( int $id ): get product inventory details by product id
    • bulkArchive( Request $filters = null, array $productIds = null ): bulk archive products
    • bulkDelete( Request $filters = null, array $productIds = null ): bulk delete products
    • bundles( int $productId ): Product bundles.
    • components( int $productId ): Product bundle components.
// $productsService = new Products([ 'username' => $username, 'password' => $password ]);
Sdk::config( [ 'username' => $username, 'password' => $password, 'environment' => Sdk::DEVELOPMENT ] );
$productsService = new Products();
$productsResponse = $productsService->get(); // response contains a list of products
$productSuppliers = $productsService->suppliers(1)->getData();
$updateResponse = $productsService->update(new Product(['id' => 1, 'weight' => 45]));
if ($updateResponse->isFailure())
{
  $errors = $updateResponse->getErrors();
}

ProductBrands

  • Functions
    • get( Request $request = null ): retrieve product brands according to your request, see Request
    • show( int $id, Request $request = null ): show a product brand by id, see Request
    • store( string $brandName ): create a new product brand
    • update( int $id, string $brandName ): update a product brand by id, and new brand name
    • archive( int $id ): archive a product brand by id
    • unarchived( int $id ): unarchived a product brand by id

Warehouses

  • Warehouse
    • Functions
      • get( Request $request = null ): retrieve a list of warehouses, see Request
      • store( Warehouse $warehouse ): create a new warehouse, see Warehouse Model
      • update( Warehouse $warehouse ): update warehouse, see Warehouse Model
      • archive( int $id ): archive a warehouse by id.
      • unarchived( int $id ): unarchived a warehouse by id.
  • WarehouseLocation
    • Functions

Suppliers

  • Functions
    • get( Request $request = null ): retrieve a list of suppliers, see Request
    • store( Supplier $supplier ): create a new supplier, see Supplier Model
    • update( Supplier $supplier ): update supplier, see Supplier Model
    • archive( int $id ): archive the supplier.
    • unarchived( int $id ): unarchived the supplier.
    • products( int $id ): retrieve products (supplier products) to the supplier by supplier id
    • storeSupplierProduct( SupplierProduct $supplierProduct ): create a new supplier product, see Supplier Product Model
    • updateSupplierProduct( SupplierProduct $supplierProduct ): update a supplier product, see Supplier Product Model
    • createWarehouse( $supplierId, Warehouse $warehouse ): creates a warehouse for the supplier.

SupplierPricingTiers

  • Functions
    • get( Request $request = null ): retrieve a list of supplier pricing tiers, see Request
    • store( PricingTier $supplier ): create a new supplier pricing tier, see PricingTier Model
    • update( PricingTier $supplier ): update supplier pricing tier, see PricingTier Model
    • archive( int $id ): archive the supplier pricing tier.
    • unarchived( int $id ): unarchived the supplier pricing tier.
    • setDefault( int $id ): set supplier pricing tier as default tier for suppliers

Attributes

  • Functions
    • get( Request $request = null ): retrieve a list of attributes, see Request
    • store( Attribute $attribute ): create a new attribute, see Attribute Model
    • update( Attribute $attribute ): update attribute, see Attribute Model
    • archive( int $id ): archive the attribute.
    • unarchived( int $id ): unarchived the attribute.

AttributeGroups

  • Functions
    • get( int $parentId = null ): retrieve a list of attribute groups, and if there is parent id will retrieve its children attribute groups.
    • show( int $id ): get attribute group by id
    • store( AttributeGroup $attributeGroup ): create a new attribute group, see AttributeGroup Model.
    • update( AttributeGroup $attributeGroup ): update attribute group, see AttributeGroup Model.
    • delete( int $id ): delete an attribute group by id.

ProductAttributes

  • Functions
    • store( int $productId, array $attributes ): Update or set new attributes to a product $attributes is an array of ProductAttribute.
    • delete( int $productId, array $attributes ): unassign attributes from product $attributes is an array of attribute ids.
    • getAttributesGrouped( int $productId ): get product attributes grouped by id

ProductCategories

  • Functions
    • get( Request $request = null ): retrieve a list of product categories, see Request.
    • show( int $id, Request $request = null ): get product category by id and you can use Request to exclude or include some fields.
    • store( ProductCategory $category ): create a new product category, see ProductCategory Model.
    • update( ProductCategory $category ): update product category, see ProductCategory Model.
    • delete( int $id ): delete the product category.
    • assignToProduct( ProductToCategory $productToCategory ): assign product category to product.
    • reassignNewCategoryToProducts( int $oldCategoryId, int $newCategoryId ): reassigning new product category to products.
    • getProductCategoriesForManage( int $parentId = null ): retrieve product categories for manage, and if there is parent id get product categories that belongs to that parent.
    • productCategoriesTree(): retrieve product categories tree.
    • archive( int $categoryId ): archive product category.
    • unarchived( int $categoryId ): unarchived product category.

ProductPricingTiers

  • Functions
    • get( Request $request = null ): retrieve a list of product pricing tiers, see Request.
    • show( int $id): get product pricing tier by id and you can use Request to exclude or include some fields.
    • store( PricingTier $productPricingTier ): create a new product pricing tier, see ProductPricingTier Model.
    • update( PricingTier $productPricingTier ): update a product pricing tier, see ProductPricingTier Model.
    • archive( int $id ): archive a product pricing tier.
    • unarchived( int $id ): un archive product pricing tier.
    • setDefault( int $id ): mark a product pricing tier as default tier.

ProductImages

  • Functions
    • update( ProductImage $productImage ): update product image, see ProductImage Model.
    • delete( int $productImageId ): delete product image.
    • storeImage( string $image ): store image to the server and retrieve its path.
    • deleteImage( string $imagePath ): delete image from the server.

PaymentTerms

  • Functions
    • get( Request $request = null ): retrieve a list of payment terms, see Request.
    • show( int $id, Request $request = null ): get payment term by id and you can use Request to exclude or include some fields.
    • store( string $paymentTermName ): create a new payment term.
    • update( int $id, string $paymentTermName ): update a payment term by id.
    • archive( int $id ): archive a payment term.
    • unarchived( int $id ): un archive a payment term.

NominalCodes

  • Functions
    • get( Request $request = null ): retrieve a list of nominal codes, see Request.
    • show( int $id, Request $request = null ): view a nominal code by id, and you can use Request to exclude or include some fields.
    • store( NominalCode $nominalCode ): create a new nominal code, see NominalCode Model.
    • update( NominalCode $nominalCode ): update a nominal code, see NominalCode Model.
    • archive( int $id ): archive the nominal code.
    • unarchived( int $id ): unarchived the nominal code.

Incoterms

  • Functions
    • get( Request $request = null ): retrieve a list of incoterms, see Request.
    • show( int $id ): view incoterm by id.
    • store( Incoterm $incoterm ): create a new incoterm, see Incoterm Model.
    • update( Incoterm $incoterm ): update an incoterm, see Incoterm Model.
    • archive( int $id ): archive the incoterm.
    • unarchived( int $id ): unarchived the incoterm.

SalesChannels

  • Functions
    • get(): retrieve a list of sales channels.

SalesOrders

  • Functions
    • get( Request $request ): retrieve a list of sales orders.
    • show( int $id ): get sales order by id.
    • store( SalesOrder $salesOrder ): create a new sales order, see SalesOrder Model.
    • update( SalesOrder $salesOrder ): update a sales order by, see SalesOrder Model.
    • delete( int $id ): delete a sales order by id
    • import( Import $import ): import sales orders from a CSV file, see Import Model
    • constants(): retrieve sales order constants data.
    • archive( int $id ): archive sales order.
    • unarchived( int $id ): unarchived sales order.
    • bulkArchive( Request $filters, array $salesOrdersIds ): Bulk archive sales orders
    • bulkunArchive( Request $filters, array $salesOrdersIds ): Bulk un archive sales orders
    • bulkDelete( Request $filters, array $salesOrdersIds ): Bulk delete sales orders
    • fulfill( FulfillSalesOrderRequest $request ): Fulfill sales orders, see FulfillSalesOrderRequest

SalesOrderLines

  • Functions
    • delete( int $id ): delete an sales order line by id.

SalesChannelBrands

  • Functions: get( Request $request = null ): retrieve all sales channel brands. show( int $id ): retrieve a sales channel brand by id. store( SalesChannelBrand $salesChannelBrand ): create a new sales channel brand, see SalesChannelBrand Model. update( SalesChannelBrand $salesChannelBrand ): update sales channel brand by id, see SalesChannelBrand Model.

PurchaseOrders

  • Functions
    • get( Request $request ): retrieve a list of purchase orders.
    • show( int $id ): get purchase order by id.
    • store( PurchaseOrder $purchaseOrder ): create a new purchase order, see PurchaseOrder Model.
    • update( PurchaseOrder $purchaseOrder ): update a purchase order by, see PurchaseOrder Model.
    • delete( int $id ): delete a purchase order by id
    • import( Import $import ): import purchase orders from a CSV file, see Import Model
    • constants(): retrieve sales order constants data.
    • archive( int $id ): archive purchase order.
    • unarchived( int $id ): unarchive purchase order.
    • bulkArchive( Request $filters, array $purchaseOrdersIds ): Bulk archive purchase orders
    • bulkunArchive( Request $filters, array $purchaseOrdersIds ): Bulk un archive purchase orders
    • bulkDelete( Request $filters, array $purchaseOrdersIds ): Bulk delete purchase orders

PurchaseOrderLines

  • Functions
    • delete( int $id ): delete a purchase order line by id.

ActivityLogs

  • Functions
    • get( Request $request = null ): retrieve a list of activity log, see Request
    • show( string $id ): retrieve an activity log.

Currencies

  • Functions
    • get(): retrieve all currencies
    • store( Currency $currency ): create a new currency, see Currency
    • update( Currency $currency ): update a currency, see Currency
    • delete( int $id ): delete a currency.
    • setAsDefault( int $id ): set currency as a default currency of the system

Inventory

  • Function
    • inventoryAdjustments( $inventoryAdjustment ): adjust Inventory for a product, $inventoryAdjustment parameter accept one or array of InventoryAdjustment model, see InventoryAdjustment

Customer

  • Functions
    • get( Request $request = null ): retrieve a list of customers, see Request
    • store( Address $address ): create a new customer, see Address
    • update( Address $address, $customer_id ): update a customer, see Address
    • findMatch ( string $name, string $zip, string $address1 ): get customers with match percentage of 90% of address1

Settings

  • Functions
    • get(): view all settings.
    • show( int $id ): show setting by id.
    • update( $id || $code, value ): update setting by id or by code

Image

  • Functions
    • storeImage( string $image ): storing image to the server.
    • deleteImage( string $imagePath ): removing image from the server