Skip to content

Commit

Permalink
NEXT-32619 - Write document for order approval
Browse files Browse the repository at this point in the history
  • Loading branch information
silverDuy committed Jan 17, 2024
1 parent 8528636 commit d55c189
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ nav:

### Approval Rule

The approval rule entity represents a set of conditions that need to be met in order for an order to be approved. These conditions can be based on the order's total value, the order's currency or for all orders placed by employees with a specific role. Each approval rule can be assigned the reviewer to a specific role, which means that only employees with that role can approve orders that match the rule's conditions, and it can be assigned to specific role, which means that only employees with that role will need to request approval for orders that match the rule's conditions; and a priority, which is used to determine the order in which the rules are evaluated.
The approval rule entity represents a set of conditions that need to be met for an order to be approved. These conditions might be based on the order's total value, the order's currency or orders placed by employees with a specific role. Each approval rule can be assigned to a reviewer with specific role, which means that only employees that only employees possessing that role are authorized to approve orders meeting the rule's conditions. Additionally, it can be assigned to a particular role, requiring employees with that role to seek approval for orders meeting the rule's criteria. The rule also includes a priority, dictating the sequence in which the rules are evaluated.

### Pending Order

Expand All @@ -32,10 +32,9 @@ flowchart TD
E-->|Yes| G[Event: Order Approved & Event: Order placed]
```


## Who can request approval?

- Employees which have the role that is assigned as the "Effective role" of the approval rule that matched the order.
* Employees holding the role designated as the "Effective role" in the approval rule corresponding to the order are authorized to request approval.

## Who can view pending orders?

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@ nav:
---

# Order approval permissions
## Introduction

Below you can find a list of all the order approval rules that are available in the order approval component, which you can use to assign to the roles of your employees.
Below you can find a list of all the order approval rules that are available in the order approval component. You can utilize these rules for assigning roles to your employees.

### Approval rule permissions

Expand All @@ -21,8 +20,8 @@ Below you can find a list of all the order approval rules that are available in

### Pending order Permissions

| Permission | Description |
|------------------------------------------|--------------------------------------------------------------------------------|
| `Can approve/decline all pending orders` | Allows the employee to approve or decline all pending orders. |
| `Can approve/decline pending orders` | Allows the employee to approve or decline pending orders that assigned to him. |
| `Can view all pending orders` | Allows the employee to view all pending orders. |
| Permission | Description |
|------------------------------------------|---------------------------------------------------------------------|
| `Can approve/decline all pending orders` | Allows the employee to approve or decline all pending orders |
| `Can approve/decline pending orders` | Allows the employee to approve or decline assigned pending orders |
| `Can view all pending orders` | Allows the employee to view all pending orders |
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,9 @@ nav:

---

# Order approval's Payment Process
# Order approval's payment process

## Introduction

The payment process of the order approval component is the same as the payment process of the order component, you can select the payment method that you want to use for your orders, with the exception that if this is the online payment method (Visa, PayPal, etc.), the payment process will be executed only after the order has been approved.
The payment process of the order approval component is the same as the payment process of the order component. You can select the payment method that you want to use for your orders; however unlike the standard order component, the payment process will be executed only after the order has been approved in case of the online payment method (Visa, PayPal, etc.).

## Customization

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ nav:

# How to add a new approval condition

The order approval component provides a set of conditions that you can use to define your approval rules. However, if you need to add a new condition, you can do so via app or plugin.
The order approval component provides a set of conditions for defining your approval rules. However, if you need to add a new condition, you can do so via an app or a plugin.

## Plugin

Each condition is represented by a class that extends the abstract class `Shopware\Commercial\B2B\OrderApproval\Domain\ApprovalRule\Rule\OrderApprovalRule` class. To add a new condition, you need to create a new class that extends the `OrderApprovalRule` class and implements the `match` and `getConstraints` methods. The `match` method is used to determine if the condition is met, and the `getConstraints` method is used to define the field, value or operator constraints that can be used in the condition.
Each condition is represented by a class that extends the abstract class `Shopware\Commercial\B2B\OrderApproval\Domain\ApprovalRule\Rule\OrderApprovalRule`. To add a new condition, you need to create a new class that extends the `OrderApprovalRule` class and implements the `match` and `getConstraints` methods. The `match` method is used to determine if the condition is met, and the `getConstraints` method is used to define the field, value or operator constraints that can be used in the condition.

Example:

Expand Down
2 changes: 1 addition & 1 deletion products/extensions/b2b-components/order-approval/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ nav:

---

# Order Approval Component
# Order approval component

Order approval component is a part of the B2B Employee Management. It allows you to define rules that determine which orders require approval and which employees can approve them. It also allows you to view all pending orders and approve or decline them.

Expand Down

0 comments on commit d55c189

Please sign in to comment.