engazan/mrp-ks-laravel

Laravel wrapper package for the MRP K/S API

1.0.0 2021-05-02 20:15 UTC

This package is auto-updated.

Last update: 2024-04-29 04:53:29 UTC


README

FEATURES

  • encryption (aes-256-ctr)

INSTALL

composer require engazan/mrp-ks-laravel

run php artisan vendor:publish look for Engazan\MrpKs\MrpKsServiceProvider

Config .env

MRP_KS_URI=192.168.0.166
MRP_KS_PORT=120
MRP_KS_USERNAME=MRPDBA
MRP_KS_PASSWORD=MRPDBA
MRP_KS_ENCRYPTION_KEY=
  • if MRP_KS_ENCRYPTION_KEY is provided all request are sent as ENCRYPTED, also you need DECRYPT response XML

USAGE

use Engazan\MrpKs\MrpKs;
use Engazan\MrpKs\MrpKsResponse;

$productFilter = [
    'malObraz' => 'T',
    'velObraz' => 'F',
    'SKKAR.CISLO' => '500..510',
];

// products
$response = MrpKs::EXPEO0($productFilter);
$response = MrpKs::EXPEO1($productFilter);

// addresses
$response = MrpKs::ADREO0();

// prices (default filter "cenovaSkupina" is set to "1")
$response = MrpKs::CENEO0();

// CHAINED calls
$mrpKs = new MrpKs();
$response = $mrpKs->setCommand('EXPEO0')
                    ->setFilters($productFilter)
                    ->sendRequest();
               
// DECRYPT response (needed only if MRP_KS_ENCRYPTION_KEY is filled) 
if (config('mrp-ks.encryption')) {
    $decryptedResponse = MrpKsResponse::decryptEncryptedResponse($response);
}