2017 © Pedro PelĂĄez
 

library php-sdk

PHP SDK for Lemon Way API

image

lemonway/php-sdk

PHP SDK for Lemon Way API

  • Thursday, October 12, 2017
  • by duongphuhiep
  • Repository
  • 7 Watchers
  • 6 Stars
  • 41,338 Installations
  • PHP
  • 1 Dependents
  • 0 Suggesters
  • 14 Forks
  • 3 Open issues
  • 22 Versions
  • 7 % Grown

The README.md

⚠️WARNING: This client is deprecated⚠️, (*1)

This repository is in Maintenance Mode

We recommend our new partners to use DirectkitJson2 following this example, (*2)

We will keep supporting this repository only for old customers who couldn't migrate to DirectkitJson2 (recommended) or SoapClient:, (*3)

  • we will make only minimum changes to fix small bugs.
  • Big pull-request (which make a lot of changes in the code) will be rejected.

The LemonWay API (called Directkit) has two implementations: DirectkitJson2 and DirectkitXml. There are different ways to call the service depends on the implementation you chose., (*4)

The json format is usually more network-efficient, and simpler to integrate. It is the reason why the DirectkitJson2 is recommended., (*5)

Anyway, if you don't like the json format, you can also send SOAP (XML) requests to the DirectkitXml. There are 3 different ways to call the DirectkitXml:, (*6)

  1. SoapClient: the casual method in PHP to consume any Web Service. It is the simplest way to access to DirectkitXml.
  2. SoapClient SDK: same with the first method, but all the structure of requests / responses are generated overhead with wsdl2phpgenerator
  3. LemonWay SDK: call the web service as a normal http request [curl_init]. The SDK will help you to parse the SOAP response.

We recommend the first method with SoapClient because it is the standard solution in PHP world., (*7)

This example demonstrates the third method. The LemonWay SDK doesn't really have any advantages over other methods (see an opinionated comparisons here). But we will keep maintaining the LemonWay SDK for old customers., (*8)

Lemon Way PHP SDK (This SDK is only used with Direckit XML)

Lemon Way SDK is a PHP client library to work with Lemon Way API., (*9)

Installation with Composer

You can use Lemon Way SDK library as a dependency in your project with Composer (which is the preferred technique). Follow these installation instructions if you do not already have Composer installed. A composer.json file is available in the repository and it has been referenced from Packagist., (*10)

The installation with Composer is easy and reliable:, (*11)

Step 1 - Add the Lemon Way SDK as a dependency by executing the following command:, (*12)

you@yourhost:/path/to/your-project$ composer require lemonway/php-sdk:^1.0

Step 2 - Update your dependencies with Composer, (*13)

you@yourhost:/path/to/your-project$ composer update

Step 3 - Finally, be sure to include the autoloader in your project, (*14)

require_once '/path/to/your-project/vendor/autoload.php';

The Library has been added into your dependencies and is ready to be used., (*15)

Installation without Composer

SDK has been written in PHP 5.4. You should ensure that curl and openssl extensions (that are part of standard PHP distribution) are enabled in your PHP installation., (*16)

The project attempts to comply with PSR-4 specification for autoloading classes from file paths. As a namespace prefix is LemonWay\ with base directory /path/to/your-project/., (*17)

But if you're not using PSR-4 or Composer, the installation is as easy as downloading the library and storing it under any location that will be available for including in your project (don't forget to include the required library dependencies though):, (*18)

    require_once '/path/to/your-project/LemonWay/Autoloader.php';

Contacts

Report bugs or suggest features using issue tracker on GitHub., (*19)

Account creation

You need a sandbox to run Examples., (*20)

Configuration

Using the credentials information from Lemon Way support, you should then set $api->config->wlLogin to your Lemon Way login and $api->config->wlPass to your Lemon Way password., (*21)

require_once '/path/to/your-project/vendor/autoload.php';
$api = new LemonWayAPI();

$api->config->dkUrl = 'Your DirectKitXML url';
$api->config->wkUrl = 'Your WebKit url';
$api->config->wlLogin = 'Your login';
$api->config->wlPass = 'Your password';
$api->config->lang = 'Your language';
//$api->config->isDebugEnabled = true; //Uncomment to turn on debug mode

// call some API methods...
$result = $api->RegisterWallet(...);

Response Object

All LemonWayAPI methods are returning \LemonWay\ApiResponse object. It is a dynamic object with variable properties., (*22)

Fixed properties :

Property Type Description
lwError LemonWay\Models\LwError LwError Object
lwXml SimpleXMLElement Raw xml return as SimpleXMLElement object. Details in Lemon Way API

Variable properties:

Those properties depends of which method was called., (*23)

Property Type Description
wallets array of LemonWay\Models\Wallet Filled when the API returns multiple Wallets
operations array of LemonWay\Models\Operation Filled when the API returns multiple Operations
wallet LemonWay\Models\Wallet Filled when the API returns only one Wallet
operation LemonWay\Models\Operation Filled when the API returns only one Operation
kycDoc LemonWay\Models\KycDoc Filled when the API returns a KycDoc
iban LemonWay\Models\Iban Filled when the API returns an Iban
sddMandate LemonWay\Models\SddMandate Filled when the API returns a SDD Mandate

Sample usage

require_once '/path/to/your-project/vendor/autoload.php';
$api = new LemonWayAPI();

$api->config->dkUrl = 'Your DirectKitXML url';
$api->config->wkUrl = 'Your WebKit url';
$api->config->wlLogin = 'Your login';
$api->config->wlPass = 'Your password';
$api->config->lang = 'Your language';


// call some API methods...
$walletID = 'Fill in with a unique id';
$response = $api->RegisterWallet(array('wallet' => $walletID,
                                        'clientMail' => $walletID.'@mail.fr',
                                        'clientTitle' => Wallet::UNKNOWN,
                                        'clientFirstName' => 'Paul',
                                        'clientLastName' => 'Atreides'));
if (isset($response->lwError)) {
    print 'Error, code '.$response->lwError->CODE.' : '.$response->lwError->MSG;
} else {
    print '<br/>Wallet created : ' . $response->wallet->ID;

    // OR BY USING lwXml :
    print '<br/>Wallet created : ' . $response->lwXml->WALLET->ID;
}

Get started with our examples

In the examples folder, you can find an example for each API method., (*24)

You need to run the examples in a web server with php configured and a hostname different from localhost., (*25)

You also need a sandbox if you want to run examples (contact Lemon Way to create a sandbox), (*26)

An API method / example match table could be find in the Index of examples folder in HTML format and also in MarkDown in the examples folder README.md., (*27)

Configuration

By default, the examples run with our sandbox demo. If you need your own sandbox, please contact Lemon Way then do these configurations. There's two files that handles the examples configuration:, (*28)

File Description
ExamplesDatas Random ID generator, Test card number, Test Iban ...
ExamplesBootstrap API configuration (login, urls ...), API factory, Host configuration

The Versions

12/10 2017

dev-master

9999999-dev https://github.com/lemonwaysas/php-client-directkit-xml

PHP SDK for Lemon Way API

  Sources   Download

MIT

The Requires

  • php >=5.4.0
  • ext-curl *
  • ext-openssl *

 

payment marketplace wallet lemon way lemonway

08/06 2017

1.6.18

1.6.18.0 https://github.com/lemonwaysas/php-client-directkit-xml

PHP SDK for Lemon Way API

  Sources   Download

MIT

The Requires

  • php >=5.4.0
  • ext-curl *
  • ext-openssl *

 

payment marketplace wallet lemon way lemonway

24/05 2017

1.6.17

1.6.17.0 https://github.com/lemonwaysas/php-client-directkit-xml

PHP SDK for Lemon Way API

  Sources   Download

MIT

The Requires

  • php >=5.4.0
  • ext-curl *
  • ext-openssl *

 

payment marketplace wallet lemon way lemonway

22/05 2017

1.6.16

1.6.16.0 https://github.com/lemonwaysas/php-client-directkit-xml

PHP SDK for Lemon Way API

  Sources   Download

MIT

The Requires

  • php >=5.4.0
  • ext-curl *
  • ext-openssl *

 

payment marketplace wallet lemon way lemonway

09/02 2017

1.6.15

1.6.15.0 https://github.com/lemonwaysas/php-client-directkit-xml

PHP SDK for Lemon Way API

  Sources   Download

MIT

The Requires

  • php >=5.4.0
  • ext-curl *
  • ext-openssl *

 

payment marketplace wallet lemon way lemonway

09/02 2017

1.6.14

1.6.14.0 https://github.com/lemonwaysas/php-client-directkit-xml

PHP SDK for Lemon Way API

  Sources   Download

MIT

The Requires

  • php >=5.4.0
  • ext-curl *
  • ext-openssl *

 

payment marketplace wallet lemon way lemonway

30/01 2017

1.6.13

1.6.13.0 https://github.com/lemonwaysas/php-client-directkit-xml

PHP SDK for Lemon Way API

  Sources   Download

MIT

The Requires

  • php >=5.4.0
  • ext-curl *
  • ext-openssl *

 

payment marketplace wallet lemon way lemonway

25/01 2017

1.6.12

1.6.12.0 https://bitbucket.org/usul_/lemonway-php-sdk

PHP SDK for Lemon Way API

  Sources   Download

MIT

The Requires

  • php >=5.4.0
  • ext-curl *
  • ext-openssl *

 

payment marketplace wallet lemon way lemonway

23/01 2017

1.6.11

1.6.11.0 https://bitbucket.org/usul_/lemonway-php-sdk

PHP SDK for Lemon Way API

  Sources   Download

MIT

The Requires

  • php >=5.4.0
  • ext-curl *
  • ext-openssl *

 

payment marketplace wallet lemon way lemonway

03/01 2017

1.6.10

1.6.10.0 https://bitbucket.org/usul_/lemonway-php-sdk

PHP SDK for Lemon Way API

  Sources   Download

MIT

The Requires

  • php >=5.4.0
  • ext-curl *
  • ext-openssl *

 

payment marketplace wallet lemon way lemonway

03/01 2017

1.6.9

1.6.9.0 https://bitbucket.org/usul_/lemonway-php-sdk

PHP SDK for Lemon Way API

  Sources   Download

MIT

The Requires

  • php >=5.4.0
  • ext-curl *
  • ext-openssl *

 

payment marketplace wallet lemon way lemonway

14/12 2016

1.6.8

1.6.8.0 https://bitbucket.org/usul_/lemonway-php-sdk

PHP SDK for Lemon Way API

  Sources   Download

MIT

The Requires

  • php >=5.4.0
  • ext-curl *
  • ext-openssl *

 

payment marketplace wallet lemon way lemonway

13/12 2016

1.6.7

1.6.7.0 https://bitbucket.org/usul_/lemonway-php-sdk

PHP SDK for Lemon Way API

  Sources   Download

MIT

The Requires

  • php >=5.4.0
  • ext-curl *
  • ext-openssl *

 

payment marketplace wallet lemon way lemonway

09/12 2016

1.6.6

1.6.6.0 https://bitbucket.org/usul_/lemonway-php-sdk

PHP SDK for Lemon Way API

  Sources   Download

MIT

The Requires

  • php >=5.4.0
  • ext-curl *
  • ext-openssl *

 

payment marketplace wallet lemon way lemonway

08/12 2016

1.6.5

1.6.5.0 https://bitbucket.org/usul_/lemonway-php-sdk

PHP SDK for Lemon Way API

  Sources   Download

MIT

The Requires

  • php >=5.4.0
  • ext-curl *
  • ext-openssl *

 

payment marketplace wallet lemon way lemonway

29/11 2016

1.6.4

1.6.4.0 https://bitbucket.org/usul_/lemonway-php-sdk

PHP SDK for Lemon Way API

  Sources   Download

MIT

The Requires

  • php >=5.4.0
  • ext-curl *
  • ext-openssl *

 

payment marketplace wallet lemon way lemonway

23/11 2016

1.6.3

1.6.3.0 https://bitbucket.org/usul_/lemonway-php-sdk

PHP SDK for Lemon Way API

  Sources   Download

MIT

The Requires

  • php >=5.4.0
  • ext-curl *
  • ext-openssl *

 

payment marketplace wallet lemon way lemonway

18/10 2016

1.6.2

1.6.2.0 https://bitbucket.org/usul_/lemonway-php-sdk

PHP SDK for Lemon Way API

  Sources   Download

MIT

The Requires

  • php >=5.4.0
  • ext-curl *
  • ext-openssl *

 

payment marketplace wallet lemon way lemonway

10/10 2016

1.6.1

1.6.1.0 https://bitbucket.org/usul_/lemonway-php-sdk

PHP SDK for Lemon Way API

  Sources   Download

MIT

The Requires

  • php >=5.4.0
  • ext-curl *
  • ext-openssl *

 

payment marketplace wallet lemon way lemonway

10/10 2016

1.6

1.6.0.0 https://bitbucket.org/usul_/lemonway-php-sdk

PHP SDK for Lemon Way API

  Sources   Download

MIT

The Requires

  • php >=5.4.0
  • ext-curl *
  • ext-openssl *

 

payment marketplace wallet lemon way lemonway

05/09 2016

1.5

1.5.0.0 https://bitbucket.org/usul_/lemonway-php-sdk

PHP SDK for Lemon Way API

  Sources   Download

MIT

The Requires

  • php >=5.4.0
  • ext-curl *
  • ext-openssl *

 

payment marketplace wallet lemon way lemonway

21/04 2016

1.4

1.4.0.0 https://bitbucket.org/usul_/lemonway-php-sdk

PHP SDK for Lemon Way API

  Sources   Download

MIT

The Requires

  • php >=5.4.0
  • ext-curl *
  • ext-openssl *

 

payment marketplace wallet lemon way lemonway