Advance Line

The Advance Line is a revolving facility. A supplier draws against a credit limit and repays automatically out of marketplace receipts.

State

Two slices, both registered by AdvanceLineFeatureModule.

advanceLine

Summary — the current facility. Actions loadSummary, loadSummarySuccess, loadSummaryFailure, advanceLineWithdrawSuccess.

advanceLineOffers

Draw offers and their terms. Actions loadOffers, loadOffersSuccess, loadOffersFailure, clearOffers, withdrawOffer.

The authoritative product state also lives on the user object as status.advanceLine (AdvanceLineStatusDto):

Field Meaning

currentAmount

Credit currently available to draw.

outstandingAmount

Amount drawn and not yet repaid.

expirationDate

When the facility lapses.

status

AdvanceLineStatusEnum — Active, Pending, …

uwStatus

AdvanceLineUWStatusEnum — Approved, Rejected, Pending.

type

AdvanceLineModeEnum — Legacy or the modern Advance Line.

Legacy versus modern

calculateAdvanceLinePermissionsFromUser() returns an empty array when there is no advanceLine or when advanceLine.type === AdvanceLineModeEnum.Legacy. A legacy supplier gets no Advance Line permissions at all — their product surface is Instant Advance, and INSTANT_ADVANCE_REPORT_WIDGET is granted precisely because their Advance Line is legacy.

Permissions

Permission (dotted name) Condition

ADVANCE_LINE.VIEW_ADVANCE_LINE_WIDGET

Active, or pending-and-expedited, or expired

ADVANCE_LINE.ADVANCE_LINE_EXPIRED

Expired and not active and not rejected

ADVANCE_LINE.ADVANCE_LINE_REJECTED

uwStatus === Rejected or (expired and active)

ADVANCE_LINE.ADVANCE_LINE_PENDING_ACTIVATION

Supplier pending and advanceLine.status === Pending and schema === Expedited

ADVANCE_LINE.WITHDRAW_ADVANCE_LINE

outstandingAmount > 0 and supplierStatus !== Suspended

ADVANCE_LINE.VIEW_ADVANCE_LINE_REPORT

currentAmount > 0

Expiry is evaluated client-side: new Date() > new Date(advanceLine.expirationDate).

ADVANCE_LINE_REJECTED is also granted when the line is expired and still active — a state that means the facility lapsed without renewal, which the UI presents the same way as a rejection.

Withdrawal

AdvanceLineWithdrawFlow (core/pyb/flows/advance-line/advance-line-withdraw.flow.ts) composes the journey with the tasks engine.

taskFlow
    .setContextData('data', this.prepareFlowContextData())
    .addTask(this.openAdvanceLineInputModalTask,        this.defaultHandler)
    .addTask(this.openAdvanceLineConfirmationModalTask, this.defaultHandler);

if (!status.instantAdvanceSigned || this.userService.isAprUserContract()) {
    taskFlow.addTask(this.docusignAdvanceLineTask);                    (1)
} else {
    taskFlow
        .addTask(this.withdrawAdvanceLineTask, this.defaultHandler)    (2)
        .addTask(this.updateUserStatusTask,    this.defaultHandler)
        .addTask(this.openAdvanceLineSuccessModalTask);
}
1 Not yet signed, or on an APR contract → the supplier must sign. The flow ends here because the browser leaves for DocuSign; it resumes on return.
2 Already signed and not APR → withdraw inline, refresh status, show the success modal without leaving the app.

Flow context is seeded with:

{
    advanceLine,                                 // the facility
    id,                                          // supplier key
    autodebitPmtCfg,                             // repayment configuration
    docuSignNoteVisible: !instantAdvanceSigned,  // show the "you'll be asked to sign" note
}

The DocuSign branch

DocusignFlowEnum.AdvanceLineActive, handled on return by DocusignVerificationService.handleAdvanceLineFlow():

clearDashboardNotifications()
confirmAdvanceLineDocuSignRequest(supplierKey, { event }, isAprUserContract())
track(AdvanceLineEventTypes.DOCUSIGN_VERIFIED)
advanceLineService.withdraw(supplierKey, advanceLineKey, amount, offerType)
  → fetchSupplierMarketplaces()
  → loadBalance()
  → loadSummary()
  → advanceLineWithdrawSuccess()
  → userStatusUpdateRequested()
  → track(AdvanceLineEventTypes.FUNDS_WITHDRAWN, { offerType, amount })
  → success modal: FEATURES.ADVANCE_LINE.MODALS.SUCCESS.HEADER / .BODY

Offer acceptance

AdvanceLineAcceptOfferFlow handles a supplier accepting a new offer, using:

StartAdvanceLineAcceptOfferFlowTask

Entry point.

OpenAdvanceDetailsModalTask

Present the terms.

AcceptAdvanceLineTask

Accept via the API.

DirectAcceptAdvanceLineTask

Accept without the intermediate confirmation.

Tracked with:

AdvanceLineEventTypes.OFFER_ACCEPTED

AdvanceLineOfferAccepted

AdvanceLineEventTypes.OFFER_DECLINED

AdvanceLineOfferDeclined

AdvanceLineEventTypes.OFFER_SAVED_FOR_LATER

AdvanceLineOfferSavedForLater

If a Long Term Contract offer is available at acceptance time, the LTC options modal is inserted into the journey — see Long Term Contract.

Pending activation (expedited)

AdvanceLinePendingActivationFlow covers an expedited supplier’s first interaction. The DocuSign flow is DocusignFlowEnum.AdvanceLinePending, which confirms the ACH agreement rather than the advance contract, and the handler branches on whether an amount was supplied:

Amount present

Confirm ACH, revoke ADVANCE_LINE.ADVANCE_LINE_PENDING_ACTIVATION, then withdraw.

Amount absent

Confirm ACH, revoke the permission, dispatch userStatusUpdateRequested().

The permission is revoked client-side immediately so the widget leaves its "pending activation" state before the status round-trip completes.

Legacy activation

AdvanceLineLegacyActivationFlow handles activation for suppliers still on the legacy advance product.

UI surface

Component Role

advance-line-widget

Dashboard card — available credit, outstanding balance, draw CTA.

advance-line-open-advances

Open drawdowns.

advance-line-past-advances

Historical drawdowns.

advance-rate-widget

The supplier’s advance rate.

advance-line-description

Formatted terms block.

modals/advance-line/

Input, confirmation and success dialogs.

AdvanceLineTooltipTextService

Builds the contextual tooltip copy shown on the widget.

Reporting lives at /reports/instant-advance-report and /reports/outstanding-balance; see Reports.

Analytics

Constant Segment event Properties

OFFER_ACCEPTED

AdvanceLineOfferAccepted

—

OFFER_DECLINED

AdvanceLineOfferDeclined

—

OFFER_SAVED_FOR_LATER

AdvanceLineOfferSavedForLater

—

DOCUSIGN_VERIFIED

AdvanceLineDocusignVerified

—

FUNDS_WITHDRAWN

AdvanceLineFundsWithdrawn

{ offerType, amount }

ADVANCE_REPORT_LINK

ClickedOnAdvanceReportLink

—