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 billing portal configuration #965

Merged
merged 4 commits into from Feb 20, 2021
Merged
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
1 change: 1 addition & 0 deletions .rubocop.yml
Expand Up @@ -27,6 +27,7 @@ Layout/HeredocIndentation:

Layout/LineLength:
Exclude:
- "lib/stripe/object_types.rb"
- "lib/stripe/resources/**/*.rb"
- "test/**/*.rb"

Expand Down
2 changes: 1 addition & 1 deletion .travis.yml
Expand Up @@ -15,7 +15,7 @@ notifications:
env:
global:
# If changing this number, please also change it in `test/test_helper.rb`.
- STRIPE_MOCK_VERSION=0.101.0
- STRIPE_MOCK_VERSION=0.103.0

cache:
directories:
Expand Down
1 change: 1 addition & 0 deletions lib/stripe/object_types.rb
Expand Up @@ -19,6 +19,7 @@ def self.object_names_to_classes
Balance::OBJECT_NAME => Balance,
BalanceTransaction::OBJECT_NAME => BalanceTransaction,
BankAccount::OBJECT_NAME => BankAccount,
BillingPortal::Configuration::OBJECT_NAME => BillingPortal::Configuration,
BillingPortal::Session::OBJECT_NAME => BillingPortal::Session,
BitcoinReceiver::OBJECT_NAME => BitcoinReceiver,
BitcoinTransaction::OBJECT_NAME => BitcoinTransaction,
Expand Down
1 change: 1 addition & 0 deletions lib/stripe/resources.rb
Expand Up @@ -9,6 +9,7 @@
require "stripe/resources/balance"
require "stripe/resources/balance_transaction"
require "stripe/resources/bank_account"
require "stripe/resources/billing_portal/configuration"
require "stripe/resources/billing_portal/session"
require "stripe/resources/bitcoin_receiver"
require "stripe/resources/bitcoin_transaction"
Expand Down
14 changes: 14 additions & 0 deletions lib/stripe/resources/billing_portal/configuration.rb
@@ -0,0 +1,14 @@
# File generated from our OpenAPI spec
# frozen_string_literal: true

module Stripe
module BillingPortal
class Configuration < APIResource
extend Stripe::APIOperations::Create
extend Stripe::APIOperations::List
include Stripe::APIOperations::Save

OBJECT_NAME = "billing_portal.configuration"
end
end
end
37 changes: 37 additions & 0 deletions test/stripe/billing_portal/configuration_test.rb
@@ -0,0 +1,37 @@
# frozen_string_literal: true

require ::File.expand_path("../../test_helper", __dir__)

module Stripe
module BillingPortal
class ConfigurationTest < Test::Unit::TestCase
should "be creatable" do
session = Stripe::BillingPortal::Configuration.create({
business_profile: {
privacy_policy_url: "https://example.com/privacy",
terms_of_service_url: "https://example.com/tos",
},
features: { customer_update: { allowed_updates: ["address"], enabled: true } },
})
assert_requested :post, "#{Stripe.api_base}/v1/billing_portal/configurations"
assert session.is_a?(Stripe::BillingPortal::Configuration)
end
should "be retrievable" do
session = Stripe::BillingPortal::Configuration.retrieve("bpc_xyz")
assert_requested :get, "#{Stripe.api_base}/v1/billing_portal/configurations/bpc_xyz"
assert session.is_a?(Stripe::BillingPortal::Configuration)
end

should "be updateable" do
session = Stripe::BillingPortal::Configuration.update("bpc_xyz", { active: false })
assert_requested :post, "#{Stripe.api_base}/v1/billing_portal/configurations/bpc_xyz"
assert session.is_a?(Stripe::BillingPortal::Configuration)
end
should "be listable" do
sessions = Stripe::BillingPortal::Configuration.list
assert_requested :get, "#{Stripe.api_base}/v1/billing_portal/configurations"
assert sessions.data[0].is_a?(Stripe::BillingPortal::Configuration)
end
end
end
end
2 changes: 1 addition & 1 deletion test/test_helper.rb
Expand Up @@ -16,7 +16,7 @@
require ::File.expand_path("stripe_mock", __dir__)

# If changing this number, please also change it in `.travis.yml`.
MOCK_MINIMUM_VERSION = "0.101.0"
MOCK_MINIMUM_VERSION = "0.103.0"
MOCK_PORT = Stripe::StripeMock.start

# Disable all real network connections except those that are outgoing to
Expand Down