Skip to content

Commit

Permalink
Merge pull request #240 from jayjun/2.0-line-item
Browse files Browse the repository at this point in the history
Add invoice line items support
  • Loading branch information
begedin authored Jul 4, 2017
2 parents b3d7f22 + 81ea988 commit 49495f4
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 4 deletions.
7 changes: 3 additions & 4 deletions lib/stripe/invoice.ex
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@ defmodule Stripe.Invoice do
- Retrieve an invoice
- Update an invoice
Does not yet implement `lines`.
Does not yet render lists or take options.
Does not take options yet.
Stripe API reference: https://stripe.com/docs/api#invoice
"""
Expand All @@ -21,7 +19,7 @@ defmodule Stripe.Invoice do
:id, :object,
:amount_due, :application_fee, :attempt_count, :attempted,
:charge, :closed, :currency, :customer, :date, :description, :discount,
:ending_balance, :forgiven, :livemode, :metadata,
:ending_balance, :forgiven, :lines, :livemode, :metadata,
:next_payment_attempt, :paid, :period_end, :period_start,
:receipt_number, :starting_balance, :statement_descriptor,
:subscription, :subscription_proration_date, :subtotal, :tax,
Expand All @@ -45,6 +43,7 @@ defmodule Stripe.Invoice do
ending_balance: [:retrieve],
forgiven: [:retrieve, :update],
id: [:retrieve],
lines: [:retrieve],
livemode: [:retrieve],
metadata: [:create, :retrieve, :update],
next_payment_attempt: [:retrieve],
Expand Down
16 changes: 16 additions & 0 deletions lib/stripe/line_item.ex
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
defmodule Stripe.LineItem do
@moduledoc """
Work with Stripe (invoice) line item objects.
Stripe API reference: https://stripe.com/docs/api/ruby#invoice_line_item_object
"""

@type t :: %__MODULE__{}

defstruct [
:id, :object,
:amount, :currency, :description, :discountable, :livemode, :metadata,
:period, :plan, :proration, :quantity, :subscription, :subscription_item,
:type
]
end
1 change: 1 addition & 0 deletions test/stripe/util_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ defmodule Stripe.UtilTest do
assert object_name_to_module("external_account") == Stripe.ExternalAccount
assert object_name_to_module("file_upload") == Stripe.FileUpload
assert object_name_to_module("invoice") == Stripe.Invoice
assert object_name_to_module("line_item") == Stripe.LineItem
assert object_name_to_module("list") == Stripe.List
assert object_name_to_module("plan") == Stripe.Plan
assert object_name_to_module("refund") == Stripe.Refund
Expand Down

0 comments on commit 49495f4

Please sign in to comment.