mirror of
https://github.com/stripe/stripe-ruby.git
synced 2025-08-19 00:01:04 -04:00
Merge pull request #97 from surfacedamage/customer-create-upcoming-invoice
Allow creation of new Invoice off Customer
This commit is contained in:
commit
ff7595c006
@ -25,6 +25,10 @@ module Stripe
|
||||
Charge.all({ :customer => id }, @api_key)
|
||||
end
|
||||
|
||||
def create_upcoming_invoice(params={})
|
||||
Invoice.create(params.merge(:customer => id), @api_key)
|
||||
end
|
||||
|
||||
def cancel_subscription(params={})
|
||||
response, api_key = Stripe.request(:delete, subscription_url, @api_key, params)
|
||||
refresh_from({ :subscription => response }, api_key, true)
|
||||
|
@ -32,6 +32,12 @@ module Stripe
|
||||
assert_equal "c_test_customer", c.id
|
||||
end
|
||||
|
||||
should "create_upcoming_invoice should create a new invoice" do
|
||||
@mock.expects(:post).once.returns(test_response(test_invoice))
|
||||
i = Stripe::Customer.new("test_customer").create_upcoming_invoice
|
||||
assert_equal "c_test_customer", i.customer
|
||||
end
|
||||
|
||||
should "be able to update a customer's subscription" do
|
||||
@mock.expects(:get).once.returns(test_response(test_customer))
|
||||
c = Stripe::Customer.retrieve("test_customer")
|
||||
|
@ -8,6 +8,12 @@ module Stripe
|
||||
assert_equal 'in_test_invoice', i.id
|
||||
end
|
||||
|
||||
should "create should create a new invoice" do
|
||||
@mock.expects(:post).once.returns(test_response(test_invoice))
|
||||
i = Stripe::Invoice.create
|
||||
assert_equal "in_test_invoice", i.id
|
||||
end
|
||||
|
||||
should "pay should pay an invoice" do
|
||||
@mock.expects(:get).once.returns(test_response(test_invoice))
|
||||
i = Stripe::Invoice.retrieve('in_test_invoice')
|
||||
@ -17,4 +23,4 @@ module Stripe
|
||||
assert_equal i.next_payment_attempt, nil
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user