Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add new methods #706

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/stripe_mock/request_handlers/subscriptions.rb
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def create_subscription(route, method_url, params, headers)
customer[:default_source] = new_card[:id]
end

allowed_params = %w(customer application_fee_percent coupon items metadata plan quantity source tax_percent trial_end trial_period_days current_period_start created prorate billing_cycle_anchor billing days_until_due idempotency_key enable_incomplete_payments cancel_at_period_end default_tax_rates payment_behavior pending_invoice_item_interval)
allowed_params = %w(customer application_fee_percent coupon items metadata plan quantity source tax_percent trial_end trial_period_days current_period_start created prorate billing_cycle_anchor billing days_until_due idempotency_key enable_incomplete_payments cancel_at_period_end default_tax_rates payment_behavior pending_invoice_item_interval default_payment_method expand)
unknown_params = params.keys - allowed_params.map(&:to_sym)
if unknown_params.length > 0
raise Stripe::InvalidRequestError.new("Received unknown parameter: #{unknown_params.join}", unknown_params.first.to_s, http_status: 400)
Expand Down
11 changes: 11 additions & 0 deletions lib/stripe_mock/test_strategies/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,17 @@ def create_plan_params(params={})
}.merge(params)
end

def create_payment_method(params={})
Stripe::PaymentMethod.create(params)
end

def create_customer(params={})
Stripe::Customer.create(params)
end

def create_subscription(params={})
Stripe::Subscription.create(params)
end

def list_subscriptions(limit)
Stripe::Subscription.list(limit: limit)
Expand Down