@graphcommerce/magento-payment-adyen 9.0.1 → 9.0.2-canary.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,7 @@
1
1
  # @graphcommerce/magento-payment-adyen
2
2
 
3
+ ## 9.0.2-canary.0
4
+
3
5
  ## 9.0.1
4
6
 
5
7
  ## 9.0.1-canary.1
@@ -17,6 +17,11 @@ mutation AdyenPaymentOptionsAndPlaceOrder(
17
17
  }
18
18
  }
19
19
  placeOrder(input: { cart_id: $cartId }) {
20
+ errors {
21
+ code
22
+ message
23
+ }
24
+
20
25
  order {
21
26
  order_number
22
27
  adyen_payment_status {
@@ -1,7 +1,11 @@
1
1
  import { FormPersist, TextFieldElement, useFormCompose } from '@graphcommerce/ecommerce-ui'
2
2
  import { useFormGqlMutationCart } from '@graphcommerce/magento-cart'
3
3
  import type { PaymentOptionsProps } from '@graphcommerce/magento-cart-payment-method'
4
- import { usePaymentMethodContext } from '@graphcommerce/magento-cart-payment-method'
4
+ import {
5
+ assertOrderPlaced,
6
+ throwGenericPlaceOrderError,
7
+ usePaymentMethodContext,
8
+ } from '@graphcommerce/magento-cart-payment-method'
5
9
  import { FormRow } from '@graphcommerce/next-ui'
6
10
  import { t } from '@lingui/macro'
7
11
  import { useRouter } from 'next/router'
@@ -40,15 +44,18 @@ export function HppOptions(props: PaymentOptionsProps) {
40
44
  brandCode,
41
45
  }),
42
46
  onComplete: async (result) => {
47
+ assertOrderPlaced(result.data?.placeOrder)
43
48
  const merchantReference = result.data?.placeOrder?.order.order_number
44
49
  const action = result?.data?.placeOrder?.order.adyen_payment_status?.action
45
50
 
46
51
  if (result.errors) return
47
52
 
48
53
  if (!merchantReference || !selectedMethod?.code || !action) {
49
- throw Error(
50
- t`An error occurred while processing your payment. Please contact the store owner`,
54
+ console.error(
55
+ 'Adyen: Order was placed, but no merchant reference or action was returned, this is an issue on the Magento Adyen side.',
56
+ result,
51
57
  )
58
+ throwGenericPlaceOrderError()
52
59
  }
53
60
 
54
61
  const url = JSON.parse(action).url as string
@@ -31,10 +31,7 @@ export type AdyenPaymentResponse = {
31
31
  additionalData?: Types.checkout.PaymentResponse['additionalData']
32
32
  }
33
33
 
34
- /**
35
- * @deprecated Will be removed
36
- * @public
37
- */
34
+ /** @public */
38
35
  export function parsePaymentResponse(
39
36
  status?: AdyenPaymentResponseFragment | null,
40
37
  ): AdyenPaymentResponse {
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@graphcommerce/magento-payment-adyen",
3
3
  "homepage": "https://www.graphcommerce.org/",
4
4
  "repository": "github:graphcommerce-org/graphcommerce",
5
- "version": "9.0.1",
5
+ "version": "9.0.2-canary.0",
6
6
  "sideEffects": false,
7
7
  "prettier": "@graphcommerce/prettier-config-pwa",
8
8
  "eslintConfig": {
@@ -12,18 +12,18 @@
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-payment-method": "^9.0.1",
22
- "@graphcommerce/magento-product": "^9.0.1",
23
- "@graphcommerce/magento-store": "^9.0.1",
24
- "@graphcommerce/next-ui": "^9.0.1",
25
- "@graphcommerce/prettier-config-pwa": "^9.0.1",
26
- "@graphcommerce/typescript-config-pwa": "^9.0.1",
15
+ "@graphcommerce/ecommerce-ui": "^9.0.2-canary.0",
16
+ "@graphcommerce/eslint-config-pwa": "^9.0.2-canary.0",
17
+ "@graphcommerce/graphql": "^9.0.2-canary.0",
18
+ "@graphcommerce/graphql-mesh": "^9.0.2-canary.0",
19
+ "@graphcommerce/image": "^9.0.2-canary.0",
20
+ "@graphcommerce/magento-cart": "^9.0.2-canary.0",
21
+ "@graphcommerce/magento-cart-payment-method": "^9.0.2-canary.0",
22
+ "@graphcommerce/magento-product": "^9.0.2-canary.0",
23
+ "@graphcommerce/magento-store": "^9.0.2-canary.0",
24
+ "@graphcommerce/next-ui": "^9.0.2-canary.0",
25
+ "@graphcommerce/prettier-config-pwa": "^9.0.2-canary.0",
26
+ "@graphcommerce/typescript-config-pwa": "^9.0.2-canary.0",
27
27
  "@lingui/core": "^4.2.1",
28
28
  "@lingui/macro": "^4.2.1",
29
29
  "@lingui/react": "^4.2.1",