mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-05 08:59:14 +08:00
✨ Add store action to update merchant details
This commit is contained in:
parent
e09ad9d74d
commit
67522b9557
3 changed files with 16 additions and 0 deletions
|
@ -12,6 +12,7 @@ export default {
|
|||
SET_PERSISTENT: 'ppcp/common/SET_PERSISTENT',
|
||||
RESET: 'ppcp/common/RESET',
|
||||
HYDRATE: 'ppcp/common/HYDRATE',
|
||||
SET_MERCHANT: 'ppcp/common/SET_MERCHANT',
|
||||
RESET_MERCHANT: 'ppcp/common/RESET_MERCHANT',
|
||||
|
||||
// Activity management (advanced solution that replaces the isBusy state).
|
||||
|
|
|
@ -110,6 +110,17 @@ export const setManualConnectionMode = ( useManualConnection ) =>
|
|||
export const setWebhooks = ( webhooks ) =>
|
||||
setPersistent( 'webhooks', webhooks );
|
||||
|
||||
/**
|
||||
* Replace merchant details in the store.
|
||||
*
|
||||
* @param {Object} merchant - The new merchant details.
|
||||
* @return {Action} The action.
|
||||
*/
|
||||
export const setMerchant = ( merchant ) => ( {
|
||||
type: ACTION_TYPES.SET_MERCHANT,
|
||||
payload: { merchant },
|
||||
} );
|
||||
|
||||
/**
|
||||
* Reset merchant details in the store.
|
||||
*
|
||||
|
|
|
@ -113,6 +113,10 @@ const commonReducer = createReducer( defaultTransient, defaultPersistent, {
|
|||
features: Object.freeze( { ...defaultTransient.features } ),
|
||||
} ),
|
||||
|
||||
[ ACTION_TYPES.SET_MERCHANT ]: ( state, payload ) => {
|
||||
return changePersistent( state, { merchant: payload.merchant } );
|
||||
},
|
||||
|
||||
[ ACTION_TYPES.HYDRATE ]: ( state, payload ) => {
|
||||
const newState = changePersistent( state, payload.data );
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue