@commercetools/connect-payments-sdk 0.10.0 → 0.11.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,17 @@
1
1
  # @commercetools/connect-payments-sdk
2
2
 
3
+ ## 0.11.0
4
+
5
+ ### Minor Changes
6
+
7
+ - bb40dbd: Add support for retrieving the future order number from the session
8
+
9
+ ## 0.10.1
10
+
11
+ ### Patch Changes
12
+
13
+ - c93e2aa: Fixed issue retrieving error information from commercetools API errors
14
+
3
15
  ## 0.10.0
4
16
 
5
17
  ### Minor Changes
@@ -1,9 +1,10 @@
1
1
  import { Errorx } from '../../errorx/errorx';
2
2
  export type CocoErrorType = {
3
3
  body?: {
4
- code?: string;
5
4
  message?: string;
6
- errors?: object[];
5
+ errors?: {
6
+ [key: string]: any;
7
+ }[];
7
8
  };
8
9
  statusCode: number;
9
10
  message?: string;
@@ -5,7 +5,7 @@ const errorx_1 = require("../../errorx/errorx");
5
5
  class CommercetoolsAPIError extends errorx_1.Errorx {
6
6
  constructor(err) {
7
7
  super({
8
- code: err.body?.code ?? 'CommercetoolsAPIError',
8
+ code: err.body?.errors?.[0]?.code ?? 'CommercetoolsAPIError',
9
9
  message: err?.body?.message ?? err?.message ?? '',
10
10
  httpErrorStatus: err.statusCode,
11
11
  cause: err,
@@ -19,5 +19,6 @@ export declare class DefaultSessionService implements SessionService {
19
19
  getProcessorUrlFromSession(session: Session): string;
20
20
  getPaymentInterfaceFromSession(session: Session): string | undefined;
21
21
  getMerchantReturnUrlFromSession(session: Session): string | undefined;
22
+ getFutureOrderNumberFromSession(session: Session): string | undefined;
22
23
  private getSession;
23
24
  }
@@ -72,6 +72,9 @@ class DefaultSessionService {
72
72
  getMerchantReturnUrlFromSession(session) {
73
73
  return session.metadata?.merchantReturnUrl;
74
74
  }
75
+ getFutureOrderNumberFromSession(session) {
76
+ return session.metadata?.futureOrderNumber;
77
+ }
75
78
  async getSession(sessionId) {
76
79
  return await fetch(`${this.sessionUrl}/${this.projectKey}/sessions/${sessionId}`, {
77
80
  method: 'GET',
@@ -28,4 +28,5 @@ export interface SessionService {
28
28
  getProcessorUrlFromSession(session: Session): string;
29
29
  getPaymentInterfaceFromSession(session: Session): string | undefined;
30
30
  getMerchantReturnUrlFromSession(session: Session): string | undefined;
31
+ getFutureOrderNumberFromSession(session: Session): string | undefined;
31
32
  }
@@ -20,6 +20,7 @@ class SessionHeaderAuthenticationManager {
20
20
  processorUrl: this.sessionService.getProcessorUrlFromSession(session),
21
21
  paymentInterface: this.sessionService.getPaymentInterfaceFromSession(session),
22
22
  merchantReturnUrl: this.sessionService.getMerchantReturnUrlFromSession(session),
23
+ futureOrderNumber: this.sessionService.getFutureOrderNumberFromSession(session),
23
24
  });
24
25
  }
25
26
  catch (e) {
@@ -20,6 +20,7 @@ class SessionQueryParamAuthenticationManager {
20
20
  processorUrl: this.sessionService.getProcessorUrlFromSession(session),
21
21
  paymentInterface: this.sessionService.getPaymentInterfaceFromSession(session),
22
22
  merchantReturnUrl: this.sessionService.getMerchantReturnUrlFromSession(session),
23
+ futureOrderNumber: this.sessionService.getFutureOrderNumberFromSession(session),
23
24
  });
24
25
  }
25
26
  catch (e) {
@@ -21,6 +21,7 @@ export type SessionPrincipal = {
21
21
  processorUrl: string;
22
22
  paymentInterface?: string;
23
23
  merchantReturnUrl?: string;
24
+ futureOrderNumber?: string;
24
25
  };
25
26
  export type Oauth2Principal = {
26
27
  clientId: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@commercetools/connect-payments-sdk",
3
- "version": "0.10.0",
3
+ "version": "0.11.0",
4
4
  "description": "Payment SDK for commercetools payment connectors",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -15,8 +15,8 @@
15
15
  ],
16
16
  "license": "ISC",
17
17
  "dependencies": {
18
- "@commercetools-backend/loggers": "22.32.2",
19
- "@commercetools/platform-sdk": "7.14.0",
18
+ "@commercetools-backend/loggers": "22.35.0",
19
+ "@commercetools/platform-sdk": "7.18.0",
20
20
  "@commercetools/sdk-client-v2": "2.5.0",
21
21
  "jsonwebtoken": "9.0.2",
22
22
  "jwks-rsa": "3.1.0",