Skip to content

ffl_integrations.gunbroker.fulfillment

Source: apps/ffl_integrations/ffl_integrations/gunbroker/fulfillment.py · 11 endpoint(s)

Generated by make api-docs — do not edit by hand.

assign_gb_unit_serial

POST /api/method/ffl_integrations.gunbroker.fulfillment.assign_gb_unit_serial

Auth (derived from code): Roles: Sales User / Sales Manager / Stock Manager / System Manager

Name the gun that fills one unit of a model-level GunBroker order.

Reserves the gun for the order (the claim becomes a hold), tells the other storefronts it is gone, and records who assigned it and when. Naming a different gun for a unit that already has one swaps them: the old gun is released only if this order holds it. An empty serial_no unassigns the unit, which makes it an open claim again. Calling it again with the gun the unit already has changes nothing.

Refused: a gun of another model (a model pooled under this one must be filed under it first), a customer's consignment or transfer gun, one in custody, one the order already holds for another unit, one that is not free (held by a counter order or another channel, out on consignment, possibly already sold on GunBroker), and, on a Type 03 collector order, a gun not old enough to be a curio or relic. Nothing is changed on a refusal.

arg type required default description
gunbroker_order string yes — GunBroker Order name (must be Pending Fulfillment).
row_name string yes — The unit, as the card gives it: <gunbroker item id>:<unit number>.
serial_no string no '' The gun's Serial No. Empty unassigns the unit.

Returns: {ok, serial, row: the refreshed Pending Order card}.

Permissions: Counter roles.

apps/ffl_integrations/ffl_integrations/gunbroker/fulfillment.py:1027

correct_payment_details

POST /api/method/ffl_integrations.gunbroker.fulfillment.correct_payment_details

Auth (derived from code): Roles: System Manager

Repair the deposit date (and cheque number) recorded on a GunBroker order.

For the row that cannot otherwise be fixed. The four payment fields are read-only on the form — they are a record of what was banked, not something to retype — and the document refuses to save when a mode is recorded with no deposit date. A row in that state (a direct database write, an import, a half-finished edit) is reported by the daily audit and then cannot be corrected through the Desk at all: the field will not accept typing and opening the form and saving throws.

Deliberately narrow: the date and the reference number, nothing else. The amount, the mode and whether the order is paid are what was banked — those are mark_payment_received's, and once a receipt is posted they are an accounting correction rather than an edit.

arg type required default description
gunbroker_order string yes — GunBroker Order name.
received_on string yes — The day the money went into the bank. Not in the future.
reference_no string | null no None Cheque or money-order number, when that is the wrong part.

Returns: {ok, received_on, reference_no}.

Permissions: System Manager.

apps/ffl_integrations/ffl_integrations/gunbroker/fulfillment.py:734

dispose_gb_order

POST /api/method/ffl_integrations.gunbroker.fulfillment.dispose_gb_order

Auth (derived from code): Roles: Sales User / Sales Manager / Stock Manager / System Manager

Book the bound-book exit for a paid GunBroker order (the Dispose action).

One submitted "FFL Transfer" disposition per regulated gun, each of which issues its own stock-out and queues its own FastBound push. Idempotent on {serial, gunbroker_order}. An ANTIQUE on the order gets no disposition — it is GCA-exempt, so it is issued straight out of stock instead (_retire_antique_units). Whether a dealer is involved at all is needs_dealer: an order that is all antiques and names no licence ships to the buyer, and that decision is written to ships_direct for the invoice and the card to read. A serialized unit that is neither a regulated firearm nor an antique is refused outright. The revenue invoice is raised at the end and a failure there does not roll back the dispositions — create_gb_invoice_now retries.

arg type required default description
gunbroker_order string yes — GunBroker Order name (must be Pending Fulfillment).
cr_details — no None Staff verification captured in the dispose dialog for a Type 03 (Curio & Relic) order. Dict from Python, JSON string from the browser. Only consulted for a C&R order, and refused on one that is not.
locations — no None Optional {gb_item_id: Storage Location} -- where in the store staff took each item-level line from (see get_dispose_stock_lines). The units leave that location; a line left out goes to the "to confirm" list on the Storage Locations page.

Returns: {ok, dispositions: [names], disposed_count, retired: [antique serials issued out with no disposition], issued: [item-level quantities taken out of stock], sales_invoice, invoice_status}.

Permissions: Counter roles.

apps/ffl_integrations/ffl_integrations/gunbroker/fulfillment.py:1209

enter_gb_tracking

POST /api/method/ffl_integrations.gunbroker.fulfillment.enter_gb_tracking

Auth (derived from code): Roles: Sales User / Sales Manager / Stock Manager / System Manager

Send GunBroker the tracking number of a label bought outside the POS shipment.

For a label bought on an order staff built in ShipStation by hand: the POS's own shipment has no label, so the poll has nothing to find. The number must belong to a live (not voided) ShipStation label — that is still the "a label was bought" fact the write-back waits for — and it is then sent the same way the poll sends one.

arg type required default description
gunbroker_order string yes — GunBroker Order name (disposed, invoice posted).
tracking_number string yes — The tracking number on the label.

Returns: push_tracking's result: {ok, tracking_number, carrier, steps, ...}.

Permissions: Counter roles.

apps/ffl_integrations/ffl_integrations/gunbroker/fulfillment.py:1751

get_dispose_stock_lines

POST /api/method/ffl_integrations.gunbroker.fulfillment.get_dispose_stock_lines

Auth (derived from code): Roles: Sales User / Sales Manager / Stock Manager / System Manager

The loose-stock lines of a GunBroker order and where in the store each can be

taken from, for the "where did these come from?" step of Dispose.

arg type required default description
gunbroker_order string yes — GunBroker Order name.

Returns: [{line, item_code, item_name, qty, locations: [{location, label, qty}], unassigned, chosen}] -- one per item-level line (ammunition, optics, parts). line is the GunBroker item id the dispose call keys its picks by; chosen is the sole place the item can only have come from (exactly one holds it, none is unassigned).

apps/ffl_integrations/ffl_integrations/gunbroker/fulfillment.py:1185

list_pending_gb_orders

POST /api/method/ffl_integrations.gunbroker.fulfillment.list_pending_gb_orders

Auth (derived from code): Roles: Sales User / Sales Manager / Stock Manager / System Manager

Rows for the Pending Order page: GunBroker orders still needing work.

Shaped to match ffl_core.api.manual_order.list_pending_dispositions so the page renders three sources uniformly; these carry source="gunbroker".

An order stays listed until its tracking number has been written back to GunBroker — which is later than a web order leaves, on purpose: the store buys this label, so "disposed" is the middle of the job here, not the end.

Returns: Pending-order cards (source="gunbroker"), shaped like list_pending_dispositions rows.

Permissions: Counter roles.

apps/ffl_integrations/ffl_integrations/gunbroker/fulfillment.py:146

mark_gb_unit_refunded

POST /api/method/ffl_integrations.gunbroker.fulfillment.mark_gb_unit_refunded

Auth (derived from code): Roles: Sales User / Sales Manager / Stock Manager / System Manager

Mark one unit of a model-level order as refunded on GunBroker.

For an oversold order: the buyer paid for N, only N-1 guns exist, and the buyer is refunded for the missing one on GunBroker's side. A unit marked refunded stops counting as a claim, gets no gun, no bound-book entry and no invoice line; the seller fee is still accrued on the whole GunBroker line, because GunBroker does not reduce it for a refund. The invoice then no longer agrees with what GunBroker charged and stays in Draft for a person to check the refund against the statement.

Marking a unit that already has a gun releases the gun (if this order holds it). refunded=0 undoes the mark.

arg type required default description
gunbroker_order string yes — GunBroker Order name (must be Pending Fulfillment).
row_name string yes — The unit, as the card gives it: <gunbroker item id>:<unit number>.
refunded integer no 1 1 to mark (default), 0 to undo.

Returns: {ok, refunded, row: the refreshed Pending Order card}.

Permissions: Counter roles.

apps/ffl_integrations/ffl_integrations/gunbroker/fulfillment.py:1136

mark_payment_received

POST /api/method/ffl_integrations.gunbroker.fulfillment.mark_payment_received

Auth (derived from code): Roles: Sales User / Sales Manager / Stock Manager / System Manager

Record that a GunBroker buyer's payment has been banked.

This is the fact the Dispose gate opens on, and it is deliberately not GunBroker's own "payment received" flag: that flag is a click on their website, and a gun must not leave the building on the strength of it.

No Payment Entry is created here. GunBroker orders are paid before they are invoiced, and the invoice does not exist until the guns are disposed — so there is nothing to book the receipt against yet. The values recorded here are replayed onto a Payment Entry the moment the invoice is raised, against the account of the Mode of Payment recorded.

arg type required default description
gunbroker_order string yes — GunBroker Order name.
mode_of_payment string yes — "GunBroker Check" (also accepted as "Check/Money Order"), "GunBroker Card" (GunBroker's own checkout; refused while no gateway is connected), or a tender the store took directly: "Credit Card" (charged on the Virtual Terminal), "Zelle" or "ACH". Cash is refused: the receipt is dated the day the invoice is raised, so cash would sit in the drawer with nothing on the books for it.
amount number yes — What was actually banked, which is not always what was owed.
reference_no string | null no None Cheque / money-order number, Zelle or ACH confirmation, or card approval code. Required for every mode but GunBroker Card — without it the deposit cannot be traced on a bank statement.
received_on string | null no None The day it went INTO the bank, not the day it arrived in the post. Defaults to today.
replace_posted_receipt integer no 0 Record over an order whose receipt has already been posted. Refused without it, and alerted on with it.

Returns: {ok, mode_of_payment, amount, received_on, difference}.

Permissions: Counter roles.

apps/ffl_integrations/ffl_integrations/gunbroker/fulfillment.py:467

push_gb_shipment

POST /api/method/ffl_integrations.gunbroker.fulfillment.push_gb_shipment

Auth (derived from code): Roles: Sales User / Sales Manager / Stock Manager / System Manager

Push a paid GunBroker order to ShipStation (the Pending Order Ship action).

Same as a counter or web order: Ship does not wait for Dispose. Before Dispose there is no invoice, so the shipment is built off the order itself and its id is kept on the order; revenue copies it onto the invoice when Dispose raises one, which is where the tracking write-back reads it. After Dispose this is the invoice's own push_shipment.

The gates are Dispose's (paid, FFL received, every unit named, no unresolved line) plus a valid destination, so nothing reaches ShipStation that Dispose would then refuse. A C&R licence is only verified in the Dispose dialog, so a C&R order not yet verified must Dispose first. Tracking still goes back to GunBroker only after Dispose.

arg type required default description
gunbroker_order string yes — GunBroker Order name.

Returns: {ok, shipstation_order_id} — plus already: True when it was pushed before.

Permissions: Counter roles.

apps/ffl_integrations/ffl_integrations/gunbroker/fulfillment.py:1802

push_tracking_now

POST /api/method/ffl_integrations.gunbroker.fulfillment.push_tracking_now

Auth (derived from code): Roles: Sales User / Sales Manager / Stock Manager / System Manager

Write this order's tracking number back to GunBroker now.

The scheduled poll does this on its own every ten minutes; this is for the operator who has just bought the label and wants the buyer to see it.

arg type required default description
gunbroker_order string yes — GunBroker Order name (disposed, with a ShipStation shipment against its invoice).

Returns: {ok, tracking_number, carrier, steps} — or {ok: False, reason} when there is no live label yet.

Permissions: Counter roles.

apps/ffl_integrations/ffl_integrations/gunbroker/fulfillment.py:1727

reserved_gb_serials

POST /api/method/ffl_integrations.gunbroker.fulfillment.reserved_gb_serials

Auth (derived from code): Role-filtered: callers without Roles Sales User / Sales Manager / Stock Manager / System Manager receive an EMPTY result instead of an error.

GunBroker hold registry for one Item's serials — the DISPLAY half.

arg type required default description
item_code string yes — Item whose serials to check.

Returns: {serial: {source, ref, kind, tooltip, url}} — only held serials appear. kind is gb_sold for a gun with a GunBroker order against it, or gb_sold_unknown for one the sweep believes was sold there while the order has not arrived yet.

Permissions: Canonical shipping roles, matching the counter and web registries this merges with — it names which regulated serials sit on which order. A caller WITHOUT the role gets an empty {} back silently, so an empty result from THIS function is not proof of "no holds".

apps/ffl_integrations/ffl_integrations/gunbroker/fulfillment.py:55