Coder Social home page Coder Social logo

mplus-api-client-php's Introduction

mplus-api-client-php

PHP client for the Mplus Q-line API.

Install through Composer:

composer require mplus-software/mplus-api-client-php

Example of usage:

The following script will connect to the API with your credentials and try to request the currently running version of the API.

<?php

require_once('Mplusqapiclient.php');

$mplusqapiclient = new Mplusqapiclient();
$mplusqapiclient->setApiServer($your_api_url);
$mplusqapiclient->setApiPort($your_api_port);
$mplusqapiclient->setApiFingerprint($certificate_fingerprint);
$mplusqapiclient->setApiIdent($your_api_ident);
$mplusqapiclient->setApiSecret($your_api_secret);

try {
  $mplusqapiclient->initClient();
} catch (MplusQAPIException $e) {
  exit($e->getMessage());
}
    
try {
  $api_version = $mplusqapiclient->getApiVersion();
  echo sprintf('Current API version: %d.%d.%d', 
    $api_version['majorNumber'], 
    $api_version['minorNumber'], 
    $api_version['revisionNumber']);
} catch (MplusQAPIException $e) {
  exit($e->getMessage());
}

Visit the Mplus Developers website for more information.

mplus-api-client-php's People

Contributors

barryvdh avatar bramstroker avatar dennismpluskassa avatar eelke-at-bolt avatar freerk-mpluskassa avatar jorams avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mplus-api-client-php's Issues

Multiple select field does not exists - getOverview with getOverviewFields

When using getOverview with the fields of getOverviewField. getOverview returns errors sayings 10 of the fields are not existing.

$fieldNames = [];

$fields = $client->getOverviewFields('PRODUCT');
foreach ($fields->overviewFieldsList as $field) {
	$fieldNames[] = $field->name;
}

$overview = $client->getOverview('PRODUCT', 0, $fieldNames);

Result:

{#2542 ▼
  +"currentPageNumber": 0
  +"lastPageNumber": 0
  +"maxPerPage": 0
  +"totalRecords": 0
  +"overviewList": []
  +"result": "GET-OVERVIEW-RESULT-FAILED"
  +"errorList": array:10 [▼
    0 => {#2544 ▼
      +"field": "voorraad_huidig_filiaal"
      +"errorCode": "GET-OVERVIEW-ERROR-INVALID-SELECT-FIELD"
      +"errorMessage": "Select field does not exists."
    }
    1 => {#2545 ▼
      +"field": "fil_maxvrd_1"
      +"errorCode": "GET-OVERVIEW-ERROR-INVALID-SELECT-FIELD"
      +"errorMessage": "Select field does not exists."
    }
    2 => {#2546 ▼
      +"field": "vrijevrd_huidig_filiaal"
      +"errorCode": "GET-OVERVIEW-ERROR-INVALID-SELECT-FIELD"
      +"errorMessage": "Select field does not exists."
    }
    3 => {#2547 ▼
      +"field": "inorder_huidig_filiaal"
      +"errorCode": "GET-OVERVIEW-ERROR-INVALID-SELECT-FIELD"
      +"errorMessage": "Select field does not exists."
    }
    4 => {#2548 ▶}
    5 => {#2549 ▶}
    6 => {#2550 ▶}
    7 => {#2551 ▶}
    8 => {#2552 ▶}
    9 => {#2553 ▶}
  ]
}

All the fields:

  • voorraad_huidig_filiaal
  • fil_maxvrd_1
  • vrijevrd_huidig_filiaal
  • inorder_huidig_filiaal
  • inifopdr_huidig_filiaal
  • filiaal_brutoprijs
  • filiaal_verkoopprijs
  • fil_vrd_1
  • fil_minvrd_1
  • inbestel_huidig_filiaal

I think that is because there is no 'filiaal' selected or something but then someone needs te exclude fields from the list.

Misprint in parseUpdateProductResult?

Mplusqapiclient.php file (line 1869)
In function definition you have param $soapCreateProductResult but in function's body $soapUpdateProductResult is used. I think this is just a copy&paste related misprint.

PHP 8.0 - Deprecations

This package triggers some warnings when using PHP 8.0.

Required parameter $selectFields follows optional parameter $categoryId in /home/vagrant/code/vendor/mplus-software/mplus-api-client-php/Mplusqapiclient.php on line 3905.
Required parameter $numbers follows optional parameter $categoryId in /home/vagrant/code/vendor/mplus-software/mplus-api-client-php/Mplusqapiclient.php on line 3954.
Required parameter $fields follows optional parameter $categoryId in /home/vagrant/code/vendor/mplus-software/mplus-api-client-php/Mplusqapiclient.php on line 3954.

Fatal error: Call to a member function getStock() on a non-object in Mplusqapiclient.php on line 605

I am using the following code like suggested on the development portal:

// Then we initialize the variables
$branchNumber = 1;
$articleNumbers = 4542;
$amountChanged = -3;

// Then we call the getStock() function wrapped in a try/catch block to intercept any exceptions.
try {
if (false !== $mplusqapiclient->updateStock($branchNumber, $articleNumber, $amountChanged)) {
exit('Stock succesfully updated.');
} else {
exit('Unable to update stock.');
}
} catch (MplusQAPIException $e) {
exit($e->getMessage());
}

This results in:

Fatal error: Call to a member function getStock() on a non-object in Mplusqapiclient.php on line 605

Yes I am sure that i am using the right articleNumber.

Also there is a typo on the $articleNumbers vs $articleNumber

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.