mirror of
https://github.com/stripe/stripe-ruby.git
synced 2025-06-01 00:00:30 -04:00
Add billing portal configuration (#965)
This commit is contained in:
parent
512f5464d0
commit
f59ba8cae0
@ -27,6 +27,7 @@ Layout/HeredocIndentation:
|
||||
|
||||
Layout/LineLength:
|
||||
Exclude:
|
||||
- "lib/stripe/object_types.rb"
|
||||
- "lib/stripe/resources/**/*.rb"
|
||||
- "test/**/*.rb"
|
||||
|
||||
|
@ -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:
|
||||
|
@ -19,6 +19,7 @@ module Stripe
|
||||
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,
|
||||
|
@ -9,6 +9,7 @@ require "stripe/resources/application_fee_refund"
|
||||
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"
|
||||
|
14
lib/stripe/resources/billing_portal/configuration.rb
Normal file
14
lib/stripe/resources/billing_portal/configuration.rb
Normal file
@ -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
test/stripe/billing_portal/configuration_test.rb
Normal file
37
test/stripe/billing_portal/configuration_test.rb
Normal file
@ -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
|
@ -16,7 +16,7 @@ require ::File.expand_path("test_data", __dir__)
|
||||
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
|
||||
|
Loading…
x
Reference in New Issue
Block a user