Options
All
  • Public
  • Public/Protected
  • All
Menu

Namespace Backend

Index

Functions

  • createSSOURL(options: Options): string
  • getNextTransactionDateConstraints(data: Pick<Core.Resource<Backend.Rels.Subscription, undefined>, "start_date" | "next_transaction_date" | "end_date" | "frequency" | "error_message" | "past_due_amount" | "first_failed_transaction_date" | "is_active" | "third_party_id" | "date_created" | "date_modified">, rules: boolean | { allowedDays?: { days: number[]; type: "day" } | { days: number[]; type: "month" }; disallowedDates?: string[]; jsonataQuery: string; max?: string; min?: string }[]): Constraints | boolean
  • Finds which next transaction date modification rules are applicable to the given subscription and merges them together.

    Parameters

    • data: Pick<Core.Resource<Backend.Rels.Subscription, undefined>, "start_date" | "next_transaction_date" | "end_date" | "frequency" | "error_message" | "past_due_amount" | "first_failed_transaction_date" | "is_active" | "third_party_id" | "date_created" | "date_modified">

      Subscription to generate constraints for.

    • rules: boolean | { allowedDays?: { days: number[]; type: "day" } | { days: number[]; type: "month" }; disallowedDates?: string[]; jsonataQuery: string; max?: string; min?: string }[]

      Next date modification config from the customer portal settings.

    Returns Constraints | boolean

    Returns true if all modifications are allowed, false if next date can't be changed by the customer, object with constraints in any other case.

  • getTimeFromFrequency(frequency: string): number
  • Gives a rough estimate for a number of milliseconds in the given frequency.

    IMPORTANT: this function SHOULD NOT be used to calculate precise dates as it doesn't account for leap years, months of variable length, etc. It works best for broad estimates and comparing frequencies.

    throws

    InvalidFrequencyError when provided with unsupported frequency.

    Parameters

    • frequency: string

      Frequency as positive integer + units (y, m, w, d for years, months, weeks and days respectively). You can use .5m for twice a month. Example: 1m (1 month), 4y (4 years).

    Returns number

    Estimated number of milliseconds in the given frequency.

  • isNextTransactionDate(opts: Options): boolean
  • Checks if given date (YYYY-MM-DD) can be used as the next transaction date for given subscription.

    Parameters

    • opts: Options

      Subscription, customer portal settings and value.

    Returns boolean

    True if given date can be used as next transaction date.

  • verifyWebhookSignature(webhook: Webhook): boolean
  • Verifies that the webhook your app has received was indeed sent from our servers. See our wiki for more info.

    Parameters

    • webhook: Webhook

      info received with the webhook that needs validation

    Returns boolean

    True if this webhook has a valid signature.

Generated using TypeDoc