@deliverart/sdk-js-order 2.36.0 → 2.37.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (6) hide show
  1. package/README.md +480 -0
  2. package/dist/index.cjs +3091 -900
  3. package/dist/index.d.cts +25158 -10464
  4. package/dist/index.d.ts +25158 -10464
  5. package/dist/index.js +2871 -810
  6. package/package.json +10 -10
package/README.md CHANGED
@@ -599,3 +599,483 @@ Available requests
599
599
  ## License
600
600
 
601
601
  MIT
602
+
603
+ ## Order amendment history
604
+
605
+ `GetOrderAmendments(orderId, { query: { page, itemsPerPage } })` reads paginated
606
+ operator history from `/orders/{id}/amendments`. `GetOrderAmendmentDetails(id)`
607
+ reads one immutable revision. Both require permission to manage the order;
608
+ customer-facing history uses a separate projection and must not expose operator
609
+ notes or another recipient's billing data.
610
+
611
+ Each record includes its previous/current revisions, action, actor identifier,
612
+ request identifier, immutable before/after snapshots and confirmed operator
613
+ choices. Snapshot amounts remain decimal strings and retain the prices applied
614
+ at that revision. There are no generic create/update/delete history requests.
615
+
616
+ Orders now expose a required `revision` and fixed/percentage discount intent
617
+ through `discountType` and nullable `discountValue`. Legacy orders with no
618
+ explicit intent retain their fixed monetary `discount`. New order-taking
619
+ clients should send the selected type and entered value. Deploy the API migration
620
+ before consumers using this SDK; a missing revision must not be invented by the
621
+ client. Preview/commit requests will be added with the complete amendment workflow.
622
+
623
+ Amendment `decisions` preserve unknown JSON decision keys while validating typed
624
+ `settlement` (before/after confirmed balances) and `settlementPlan` when present.
625
+ Legacy history without these financial decisions remains readable. All monetary
626
+ values remain four-decimal strings. `refundSources[].execution` distinguishes
627
+ provider processing, an operator-recorded offline return, and an unavailable
628
+ original payment configuration; a reviewed plan is not payment/refund completion.
629
+
630
+ `orderSettlementRequestSchema` accepts an explicit collection/refund timing choice.
631
+ Immediate collection requires a payment configuration UUID; other choices cannot
632
+ supply a replacement refund destination or arbitrary provider payload. These are
633
+ shared domain schemas; preview/commit requests remain unavailable until the
634
+ corresponding API operations are exposed.
635
+
636
+ `decisions.settlementWork` separates original/legacy pending payment attempts from
637
+ active settlement operations. Its pending and `outcome_unknown` entries are not
638
+ confirmed money. A linked payment ID may appear in both collections: clients must
639
+ not add the amounts together or infer a fresh charge from `toCollect`. The backend
640
+ owns reservation accounting and rejects previews when this work changes.
641
+
642
+
643
+ ## Settlement balance, operations, and offline evidence
644
+
645
+ `GetOrderSettlement(orderId)` reads the current confirmed balance, original payment,
646
+ latest reviewed instruction, automatic preparation state, and pending payments.
647
+ It never starts payment processing or initializes settlement accounting. Use
648
+ `balance.toCollect` / `balance.toRefund` for the amount currently outstanding: the
649
+ instruction's amount is historical authorization and can remain nonzero after
650
+ settlement. A preparation state of `ready` means provider intents were prepared,
651
+ not that money was received or returned.
652
+
653
+ `GetOrderSettlementOperations(orderId, { query: { page, itemsPerPage } })` lists
654
+ operations newest first. Pagination is enabled by default with a maximum page
655
+ size of 100; `{ pagination: false }` returns an unpaginated list.
656
+ `GetOrderSettlementOperationDetails(operationId)` reads one operation. These reads
657
+ require order access and preserve the original Ecommerce buyer's access after a
658
+ recipient change. Responses omit provider credentials, external references and
659
+ private operator receipt evidence.
660
+
661
+ An authorized human operator can record cash, terminal or bank-transfer money
662
+ already received or returned using `RecordOrderOfflineSettlement`:
663
+
664
+ ```ts
665
+ const requestId = crypto.randomUUID() // retain this value and the same evidence for retries
666
+ const input = {
667
+ instructionId: settlement.instruction.id,
668
+ requestId,
669
+ amount: '8.0000',
670
+ paymentConfigId,
671
+ reference: 'Cash receipt 1',
672
+ }
673
+ const operation = await sdk.call(new RecordOrderOfflineSettlement(orderId, input))
674
+ ```
675
+
676
+ For collection, use the completed local payment configuration allowed by the
677
+ instruction. For a refund, pass the reviewed `sourcePaymentId` instead; null is
678
+ allowed only for a legacy opening balance without a Payment. Optional `occurredAt`
679
+ accepts an ISO timestamp with timezone and up to millisecond precision. Omitting it
680
+ uses server recording time. A timestamp cannot precede order creation or be in the
681
+ future. The reference is optional and limited to 120 characters.
682
+
683
+ A repeated request UUID with identical money and evidence returns the original
684
+ operation; changing the input conflicts. The endpoint requires `MANAGE_ORDER`
685
+ and a human operator, rechecks pending funds under the order lock, and rejects
686
+ Stripe declarations. It records an actual offline act and never sends a bank
687
+ transfer.
688
+
689
+ `StartOrderOnlineSettlement(orderId, { instructionId, requestId, amount,
690
+ paymentConfigId?, sourcePaymentId? })` starts a reviewed Stripe collection or
691
+ refund, including an arrangement previously deferred until fulfillment. Use the
692
+ collection configuration or original refund source as appropriate. The API returns
693
+ 202 with a durable operation; Checkout creation and refunds run asynchronously.
694
+ Keep the same request UUID and payload after connection failures. Replays return
695
+ the existing status, including failure or uncertain outcome, without starting a
696
+ replacement. A new request cannot spend funds still reserved by pending work.
697
+ The API resolves first-party return URLs; custom redirects and asserted outcomes
698
+ are rejected. Read the operation and the additional Payment's info to obtain the
699
+ Checkout link when available. Only confirmed outcomes change the settlement
700
+ balance. Explicit recovery and audit requests are described below.
701
+
702
+ ## Settlement recovery and operator audit
703
+
704
+ `ReconcileOrderSettlementOperation(operationId, { requestId })` asks for asynchronous
705
+ provider verification of a submitted, unresolved Stripe operation. It returns 202
706
+ with the current operation. It makes no provider request during HTTP handling and
707
+ never authorizes another charge/refund submission. If a complete provider lookup
708
+ finds no result, the operation remains uncertain and reserves money with an
709
+ attention diagnostic. An active worker lease cannot be displaced. Original
710
+ credentials, request, provider identity and first submission time are preserved.
711
+
712
+ `RetryOrderSettlementPreparation(orderId, { instructionId, requestId })` makes a
713
+ waiting/blocked automatic preparation due again and returns the current summary
714
+ with 202. Only the latest immediate instruction is eligible: deferred arrangements
715
+ use the explicit online/offline actions. This retry does not replace provider work
716
+ already prepared and cannot restart a successful preparation.
717
+
718
+ Both actions require a human order operator and record immutable audit evidence in
719
+ the same transaction. Keep the same request UUID for retries after transport
720
+ failure; an exact replay does not request another check or clear a later error.
721
+ Use a new UUID only for a new deliberate recovery action. Read operator-only audit
722
+ with `GetOrderSettlementRecoveries(orderId, { query: { page, itemsPerPage } })` or
723
+ `GetOrderSettlementRecoveryDetails(recoveryId)`. Reads are paginated by default,
724
+ newest first, with at most 100 items per page. Buyer read access to the balance does
725
+ not grant recovery or audit access.
726
+
727
+ ## Delivery or collection with an outstanding balance
728
+
729
+ `GetOrderFulfillment(orderId)` reads the current revision, fulfillment readiness,
730
+ assigned delivery id, amount still to collect and whether amendment debt requires
731
+ acknowledgement. Collection requires order-management access. Delivery permits an
732
+ authorized delivery operator or the assigned courier; it does not give couriers
733
+ permission to manage settlement operations.
734
+
735
+ `CompleteOrderFulfillment(orderId, { requestId, revision, acknowledgedAmount?, reason? })`
736
+ completes a ready collection or the current stop of a started delivery. For an
737
+ amended order with money still due, show the warning before submitting, pass the
738
+ exact reviewed `toCollect` and require a nonblank reason (maximum 500 characters).
739
+ A stale revision or changed amount conflicts and requires a fresh review. Keep
740
+ request UUID and input unchanged to recover after a connection failure.
741
+
742
+ The returned `debtStatus` remains `open` until the confirmed balance reaches zero;
743
+ fulfillment is not payment or a write-off. `GetOrderFulfillmentReceipt(receiptId)`
744
+ is operator-only historical evidence and preserves the original outstanding
745
+ amount, actor, time and reason after actual settlement. `MarkOrderAsCollected`
746
+ and the existing delivery-completion action return 409 for unacknowledged
747
+ amendment debt; ordinary orders retain their existing no-body behavior.
748
+ `GetOrderSettlementTasks(pointOfSaleId, { query: { status: 'open', completed: true } })`
749
+ returns the POS worklist, including fulfilled orders with amendment money still due.
750
+ The native filters are `status` (`open`, `settled`, `all`, default `open`),
751
+ `direction` (`collection`, `refund`, `reconciliation`) and `completed` (boolean).
752
+ Pagination is always enabled: 25 rows by default, at most 100, with `page` and
753
+ `itemsPerPage`. Unlike ordinary lists, this bounded worklist rejects SDK
754
+ `pagination: false` requests.
755
+
756
+ Rows include the current balance, reviewed instruction, preparation status,
757
+ active operation count, pending-payment flag, attention flag and an optional
758
+ immutable fulfillment receipt id. Display money from `balance`, not the historical
759
+ instruction amount. A balanced order remains open in direction `reconciliation`
760
+ while a payment or provider outcome is unresolved. Confirmed settlement removes
761
+ the row from the default open view; `status: 'settled'` retains access to its
762
+ historical receipt. Reads neither initialize accounting nor contact providers.
763
+ Only POS managers with order access may list these tasks; buyer and courier
764
+ per-order permissions do not grant access. The actual Hub/courier interfaces
765
+ remain pending.
766
+
767
+
768
+ ## Currently available settlement actions
769
+
770
+ `GetOrderSettlementActions(orderId)` is an operator-only local read. Its response
771
+ identifies the current instruction and revision, captured currency/direction and
772
+ funding actions (`paymentConfigId` or original `sourcePaymentId`, method,
773
+ execution mode, `availableAmount`, safe optional reason). It uses the same money
774
+ budget as reservation writes, including verified facts awaiting ledger sync,
775
+ pending money and active holds. Do not reuse the historical instruction amount
776
+ as the executable amount or sum per-source maxima beyond the order balance.
777
+
778
+ A zero amount or `execution: 'unavailable'` disables that action. GET does not
779
+ initialize accounting, reserve money or contact a provider. It predicts the
780
+ superseded-unsent cleanup performed by a new reservation without performing that
781
+ cleanup itself. Submitted/uncertain work remains held. Compare the action revision
782
+ with the current summary and refresh on mismatch; the eventual command always
783
+ revalidates under locks.
784
+
785
+ ## Kitchen amendment evidence
786
+
787
+ `OrderAmendment.decisions.kitchen` is optional for historical records and uses
788
+ `OrderKitchenAmendmentPlan` for new internal workflow commits. Changed root trees
789
+ retain line identities and before/after nested configurations; `quantityDelta`
790
+ describes the difference rather than the full revised preparation quantity.
791
+ Unchanged products and financial/customer data are absent from this projection.
792
+ The previous preparation status/timestamps remain historical evidence when
793
+ `reopensPreparation` moves a ready order back to `in_preparation`.
794
+
795
+ This read contract does not introduce a kitchen acknowledgement endpoint or
796
+ authorize readiness changes. Public amendment writes, revision-aware readiness
797
+ confirmation and Kitchen Monitor integration are still being implemented.
798
+
799
+ ## Reviewed preparation confirmation
800
+
801
+ `new AdvanceOrderPreparationStatus(orderId, revision)` sends one strong
802
+ `If-Match: "<revision>"` header and no request body. Pass the revision that the
803
+ operator reviewed. It is required for amended orders (428 without it); stale or
804
+ invalid revisions fail with 412. Reload and review after an uncertain response;
805
+ never automatically advance again. The legacy one-argument call remains only for
806
+ ordinary orders. Pending kitchen notices must be reviewed before advancement.
807
+
808
+ ## Persistent kitchen review
809
+
810
+ `GetPointOfSaleKitchenReviews(posId, { query: { page, itemsPerPage } })` returns
811
+ the paginated inbox across order dates and preparation statuses. Pagination cannot
812
+ be disabled; page size is at most 25. `GetOrderKitchenReview(orderId)` reads the
813
+ current revision, total pending count and oldest 25 notices. Only kitchen evidence
814
+ is returned; the full customer/financial amendment snapshots are excluded.
815
+
816
+ `AcknowledgeKitchenAmendments(orderId, { revision, amendmentIds })` acknowledges
817
+ 1–25 distinct explicitly reviewed notices. Stale revision returns 412 and invalid
818
+ notice membership returns 409 atomically. Acknowledgement is idempotent per notice
819
+ and leaves preparation/readiness unchanged. Recover an uncertain response by
820
+ reading the inbox. Pending notices block preparation advancement. The SDK validates
821
+ these contracts against an actual isolated API response fixture.
822
+
823
+ Kitchen review responses also include `displayReference` and nullable
824
+ `preparationTime` for an operational inbox across dates. They are read in the same
825
+ server snapshot as the revision and notices. Never infer acknowledgement from a
826
+ missing row in one paginated page; explicitly read the order after uncertain writes.
827
+
828
+ ## Reviewed amendment notifications
829
+
830
+ `OrderAmendment.decisions.notifications` optionally carries a typed
831
+ `OrderAmendmentNotificationPlan[]`. The optional `orderNumber` preserves the
832
+ reviewed display number; historical decisions can omit it. Each affected order has its own reviewed
833
+ recipient, revision, source policy, material changes and financial balance. The
834
+ review statuses (`ready`, `opted_out`, `no_material_change`, `not_configured`,
835
+ `source_disabled`, `missing_recipient`, `unsupported_source`) are not delivery
836
+ states. Never display `ready` as queued, sent or delivered.
837
+
838
+ Ecommerce decisions retain the original buyer and do not allow a Hub opt-out.
839
+ Eligible Hub decisions default selected and may be deselected individually.
840
+ Legacy history can omit this field. Public amendment preview/commit is still pending.
841
+
842
+ `GetOrderAmendmentNotifications(orderId, { query: { page, itemsPerPage: 25 } })`
843
+ reads the native bounded outcome collection. `GetOrderAmendmentNotificationDetails`
844
+ reads one `OrderAmendmentNotification`. These operator-only views expose the
845
+ frozen sendable recipient, revision, effective state, safe diagnostic code and
846
+ verification eligibility, without private email data or service credentials.
847
+ `sent` means provider acceptance, not inbox delivery.
848
+
849
+ `VerifyOrderAmendmentNotification(notificationId, { requestId })` requests an
850
+ asynchronous read-only check. Keep the UUID unchanged after a transport failure.
851
+ The response confirms local scheduling, not email delivery; follow subsequent
852
+ outcome reads. Verification cannot resend email, override a recipient, or assert
853
+ an outcome. `canVerify` controls eligibility and `verifying` marks pending checks.
854
+ A missing or unproven remote record requires assistance instead of a new key.
855
+
856
+ ### Amendment destination review
857
+
858
+ `OrderAmendment.decisions.destinations` preserves the reviewed consequences for
859
+ all affected order/destination pairs. `orderAmendmentDestinationReviewSchema`
860
+ validates these local decisions, including automatic verification, assistance,
861
+ closed-sale correction, reconciliation, unresolved earlier amendments and
862
+ initial-export review. `remoteStateVerified` is always `false`: preview/history
863
+ must never label these decisions as successful remote synchronization. The
864
+ fingerprint binds local evidence to the reviewed revision without exposing
865
+ remote identifiers or private export payloads. Historical records may omit this
866
+ field. Public authoring uses the targeted preview/commit requests documented below.
867
+
868
+ ### Destination outcomes and assisted completion
869
+
870
+ `GetOrderAmendmentDestinations` (fixed 25-item pagination) and
871
+ `GetOrderAmendmentDestinationDetails` expose frozen revision contents and the
872
+ current destination outcome. `DeclareOrderAmendmentDestinationCompletion` records
873
+ an intervention already performed externally. It requires request UUID, reviewed
874
+ revision and execution version, correction kind, reference, evidence and explicit
875
+ confirmation. An ordinary open-sale update must use the reviewed remote reference;
876
+ a separate correction supplies its external correction/document reference, which
877
+ must differ from the original sale reference after trimming (otherwise HTTP 409).
878
+ A client must retain the same command UUID/body after an uncertain response and
879
+ match the returned declaration evidence before reporting completion.
880
+
881
+ `manually_completed` includes immutable operator evidence and has no `verifiedAt`.
882
+ It is distinct from provider-confirmed `verified`. Uncertain submissions, missing
883
+ initial export identities, unresolved predecessors and stale reviews block manual
884
+ declarations. This operation does not execute a remote update, issue a document,
885
+ move funds or grant access to a different order. Apply API migration
886
+ `Version20260918003000` before consuming these operations. Hub exposes the assisted
887
+ outcome workflow; this does not imply completion of every provider recovery path.
888
+
889
+ Amendment destination outcomes include the immutable display `currency` and
890
+ `timezone` captured with the revision. Both are nullable for legacy intent rows;
891
+ clients must not silently substitute the POS's current settings or assume EUR.
892
+ The Hub comparison uses these fields for historical amounts and scheduling times.
893
+
894
+ ### Targeted amendment authoring
895
+
896
+ `UpdateOrder` and `GenerateOrderBundle` are legacy operations for partner orders
897
+ without amendment history. Application/Ecommerce orders require the targeted
898
+ amendment flow from the first edit; otherwise valid legacy writes return
899
+ `409 order_amendment_required`. Existing preparation/fulfillment requests retain
900
+ their own permission and revision contracts. Never use generic updates to recover
901
+ from an unavailable or stale amendment preview.
902
+
903
+ Use `PreviewOrderAmendment(orderId, input)` with a new request UUID, the displayed
904
+ order revision and one action (`customer`, `billing`, `products`, `address`, `time`,
905
+ `discount`, `instructions`). `previewOrderAmendmentInputSchema` is a closed
906
+ discriminated union: existing product row IDs preserve commercial identity;
907
+ new rows require catalog IDs and quantities. Registry references and order-local
908
+ snapshots are mutually exclusive, and arbitrary order fields cannot be submitted.
909
+
910
+ Render the complete `OrderAmendmentPreview`, including planning alternatives,
911
+ financial work, recipients and destination choices. `canCommit=false` has no
912
+ usable token. Assisted/separate correction choices require an explicit operator
913
+ statement describing the available external correction path. Such a choice is
914
+ not capability proof and does not complete remote work. It is bound to each
915
+ review's `basisFingerprint`; changing local evidence requires a fresh review.
916
+
917
+ Confirm with `CommitOrderAmendment(orderId, { amendment: exactReviewedInput,
918
+ previewToken })`. Keep the same UUID and payload when recovering an uncertain
919
+ HTTP result. A success returns immutable history for local acceptance; payment,
920
+ notification and destination outcomes remain asynchronous. A changed request or
921
+ stale/expired preview fails rather than silently applying different consequences.
922
+ These contracts are tested against real authenticated HTTP fixtures. The full
923
+ feature and coordinated client/package rollout remain in progress.
924
+
925
+ Initialize targeted amendment forms with `GetOrderAmendmentEditor(orderId)`.
926
+
927
+ For time/address/product conflicts, `planning.forceAvailable=true` exposes the
928
+ human operator's existing force-scheduling permission. A separate explicit
929
+ `forcePlanning: { reason, manualFulfillmentConfirmed: true }` requires a new
930
+ preview. The reason is trimmed and bounded to 1–1000 characters. Forced results
931
+ use `planning.status=forced`, carry the reviewed reason and original conflict,
932
+ and set `automaticFeasibilityVerified=false`. They exclude the target from
933
+ automatic capacity without supplying another courier; source neighbors still
934
+ respect their constraints. Missing acknowledgement, unrelated actions and stale
935
+ permissions cannot bypass the flow. Keep the exact forced command on uncertain
936
+ commit recovery. Route metrics are nullable, including empty source bookings.
937
+ The response contains the current revision, POS/display context, an amendment
938
+ snapshot and all seven action availability entries with stable block reasons.
939
+ This operator-only read includes whole-journey departure in its eligibility
940
+ calculation. It creates no work and does not replace preview/commit validation.
941
+ Use `orderAmendmentEditorSchema` at client boundaries; it rejects duplicate or
942
+ missing actions, inconsistent availability and a foreign order snapshot.
943
+
944
+ Address and product amendment commands may set `alternativeRequestedTime` (an ISO
945
+ 8601 timestamp with seconds and an explicit offset) together with the selected
946
+ `referenceBundleId`. Pass the same primary `changes` and request UUID to a fresh
947
+ preview after selecting an alternative; commit that exact combined request and
948
+ its returned token. The API applies the time before recalculating the proposal
949
+ and rechecks availability under commit locks. Preview alternatives reserve no
950
+ capacity. The `time` action continues to use only `changes.requestedTime`; the
951
+ schema rejects alternative timestamps on other actions. Omission/null preserves
952
+ the original requested time. A lost response must replay the original combined
953
+ commit rather than submit separate product/address and time mutations.
954
+
955
+ Amendment destination outcomes may report
956
+ `errorCode=order_export_prior_submission_pending` while retaining an unfinished
957
+ status. The earlier global export must be resolved before that amendment can
958
+ proceed; waiting consumes no amendment send attempt. Global success wakes the
959
+ pending amendment but does not verify its later revision. This uses the existing
960
+ outcome schema and asynchronous workflow, without new request fields.
961
+
962
+ The same destination outcome schema carries `order_export_initial_pending` and
963
+ `order_export_initial_action_required` for approved Tilby and CassaInCloud first sends. The API binds
964
+ that global export to the reviewed immutable revision. Recover failures through
965
+ the existing global-export action; completed initial exports cannot be retried over
966
+ later amendments. Matching global success verifies only the bound intent and sets
967
+ its remote reference. Subsequent revisions retain their own destination work.
968
+ No new SDK fields or enum values are needed. Cassa initial sends verify the frozen
969
+ body through remote reads; later Cassa amendments remain assisted corrections.
970
+ Their outcome may expose the proven initial remote reference even when they were
971
+ accepted before the first send completed. This reference is not proof that the
972
+ later revision was applied.
973
+
974
+ `OrderAmendmentDestination.retry` now exposes the permitted recovery `mode`
975
+ (`retry` / `verify`, or null), `blockedReason` and `generation`. Use the native
976
+ `RetryOrderAmendmentDestination` request with a request UUID, expected intent
977
+ revision/execution version, the displayed mode, a reason and `confirmed: true`.
978
+ The response means recovery was durably authorized; only a later `verified`
979
+ outcome proves remote alignment. Reuse the exact command after a lost response.
980
+ After submission only verification is available. Earlier unresolved work, initial
981
+ global exports and assisted corrections retain their owning workflows. Deploy
982
+ API migration `Version20260918030000` and the outcome field before this SDK.
983
+
984
+ ### Amendment email delivery evidence
985
+
986
+ Notification outcomes optionally add `delivery: { status, occurredAt }`,
987
+ `deliveryCheckedAt`, `deliveryMonitoring`, `deliveryNextCheckAt` and
988
+ `deliveryErrorCode`. Legacy API responses may omit them. Delivery statuses are
989
+ accepted, delayed, delivered, bounced, complained, rejected and rendering_failed.
990
+ The submission status remains sent even for a later bounce. Delivered means the
991
+ recipient mail server accepted the email, not inbox placement or reading.
992
+
993
+ The API monitors accepted/uncertain sends through bounded asynchronous reads of
994
+ the same immutable request. After monitoring ends, server-authorized verification
995
+ can check an accepted message without resending or losing recorded facts. Consume
996
+ `canVerify` rather than excluding every sent row locally. Apply API migration
997
+ Version20260918050000 before enabling these fields. The SDK includes an actual
998
+ HTTP delivery-outcome fixture and validates delivery/monitoring eligibility.
999
+
1000
+ ### Original Ecommerce buyer
1001
+
1002
+ Order details expose optional, read-only `buyer` as a native user IRI (nullable
1003
+ for captured guests or deleted accounts). It remains independent of the mutable
1004
+ `customer`. The optional shape permits older API reads; consumer authorization
1005
+ must fail closed when the field is absent/null, never fall back to the recipient.
1006
+ Storefront detail, rating and realtime BFFs compare `buyer.params.id` with the
1007
+ signed-in user and separately require an exact order POS match. Release the API
1008
+ and this package together before switching those readers.
1009
+
1010
+ `GetCustomerOrders(customerId, { query: { view: 'buyer' } })` requests personal
1011
+ purchases at that customer's POS, including for accounts that also have operator
1012
+ roles. It requires ownership of the Customer. Omit the view to retain the API's
1013
+ existing operator/current-customer view. Use `GetOrderSettlement` for confirmed
1014
+ captured/refunded/net-paid amounts and outstanding differences; the original
1015
+ order `paymentStatus` is not the amended settlement balance.
1016
+
1017
+
1018
+ ### Reviewed status decisions
1019
+
1020
+ Use `new ConfirmOrder(order.id, order.revision)` and
1021
+ `new RejectOrder(order.id, order.revision)`. Like preparation advancement, these
1022
+ send a strong If-Match header without an input body. The API requires it after
1023
+ any amendment and rejects stale decisions. The optional constructor argument
1024
+ retains unamended legacy calls only; consumers should always pass the displayed
1025
+ revision. A 412/428 response requires operator review, not a refetch-and-retry.
1026
+
1027
+
1028
+ `DeleteOrder` may return HTTP 409 with `order_amendment_history_retained` when
1029
+ amendment history or a neighbor destination intent protects the order. Do not
1030
+ treat a rejected request as deletion or replace it with automatic cancellation,
1031
+ register removal or refund. Existing unamended-order deletion remains available.
1032
+
1033
+
1034
+ Generic `UpdateBundle` cannot change readiness/deliverability on a bundle with
1035
+ amendment history or affected-neighbor intents (409
1036
+ `bundle_amendment_actions_required`). Use targeted order operations.
1037
+ `DeleteBundle` also preserves that history (409 `order_amendment_history_retained`)
1038
+ and refuses started delivery history. Existing unamended bundle behavior remains
1039
+ available. The API now enforces the same immutable POS already excluded by the
1040
+ SDK update schema. Reload after conflicts rather than replaying stale flags.
1041
+
1042
+ ### Operator receipts
1043
+
1044
+ `GetOrderReceipts(orderId)` reads typed receipt sources, currently allowed offline
1045
+ commands, unreserved collection capacity and confirmed history. `RecordOrderReceipt`
1046
+ submits a revision-checked, idempotent `confirm`, `not_received`, `collect`, `refund`
1047
+ or `correct` command. Corrections require a reason and are separate from refunds.
1048
+ For actual-amount correction, retain the source `amount` and send `correctedAmount`
1049
+ (including zero). The API reverses the old receipt and atomically records a positive
1050
+ replacement. Respect funding `maximumCorrectedAmount` and require a changed value.
1051
+ Omitting the new field preserves legacy full-reversal requests and exact retries.
1052
+ Keep the exact request UUID and payload for uncertain-outcome recovery; a different
1053
+ payload with the same UUID is rejected. These commands record offline evidence and
1054
+ never execute card/bank transfers or assert Stripe results. Online settlement keeps
1055
+ its existing reviewed asynchronous workflow.
1056
+
1057
+ Receipt journal correction rows include optional nullable `correctedAmount` and
1058
+ `replacementPaymentId`. Keep raw movements intact but use the explicit relationship
1059
+ to show a correction and its replacement capture as one operator event, before
1060
+ paginating history. Legacy full reversals expose zero without a replacement.
1061
+
1062
+ API-generated preview fixtures preserve the public response shape and timestamps; their signed preview tokens use an all-zero signature so they cannot authorize a command.
1063
+
1064
+ ### Amendment resource references
1065
+
1066
+ Amendment and settlement commands accept canonical API resource IRIs. For example,
1067
+ use `changes: { customer: '/customers/<uuid>' }`,
1068
+ `changes: { customerAddress: '/customers/address/<uuid>' }`, or
1069
+ `changes: { customerBusinessProfile: '/customers/business_profiles/<uuid>' }`.
1070
+ Product trees accept `menuItem`, `variant`, `salesMode` and `menuItemModifier`;
1071
+ the optional planning reference is `referenceBundle`. Receipt commands accept
1072
+ `payment` and `paymentConfig`; settlement execution accepts `sourcePayment` and
1073
+ `paymentConfig`. Destination choices accept `order` and `integration`.
1074
+
1075
+ Existing UUID aliases remain supported for compatibility, but callers must not
1076
+ supply two non-null forms of the same reference. Historical response identifiers,
1077
+ request ids and instruction ids remain UUIDs. The new
1078
+ `orderAmendmentDestinationChoiceInputSchema` describes writable IRI choices;
1079
+ `orderAmendmentDestinationChoiceSchema` continues to describe frozen UUID evidence.
1080
+ Canonical IRIs are validated by the shared SDK IRI parser and sent as strings.
1081
+ The API rechecks resource type, POS ownership and customer/catalog relationships.