File tree Expand file tree Collapse file tree 1 file changed +22
-3
lines changed
packages/template-retail-react-app/app/pages/checkout Expand file tree Collapse file tree 1 file changed +22
-3
lines changed Original file line number Diff line number Diff line change @@ -70,6 +70,23 @@ const CheckoutConfirmation = () => {
7070 enabled : ! ! orderNo && onClient
7171 }
7272 )
73+
74+ const isSavedPaymentMethod = React . useMemo ( ( ) => {
75+ if ( ! order ?. paymentInstruments ?. [ 0 ] ) {
76+ return false
77+ }
78+
79+ const orderPaymentInstrument = order . paymentInstruments [ 0 ]
80+ if ( orderPaymentInstrument . paymentMethodId === 'Salesforce Payments' ) {
81+ return (
82+ customer ?. paymentInstruments ?. some (
83+ ( savedPI ) => savedPI . paymentInstrumentId === orderPaymentInstrument . paymentInstrumentId
84+ ) || false
85+ )
86+ }
87+ return true
88+ } , [ order ?. paymentInstruments , customer ?. paymentInstruments ] )
89+
7390 const { currency} = useCurrency ( )
7491 const itemIds = order ?. productItems . map ( ( item ) => item . productId )
7592 const { data : products } = useProducts ( { parameters : { ids : itemIds ?. join ( ',' ) } } )
@@ -509,9 +526,11 @@ const CheckoutConfirmation = () => {
509526
510527 { order . paymentInstruments [ 0 ] . paymentMethodId ===
511528 'Salesforce Payments' ? (
512- < SFPaymentsOrderSummary
513- paymentInstrument = { order . paymentInstruments [ 0 ] }
514- />
529+ isSavedPaymentMethod ? (
530+ < SFPaymentsOrderSummary
531+ paymentInstrument = { order . paymentInstruments [ 0 ] }
532+ />
533+ ) : null
515534 ) : (
516535 < Stack spacing = { 1 } >
517536 < Heading as = "h3" fontSize = "sm" >
You can’t perform that action at this time.
0 commit comments