Product Order Fulfillment Orchestration API (POFO)¶
This API provides Product Order Fulfillment Orchestration capabilities through a REST API interface.
Installation¶
Setup¶
Import the required modules and services:
import { NgModule } from '@angular/core';
import { HttpClientModule } from '@angular/common/http';
import { ExecutionPlanService } from '@dnext-angular/pofo';
@NgModule({
imports: [
HttpClientModule
],
providers: [
ExecutionPlanService
]
})
export class AppModule { }
Services¶
ExecutionPlanService¶
Handles execution plan management operations.
// Retrieve an execution plan
retrieveExecutionPlan(
id: string,
fields?: string,
observe?: 'body' | 'response' | 'events'
): Observable<ExecutionPlan>
// Update an execution plan
patchExecutionPlan(
body: ExecutionPlanMVO,
id: string,
fields?: string,
contentType?: ContentType
): Observable<ExecutionPlan>
// Delete an execution plan
deleteExecutionPlan(
id: string
): Observable<any>
Models¶
Core Models¶
ExecutionPlan¶
Describes the dependency graph of orchestration logic:
interface ExecutionPlan extends Entity {
orderRef?: OrderRef; // Reference to the order
nodes?: Nodes; // Array of execution nodes
edges?: Edges; // Array of dependencies
}
Node¶
Represents a single node in the execution plan:
interface Node {
itemId?: string; // Order Item Id
orderId?: string; // Order Id
fulfillmentStatus?: 'completed' | 'inProgress' | 'pending';
isBundle?: boolean; // Bundle indicator
orderItemAction?: string; // Order Item Action
inventoryId?: string; // Related Inventory ID
orderItemIndex?: number; // Order Item Sequence
skipInventoryCreate?: boolean; // Skip inventory creation flag
skipInventoryUpdate?: boolean; // Skip inventory update flag
}
Edge¶
Represents a dependency between nodes:
interface Edge {
from?: string; // From Dependency (null implies START)
to?: string; // To Dependent
}
Usage Examples¶
Retrieving an Execution Plan¶
import { ExecutionPlanService } from '@dnext-angular/pofo';
@Component({...})
export class ExecutionPlanComponent {
constructor(private executionPlanService: ExecutionPlanService) {}
getExecutionPlan(planId: string) {
this.executionPlanService.retrieveExecutionPlan(planId)
.subscribe({
next: (plan) => {
console.log('Execution Plan:', plan);
},
error: (error) => {
console.error('Error retrieving plan:', error);
}
});
}
}
Updating an Execution Plan¶
import { ExecutionPlanService } from '@dnext-angular/pofo';
@Component({...})
export class UpdatePlanComponent {
constructor(private executionPlanService: ExecutionPlanService) {}
updatePlan(planId: string) {
const updates: ExecutionPlanMVO = {
type: 'ExecutionPlan',
nodes: [{
itemId: 'item-123',
orderId: 'order-456',
fulfillmentStatus: 'inProgress',
orderItemAction: 'add'
}],
edges: [{
from: 'node-1',
to: 'node-2'
}]
};
this.executionPlanService.patchExecutionPlan(updates, planId)
.subscribe({
next: (response) => {
console.log('Plan updated:', response);
},
error: (error) => {
console.error('Error updating plan:', error);
}
});
}
}
Working with Fields Parameter¶
You can specify which fields to include in the response:
// Only retrieve specific fields
this.executionPlanService.retrieveExecutionPlan(
'plan-123',
'id,nodes,edges'
).subscribe(plan => {
console.log('Filtered plan:', plan);
});
Dependencies¶
- @angular/core: >=18.0.1
- @angular/common: >=18.0.1
- @dnext-angular/http: 1.2.2
- @dnext-angular/common: 1.1.1
- rxjs: ^7.0.0
License¶
DNext PiAGroup