Skip to content

PrestaShopCorp/ps_accounts

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

127 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PrestaShop Account module

Source Code Latest Version Software License Build Status

Context

The module ps_accounts is the interface between your module and PrestaShop's services. It manages:

  • Shop Identification and Verification process;
  • Providing tokens to communicate safely with PrestaShop services;
  • Synchronize basic informations about the shops (ex: shop URLs, name, ...).

This module is a base component for other modules using PrestaShop services.

Installation

If you need to install and test the module, you can download the desired zip here.

Compatibility Matrix

We aims to follow partially the Prestashop compatibility charts

ps_accounts version Prestashop Version PHP Version
^8.0.0 >=1.6 && <= 9.x PHP 5.6 - 8
^7.0.9 >=1.6 && <= 9.x PHP 5.6 - 8
7.x >=1.6 && <9.x PHP 5.6 - 8
6.x (deprecated) >=8.0.0 PHP 7.2 - 8
5.x (deprecated) >=1.6 && <8.0.0 PHP 5.6 - 7.4

Integration along with your Prestashop module

If you are integrating a module, you should have a look on the PrestaShop Integration Framework Documentation.

A preliminary note about PrestaShop modules ecosystem :

You should keep in mind that the PrestaShop Core

  • doesn't manage dependencies between modules;
  • doesn't manage composer dependencies globally.

As a consequence you MUST

  • check by yourself that the PsAccounts module is installed;
  • ensure your vendor dependencies won't collide with existing ones.
    (loaded by other modules OR coming from the PrestaShop Core)

Tokens availability with legacy compatibility table

Method Name PrestaShop AccessToken Scopes Legacy
Firebase Shop Id Token
Legacy
Firebase User Id Token
>= v8.0.0
isShopIdentityCreated Yes Yes No
isShopIdentityVerified Yes shop.verified Yes No
isShopPointOfContactSet Yes shop.verified Yes Yes
< v8.0.0
isAccountLinked Yes shop.verified Yes Yes

How to get up-to-date JWT Shop Access Tokens

// /!\ TODO: Starting here you are responsible to check that the module is installed

/** @var Ps_accounts $module */
$module = \Module::getModuleIdByName('ps_accounts');

/** @var \PrestaShop\Module\PsAccounts\Service\PsAccountsService $service */
$service = $module->getService(\PrestaShop\Module\PsAccounts\Service\PsAccountsService::class);

try {
    $jwtAccessToken = $service->getShopToken();
} catch (\PrestaShop\Module\PsAccounts\Account\Exception\RefreshTokenException $e) {
    // 
}

How to get up-to-date (legacy) JWT Tokens

// /!\ TODO: Starting here you are responsible to check that the module is installed

/** @var Ps_accounts $module */
$module = \Module::getModuleIdByName('ps_accounts');

/** @var \PrestaShop\Module\PsAccounts\Service\PsAccountsService $service */
$service = $module->getService(\PrestaShop\Module\PsAccounts\Service\PsAccountsService::class);

// With this one you can call your API's as the PrestaShop Account Shop
$jwtShop = $service->getOrRefreshToken();

// With this one you can call your API's as the PrestaShop Account Shop Owner
$jwtOwner = $service->getUserToken();

Building the module locally

In case you need to build a zip by yourself :

  cp config.dist.php config.php
  make

OR with multiple environments :

  cp config.dist.php config.myenv.php
  BUNDLE_ENV=myenv make