@wearejh/m2-pwa-adyen 0.26.0 → 0.28.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
@@ -3,6 +3,28 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [0.28.0](https://github.com/WeareJH/mage-mono/compare/v0.25.0...v0.28.0) (2024-07-30)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * WOOD-2009 cancelled adyen orders ([#92](https://github.com/WeareJH/mage-mono/issues/92)) ([38c017e](https://github.com/WeareJH/mage-mono/commit/38c017e70c26adbb63616727d15594b5bf77e510))
12
+
13
+
14
+
15
+
16
+
17
+ # [0.27.0](https://github.com/WeareJH/mage-mono/compare/v0.25.0...v0.27.0) (2024-07-30)
18
+
19
+
20
+ ### Bug Fixes
21
+
22
+ * WOOD-2009 cancelled adyen orders ([#92](https://github.com/WeareJH/mage-mono/issues/92)) ([38c017e](https://github.com/WeareJH/mage-mono/commit/38c017e70c26adbb63616727d15594b5bf77e510))
23
+
24
+
25
+
26
+
27
+
6
28
  # [0.26.0](https://github.com/WeareJH/mage-mono/compare/v0.25.0...v0.26.0) (2024-07-15)
7
29
 
8
30
  **Note:** Version bump only for package @wearejh/m2-pwa-adyen
@@ -2,14 +2,12 @@ import { CheckoutMsg } from '@wearejh/m2-pwa-checkout';
2
2
  import { State as CheckoutState } from '@wearejh/m2-pwa-checkout/lib/checkout.reducer';
3
3
  import { scrollTop } from '@wearejh/m2-pwa-engine/lib/runtime/utils/scrollTop';
4
4
  import { EpicDeps } from '@wearejh/m2-pwa-engine/lib/types';
5
- import { extractErrorAndCode } from '@wearejh/swagger-rxjs/utils/ajax-helpers';
6
5
  import { ofType } from 'redux-observable';
7
6
  import { EMPTY, Observable, of } from 'rxjs';
8
- import { catchError, mergeMap, pluck, switchMap, withLatestFrom } from 'rxjs/operators';
7
+ import { pluck, switchMap, withLatestFrom } from 'rxjs/operators';
9
8
 
10
- import { Actions, AdyenMessage, ActionTypes, TypeMap } from '../adyen.actions';
9
+ import { Actions, ActionTypes, TypeMap } from '../adyen.actions';
11
10
  import { AppendState as AdyenStore } from '../adyen.types';
12
- import { execute as cancelQuery } from '../rest/JhAdyenPaymentAdyenThreeDSAbortV1AbortPost';
13
11
 
14
12
  /**
15
13
  * This epic handles Adyen cancel events and communicates
@@ -18,7 +16,7 @@ import { execute as cancelQuery } from '../rest/JhAdyenPaymentAdyenThreeDSAbortV
18
16
  * Within the Adyen module, you only need to dispatch
19
17
  * the cancel action. This epic will handle the rest.
20
18
  */
21
- export function onCancel(action$: Observable<any>, state$: Observable<any>, deps: EpicDeps) {
19
+ export function onCancel(action$: Observable<any>, state$: Observable<any>, _deps: EpicDeps) {
22
20
  /**
23
21
  * Get the checkout order id from the store.
24
22
  */
@@ -43,27 +41,7 @@ export function onCancel(action$: Observable<any>, state$: Observable<any>, deps
43
41
  return EMPTY;
44
42
  }
45
43
 
46
- const ajax$ = cancelQuery(
47
- {
48
- orderId: Number(orderId),
49
- },
50
- deps,
51
- );
52
-
53
- return ajax$.pipe(
54
- mergeMap(() => of(CheckoutMsg('Checkout.SetState', CheckoutState.Ready), scrollTop())),
55
-
56
- catchError((errorResponse) => {
57
- const { error } = extractErrorAndCode(errorResponse);
58
-
59
- return of(
60
- AdyenMessage(ActionTypes.Error, {
61
- cancelPayment: false,
62
- message: error,
63
- }),
64
- );
65
- }),
66
- );
44
+ return of(CheckoutMsg('Checkout.SetState', CheckoutState.Ready), scrollTop());
67
45
  }),
68
46
  );
69
47
  }
@@ -1,15 +1,12 @@
1
1
  import { CheckoutMsg } from '@wearejh/m2-pwa-checkout';
2
2
  import { scrollTop } from '@wearejh/m2-pwa-engine/lib/runtime/utils/scrollTop';
3
3
  import { EpicDeps } from '@wearejh/m2-pwa-engine/lib/types';
4
- import { extractErrorAndCode } from '@wearejh/swagger-rxjs/utils/ajax-helpers';
5
4
  import { ofType } from 'redux-observable';
6
- import { EMPTY, concat, Observable, of } from 'rxjs';
7
- import { catchError, mergeMap, pluck, switchMap, withLatestFrom } from 'rxjs/operators';
8
- import { CartMsg } from '@wearejh/m2-pwa-cart-gql';
5
+ import { EMPTY, Observable, of } from 'rxjs';
6
+ import { pluck, switchMap, withLatestFrom } from 'rxjs/operators';
9
7
 
10
8
  import { Actions, ActionTypes, TypeMap } from '../adyen.actions';
11
9
  import { AppendState as AdyenStore } from '../adyen.types';
12
- import { execute as cancelQuery } from '../rest/JhAdyenPaymentAdyenThreeDSAbortV1AbortPost';
13
10
 
14
11
  /**
15
12
  * This epic handles Adyen error events, cancels the order,
@@ -18,7 +15,7 @@ import { execute as cancelQuery } from '../rest/JhAdyenPaymentAdyenThreeDSAbortV
18
15
  * Within the Adyen module, you only need to dispatch
19
16
  * the error action. This epic will handle the rest.
20
17
  */
21
- export function onError(action$: Observable<any>, state$: Observable<any>, deps: EpicDeps) {
18
+ export function onError(action$: Observable<any>, state$: Observable<any>, _deps: EpicDeps) {
22
19
  /**
23
20
  * Get the checkout order id from the store.
24
21
  */
@@ -40,9 +37,9 @@ export function onError(action$: Observable<any>, state$: Observable<any>, deps:
40
37
  switchMap(
41
38
  ([
42
39
  {
43
- payload: { cancelPayment, message },
40
+ payload: { message },
44
41
  },
45
- orderId,
42
+ _orderId,
46
43
  ]) => {
47
44
  let errorMessage = message;
48
45
 
@@ -54,35 +51,7 @@ export function onError(action$: Observable<any>, state$: Observable<any>, deps:
54
51
  errorMessage = 'Can not set name for cross-domain window.';
55
52
  }
56
53
 
57
- if (cancelPayment) {
58
- if (!orderId) {
59
- return of(CheckoutMsg('Checkout.PaymentSubmitError', 'Cannot find the order ID.'), scrollTop());
60
- }
61
-
62
- const ajax$ = cancelQuery(
63
- {
64
- orderId: Number(orderId),
65
- },
66
- deps,
67
- );
68
-
69
- return ajax$.pipe(
70
- mergeMap(() => {
71
- return concat(
72
- of(CheckoutMsg('Checkout.PaymentSubmitError', message)),
73
- of(CartMsg('Cart.Refresh', { force: true }), scrollTop()),
74
- );
75
- }),
76
-
77
- catchError((errorResponse) => {
78
- const { error } = extractErrorAndCode(errorResponse);
79
-
80
- return of(CheckoutMsg('Checkout.PaymentSubmitError', error), scrollTop());
81
- }),
82
- );
83
- }
84
-
85
- return of(CheckoutMsg('Checkout.PaymentSubmitError', message), scrollTop());
54
+ return of(CheckoutMsg('Checkout.PaymentSubmitError', errorMessage), scrollTop());
86
55
  },
87
56
  ),
88
57
  );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wearejh/m2-pwa-adyen",
3
- "version": "0.26.0",
3
+ "version": "0.28.0",
4
4
  "description": "> TODO: description",
5
5
  "author": "Shane Osbourne <shane.osbourne8@gmail.com>",
6
6
  "homepage": "",
@@ -22,13 +22,13 @@
22
22
  },
23
23
  "dependencies": {
24
24
  "@adyen/adyen-web": "5.59.0",
25
- "@wearejh/m2-pwa-cart": "^0.26.0",
26
- "@wearejh/m2-pwa-checkout": "^0.26.0",
27
- "@wearejh/m2-pwa-engine": "^0.26.0",
28
- "@wearejh/react-hooks": "^0.26.0",
29
- "@wearejh/rx-form": "^0.26.0",
30
- "@wearejh/swagger-rxjs": "^0.26.0",
25
+ "@wearejh/m2-pwa-cart": "^0.28.0",
26
+ "@wearejh/m2-pwa-checkout": "^0.28.0",
27
+ "@wearejh/m2-pwa-engine": "^0.28.0",
28
+ "@wearejh/react-hooks": "^0.28.0",
29
+ "@wearejh/rx-form": "^0.28.0",
30
+ "@wearejh/swagger-rxjs": "^0.28.0",
31
31
  "load-js": "^3.0.3"
32
32
  },
33
- "gitHead": "d626f346da72a5ee0fe293d4f57f70e12c4cccf5"
33
+ "gitHead": "7fafabd9c93a5f95b4b4794bc650da1bb599b480"
34
34
  }