From f2ed42f0a1dbfad58216ae0af50e5aa5fdcfc5e7 Mon Sep 17 00:00:00 2001 From: Matt Gros Date: Wed, 21 Oct 2026 21:52:53 -0400 Subject: [PATCH] Push shipped parcels and tracking to Shopify with duplicate protection --- .github/workflows/ci.yml | 2 +- README.md | 14 +- docs/setup.md | 4 + src/Console/SyncCommand.php | 6 + src/Http/Controllers/ActionsController.php | 14 +- src/Jobs/PushFulfilments.php | 27 +++ src/Shopify/FulfilmentQueries.php | 56 ++++++ src/Shopify/HttpShopifyClient.php | 64 +++++++ src/Shopify/ShopifyClient.php | 11 ++ src/Shopify/SyncPolicy.php | 8 +- src/ShopifyPlugin.php | 2 + src/Support/Listeners.php | 23 +++ src/Sync/FulfilmentPush.php | 190 +++++++++++++++++++++ src/Sync/OrderImporter.php | 16 ++ tests/Fakes/FakeShopifyClient.php | 43 +++++ tests/Feature/FulfilmentHttpClientTest.php | 47 +++++ tests/Feature/FulfilmentPushTest.php | 140 +++++++++++++++ ui/src/components/ConnectionForm.vue | 6 + ui/src/locales/ar.json | 2 + ui/src/locales/de.json | 2 + ui/src/locales/en.json | 2 + ui/src/locales/es.json | 2 + ui/src/locales/fr.json | 2 + ui/src/locales/it.json | 2 + ui/src/locales/ja.json | 2 + ui/src/locales/ko.json | 2 + ui/src/locales/nl.json | 2 + ui/src/locales/pl.json | 2 + ui/src/locales/pt-BR.json | 2 + ui/src/locales/ru.json | 2 + ui/src/locales/tr.json | 2 + ui/src/locales/zh-CN.json | 2 + 32 files changed, 694 insertions(+), 7 deletions(-) create mode 100644 src/Jobs/PushFulfilments.php create mode 100644 src/Shopify/FulfilmentQueries.php create mode 100644 src/Sync/FulfilmentPush.php create mode 100644 tests/Feature/FulfilmentHttpClientTest.php create mode 100644 tests/Feature/FulfilmentPushTest.php diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2d83ccc..459b968 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -67,7 +67,7 @@ jobs: config: phpunit.xml port: '' username: '' - core_ref: feat/warehouse-stock-overview + core_ref: feat/order-consolidation-planning - database: mysql config: phpunit.mysql.xml port: 3306 diff --git a/README.md b/README.md index 6684668..3dd3191 100644 --- a/README.md +++ b/README.md @@ -94,10 +94,10 @@ Admins hold both. On Inventoros versions without plugin permissions they fall ba - Routes follow the plugin route namespace: names `plg.shopify.*`, pages and actions under `/p/shopify/` (the overview moved from `/shopify` to `/p/shopify` in 1.0.1; update bookmarks). The webhook address, `/webhooks/plugins/shopify/{connection}`, is unchanged, so subscriptions registered by 1.0.0 keep delivering and nothing needs re-registering. - The sidebar item is translated on cores that translate plugin menu items (`label_key`). - Known limitations and SDK gaps: - - Core has no stock reservations (SDK gap G4): an order placed in Shopify takes stock when it is imported, not when it is placed. + - Orders commit Inventoros stock when imported. Cores with reservations exclude local holds from pushed availability; older releases do not provide reservation support. - 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; refunds and order edits after import are not applied. + - Optional shipment fulfilment and tracking push is available on cores with shipment notification ownership. Refunds and order edits after import are not applied. - No public OAuth app yet (custom app tokens only); see [docs/setup.md](docs/setup.md#7-future-a-public-app-with-oauth). ## Develop and test @@ -131,3 +131,13 @@ README screenshots: `SCREENSHOTS=1 npx playwright test -c plugins/shopify/e2e/pl ## License AGPL-3.0-or-later. See [LICENSE](LICENSE). + +## 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`, 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. diff --git a/docs/setup.md b/docs/setup.md index 3138288..9f9aa47 100644 --- a/docs/setup.md +++ b/docs/setup.md @@ -92,3 +92,7 @@ Place a test order in Shopify (enable **Also import test orders** first, or use ## 7. Future: a public app with OAuth Version 1 connects with a custom app's access token, one store at a time. 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/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 93b196f..4e3b9f0 100644 --- a/src/Http/Controllers/ActionsController.php +++ b/src/Http/Controllers/ActionsController.php @@ -4,11 +4,13 @@ namespace Inventoros\Plugins\Shopify\Http\Controllers; +use App\Models\User; use Illuminate\Http\RedirectResponse; use Illuminate\Http\Request; use Illuminate\Routing\Controller; use Illuminate\Validation\Rule; use Illuminate\Validation\ValidationException; +use InvalidArgumentException; use Inventoros\Plugins\Shopify\Jobs\ImportOrder; use Inventoros\Plugins\Shopify\Jobs\PushInventory; use Inventoros\Plugins\Shopify\Jobs\RunSync; @@ -26,10 +28,11 @@ 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; -use InvalidArgumentException; +use Inventoros\Plugins\Shopify\Sync\SkuMatcher; /** * Every write the pages make, under /p/shopify/actions (web group: session, @@ -221,7 +224,7 @@ public function linkMapping(Request $request, int $mapping): RedirectResponse } $data = $request->validate(['sku' => ['required', 'string', 'max:191']]); - $candidates = \Inventoros\Plugins\Shopify\Sync\SkuMatcher::candidates($organizationId, $data['sku']); + $candidates = SkuMatcher::candidates($organizationId, $data['sku']); if (count($candidates) !== 1) { throw ValidationException::withMessages(['sku' => count($candidates) === 0 @@ -379,10 +382,15 @@ 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_test_orders' => ['nullable', 'boolean'], 'orders_since' => ['nullable', 'date'], ]); + 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 ($existing === null && ! ShopDomain::valid($data['shop_domain'])) { throw ValidationException::withMessages(['shop_domain' => __('shopify::messages.invalid_domain')]); } @@ -390,7 +398,7 @@ private function validateConnection(Request $request, ?Connection $existing): ar return $data; } - private function authorizeManage(Request $request): \App\Models\User + private function authorizeManage(Request $request): User { $user = $request->user(); 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..57054c1 --- /dev/null +++ b/src/Shopify/FulfilmentQueries.php @@ -0,0 +1,56 @@ +assertNoUserErrors($data['inventorySetQuantities']['userErrors'] ?? []); } + public function fulfilmentOrders(string $orderId, string $locationId): array + { + $result = []; + $after = null; + do { + $data = $this->query(FulfilmentQueries::ORDERS, ['id' => Gid::make('Order', $orderId), 'location' => Gid::make('Location', $locationId), 'after' => $after], 300); + 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) { + if ($order['lineItems']['pageInfo']['hasNextPage'] ?? false) { + throw new PermanentError('This fulfillment order has more than 250 lines. Fulfil it in Shopify.'); + } + $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 && $after === null) { + throw new TransientError('Shopify omitted the fulfilment order page cursor.'); + } + } 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, [ diff --git a/src/Shopify/ShopifyClient.php b/src/Shopify/ShopifyClient.php index 3993fd0..734098b 100644 --- a/src/Shopify/ShopifyClient.php +++ b/src/Shopify/ShopifyClient.php @@ -76,6 +76,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/SyncPolicy.php b/src/Shopify/SyncPolicy.php index d0d32fd..550df82 100644 --- a/src/Shopify/SyncPolicy.php +++ b/src/Shopify/SyncPolicy.php @@ -32,6 +32,7 @@ final class SyncPolicy 'stock_source' => 'inventoros', 'product_source' => 'shopify', 'import_orders' => true, + 'push_fulfilments' => false, 'import_test_orders' => false, 'orders_since' => null, 'push_delay_seconds' => 10, @@ -60,7 +61,7 @@ public static function sanitize(array $input, array $current = []): array $settings['product_source'] = $input['product_source']; } - foreach (['import_orders', 'import_test_orders'] as $flag) { + foreach (['import_orders', 'import_test_orders', 'push_fulfilments'] as $flag) { if (array_key_exists($flag, $input)) { $settings[$flag] = (bool) $input[$flag]; } @@ -73,6 +74,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 93c096a..a83b441 100644 --- a/src/ShopifyPlugin.php +++ b/src/ShopifyPlugin.php @@ -170,6 +170,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..bcb5f2c --- /dev/null +++ b/src/Sync/FulfilmentPush.php @@ -0,0 +1,190 @@ +organization_id)->find($shipment->order_id); + $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 5b5da6c..fe6fe38 100644 --- a/src/Sync/OrderImporter.php +++ b/src/Sync/OrderImporter.php @@ -144,6 +144,21 @@ private function create(Connection $connection, string $id, array $order, ?Carbo } $created = $this->orders->create($this->orderData($connection, $order, $items, $reference, $label), $actor, 'shopify'); + $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; @@ -244,6 +259,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 f4abe81..e5f7d2b 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; @@ -195,6 +196,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..6df1da3 --- /dev/null +++ b/tests/Feature/FulfilmentHttpClientTest.php @@ -0,0 +1,47 @@ + '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(); + $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); + } +} diff --git a/tests/Feature/FulfilmentPushTest.php b/tests/Feature/FulfilmentPushTest.php new file mode 100644 index 0000000..252e58c --- /dev/null +++ b/tests/Feature/FulfilmentPushTest.php @@ -0,0 +1,140 @@ +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_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 f7aa2e1..7b11722 100644 --- a/ui/src/components/ConnectionForm.vue +++ b/ui/src/components/ConnectionForm.vue @@ -27,6 +27,7 @@ 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_test_orders: settings.import_test_orders ?? false, orders_since: settings.orders_since ?? today, }); @@ -108,6 +109,11 @@ const submit = () => { +
+ +

{{ 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 c13b871..850f7de 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.", "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": "店铺域名",