Payment Flow + Access Flow Change
This commit is contained in:
@@ -25,7 +25,7 @@ const (
|
||||
// - State : current lifecycle state of the step
|
||||
// - Deps : itemIDs that must reach StepSuccess before this step can start
|
||||
// - WhenRunning : itemIDs (resources) that become active while this step is running
|
||||
// (e.g. the compute node executing it, the storage it reads/writes)
|
||||
// (e.g. the compute node executing it, the storage it reads/writes)
|
||||
type ExecutionGraphItem struct {
|
||||
Name string `json:"name" bson:"name"`
|
||||
StartDate *time.Time `json:"start_date,omitempty" bson:"start_date,omitempty"`
|
||||
@@ -69,10 +69,10 @@ func BuildExecutionGraph(g *workflowgraph.Graph) ExecutionGraph {
|
||||
|
||||
// Steps (logical nodes that sequence execution): Data, Processing, Workflow, NativeTool.
|
||||
// Resources (infrastructure co-active while a step runs): Compute, Storage.
|
||||
srcIsStep := srcItem.Data != nil || srcItem.Processing != nil || srcItem.Workflow != nil || srcItem.NativeTool != nil
|
||||
dstIsStep := dstItem.Data != nil || dstItem.Processing != nil || dstItem.Workflow != nil || dstItem.NativeTool != nil
|
||||
srcIsResource := srcItem.Compute != nil || srcItem.Storage != nil
|
||||
dstIsResource := dstItem.Compute != nil || dstItem.Storage != nil
|
||||
srcIsStep := srcItem.ItemResource.Data != nil || srcItem.ItemResource.Processing != nil || srcItem.ItemResource.Workflow != nil || srcItem.ItemResource.NativeTool != nil
|
||||
dstIsStep := dstItem.ItemResource.Data != nil || dstItem.ItemResource.Processing != nil || dstItem.ItemResource.Workflow != nil || dstItem.ItemResource.NativeTool != nil
|
||||
srcIsResource := srcItem.ItemResource.Compute != nil || srcItem.ItemResource.Storage != nil
|
||||
dstIsResource := dstItem.ItemResource.Compute != nil || dstItem.ItemResource.Storage != nil
|
||||
|
||||
switch {
|
||||
case srcIsStep && dstIsStep:
|
||||
|
||||
@@ -57,6 +57,12 @@ type WorkflowExecution struct {
|
||||
SelectedPartnerships workflow.ConfigItem `json:"selected_partnerships"`
|
||||
SelectedBuyings workflow.ConfigItem `json:"selected_buyings"`
|
||||
SelectedStrategies workflow.ConfigItem `json:"selected_strategies"`
|
||||
SelectedPaymentMode workflow.ConfigItem `json:"selected_payment_mode"`
|
||||
|
||||
// SelectedBillingStrategy est la fréquence de facturation globale choisie par l'utilisateur
|
||||
// (BILL_ONCE, BILL_PER_WEEK, BILL_PER_MONTH, BILL_PER_YEAR).
|
||||
// Propagée depuis WorkflowSchedule.SelectedBillingStrategy par GenerateExecutions().
|
||||
SelectedBillingStrategy pricing.BillingStrategy `json:"selected_billing_strategy" bson:"selected_billing_strategy"`
|
||||
|
||||
// SelectedEmbeddedStorages records which storage capability was activated on
|
||||
// each compute unit graph node (key = compute graph node ID).
|
||||
@@ -275,6 +281,16 @@ func (d *WorkflowExecution) bookEach(executionsID string, wfID string, dt tools.
|
||||
if len(executionsID) > 8 {
|
||||
name += " " + executionsID[:8]
|
||||
}
|
||||
// Résout le mode de paiement spécifique à cette ressource depuis SelectedPaymentMode.
|
||||
// SelectedPaymentMode est un ConfigItem (map[string]int) dont les clés sont les IDs
|
||||
// de nœuds du graph ; on tente itemID puis l'ID de la ressource comme fallback.
|
||||
paymentType := pricing.PAY_ONCE
|
||||
if v, ok := d.SelectedPaymentMode[itemID]; ok {
|
||||
paymentType = pricing.PaymentType(v)
|
||||
} else if v, ok := d.SelectedPaymentMode[priced.GetID()]; ok {
|
||||
paymentType = pricing.PaymentType(v)
|
||||
}
|
||||
|
||||
bookingItem := &booking.Booking{
|
||||
AbstractObject: utils.AbstractObject{
|
||||
UUID: uuid.New().String(),
|
||||
@@ -293,6 +309,8 @@ func (d *WorkflowExecution) bookEach(executionsID string, wfID string, dt tools.
|
||||
ExecutionID: d.GetID(),
|
||||
ExpectedStartDate: start,
|
||||
ExpectedEndDate: endDate,
|
||||
BillingStrategy: d.SelectedBillingStrategy,
|
||||
PaymentType: paymentType,
|
||||
}
|
||||
items = append(items, bookingItem)
|
||||
d.PeerBookByGraph[priced.GetCreatorID()][itemID] = append(
|
||||
|
||||
Reference in New Issue
Block a user