@commercetools/connect-payments-sdk 0.1.0 → 0.2.0

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 CHANGED
@@ -1,5 +1,11 @@
1
1
  # @commercetools/connect-payments-sdk
2
2
 
3
+ ## 0.2.0
4
+
5
+ ### Minor Changes
6
+
7
+ - cdeb0af: allow to retrieve processor URL from the session
8
+
3
9
  ## 0.1.0
4
10
 
5
11
  ### Minor Changes
@@ -13,5 +13,6 @@ export declare class DefaultSessionService implements SessionService {
13
13
  verifySession(sessionId: string): Promise<Session>;
14
14
  getCartFromSession(session: Session): string;
15
15
  getAllowedPaymentMethodsFromSession(session: Session): string[];
16
+ getProcessorUrlFromSession(session: Session): string;
16
17
  getPaymentInterfaceFromSession(session: Session): string | undefined;
17
18
  }
@@ -41,6 +41,9 @@ class DefaultSessionService {
41
41
  getAllowedPaymentMethodsFromSession(session) {
42
42
  return session.metadata?.allowedPaymentMethods || [];
43
43
  }
44
+ getProcessorUrlFromSession(session) {
45
+ return session.metadata?.processorUrl;
46
+ }
44
47
  getPaymentInterfaceFromSession(session) {
45
48
  return session.metadata?.paymentInterface;
46
49
  }
@@ -25,5 +25,6 @@ export interface SessionService {
25
25
  verifySession(sessionId: string): Promise<Session>;
26
26
  getCartFromSession(session: Session): string;
27
27
  getAllowedPaymentMethodsFromSession(session: Session): string[];
28
+ getProcessorUrlFromSession(session: Session): string;
28
29
  getPaymentInterfaceFromSession(session: Session): string | undefined;
29
30
  }
@@ -15,6 +15,7 @@ class SessionAuthenticationManager {
15
15
  return new authns_1.SessionAuthentication(principal.authHeader, {
16
16
  cartId: this.sessionService.getCartFromSession(session),
17
17
  allowedPaymentMethods: this.sessionService.getAllowedPaymentMethodsFromSession(session),
18
+ processorUrl: this.sessionService.getProcessorUrlFromSession(session),
18
19
  paymentInterface: this.sessionService.getPaymentInterfaceFromSession(session),
19
20
  });
20
21
  }
@@ -15,6 +15,7 @@ export type HeaderPrincipal = {
15
15
  export type SessionPrincipal = {
16
16
  cartId: string;
17
17
  allowedPaymentMethods: string[];
18
+ processorUrl: string;
18
19
  paymentInterface?: string;
19
20
  };
20
21
  export type Oauth2Principal = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@commercetools/connect-payments-sdk",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "Payment SDK for commercetools payment connectors",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",