diff --git a/api-specs/api/examples/BusinessUnit/BusinessUnitChangeApprovalRuleModeAction.json b/api-specs/api/examples/BusinessUnit/BusinessUnitChangeApprovalRuleModeAction.json new file mode 100644 index 000000000..4d43c24b7 --- /dev/null +++ b/api-specs/api/examples/BusinessUnit/BusinessUnitChangeApprovalRuleModeAction.json @@ -0,0 +1,4 @@ +{ + "action": "changeApprovalRuleMode", + "approvalRuleMode": "Explicit" +} diff --git a/api-specs/api/examples/business-unit.example.json b/api-specs/api/examples/business-unit.example.json index 19d573a2b..97291d961 100644 --- a/api-specs/api/examples/business-unit.example.json +++ b/api-specs/api/examples/business-unit.example.json @@ -16,5 +16,6 @@ "addresses": [], "associates": [], "associateMode": "Explicit", - "inheritedAssociates": [] + "inheritedAssociates": [], + "approvalRuleMode": "Explicit" } diff --git a/api-specs/api/examples/business-units.example.json b/api-specs/api/examples/business-units.example.json index 8a7cbbf8f..436c632fb 100644 --- a/api-specs/api/examples/business-units.example.json +++ b/api-specs/api/examples/business-units.example.json @@ -21,6 +21,7 @@ "associates": [], "associateMode": "Explicit", "inheritedAssociates": [], + "approvalRuleMode": "Explicit", "storeMode": "Explicit", "stores": [] } diff --git a/api-specs/api/examples/my-business-unit.example.json b/api-specs/api/examples/my-business-unit.example.json index 19d573a2b..97291d961 100644 --- a/api-specs/api/examples/my-business-unit.example.json +++ b/api-specs/api/examples/my-business-unit.example.json @@ -16,5 +16,6 @@ "addresses": [], "associates": [], "associateMode": "Explicit", - "inheritedAssociates": [] + "inheritedAssociates": [], + "approvalRuleMode": "Explicit" } diff --git a/api-specs/api/examples/my-business-units.example.json b/api-specs/api/examples/my-business-units.example.json index 524d5c905..3f4a4a597 100644 --- a/api-specs/api/examples/my-business-units.example.json +++ b/api-specs/api/examples/my-business-units.example.json @@ -22,7 +22,8 @@ "addresses": [], "associates": [], "associateMode": "Explicit", - "inheritedAssociates": [] + "inheritedAssociates": [], + "approvalRuleMode": "Explicit" } ] } diff --git a/api-specs/api/types/business-unit/BusinessUnit.raml b/api-specs/api/types/business-unit/BusinessUnit.raml index c181fdf27..f101aaf66 100644 --- a/api-specs/api/types/business-unit/BusinessUnit.raml +++ b/api-specs/api/types/business-unit/BusinessUnit.raml @@ -114,3 +114,8 @@ properties: type: BusinessUnitKeyReference description: | Top-level unit of the Business Unit. The top-level unit is of `unitType` `Company`. + approvalRuleMode: + type: BusinessUnitApprovalRuleMode + description: | + Determines whether the Business Unit can inherit Approval Rules from a parent. + Always `Explicit` for [Companies](ctp:api:type:BusinessUnitType) and defaults to `ExplicitAndFromParent` for [Divisions](ctp:api:type:BusinessUnitType). diff --git a/api-specs/api/types/business-unit/BusinessUnitApprovalRuleMode.raml b/api-specs/api/types/business-unit/BusinessUnitApprovalRuleMode.raml new file mode 100644 index 000000000..5fdc2148c --- /dev/null +++ b/api-specs/api/types/business-unit/BusinessUnitApprovalRuleMode.raml @@ -0,0 +1,14 @@ +#%RAML 1.0 DataType +(package): BusinessUnit +displayName: BusinessUnitApprovalRuleMode +type: string +description: | + Determines whether a Business Unit can inherit [Approval Rules](/projects/approval-rules) from a parent. Only Business Units of type `Division` can use `ExplicitAndFromParent`. +enum: + - Explicit + - ExplicitAndFromParent +(enumDescriptions): + Explicit: | + Approval Rules of a Business Unit must be explicitly assigned. The Business Unit cannot inherit Approval Rules from a parent. + ExplicitAndFromParent: | + Approval Rules of a Business Unit are inherited from a parent and can also be explicitly assigned. diff --git a/api-specs/api/types/business-unit/BusinessUnitDraft.raml b/api-specs/api/types/business-unit/BusinessUnitDraft.raml index ce310f12e..c1ee9cb22 100644 --- a/api-specs/api/types/business-unit/BusinessUnitDraft.raml +++ b/api-specs/api/types/business-unit/BusinessUnitDraft.raml @@ -52,6 +52,12 @@ properties: type: AssociateDraft[] description: | List of members that are part of the Business Unit in specific [roles](ctp:api:type:AssociateRole). + approvalRuleMode?: + type: BusinessUnitApprovalRuleMode + description: | + Determines whether the Business Unit can inherit Approval Rules from a parent. + For [Companies](ctp:api:type:BusinessUnitType), the value of this field is always `Explicit`. + For [Divisions](ctp:api:type:BusinessUnitType), the default value is `ExplicitAndFromParent`. addresses?: type: BaseAddress[] description: | diff --git a/api-specs/api/types/business-unit/Company.raml b/api-specs/api/types/business-unit/Company.raml index c19646157..c43bcdbc9 100644 --- a/api-specs/api/types/business-unit/Company.raml +++ b/api-specs/api/types/business-unit/Company.raml @@ -10,8 +10,13 @@ properties: storeMode: type: BusinessUnitStoreMode description: | - Is always `Explicit` since a Company cannot have a parent Business Unit that Stores can be inherited from. + The value of this field is always `Explicit` because a Company cannot have a parent Business Unit that Stores can be inherited from. associateMode: type: BusinessUnitAssociateMode description: | - Is always `Explicit` since a Company cannot have a parent Business Unit that Associates can be inherited from. + The value of this field is always `Explicit` because a Company cannot have a parent Business Unit that Associates can be inherited from. + approvalRuleMode: + type: BusinessUnitApprovalRuleMode + default: Explicit + description: | + The value of this field is always `Explicit` because a Company cannot have a parent Business Unit that Approval Rules can be inherited from. diff --git a/api-specs/api/types/business-unit/Division.raml b/api-specs/api/types/business-unit/Division.raml index 86fea9b46..72278de7e 100644 --- a/api-specs/api/types/business-unit/Division.raml +++ b/api-specs/api/types/business-unit/Division.raml @@ -21,3 +21,8 @@ properties: default: ExplicitAndFromParent description: | Determines whether the Division can inherit Associates from a parent. + approvalRuleMode: + type: BusinessUnitApprovalRuleMode + default: ExplicitAndFromParent + description: | + Determines whether a Business Unit can inherit Approval Rules from a parent. diff --git a/api-specs/api/types/business-unit/DivisionDraft.raml b/api-specs/api/types/business-unit/DivisionDraft.raml index 5de3cb30d..aeb54f807 100644 --- a/api-specs/api/types/business-unit/DivisionDraft.raml +++ b/api-specs/api/types/business-unit/DivisionDraft.raml @@ -22,3 +22,8 @@ properties: default: ExplicitAndFromParent description: | Determines whether the Division can inherit Associates from a parent. + approvalRuleMode?: + type: BusinessUnitApprovalRuleMode + default: ExplicitAndFromParent + description: | + Determines whether the Division can inherit Approval Rules from a parent. diff --git a/api-specs/api/types/business-unit/updates/BusinessUnitChangeApprovalRuleModeAction.raml b/api-specs/api/types/business-unit/updates/BusinessUnitChangeApprovalRuleModeAction.raml new file mode 100644 index 000000000..4eb7fbb2a --- /dev/null +++ b/api-specs/api/types/business-unit/updates/BusinessUnitChangeApprovalRuleModeAction.raml @@ -0,0 +1,17 @@ +#%RAML 1.0 DataType +(package): BusinessUnit +type: BusinessUnitUpdateAction +displayName: BusinessUnitChangeApprovalRuleModeAction +discriminatorValue: changeApprovalRuleMode +example: !include ../../../examples/BusinessUnit/BusinessUnitChangeApprovalRuleModeAction.json +description: | + Updates [Approval Rules](/projects/approval-rules) inheritance behavior between Business Units. + + Only Business Units of type `Division` can be changed to `ExplicitAndFromParent`. + + This update action generates a [BusinessUnitApprovalRuleModeChanged](ctp:api:type:BusinessUnitApprovalRuleModeChangedMessage) Message. +properties: + approvalRuleMode: + type: BusinessUnitApprovalRuleMode + description: | + The new value for `approvalRuleMode`. diff --git a/api-specs/api/types/message/BusinessUnitApprovalRuleModeChangedMessage.raml b/api-specs/api/types/message/BusinessUnitApprovalRuleModeChangedMessage.raml new file mode 100644 index 000000000..0ecc73f76 --- /dev/null +++ b/api-specs/api/types/message/BusinessUnitApprovalRuleModeChangedMessage.raml @@ -0,0 +1,16 @@ +#%RAML 1.0 DataType +(package): Message +type: Message +displayName: BusinessUnitApprovalRuleModeChangedMessage +discriminatorValue: BusinessUnitApprovalRuleModeChanged +description: | + Generated after a successful [Change Approval Rule Mode](ctp:api:type:BusinessUnitChangeApprovalRuleModeAction) update action. +properties: + approvalRuleMode: + type: BusinessUnitApprovalRuleMode + description: | + [BusinessUnitApprovalRuleMode](ctp:api:type:BusinessUnitApprovalRuleMode) of the Business Unit after the [Change Approval Rule Mode](ctp:api:type:BusinessUnitChangeApprovalRuleModeAction) update action. + oldApprovalRuleMode?: + type: BusinessUnitApprovalRuleMode + description: | + [BusinessUnitApprovalRuleMode](ctp:api:type:BusinessUnitApprovalRuleMode) of the Business Unit before the [Change Approval Rule Mode](ctp:api:type:BusinessUnitChangeApprovalRuleModeAction) update action. diff --git a/api-specs/api/types/message/payload/BusinessUnitApprovalRuleModeChangedMessagePayload.raml b/api-specs/api/types/message/payload/BusinessUnitApprovalRuleModeChangedMessagePayload.raml new file mode 100644 index 000000000..753da95d8 --- /dev/null +++ b/api-specs/api/types/message/payload/BusinessUnitApprovalRuleModeChangedMessagePayload.raml @@ -0,0 +1,16 @@ +#%RAML 1.0 DataType +(package): Message +type: MessagePayload +displayName: BusinessUnitApprovalRuleModeChangedMessagePayload +discriminatorValue: BusinessUnitApprovalRuleModeChanged +description: | + Generated after a successful [Change Approval Rule Mode](ctp:api:type:BusinessUnitChangeApprovalRuleModeAction) update action. +properties: + approvalRuleMode: + type: BusinessUnitApprovalRuleMode + description: | + [BusinessUnitApprovalRuleMode](ctp:api:type:BusinessUnitApprovalRuleMode) of the Business Unit after the [Change Approval Rule Mode](ctp:api:type:BusinessUnitChangeApprovalRuleModeAction) update action. + oldApprovalRuleMode?: + type: BusinessUnitApprovalRuleMode + description: | + [BusinessUnitApprovalRuleMode](ctp:api:type:BusinessUnitApprovalRuleMode) of the Business Unit before the [Change Approval Rule Mode](ctp:api:type:BusinessUnitChangeApprovalRuleModeAction) update action. diff --git a/api-specs/api/types/types.raml b/api-specs/api/types/types.raml index 3b0d181ab..3f0f89d16 100644 --- a/api-specs/api/types/types.raml +++ b/api-specs/api/types/types.raml @@ -75,6 +75,7 @@ AssociateRoleAssignmentDraft: !include business-unit/AssociateRoleAssignmentDraf AssociateRoleDeprecated: !include business-unit/AssociateRoleDeprecated.raml AssociateRoleInheritanceMode: !include business-unit/AssociateRoleInheritanceMode.raml BusinessUnit: !include business-unit/BusinessUnit.raml +BusinessUnitApprovalRuleMode: !include business-unit/BusinessUnitApprovalRuleMode.raml BusinessUnitAssociateMode: !include business-unit/BusinessUnitAssociateMode.raml BusinessUnitDraft: !include business-unit/BusinessUnitDraft.raml BusinessUnitKeyReference: !include business-unit/BusinessUnitKeyReference.raml @@ -98,6 +99,7 @@ BusinessUnitAddBillingAddressIdAction: !include business-unit/updates/BusinessUn BusinessUnitAddShippingAddressIdAction: !include business-unit/updates/BusinessUnitAddShippingAddressIdAction.raml BusinessUnitAddStoreAction: !include business-unit/updates/BusinessUnitAddStoreAction.raml BusinessUnitChangeAddressAction: !include business-unit/updates/BusinessUnitChangeAddressAction.raml +BusinessUnitChangeApprovalRuleModeAction: !include business-unit/updates/BusinessUnitChangeApprovalRuleModeAction.raml BusinessUnitChangeAssociateAction: !include business-unit/updates/BusinessUnitChangeAssociateAction.raml BusinessUnitChangeAssociateModeAction: !include business-unit/updates/BusinessUnitChangeAssociateModeAction.raml BusinessUnitChangeNameAction: !include business-unit/updates/BusinessUnitChangeNameAction.raml @@ -844,6 +846,7 @@ BusinessUnitAddressCustomFieldRemovedMessage: !include message/BusinessUnitAddre BusinessUnitAddressCustomTypeRemovedMessage: !include message/BusinessUnitAddressCustomTypeRemovedMessage.raml BusinessUnitAddressCustomTypeSetMessage: !include message/BusinessUnitAddressCustomTypeSetMessage.raml BusinessUnitAddressRemovedMessage: !include message/BusinessUnitAddressRemovedMessage.raml +BusinessUnitApprovalRuleModeChangedMessage: !include message/BusinessUnitApprovalRuleModeChangedMessage.raml BusinessUnitAssociateAddedMessage: !include message/BusinessUnitAssociateAddedMessage.raml BusinessUnitAssociateChangedMessage: !include message/BusinessUnitAssociateChangedMessage.raml BusinessUnitAssociateModeChangedMessage: !include message/BusinessUnitAssociateModeChangedMessage.raml @@ -1090,6 +1093,8 @@ BusinessUnitAddressCustomTypeRemovedMessagePayload: !include message/payload/Bus # yamllint disable-line rule:line-length BusinessUnitAddressCustomTypeSetMessagePayload: !include message/payload/BusinessUnitAddressCustomTypeSetMessagePayload.raml BusinessUnitAddressRemovedMessagePayload: !include message/payload/BusinessUnitAddressRemovedMessagePayload.raml +# yamllint disable-line rule:line-length +BusinessUnitApprovalRuleModeChangedMessagePayload: !include message/payload/BusinessUnitApprovalRuleModeChangedMessagePayload.raml BusinessUnitAssociateAddedMessagePayload: !include message/payload/BusinessUnitAssociateAddedMessagePayload.raml BusinessUnitAssociateChangedMessagePayload: !include message/payload/BusinessUnitAssociateChangedMessagePayload.raml # yamllint disable-line rule:line-length diff --git a/api-specs/graphql/schema.sdl b/api-specs/graphql/schema.sdl index 9a68131d4..2e24329d8 100644 --- a/api-specs/graphql/schema.sdl +++ b/api-specs/graphql/schema.sdl @@ -1358,6 +1358,7 @@ type BusinessUnit implements Versioned & ReferenceExpandable { inheritedStores: [InheritedStore!] topLevelUnitRef: KeyReference topLevelUnit: BusinessUnit! + approvalRuleMode: BusinessUnitApprovalRuleMode! id: String! version: Long! createdAt: DateTime! @@ -1410,6 +1411,17 @@ type BusinessUnitAddressRemoved implements MessagePayload { type: String! } +enum BusinessUnitApprovalRuleMode { + Explicit + ExplicitAndFromParent +} + +type BusinessUnitApprovalRuleModeChanged implements MessagePayload { + approvalRuleMode: BusinessUnitApprovalRuleMode! + oldApprovalRuleMode: BusinessUnitApprovalRuleMode + type: String! +} + type BusinessUnitAssociateAdded implements MessagePayload { associate: Associate! type: String! @@ -1543,6 +1555,7 @@ input BusinessUnitDraft { stores: [ResourceIdentifierInput!] associates: [AssociateDraft!] associateMode: BusinessUnitAssociateMode + approvalRuleMode: BusinessUnitApprovalRuleMode } type BusinessUnitNameChanged implements MessagePayload { @@ -1646,6 +1659,7 @@ input BusinessUnitUpdateAction { setStores: SetBusinessUnitStores setStoreMode: SetBusinessUnitStoreMode changeAssociateMode: ChangeBusinessUnitAssociateMode + changeApprovalRuleMode: ChangeBusinessUnitApprovalRuleMode } input CancelQuoteRequest { @@ -2248,6 +2262,10 @@ input ChangeBusinessUnitAddress { address: AddressInput! } +input ChangeBusinessUnitApprovalRuleMode { + approvalRuleMode: BusinessUnitApprovalRuleMode! +} + input ChangeBusinessUnitAssociate { associate: AssociateDraft! }