code_corps v0.0.1 CodeCorps.StripeService.StripeConnectSubscriptionService View Source

Used to perform actions on StripeConnectSubscription records while propagating to and from associated Stripe.Subscription records.

Link to this section Summary

Functions

Finds or creates a new Stripe.Subscription record on Stripe API, as well as an associated local StripeConnectSubscription record

Updates an existing StripeConnectSubscription record by retrieving a Stripe.Subscription record and using that data as update parameters

Link to this section Functions

Link to this function find_or_create(attributes) View Source
find_or_create(map()) ::
  {:ok, CodeCorps.StripeConnectSubscription.t()} |
  {:error, Ecto.Changeset.t()} |
  {:error, Stripe.Error.t()} |
  {:error, :project_not_found} |
  {:error, :project_not_ready} |
  {:error, :user_not_found} |
  {:error, :user_not_ready}

Finds or creates a new Stripe.Subscription record on Stripe API, as well as an associated local StripeConnectSubscription record

Side effects

  • If the subscription is created or found, associated project totals will get updated
  • If the subscription is created or found, associated donation goal states will be updated
Link to this function update_from_stripe(stripe_id, connect_customer_id) View Source
update_from_stripe(String.t(), String.t()) ::
  {:ok, CodeCorps.StripeConnectSubscription.t()} |
  {:error, Stripe.Error.t()} |
  {:error, :not_found}

Updates an existing StripeConnectSubscription record by retrieving a Stripe.Subscription record and using that data as update parameters