prestashop / prestashop-accounts-auth
PrestaShop 账户 composer 库
该包的官方仓库似乎已不存在,因此该包已被冻结。
v2.3.1
2021-04-26 10:28 UTC
Requires
- php: >=5.6
- ext-json: *
- guzzlehttp/guzzle: ~5.0
- lcobucci/jwt: ^3.3
- phpseclib/phpseclib: ^2.0
- sentry/sentry: ^1.0
- symfony/dotenv: ^3.4
Requires (Dev)
- friendsofphp/php-cs-fixer: ^2.16
- fzaninotto/faker: ^1.9
- phpunit/phpunit: ^5.7
- prestashop/php-dev-tools: 3.*
- dev-master
- v2.3.1
- v2.3.0
- 2.2.4
- 2.2.3
- 2.2.2
- 2.2.1
- 2.2.0
- 2.1.9
- 2.1.8
- 2.1.7
- v2.1.6
- 2.1.5
- 2.1.4
- 2.1.3
- 2.1.2
- 2.1.1
- 2.1.0
- v2.0.0.x-dev
- 2.0.0
- 1.3.0
- 1.2.0
- 1.1.1
- 1.1.0
- 1.0.0
- v0.0.1
- dev-dependabot/composer/phpseclib/phpseclib-3.0.34
- dev-dependabot/composer/guzzlehttp/guzzle-6.5.8
- dev-dependabot/composer/lcobucci/jwt-3.4.6
- dev-fix/billing_api_link
- dev-feat/add_shopId_context
- dev-fix/update-onboarding-link
- dev-fix/sign-data
- dev-feature/compat-event-bus
- dev-feature/unlink-shop
- dev-fix/evenstore-env
- dev-feature/add-index
- dev-fix/sshKey
- dev-feature/env
- dev-fix/environment
- dev-fix/firebase
- dev-fix/missing-billing-env-var
- dev-ref/billing-exception
- dev-feature/ACCOUNT-306-unit-tests
- dev-feature/ACCOUNT-327-manage-account-link
- dev-feature/312-regenrate-token
- dev-feature/ACCOUNT-91-chargebee-subscription
- dev-fix/prod-vars-env
- dev-refacto/jwtParser
- dev-feature/triggerShopDomainUpdate
This package is auto-updated.
Last update: 2024-05-28 19:09:37 UTC
README
社区服务和 PrestaShop X 模块
要作为社区服务或 PrestaShop X 运行,模块需要三个部分
module ps_accounts
- 包含所有控制器
library npm
- 包含所有用于管理的 vuejs 组件
library composer
- 包装所有对 ps_accounts 的调用
- 包含所有 Firebase 逻辑
安装
composer require prestashop/prestashop-accounts-auth
使用
每个 PrestaShop X 模块都需要安装 ps_accounts 模块才能进行入门流程。PrestaShop X 模块需要在它们的 install() 方法中安装 ps_accounts。为了简化这一过程,我们为您创建了一个处理方法。
(new PrestaShop\AccountsAuth\Installer\Install())->installPsAccounts()
例如:您需要在模块的主类中的 install() 方法中调用上述方法。
/** * Function executed at the install of the module * * @return bool */ public function install() { return (new PrestaShop\AccountsAuth\Installer\Install())->installPsAccounts() && parent::install(); }
在您的 PrestaShop X 或社区服务模块中
- 在模块的控制器和/或主类中,获取入门表示器并转到 viewsjs 组件 所使用的视图。
$psAccountPresenter = new PrestaShop\AccountsAuth\Presenter\PsAccountsPresenter($this->name); Media::addJsDef([ 'contextPsAccounts' => $psAccountPresenter->present(), ]);
$psAccountPresenter 的格式为
[
'psIs17' => bool,
'psAccountsInstallLink' => null|string,
'psAccountsEnableLink' => null|string,
'onboardingLink' => string,
'user' => [
'email' => null|string,
'emailIsValidated' => bool,
'isSuperAdmin' => bool,
],
'currentShop' => [
'id' => string,
'name' => string,
'domain' => string,
'domainSsl' => string,
'url' => string,
],
'shops' => [],
'firebaseRefreshToken' => null|string,
'superAdminEmail' => string,
'ssoResendVerificationEmail' => string,
];
账单
此库还提供 PrestaShop 账单功能和助手,以便您的模块可以调用 PrestaShop 账单 API。
注意:要调用账单 API,您需要首先入门商店。
入门后订阅免费计划
入门成功后,您可能需要将您的商家注册到基础账单计划(如果您有多个服务级别,则基础计划可能是免费的)。让它进行。
$billingService = new \PrestaShop\AccountsAuth\Service\PsBillingService(); $shopId = false; // Set this ID to the current shop in multishop context. False otherwise. $ip = null; // Set this to the browser IP (the call is made from the backoffice by the merchant). $result = $billingService->subscribeToFreePlan('<your_module>', '<your_basic_plan>', $shopId, $ip);
结果将显示这些 ID
[
'shopAccountId' => '<The PS Accounts shop ID, set after onboarding>',
'customerId' => '<The PS Billing customer ID, linked to shop account>',
'subscriptionId' => '<The subscription ID of the given plan>'
]
或如果出现错误,将抛出 \Exception 异常。
- 代码
10:'商店账户未知'。商店尚未完全进入 PS 账户流程。 - 代码
20:'订阅计划名称不匹配'。提供的计划不匹配可用的计划。 - 代码
50:'账单客户请求失败'。无法执行 API 调用。 - 代码
51:'账单订阅请求失败'。无法执行 API 调用。 - 代码
60:'账单客户创建失败'。无法创建账单客户。 - 代码
65:'账单订阅创建失败'。无法创建账单订阅。
测试
运行 php-cs-fixer
php vendor/bin/php-cs-fixer fix
运行 phpstan for prestashop 1.6.1.0
git@github.com:PrestaShopCorp/prestashop_accounts_auth.git path/to/clone docker run -tid --rm -v ps-volume:/var/www/html --name temp-ps prestashop/prestashop:1.6.1.0; docker run --rm --volumes-from temp-ps -v $PWD:/web/module -v path/to/clone:/web/ps_accounts -e _PS_ROOT_DIR_=/var/www/html --workdir=/web/module phpstan/phpstan:0.12 analyse --configuration=/web/module/tests/phpstan/phpstan-PS-1.6.neon
运行 phpstan for prestashop 1.7.0.3
git@github.com:PrestaShopCorp/prestashop_accounts_auth.git path/to/clone docker run -tid --rm -v ps-volume:/var/www/html --name temp-ps prestashop/prestashop:1.7.0.3; docker run --rm --volumes-from temp-ps -v $PWD:/web/module -v path/to/clone:/web/ps_accounts -e _PS_ROOT_DIR_=/var/www/html --workdir=/web/module phpstan/phpstan:0.12 analyse --configuration=/web/module/tests/phpstan/phpstan-PS-1.7.neon