@commercetools/connect-payments-sdk 0.10.1 → 0.12.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.12.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 6201192: enable retries on commercetools SDK for 503 errors
8
+
9
+ ## 0.11.0
10
+
11
+ ### Minor Changes
12
+
13
+ - bb40dbd: Add support for retrieving the future order number from the session
14
+
3
15
  ## 0.10.1
4
16
 
5
17
  ### Patch Changes
@@ -33,6 +33,8 @@ const createClient = (opts) => {
33
33
  };
34
34
  const httpMiddlewareOptions = {
35
35
  host: opts.apiUrl,
36
+ //Enables SDK retries when CoCo returns a 503 error. It retries up to 10 times with an 200ms backoff.
37
+ enableRetry: true,
36
38
  };
37
39
  const correlationIdMiddlewareOptions = {
38
40
  generate: () => {
@@ -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.1",
3
+ "version": "0.12.0",
4
4
  "description": "Payment SDK for commercetools payment connectors",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -15,12 +15,12 @@
15
15
  ],
16
16
  "license": "ISC",
17
17
  "dependencies": {
18
- "@commercetools-backend/loggers": "22.34.0",
19
- "@commercetools/platform-sdk": "7.17.0",
18
+ "@commercetools-backend/loggers": "22.35.1",
19
+ "@commercetools/platform-sdk": "7.21.0",
20
20
  "@commercetools/sdk-client-v2": "2.5.0",
21
21
  "jsonwebtoken": "9.0.2",
22
22
  "jwks-rsa": "3.1.0",
23
23
  "lodash": "4.17.21",
24
- "logform": "2.6.1"
24
+ "logform": "2.7.0"
25
25
  }
26
26
  }