diff --git a/CHANGELOG.md b/CHANGELOG.md index 25303a0..2a57de5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,12 @@ All notable changes to this plugin are documented here. The format follows [Keep ## [Unreleased] +## [1.4.0] - Unreleased + +### Added + +- Optional shipment fulfilment and tracking push, destination inventory activation and Shopify-owned shipping notifications. Exact line mappings and persisted send claims prevent duplicate fulfilments. Historical/non-stock orders are excluded. + ## [1.3.0] - Unreleased ### Added diff --git a/README.md b/README.md index f9c398d..653eaee 100644 --- a/README.md +++ b/README.md @@ -97,7 +97,7 @@ Admins hold both. On Inventoros versions without plugin permissions they fall ba - Orders take stock when imported. External Shopify checkout reservations are not created in Inventoros before the order webhook arrives. - On cores with variant location stock, each variant syncs its own bins per mapped warehouse. Older cores retain primary-location variant sync. Local and global stock holds reduce pushed availability; warehouse quantities share a single SKU availability budget, allocated primary location first. - On cores before Inventoros#254, `OrderService::cancel()` takes its actor from the signed-in user, so the plugin signs in the connection's user for that one call when it cancels in a background job. Newer cores take the actor as a parameter and nobody is signed in. - - Fulfillments and tracking are not pushed to Shopify yet; order edits after import are not applied. Completed payment/refund records can be imported with the optional ledger setting. + - Optional shipment fulfilment and tracking push is available on cores with shipment notification ownership; order edits after import are not applied. Completed payment/refund records can be imported with the optional ledger setting. - Public multi-merchant OAuth installation is not implemented; see [docs/setup.md](docs/setup.md#7-future-a-public-app-with-oauth). ## Develop and test @@ -211,3 +211,15 @@ The API reader checks the exact transaction count and refuses incomplete lists or orders with more than 100 transactions for manual review. It does not silently import a subset. Financial records and new-order creation are atomic; an invalid transaction leaves no partial order/payment ledger. + +## Shipment fulfilment and tracking + +After upgrading the core with shipment notification ownership, grant the custom app `read_merchant_managed_fulfillment_orders` and `write_merchant_managed_fulfillment_orders`, plus `write_inventory` for destination activation, then enable **Push shipments and tracking to Shopify** in the connection settings. This is off by default. Map each ship-from warehouse to exactly one Shopify location. + +Newly imported order lines retain their exact Shopify line ids. When an Inventoros shipment is marked shipped, queued work fulfils only those shipped quantities, includes tracking, and lets Shopify send the shipping email if the customer notification option is enabled. The core email is suppressed for those shipments. Older imported orders without exact line mappings must be fulfilled in Shopify. Shipping never deducts Inventoros stock a second time. + +If routing differs, the plugin activates previously unstocked inventory items at the destination, without resetting existing quantities, before moving only the shipment’s fulfilment-order lines. Moves re-read Shopify because order and line ids may change. Fulfilment holds and unsupported service requests stop the push for review. Read pages and definite throttles use the existing delayed retries. + +Shopify’s [fulfillmentCreate](https://shopify.dev/docs/api/admin-graphql/2026-07/mutations/fulfillmentCreate) does not document a creation idempotency key. The plugin commits a send claim before creation, persists the returned id, and refuses to blindly replay an uncertain response or a killed worker’s claim. Check the failed operation in Sync activity and verify or finish that shipment in Shopify; repeated retries cannot create another fulfilment. This conservative stop also applies to rejected creation responses. [Destination activation](https://shopify.dev/docs/api/admin-graphql/2026-07/mutations/inventoryActivate) uses its required idempotency key; [fulfilment-order moves](https://shopify.dev/docs/api/admin-graphql/2026-07/mutations/fulfillmentOrderMove) require the items to be stocked at the destination. + +Historical orders and orders that never committed stock are excluded from shipment push. Fulfilment orders and their lines use bounded, complete read pages; missing/repeated cursors stop partial data before any shipment mutation. diff --git a/docs/setup.md b/docs/setup.md index b00e4d7..a674b23 100644 --- a/docs/setup.md +++ b/docs/setup.md @@ -95,3 +95,7 @@ Place a test order in Shopify (enable **Also import test orders** first, or use ## 7. Future: a public app with OAuth The plugin connects one store at a time with app client credentials or an existing Admin API token. A public Shopify app installed through OAuth (an install link, offline access tokens, Shopify's mandatory privacy webhooks) is planned; the connection model already keeps credentials as an encrypted set so an OAuth token can replace the custom app token without a data migration. + +### Optional shipment sync + +To push shipped parcels and tracking, upgrade Inventoros with shipment notification ownership, add `read_merchant_managed_fulfillment_orders` and `write_merchant_managed_fulfillment_orders` to the Shopify custom app, and enable shipment push in the connection settings. Keep one Shopify location per ship-from warehouse. Shopify owns customer shipping emails while this option is enabled, including while sync is paused. Resume sync to process queued shipments. Orders imported before exact line mappings were stored require manual fulfilment in Shopify. See the README for uncertain-response recovery. diff --git a/plugin.json b/plugin.json index ca0f5df..6f45f64 100644 --- a/plugin.json +++ b/plugin.json @@ -1,7 +1,7 @@ { "name": "Shopify", "description": "Connect Inventoros with Shopify for asynchronous two-way product, inventory and order sync, with webhooks, retries, mappings and sync health checks.", - "version": "1.3.0", + "version": "1.4.0", "author": "Inventoros", "author_url": "https://inventoros.com", "license": "AGPL-3.0-or-later", diff --git a/src/Console/SyncCommand.php b/src/Console/SyncCommand.php index b653740..6233363 100644 --- a/src/Console/SyncCommand.php +++ b/src/Console/SyncCommand.php @@ -6,12 +6,14 @@ use Illuminate\Console\Command; use Inventoros\Plugins\Shopify\Jobs\ProcessWebhook; +use Inventoros\Plugins\Shopify\Jobs\PushFulfilments; use Inventoros\Plugins\Shopify\Jobs\PushInventory; use Inventoros\Plugins\Shopify\Jobs\PushProducts; use Inventoros\Plugins\Shopify\Jobs\RunSync; use Inventoros\Plugins\Shopify\Kit\Models\Connection; use Inventoros\Plugins\Shopify\Kit\Models\WebhookInboxEntry; use Inventoros\Plugins\Shopify\Kit\Outbox\Outbox; +use Inventoros\Plugins\Shopify\Sync\FulfilmentPush; use Inventoros\Plugins\Shopify\Sync\InventoryPush; use Inventoros\Plugins\Shopify\Sync\ProductPush; @@ -59,6 +61,10 @@ public function handle(Outbox $outbox): int PushInventory::dispatch($connection->id); } + if ($outbox->hasDue($connection, FulfilmentPush::KIND)) { + PushFulfilments::dispatch($connection->id); + } + if ($outbox->hasDue($connection, ProductPush::KIND)) { PushProducts::dispatch($connection->id); } diff --git a/src/Http/Controllers/ActionsController.php b/src/Http/Controllers/ActionsController.php index fafbdba..f2874e7 100644 --- a/src/Http/Controllers/ActionsController.php +++ b/src/Http/Controllers/ActionsController.php @@ -28,6 +28,7 @@ use Inventoros\Plugins\Shopify\Support\Core; use Inventoros\Plugins\Shopify\Support\Permissions; use Inventoros\Plugins\Shopify\Sync\Catalog; +use Inventoros\Plugins\Shopify\Sync\FulfilmentPush; use Inventoros\Plugins\Shopify\Sync\InventoryPush; use Inventoros\Plugins\Shopify\Sync\Locations; use Inventoros\Plugins\Shopify\Sync\OrderImporter; @@ -94,6 +95,9 @@ public function updateConnection(Request $request, int $connection): RedirectRes unset($credentials['client_id'], $credentials['token_expires_at']); } + if (($data['push_fulfilments'] ?? false) && ! $record->setting('push_fulfilments', false)) { + $retest = true; + } if (($data['import_payments'] ?? false) && ! $record->setting('import_payments', false)) { $retest = true; // Register the refund topic when payment imports are enabled. } @@ -401,12 +405,18 @@ private function validateConnection(Request $request, ?Connection $existing): ar 'stock_source' => ['required', Rule::in(SyncPolicy::STOCK_SOURCES)], 'product_source' => ['required', Rule::in(SyncPolicy::PRODUCT_SOURCES)], 'import_orders' => ['required', 'boolean'], + 'push_fulfilments' => ['nullable', 'boolean'], 'import_payments' => ['nullable', 'boolean'], + 'import_test_orders' => ['nullable', 'boolean'], 'orders_since' => ['required_with:history_before', 'nullable', 'date'], 'history_before' => ['nullable', 'date', 'after_or_equal:orders_since', 'before_or_equal:today'], ]); + if (($data['push_fulfilments'] ?? false) && ! FulfilmentPush::supported()) { + throw ValidationException::withMessages(['push_fulfilments' => 'Update Inventoros to a version with shipment notification ownership before enabling this option.']); + } + if (($data['import_payments'] ?? false) && ! Payments::supported()) { throw ValidationException::withMessages(['import_payments' => 'Update Inventoros core to enable imported-payment records.']); } diff --git a/src/Jobs/PushFulfilments.php b/src/Jobs/PushFulfilments.php new file mode 100644 index 0000000..61dd9a9 --- /dev/null +++ b/src/Jobs/PushFulfilments.php @@ -0,0 +1,27 @@ +pushesFulfilments(); + } + + protected function pushBatch(Connection $connection, $entries, $run): void + { + app(FulfilmentPush::class)->push($connection, $entries, $run); + } +} diff --git a/src/Shopify/FulfilmentQueries.php b/src/Shopify/FulfilmentQueries.php new file mode 100644 index 0000000..404a4c4 --- /dev/null +++ b/src/Shopify/FulfilmentQueries.php @@ -0,0 +1,71 @@ +assertNoUserErrors($data['inventorySetQuantities']['userErrors'] ?? []); } + public function fulfilmentOrders(string $orderId, string $locationId): array + { + $result = []; + $after = null; + $seen = []; + do { + $data = $this->read(FulfilmentQueries::ORDERS, ['id' => Gid::make('Order', $orderId), 'location' => Gid::make('Location', $locationId), 'after' => $after], 600); + if (! is_array($data['order'] ?? null)) { + throw new PermanentError('The Shopify order no longer exists or is not accessible.'); + } + $page = $data['order']['fulfillmentOrders'] ?? []; + foreach ($page['nodes'] ?? [] as $order) { + $order = $this->complete($order, 'lineItems', FulfilmentQueries::LINES, 'fulfillmentOrder', 600, ['location' => Gid::make('Location', $locationId)]); + $result[] = [ + 'id' => Gid::id($order['id']), 'status' => $order['status'], 'request_status' => $order['requestStatus'], + 'location_id' => Gid::id($order['assignedLocation']['location']['id'] ?? null), + 'lines' => array_map(fn ($line) => [ + 'id' => Gid::id($line['id']), 'line_id' => Gid::id($line['lineItem']['id']), + 'inventory_item_id' => Gid::id($line['inventoryItemId'] ?? null), 'remaining' => (int) $line['remainingQuantity'], + 'stocked' => ($line['variant']['inventoryItem']['inventoryLevel'] ?? null) !== null, + ], $order['lineItems']['nodes'] ?? []), + ]; + } + $more = (bool) ($page['pageInfo']['hasNextPage'] ?? false); + $after = $page['pageInfo']['endCursor'] ?? null; + if ($more && (! is_string($after) || $after === '' || isset($seen[$after]))) { + throw new PermanentError('Shopify returned a missing or repeated fulfilment order cursor; refusing partial data.'); + } + if ($more) { + $seen[$after] = true; + } + } while ($more); + + return $result; + } + + public function activateInventory(string $inventoryItemId, string $locationId, string $key): void + { + $data = $this->query(FulfilmentQueries::ACTIVATE, ['item' => Gid::make('InventoryItem', $inventoryItemId), 'location' => Gid::make('Location', $locationId), 'key' => $key], 10); + $this->assertNoUserErrors($data['inventoryActivate']['userErrors'] ?? []); + } + + public function moveFulfilmentOrder(string $id, string $locationId, array $lines): void + { + if ($lines === []) { + throw new PermanentError('A shipment move must name its line quantities.'); + } + $data = $this->query(FulfilmentQueries::MOVE, [ + 'id' => Gid::make('FulfillmentOrder', $id), 'location' => Gid::make('Location', $locationId), + 'lines' => array_map(fn ($line) => ['id' => Gid::make('FulfillmentOrderLineItem', $line['id']), 'quantity' => $line['quantity']], $lines), + ], 10); + $this->assertNoUserErrors($data['fulfillmentOrderMove']['userErrors'] ?? []); + } + + public function createFulfilment(array $fulfilment, string $message): string + { + $data = $this->query(FulfilmentQueries::CREATE, ['fulfillment' => $fulfilment, 'message' => $message], 10); + $this->assertNoUserErrors($data['fulfillmentCreate']['userErrors'] ?? []); + $id = Gid::id($data['fulfillmentCreate']['fulfillment']['id'] ?? null); + if ($id === null) { + throw new TransientError('Shopify did not return a fulfilment id.'); + } + + return $id; + } + public function updateProductTitle(string $productId, string $title): void { $data = $this->query(Queries::UPDATE_PRODUCT, [ @@ -280,7 +346,7 @@ private function query(string $query, array $variables, int $expectedCost): arra } /** Finish a nested connection before returning a record to an importer. */ - private function complete(array $node, string $field, string $query, string $root, int $cost): array + private function complete(array $node, string $field, string $query, string $root, int $cost, array $variables = []): array { $connection = $node[$field] ?? []; $seen = []; @@ -290,7 +356,7 @@ private function complete(array $node, string $field, string $query, string $roo throw new PermanentError('Shopify returned a missing or repeated pagination cursor; refusing a partial record.'); } $seen[$cursor] = true; - $data = $this->read($query, ['id' => $node['id'], 'after' => $cursor], $cost); + $data = $this->read($query, ['id' => $node['id'], 'after' => $cursor] + $variables, $cost); if (! is_array($data[$root][$field] ?? null)) { throw new TransientError('Shopify omitted a nested page; refusing a partial record. Retry the sync.'); } diff --git a/src/Shopify/ShopifyClient.php b/src/Shopify/ShopifyClient.php index 17f671e..ad779f0 100644 --- a/src/Shopify/ShopifyClient.php +++ b/src/Shopify/ShopifyClient.php @@ -79,6 +79,17 @@ public function order(string $id): ?array; */ public function setInventoryQuantities(array $quantities, string $idempotencyKey): void; + /** Unfulfilled line ids and quantities, with destination stock activation state. */ + public function fulfilmentOrders(string $orderId, string $locationId): array; + + public function activateInventory(string $inventoryItemId, string $locationId, string $key): void; + + /** Move only these explicit line ids/quantities; callers re-read afterwards. */ + public function moveFulfilmentOrder(string $id, string $locationId, array $lines): void; + + /** Returns the created fulfilment id. Not safe to replay after an ambiguous response. */ + public function createFulfilment(array $fulfilment, string $message): string; + public function updateProductTitle(string $productId, string $title): void; /** diff --git a/src/Shopify/ShopifyConnectionTester.php b/src/Shopify/ShopifyConnectionTester.php index 9de8815..5633091 100644 --- a/src/Shopify/ShopifyConnectionTester.php +++ b/src/Shopify/ShopifyConnectionTester.php @@ -41,6 +41,10 @@ public function test(Connection $connection): TestResult $required[] = 'read_all_orders'; } } + if ($policy->pushesFulfilments()) { + $required = array_merge($required, ['read_orders', 'read_merchant_managed_fulfillment_orders', 'write_merchant_managed_fulfillment_orders', 'write_inventory']); + } + $required = array_values(array_unique($required)); $granted = $shop['scopes'] ?? []; $missing = array_values(array_filter($required, fn ($scope) => ! in_array($scope, $granted, true) && ! (str_starts_with($scope, 'read_') && in_array('write_'.substr($scope, 5), $granted, true)))); diff --git a/src/Shopify/SyncPolicy.php b/src/Shopify/SyncPolicy.php index 00394a1..c7634f8 100644 --- a/src/Shopify/SyncPolicy.php +++ b/src/Shopify/SyncPolicy.php @@ -33,6 +33,7 @@ final class SyncPolicy 'stock_source' => 'inventoros', 'product_source' => 'shopify', 'import_orders' => true, + 'push_fulfilments' => false, 'import_payments' => false, 'import_test_orders' => false, 'orders_since' => null, @@ -67,7 +68,7 @@ public static function sanitize(array $input, array $current = []): array $settings['product_source'] = $input['product_source']; } - foreach (['import_orders', 'import_test_orders', 'import_payments'] as $flag) { + foreach (['import_orders', 'import_test_orders', 'push_fulfilments', 'import_payments'] as $flag) { if (array_key_exists($flag, $input)) { $settings[$flag] = (bool) $input[$flag]; } @@ -84,6 +85,11 @@ public static function sanitize(array $input, array $current = []): array return $settings; } + public function pushesFulfilments(): bool + { + return (bool) $this->settings['push_fulfilments']; + } + public function pushesStock(): bool { return $this->settings['stock_source'] === 'inventoros'; diff --git a/src/ShopifyPlugin.php b/src/ShopifyPlugin.php index 5bfe83a..63df1f4 100644 --- a/src/ShopifyPlugin.php +++ b/src/ShopifyPlugin.php @@ -177,6 +177,8 @@ private function registerNavigation(): void private function registerHooks(): void { add_action('stock_changed', [Listeners::class, 'stockChanged']); + add_action('shipment_shipped', [Listeners::class, 'shipmentShipped']); + add_filter('shipment_should_notify_customer', [Listeners::class, 'shouldNotifyShipment']); add_action('product_updated', [Listeners::class, 'catalogChanged']); add_action('variant_updated', [Listeners::class, 'catalogChanged']); diff --git a/src/Support/Listeners.php b/src/Support/Listeners.php index 405e2dc..e9b096e 100644 --- a/src/Support/Listeners.php +++ b/src/Support/Listeners.php @@ -6,8 +6,10 @@ use App\Models\Inventory\Product; use App\Models\Inventory\ProductVariant; +use App\Models\Shipping\Shipment; use Illuminate\Support\Collection; use Illuminate\Support\Facades\Log; +use Inventoros\Plugins\Shopify\Jobs\PushFulfilments; use Inventoros\Plugins\Shopify\Jobs\PushInventory; use Inventoros\Plugins\Shopify\Jobs\PushProducts; use Inventoros\Plugins\Shopify\Kit\Models\Connection; @@ -15,6 +17,7 @@ use Inventoros\Plugins\Shopify\Kit\Outbox\Outbox; use Inventoros\Plugins\Shopify\Shopify\SyncPolicy; use Inventoros\Plugins\Shopify\Sync\Catalog; +use Inventoros\Plugins\Shopify\Sync\FulfilmentPush; use Inventoros\Plugins\Shopify\Sync\InventoryPush; use Inventoros\Plugins\Shopify\Sync\ProductPush; use Throwable; @@ -100,6 +103,26 @@ public static function catalogChanged(mixed $record): void }); } + public static function shipmentShipped(mixed $shipment): void + { + if (! $shipment instanceof Shipment) { + return; + } + self::guard(function () use ($shipment): void { + $connection = FulfilmentPush::connectionFor($shipment); + if ($connection === null) { + return; + } + app(Outbox::class)->put($connection, FulfilmentPush::KIND, (string) $shipment->id); + PushFulfilments::dispatch($connection->id); + }); + } + + public static function shouldNotifyShipment(bool $send, mixed $shipment): bool + { + return $send && (! $shipment instanceof Shipment || FulfilmentPush::connectionFor($shipment) === null); + } + /** * Forget the per-request connection cache (tests, long-running workers). */ diff --git a/src/Sync/FulfilmentPush.php b/src/Sync/FulfilmentPush.php new file mode 100644 index 0000000..14c5e2e --- /dev/null +++ b/src/Sync/FulfilmentPush.php @@ -0,0 +1,193 @@ +organization_id)->find($shipment->order_id); + if ($order === null || $order->stock_committed === false || ($order->metadata['shopify']['historical'] ?? false)) { + return null; + } + $id = $order?->metadata['shopify']['connection_id'] ?? null; + $connection = $id ? Connection::forOrganization((int) $shipment->organization_id)->find($id) : null; + if ($connection === null || $connection->status === Connection::DISCONNECTED || ! SyncPolicy::for($connection)->pushesFulfilments()) { + return null; + } + + return Mapping::where('connection_id', $connection->id)->where('entity', OrderImporter::ENTITY) + ->where('internal_type', 'order')->where('internal_id', $shipment->order_id)->where('status', Mapping::MAPPED)->exists() ? $connection : null; + } + + public function push(Connection $connection, $entries, $run): void + { + foreach ($entries as $entry) { + $shipment = Shipment::withoutGlobalScopes()->where('organization_id', $connection->organization_id)->find((int) $entry->subject); + if ($shipment === null || $shipment->shipped_at === null || $shipment->status->value === 'cancelled') { + app(Outbox::class)->done($entry); + + continue; + } + $lock = Cache::lock('shopify:fulfil:'.$connection->id.':'.$shipment->order_id, 330); + if (! $lock->get()) { + throw new RateLimited('Another shipment of this order is syncing.', 3); + } + try { + $record = Mapping::firstOrCreate([ + 'connection_id' => $connection->id, 'entity' => self::KIND, 'external_id' => 'shipment-'.$shipment->id, + ], ['organization_id' => $connection->organization_id, 'internal_type' => 'shipment', 'internal_id' => $shipment->id, 'status' => Mapping::PENDING]); + if ($record->meta('state') === 'ambiguous' || $record->meta('state') === 'sending') { + app(Outbox::class)->done($entry); + throw new PermanentError("Shipment {$shipment->id} needs review: Shopify may already have created its fulfilment. Check and complete it in Shopify; automatic creation is stopped to prevent duplicates."); + } + if ($record->meta('fulfilment_id') === null) { + $this->send($connection, $shipment, $record); + } + app(Outbox::class)->done($entry); + app(SyncRecorder::class)->count($run, 'processed'); + app(SyncRecorder::class)->log($connection, $run, 'info', "Shipment {$shipment->id} fulfilled in Shopify.", ['entity' => self::KIND, 'internal_id' => $shipment->id, 'external_id' => $record->fresh()->meta('fulfilment_id'), 'action' => 'push_fulfilment']); + } catch (Throwable $e) { + if (isset($record) && $record->fresh()->meta('state') === 'ambiguous') { + app(Outbox::class)->done($entry); + } + throw $e; + } finally { + $lock->release(); + } + } + } + + private function send(Connection $connection, Shipment $shipment, Mapping $record): void + { + if (! self::supported()) { + throw new PermanentError('Update Inventoros to a core with shipment notification ownership before enabling fulfilment sync.'); + } + $order = Core::orders((int) $connection->organization_id)->findOrFail($shipment->order_id); + $orderMapping = app(MappingStore::class)->forInternal($connection, OrderImporter::ENTITY, 'order', (int) $order->id); + if ($orderMapping === null || self::connectionFor($shipment)?->id !== $connection->id) { + throw new PermanentError('This shipment is not linked to an imported order for this connection.'); + } + $location = app(Locations::class)->mapped($connection)->where('internal_type', Locations::WAREHOUSE)->where('internal_id', $shipment->warehouse_id); + if ($shipment->warehouse_id === null || $location->count() !== 1) { + throw new PermanentError('Map the shipment warehouse to exactly one Shopify location before syncing it.'); + } + $locationId = (string) $location->first()->external_id; + $lineIds = $order->metadata['shopify']['line_items'] ?? []; + $wanted = []; + foreach ($shipment->items as $item) { + $external = $lineIds[$item->order_item_id] ?? null; + if ($external === null || (int) $item->quantity <= 0) { + throw new PermanentError('This shipment has no exact Shopify line mapping. Fulfil older imported orders in Shopify.'); + } + $wanted[$external] = ($wanted[$external] ?? 0) + (int) $item->quantity; + } + if ($wanted === []) { + throw new PermanentError('The shipment contains no fulfilment lines.'); + } + $client = app(ClientFactory::class)->make($connection); + // Moves may split/merge fulfillment orders and replace their line ids. + // Re-read after each move, including after a retried/lost move response. + for ($moves = 0; $moves < 101; $moves++) { + $orders = $client->fulfilmentOrders($orderMapping->external_id, $locationId); + $remaining = $wanted; + $groups = []; + $move = null; + usort($orders, fn ($a, $b) => ($a['location_id'] !== $locationId) <=> ($b['location_id'] !== $locationId)); + foreach ($orders as $fulfilmentOrder) { + if (! in_array($fulfilmentOrder['status'], ['OPEN', 'IN_PROGRESS'], true) || ! in_array($fulfilmentOrder['request_status'], ['UNSUBMITTED', 'REJECTED', 'CANCELLATION_ACCEPTED'], true)) { + continue; + } + $lines = []; + $activate = []; + foreach ($fulfilmentOrder['lines'] as $line) { + $quantity = min($remaining[$line['line_id']] ?? 0, $line['remaining']); + if ($quantity <= 0) { + continue; + } + $lines[] = ['id' => $line['id'], 'quantity' => $quantity]; + $remaining[$line['line_id']] -= $quantity; + if (! $line['stocked'] && $line['inventory_item_id'] !== null) { + $activate[] = $line['inventory_item_id']; + } + } + if ($lines === []) { + continue; + } + if ($fulfilmentOrder['location_id'] !== $locationId) { + $move = [$fulfilmentOrder['id'], $lines, $activate]; + break; + } + $groups[] = ['fulfillmentOrderId' => Gid::make('FulfillmentOrder', $fulfilmentOrder['id']), 'fulfillmentOrderLineItems' => array_map(fn ($line) => ['id' => Gid::make('FulfillmentOrderLineItem', $line['id']), 'quantity' => $line['quantity']], $lines)]; + } + if ($move !== null) { + if ($moves === 100) { + throw new PermanentError('Too many fulfilment moves. Finish the shipment in Shopify.'); + } + foreach (array_unique($move[2]) as $itemId) { + $client->activateInventory($itemId, $locationId, 'inventoros-'.$connection->id.'-'.$shipment->id.'-'.$itemId.'-'.$locationId); + } + $client->moveFulfilmentOrder($move[0], $locationId, $move[1]); + + continue; + } + if (array_sum($remaining) > 0 || $groups === []) { + throw new PermanentError('Shopify has insufficient unfulfilled quantities for this shipment. Check existing fulfilments and held fulfillment orders.'); + } + $input = ['lineItemsByFulfillmentOrder' => $groups, 'notifyCustomer' => $shipment->notify_customer && $shipment->customer_notified_at === null && $shipment->customer_notification_queued_at === null]; + if (filled($shipment->tracking_number)) { + $input['trackingInfo'] = array_filter(['number' => $shipment->tracking_number, 'url' => $shipment->tracking_url, 'company' => $shipment->carrier_name], fn ($value) => filled($value)); + } + // Durable claim before the non-idempotent request: a killed worker + // or ambiguous network response cannot blindly create a second parcel. + DB::transaction(function () use ($record, $input): void { + $locked = Mapping::whereKey($record->id)->lockForUpdate()->firstOrFail(); + if (in_array($locked->meta('state'), ['sending', 'ambiguous', 'done'], true)) { + throw new PermanentError('This shipment already has a send claim. Review its Shopify fulfilment.'); + } + $locked->update(['meta' => array_merge($locked->meta ?? [], ['state' => 'sending', 'input' => $input, 'claimed_at' => now()->toIso8601String()])]); + }); + try { + $id = $client->createFulfilment($input, 'Inventoros shipment '.$shipment->id); + } catch (RateLimited $e) { + $record->refresh()->update(['meta' => array_merge($record->meta ?? [], ['state' => 'pending'])]); + throw $e; + } catch (Throwable $e) { + $record->refresh()->update(['status' => Mapping::CONFLICT, 'meta' => array_merge($record->meta ?? [], ['state' => 'ambiguous'])]); + throw new PermanentError("Shipment {$shipment->id}: verify and finish its fulfilment in Shopify before retrying. Automatic creation stopped after an uncertain or rejected response: ".$e->getMessage()); + } + $record->refresh()->update(['status' => Mapping::MAPPED, 'synced_at' => now(), 'meta' => array_merge($record->meta ?? [], ['state' => 'done', 'fulfilment_id' => $id])]); + if ($input['notifyCustomer']) { + $shipment->update(['customer_notification_queued_at' => now()]); + } + + return; + } + } +} diff --git a/src/Sync/OrderImporter.php b/src/Sync/OrderImporter.php index d163469..2259983 100644 --- a/src/Sync/OrderImporter.php +++ b/src/Sync/OrderImporter.php @@ -164,6 +164,21 @@ private function create(Connection $connection, string $id, array $order, ?Carbo DB::afterCommit(fn () => do_action('order_created', $created->refresh()->load('items'), $actor)); } $this->payments->sync($connection, $created, $transactions); + $createdLines = $created->items()->orderBy('id')->get(); + if ($createdLines->count() !== count($items)) { + throw new PermanentError('The imported order lines changed during creation; exact fulfilment mapping is not possible.'); + } + $lineIds = []; + foreach ($createdLines as $index => $createdLine) { + $source = $items[$index]; + if ((int) $createdLine->product_id !== (int) $source['product_id'] || (int) $createdLine->product_variant_id !== (int) ($source['product_variant_id'] ?? 0) || (int) $createdLine->quantity !== $source['quantity']) { + throw new PermanentError('The imported order lines were reordered; exact fulfilment mapping is not possible.'); + } + $lineIds[(string) $createdLine->id] = $source['_shopify_line_id']; + } + $metadata = $created->metadata; + $metadata['shopify']['line_items'] = $lineIds; + $created->update(['metadata' => $metadata]); $this->mappings->link($locked, 'order', (int) $created->id); return $created; @@ -280,6 +295,7 @@ private function items(Connection $connection, array $order, string $label): arr $item = ['product_id' => (int) $mapping->internal_id]; } + $item['_shopify_line_id'] = (string) $line['id']; $item['quantity'] = (int) $line['quantity']; $item['unit_price'] = $line['price']; diff --git a/tests/Fakes/FakeShopifyClient.php b/tests/Fakes/FakeShopifyClient.php index c65e895..65f43a1 100644 --- a/tests/Fakes/FakeShopifyClient.php +++ b/tests/Fakes/FakeShopifyClient.php @@ -4,6 +4,7 @@ namespace Inventoros\Plugins\Shopify\Tests\Fakes; +use Inventoros\Plugins\Shopify\Kit\Exceptions\TransientError; use Inventoros\Plugins\Shopify\Shopify\Normalizer; use Inventoros\Plugins\Shopify\Shopify\Page; use Inventoros\Plugins\Shopify\Shopify\ShopifyClient; @@ -48,7 +49,7 @@ final class FakeShopifyClient implements ShopifyClient public function __construct() { $shop = self::fixture('shop')['data']['shop']; - $this->shop = ['id' => '77001', 'name' => $shop['name'], 'domain' => $shop['myshopifyDomain'], 'currency' => $shop['currencyCode'], 'plan' => $shop['plan']['displayName'], 'scopes' => ['read_products', 'write_products', 'read_inventory', 'write_inventory', 'read_locations', 'read_orders', 'read_all_orders']]; + $this->shop = ['id' => '77001', 'name' => $shop['name'], 'domain' => $shop['myshopifyDomain'], 'currency' => $shop['currencyCode'], 'plan' => $shop['plan']['displayName'], 'scopes' => ['read_products', 'write_products', 'read_inventory', 'write_inventory', 'read_locations', 'read_orders', 'read_all_orders', 'read_merchant_managed_fulfillment_orders', 'write_merchant_managed_fulfillment_orders']]; foreach (self::fixture('locations')['data']['locations']['nodes'] as $node) { $this->locations[] = ['id' => substr($node['id'], strrpos($node['id'], '/') + 1), 'name' => $node['name'], 'active' => $node['isActive']]; @@ -204,6 +205,48 @@ public function subscribeWebhook(string $topic, string $callbackUrl): void /** * @param array $args */ + public array $fulfilmentOrderRows = []; + + public array $fulfilments = []; + + public bool $loseFulfilmentResponse = false; + + public function fulfilmentOrders(string $orderId, string $locationId): array + { + $this->record(__FUNCTION__, func_get_args()); + + return $this->fulfilmentOrderRows; + } + + public function activateInventory(string $inventoryItemId, string $locationId, string $key): void + { + $this->record(__FUNCTION__, func_get_args()); + } + + public function moveFulfilmentOrder(string $id, string $locationId, array $lines): void + { + $this->record(__FUNCTION__, func_get_args()); + foreach ($this->fulfilmentOrderRows as &$row) { + if ($row['id'] === $id) { + $row['location_id'] = $locationId; + foreach ($row['lines'] as &$line) { + $line['stocked'] = true; + } + } + } + } + + public function createFulfilment(array $fulfilment, string $message): string + { + $this->record(__FUNCTION__, func_get_args()); + $this->fulfilments[] = $fulfilment; + if ($this->loseFulfilmentResponse) { + throw new TransientError('Response lost'); + } + + return (string) (9000 + count($this->fulfilments)); + } + private function record(string $method, array $args): void { $this->calls[] = [$method, $args]; diff --git a/tests/Feature/FulfilmentHttpClientTest.php b/tests/Feature/FulfilmentHttpClientTest.php new file mode 100644 index 0000000..ad11cf6 --- /dev/null +++ b/tests/Feature/FulfilmentHttpClientTest.php @@ -0,0 +1,71 @@ + 'gid://shopify/FulfillmentOrder/70', 'status' => 'OPEN', 'requestStatus' => 'UNSUBMITTED', + 'assignedLocation' => ['location' => ['id' => 'gid://shopify/Location/1001']], + 'lineItems' => ['nodes' => [['id' => 'gid://shopify/FulfillmentOrderLineItem/80', 'lineItem' => ['id' => 'gid://shopify/LineItem/90'], 'remainingQuantity' => 2, 'inventoryItemId' => 'gid://shopify/InventoryItem/40', 'variant' => ['inventoryItem' => ['inventoryLevel' => null]]]], 'pageInfo' => ['hasNextPage' => false]]]; + Http::fake(['*' => Http::sequence() + ->push(['data' => ['order' => ['fulfillmentOrders' => ['nodes' => [$node], 'pageInfo' => ['hasNextPage' => true, 'endCursor' => 'next-page']]]]]) + ->push(['data' => ['order' => ['fulfillmentOrders' => ['nodes' => [], 'pageInfo' => ['hasNextPage' => false, 'endCursor' => null]]]]])]); + $budget = CostBudget::for(8888); + $budget->reset(); + $budget->observe(2000, 2000, 100); + $client = new HttpShopifyClient('acme-store.myshopify.com', 'test_token', $budget); + $rows = $client->fulfilmentOrders('5001', '1001'); + $this->assertSame('90', $rows[0]['lines'][0]['line_id']); + $this->assertFalse($rows[0]['lines'][0]['stocked']); + Http::assertSent(fn ($request) => (json_decode($request->body(), true)['variables']['after'] ?? null) === 'next-page'); + Http::assertSentCount(2); + } + + public function test_activation_is_idempotent_without_overwriting_existing_quantities_and_moves_name_partial_lines(): void + { + Http::fake(['*' => Http::sequence() + ->push(['data' => ['inventoryActivate' => ['inventoryLevel' => ['id' => 'level'], 'userErrors' => []]]]) + ->push(['data' => ['fulfillmentOrderMove' => ['movedFulfillmentOrder' => ['id' => '70'], 'userErrors' => []]]]) + ->push(['data' => ['fulfillmentCreate' => ['fulfillment' => ['id' => 'gid://shopify/Fulfillment/91'], 'userErrors' => []]]])]); + $budget = CostBudget::for(8889); + $budget->reset(); + $client = new HttpShopifyClient('acme-store.myshopify.com', 'test_token', $budget); + $client->activateInventory('40', '1001', 'activation-key'); + $client->moveFulfilmentOrder('70', '1001', [['id' => '80', 'quantity' => 1]]); + $this->assertSame('91', $client->createFulfilment(['lineItemsByFulfillmentOrder' => [['fulfillmentOrderId' => 'gid://shopify/FulfillmentOrder/70', 'fulfillmentOrderLineItems' => [['id' => 'gid://shopify/FulfillmentOrderLineItem/80', 'quantity' => 1]]]], 'notifyCustomer' => false], 'Shipment 1')); + Http::assertSent(fn ($request) => (json_decode($request->body(), true)['variables']['key'] ?? null) === 'activation-key' && ! str_contains(json_decode($request->body(), true)['query'], 'available:') && str_contains(json_decode($request->body(), true)['query'], '@idempotent')); + Http::assertSent(fn ($request) => (json_decode($request->body(), true)['variables']['lines'][0]['quantity'] ?? null) === 1); + } + + public function test_nested_fulfilment_lines_are_complete_and_keep_the_destination_location(): void + { + Sleep::fake(); + $line = ['id' => 'gid://shopify/FulfillmentOrderLineItem/80', 'lineItem' => ['id' => 'gid://shopify/LineItem/90'], + 'remainingQuantity' => 2, 'inventoryItemId' => 'gid://shopify/InventoryItem/40', 'variant' => ['inventoryItem' => ['inventoryLevel' => null]]]; + $node = ['id' => 'gid://shopify/FulfillmentOrder/70', 'status' => 'OPEN', 'requestStatus' => 'UNSUBMITTED', + 'assignedLocation' => ['location' => ['id' => 'gid://shopify/Location/1001']], + 'lineItems' => ['nodes' => [$line], 'pageInfo' => ['hasNextPage' => true, 'endCursor' => 'line-page']]]; + $next = array_replace($line, ['id' => 'gid://shopify/FulfillmentOrderLineItem/81']); + $cost = ['extensions' => ['cost' => ['throttleStatus' => ['currentlyAvailable' => 2000, 'maximumAvailable' => 2000, 'restoreRate' => 100]]]]; + Http::fake(['*' => Http::sequence() + ->push(['data' => ['order' => ['fulfillmentOrders' => ['nodes' => [$node], 'pageInfo' => ['hasNextPage' => false]]]]] + $cost) + ->push([], 429, ['Retry-After' => 1]) + ->push(['data' => ['fulfillmentOrder' => ['lineItems' => ['nodes' => [$next], 'pageInfo' => ['hasNextPage' => false]]]]] + $cost)]); + $rows = (new HttpShopifyClient('acme-store.myshopify.com', 'token', CostBudget::for(8800)))->fulfilmentOrders('5001', '1001'); + $this->assertSame(['80', '81'], array_column($rows[0]['lines'], 'id')); + Http::assertSent(fn ($request) => (json_decode($request->body(), true)['variables']['after'] ?? null) === 'line-page' + && json_decode($request->body(), true)['variables']['location'] === 'gid://shopify/Location/1001'); + Http::assertSentCount(3); + Sleep::assertSleptTimes(1); + } +} diff --git a/tests/Feature/FulfilmentPushTest.php b/tests/Feature/FulfilmentPushTest.php new file mode 100644 index 0000000..226b02a --- /dev/null +++ b/tests/Feature/FulfilmentPushTest.php @@ -0,0 +1,159 @@ +markTestSkipped('Requires core shipment notification ownership.'); + } + $this->setUpWorld(); + $this->mapLocations(); + $this->mapCatalog(); + $this->store->update(['settings' => array_merge($this->store->settings, ['push_fulfilments' => true])]); + Queue::fake(); + app(OrderImporter::class)->import($this->store, $this->shopify->orders[0]); + $this->order = Order::withoutGlobalScopes()->where('organization_id', $this->organization->id)->sole(); + $line = $this->order->items()->where('product_id', $this->bolt->id)->sole(); + $this->shopify->fulfilmentOrderRows = [[ + 'id' => '7001', 'location_id' => '1002', 'status' => 'OPEN', 'request_status' => 'UNSUBMITTED', + 'lines' => [['id' => '8001', 'line_id' => $this->order->metadata['shopify']['line_items'][$line->id], 'inventory_item_id' => '4001', 'remaining' => 2, 'stocked' => false]], + ]]; + $this->shopify->calls = []; + } + + private function ship(bool $notify = true) + { + $line = $this->order->items()->where('product_id', $this->bolt->id)->sole(); + $service = app(ShipmentService::class); + $shipment = $service->create($this->order, [ + 'carrier' => 'manual', 'carrier_name' => 'UPS', 'tracking_number' => 'FUL-TRACK', 'notify_customer' => $notify, + 'warehouse_id' => $this->main->id, 'items' => [['order_item_id' => $line->id, 'quantity' => 1]], + ], $this->admin); + $service->markShipped($shipment, $this->admin); + + return $shipment; + } + + public function test_partial_shipment_activates_before_moving_and_lets_shopify_send_the_email_once(): void + { + $before = $this->bolt->fresh()->stock; + $shipment = $this->ship(); + Queue::assertPushed(PushFulfilments::class); + Mail::assertNotQueued(ShipmentShippedEmail::class); + (new PushFulfilments($this->store->id))->handle(); + $this->assertCount(1, $this->shopify->fulfilments); + $payload = $this->shopify->fulfilments[0]; + $this->assertSame(1, $payload['lineItemsByFulfillmentOrder'][0]['fulfillmentOrderLineItems'][0]['quantity']); + $this->assertTrue($payload['notifyCustomer']); + $this->assertSame('FUL-TRACK', $payload['trackingInfo']['number']); + $calls = array_column($this->shopify->calls, 0); + $this->assertLessThan(array_search('moveFulfilmentOrder', $calls), array_search('activateInventory', $calls)); + $this->assertSame($before, $this->bolt->fresh()->stock, 'Shipping does not deduct Inventoros stock again.'); + $this->assertNotNull($shipment->fresh()->customer_notification_queued_at); + Listeners::shipmentShipped($shipment); + (new PushFulfilments($this->store->id))->handle(); + $this->assertCount(1, $this->shopify->fulfilments); + } + + public function test_existing_destination_stock_is_not_reactivated_and_notifications_can_be_off(): void + { + $this->shopify->fulfilmentOrderRows[0]['location_id'] = '1001'; + $this->shopify->fulfilmentOrderRows[0]['lines'][0]['stocked'] = true; + $this->ship(false); + (new PushFulfilments($this->store->id))->handle(); + $this->assertFalse($this->shopify->fulfilments[0]['notifyCustomer']); + $this->assertSame(0, $this->shopify->callsTo('activateInventory')); + $this->assertSame(0, $this->shopify->callsTo('moveFulfilmentOrder')); + } + + public function test_historical_orders_are_excluded_from_fulfilment_push(): void + { + $metadata = $this->order->metadata; + $metadata['shopify']['historical'] = true; + $this->order->update(['metadata' => $metadata]); + $shipment = $this->ship(false); + $this->assertNull(FulfilmentPush::connectionFor($shipment)); + Queue::assertNotPushed(PushFulfilments::class); + $this->assertSame(0, OutboxEntry::where('kind', FulfilmentPush::KIND)->count()); + } + + public function test_orders_that_never_committed_stock_are_excluded_from_fulfilment_push(): void + { + $this->order->forceFill(['stock_committed' => false])->save(); + $shipment = $this->ship(false); + $this->assertNull(FulfilmentPush::connectionFor($shipment)); + Queue::assertNotPushed(PushFulfilments::class); + } + + public function test_throttling_waits_then_retries_without_creating_duplicates(): void + { + $this->ship(); + $this->shopify->failNext('createFulfilment', new RateLimited('Slow down', 5)); + (new PushFulfilments($this->store->id))->handle(); + $this->assertCount(0, $this->shopify->fulfilments); + (new PushFulfilments($this->store->id))->handle(); + $this->assertCount(1, $this->shopify->fulfilments); + $this->assertSame(0, DeadLetter::count()); + } + + public function test_a_lost_creation_response_stops_for_review_and_never_blindly_replays(): void + { + $shipment = $this->ship(); + $this->shopify->loseFulfilmentResponse = true; + (new PushFulfilments($this->store->id))->handle(); + $this->assertCount(1, $this->shopify->fulfilments); + $this->assertSame('ambiguous', Mapping::where('entity', FulfilmentPush::KIND)->sole()->meta('state')); + $this->assertSame(0, OutboxEntry::where('kind', FulfilmentPush::KIND)->count()); + $this->assertSame(1, DeadLetter::count()); + Listeners::shipmentShipped($shipment); + (new PushFulfilments($this->store->id))->handle(); + $this->assertCount(1, $this->shopify->fulfilments); + } + + public function test_paused_connections_keep_shipment_work_and_do_not_send_a_second_core_email(): void + { + $this->store->update(['paused_until' => now()->addHour()]); + $this->ship(); + (new PushFulfilments($this->store->id))->handle(); + $this->assertSame(1, OutboxEntry::where('kind', FulfilmentPush::KIND)->count()); + Mail::assertNotQueued(ShipmentShippedEmail::class); + $this->store->update(['paused_until' => null]); + (new PushFulfilments($this->store->id))->handle(); + $this->assertCount(1, $this->shopify->fulfilments); + } + + public function test_missing_line_mapping_or_insufficient_remote_quantity_cannot_fulfil_everything_accidentally(): void + { + $this->shopify->fulfilmentOrderRows[0]['lines'][0]['remaining'] = 0; + $this->ship(); + (new PushFulfilments($this->store->id))->handle(); + $this->assertCount(0, $this->shopify->fulfilments); + $this->assertSame(1, DeadLetter::count()); + } +} diff --git a/ui/src/components/ConnectionForm.vue b/ui/src/components/ConnectionForm.vue index 1d7aff5..df86ec5 100644 --- a/ui/src/components/ConnectionForm.vue +++ b/ui/src/components/ConnectionForm.vue @@ -30,7 +30,9 @@ const form = useForm({ stock_source: settings.stock_source ?? 'inventoros', product_source: settings.product_source ?? 'shopify', import_orders: settings.import_orders ?? true, + push_fulfilments: settings.push_fulfilments ?? false, import_payments: settings.import_payments ?? false, + import_test_orders: settings.import_test_orders ?? false, orders_since: settings.orders_since ?? today, history_before: settings.history_before ?? '', @@ -134,6 +136,11 @@ const submit = () => {

{{ form.errors.import_payments }}

+
+ +

{{ t('form.fulfilmentsHint') }}

+

{{ form.errors.push_fulfilments }}

+
diff --git a/ui/src/locales/ar.json b/ui/src/locales/ar.json index 2c3e066..f5802ab 100644 --- a/ui/src/locales/ar.json +++ b/ui/src/locales/ar.json @@ -16,6 +16,8 @@ "apiVersion": "Admin API {version}" }, "form": { + "pushFulfilments": "إرسال الشحنات والتتبع إلى Shopify", + "fulfilmentsHint": "يتطلب صلاحيات تجهيز الطلبات في Shopify وإصدار Inventoros محدثاً. يرسل Shopify بريد الشحن.", "name": "الاسم", "namePlaceholder": "المتجر الرئيسي", "shopDomain": "نطاق المتجر", diff --git a/ui/src/locales/de.json b/ui/src/locales/de.json index c54abee..1188de3 100644 --- a/ui/src/locales/de.json +++ b/ui/src/locales/de.json @@ -16,6 +16,8 @@ "apiVersion": "Admin API {version}" }, "form": { + "pushFulfilments": "Sendungen und Tracking an Shopify übertragen", + "fulfilmentsHint": "Erfordert Shopify-Versandberechtigungen und eine aktuelle Inventoros-Version. Shopify versendet die Versand-E-Mail.", "name": "Name", "namePlaceholder": "Hauptshop", "shopDomain": "Shop-Domain", diff --git a/ui/src/locales/en.json b/ui/src/locales/en.json index 59f02a9..0df2845 100644 --- a/ui/src/locales/en.json +++ b/ui/src/locales/en.json @@ -16,6 +16,8 @@ "apiVersion": "Admin API {version}" }, "form": { + "pushFulfilments": "Push shipments and tracking to Shopify", + "fulfilmentsHint": "Requires Shopify fulfilment permissions and an updated Inventoros core. Shopify sends the shipping email.", "paymentsUpgrade": "Update Inventoros core to enable imported-payment records.", "importPayments": "Record Shopify payments and refunds", "paymentsHint": "Imports completed transactions into the payment ledger. This does not charge or refund customers. Reconcile existing manual payment entries first to prevent duplicates.", @@ -26,6 +28,7 @@ "authClient": "App client credentials (automatic renewal)", "authHint": "Client credentials work when the app and store belong to the same Shopify organization. The API secret key is also the app client secret. Tokens renew automatically before expiry.", "clientId": "App client ID", + "name": "Name", "namePlaceholder": "Main store", "shopDomain": "Shop domain", diff --git a/ui/src/locales/es.json b/ui/src/locales/es.json index be26950..8689337 100644 --- a/ui/src/locales/es.json +++ b/ui/src/locales/es.json @@ -16,6 +16,8 @@ "apiVersion": "Admin API {version}" }, "form": { + "pushFulfilments": "Enviar envíos y seguimiento a Shopify", + "fulfilmentsHint": "Requiere permisos de preparación de Shopify e Inventoros actualizado. Shopify envía el correo de envío.", "name": "Nombre", "namePlaceholder": "Tienda principal", "shopDomain": "Dominio de la tienda", diff --git a/ui/src/locales/fr.json b/ui/src/locales/fr.json index e63ff48..3ec712e 100644 --- a/ui/src/locales/fr.json +++ b/ui/src/locales/fr.json @@ -16,6 +16,8 @@ "apiVersion": "Admin API {version}" }, "form": { + "pushFulfilments": "Envoyer les expéditions et le suivi à Shopify", + "fulfilmentsHint": "Nécessite les autorisations de préparation Shopify et Inventoros à jour. Shopify envoie le courriel d’expédition.", "name": "Nom", "namePlaceholder": "Boutique principale", "shopDomain": "Domaine de la boutique", diff --git a/ui/src/locales/it.json b/ui/src/locales/it.json index ea40b00..d2bc102 100644 --- a/ui/src/locales/it.json +++ b/ui/src/locales/it.json @@ -16,6 +16,8 @@ "apiVersion": "Admin API {version}" }, "form": { + "pushFulfilments": "Invia spedizioni e tracciamento a Shopify", + "fulfilmentsHint": "Richiede i permessi di evasione Shopify e Inventoros aggiornato. Shopify invia l’email di spedizione.", "name": "Nome", "namePlaceholder": "Negozio principale", "shopDomain": "Dominio del negozio", diff --git a/ui/src/locales/ja.json b/ui/src/locales/ja.json index d3cd37b..adc0830 100644 --- a/ui/src/locales/ja.json +++ b/ui/src/locales/ja.json @@ -16,6 +16,8 @@ "apiVersion": "Admin API {version}" }, "form": { + "pushFulfilments": "出荷と追跡情報をShopifyに送信", + "fulfilmentsHint": "Shopifyのフルフィルメント権限と更新済みのInventorosが必要です。出荷メールはShopifyが送信します。", "name": "名前", "namePlaceholder": "メインストア", "shopDomain": "ショップドメイン", diff --git a/ui/src/locales/ko.json b/ui/src/locales/ko.json index 9a598ca..3e1ccc1 100644 --- a/ui/src/locales/ko.json +++ b/ui/src/locales/ko.json @@ -16,6 +16,8 @@ "apiVersion": "Admin API {version}" }, "form": { + "pushFulfilments": "배송 및 추적 정보를 Shopify로 전송", + "fulfilmentsHint": "Shopify 주문 처리 권한과 최신 Inventoros가 필요합니다. 배송 이메일은 Shopify에서 보냅니다.", "name": "이름", "namePlaceholder": "메인 스토어", "shopDomain": "상점 도메인", diff --git a/ui/src/locales/nl.json b/ui/src/locales/nl.json index 05dd4bb..d6448a3 100644 --- a/ui/src/locales/nl.json +++ b/ui/src/locales/nl.json @@ -16,6 +16,8 @@ "apiVersion": "Admin API {version}" }, "form": { + "pushFulfilments": "Zendingen en tracking naar Shopify sturen", + "fulfilmentsHint": "Vereist Shopify-afhandelingsrechten en een bijgewerkte Inventoros-versie. Shopify verstuurt de verzendmail.", "name": "Naam", "namePlaceholder": "Hoofdwinkel", "shopDomain": "Winkeldomein", diff --git a/ui/src/locales/pl.json b/ui/src/locales/pl.json index 5150db6..e88ad34 100644 --- a/ui/src/locales/pl.json +++ b/ui/src/locales/pl.json @@ -16,6 +16,8 @@ "apiVersion": "Admin API {version}" }, "form": { + "pushFulfilments": "Wysyłaj przesyłki i śledzenie do Shopify", + "fulfilmentsHint": "Wymaga uprawnień realizacji Shopify i aktualnej wersji Inventoros. Shopify wysyła wiadomość o wysyłce.", "name": "Nazwa", "namePlaceholder": "Sklep główny", "shopDomain": "Domena sklepu", diff --git a/ui/src/locales/pt-BR.json b/ui/src/locales/pt-BR.json index 18bc174..4820831 100644 --- a/ui/src/locales/pt-BR.json +++ b/ui/src/locales/pt-BR.json @@ -16,6 +16,8 @@ "apiVersion": "Admin API {version}" }, "form": { + "pushFulfilments": "Enviar remessas e rastreamento para Shopify", + "fulfilmentsHint": "Requer permissões de atendimento Shopify e Inventoros atualizado. Shopify envia o email de envio.", "name": "Nome", "namePlaceholder": "Loja principal", "shopDomain": "Domínio da loja", diff --git a/ui/src/locales/ru.json b/ui/src/locales/ru.json index 8624c0f..11ad87a 100644 --- a/ui/src/locales/ru.json +++ b/ui/src/locales/ru.json @@ -16,6 +16,8 @@ "apiVersion": "Admin API {version}" }, "form": { + "pushFulfilments": "Отправлять отгрузки и отслеживание в Shopify", + "fulfilmentsHint": "Требуются разрешения Shopify на выполнение заказов и обновлённый Inventoros. Письмо об отправке отправляет Shopify.", "name": "Название", "namePlaceholder": "Основной магазин", "shopDomain": "Домен магазина", diff --git a/ui/src/locales/tr.json b/ui/src/locales/tr.json index e0e785b..aec6196 100644 --- a/ui/src/locales/tr.json +++ b/ui/src/locales/tr.json @@ -16,6 +16,8 @@ "apiVersion": "Admin API {version}" }, "form": { + "pushFulfilments": "Gönderileri ve takibi Shopify’a aktar", + "fulfilmentsHint": "Shopify sipariş karşılama izinleri ve güncel Inventoros gerekir. Kargo epostasını Shopify gönderir.", "name": "Ad", "namePlaceholder": "Ana mağaza", "shopDomain": "Mağaza alanı", diff --git a/ui/src/locales/zh-CN.json b/ui/src/locales/zh-CN.json index a16815c..396b746 100644 --- a/ui/src/locales/zh-CN.json +++ b/ui/src/locales/zh-CN.json @@ -16,6 +16,8 @@ "apiVersion": "Admin API {version}" }, "form": { + "pushFulfilments": "将发货和物流追踪信息推送到 Shopify", + "fulfilmentsHint": "需要 Shopify 履约权限和更新后的 Inventoros。发货邮件由 Shopify 发送。", "name": "名称", "namePlaceholder": "主店铺", "shopDomain": "店铺域名",