ffl_core.customer_flags¶
Source: apps/ffl_core/ffl_core/customer_flags.py · 7 endpoint(s)
Generated by
make api-docs— do not edit by hand.
apply_id_scan¶
POST /api/method/ffl_core.customer_flags.apply_id_scan
Auth (derived from code): Requires write permission on Customer (Frappe DocType permission check).
Bring an existing customer's ID documents and address up to the ID just scanned.
For a customer who renewed or replaced an ID, or moved. Nothing is written while FFL
Settings → Store Customer ID Numbers is off, for a customer who is not an Individual, or
when the ID is someone else's (unless force): another first + last name, or another
date of birth than the one on file (a parent and child can share a name).
- ID documents: the Driver License row from
idNumber/expiryand the CCW row fromcarryNumber/carryExpiry. A row of that type is updated in place (the one with the same number, else the only one); otherwise a row is added. An expiry the scan does not carry leaves the stored one alone, unless the number changed. - Date of birth and gender: filled when empty, never overwritten.
- Address: when the ID's street and ZIP are not the primary address (an ID whose ZIP did not read changes nothing). An address the customer already has under that street and ZIP becomes the primary one. Otherwise the primary address is changed in place when only this customer uses it; a shared one is left alone and a new primary address is made. The old address goes on the customer's timeline.
| arg | type | required | default | description |
|---|---|---|---|---|
customer |
string | yes | — | Customer name (document id). |
scan |
dict | str | yes | — |
force |
bool | int | str | no |
Returns: {"changed": [str]} naming what was written ("Driver License", "CCW", "Date of Birth", "Gender", "Address"; empty when the record already matched), or {"changed": [], "mismatch": {"on_id": str, "customer": str}} (each a name, with "(born YYYY-MM-DD)" when the dates of birth differ) when the ID is someone else's and nothing was written.
apps/ffl_core/ffl_core/customer_flags.py:276
banned_order_rows¶
POST /api/method/ffl_core.customer_flags.banned_order_rows
Auth (derived from code): Requires read permission on Customer (Frappe DocType permission check).
Which Pending Order rows belong to a Banned customer, for the page's red badge.
A web or GunBroker order is booked to a customer only once it has shipped, so its buyer is looked up the way that booking will: a Woo order by its billing email (customer email, then merged-email alias); a GunBroker order by its linked customer, then the buyer's GunBroker id (field, then alias), then email.
| arg | type | required | default | description |
|---|---|---|---|---|
woo_orders |
list | str | no | None |
gb_orders |
list | str | no | None |
customers |
list | str | no | None |
Returns: {"woo": [names], "gb": [names], "customers": [names]} — only the Banned ones.
apps/ffl_core/ffl_core/customer_flags.py:556
find_customers_by_id_number¶
POST /api/method/ffl_core.customer_flags.find_customers_by_id_number
Auth (derived from code): Requires read permission on Customer (Frappe DocType permission check).
Customers holding this ID number (a licence scanned at the register).
Only while FFL Settings → Store Customer ID Numbers is on (otherwise none are stored, and the answer is an empty list). Compared without case, spaces or dashes.
| arg | type | required | default | description |
|---|---|---|---|---|
id_number |
string | yes | — | The number read from the ID. |
Returns: [{"name", "customer_name", "customer_status"}], at most 5.
apps/ffl_core/ffl_core/customer_flags.py:245
find_customers_by_scan¶
POST /api/method/ffl_core.customer_flags.find_customers_by_scan
Auth (derived from code): Requires read permission on Customer (Frappe DocType permission check).
Customers a scanned licence may belong to (the gunsmith work order's Scan ID): by
its number (only while ID numbers are stored, as :func:find_customers_by_id_number),
then by first + last name. A name match is only a guess, so the caller lets the clerk
pick; a number match is the person.
| arg | type | required | default | description |
|---|---|---|---|---|
first |
string | null | no | None |
First name read from the ID. |
last |
string | null | no | None |
Last name read from the ID. |
id_number |
string | null | no | None |
The licence number read from the ID, if any. |
Returns: [{"name", "customer_name", "customer_status", "address": primary address on one line, "by_id": matched on the ID number}], at most 5.
apps/ffl_core/ffl_core/customer_flags.py:445
find_possible_duplicates¶
POST /api/method/ffl_core.customer_flags.find_possible_duplicates
Auth (derived from code): Requires read permission on Customer (Frappe DocType permission check).
Existing customers a new one may duplicate, for the New Customer dialog.
Matches the customer's email (or an email merged into it), mobile number (last 10 digits) and — while the store keeps ID numbers — an ID number.
| arg | type | required | default | description |
|---|---|---|---|---|
email |
string | null | no | None |
Email typed in the dialog. |
phone |
string | null | no | None |
Mobile number typed in the dialog. |
id_number |
string | null | no | None |
Driver licence number from a scan (ignored when ID numbers are off). |
Returns: [{"name", "customer_name", "customer_status", "matched": ["email" | "phone" | "id_number"]}], at most 5.
apps/ffl_core/ffl_core/customer_flags.py:501
get_customer_flags¶
POST /api/method/ffl_core.customer_flags.get_customer_flags
Auth (derived from code): Requires read permission on Customer (Frappe DocType permission check).
What the counter panel shows when this customer is picked.
| arg | type | required | default | description |
|---|---|---|---|---|
customer |
string | yes | — | Customer name (document id). |
Returns: {"name", "customer_name", "status", "status_reason" (only when not Active), "banned": Banned with no open override, "override_until": end of an open manager override or None, "can_override": whether the caller may override, "alerts": [{"message", "created_by", "created_on"}] (active ones, oldest first), "tags": [str], "family": {"primary": {"name", "customer_name"} or None, "relationship", "members": int}, "ids": [{"id_type", "expiry_date", "expired": bool}] for ID documents expired or expiring within 30 days, "agreements": [{"template", "state", "expires_on", "agreement"}] for each active Agreement Template shown on the counter panel — state is signed, expiring (within 30 days), expired, pending or missing, "membership": the member badge (membership_benefits.membership_badge: {"text", "memberships"}) or None}. Never carries an ID number or date of birth.
apps/ffl_core/ffl_core/customer_flags.py:139
override_customer_ban¶
POST /api/method/ffl_core.customer_flags.override_customer_ban
Auth (derived from code): Roles: Sales Manager / System Manager
Manager lets a Banned customer be served for the next 30 minutes.
Opens the window every counter screen and the server-side sale gate read
(ban_override_until / ban_override_by) and records who and why on the
customer's timeline. The customer stays Banned.
| arg | type | required | default | description |
|---|---|---|---|---|
customer |
string | yes | — | Customer name (document id); must be Banned. |
reason |
string | yes | — | Why the sale is allowed (required, kept on the timeline). |
Returns: {"customer": name, "override_until": the window's end, "by": the manager}.
apps/ffl_core/ffl_core/customer_flags.py:205