Untitled

mail@pastecode.io avatar
unknown
plain_text
22 days ago
831 B
1
Indexable
Never
/**
     * Lấy config cân nặng quy đổi
     *
     * @param Package $package
     * @return Config|null
     * @since BC1001-15126
     */
    public function handle(Package $package): ?Config
    {
        $shop = $this->getShop($package->shopCode);
        if (!$shop) {
            return null;
        }

        $shopManualConfig = $this->getShopManualConfig($shop);
        if (!$shopManualConfig) {
            return null;
        }

        $shopManualConfig = $this->pipeline
            ->send($shopManualConfig)
            ->via('filter')
            ->through([
                app(RemoveConfigNotXFastFilter::class)->setPackage($package)
            ])
            ->thenReturn();

        return empty($shopManualConfig->configValue->configs) ? null : current($shopManualConfig->configValue->configs);
    }
Leave a Comment