Skip to content

Commit a268a7e

Browse files
feat: introduce consumer data endpoint and remove deprecated anonymous data methods
1 parent 5c36dba commit a268a7e

File tree

7 files changed

+100
-514
lines changed

7 files changed

+100
-514
lines changed

CHANGELOG.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,20 @@
1+
## [1.3.0](https://github.com/trustedshops-public/cot-php-integration-library/compare/1.2.2...1.3.0) (2025-01-XX)
2+
3+
4+
### Features
5+
6+
* Replace anonymous endpoint with new consumer data endpoint ([#XX](https://github.com/trustedshops-public/cot-php-integration-library/issues/XX))
7+
* Add new `ConsumerData` class with firstName, membershipStatus, and membershipSince fields
8+
* Add new `getConsumerData()` method to replace `getAnonymousConsumerData()`
9+
* Update endpoint from `anonymous-data` to `consumer-data`
10+
* Update examples and documentation to use new consumer data endpoint
11+
12+
### Breaking Changes
13+
14+
* Remove deprecated `getAnonymousConsumerData()` method
15+
* Remove deprecated `AnonymousConsumerData` class
16+
* Remove deprecated anonymous endpoint constants
17+
118
## [1.2.2](https://github.com/trustedshops-public/cot-php-integration-library/compare/1.2.1...1.2.2) (2025-07-02)
219

320

README.md

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,15 @@ $client = new Client(
4343
// Invoke handleCallback function to handle code coming from the authentication server
4444
$client->handleCallback();
4545

46-
// Get anonymous consumer data for the current user
47-
$client->getAnonymousConsumerData();
46+
// Get consumer data for the current user
47+
$consumerData = $client->getConsumerData();
48+
49+
// Access consumer information
50+
if ($consumerData) {
51+
$firstName = $consumerData->getFirstName();
52+
$membershipStatus = $consumerData->getMembershipStatus();
53+
$membershipSince = $consumerData->getMembershipSince();
54+
}
4855
```
4956

5057
On the frontend side, place the following code in your HTML file where you want the widget to appear:

examples/prestashop/trstdexampleintegration/trstdexampleintegration.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,11 +79,11 @@ public function hookDisplayFooter(array $params)
7979
// Handle the OAuth2 callback
8080
$this->cotAuthClient->handleCallback();
8181

82-
// Get the anonymous consumer data
83-
$anonymousConsumerData = $this->cotAuthClient->getAnonymousConsumerData();
82+
// Get the consumer data
83+
$consumerData = $this->cotAuthClient->getConsumerData();
8484

8585
$this->smarty->assign([
86-
'anonymousConsumerData' => $anonymousConsumerData
86+
'consumerData' => $consumerData
8787
]);
8888

8989
return $this->fetch('module:trstdexampleintegration/views/templates/front/consumerdata.tpl');
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
{$anonymousConsumerData|@json_encode nofilter}
1+
{$consumerData|@json_encode nofilter}

0 commit comments

Comments
 (0)