2017 © Pedro Peláez
 

library elms-service

Nette service for comunication with ELMS distribution service (http://www.elmsservice.cz)

image

premekkoch/elms-service

Nette service for comunication with ELMS distribution service (http://www.elmsservice.cz)

  • Friday, August 4, 2017
  • by premekkoch
  • Repository
  • 1 Watchers
  • 0 Stars
  • 13 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 6 Versions
  • 0 % Grown

The README.md

PremekKoch\ElmsService

ELMS Servis API communication service. It serves to create an order for sending the stored goods to the end customer., (*1)

Instalation

composer require premekkoch/elms-service

Configuration

1. Register new extension in config.neon

extensions:
    elms: PremekKoch\Elms\DI\ElmsExtension

2. Set-up extension in config.neon

elms:
    orderSourceCode: 'yourClientCodeFromElmsServis' 
    debugMode: false  # in debug mode no data are send

How to use

1. Inject an service into presenter or somewhere you need

    /** @var PremekKoch\Elms\ElmsService @inject */
    public $elmsService;

2. Set a customer and order data

Start with creating order and customer basic data:, (*2)

    :
    $this->elmsService->createOrder('123', 'INV_123', false, ElmsService::CURRENCY_CZK);
    $this->elmsService->addCustomer('Jan', 'Novák', 'Dlouhá 5', 'Dlouhá Lhota', '12345', ElmsService::COUNTRY_CZE);
    :

You can set another customer properties:, (*3)

    :
    $this->elmsService->setCustomerCompany('Firma s.r.o.', '123456789', 'CZ123456789');
    $this->elmsService->setCustomerContact('novak@firma.cz', '+420777666555');
    :

or even diferent delivery address. You can set any part of delivery address separately. If delivery address is not set, shipping will be provided to customer`s address., (*4)

    :
    $this->elmsService->setCustomerDeliveryName('Jana', 'Nováková');
    $this->elmsService->setCustomerDeliveryAddress('Krátká 8', 'Krátká Lhota', '54321', ElmsService::COUNTRY_SVK);
    $this->elmsService->setCustomerDeliveryCompany('Jana Nováková OSVČ');
    $this->elmsService->setCustomerDeliveryContact('novakova@novakova.sk', '+421777888999');
    :

Next you must specify products to delivery. You can add more products, minimaly you must set one product and shipping:, (*5)

    :
    $this->elmsService->addProduct('Product PLU', 1234.56, 1, 21);
    $this->elmsService->addProduct(ElmsService::DELIVERY_CPOSTRR, 55, 1, 21);
    :   

Alternatively, you can set products in bulk:, (*6)

    :
    $this->elmsService->addProducts([
        [
            'plu' => 'Product PLU',
            'price' => 1234.56,
            'amount' => 1,
            'vat' => 21,
        ],
        [
            'plu' => ElmsService::DELIVERY_CPOSTRR,
            'price' => 55,
            'amount' => 1,
            'vat' => 21,
        ],
    ]);
    :

You can add special product items:, (*7)

    :
    // Discount 100 CZK (value or ammount must be negative)
    $this->elmsService->addDiscount(-100, 1, 21);
    :
    // Rounding (-0.99 to +0.99)
    $this->elmsService->addRounding(-0.56);
    :

Remember: when you use CZK and cashOnDelivery, you must round an order to integers. In order cases (EURs or not cashOnDelivery) use two decimals maximally., (*8)

3. Send an order

    :
    $this->elmsService->sendOrder();
    :
    catch (PremekKoch\Elms\ElmsException $exc){
        // something goes wrong...          
    }

When send fails, API returns only brief error. Email with whole request and problems descriptions should arrive from ELMS Servis soon - they checks every failed request manually., (*9)

The Versions

04/08 2017

dev-master

9999999-dev

Nette service for comunication with ELMS distribution service (http://www.elmsservice.cz)

  Sources   Download

The Requires

 

by Avatar premekkoch

04/08 2017

0.0.5

0.0.5.0

Nette service for comunication with ELMS distribution service (http://www.elmsservice.cz)

  Sources   Download

The Requires

 

by Avatar premekkoch

27/07 2017

0.0.4

0.0.4.0

Nette service for comunication with ELMS distribution service (http://www.elmsservice.cz)

  Sources   Download

The Requires

 

by Avatar premekkoch

30/06 2017

0.0.3

0.0.3.0

Nette service for comunication with ELMS distribution service (http://www.elmsservice.cz)

  Sources   Download

The Requires

 

by Avatar premekkoch

29/06 2017

0.0.2

0.0.2.0

Nette service for comunication with ELMS distribution service (http://www.elmsservice.cz)

  Sources   Download

The Requires

 

by Avatar premekkoch

29/06 2017

0.0.1

0.0.1.0

Nette service for comunication with ELMS distribution service (http://www.elmsservice.cz)

  Sources   Download

The Requires

 

by Avatar premekkoch