@graphcommerce/mollie-magento-payment 3.0.4 → 3.1.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 +82 -95
- package/Inject/MolliePaymentMethod.graphql +0 -4
- package/components/MollieOptionsIssuer/MollieIdealOptions.tsx +2 -3
- package/components/MollieOptionsIssuer/MollieIssuerOptions.tsx +5 -17
- package/components/MollieOptionsToken/MollieCreditCardOptions.tsx +2 -2
- package/components/MollieOptionsToken/MollieField.tsx +3 -3
- package/components/MolliePaymentHandler/MolliePaymentHandler.graphql +8 -0
- package/components/MolliePaymentHandler/MolliePaymentHandler.tsx +83 -15
- package/components/MolliePaymentHandler/MollieRecoverCart.graphql +7 -0
- package/components/MolliePaymentToggle/MolliePaymentToggle.tsx +3 -9
- package/components/MolliePlaceOrder/MolliePlaceOrder.tsx +15 -20
- package/hooks/useCartLockWithToken.ts +22 -0
- package/index.ts +1 -3
- package/methods/mollie_methods_creditcard.ts +6 -6
- package/methods/mollie_methods_ideal.ts +5 -5
- package/methods/mollie_methods_klarnapaylater.ts +1 -3
- package/methods/mollie_methods_paypal.ts +3 -3
- package/next-env.d.ts +4 -0
- package/package.json +15 -15
- package/test/creditcard.playwright.ts +70 -0
- package/test/ideal.playwright.ts +70 -0
- package/Inject/MollieSelectedPaymentMethod.graphql +0 -6
- package/_playwright/mollie_methods_ideal.spec.ts +0 -101
- package/hooks/UseMolliePaymentTokenHandler.graphql +0 -8
- package/hooks/index.ts +0 -1
- package/hooks/useMolliePaymentTokenHandler.ts +0 -66
package/CHANGELOG.md
CHANGED
|
@@ -1,18 +1,58 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
+
## 3.1.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#1368](https://github.com/graphcommerce-org/graphcommerce/pull/1368) [`892018809`](https://github.com/graphcommerce-org/graphcommerce/commit/8920188093d0422ec50580e408dc28ac5f93e46a) Thanks [@paales](https://github.com/paales)! - Fix issue where the cart couldn't be properly restored when a payment was cancelled
|
|
8
|
+
|
|
9
|
+
### Patch Changes
|
|
10
|
+
|
|
11
|
+
- [#1369](https://github.com/graphcommerce-org/graphcommerce/pull/1369) [`ae6449502`](https://github.com/graphcommerce-org/graphcommerce/commit/ae64495024a455bbe5188588604368c1542840c9) Thanks [@paales](https://github.com/paales)! - Upgraded dependencies
|
|
12
|
+
|
|
13
|
+
- Updated dependencies [[`892018809`](https://github.com/graphcommerce-org/graphcommerce/commit/8920188093d0422ec50580e408dc28ac5f93e46a), [`892018809`](https://github.com/graphcommerce-org/graphcommerce/commit/8920188093d0422ec50580e408dc28ac5f93e46a), [`ae6449502`](https://github.com/graphcommerce-org/graphcommerce/commit/ae64495024a455bbe5188588604368c1542840c9), [`892018809`](https://github.com/graphcommerce-org/graphcommerce/commit/8920188093d0422ec50580e408dc28ac5f93e46a), [`892018809`](https://github.com/graphcommerce-org/graphcommerce/commit/8920188093d0422ec50580e408dc28ac5f93e46a), [`892018809`](https://github.com/graphcommerce-org/graphcommerce/commit/8920188093d0422ec50580e408dc28ac5f93e46a)]:
|
|
14
|
+
- @graphcommerce/graphql@3.0.6
|
|
15
|
+
- @graphcommerce/next-ui@4.5.0
|
|
16
|
+
- @graphcommerce/image@3.1.2
|
|
17
|
+
- @graphcommerce/magento-cart@4.2.2
|
|
18
|
+
- @graphcommerce/magento-cart-payment-method@3.0.6
|
|
19
|
+
- @graphcommerce/magento-store@4.1.4
|
|
20
|
+
- @graphcommerce/react-hook-form@3.0.6
|
|
21
|
+
|
|
22
|
+
## 3.0.6
|
|
23
|
+
|
|
24
|
+
### Patch Changes
|
|
25
|
+
|
|
26
|
+
- [#1353](https://github.com/graphcommerce-org/graphcommerce/pull/1353) [`0e5ee7ba8`](https://github.com/graphcommerce-org/graphcommerce/commit/0e5ee7ba89698e5e711001e846ed182528060cba) Thanks [@paales](https://github.com/paales)! - Eslint: enable rules that were previously disabled and make fixes
|
|
27
|
+
|
|
28
|
+
- Updated dependencies [[`49a2d6617`](https://github.com/graphcommerce-org/graphcommerce/commit/49a2d661712e1787fba46c6195f7b559189e23d9), [`f67da3cfb`](https://github.com/graphcommerce-org/graphcommerce/commit/f67da3cfbe2dcf5ea23519d088c5aa0074029182), [`218766869`](https://github.com/graphcommerce-org/graphcommerce/commit/218766869f7468c067a590857c942f3819f8add4), [`0e5ee7ba8`](https://github.com/graphcommerce-org/graphcommerce/commit/0e5ee7ba89698e5e711001e846ed182528060cba), [`829b8690b`](https://github.com/graphcommerce-org/graphcommerce/commit/829b8690bc5d0a46e596299e4120e9837a9f179c), [`829b8690b`](https://github.com/graphcommerce-org/graphcommerce/commit/829b8690bc5d0a46e596299e4120e9837a9f179c)]:
|
|
29
|
+
- @graphcommerce/next-ui@4.4.0
|
|
30
|
+
- @graphcommerce/magento-cart@4.2.1
|
|
31
|
+
|
|
32
|
+
## 3.0.5
|
|
33
|
+
|
|
34
|
+
### Patch Changes
|
|
35
|
+
|
|
36
|
+
- [#1307](https://github.com/ho-nl/m2-pwa/pull/1307) [`bd10506d3`](https://github.com/ho-nl/m2-pwa/commit/bd10506d32fdbc91d01dadc29a12ebd1e0943655) Thanks [@paales](https://github.com/paales)! - All default exports are now named exports internally and all `index.tsx` are renamed to the component name.
|
|
37
|
+
|
|
38
|
+
* [#1307](https://github.com/ho-nl/m2-pwa/pull/1307) [`27cb1f2d8`](https://github.com/ho-nl/m2-pwa/commit/27cb1f2d8dbfb8f1b301ce56fb6a2b6c1fc6a5ef) Thanks [@paales](https://github.com/paales)! - upgrade dependencies
|
|
39
|
+
|
|
40
|
+
* Updated dependencies [[`3d63b39f7`](https://github.com/ho-nl/m2-pwa/commit/3d63b39f7e330d1827a32dba782667d7b21adaba), [`bd10506d3`](https://github.com/ho-nl/m2-pwa/commit/bd10506d32fdbc91d01dadc29a12ebd1e0943655), [`27cb1f2d8`](https://github.com/ho-nl/m2-pwa/commit/27cb1f2d8dbfb8f1b301ce56fb6a2b6c1fc6a5ef)]:
|
|
41
|
+
- @graphcommerce/next-ui@4.2.4
|
|
42
|
+
- @graphcommerce/graphql@3.0.4
|
|
43
|
+
- @graphcommerce/image@3.1.1
|
|
44
|
+
- @graphcommerce/magento-cart@4.1.4
|
|
45
|
+
- @graphcommerce/magento-cart-payment-method@3.0.5
|
|
46
|
+
- @graphcommerce/magento-store@4.1.2
|
|
47
|
+
- @graphcommerce/react-hook-form@3.0.4
|
|
48
|
+
|
|
3
49
|
## 3.0.4
|
|
4
50
|
|
|
5
51
|
### Patch Changes
|
|
6
52
|
|
|
7
|
-
- [#1292](https://github.com/ho-nl/m2-pwa/pull/1292)
|
|
8
|
-
[`5a1ba9e66`](https://github.com/ho-nl/m2-pwa/commit/5a1ba9e664abbac89c4f5f71f7d6d6ed1aefa5c0)
|
|
9
|
-
Thanks [@paales](https://github.com/paales)! - Renamed SvgIcon to IconSvg to prevent collisions
|
|
10
|
-
with MUI
|
|
53
|
+
- [#1292](https://github.com/ho-nl/m2-pwa/pull/1292) [`5a1ba9e66`](https://github.com/ho-nl/m2-pwa/commit/5a1ba9e664abbac89c4f5f71f7d6d6ed1aefa5c0) Thanks [@paales](https://github.com/paales)! - Renamed SvgIcon to IconSvg to prevent collisions with MUI
|
|
11
54
|
|
|
12
|
-
- Updated dependencies
|
|
13
|
-
[[`5a1ba9e66`](https://github.com/ho-nl/m2-pwa/commit/5a1ba9e664abbac89c4f5f71f7d6d6ed1aefa5c0),
|
|
14
|
-
[`990df655b`](https://github.com/ho-nl/m2-pwa/commit/990df655b73b469718d6cb5837ee65dfe2ad6a1d),
|
|
15
|
-
[`63f9b56eb`](https://github.com/ho-nl/m2-pwa/commit/63f9b56eb68ba790567ff1427e599fd2c3c8f1ee)]:
|
|
55
|
+
- Updated dependencies [[`5a1ba9e66`](https://github.com/ho-nl/m2-pwa/commit/5a1ba9e664abbac89c4f5f71f7d6d6ed1aefa5c0), [`990df655b`](https://github.com/ho-nl/m2-pwa/commit/990df655b73b469718d6cb5837ee65dfe2ad6a1d), [`63f9b56eb`](https://github.com/ho-nl/m2-pwa/commit/63f9b56eb68ba790567ff1427e599fd2c3c8f1ee)]:
|
|
16
56
|
- @graphcommerce/magento-cart@4.1.3
|
|
17
57
|
- @graphcommerce/magento-cart-payment-method@3.0.4
|
|
18
58
|
- @graphcommerce/next-ui@4.2.0
|
|
@@ -21,18 +61,11 @@
|
|
|
21
61
|
|
|
22
62
|
### Patch Changes
|
|
23
63
|
|
|
24
|
-
- [`973ff8645`](https://github.com/ho-nl/m2-pwa/commit/973ff86452a70ade9f4db13fdda6e963d7220e96)
|
|
25
|
-
Thanks [@paales](https://github.com/paales)! - made packages public
|
|
64
|
+
- [`973ff8645`](https://github.com/ho-nl/m2-pwa/commit/973ff86452a70ade9f4db13fdda6e963d7220e96) Thanks [@paales](https://github.com/paales)! - made packages public
|
|
26
65
|
|
|
27
|
-
* [#1278](https://github.com/ho-nl/m2-pwa/pull/1278)
|
|
28
|
-
[`81ea406d5`](https://github.com/ho-nl/m2-pwa/commit/81ea406d54d6b5c662c030a7fea444abc4117a20)
|
|
29
|
-
Thanks [@ErwinOtten](https://github.com/ErwinOtten)! - Upgraded dependencies to the latest version
|
|
66
|
+
* [#1278](https://github.com/ho-nl/m2-pwa/pull/1278) [`81ea406d5`](https://github.com/ho-nl/m2-pwa/commit/81ea406d54d6b5c662c030a7fea444abc4117a20) Thanks [@ErwinOtten](https://github.com/ErwinOtten)! - Upgraded dependencies to the latest version
|
|
30
67
|
|
|
31
|
-
* Updated dependencies
|
|
32
|
-
[[`973ff8645`](https://github.com/ho-nl/m2-pwa/commit/973ff86452a70ade9f4db13fdda6e963d7220e96),
|
|
33
|
-
[`81ea406d5`](https://github.com/ho-nl/m2-pwa/commit/81ea406d54d6b5c662c030a7fea444abc4117a20),
|
|
34
|
-
[`3a719c88c`](https://github.com/ho-nl/m2-pwa/commit/3a719c88cad1eab58602de28c41adc0fc4827e1d),
|
|
35
|
-
[`5ffcb56bf`](https://github.com/ho-nl/m2-pwa/commit/5ffcb56bfcbe49ebeaf24f9341e819a145ab9a14)]:
|
|
68
|
+
* Updated dependencies [[`973ff8645`](https://github.com/ho-nl/m2-pwa/commit/973ff86452a70ade9f4db13fdda6e963d7220e96), [`81ea406d5`](https://github.com/ho-nl/m2-pwa/commit/81ea406d54d6b5c662c030a7fea444abc4117a20), [`3a719c88c`](https://github.com/ho-nl/m2-pwa/commit/3a719c88cad1eab58602de28c41adc0fc4827e1d), [`5ffcb56bf`](https://github.com/ho-nl/m2-pwa/commit/5ffcb56bfcbe49ebeaf24f9341e819a145ab9a14)]:
|
|
36
69
|
- @graphcommerce/graphql@3.0.3
|
|
37
70
|
- @graphcommerce/image@3.1.0
|
|
38
71
|
- @graphcommerce/magento-cart@4.1.2
|
|
@@ -45,30 +78,13 @@
|
|
|
45
78
|
|
|
46
79
|
### Patch Changes
|
|
47
80
|
|
|
48
|
-
- [#1276](https://github.com/ho-nl/m2-pwa/pull/1276)
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
* [
|
|
55
|
-
[`52a45bba4`](https://github.com/ho-nl/m2-pwa/commit/52a45bba4dc6dd6df3c81f5023df7d23ed8a534d)
|
|
56
|
-
Thanks [@paales](https://github.com/paales)! - Upgraded to
|
|
57
|
-
[NextJS 12.1](https://nextjs.org/blog/next-12-1)! This is just for compatibility, but we'll be
|
|
58
|
-
implementing
|
|
59
|
-
[On-demand Incremental Static Regeneration](https://nextjs.org/blog/next-12-1#on-demand-incremental-static-regeneration-beta)
|
|
60
|
-
soon.
|
|
61
|
-
|
|
62
|
-
This will greatly reduce the requirement to rebuid stuff and we'll add a management UI on the
|
|
63
|
-
frontend to be able to revalidate pages manually.
|
|
64
|
-
|
|
65
|
-
* Updated dependencies
|
|
66
|
-
[[`381e4c86a`](https://github.com/ho-nl/m2-pwa/commit/381e4c86a8321ce96e1fa5c7d3c0a0c0ff3e02c7),
|
|
67
|
-
[`ce09388e0`](https://github.com/ho-nl/m2-pwa/commit/ce09388e0d7ef33aee660612340f6fbae15ceec2),
|
|
68
|
-
[`e7c8e2756`](https://github.com/ho-nl/m2-pwa/commit/e7c8e2756d637cbcd2e793d62ef5721d35d9fa7b),
|
|
69
|
-
[`b08a8eb1d`](https://github.com/ho-nl/m2-pwa/commit/b08a8eb1d024b9d3e7712ef034029151670db275),
|
|
70
|
-
[`52a45bba4`](https://github.com/ho-nl/m2-pwa/commit/52a45bba4dc6dd6df3c81f5023df7d23ed8a534d),
|
|
71
|
-
[`5a4809b1a`](https://github.com/ho-nl/m2-pwa/commit/5a4809b1a705aa32f620f520085df48ee25f9949)]:
|
|
81
|
+
- [#1276](https://github.com/ho-nl/m2-pwa/pull/1276) [`ce09388e0`](https://github.com/ho-nl/m2-pwa/commit/ce09388e0d7ef33aee660612340f6fbae15ceec2) Thanks [@paales](https://github.com/paales)! - We've moved lots of internal packages from `dependencies` to `peerDependencies`. The result of this is that there will be significantly less duplicate packages in the node_modules folders.
|
|
82
|
+
|
|
83
|
+
* [#1276](https://github.com/ho-nl/m2-pwa/pull/1276) [`52a45bba4`](https://github.com/ho-nl/m2-pwa/commit/52a45bba4dc6dd6df3c81f5023df7d23ed8a534d) Thanks [@paales](https://github.com/paales)! - Upgraded to [NextJS 12.1](https://nextjs.org/blog/next-12-1)! This is just for compatibility, but we'll be implementing [On-demand Incremental Static Regeneration](https://nextjs.org/blog/next-12-1#on-demand-incremental-static-regeneration-beta) soon.
|
|
84
|
+
|
|
85
|
+
This will greatly reduce the requirement to rebuid stuff and we'll add a management UI on the frontend to be able to revalidate pages manually.
|
|
86
|
+
|
|
87
|
+
* Updated dependencies [[`381e4c86a`](https://github.com/ho-nl/m2-pwa/commit/381e4c86a8321ce96e1fa5c7d3c0a0c0ff3e02c7), [`ce09388e0`](https://github.com/ho-nl/m2-pwa/commit/ce09388e0d7ef33aee660612340f6fbae15ceec2), [`e7c8e2756`](https://github.com/ho-nl/m2-pwa/commit/e7c8e2756d637cbcd2e793d62ef5721d35d9fa7b), [`b08a8eb1d`](https://github.com/ho-nl/m2-pwa/commit/b08a8eb1d024b9d3e7712ef034029151670db275), [`52a45bba4`](https://github.com/ho-nl/m2-pwa/commit/52a45bba4dc6dd6df3c81f5023df7d23ed8a534d), [`5a4809b1a`](https://github.com/ho-nl/m2-pwa/commit/5a4809b1a705aa32f620f520085df48ee25f9949)]:
|
|
72
88
|
- @graphcommerce/magento-cart@4.1.1
|
|
73
89
|
- @graphcommerce/magento-cart-payment-method@3.0.2
|
|
74
90
|
- @graphcommerce/next-ui@4.1.1
|
|
@@ -81,11 +97,8 @@
|
|
|
81
97
|
|
|
82
98
|
### Patch Changes
|
|
83
99
|
|
|
84
|
-
- [`0cbaa878b`](https://github.com/ho-nl/m2-pwa/commit/0cbaa878b8a844d5abbeb1797b625a33130e6514)
|
|
85
|
-
|
|
86
|
-
so that the packages link to back to the website and repository
|
|
87
|
-
- Updated dependencies
|
|
88
|
-
[[`0cbaa878b`](https://github.com/ho-nl/m2-pwa/commit/0cbaa878b8a844d5abbeb1797b625a33130e6514)]:
|
|
100
|
+
- [`0cbaa878b`](https://github.com/ho-nl/m2-pwa/commit/0cbaa878b8a844d5abbeb1797b625a33130e6514) Thanks [@paales](https://github.com/paales)! - Added homepage and repository package.json files, so that the packages link to back to the website and repository
|
|
101
|
+
- Updated dependencies [[`0cbaa878b`](https://github.com/ho-nl/m2-pwa/commit/0cbaa878b8a844d5abbeb1797b625a33130e6514)]:
|
|
89
102
|
- @graphcommerce/graphql@3.0.1
|
|
90
103
|
- @graphcommerce/image@3.0.1
|
|
91
104
|
- @graphcommerce/magento-cart@4.0.1
|
|
@@ -98,14 +111,11 @@
|
|
|
98
111
|
|
|
99
112
|
### Major Changes
|
|
100
113
|
|
|
101
|
-
- [#1258](https://github.com/ho-nl/m2-pwa/pull/1258)
|
|
102
|
-
[`ad36382a4`](https://github.com/ho-nl/m2-pwa/commit/ad36382a4d55d83d9e47b7eb6a02671a2a631a05)
|
|
103
|
-
Thanks [@paales](https://github.com/paales)! - Upgraded to Material UI 5
|
|
114
|
+
- [#1258](https://github.com/ho-nl/m2-pwa/pull/1258) [`ad36382a4`](https://github.com/ho-nl/m2-pwa/commit/ad36382a4d55d83d9e47b7eb6a02671a2a631a05) Thanks [@paales](https://github.com/paales)! - Upgraded to Material UI 5
|
|
104
115
|
|
|
105
116
|
### Patch Changes
|
|
106
117
|
|
|
107
|
-
- Updated dependencies
|
|
108
|
-
[[`ad36382a4`](https://github.com/ho-nl/m2-pwa/commit/ad36382a4d55d83d9e47b7eb6a02671a2a631a05)]:
|
|
118
|
+
- Updated dependencies [[`ad36382a4`](https://github.com/ho-nl/m2-pwa/commit/ad36382a4d55d83d9e47b7eb6a02671a2a631a05)]:
|
|
109
119
|
- @graphcommerce/graphql@3.0.0
|
|
110
120
|
- @graphcommerce/image@3.0.0
|
|
111
121
|
- @graphcommerce/magento-cart@4.0.0
|
|
@@ -114,68 +124,55 @@
|
|
|
114
124
|
- @graphcommerce/next-ui@4.0.0
|
|
115
125
|
- @graphcommerce/react-hook-form@3.0.0
|
|
116
126
|
|
|
117
|
-
All notable changes to this project will be documented in this file. See
|
|
118
|
-
[Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
127
|
+
All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
119
128
|
|
|
120
129
|
## [2.106.24](https://github.com/ho-nl/m2-pwa/compare/@graphcommerce/mollie-magento-payment@2.106.23...@graphcommerce/mollie-magento-payment@2.106.24) (2021-12-20)
|
|
121
130
|
|
|
122
131
|
### Bug Fixes
|
|
123
132
|
|
|
124
|
-
- animations would run on background page, make sure animations are not running when page is not
|
|
125
|
-
active
|
|
126
|
-
([2fcf4b8](https://github.com/ho-nl/m2-pwa/commit/2fcf4b8a853108147477e3a67c7ea202abb2842f))
|
|
133
|
+
- animations would run on background page, make sure animations are not running when page is not active ([2fcf4b8](https://github.com/ho-nl/m2-pwa/commit/2fcf4b8a853108147477e3a67c7ea202abb2842f))
|
|
127
134
|
|
|
128
135
|
# [2.106.0](https://github.com/ho-nl/m2-pwa/compare/@graphcommerce/mollie-magento-payment@2.105.32...@graphcommerce/mollie-magento-payment@2.106.0) (2021-11-12)
|
|
129
136
|
|
|
130
137
|
### Features
|
|
131
138
|
|
|
132
|
-
- added tons of translations
|
|
133
|
-
([9bb0ac7](https://github.com/ho-nl/m2-pwa/commit/9bb0ac709b58df6ea6141e92e4923a5ca9ae2963))
|
|
139
|
+
- added tons of translations ([9bb0ac7](https://github.com/ho-nl/m2-pwa/commit/9bb0ac709b58df6ea6141e92e4923a5ca9ae2963))
|
|
134
140
|
|
|
135
141
|
## [2.105.9](https://github.com/ho-nl/m2-pwa/compare/@graphcommerce/mollie-magento-payment@2.105.8...@graphcommerce/mollie-magento-payment@2.105.9) (2021-11-02)
|
|
136
142
|
|
|
137
143
|
### Bug Fixes
|
|
138
144
|
|
|
139
|
-
- input labels
|
|
140
|
-
|
|
141
|
-
- overlapping checkmark icon
|
|
142
|
-
([b4da61a](https://github.com/ho-nl/m2-pwa/commit/b4da61ae33ab058a56f0f32c2874a2e77d77d01d))
|
|
145
|
+
- input labels ([ba46c9a](https://github.com/ho-nl/m2-pwa/commit/ba46c9a17b3b460daab5015df39ac9ae66858df4))
|
|
146
|
+
- overlapping checkmark icon ([b4da61a](https://github.com/ho-nl/m2-pwa/commit/b4da61ae33ab058a56f0f32c2874a2e77d77d01d))
|
|
143
147
|
|
|
144
148
|
# [2.105.0](https://github.com/ho-nl/m2-pwa/compare/@graphcommerce/mollie-magento-payment@2.104.33...@graphcommerce/mollie-magento-payment@2.105.0) (2021-10-27)
|
|
145
149
|
|
|
146
150
|
### Features
|
|
147
151
|
|
|
148
|
-
- **nextjs:** upgraded to nextjs 12
|
|
149
|
-
([9331bc8](https://github.com/ho-nl/m2-pwa/commit/9331bc801f6419522115cc47d291d49d608d5a90))
|
|
152
|
+
- **nextjs:** upgraded to nextjs 12 ([9331bc8](https://github.com/ho-nl/m2-pwa/commit/9331bc801f6419522115cc47d291d49d608d5a90))
|
|
150
153
|
|
|
151
154
|
## [2.104.13](https://github.com/ho-nl/m2-pwa/compare/@graphcommerce/mollie-magento-payment@2.104.12...@graphcommerce/mollie-magento-payment@2.104.13) (2021-10-08)
|
|
152
155
|
|
|
153
156
|
### Bug Fixes
|
|
154
157
|
|
|
155
|
-
- **mollie:** make sure we're redirected to the success page
|
|
156
|
-
([316d2b2](https://github.com/ho-nl/m2-pwa/commit/316d2b2a99189f093e74db98521c27e8e7267dd4))
|
|
158
|
+
- **mollie:** make sure we're redirected to the success page ([316d2b2](https://github.com/ho-nl/m2-pwa/commit/316d2b2a99189f093e74db98521c27e8e7267dd4))
|
|
157
159
|
|
|
158
160
|
## [2.104.11](https://github.com/ho-nl/m2-pwa/compare/@graphcommerce/mollie-magento-payment@2.104.10...@graphcommerce/mollie-magento-payment@2.104.11) (2021-10-07)
|
|
159
161
|
|
|
160
162
|
### Bug Fixes
|
|
161
163
|
|
|
162
|
-
- make sure if no payment method is filled in we get an error shown
|
|
163
|
-
([a203e57](https://github.com/ho-nl/m2-pwa/commit/a203e570caad0732427a178e8e8b10b4a15d676b))
|
|
164
|
+
- make sure if no payment method is filled in we get an error shown ([a203e57](https://github.com/ho-nl/m2-pwa/commit/a203e570caad0732427a178e8e8b10b4a15d676b))
|
|
164
165
|
|
|
165
166
|
# 2.104.0 (2021-09-29)
|
|
166
167
|
|
|
167
168
|
### Bug Fixes
|
|
168
169
|
|
|
169
|
-
- make sure mollie only gets build optionally
|
|
170
|
-
|
|
171
|
-
- make sure the mollie module doesn't start with magento- to prevent building from node moduels
|
|
172
|
-
([ed406b9](https://github.com/ho-nl/m2-pwa/commit/ed406b9f56bd8cb5df0463cc50e4b1e9a728d4ca))
|
|
170
|
+
- make sure mollie only gets build optionally ([e5e2347](https://github.com/ho-nl/m2-pwa/commit/e5e23475e170dc2fc0c13103dfb8fbdb9009715f))
|
|
171
|
+
- make sure the mollie module doesn't start with magento- to prevent building from node moduels ([ed406b9](https://github.com/ho-nl/m2-pwa/commit/ed406b9f56bd8cb5df0463cc50e4b1e9a728d4ca))
|
|
173
172
|
|
|
174
173
|
### Features
|
|
175
174
|
|
|
176
|
-
- renamed all packages to use [@graphcommerce](https://github.com/graphcommerce) instead of
|
|
177
|
-
[@reachdigital](https://github.com/reachdigital)
|
|
178
|
-
([491e4ce](https://github.com/ho-nl/m2-pwa/commit/491e4cec9a2686472dac36b79f999257c0811ffe))
|
|
175
|
+
- renamed all packages to use [@graphcommerce](https://github.com/graphcommerce) instead of [@reachdigital](https://github.com/reachdigital) ([491e4ce](https://github.com/ho-nl/m2-pwa/commit/491e4cec9a2686472dac36b79f999257c0811ffe))
|
|
179
176
|
|
|
180
177
|
## [2.103.1](https://github.com/ho-nl/m2-pwa/compare/@graphcommerce/magento-payment-mollie@2.103.0...@graphcommerce/magento-payment-mollie@2.103.1) (2021-09-27)
|
|
181
178
|
|
|
@@ -185,58 +182,48 @@ All notable changes to this project will be documented in this file. See
|
|
|
185
182
|
|
|
186
183
|
### Bug Fixes
|
|
187
184
|
|
|
188
|
-
- make sure mollie only gets build optionally
|
|
189
|
-
([e5e2347](https://github.com/ho-nl/m2-pwa/commit/e5e23475e170dc2fc0c13103dfb8fbdb9009715f))
|
|
185
|
+
- make sure mollie only gets build optionally ([e5e2347](https://github.com/ho-nl/m2-pwa/commit/e5e23475e170dc2fc0c13103dfb8fbdb9009715f))
|
|
190
186
|
|
|
191
187
|
### Features
|
|
192
188
|
|
|
193
|
-
- renamed all packages to use [@graphcommerce](https://github.com/graphcommerce) instead of
|
|
194
|
-
[@reachdigital](https://github.com/reachdigital)
|
|
195
|
-
([491e4ce](https://github.com/ho-nl/m2-pwa/commit/491e4cec9a2686472dac36b79f999257c0811ffe))
|
|
189
|
+
- renamed all packages to use [@graphcommerce](https://github.com/graphcommerce) instead of [@reachdigital](https://github.com/reachdigital) ([491e4ce](https://github.com/ho-nl/m2-pwa/commit/491e4cec9a2686472dac36b79f999257c0811ffe))
|
|
196
190
|
|
|
197
191
|
# Change Log
|
|
198
192
|
|
|
199
|
-
All notable changes to this project will be documented in this file. See
|
|
200
|
-
[Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
193
|
+
All notable changes to this project will be documented in this file. See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
201
194
|
|
|
202
195
|
## [2.102.18](https://github.com/ho-nl/m2-pwa/compare/@graphcommerce/magento-payment-mollie@2.102.17...@graphcommerce/magento-payment-mollie@2.102.18) (2021-09-23)
|
|
203
196
|
|
|
204
197
|
### Bug Fixes
|
|
205
198
|
|
|
206
|
-
- make sure mollie only gets build optionally
|
|
207
|
-
([e5e2347](https://github.com/ho-nl/m2-pwa/commit/e5e23475e170dc2fc0c13103dfb8fbdb9009715f))
|
|
199
|
+
- make sure mollie only gets build optionally ([e5e2347](https://github.com/ho-nl/m2-pwa/commit/e5e23475e170dc2fc0c13103dfb8fbdb9009715f))
|
|
208
200
|
|
|
209
201
|
# [2.102.0](https://github.com/ho-nl/m2-pwa/compare/@graphcommerce/magento-payment-mollie@2.101.10...@graphcommerce/magento-payment-mollie@2.102.0) (2021-08-12)
|
|
210
202
|
|
|
211
203
|
### Features
|
|
212
204
|
|
|
213
|
-
- upgraded to nextjs 11
|
|
214
|
-
([0053beb](https://github.com/ho-nl/m2-pwa/commit/0053beb7ef597c190add7264256a0eaec35868da))
|
|
205
|
+
- upgraded to nextjs 11 ([0053beb](https://github.com/ho-nl/m2-pwa/commit/0053beb7ef597c190add7264256a0eaec35868da))
|
|
215
206
|
|
|
216
207
|
## [2.101.9](https://github.com/ho-nl/m2-pwa/compare/@graphcommerce/magento-payment-mollie@2.101.8...@graphcommerce/magento-payment-mollie@2.101.9) (2021-08-09)
|
|
217
208
|
|
|
218
209
|
### Reverts
|
|
219
210
|
|
|
220
|
-
- Revert "chore: upgrade @apollo/client"
|
|
221
|
-
([55ff24e](https://github.com/ho-nl/m2-pwa/commit/55ff24ede0e56c85b8095edadadd1ec5e0b1b8d2))
|
|
211
|
+
- Revert "chore: upgrade @apollo/client" ([55ff24e](https://github.com/ho-nl/m2-pwa/commit/55ff24ede0e56c85b8095edadadd1ec5e0b1b8d2))
|
|
222
212
|
|
|
223
213
|
## [2.101.3](https://github.com/ho-nl/m2-pwa/compare/@graphcommerce/magento-payment-mollie@2.101.2...@graphcommerce/magento-payment-mollie@2.101.3) (2021-07-29)
|
|
224
214
|
|
|
225
215
|
### Bug Fixes
|
|
226
216
|
|
|
227
|
-
- paymentDone removed in favor of a more simple clearCart method
|
|
228
|
-
([5314f77](https://github.com/ho-nl/m2-pwa/commit/5314f7752c2f75a55dcd926bfc26607124561e5d))
|
|
217
|
+
- paymentDone removed in favor of a more simple clearCart method ([5314f77](https://github.com/ho-nl/m2-pwa/commit/5314f7752c2f75a55dcd926bfc26607124561e5d))
|
|
229
218
|
|
|
230
219
|
# [2.101.0](https://github.com/ho-nl/m2-pwa/compare/@graphcommerce/magento-payment-mollie@2.100.19...@graphcommerce/magento-payment-mollie@2.101.0) (2021-07-26)
|
|
231
220
|
|
|
232
221
|
### Features
|
|
233
222
|
|
|
234
|
-
- **playwright:** added new playwright package to enable browser testing
|
|
235
|
-
([6f49ec7](https://github.com/ho-nl/m2-pwa/commit/6f49ec7595563775b96ebf21c27e39da1282e8d9))
|
|
223
|
+
- **playwright:** added new playwright package to enable browser testing ([6f49ec7](https://github.com/ho-nl/m2-pwa/commit/6f49ec7595563775b96ebf21c27e39da1282e8d9))
|
|
236
224
|
|
|
237
225
|
## [2.100.11](https://github.com/ho-nl/m2-pwa/compare/@graphcommerce/magento-payment-mollie@2.100.10...@graphcommerce/magento-payment-mollie@2.100.11) (2021-07-20)
|
|
238
226
|
|
|
239
227
|
### Bug Fixes
|
|
240
228
|
|
|
241
|
-
- ignore md files from triggering version updates
|
|
242
|
-
([4f98392](https://github.com/ho-nl/m2-pwa/commit/4f9839250b3a32d3070da5290e5efcc5e2243fba))
|
|
229
|
+
- ignore md files from triggering version updates ([4f98392](https://github.com/ho-nl/m2-pwa/commit/4f9839250b3a32d3070da5290e5efcc5e2243fba))
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { PaymentOptionsProps } from '@graphcommerce/magento-cart-payment-method'
|
|
2
|
-
import
|
|
3
|
-
import MollieIssuerOptions from './MollieIssuerOptions'
|
|
2
|
+
import { MollieIssuerOptions } from './MollieIssuerOptions'
|
|
4
3
|
|
|
5
|
-
export
|
|
4
|
+
export function MollieIdealOptions(props: PaymentOptionsProps) {
|
|
6
5
|
return <MollieIssuerOptions label='Choose your bank' {...props} />
|
|
7
6
|
}
|
|
@@ -12,8 +12,8 @@ const compName = 'MollieIssuerOptions' as const
|
|
|
12
12
|
const parts = ['root', 'list'] as const
|
|
13
13
|
const { classes } = extendableComponent(compName, parts)
|
|
14
14
|
|
|
15
|
-
export
|
|
16
|
-
const { mollie_available_issuers = [] } = props
|
|
15
|
+
export function MollieIssuerOptions(props: MollieIssuerOptionsProps) {
|
|
16
|
+
const { mollie_available_issuers = [], selected } = props
|
|
17
17
|
const { code, step, Container, label, title = '' } = props
|
|
18
18
|
|
|
19
19
|
const form = useFormGqlMutationCart(SetMolliePaymentMethodIssuerOnCartDocument, {
|
|
@@ -49,8 +49,8 @@ export default function MollieIssuerOptions(props: MollieIssuerOptionsProps) {
|
|
|
49
49
|
endAdornment: <InputCheckmark show={valid.issuer} select />,
|
|
50
50
|
}}
|
|
51
51
|
>
|
|
52
|
+
{/* eslint-disable-next-line jsx-a11y/control-has-associated-label */}
|
|
52
53
|
<option value='' />
|
|
53
|
-
{/* <MenuItem value='' /> */}
|
|
54
54
|
{mollie_available_issuers?.map((issuer) => {
|
|
55
55
|
if (!issuer?.code || !issuer.name) return null
|
|
56
56
|
|
|
@@ -59,31 +59,19 @@ export default function MollieIssuerOptions(props: MollieIssuerOptionsProps) {
|
|
|
59
59
|
{issuer.name}
|
|
60
60
|
</option>
|
|
61
61
|
)
|
|
62
|
-
// return (
|
|
63
|
-
// <MenuItem key={issuer.code} value={issuer.code}>
|
|
64
|
-
// <ListItemIcon>
|
|
65
|
-
// <IconSvg src={issuer.svg} alt={issuer.name} size='small' />
|
|
66
|
-
// </ListItemIcon>
|
|
67
|
-
// <Typography variant='inherit'>{issuer.name}</Typography>
|
|
68
|
-
// </MenuItem>
|
|
69
|
-
// )
|
|
70
62
|
})}
|
|
71
63
|
</TextField>
|
|
72
64
|
</FormRow>
|
|
73
65
|
<Box
|
|
74
66
|
component='ul'
|
|
75
67
|
className={classes.list}
|
|
76
|
-
sx={(theme) => ({
|
|
77
|
-
typography: 'body2',
|
|
78
|
-
paddingLeft: theme.spacings.xs,
|
|
79
|
-
margin: 0,
|
|
80
|
-
})}
|
|
68
|
+
sx={(theme) => ({ typography: 'body2', paddingLeft: theme.spacings.xs, margin: 0 })}
|
|
81
69
|
>
|
|
82
70
|
<li>
|
|
83
71
|
<Trans>Choose your bank, and place your order.</Trans>
|
|
84
72
|
</li>
|
|
85
73
|
<li>
|
|
86
|
-
<Trans>Complete the payment on your bank
|
|
74
|
+
<Trans>Complete the payment on your bank’s website.</Trans>
|
|
87
75
|
</li>
|
|
88
76
|
<li>
|
|
89
77
|
<Trans>
|
|
@@ -9,11 +9,11 @@ import { Typography, Alert } from '@mui/material'
|
|
|
9
9
|
import Script from 'next/script'
|
|
10
10
|
import React, { useEffect, useState } from 'react'
|
|
11
11
|
import { Mollie } from '../../Mollie'
|
|
12
|
-
import MollieField from './MollieField'
|
|
12
|
+
import { MollieField } from './MollieField'
|
|
13
13
|
import { SetMolliePaymentMethodTokenOnCartDocument } from './SetMolliePaymentMethodTokenOnCart.gql'
|
|
14
14
|
import { mollieContext, MollieContext } from './mollieContext'
|
|
15
15
|
|
|
16
|
-
export
|
|
16
|
+
export function MollieCreditCardOptions(props: PaymentOptionsProps) {
|
|
17
17
|
const { code, step, Container, title = '' } = props
|
|
18
18
|
const [loaded, setLoaded] = useState<boolean>(false)
|
|
19
19
|
const [mollie, setMollie] = useState<MollieContext>(undefined)
|
|
@@ -14,7 +14,7 @@ import { useMollieContext } from './mollieContext'
|
|
|
14
14
|
type MollieFieldContext = [ComponentFieldState, Dispatch<SetStateAction<ComponentFieldState>>]
|
|
15
15
|
const mollieFieldContext = React.createContext(undefined as unknown as MollieFieldContext)
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
function InputComponent(props) {
|
|
18
18
|
const { component, inputRef, ...other } = props
|
|
19
19
|
const Component = component as typeof IframeField
|
|
20
20
|
return <Component {...other} ref={inputRef} />
|
|
@@ -25,7 +25,7 @@ type IframeFieldProps = Omit<InputBaseComponentProps, 'onChange'> & {
|
|
|
25
25
|
onChange: (event: { target: { name: string; value: string } }) => void
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
const IframeField = React.forwardRef<
|
|
28
|
+
const IframeField = React.forwardRef<HTMLInputElement, IframeFieldProps>((props, forwardedRef) => {
|
|
29
29
|
const { name, onChange, onFocus, onBlur, ...otherProps } = props
|
|
30
30
|
const internalRef = useRef<HTMLDivElement>(null)
|
|
31
31
|
const forkRef = forwardedRef
|
|
@@ -98,7 +98,7 @@ type MollieFieldProps = {
|
|
|
98
98
|
isSubmitted?: boolean
|
|
99
99
|
} & TextFieldProps
|
|
100
100
|
|
|
101
|
-
export
|
|
101
|
+
export function MollieField(props: MollieFieldProps) {
|
|
102
102
|
const { isSubmitted = false, label, ...fieldProps } = props
|
|
103
103
|
|
|
104
104
|
const [state, setState] = useState<ComponentFieldState>({
|
|
@@ -1,34 +1,102 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { PaymentStatusEnum, useMutation } from '@graphcommerce/graphql'
|
|
2
|
+
import {
|
|
3
|
+
ApolloCartErrorFullPage,
|
|
4
|
+
useClearCurrentCartId,
|
|
5
|
+
useCurrentCartId,
|
|
6
|
+
} from '@graphcommerce/magento-cart'
|
|
7
|
+
import { usePaymentMethodContext } from '@graphcommerce/magento-cart-payment-method'
|
|
8
|
+
import { ErrorSnackbar } from '@graphcommerce/next-ui'
|
|
9
|
+
import { Trans } from '@lingui/macro'
|
|
2
10
|
import { Button, Dialog } from '@mui/material'
|
|
3
11
|
import { useRouter } from 'next/router'
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
12
|
+
import { useEffect } from 'react'
|
|
13
|
+
import { useCartLockWithToken } from '../../hooks/useCartLockWithToken'
|
|
14
|
+
import { MolliePaymentHandlerDocument } from './MolliePaymentHandler.gql'
|
|
15
|
+
import { MollieRecoverCartDocument } from './MollieRecoverCart.gql'
|
|
6
16
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
17
|
+
const successStatusses: PaymentStatusEnum[] = ['AUTHORIZED', 'COMPLETED', 'PAID', 'SHIPPING']
|
|
18
|
+
|
|
19
|
+
export function MolliePaymentHandler() {
|
|
10
20
|
const router = useRouter()
|
|
21
|
+
const method = usePaymentMethodContext()
|
|
22
|
+
const clear = useClearCurrentCartId()
|
|
23
|
+
|
|
24
|
+
const isMollie = method.selectedMethod?.code.startsWith('mollie_methods')
|
|
11
25
|
|
|
12
|
-
const
|
|
13
|
-
|
|
26
|
+
const [lockState] = useCartLockWithToken()
|
|
27
|
+
|
|
28
|
+
const [handle, handleResult] = useMutation(MolliePaymentHandlerDocument)
|
|
29
|
+
const [recoverCart, recoverResult] = useMutation(MollieRecoverCartDocument)
|
|
30
|
+
|
|
31
|
+
const { called, error, data } = handleResult
|
|
32
|
+
|
|
33
|
+
useEffect(() => {
|
|
14
34
|
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
15
|
-
|
|
16
|
-
|
|
35
|
+
;(async () => {
|
|
36
|
+
if (lockState.locked && lockState.redirecting) return
|
|
37
|
+
|
|
38
|
+
if (!lockState.mollie_payment_token) return
|
|
39
|
+
if (called || error) return
|
|
40
|
+
|
|
41
|
+
const result = await handle({
|
|
42
|
+
variables: { mollie_payment_token: lockState.mollie_payment_token },
|
|
43
|
+
})
|
|
44
|
+
|
|
45
|
+
const paymentStatus = result.data?.mollieProcessTransaction?.paymentStatus
|
|
46
|
+
let returnedCartId = result.data?.mollieProcessTransaction?.cart?.id
|
|
47
|
+
|
|
48
|
+
if (paymentStatus === 'OPEN' && lockState.cart_id) {
|
|
49
|
+
const res = await recoverCart({ variables: { cartId: lockState.cart_id } })
|
|
50
|
+
returnedCartId = res.data?.mollieRestoreCart?.cart.id
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
if (result.errors || !paymentStatus) return
|
|
54
|
+
|
|
55
|
+
if (successStatusses.includes(paymentStatus)) {
|
|
56
|
+
clear()
|
|
57
|
+
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
58
|
+
await router.push({ pathname: '/checkout/success', query: { cart_id: lockState.cart_id } })
|
|
59
|
+
} else if (returnedCartId) {
|
|
60
|
+
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
61
|
+
router.replace('/checkout/payment')
|
|
62
|
+
}
|
|
63
|
+
})()
|
|
64
|
+
}, [called, clear, error, handle, lockState, recoverCart, router])
|
|
65
|
+
|
|
66
|
+
const paymentStatus = data?.mollieProcessTransaction?.paymentStatus
|
|
67
|
+
if (paymentStatus)
|
|
68
|
+
return (
|
|
69
|
+
<ErrorSnackbar open>
|
|
70
|
+
<Trans>Payment failed with status: {paymentStatus}</Trans>
|
|
71
|
+
</ErrorSnackbar>
|
|
72
|
+
)
|
|
73
|
+
|
|
74
|
+
if (!error || recoverResult.loading) return null
|
|
17
75
|
|
|
18
|
-
if (!error) return null
|
|
19
76
|
return (
|
|
20
77
|
<Dialog open fullWidth>
|
|
21
78
|
<ApolloCartErrorFullPage
|
|
22
79
|
error={error}
|
|
23
80
|
disableMargin
|
|
24
81
|
button={
|
|
25
|
-
<Button
|
|
26
|
-
|
|
82
|
+
<Button
|
|
83
|
+
variant='contained'
|
|
84
|
+
color='primary'
|
|
85
|
+
size='large'
|
|
86
|
+
onClick={() => {
|
|
87
|
+
clear()
|
|
88
|
+
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
89
|
+
router.push('/')
|
|
90
|
+
}}
|
|
91
|
+
>
|
|
92
|
+
<Trans>Reset Cart and Return to home</Trans>
|
|
27
93
|
</Button>
|
|
28
94
|
}
|
|
29
95
|
>
|
|
30
|
-
|
|
31
|
-
|
|
96
|
+
<Trans>
|
|
97
|
+
If you’ve successfully paid your order, the order <strong>will</strong> come through, but
|
|
98
|
+
there is a communication error with the website.
|
|
99
|
+
</Trans>
|
|
32
100
|
</ApolloCartErrorFullPage>
|
|
33
101
|
</Dialog>
|
|
34
102
|
)
|
|
@@ -1,13 +1,7 @@
|
|
|
1
1
|
import { PaymentToggleProps } from '@graphcommerce/magento-cart-payment-method'
|
|
2
2
|
|
|
3
|
-
export
|
|
4
|
-
const {
|
|
3
|
+
export function PaymentToggle(props: PaymentToggleProps) {
|
|
4
|
+
const { title } = props
|
|
5
5
|
|
|
6
|
-
return
|
|
7
|
-
<>
|
|
8
|
-
{mollie_meta?.image && <img src={mollie_meta?.image} alt={title} />}
|
|
9
|
-
|
|
10
|
-
{title}
|
|
11
|
-
</>
|
|
12
|
-
)
|
|
6
|
+
return <>{title}</>
|
|
13
7
|
}
|
|
@@ -3,18 +3,18 @@ import {
|
|
|
3
3
|
useCurrentCartId,
|
|
4
4
|
useFormGqlMutationCart,
|
|
5
5
|
} from '@graphcommerce/magento-cart'
|
|
6
|
-
import { PaymentPlaceOrderProps
|
|
6
|
+
import { PaymentPlaceOrderProps } from '@graphcommerce/magento-cart-payment-method'
|
|
7
7
|
import { useFormCompose } from '@graphcommerce/react-hook-form'
|
|
8
8
|
import { useRouter } from 'next/router'
|
|
9
9
|
import { useEffect } from 'react'
|
|
10
|
+
import { useCartLockWithToken } from '../../hooks/useCartLockWithToken'
|
|
10
11
|
import { MolliePlaceOrderDocument } from './MolliePlaceOrder.gql'
|
|
11
12
|
|
|
12
|
-
export
|
|
13
|
+
export function MolliePlaceOrder(props: PaymentPlaceOrderProps) {
|
|
13
14
|
const { step, code } = props
|
|
14
|
-
const
|
|
15
|
+
const { push } = useRouter()
|
|
15
16
|
const cartId = useCurrentCartId()
|
|
16
|
-
const
|
|
17
|
-
const { lock } = useCartLock()
|
|
17
|
+
const [, lock] = useCartLockWithToken()
|
|
18
18
|
|
|
19
19
|
const form = useFormGqlMutationCart(MolliePlaceOrderDocument, { mode: 'onChange' })
|
|
20
20
|
|
|
@@ -22,32 +22,27 @@ export default function MolliePlaceOrder(props: PaymentPlaceOrderProps) {
|
|
|
22
22
|
|
|
23
23
|
useEffect(() => {
|
|
24
24
|
const current = new URL(window.location.href.replace(window.location.hash, ''))
|
|
25
|
-
current.searchParams.append('
|
|
25
|
+
// current.searchParams.append('locked', '1')
|
|
26
|
+
current.searchParams.set('cart_id', cartId ?? '')
|
|
27
|
+
current.searchParams.set('mollie_payment_token', 'PAYMENT_TOKEN')
|
|
26
28
|
const replaced = current.toString().replace('PAYMENT_TOKEN', '{{payment_token}}')
|
|
27
29
|
setValue('returnUrl', replaced)
|
|
28
|
-
}, [setValue])
|
|
30
|
+
}, [cartId, setValue])
|
|
29
31
|
|
|
30
32
|
const submit = handleSubmit(() => {})
|
|
31
33
|
|
|
32
34
|
useEffect(() => {
|
|
33
35
|
if (!data?.placeOrder?.order || error || !cartId) return
|
|
34
36
|
const redirectUrl = data?.placeOrder?.order.mollie_redirect_url
|
|
35
|
-
const
|
|
37
|
+
const mollie_payment_token = data?.placeOrder?.order.mollie_payment_token
|
|
36
38
|
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
setTimeout(() => {
|
|
41
|
-
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
42
|
-
router.push(redirectUrl)
|
|
43
|
-
}, 500)
|
|
44
|
-
}
|
|
45
|
-
if (!redirectUrl && molliePaymentToken) {
|
|
46
|
-
clear()
|
|
39
|
+
// When redirecting to the payment gateway
|
|
40
|
+
if (redirectUrl && mollie_payment_token) {
|
|
41
|
+
lock({ mollie_payment_token })
|
|
47
42
|
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
48
|
-
|
|
43
|
+
push(redirectUrl)
|
|
49
44
|
}
|
|
50
|
-
}, [cartId,
|
|
45
|
+
}, [cartId, data?.placeOrder?.order, error, lock, push])
|
|
51
46
|
|
|
52
47
|
useFormCompose({ form, step, submit, key: `PaymentMethodPlaceOrder_${code}` })
|
|
53
48
|
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { CartLockState, useCartLock } from '@graphcommerce/magento-cart-payment-method'
|
|
2
|
+
import { useState } from 'react'
|
|
3
|
+
|
|
4
|
+
type MollieLockState = { mollie_payment_token?: string }
|
|
5
|
+
|
|
6
|
+
export const useCartLockWithToken = () => {
|
|
7
|
+
const [queryState, setRouterQuery] = useCartLock<MollieLockState>()
|
|
8
|
+
const [redirecting, setRedirecting] = useState(false)
|
|
9
|
+
|
|
10
|
+
const lock = (params: MollieLockState & CartLockState) => {
|
|
11
|
+
setRedirecting(true)
|
|
12
|
+
setRouterQuery(params)
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const state = {
|
|
16
|
+
...queryState,
|
|
17
|
+
locked: queryState.locked === '1',
|
|
18
|
+
redirecting,
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
return [state, lock] as const
|
|
22
|
+
}
|
package/index.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { PaymentModule } from '@graphcommerce/magento-cart-payment-method'
|
|
2
|
-
import MollieCreditCardOptions from '../components/MollieOptionsToken/MollieCreditCardOptions'
|
|
3
|
-
import
|
|
4
|
-
import MolliePlaceOrder from '../components/MolliePlaceOrder/MolliePlaceOrder'
|
|
1
|
+
import { PaymentMethodOptionsNoop, PaymentModule } from '@graphcommerce/magento-cart-payment-method'
|
|
2
|
+
import { MollieCreditCardOptions } from '../components/MollieOptionsToken/MollieCreditCardOptions'
|
|
3
|
+
import { PaymentToggle } from '../components/MolliePaymentToggle/MolliePaymentToggle'
|
|
4
|
+
import { MolliePlaceOrder } from '../components/MolliePlaceOrder/MolliePlaceOrder'
|
|
5
5
|
|
|
6
6
|
export const mollie_methods_creditcard: PaymentModule = {
|
|
7
|
-
PaymentToggle
|
|
8
|
-
PaymentOptions:
|
|
7
|
+
PaymentToggle,
|
|
8
|
+
PaymentOptions: PaymentMethodOptionsNoop,
|
|
9
9
|
PaymentPlaceOrder: MolliePlaceOrder,
|
|
10
10
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { PaymentModule } from '@graphcommerce/magento-cart-payment-method'
|
|
2
|
-
import MollieIdealOptions from '../components/MollieOptionsIssuer/MollieIdealOptions'
|
|
3
|
-
import MolliePaymentHandler from '../components/MolliePaymentHandler/MolliePaymentHandler'
|
|
4
|
-
import
|
|
5
|
-
import MolliePlaceOrder from '../components/MolliePlaceOrder/MolliePlaceOrder'
|
|
2
|
+
import { MollieIdealOptions } from '../components/MollieOptionsIssuer/MollieIdealOptions'
|
|
3
|
+
import { MolliePaymentHandler } from '../components/MolliePaymentHandler/MolliePaymentHandler'
|
|
4
|
+
import { PaymentToggle } from '../components/MolliePaymentToggle/MolliePaymentToggle'
|
|
5
|
+
import { MolliePlaceOrder } from '../components/MolliePlaceOrder/MolliePlaceOrder'
|
|
6
6
|
|
|
7
7
|
export const mollie_methods_ideal: PaymentModule = {
|
|
8
|
-
PaymentToggle
|
|
8
|
+
PaymentToggle,
|
|
9
9
|
PaymentOptions: MollieIdealOptions,
|
|
10
10
|
PaymentPlaceOrder: MolliePlaceOrder,
|
|
11
11
|
PaymentHandler: MolliePaymentHandler,
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
import { PaymentMethodOptionsNoop, PaymentModule } from '@graphcommerce/magento-cart-payment-method'
|
|
2
|
-
import
|
|
3
|
-
import MolliePlaceOrder from '../components/MolliePlaceOrder/MolliePlaceOrder'
|
|
2
|
+
import { MolliePlaceOrder } from '../components/MolliePlaceOrder/MolliePlaceOrder'
|
|
4
3
|
|
|
5
4
|
export const mollie_methods_klarnapaylater: PaymentModule = {
|
|
6
|
-
PaymentToggle: MollieToggle,
|
|
7
5
|
PaymentOptions: PaymentMethodOptionsNoop,
|
|
8
6
|
PaymentPlaceOrder: MolliePlaceOrder,
|
|
9
7
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { PaymentMethodOptionsNoop, PaymentModule } from '@graphcommerce/magento-cart-payment-method'
|
|
2
|
-
import
|
|
3
|
-
import MolliePlaceOrder from '../components/MolliePlaceOrder/MolliePlaceOrder'
|
|
2
|
+
import { PaymentToggle } from '../components/MolliePaymentToggle/MolliePaymentToggle'
|
|
3
|
+
import { MolliePlaceOrder } from '../components/MolliePlaceOrder/MolliePlaceOrder'
|
|
4
4
|
|
|
5
5
|
export const mollie_methods_paypal: PaymentModule = {
|
|
6
|
-
PaymentToggle
|
|
6
|
+
PaymentToggle,
|
|
7
7
|
PaymentOptions: PaymentMethodOptionsNoop,
|
|
8
8
|
PaymentPlaceOrder: MolliePlaceOrder,
|
|
9
9
|
}
|
package/next-env.d.ts
ADDED
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@graphcommerce/mollie-magento-payment",
|
|
3
3
|
"homepage": "https://www.graphcommerce.org/",
|
|
4
4
|
"repository": "github:graphcommerce-org/graphcommerce",
|
|
5
|
-
"version": "3.0
|
|
5
|
+
"version": "3.1.0",
|
|
6
6
|
"sideEffects": false,
|
|
7
7
|
"engines": {
|
|
8
8
|
"node": "14.x"
|
|
@@ -15,23 +15,23 @@
|
|
|
15
15
|
}
|
|
16
16
|
},
|
|
17
17
|
"devDependencies": {
|
|
18
|
-
"@graphcommerce/eslint-config-pwa": "^4.
|
|
19
|
-
"@graphcommerce/magento-cart-shipping-address": "^3.0.
|
|
20
|
-
"@graphcommerce/magento-product": "^4.
|
|
21
|
-
"@graphcommerce/magento-product-configurable": "^4.0.
|
|
22
|
-
"@graphcommerce/prettier-config-pwa": "^4.0.
|
|
18
|
+
"@graphcommerce/eslint-config-pwa": "^4.1.3",
|
|
19
|
+
"@graphcommerce/magento-cart-shipping-address": "^3.0.5",
|
|
20
|
+
"@graphcommerce/magento-product": "^4.1.3",
|
|
21
|
+
"@graphcommerce/magento-product-configurable": "^4.0.7",
|
|
22
|
+
"@graphcommerce/prettier-config-pwa": "^4.0.5",
|
|
23
23
|
"@graphcommerce/typescript-config-pwa": "^4.0.2",
|
|
24
|
-
"@playwright/test": "^1.
|
|
24
|
+
"@playwright/test": "^1.20.1",
|
|
25
|
+
"type-fest": "2.12.1"
|
|
25
26
|
},
|
|
26
27
|
"dependencies": {
|
|
27
|
-
"@graphcommerce/graphql": "^3.0.
|
|
28
|
-
"@graphcommerce/image": "^3.1.
|
|
29
|
-
"@graphcommerce/magento-cart": "^4.
|
|
30
|
-
"@graphcommerce/magento-cart-payment-method": "^3.0.
|
|
31
|
-
"@graphcommerce/magento-store": "^4.
|
|
32
|
-
"@graphcommerce/next-ui": "^4.
|
|
33
|
-
"@graphcommerce/react-hook-form": "^3.0.
|
|
34
|
-
"type-fest": "^2.12.0"
|
|
28
|
+
"@graphcommerce/graphql": "^3.0.6",
|
|
29
|
+
"@graphcommerce/image": "^3.1.2",
|
|
30
|
+
"@graphcommerce/magento-cart": "^4.2.2",
|
|
31
|
+
"@graphcommerce/magento-cart-payment-method": "^3.0.6",
|
|
32
|
+
"@graphcommerce/magento-store": "^4.1.4",
|
|
33
|
+
"@graphcommerce/next-ui": "^4.5.0",
|
|
34
|
+
"@graphcommerce/react-hook-form": "^3.0.6"
|
|
35
35
|
},
|
|
36
36
|
"peerDependencies": {
|
|
37
37
|
"@lingui/macro": "^3.13.2",
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-non-null-assertion */
|
|
2
|
+
import { waitForGraphQlResponse } from '@graphcommerce/graphql/test/apolloClient.fixture'
|
|
3
|
+
import { goToPayment } from '@graphcommerce/magento-cart-payment-method/test/goToPayment'
|
|
4
|
+
import { addConfigurableProductToCart } from '@graphcommerce/magento-product-configurable/test/addConfigurableProductToCart'
|
|
5
|
+
import { test } from '@graphcommerce/magento-product/test/productURL.fixture'
|
|
6
|
+
import { expect, Page } from '@playwright/test'
|
|
7
|
+
import { MolliePaymentHandlerDocument } from '../components/MolliePaymentHandler/MolliePaymentHandler.gql'
|
|
8
|
+
|
|
9
|
+
const selectCreditCard = async (page: Page) => {
|
|
10
|
+
await page.click('button[value=mollie_methods_creditcard]')
|
|
11
|
+
|
|
12
|
+
// Select Rabobank
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
type Statuses = 'paid' | 'failed' | 'canceled' | 'open' | 'expired'
|
|
16
|
+
|
|
17
|
+
const placeOrder = async (page: Page, status: Statuses) => {
|
|
18
|
+
await Promise.all([page.waitForNavigation(), page.click('#place-order')])
|
|
19
|
+
|
|
20
|
+
await page.pause()
|
|
21
|
+
// await page.click(`input[name="final_state"][value=${status}]`)
|
|
22
|
+
// await Promise.all([page.waitForNavigation(), page.click('.footer button')])
|
|
23
|
+
|
|
24
|
+
const result = await waitForGraphQlResponse(page, MolliePaymentHandlerDocument)
|
|
25
|
+
expect(result.errors).toBeUndefined()
|
|
26
|
+
expect(result.data?.mollieProcessTransaction?.paymentStatus).toBe(status.toUpperCase())
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
test.describe('mollie creditcard place order', () => {
|
|
30
|
+
// test('CANCELED', async ({ page, productURL, apolloClient }) => {
|
|
31
|
+
// await addConfigurableProductToCart(page, productURL.ConfigurableProduct)
|
|
32
|
+
// await goToPayment(page, apolloClient)
|
|
33
|
+
// await selectCreditCard(page)
|
|
34
|
+
// await placeOrder(page, 'canceled')
|
|
35
|
+
// await placeOrder(page, 'paid')
|
|
36
|
+
// expect(await page.locator('text=Back to home').innerText()).toBeDefined()
|
|
37
|
+
// })
|
|
38
|
+
|
|
39
|
+
// test('OPEN', async ({ page, productURL, apolloClient }) => {
|
|
40
|
+
// await addConfigurableProductToCart(page, productURL.ConfigurableProduct)
|
|
41
|
+
// await goToPayment(page, apolloClient)
|
|
42
|
+
// await selectIdeal(page)
|
|
43
|
+
// await placeOrder(page, 'open')
|
|
44
|
+
// await placeOrder(page, 'paid')
|
|
45
|
+
// expect(await page.locator('text=Back to home').innerText()).toBeDefined()
|
|
46
|
+
// })
|
|
47
|
+
|
|
48
|
+
test('PAID', async ({ page, productURL, apolloClient }) => {
|
|
49
|
+
await addConfigurableProductToCart(page, productURL.ConfigurableProduct)
|
|
50
|
+
await goToPayment(page, apolloClient)
|
|
51
|
+
await selectCreditCard(page)
|
|
52
|
+
await placeOrder(page, 'paid')
|
|
53
|
+
expect(await page.locator('text=Back to home').innerText()).toBeDefined()
|
|
54
|
+
})
|
|
55
|
+
|
|
56
|
+
// test('Pressed back', async ({ page, productURL, apolloClient }) => {
|
|
57
|
+
// await addConfigurableProductToCart(page, productURL.ConfigurableProduct)
|
|
58
|
+
// await goToPayment(page, apolloClient)
|
|
59
|
+
// await selectIdeal(page)
|
|
60
|
+
// await Promise.all([page.waitForNavigation(), page.click('#place-order')])
|
|
61
|
+
|
|
62
|
+
// await page.pause()
|
|
63
|
+
// await page.goBack()
|
|
64
|
+
|
|
65
|
+
// expect(await page.locator('text=Payment failed with status: OPEN').innerText()).toBeDefined()
|
|
66
|
+
|
|
67
|
+
// await placeOrder(page, 'paid')
|
|
68
|
+
// expect(await page.locator('text=Back to home').innerText()).toBeDefined()
|
|
69
|
+
// })
|
|
70
|
+
})
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-non-null-assertion */
|
|
2
|
+
import { waitForGraphQlResponse } from '@graphcommerce/graphql/test/apolloClient.fixture'
|
|
3
|
+
import { goToPayment } from '@graphcommerce/magento-cart-payment-method/test/goToPayment'
|
|
4
|
+
import { addConfigurableProductToCart } from '@graphcommerce/magento-product-configurable/test/addConfigurableProductToCart'
|
|
5
|
+
import { test } from '@graphcommerce/magento-product/test/productURL.fixture'
|
|
6
|
+
import { expect, Page } from '@playwright/test'
|
|
7
|
+
import { MolliePaymentHandlerDocument } from '../components/MolliePaymentHandler/MolliePaymentHandler.gql'
|
|
8
|
+
|
|
9
|
+
const selectIdeal = async (page: Page) => {
|
|
10
|
+
await page.click('button[value=mollie_methods_ideal]')
|
|
11
|
+
|
|
12
|
+
// Select Rabobank
|
|
13
|
+
await page.selectOption('select[name="issuer"]', 'ideal_RABONL2U')
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
type Statuses = 'paid' | 'failed' | 'canceled' | 'open' | 'expired'
|
|
17
|
+
|
|
18
|
+
const placeOrder = async (page: Page, status: Statuses) => {
|
|
19
|
+
await Promise.all([page.waitForNavigation(), page.click('#place-order')])
|
|
20
|
+
|
|
21
|
+
await page.click(`input[name="final_state"][value=${status}]`)
|
|
22
|
+
await Promise.all([page.waitForNavigation(), page.click('.footer button')])
|
|
23
|
+
|
|
24
|
+
const result = await waitForGraphQlResponse(page, MolliePaymentHandlerDocument)
|
|
25
|
+
expect(result.errors).toBeUndefined()
|
|
26
|
+
expect(result.data?.mollieProcessTransaction?.paymentStatus).toBe(status.toUpperCase())
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
test.describe('mollie ideal place order', () => {
|
|
30
|
+
test('CANCELED', async ({ page, productURL, apolloClient }) => {
|
|
31
|
+
await addConfigurableProductToCart(page, productURL.ConfigurableProduct)
|
|
32
|
+
await goToPayment(page, apolloClient)
|
|
33
|
+
await selectIdeal(page)
|
|
34
|
+
await placeOrder(page, 'canceled')
|
|
35
|
+
await placeOrder(page, 'paid')
|
|
36
|
+
expect(await page.locator('text=Back to home').innerText()).toBeDefined()
|
|
37
|
+
})
|
|
38
|
+
|
|
39
|
+
test('OPEN', async ({ page, productURL, apolloClient }) => {
|
|
40
|
+
await addConfigurableProductToCart(page, productURL.ConfigurableProduct)
|
|
41
|
+
await goToPayment(page, apolloClient)
|
|
42
|
+
await selectIdeal(page)
|
|
43
|
+
await placeOrder(page, 'open')
|
|
44
|
+
await placeOrder(page, 'paid')
|
|
45
|
+
expect(await page.locator('text=Back to home').innerText()).toBeDefined()
|
|
46
|
+
})
|
|
47
|
+
|
|
48
|
+
test('PAID', async ({ page, productURL, apolloClient }) => {
|
|
49
|
+
await addConfigurableProductToCart(page, productURL.ConfigurableProduct)
|
|
50
|
+
await goToPayment(page, apolloClient)
|
|
51
|
+
await selectIdeal(page)
|
|
52
|
+
await placeOrder(page, 'paid')
|
|
53
|
+
expect(await page.locator('text=Back to home').innerText()).toBeDefined()
|
|
54
|
+
})
|
|
55
|
+
|
|
56
|
+
test('Pressed back', async ({ page, productURL, apolloClient }) => {
|
|
57
|
+
await addConfigurableProductToCart(page, productURL.ConfigurableProduct)
|
|
58
|
+
await goToPayment(page, apolloClient)
|
|
59
|
+
await selectIdeal(page)
|
|
60
|
+
await Promise.all([page.waitForNavigation(), page.click('#place-order')])
|
|
61
|
+
|
|
62
|
+
await page.pause()
|
|
63
|
+
await page.goBack()
|
|
64
|
+
|
|
65
|
+
expect(await page.locator('text=Payment failed with status: OPEN').innerText()).toBeDefined()
|
|
66
|
+
|
|
67
|
+
await placeOrder(page, 'paid')
|
|
68
|
+
expect(await page.locator('text=Back to home').innerText()).toBeDefined()
|
|
69
|
+
})
|
|
70
|
+
})
|
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
/* eslint-disable @typescript-eslint/no-non-null-assertion */
|
|
2
|
-
import { waitForGraphQlResponse } from '@graphcommerce/graphql/_playwright/apolloClient.fixture'
|
|
3
|
-
import { fillShippingAddressForm } from '@graphcommerce/magento-cart-shipping-address/_playwright/fillShippingAddressForm'
|
|
4
|
-
import { fillCartAgreementsForm } from '@graphcommerce/magento-cart/_playwright/fillCartAgreementsForm'
|
|
5
|
-
import { addConfigurableProductToCart } from '@graphcommerce/magento-product-configurable/_playwright/addConfigurableProductToCart'
|
|
6
|
-
import { test } from '@graphcommerce/magento-product/_playwright/productURL.fixture'
|
|
7
|
-
import { expect, Page } from '@playwright/test'
|
|
8
|
-
import { MolliePlaceOrderDocument } from '../components/MolliePlaceOrder/MolliePlaceOrder.gql'
|
|
9
|
-
import { UseMolliePaymentTokenHandlerDocument } from '../hooks/UseMolliePaymentTokenHandler.gql'
|
|
10
|
-
|
|
11
|
-
const goToPayment = async (page: Page) => {
|
|
12
|
-
await page.click('a:has-text("View shopping cart")')
|
|
13
|
-
|
|
14
|
-
await page.click('a[href="/checkout"]:last-of-type')
|
|
15
|
-
|
|
16
|
-
await page.click('input[name="email"]')
|
|
17
|
-
await page.fill('input[name="email"]', 'test@test.com')
|
|
18
|
-
|
|
19
|
-
await fillShippingAddressForm(page)
|
|
20
|
-
|
|
21
|
-
await page.click('button[value=flatrate-flatrate]')
|
|
22
|
-
await page.click('button:has-text("Next")')
|
|
23
|
-
|
|
24
|
-
// Select the iDEAL option
|
|
25
|
-
await page.click('button[value=mollie_methods_ideal___]')
|
|
26
|
-
|
|
27
|
-
// Select Rabobank
|
|
28
|
-
await page.selectOption('select[name="issuer"]', 'ideal_RABONL2U')
|
|
29
|
-
|
|
30
|
-
await fillCartAgreementsForm(page)
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
test.describe('mollie ideal place order', () => {
|
|
34
|
-
test('CANCELED', async ({ page, productURL }) => {
|
|
35
|
-
test.fixme()
|
|
36
|
-
await addConfigurableProductToCart(page, productURL.ConfigurableProduct)
|
|
37
|
-
await goToPayment(page)
|
|
38
|
-
|
|
39
|
-
// Place the order and wait for the the redirect to the new page.
|
|
40
|
-
await Promise.all([page.waitForNavigation(), page.click('button[name="placeOrder"]')])
|
|
41
|
-
|
|
42
|
-
// Let the order fail
|
|
43
|
-
await page.click('input[name="final_state"][value=canceled]')
|
|
44
|
-
|
|
45
|
-
// Return to the website.
|
|
46
|
-
await Promise.all([page.waitForNavigation(), page.click('.footer button')])
|
|
47
|
-
|
|
48
|
-
const result = await waitForGraphQlResponse(page, UseMolliePaymentTokenHandlerDocument)
|
|
49
|
-
expect(result.errors).toBeUndefined()
|
|
50
|
-
expect(result.data?.mollieProcessTransaction?.paymentStatus).toBe('CANCELED')
|
|
51
|
-
|
|
52
|
-
// Select Rabobank
|
|
53
|
-
await page.selectOption('select[name="issuer"]', 'ideal_RABONL2U')
|
|
54
|
-
|
|
55
|
-
// Place the order and wait for the the redirect to the new page.
|
|
56
|
-
await Promise.all([page.waitForNavigation(), page.click('button[name="placeOrder"]')])
|
|
57
|
-
|
|
58
|
-
const placeOrder = await waitForGraphQlResponse(page, MolliePlaceOrderDocument)
|
|
59
|
-
expect(placeOrder.errors).toBeUndefined()
|
|
60
|
-
})
|
|
61
|
-
|
|
62
|
-
test('PAID', async ({ page, productURL }) => {
|
|
63
|
-
await addConfigurableProductToCart(page, productURL.ConfigurableProduct)
|
|
64
|
-
await goToPayment(page)
|
|
65
|
-
|
|
66
|
-
await page.pause()
|
|
67
|
-
|
|
68
|
-
// Place the order and wait for the the redirect to the new page.
|
|
69
|
-
await Promise.all([page.waitForNavigation(), page.click('button[name="placeOrder"]')])
|
|
70
|
-
|
|
71
|
-
// Let the order fail
|
|
72
|
-
await page.click('input[name="final_state"][value=paid]')
|
|
73
|
-
|
|
74
|
-
// Return to the website.
|
|
75
|
-
await Promise.all([page.waitForNavigation(), page.click('.footer button')])
|
|
76
|
-
|
|
77
|
-
const result = await waitForGraphQlResponse(page, UseMolliePaymentTokenHandlerDocument)
|
|
78
|
-
expect(result.errors).toBeUndefined()
|
|
79
|
-
expect(result.data?.mollieProcessTransaction?.paymentStatus).toBe('PAID')
|
|
80
|
-
|
|
81
|
-
await page.waitForNavigation()
|
|
82
|
-
})
|
|
83
|
-
})
|
|
84
|
-
|
|
85
|
-
// test('place order failed', async ({ page, productURL }) => {
|
|
86
|
-
// await addConfigurableProductToCart(page, productURL.ConfigurableProduct)
|
|
87
|
-
// await goToPayment(page)
|
|
88
|
-
|
|
89
|
-
// // Place the order and wait for the the redirect to the new page.
|
|
90
|
-
// await Promise.all([page.waitForNavigation(), page.click('button[name="placeOrder"]')])
|
|
91
|
-
|
|
92
|
-
// // Let the order fail
|
|
93
|
-
// await page.click('input[name="final_state"][value=failed]')
|
|
94
|
-
|
|
95
|
-
// // Return to the website.
|
|
96
|
-
// await Promise.all([page.waitForNavigation(), page.click('.footer button')])
|
|
97
|
-
|
|
98
|
-
// const result = await waitForGraphQlResponse(page, UseMolliePaymentTokenHandlerDocument)
|
|
99
|
-
// expect(result.errors).toBeUndefined()
|
|
100
|
-
// expect(result.data?.mollieProcessTransaction?.paymentStatus).toBeDefined()
|
|
101
|
-
// })
|
package/hooks/index.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './useMolliePaymentTokenHandler'
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import { useMutation } from '@graphcommerce/graphql'
|
|
2
|
-
import { PaymentStatusEnum } from '@graphcommerce/graphql'
|
|
3
|
-
import { useClearCurrentCartId, useCurrentCartId } from '@graphcommerce/magento-cart'
|
|
4
|
-
import { useCartLock, usePaymentMethodContext } from '@graphcommerce/magento-cart-payment-method'
|
|
5
|
-
import { useRouter } from 'next/router'
|
|
6
|
-
import { useEffect } from 'react'
|
|
7
|
-
import { UseMolliePaymentTokenHandlerDocument } from './UseMolliePaymentTokenHandler.gql'
|
|
8
|
-
|
|
9
|
-
const successStatusses: PaymentStatusEnum[] = ['AUTHORIZED', 'COMPLETED', 'PAID', 'SHIPPING']
|
|
10
|
-
|
|
11
|
-
export function useMolliePaymentTokenHandler() {
|
|
12
|
-
const router = useRouter()
|
|
13
|
-
const method = usePaymentMethodContext()
|
|
14
|
-
const cartId = useCurrentCartId()
|
|
15
|
-
const clear = useClearCurrentCartId()
|
|
16
|
-
|
|
17
|
-
const isMollie = method.selectedMethod?.code.startsWith('mollie_methods')
|
|
18
|
-
|
|
19
|
-
const paymentToken = router.query.payment_token as string | undefined
|
|
20
|
-
// const orderHash = router.query.orderHash
|
|
21
|
-
const [handlePaymentToken, res] = useMutation(UseMolliePaymentTokenHandlerDocument, {
|
|
22
|
-
errorPolicy: 'all',
|
|
23
|
-
})
|
|
24
|
-
const { lock, locked } = useCartLock()
|
|
25
|
-
|
|
26
|
-
useEffect(() => {
|
|
27
|
-
if (locked && !paymentToken && isMollie) lock(false)
|
|
28
|
-
}, [isMollie, lock, locked, paymentToken])
|
|
29
|
-
|
|
30
|
-
useEffect(() => {
|
|
31
|
-
if (!paymentToken || res.called || res.error)
|
|
32
|
-
return // eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
33
|
-
;(async () => {
|
|
34
|
-
const result = await handlePaymentToken({ variables: { paymentToken } })
|
|
35
|
-
|
|
36
|
-
const paymentStatus = result.data?.mollieProcessTransaction?.paymentStatus
|
|
37
|
-
const returnedCartId = result.data?.mollieProcessTransaction?.cart?.id
|
|
38
|
-
|
|
39
|
-
if (result.errors || !paymentStatus) return
|
|
40
|
-
|
|
41
|
-
if (successStatusses.includes(paymentStatus)) {
|
|
42
|
-
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
43
|
-
await router.push({ pathname: '/checkout/success', query: { cartId } })
|
|
44
|
-
clear()
|
|
45
|
-
} else if (returnedCartId) {
|
|
46
|
-
lock(false)
|
|
47
|
-
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
48
|
-
router.replace('/checkout/payment')
|
|
49
|
-
} else {
|
|
50
|
-
throw Error('Mollie backend error occured')
|
|
51
|
-
}
|
|
52
|
-
})()
|
|
53
|
-
}, [
|
|
54
|
-
cartId,
|
|
55
|
-
clear,
|
|
56
|
-
handlePaymentToken,
|
|
57
|
-
isMollie,
|
|
58
|
-
lock,
|
|
59
|
-
paymentToken,
|
|
60
|
-
res.called,
|
|
61
|
-
res.error,
|
|
62
|
-
router,
|
|
63
|
-
])
|
|
64
|
-
|
|
65
|
-
return res
|
|
66
|
-
}
|