Lifecycle actions and transactions
What it is
Two families of operator action:
Lifecycle — changes to the supplier’s standing: hidden, suspended, locked, cancelled, written off, deleted, or won back.
Transactions — money and data operations available from the global Actions menu regardless of which tab you are on: earnings and remittance loads, chargebacks, recoveries, receivables, write-offs, statement and payment adjustments, and fund transfer requests.
Both are implemented as dialogs under suppliers/supplier/, each with its own
service, following a shared pattern established by
suppliers/supplier/base-supplier-action/.
Status vocabulary
shared/consts/supplier-status.enum.ts:
export enum SUPPLIER_STATUS {
ACTIVE = 'Active',
PENDING_ACTIVATION = 'Pending Activation',
PENDING = 'Pending',
SUSPENDED = 'Suspended',
}
SupplierStatusModel is a much richer rollup than the supplier record itself, and is
what the header badges read:
| Field | Meaning |
|---|---|
|
|
|
Readiness gates. |
|
Funding-particulars status ( |
|
Amazon Seller Central API health. |
|
Payment-configuration readiness. |
|
Schedule dates. |
|
Whether receivables have been purchased. |
|
Whether an EFS card account exists. |
|
Automatic transfer configuration. |
|
Advance status ( |
SupplierStatusesService maps each status vocabulary to a Bootstrap badge class,
with 'badge badge-light' as the fallback for unknown values. Six dictionaries:
supFundPartStatusDictionary, mpFundPartStatusDictionary,
payConfigStatusDictionary, supplierStatusDictionary,
supplierCancelationStatusDictionary (none / pending / canceled) and
advanceStatusDictionary.
|
These dictionaries are keyed on the backend’s display strings, not codes. A wording change upstream silently degrades every badge to the neutral fallback rather than throwing. |
Lifecycle actions
| Action | Implementation | Notes |
|---|---|---|
Hide / unhide |
|
Hides the supplier from lists. The reducer flips
|
Suspend |
|
Sets status to |
Lock / unlock |
|
Actions and effects exist but the reducer has no cases for them, so lock state only updates on re-fetch. |
Cancel |
|
See below. |
Win back |
|
Re-activates a cancelled supplier. Reasons from |
Write off |
|
Requires |
Request collection |
|
Full CRUD on |
Delete account |
|
See below. |
Change password / reset |
|
Operator-initiated credential reset. |
Cancellation
CancelSupplierService on internalApiUrl:
| Endpoint | Purpose |
|---|---|
|
Which marketplaces are still active — a cancellation precondition check. |
|
Supplier detail including tax id, for the confirmation screen. |
|
The reason list. |
|
Perform the cancellation. |
|
Read the recorded reason. |
|
Amend the reason after the fact. |
cancelationStatus on the details model tracks none / pending / canceled — so
cancellation is a two-stage process, not immediate.
CancelEmitService (its own CancelEmitModule.forRoot(), imported in AppModule) is
a small Subject bus that notifies the workspace when cancellation or win-back state
changes, so panels re-render without a store round trip:
onCancellationChange: Subject<boolean>
onWinbackChange: Subject<void>
editOnCancellationChange: Subject<string>
|
|
Account deletion
DeleteSupplierAccountService, behind the DELETE_SUPPLIER feature flag:
GET supplier/:supplierKey/remove_supplier_account → { can_be_removed, … }
POST supplier/:supplierKey/remove_supplier_account → perform deletion
canBeRemoved() maps can_be_removed and catches errors to false — a failed
precondition check reads as "cannot be removed", which is the safe default.
Note the path segment is singular supplier/, unlike almost every other endpoint
(suppliers/). Easy to mistype.
The Actions menu
The sidebar Actions group is visible only when the layout slice says
actionsVisible (true on supplier pages, not on the list) and the user is not
REST_UW_ACCESS / ADVANCE_AUDITORS. Items:
| Menu item | Folder | What it does |
|---|---|---|
Import ▸ Load Earnings |
|
Starts a marketplace earnings load. Long-running — progress arrives over the
B2B task-manager SSE stream. Can also be triggered by EVA via
|
Import ▸ Load Remittance |
|
Loads the marketplace remittance. Conditionally shown
( |
Add chargeback |
|
Charges a reversal back to the supplier’s balance. |
Add Bad Debt Recovery |
|
Records a recovery against a written-off balance
( |
Add receivable |
|
Adds a receivable to fund against. |
Add writeoff |
|
Recognises an unrecoverable balance. |
Add New Default Contract |
|
Only shown when |
Edit MP Statement |
|
Corrects a marketplace statement
( |
Add MP Payment |
|
Records a marketplace payment ( |
Add Zero MP Payment |
|
Records a zero-value marketplace payment — used to close a period with no payout. |
Adjust Payability Fee |
|
One-off fee adjustment ( |
Add Fund Transfer Request |
|
Requests a fund transfer, which becomes part of a batch — see processes. |
Also present but reached from elsewhere:
add-marketplace-statement/, marketplace-access-details/,
actions-import-menu/, transaction-modal/, kyc-documentation/,
supplier-statements/.
shared/actions-menu/ and shared/actions-add-fabs/ provide the menu and
floating-action-button shells; crm-tools/actions-add-fabs/ is the CRM equivalent.
Related supplier operations
| Operation | Implementation |
|---|---|
Log in as supplier |
|
Log in to Amazon |
|
Referral link |
|
Email preferences |
|
Deal link |
|
Permissions relevant to lifecycle actions
| Permission | Gates |
|---|---|
|
Transaction cancellation. |
|
Fee adjustments. |
|
Marketplace payments. |
|
Receivables. |
|
Payment management. |
|
Write-offs and bad-debt recovery. |
|
Marketplace statement edits. |
|
Amazon-lending loans (enforced by |
|
Supplier credentials. |
|
General update and super-user. |
The client hides UI for these; the backend enforces them. See authorisation and the permission catalogue.
Gotchas
| Issue | Detail |
|---|---|
Optimistic hide, pessimistic suspend |
The hide toggle flips local state on success; suspend and lock do not. Three toggles, three different refresh behaviours. |
|
The action round-trips but the store is not updated. Re-fetch to see the result. |
Singular |
Unlike every neighbouring endpoint. |
|
It does not accept the intended state. |
Status badges key on display strings |
Backend wording changes degrade badges silently. |
Zero MP payment is a real operation |
It is not a no-op guard against mistakes; it records a zero-value payment deliberately. |
Load Earnings/Remittance are asynchronous |
They return before the work completes. Progress comes from the SSE stream — see real-time streams. |