-
Notifications
You must be signed in to change notification settings - Fork 72
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2465 from graphcommerce-org/fix/checkout
Magento 2.4.7 checkout fixes
- Loading branch information
Showing
26 changed files
with
227 additions
and
71 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@graphcommerce/magento-cart-payment-method': patch | ||
--- | ||
|
||
Solve issue where the Component prop would we forwarded tot the DOM element of the PaymentMethodActionCard |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@graphcommerce/magento-cart-shipping-address': patch | ||
--- | ||
|
||
Make sure we are toggling the selected shipping method when a user selects a previously selected shipping method |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
'@graphcommerce/magento-cart-payment-method': patch | ||
'@graphcommerce/magento-graphql': patch | ||
--- | ||
|
||
Support Magento 2.4.7 placeOrder.errors field to handle possible errors while placing the order. An `assertOrderPlaced` method was created to assert a valid placed order. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@graphcommerce/react-hook-form': patch | ||
--- | ||
|
||
Solve an issue where the payment submission would remain in a spinning state when placing an order failed: `useFormGql` will now set `root` error on the form when there is an error response on the GraphQL operation, an error is thrown in onBeforeSubmit and in onSuccess. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@graphcommerce/mollie-magento-payment': patch | ||
--- | ||
|
||
Support Magento 2.4.7 placeOrder.errors field when placing a Mollie order |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@graphcommerce/magento-cart-shipping-method': patch | ||
--- | ||
|
||
Make sure we are correctly selecting the shipping method form when a user selects a previously selected method again. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
...gento-cart-payment-method/PaymentMethodPlaceOrderNoop/PaymentMethodPlaceOrderNoop.graphql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
packages/magento-cart-payment-method/PaymentMethodPlaceOrderNoop/assertOrderPlaced.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import type { FetchResult } from '@graphcommerce/graphql' | ||
import { ApolloError } from '@graphcommerce/graphql' | ||
import { t } from '@lingui/macro' | ||
import type { PaymentMethodPlaceOrderNoopMutation } from './PaymentMethodPlaceOrderNoop.gql' | ||
|
||
export type PlacedOrder<T extends FetchResult<PaymentMethodPlaceOrderNoopMutation>> = NonNullable< | ||
NonNullable<NonNullable<T['data']>['placeOrder']>['order'] | ||
> | ||
|
||
export type AssertedOrderPlaced<T extends FetchResult<PaymentMethodPlaceOrderNoopMutation>> = T & { | ||
data: { | ||
placeOrder: { order: PlacedOrder<T> } | ||
} | ||
} | ||
|
||
export function throwGenericPlaceOrderError() { | ||
throw new ApolloError({ | ||
graphQLErrors: [ | ||
{ | ||
message: t`An error occurred while processing your payment. Please contact the store owner`, | ||
}, | ||
], | ||
}) | ||
} | ||
|
||
/** Assert that the order was place successfully. */ | ||
export function assertOrderPlaced<T extends FetchResult<PaymentMethodPlaceOrderNoopMutation>>( | ||
result: T, | ||
): asserts result is AssertedOrderPlaced<T> { | ||
if (result.errors && result.errors.length > 0) { | ||
const graphQLErrors = result.errors.filter((e) => e !== null) | ||
throw new ApolloError({ graphQLErrors }) | ||
} | ||
|
||
if (result.data?.placeOrder?.errors && result.data.placeOrder.errors.length > 0) { | ||
const graphQLErrors = result.data.placeOrder.errors.filter((e) => e !== null) | ||
throw new ApolloError({ graphQLErrors }) | ||
} | ||
|
||
if (!result.data?.placeOrder?.order?.order_number) { | ||
console.info('Error while placing order', result) | ||
throwGenericPlaceOrderError() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,14 @@ | ||
export * from './Api/PaymentMethod' | ||
export * from './hooks' | ||
export * from './PaymentMethodActionCardList/PaymentMethodActionCardListForm' | ||
export * from './PaymentMethodButton/PaymentMethodButton' | ||
export * from './PaymentMethodContext/PaymentMethodContext' | ||
export * from './PaymentMethodContext/paymentMethodContextType' | ||
export * from './PaymentMethodOptions/PaymentMethodOptions' | ||
export * from './PaymentMethodOptionsNoop/PaymentMethodOptionsNoop' | ||
export * from './PaymentMethodOptionsNoop/PaymentMethodOptionsNoop.gql' | ||
export * from './PaymentMethodPlaceOrder/PaymentMethodPlaceOrder' | ||
export * from './PaymentMethodPlaceOrderNoop/assertOrderPlaced' | ||
export * from './PaymentMethodPlaceOrderNoop/PaymentMethodPlaceOrderNoop' | ||
export * from './PaymentMethodPlaceOrderNoop/PaymentMethodPlaceOrderNoop.gql' | ||
export * from './PaymentMethodToggles/PaymentMethodToggles' | ||
export * from './PaymentMethodActionCardList/PaymentMethodActionCardListForm' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
...magento-payment-multisafepay/components/MSPPaymentPlaceOrder/MSPPaymentPlaceOrder.graphql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.