@graphcommerce/magento-payment-multisafepay 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,9 @@
1
1
  # @graphcommerce/magento-payment-multisafepay
2
2
 
3
+ ## 9.0.2
4
+
5
+ ## 9.0.2-canary.0
6
+
3
7
  ## 9.0.1
4
8
 
5
9
  ## 9.0.1-canary.1
@@ -1,5 +1,10 @@
1
1
  mutation MSPPaymentPlaceOrder($cartId: String!) {
2
2
  placeOrder(input: { cart_id: $cartId }) {
3
+ errors {
4
+ code
5
+ message
6
+ }
7
+
3
8
  order {
4
9
  order_number
5
10
  multisafepay_payment_url {
@@ -3,7 +3,11 @@ import { useMutation } from '@graphcommerce/graphql'
3
3
  import { useCartQuery, useFormGqlMutationCart } from '@graphcommerce/magento-cart'
4
4
  import { BillingPageDocument } from '@graphcommerce/magento-cart-checkout'
5
5
  import type { PaymentPlaceOrderProps } from '@graphcommerce/magento-cart-payment-method'
6
- import { usePaymentMethodContext } from '@graphcommerce/magento-cart-payment-method'
6
+ import {
7
+ assertOrderPlaced,
8
+ throwGenericPlaceOrderError,
9
+ usePaymentMethodContext,
10
+ } from '@graphcommerce/magento-cart-payment-method'
7
11
  import { ErrorSnackbar } from '@graphcommerce/next-ui'
8
12
  import { t } from '@lingui/macro'
9
13
  import { useRouter } from 'next/router'
@@ -27,14 +31,11 @@ export function MSPPaymentPlaceOrder(props: PaymentPlaceOrderProps) {
27
31
  */
28
32
  const form = useFormGqlMutationCart(MSPPaymentPlaceOrderDocument, {
29
33
  onComplete: async (result, variables) => {
30
- const url = result.data?.placeOrder?.order.multisafepay_payment_url
31
-
32
- if (result.errors) return
34
+ assertOrderPlaced(result)
35
+ const url = result.data.placeOrder.order.multisafepay_payment_url
33
36
 
34
37
  if (!selectedMethod?.code) {
35
- throw Error(
36
- t`An error occurred while processing your payment. Please contact the store owner`,
37
- )
38
+ throwGenericPlaceOrderError()
38
39
  }
39
40
 
40
41
  if (url?.error || !url?.payment_url) {
@@ -47,7 +48,7 @@ export function MSPPaymentPlaceOrder(props: PaymentPlaceOrderProps) {
47
48
 
48
49
  await lock({
49
50
  method: selectedMethod.code,
50
- order_number: result.data?.placeOrder?.order.order_number,
51
+ order_number: result.data.placeOrder.order.order_number,
51
52
  })
52
53
 
53
54
  await new Promise((resolve) => setTimeout(resolve, 1000))
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@graphcommerce/magento-payment-multisafepay",
3
3
  "homepage": "https://www.graphcommerce.org/",
4
4
  "repository": "github:graphcommerce-org/graphcommerce",
5
- "version": "9.0.1",
5
+ "version": "9.0.2",
6
6
  "sideEffects": false,
7
7
  "prettier": "@graphcommerce/prettier-config-pwa",
8
8
  "eslintConfig": {
@@ -12,22 +12,22 @@
12
12
  }
13
13
  },
14
14
  "peerDependencies": {
15
- "@graphcommerce/ecommerce-ui": "^9.0.1",
16
- "@graphcommerce/eslint-config-pwa": "^9.0.1",
17
- "@graphcommerce/graphql": "^9.0.1",
18
- "@graphcommerce/graphql-mesh": "^9.0.1",
19
- "@graphcommerce/image": "^9.0.1",
20
- "@graphcommerce/magento-cart": "^9.0.1",
21
- "@graphcommerce/magento-cart-checkout": "^9.0.1",
22
- "@graphcommerce/magento-cart-payment-method": "^9.0.1",
23
- "@graphcommerce/magento-cart-shipping-address": "^9.0.1",
24
- "@graphcommerce/magento-product": "^9.0.1",
25
- "@graphcommerce/magento-product-configurable": "^9.0.1",
26
- "@graphcommerce/magento-store": "^9.0.1",
27
- "@graphcommerce/next-ui": "^9.0.1",
28
- "@graphcommerce/prettier-config-pwa": "^9.0.1",
29
- "@graphcommerce/react-hook-form": "^9.0.1",
30
- "@graphcommerce/typescript-config-pwa": "^9.0.1",
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-checkout": "^9.0.2",
22
+ "@graphcommerce/magento-cart-payment-method": "^9.0.2",
23
+ "@graphcommerce/magento-cart-shipping-address": "^9.0.2",
24
+ "@graphcommerce/magento-product": "^9.0.2",
25
+ "@graphcommerce/magento-product-configurable": "^9.0.2",
26
+ "@graphcommerce/magento-store": "^9.0.2",
27
+ "@graphcommerce/next-ui": "^9.0.2",
28
+ "@graphcommerce/prettier-config-pwa": "^9.0.2",
29
+ "@graphcommerce/react-hook-form": "^9.0.2",
30
+ "@graphcommerce/typescript-config-pwa": "^9.0.2",
31
31
  "@lingui/core": "^4.2.1",
32
32
  "@lingui/macro": "^4.2.1",
33
33
  "@lingui/react": "^4.2.1",