@graphcommerce/mollie-magento-payment 9.0.1 → 9.0.2
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
|
# Change Log
|
|
2
2
|
|
|
3
|
+
## 9.0.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [`dc70489`](https://github.com/graphcommerce-org/graphcommerce/commit/dc70489c82aaf532bed7a6a500de8eae988e3773) - Support Magento 2.4.7 placeOrder.errors field when placing a Mollie order ([@paales](https://github.com/paales))
|
|
8
|
+
|
|
9
|
+
## 9.0.2-canary.0
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- [`dc70489`](https://github.com/graphcommerce-org/graphcommerce/commit/dc70489c82aaf532bed7a6a500de8eae988e3773) - Support Magento 2.4.7 placeOrder.errors field when placing a Mollie order ([@paales](https://github.com/paales))
|
|
14
|
+
|
|
3
15
|
## 9.0.1
|
|
4
16
|
|
|
5
17
|
## 9.0.1-canary.1
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { useFormGqlMutationCart } from '@graphcommerce/magento-cart'
|
|
2
|
-
import type
|
|
2
|
+
import { type PaymentPlaceOrderProps } from '@graphcommerce/magento-cart-payment-method'
|
|
3
3
|
import { useFormCompose } from '@graphcommerce/react-hook-form'
|
|
4
|
-
import { t } from '@lingui/macro'
|
|
5
4
|
import { useRouter } from 'next/router'
|
|
6
5
|
import { useCartLockWithToken } from '../../hooks/useCartLockWithToken'
|
|
6
|
+
import { assertMollieOrderPlaced } from './assertMollieOrderPlaced'
|
|
7
7
|
import { MolliePlaceOrderDocument } from './MolliePlaceOrder.gql'
|
|
8
8
|
|
|
9
9
|
export function MolliePlaceOrder(props: PaymentPlaceOrderProps) {
|
|
@@ -27,21 +27,15 @@ export function MolliePlaceOrder(props: PaymentPlaceOrderProps) {
|
|
|
27
27
|
|
|
28
28
|
return { ...variables, returnUrl }
|
|
29
29
|
},
|
|
30
|
-
onComplete: async (
|
|
31
|
-
|
|
30
|
+
onComplete: async (result) => {
|
|
31
|
+
assertMollieOrderPlaced(result)
|
|
32
32
|
|
|
33
|
-
const {
|
|
33
|
+
const { mollie_payment_token, order_number, mollie_redirect_url } =
|
|
34
|
+
result.data.placeOrder.order
|
|
34
35
|
|
|
35
|
-
//
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
await push(mollie_redirect_url)
|
|
40
|
-
} else {
|
|
41
|
-
throw Error(
|
|
42
|
-
t`An error occurred while processing your payment. Please contact the store owner`,
|
|
43
|
-
)
|
|
44
|
-
}
|
|
36
|
+
// Redirect to the payment gateway
|
|
37
|
+
await lock({ mollie_payment_token, method: code, order_number })
|
|
38
|
+
await push(mollie_redirect_url)
|
|
45
39
|
},
|
|
46
40
|
})
|
|
47
41
|
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { type FetchResult } from '@graphcommerce/graphql'
|
|
2
|
+
import type { AssertedOrderPlaced, PlacedOrder } from '@graphcommerce/magento-cart-payment-method'
|
|
3
|
+
import {
|
|
4
|
+
assertOrderPlaced,
|
|
5
|
+
throwGenericPlaceOrderError,
|
|
6
|
+
} from '@graphcommerce/magento-cart-payment-method'
|
|
7
|
+
import type { MolliePlaceOrderMutation } from './MolliePlaceOrder.gql'
|
|
8
|
+
|
|
9
|
+
/** Assert that the order was place successfully. */
|
|
10
|
+
export function assertMollieOrderPlaced<T extends FetchResult<MolliePlaceOrderMutation>>(
|
|
11
|
+
result: T,
|
|
12
|
+
): asserts result is AssertedOrderPlaced<T> & {
|
|
13
|
+
data: {
|
|
14
|
+
placeOrder: {
|
|
15
|
+
order: PlacedOrder<T> & {
|
|
16
|
+
mollie_redirect_url: NonNullable<PlacedOrder<T>['mollie_redirect_url']>
|
|
17
|
+
mollie_payment_token: NonNullable<PlacedOrder<T>['mollie_payment_token']>
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
} {
|
|
22
|
+
assertOrderPlaced(result)
|
|
23
|
+
|
|
24
|
+
const { mollie_redirect_url, mollie_payment_token } = result.data.placeOrder.order
|
|
25
|
+
|
|
26
|
+
if (!mollie_redirect_url || !mollie_payment_token) {
|
|
27
|
+
console.error(
|
|
28
|
+
'Mollie: Order was placed, but no redirect url or payment token was returned, this is an issue on the Magento Mollie side.',
|
|
29
|
+
result,
|
|
30
|
+
)
|
|
31
|
+
throwGenericPlaceOrderError()
|
|
32
|
+
}
|
|
33
|
+
}
|
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": "9.0.
|
|
5
|
+
"version": "9.0.2",
|
|
6
6
|
"sideEffects": false,
|
|
7
7
|
"prettier": "@graphcommerce/prettier-config-pwa",
|
|
8
8
|
"eslintConfig": {
|
|
@@ -12,21 +12,21 @@
|
|
|
12
12
|
}
|
|
13
13
|
},
|
|
14
14
|
"peerDependencies": {
|
|
15
|
-
"@graphcommerce/ecommerce-ui": "^9.0.
|
|
16
|
-
"@graphcommerce/eslint-config-pwa": "^9.0.
|
|
17
|
-
"@graphcommerce/graphql": "^9.0.
|
|
18
|
-
"@graphcommerce/graphql-mesh": "^9.0.
|
|
19
|
-
"@graphcommerce/image": "^9.0.
|
|
20
|
-
"@graphcommerce/magento-cart": "^9.0.
|
|
21
|
-
"@graphcommerce/magento-cart-payment-method": "^9.0.
|
|
22
|
-
"@graphcommerce/magento-cart-shipping-address": "^9.0.
|
|
23
|
-
"@graphcommerce/magento-product": "^9.0.
|
|
24
|
-
"@graphcommerce/magento-product-configurable": "^9.0.
|
|
25
|
-
"@graphcommerce/magento-store": "^9.0.
|
|
26
|
-
"@graphcommerce/next-ui": "^9.0.
|
|
27
|
-
"@graphcommerce/prettier-config-pwa": "^9.0.
|
|
28
|
-
"@graphcommerce/react-hook-form": "^9.0.
|
|
29
|
-
"@graphcommerce/typescript-config-pwa": "^9.0.
|
|
15
|
+
"@graphcommerce/ecommerce-ui": "^9.0.2",
|
|
16
|
+
"@graphcommerce/eslint-config-pwa": "^9.0.2",
|
|
17
|
+
"@graphcommerce/graphql": "^9.0.2",
|
|
18
|
+
"@graphcommerce/graphql-mesh": "^9.0.2",
|
|
19
|
+
"@graphcommerce/image": "^9.0.2",
|
|
20
|
+
"@graphcommerce/magento-cart": "^9.0.2",
|
|
21
|
+
"@graphcommerce/magento-cart-payment-method": "^9.0.2",
|
|
22
|
+
"@graphcommerce/magento-cart-shipping-address": "^9.0.2",
|
|
23
|
+
"@graphcommerce/magento-product": "^9.0.2",
|
|
24
|
+
"@graphcommerce/magento-product-configurable": "^9.0.2",
|
|
25
|
+
"@graphcommerce/magento-store": "^9.0.2",
|
|
26
|
+
"@graphcommerce/next-ui": "^9.0.2",
|
|
27
|
+
"@graphcommerce/prettier-config-pwa": "^9.0.2",
|
|
28
|
+
"@graphcommerce/react-hook-form": "^9.0.2",
|
|
29
|
+
"@graphcommerce/typescript-config-pwa": "^9.0.2",
|
|
30
30
|
"@lingui/core": "^4.2.1",
|
|
31
31
|
"@lingui/macro": "^4.2.1",
|
|
32
32
|
"@lingui/react": "^4.2.1",
|