This commit is contained in:
louwie17 2021-12-03 09:27:45 -04:00 committed by GitHub
parent 008b6cf2e5
commit 0cb4382c05
1 changed files with 4 additions and 3 deletions

View File

@ -56,8 +56,9 @@ export const PaymentGatewaySuggestions = ( { onComplete, query } ) => {
); );
return paymentGatewaySuggestions.reduce( ( map, suggestion ) => { return paymentGatewaySuggestions.reduce( ( map, suggestion ) => {
const { id } = suggestion; // A colon ':' is used sometimes to have multiple configs for the same gateway ex: woocommerce_payments:us.
const installedGateway = mappedPaymentGateways[ suggestion.id ] const id = ( suggestion.id || '' ).split( ':' )[ 0 ];
const installedGateway = mappedPaymentGateways[ id ]
? mappedPaymentGateways[ id ] ? mappedPaymentGateways[ id ]
: {}; : {};
@ -81,7 +82,7 @@ export const PaymentGatewaySuggestions = ( { onComplete, query } ) => {
...suggestion, ...suggestion,
}; };
map.set( id, enrichedSuggestion ); map.set( suggestion.id, enrichedSuggestion );
return map; return map;
}, new Map() ); }, new Map() );
}; };