Search by

adachsoft / model-pricing-automation-action

Arkadiusz Adach

Automation action for synchronizing model pricing sources.

Package info

gitlab.com/a.adach/model-pricing-automation-action

Issues

pkg:composer/adachsoft/model-pricing-automation-action

Statistics

Installs: 9

Dependents: 0

Suggesters: 0

Stars: 0

v0.1.0 2026-11-28 22:44 UTC

This package is auto-updated.

Last update: 2026-11-28 21:44:49 UTC


README

An automation action for synchronizing model pricing sources.

Capabilities

  • Synchronizes model prices from one or all registered providers.
  • Supports selective synchronization via a provider parameter.
  • Preserves partial results when individual sources fail during synchronization.

Installation

Install the package via Composer:

composer require adachsoft/model-pricing-automation-action

The package provides the ModelPricingSyncActionTypeProvider and ModelPricingSyncActionHandler. Register both with your action container to enable automatic discovery of the model_pricing.sync action type.

Integration

The action relies on:

  • AdachSoft\ActionContracts\Type\ActionTypeProviderInterface — registers the action schema with supported parameters.
  • AdachSoft\ActionContracts\Execution\ActionHandlerInterface — executes the synchronization workflow.
  • AdachSoft\ModelPricingContracts\Sync\PriceSourceInterface — represents a price source provider.
  • AdachSoft\ModelPricingLib\Sync\PriceSyncService — performs the actual sync logic.

After installation, wire the action handler with your PriceSyncService implementation and pass an iterable of PriceSourceInterface instances tagged with your DI container's service identifiers.

The action automatically exposes an optional provider enum parameter listing all registered provider IDs. Omitting the parameter triggers synchronization across every registered source.

Requirements

  • PHP ^8.3
  • adachsoft/action-contracts ^0.1.2
  • adachsoft/model-pricing-contracts ^0.4
  • adachsoft/model-pricing-lib ^0.1.0

Usage

Configure your dependency injection container to resolve the price sources (implementing AdachSoft\ModelPricingContracts\Sync\PriceSourceInterface). The package provides two services:

  • ModelPricingSyncActionTypeProvider: Registers the model_pricing.sync action definition. Inject a tagged iterable of price sources into its constructor.
  • ModelPricingSyncActionHandler: Handles the execution. Requires AdachSoft\ModelPricingLib\Sync\PriceSyncService and the same iterable of price sources.

Wire both instances into your action engine's registry. The system will automatically expose the action. Use the optional provider parameter to trigger a sync for a single provider; omitting it triggers a global synchronization.

Example Integration

use AdachSoft\ModelPricingAutomationAction\ActionType\ModelPricingSyncActionTypeProvider;
use AdachSoft\ModelPricingAutomationAction\Handler\ModelPricingSyncActionHandler;
use AdachSoft\ModelPricingContracts\Sync\PriceSourceInterface;
use AdachSoft\ModelPricingLib\Sync\PriceSyncService;

// ... retrieve $priceSyncService and list of PriceSourceInterface instances ...

$handler = new ModelPricingSyncActionHandler($priceSyncService, $priceSources);
$typeProvider = new ModelPricingSyncActionTypeProvider($priceSources);

$registry->addHandler($handler);
$registry->addTypeProvider($typeProvider);