hryvinskyi / magento2-gdpr-vault
Saved payment methods and persistent sessions provider for the Hryvinskyi data subject rights module: exports the masked token list and deletes the tokens and the persistent session of a customer
Package info
github.com/hryvinskyi/magento2-gdpr-vault
Type:magento2-module
pkg:composer/hryvinskyi/magento2-gdpr-vault
Requires
- php: ~8.3.0||~8.4.0||~8.5.0
- hryvinskyi/magento2-gdpr: ^1.0
- hryvinskyi/magento2-gdpr-api: ^1.0
- magento/framework: *
- magento/module-customer: *
- magento/module-persistent: *
- magento/module-store: *
- magento/module-vault: *
Requires (Dev)
None
Suggests
None
Provides
None
Conflicts
None
Replaces
None
README
Adds the saved payment tokens and the persistent shopping session of a customer account to the data-subject requests of hryvinskyi/magento2-gdpr. It contributes through di.xml only. The engine never names this package.
What it does for a store
- Which rows a subject covers. Every vault payment token of a customer subject's account, oldest first, active or not and visible or not, and the account's persistent session, expired or not. A guest subject covers none, even when an account has its e-mail address: a guest's token carries no e-mail address.
- Export, saved payment methods. One section,
payment_token, lists each token's payment method code, its kind (cardoraccount), the card type, the masked card number and the card's expiry from the token's details, whether the token is active and shown, and the dates it was created and expires. The gateway's token and the token's public hash are never exported. Of the token's details only the three masked card fields are copied, so a field a gateway adds is left out. - Export, persistent session. One section,
persistent_session, lists the time the session was last updated and the name of its website. The session's cookie key and stored data are never exported. - Delete only. An erase deletes the account's tokens and its persistent session and keeps the account. A token and a session have no anonymous form, so there is no anonymiser and an
anonymiserequest deletes both too. Deleting a token also removes its link to the order payments that used it. The orders keep their payment record.
Requirements
- Magento Open Source or Adobe Commerce 2.4.8 or 2.4.9, PHP 8.3 to 8.5.
hryvinskyi/magento2-gdpr-api^1.0 andhryvinskyi/magento2-gdpr^1.0.- The platform's Customer, Persistent, Store and Vault modules.
Installation
Run from the Magento root. hryvinskyi/magento2-gdpr-pack installs this package with the rest of the suite.
composer require hryvinskyi/magento2-gdpr-vault
bin/magento module:enable Hryvinskyi_GdprApi Hryvinskyi_Clock Hryvinskyi_RateLimit Hryvinskyi_DocumentExport Hryvinskyi_Logger Hryvinskyi_Gdpr Hryvinskyi_GdprVault
bin/magento setup:upgrade
bin/magento setup:di:compile # production mode only
bin/magento cache:flush
Verify with a dry-run plan for a customer who saved a card. It changes nothing.
bin/magento gdpr:erase --customer-id=<customer_id> --dry-run
The output lists payment_token and persistent_session with delete and the number of rows.
Configuration
None of its own. The entity codes are payment_token (sort order 650) and persistent_session (sort order 660). Their method is always delete, and neither has a field to anonymise. The core's erasure rules need no entry for them.
Stored data
The package creates no table. It reads and deletes rows of vault_payment_token and persistent_session.
Limits
- Only a customer account has tokens and a persistent session the module reaches. A guest request touches none.
- A payment gateway keeps its own record of the card behind a token. Deleting the token in the store does not delete that record: the store's operator removes it through the gateway.
- A deleted token cannot be restored. The customer saves the card again at the next checkout.
Registrations
| Where | What |
|---|---|
providers of Hryvinskyi\Gdpr\Model\Entity\EntityProviderPool |
payment_token, Hryvinskyi\GdprVault\Model\Provider\PaymentTokenProvider |
providers of Hryvinskyi\Gdpr\Model\Entity\EntityProviderPool |
persistent_session, Hryvinskyi\GdprVault\Model\Provider\PersistentSessionProvider |
The package registers no route, command, cron job, event, plugin or preference.
Extension point
None of its own. Each provider sets its anonymiser argument to null to say anonymisation is not supported. The core's README shows how another module adds its own entity provider.
Tests
Run from the Magento root.
- Unit:
vendor/bin/phpunit -c app/code/Hryvinskyi/GdprVault/phpunit.xml.dist. The package's rules are proved against a real database, so the unit suite holds no test. - Integration: the platform's harness in
dev/tests/integration, against its own database, one run at a time.cd dev/tests/integration && php -d memory_limit=4G ../../../vendor/bin/phpunit -c phpunit.xml ../../../app/code/Hryvinskyi/GdprVault/Test/Integration. - Static analysis: PHPStan 2.x at level 10 with the package's
phpstan.neon.dist(phpstan analyse -c app/code/Hryvinskyi/GdprVault/phpstan.neon.dist --level=10), andvendor/bin/phpcs --standard=app/code/Hryvinskyi/GdprVault/phpcs.xml.dist app/code/Hryvinskyi/GdprVault.
Translations
The labels the package shows in exports ship in en_US and 25 more locales: the official languages of the European Union, Norwegian Bokmål and Ukrainian. The translations are machine-made; have them read by a native speaker before a store relies on them, and override a phrase in a theme or a language pack.