No description
Find a file
Jérémy Munsch 70043b227c 3.0.3
-----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEENM6P8RR0Fd/BNUDJGDYa87/sD+wFAmKhvFAACgkQGDYa87/s
 D+w6XBAAo0HaUUi2ArCO6VnQQfMmSIFhF2cr1ZT5CcG8quK19AdWrjwwanyx9ood
 r55GOjKHF2g/Hs5bg63xiKsDsMs93ZZks8RmpktMb50YSCnRQraOZ9dWQG/dIn2V
 VvUISrcqFFMiAObcKyzfzTWhQaFpPz3oBf9tf52zf7ZM61DrwfA4xCItGA/3hQmx
 aQleMOkRX3vSphYraSqLwpENWXQYEJKmgGCTr0Pq8KMfsOYRO6+JXwGjQVQuFXtL
 uHvCTsUVxw9UYpzA/PqoUu++nhDbKCWjDiUaOLeNmXdMTN9n4TK+7fstDWpLZ83q
 GgxTcQt4ES7S/cqZ5WFW9whDQUqoywjNokPKjJfZ0BF6hpPvMMI0EBkdZiI5X7uP
 E1d2mhbzmJXu0LOnMEyqeU6bbeVSdm3F1CNjoN68wLgGHhZ2zt2zoEMbkJZUya7i
 jjl0dRj7wXRE8VRcheixQ/AWCAyORs0c+nigQsk/dWpxHT0dyBlmn0fvt9SleWB9
 hYVy/DDTxNstV0OHNiLNnU6SfSEPKCxt7B5tBw/cCJHo5go0kFYRpC7ka8G67+M1
 /WV+1u2ZdoyQQCxD+fjuWXAGZVSC+SAa6JjdyItDhZzLzZp5IjU+rCDPjYetf0sZ
 cU33khcpfdLtYYlfBYhBOVm2/zz1S4MtGYUV/jmpPJuRQA0r4yQ=
 =fTMB
 -----END PGP SIGNATURE-----
gpgsig -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEENM6P8RR0Fd/BNUDJGDYa87/sD+wFAmKsj9wACgkQGDYa87/s
 D+y2IQ//TmkewKBjKXh3GVIwCN8yghM2ARLgYSvJAIqE4akBDyd8dAT0akY691JN
 3OfEBKJBQD+Ml1+gZq1vRVTxyYvfiJPl/LcuUzv2RL0MwdQ53wDH7VKXauOtr3yY
 r57RAYEHuYKRXPVHIoyg2vvy+snLZtiV8mhLY1zYav1AC4hYVlyuQ07AcCIipsT8
 K0ZRhjk2Z/2rLWa3uZoEaQN4AsD9w5Fqum+TctMKvhHhZ+Wp0x9gUa2SRgFbXvHo
 tSHblRU1svCAEK3bE43McPvYq2rndKwGJDFeWI7EfaKjZOWzaMRfISz0KeFgZ26E
 08d3rQA9TbV4YckUPOKF5Lj21UYY3MHIUuTC/MBSofcgMhYSHgNPwLjxBCOhlzv/
 ycZUFlVUIrc1H4Fw9JgHLTdqmu8BnDc5gJpuEK4bycsxKDKmGtMRnY/fVd2w3GxZ
 /UlS2WSbYBtjl7EFTIWHTG95Ns2+5qs86w40kwVCJDDspwoEM9U6nJhULAwbmCgj
 Nw32s/+D/eojBlS6LOLPWBS5LUGUagFzBMoaanHCqtow3ivJ4fwA6pdCF3Ks9thg
 QzboJNOQ7osBU4Fw1WXqf9KCyu/o95q43iEz1eoicIonucfdHdWTZHuNUfAjdCGk
 Jd4kXkd75toobxaFM5yf0UXI2VltMpG5KwBhRXmrw7EOMSJHoGk=
 =jR9h
 -----END PGP SIGNATURE-----

Merge tag '3.0.3'

3.0.3
2022-06-17 16:29:47 +02:00
.vscode init 2021-07-22 16:50:30 +02:00
docs API V3 UPDATE 2021-12-31 17:00:55 +01:00
documentation - update comments to be user friendly 2022-02-23 11:33:20 +01:00
examples API V3 UPDATE 2021-12-31 17:00:55 +01:00
resources/lang password validation with translations for fields validations 2021-08-17 11:03:05 +02:00
src client generate 2022-06-09 11:14:02 +02:00
.editorconfig init 2021-07-22 16:50:30 +02:00
.env.default V2 Working client with some documentation 2021-08-09 09:18:46 +02:00
.gitignore API V3 UPDATE 2021-12-31 17:00:55 +01:00
.gitkeep init 2021-07-22 16:50:30 +02:00
apiConfig.readonly.json client generate 2022-06-09 11:14:02 +02:00
changelog.md Bumper composer deps 2022-06-09 11:21:42 +02:00
composer.json Bumper composer deps 2022-06-09 11:21:42 +02:00
composer.lock Bumper composer deps 2022-06-09 11:21:42 +02:00
license.md init 2021-07-22 16:50:30 +02:00
phpcs.xml API V3 UPDATE 2021-12-31 17:00:55 +01:00
phpdoc.dist.xml V 2.0.1 PHP DOC 2021-08-11 17:36:59 +02:00
readme.md API V3 UPDATE 2021-12-31 17:00:55 +01:00

LDC CRM api

Api client for CRM V2

Client version must match CRM version !!

Installation

Multiple ways are possible. You may include the client directly into your project using composer. You will need to have access to this repos. If you read this it may already be the case. So using composer update or composer require ldc/ldccrmv2client should be enough.

This has few dependencies it may not interfer with your project.

"ext-curl": "^7.3",
"php": "^7.3",
"kwaadpepper/enum": "^2.1",
"guzzlehttp/guzzle": "^7.4",
"respect/validation": "^2.2"

Usage

As for initialisation multiple ways are possible. If you are in a laravel project you can map a singleton of the crm api.

Using Laravel

  1. Setup config/crm.php

     <?php
    
     return [
         'endpoint' => 'https://ldc-crm.ldc.fr',
         'token' => 'YOUR_API_TOKEN',
         'password' => 'YOUR_API_PASSWORD'
     ];
    
  2. Make a crm singleton if needed (optional)

     // In AppServiceProvider.php
     App::singleton('CrmApiV2', function () {
         return new CrmApiV2();
     });
    
     // You then like this.
     /** @var \LDC\LDCCRM\CrmApiV2 $crmApi */
     $crmApi = app('CrmApiV2);
    
     // Or directly use static methods.
     /** @var \LDC\LDCCRM\Models\Customer|null $customer */
     $customer = Customer::find('UUID');
    

Using any other project

Setup once the main class (it is already a singleton, no need to manage it).

Informations will be kept in memory as static meaning all instance of CrmApiV2 or any class (Customer, ..) will share the same informations as credentials.

$crmToken    = 'YOUR_API_TOKEN';
$crmPassword = 'YOUR_API_PASSWORD';

// This has to hapen once. It will be kept in memory;
new CrmApiV2('https://ldc-crm.ldc.fr', $crmToken, $crmPassword);

Using Wordpress

We created as experimental some wordpress classes. It will handle locale storage (in sql database) and sessions using start session. Some security is provided with a settion time out of 15 minutes. A fingerprint is set using the user agent and remote_ip. These cannot be trusted and it wont prevent a replay attack though. Usefull to point out that you make not use this without ssl (https) connection.

The usage is that same as for setting up for any other project, bu instead you can make usage of class in the LDC\LDCCRM\WordPress namespace.

Note: using methods from classes in this namespace will call php session_start if it has not started yet

// If true from here; user session is set and will be remembered until timeout or WPCRM::logout.
$status = WPCRM::login('customer@email.com', 'password');

Using custom implementation and calling directly CRM

You may implement your own call to fit your needs. If you wish to go this way please read these instructions.

More information

Customer Informations

The CRM will store multiple informations about your customer. Of course you can contact us if there is a RGPD demand to access or suppress information. Also we store the following informations as for now :

  • last connection
  • password
  • email
  • first name
  • last name
  • birth date
  • address
  • phone
  • country
  • city
  • postcode
  • opt in status and history
  • question answers

Password is stored as hashed using strong algorithm and a secret key, no logs are done while authenticating your customer other than the connection date if auth is successful

You may also note that every customer has a HASHCODE, this is the ID of your customer and has to be stored on your side. But even if you don't you can always identify your customers using it's email.

Minimal informations you may keep are :

  • hashcode
  • email

Change log

Please see the changelog for more information on what has changed recently.

Testing

All unit test are included in the crm source code, meaning you do not have access to them. If you wish you can override any source code, write your own test, but data will still be validated on crm side.

Credits

License

MIT. Please see the license file for more information.