@commercetools/connect-payments-sdk 0.18.0 → 0.18.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/dist/api/hooks/session-header-auth.hook.js +2 -0
- package/dist/api/hooks/session-query-param-auth.hook.js +2 -0
- package/dist/commercetools/services/ct-session.service.d.ts +1 -0
- package/dist/commercetools/services/ct-session.service.js +3 -0
- package/dist/commercetools/types/session.type.d.ts +1 -0
- package/dist/security/authn/session-header-authn-manager.js +1 -0
- package/dist/security/authn/types/authn.type.d.ts +1 -0
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -16,8 +16,10 @@ class SessionHeaderAuthenticationHook {
|
|
|
16
16
|
return async (request) => {
|
|
17
17
|
const sessionIdAuthn = new security_1.HeaderBasedAuthentication(request.headers['x-session-id']);
|
|
18
18
|
const authn = await this.authenticationManager.authenticate(sessionIdAuthn);
|
|
19
|
+
const correlationId = authn.getPrincipal().correlationId;
|
|
19
20
|
this.contextProvider.updateContextData({
|
|
20
21
|
authentication: authn,
|
|
22
|
+
...(correlationId && { correlationId }),
|
|
21
23
|
});
|
|
22
24
|
};
|
|
23
25
|
}
|
|
@@ -16,8 +16,10 @@ class SessionQueryParamAuthenticationHook {
|
|
|
16
16
|
return async (request) => {
|
|
17
17
|
const sessionIdAuthn = new security_1.QueryParamBasedAuthentication(request.query['ctsid']);
|
|
18
18
|
const authn = await this.authenticationManager.authenticate(sessionIdAuthn);
|
|
19
|
+
const correlationId = authn.getPrincipal().correlationId;
|
|
19
20
|
this.contextProvider.updateContextData({
|
|
20
21
|
authentication: authn,
|
|
22
|
+
...(correlationId && { correlationId }),
|
|
21
23
|
});
|
|
22
24
|
};
|
|
23
25
|
}
|
|
@@ -22,5 +22,6 @@ export declare class DefaultSessionService implements SessionService {
|
|
|
22
22
|
getMerchantReturnUrlFromSession(session: Session): string | undefined;
|
|
23
23
|
getFutureOrderNumberFromSession(session: Session): string | undefined;
|
|
24
24
|
getGiftCardPlannedAmountFromSession(session: Session): Money | undefined;
|
|
25
|
+
getCorrelationIdFromSession(session: Session): string | undefined;
|
|
25
26
|
private getSession;
|
|
26
27
|
}
|
|
@@ -78,6 +78,9 @@ class DefaultSessionService {
|
|
|
78
78
|
getGiftCardPlannedAmountFromSession(session) {
|
|
79
79
|
return session.metadata?.giftCardPlannedAmount;
|
|
80
80
|
}
|
|
81
|
+
getCorrelationIdFromSession(session) {
|
|
82
|
+
return session.metadata?.correlationId;
|
|
83
|
+
}
|
|
81
84
|
async getSession(sessionId) {
|
|
82
85
|
return await fetch(`${this.sessionUrl}/${this.projectKey}/sessions/${sessionId}`, {
|
|
83
86
|
method: 'GET',
|
|
@@ -31,4 +31,5 @@ export interface SessionService {
|
|
|
31
31
|
getMerchantReturnUrlFromSession(session: Session): string | undefined;
|
|
32
32
|
getFutureOrderNumberFromSession(session: Session): string | undefined;
|
|
33
33
|
getGiftCardPlannedAmountFromSession(session: Session): Money | undefined;
|
|
34
|
+
getCorrelationIdFromSession(session: Session): string | undefined;
|
|
34
35
|
}
|
|
@@ -22,6 +22,7 @@ class SessionHeaderAuthenticationManager {
|
|
|
22
22
|
merchantReturnUrl: this.sessionService.getMerchantReturnUrlFromSession(session),
|
|
23
23
|
futureOrderNumber: this.sessionService.getFutureOrderNumberFromSession(session),
|
|
24
24
|
giftCardPlannedAmount: this.sessionService.getGiftCardPlannedAmountFromSession(session),
|
|
25
|
+
correlationId: this.sessionService.getCorrelationIdFromSession(session),
|
|
25
26
|
});
|
|
26
27
|
}
|
|
27
28
|
catch (e) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@commercetools/connect-payments-sdk",
|
|
3
|
-
"version": "0.18.
|
|
3
|
+
"version": "0.18.1",
|
|
4
4
|
"description": "Payment SDK for commercetools payment connectors",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
],
|
|
16
16
|
"license": "ISC",
|
|
17
17
|
"dependencies": {
|
|
18
|
-
"@commercetools-backend/loggers": "22.39.
|
|
18
|
+
"@commercetools-backend/loggers": "22.39.1",
|
|
19
19
|
"@commercetools/platform-sdk": "8.1.0",
|
|
20
20
|
"@commercetools/sdk-client-v2": "2.5.0",
|
|
21
21
|
"jsonwebtoken": "9.0.2",
|