View Source Money.Subscription.Change (Money v5.17.0)

Defines the structure of a plan changeset.

  • :first_interval_starts which is the start date of the first interval for the new plan

  • :first_billing_amount is the amount to be billed, net of any credit, at the :first_interval_starts

  • :next_interval_starts is the start date of the next interval after the first interval including anycredit_days_applied*:credit_amountis the amount of unconsumed credit of the current plan *:credit_amount_appliedis the amount of credit applied to the new plan. If the:prorateoption is:price(the default) the:first_billing_amountis the plan:pricereduced by the:credit_amount_applied. If the:prorateoption is:periodthen the:first_billing_amountis the planprice and the :next_interval_date is extended by the :credit_days_applied instead.

  • :credit_days_applied is the number of days credit applied to the first interval by adding days to the :first_interval_starts date.

  • :credit_period_ends is the date on which any applied credit is consumed or nil

  • :carry_forward is any amount of credit carried forward to a subsequent period. If non-zero this amount is a negative Money.t. It is non-zero when the credit amount for the current plan is greater than the price of the new plan. In this case the :first_billing_amount is zero.

Summary

Types

t()

A plan change record struct.

Functions

A struct defining the changes between two plans.

Types

@type t() :: %Money.Subscription.Change{
  carry_forward: Money.t(),
  credit_amount: Money.t(),
  credit_amount_applied: Money.t(),
  credit_days_applied: non_neg_integer(),
  credit_period_ends: Date.t(),
  first_billing_amount: Money.t(),
  first_interval_starts: Date.t(),
  next_interval_starts: Date.t()
}

A plan change record struct.

Functions

Link to this function

%Money.Subscription.Change{}

View Source (struct)

A struct defining the changes between two plans.