diff --git a/spec/controllers/admin/stripe_accounts_controller_spec.rb b/spec/controllers/admin/stripe_accounts_controller_spec.rb index b5b0683c73..3fa3c09052 100644 --- a/spec/controllers/admin/stripe_accounts_controller_spec.rb +++ b/spec/controllers/admin/stripe_accounts_controller_spec.rb @@ -5,12 +5,11 @@ require 'spec_helper' describe Admin::StripeAccountsController, type: :controller do let(:enterprise) { create(:distributor_enterprise) } - before do - Stripe.client_id = "some_id" - end - describe "#connect" do + let(:client_id) { ENV.fetch('STRIPE_CLIENT_ID', nil) } + before do + Stripe.client_id = client_id allow(controller).to receive(:spree_current_user) { enterprise.owner } end @@ -21,12 +20,12 @@ describe Admin::StripeAccountsController, type: :controller do expect(response).to redirect_to("https://connect.stripe.com/oauth/authorize?" \ "state=eyJhbGciOiJIUzI1NiJ9.eyJlbnRlcnByaXNlX2lkIjoiMSJ9" \ ".jSSFGn0bLhwuiQYK5ORmHWW7aay1l030bcfGwn1JbFg&" \ - "scope=read_write&client_id=some_id&response_type=code") + "scope=read_write&client_id=#{client_id}&response_type=code") end end describe "#destroy" do - let(:params) { { format: :json, id: "some_id" } } + let(:params) { { format: :json, id: "client_id" } } context "when the specified stripe account doesn't exist" do it "raises an error?" do @@ -34,8 +33,18 @@ describe Admin::StripeAccountsController, type: :controller do end end - context "when the specified stripe account exists" do - let(:stripe_account) { create(:stripe_account, enterprise:) } + context "when the specified stripe account exists", :vcr, :stripe_version do + let(:connected_account) do + Stripe::Account.create({ + type: 'standard', + country: 'AU', + email: 'jumping.jack@example.com', + business_type: "non_profit" + }) + end + let(:stripe_account) { + create(:stripe_account, enterprise:, stripe_user_id: connected_account.id) + } before do # So that we can stub #deauthorize_and_destroy @@ -83,11 +92,6 @@ describe Admin::StripeAccountsController, type: :controller do describe "#status" do let(:params) { { format: :json, enterprise_id: enterprise.id } } - before do - Stripe.api_key = "sk_test_12345" - allow(Spree::Config).to receive(:stripe_connect_enabled).and_return(false) - end - context "when I don't manage the specified enterprise" do let(:user) { create(:user) } @@ -125,45 +129,44 @@ describe Admin::StripeAccountsController, type: :controller do end end - context "when a stripe account is associated with the specified enterprise" do + context "when a stripe account is associated with the specified enterprise", :vcr, + :stripe_version do + let(:connected_account) do + Stripe::Account.create({ + type: 'standard', + country: 'AU', + email: 'jumping.jack@example.com', + business_type: "non_profit" + }) + end let!(:account) { - create(:stripe_account, stripe_user_id: "acc_123", enterprise:) + create(:stripe_account, stripe_user_id: connected_account.id, enterprise:) } context "but access has been revoked or does not exist on stripe's servers" do + let(:message) { + "The provided key 'sk_test_******************************uCJm' " \ + "does not have access to account 'acct_fake_account' (or that account " \ + "does not exist). Application access may have been revoked." + } before do - stub_request(:get, - "https://api.stripe.com/v1/accounts/acc_123").to_return(status: 404) + account.update(stripe_user_id: "acct_fake_account") end it "returns with a status of 'access_revoked'" do - get(:status, params:) - json_response = JSON.parse(response.body) - expect(json_response["status"]).to eq "access_revoked" + expect { + response = get(:status, params:) + }.to raise_error Stripe::PermissionError, message end end context "which is connected" do - let(:stripe_account_mock) do - { - id: "acc_123", - business_name: "My Org", - charges_enabled: true, - some_other_attr: "something" - } - end - - before do - stub_request(:get, "https://api.stripe.com/v1/accounts/acc_123") - .to_return(body: JSON.generate(stripe_account_mock)) - end - it "returns with a status of 'connected'" do - get(:status, params:) + response = get(:status, params:) json_response = JSON.parse(response.body) expect(json_response["status"]).to eq "connected" # serializes required attrs - expect(json_response["business_name"]).to eq "My Org" + expect(json_response["charges_enabled"]).to eq false # ignores other attrs expect(json_response["some_other_attr"]).to be nil end diff --git a/spec/fixtures/vcr_cassettes/Stripe-v10.10.0/Admin_StripeAccountsController/_destroy/when_the_specified_stripe_account_exists/when_I_don_t_manage_the_enterprise_linked_to_the_stripe_account/redirects_to_unauthorized.yml b/spec/fixtures/vcr_cassettes/Stripe-v10.10.0/Admin_StripeAccountsController/_destroy/when_the_specified_stripe_account_exists/when_I_don_t_manage_the_enterprise_linked_to_the_stripe_account/redirects_to_unauthorized.yml new file mode 100644 index 0000000000..625086f75b --- /dev/null +++ b/spec/fixtures/vcr_cassettes/Stripe-v10.10.0/Admin_StripeAccountsController/_destroy/when_the_specified_stripe_account_exists/when_I_don_t_manage_the_enterprise_linked_to_the_stripe_account/redirects_to_unauthorized.yml @@ -0,0 +1,233 @@ +--- +http_interactions: +- request: + method: post + uri: https://api.stripe.com/v1/accounts + body: + encoding: UTF-8 + string: type=standard&country=AU&email=jumping.jack%40example.com&business_type=non_profit + headers: + User-Agent: + - Stripe/v1 RubyBindings/10.10.0 + Authorization: + - Bearer + Content-Type: + - application/x-www-form-urlencoded + Stripe-Version: + - '2023-10-16' + X-Stripe-Client-User-Agent: + - '{"bindings_version":"10.10.0","lang":"ruby","lang_version":"3.1.4 p223 (2023-03-30)","platform":"x86_64-linux","engine":"ruby","publisher":"stripe","uname":"Linux + version 6.5.0-25-generic (buildd@bos03-amd64-044) (x86_64-linux-gnu-gcc-12 + (Ubuntu 12.3.0-1ubuntu1~22.04) 12.3.0, GNU ld (GNU Binutils for Ubuntu) 2.38) + #25~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Tue Feb 20 16:09:15 UTC 2","hostname":"ff-LAT"}' + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + response: + status: + code: 200 + message: OK + headers: + Server: + - nginx + Date: + - Sun, 17 Mar 2024 13:21:06 GMT + Content-Type: + - application/json + Content-Length: + - '3527' + Connection: + - keep-alive + Access-Control-Allow-Credentials: + - 'true' + Access-Control-Allow-Methods: + - GET,HEAD,PUT,PATCH,POST,DELETE + Access-Control-Allow-Origin: + - "*" + Access-Control-Expose-Headers: + - Request-Id, Stripe-Manage-Version, Stripe-Should-Retry, X-Stripe-External-Auth-Required, + X-Stripe-Privileged-Session-Required + Access-Control-Max-Age: + - '300' + Cache-Control: + - no-cache, no-store + Content-Security-Policy: + - report-uri https://q.stripe.com/csp-report?p=v1%2Faccounts; block-all-mixed-content; + default-src 'none'; base-uri 'none'; form-action 'none'; frame-ancestors 'none'; + img-src 'self'; script-src 'self' 'report-sample'; style-src 'self' + Cross-Origin-Opener-Policy-Report-Only: + - same-origin; report-to=https://q.stripe.com/coop-report + Idempotency-Key: + - 153e797a-47b7-4f48-a0f8-cd8c39bf619d + Original-Request: + - req_zfQDRPw4pwuL9V + Request-Id: + - req_zfQDRPw4pwuL9V + Stripe-Should-Retry: + - 'false' + Stripe-Version: + - '2023-10-16' + Vary: + - Origin + X-Stripe-Routing-Context-Priority-Tier: + - api-testmode + Strict-Transport-Security: + - max-age=63072000; includeSubDomains; preload + body: + encoding: UTF-8 + string: |- + { + "id": "acct_1OvJe8QKz09hVwk6", + "object": "account", + "business_profile": { + "annual_revenue": null, + "estimated_worker_count": null, + "mcc": null, + "name": null, + "product_description": null, + "support_address": null, + "support_email": null, + "support_phone": null, + "support_url": null, + "url": null + }, + "business_type": "non_profit", + "capabilities": {}, + "charges_enabled": false, + "company": { + "address": { + "city": null, + "country": "AU", + "line1": null, + "line2": null, + "postal_code": null, + "state": null + }, + "directors_provided": false, + "executives_provided": false, + "name": null, + "owners_provided": false, + "tax_id_provided": false, + "verification": { + "document": { + "back": null, + "details": null, + "details_code": null, + "front": null + } + } + }, + "controller": { + "is_controller": true, + "type": "application" + }, + "country": "AU", + "created": 1710681665, + "default_currency": "aud", + "details_submitted": false, + "email": "jumping.jack@example.com", + "external_accounts": { + "object": "list", + "data": [], + "has_more": false, + "total_count": 0, + "url": "/v1/accounts/acct_1OvJe8QKz09hVwk6/external_accounts" + }, + "future_requirements": { + "alternatives": [], + "current_deadline": null, + "currently_due": [], + "disabled_reason": null, + "errors": [], + "eventually_due": [], + "past_due": [], + "pending_verification": [] + }, + "metadata": {}, + "payouts_enabled": false, + "requirements": { + "alternatives": [], + "current_deadline": null, + "currently_due": [ + "business_profile.product_description", + "business_profile.support_phone", + "business_profile.url", + "external_account", + "tos_acceptance.date", + "tos_acceptance.ip" + ], + "disabled_reason": "requirements.past_due", + "errors": [], + "eventually_due": [ + "business_profile.product_description", + "business_profile.support_phone", + "business_profile.url", + "external_account", + "tos_acceptance.date", + "tos_acceptance.ip" + ], + "past_due": [ + "external_account", + "tos_acceptance.date", + "tos_acceptance.ip" + ], + "pending_verification": [] + }, + "settings": { + "bacs_debit_payments": { + "display_name": null, + "service_user_number": null + }, + "branding": { + "icon": null, + "logo": null, + "primary_color": null, + "secondary_color": null + }, + "card_issuing": { + "tos_acceptance": { + "date": null, + "ip": null + } + }, + "card_payments": { + "decline_on": { + "avs_failure": false, + "cvc_failure": false + }, + "statement_descriptor_prefix": null, + "statement_descriptor_prefix_kana": null, + "statement_descriptor_prefix_kanji": null + }, + "dashboard": { + "display_name": null, + "timezone": "Etc/UTC" + }, + "invoices": { + "default_account_tax_ids": null + }, + "payments": { + "statement_descriptor": null, + "statement_descriptor_kana": null, + "statement_descriptor_kanji": null + }, + "payouts": { + "debit_negative_balances": true, + "schedule": { + "delay_days": 2, + "interval": "daily" + }, + "statement_descriptor": null + }, + "sepa_debit_payments": {} + }, + "tos_acceptance": { + "date": null, + "ip": null, + "user_agent": null + }, + "type": "standard" + } + recorded_at: Sun, 17 Mar 2024 13:21:06 GMT +recorded_with: VCR 6.2.0 diff --git a/spec/fixtures/vcr_cassettes/Stripe-v10.10.0/Admin_StripeAccountsController/_destroy/when_the_specified_stripe_account_exists/when_I_manage_the_enterprise_linked_to_the_stripe_account/and_the_attempt_to_deauthorize_and_destroy_fails/redirects_to_unauthorized.yml b/spec/fixtures/vcr_cassettes/Stripe-v10.10.0/Admin_StripeAccountsController/_destroy/when_the_specified_stripe_account_exists/when_I_manage_the_enterprise_linked_to_the_stripe_account/and_the_attempt_to_deauthorize_and_destroy_fails/redirects_to_unauthorized.yml new file mode 100644 index 0000000000..a05bd4b392 --- /dev/null +++ b/spec/fixtures/vcr_cassettes/Stripe-v10.10.0/Admin_StripeAccountsController/_destroy/when_the_specified_stripe_account_exists/when_I_manage_the_enterprise_linked_to_the_stripe_account/and_the_attempt_to_deauthorize_and_destroy_fails/redirects_to_unauthorized.yml @@ -0,0 +1,235 @@ +--- +http_interactions: +- request: + method: post + uri: https://api.stripe.com/v1/accounts + body: + encoding: UTF-8 + string: type=standard&country=AU&email=jumping.jack%40example.com&business_type=non_profit + headers: + User-Agent: + - Stripe/v1 RubyBindings/10.10.0 + Authorization: + - Bearer + Content-Type: + - application/x-www-form-urlencoded + X-Stripe-Client-Telemetry: + - '{"last_request_metrics":{"request_id":"req_Kn4sy7JqIW8lyd","request_duration_ms":1966}}' + Stripe-Version: + - '2023-10-16' + X-Stripe-Client-User-Agent: + - '{"bindings_version":"10.10.0","lang":"ruby","lang_version":"3.1.4 p223 (2023-03-30)","platform":"x86_64-linux","engine":"ruby","publisher":"stripe","uname":"Linux + version 6.5.0-25-generic (buildd@bos03-amd64-044) (x86_64-linux-gnu-gcc-12 + (Ubuntu 12.3.0-1ubuntu1~22.04) 12.3.0, GNU ld (GNU Binutils for Ubuntu) 2.38) + #25~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Tue Feb 20 16:09:15 UTC 2","hostname":"ff-LAT"}' + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + response: + status: + code: 200 + message: OK + headers: + Server: + - nginx + Date: + - Sun, 17 Mar 2024 13:21:10 GMT + Content-Type: + - application/json + Content-Length: + - '3527' + Connection: + - keep-alive + Access-Control-Allow-Credentials: + - 'true' + Access-Control-Allow-Methods: + - GET,HEAD,PUT,PATCH,POST,DELETE + Access-Control-Allow-Origin: + - "*" + Access-Control-Expose-Headers: + - Request-Id, Stripe-Manage-Version, Stripe-Should-Retry, X-Stripe-External-Auth-Required, + X-Stripe-Privileged-Session-Required + Access-Control-Max-Age: + - '300' + Cache-Control: + - no-cache, no-store + Content-Security-Policy: + - report-uri https://q.stripe.com/csp-report?p=v1%2Faccounts; block-all-mixed-content; + default-src 'none'; base-uri 'none'; form-action 'none'; frame-ancestors 'none'; + img-src 'self'; script-src 'self' 'report-sample'; style-src 'self' + Cross-Origin-Opener-Policy-Report-Only: + - same-origin; report-to=https://q.stripe.com/coop-report + Idempotency-Key: + - 465ce517-9c88-45fc-a4ae-ec6fea3ed101 + Original-Request: + - req_a6vV2cQ3GJ5sRJ + Request-Id: + - req_a6vV2cQ3GJ5sRJ + Stripe-Should-Retry: + - 'false' + Stripe-Version: + - '2023-10-16' + Vary: + - Origin + X-Stripe-Routing-Context-Priority-Tier: + - api-testmode + Strict-Transport-Security: + - max-age=63072000; includeSubDomains; preload + body: + encoding: UTF-8 + string: |- + { + "id": "acct_1OvJeD4GSYqMqmpR", + "object": "account", + "business_profile": { + "annual_revenue": null, + "estimated_worker_count": null, + "mcc": null, + "name": null, + "product_description": null, + "support_address": null, + "support_email": null, + "support_phone": null, + "support_url": null, + "url": null + }, + "business_type": "non_profit", + "capabilities": {}, + "charges_enabled": false, + "company": { + "address": { + "city": null, + "country": "AU", + "line1": null, + "line2": null, + "postal_code": null, + "state": null + }, + "directors_provided": false, + "executives_provided": false, + "name": null, + "owners_provided": false, + "tax_id_provided": false, + "verification": { + "document": { + "back": null, + "details": null, + "details_code": null, + "front": null + } + } + }, + "controller": { + "is_controller": true, + "type": "application" + }, + "country": "AU", + "created": 1710681669, + "default_currency": "aud", + "details_submitted": false, + "email": "jumping.jack@example.com", + "external_accounts": { + "object": "list", + "data": [], + "has_more": false, + "total_count": 0, + "url": "/v1/accounts/acct_1OvJeD4GSYqMqmpR/external_accounts" + }, + "future_requirements": { + "alternatives": [], + "current_deadline": null, + "currently_due": [], + "disabled_reason": null, + "errors": [], + "eventually_due": [], + "past_due": [], + "pending_verification": [] + }, + "metadata": {}, + "payouts_enabled": false, + "requirements": { + "alternatives": [], + "current_deadline": null, + "currently_due": [ + "business_profile.product_description", + "business_profile.support_phone", + "business_profile.url", + "external_account", + "tos_acceptance.date", + "tos_acceptance.ip" + ], + "disabled_reason": "requirements.past_due", + "errors": [], + "eventually_due": [ + "business_profile.product_description", + "business_profile.support_phone", + "business_profile.url", + "external_account", + "tos_acceptance.date", + "tos_acceptance.ip" + ], + "past_due": [ + "external_account", + "tos_acceptance.date", + "tos_acceptance.ip" + ], + "pending_verification": [] + }, + "settings": { + "bacs_debit_payments": { + "display_name": null, + "service_user_number": null + }, + "branding": { + "icon": null, + "logo": null, + "primary_color": null, + "secondary_color": null + }, + "card_issuing": { + "tos_acceptance": { + "date": null, + "ip": null + } + }, + "card_payments": { + "decline_on": { + "avs_failure": false, + "cvc_failure": false + }, + "statement_descriptor_prefix": null, + "statement_descriptor_prefix_kana": null, + "statement_descriptor_prefix_kanji": null + }, + "dashboard": { + "display_name": null, + "timezone": "Etc/UTC" + }, + "invoices": { + "default_account_tax_ids": null + }, + "payments": { + "statement_descriptor": null, + "statement_descriptor_kana": null, + "statement_descriptor_kanji": null + }, + "payouts": { + "debit_negative_balances": true, + "schedule": { + "delay_days": 2, + "interval": "daily" + }, + "statement_descriptor": null + }, + "sepa_debit_payments": {} + }, + "tos_acceptance": { + "date": null, + "ip": null, + "user_agent": null + }, + "type": "standard" + } + recorded_at: Sun, 17 Mar 2024 13:21:10 GMT +recorded_with: VCR 6.2.0 diff --git a/spec/fixtures/vcr_cassettes/Stripe-v10.10.0/Admin_StripeAccountsController/_destroy/when_the_specified_stripe_account_exists/when_I_manage_the_enterprise_linked_to_the_stripe_account/and_the_attempt_to_deauthorize_and_destroy_succeeds/redirects_to_unauthorized.yml b/spec/fixtures/vcr_cassettes/Stripe-v10.10.0/Admin_StripeAccountsController/_destroy/when_the_specified_stripe_account_exists/when_I_manage_the_enterprise_linked_to_the_stripe_account/and_the_attempt_to_deauthorize_and_destroy_succeeds/redirects_to_unauthorized.yml new file mode 100644 index 0000000000..5f96625e42 --- /dev/null +++ b/spec/fixtures/vcr_cassettes/Stripe-v10.10.0/Admin_StripeAccountsController/_destroy/when_the_specified_stripe_account_exists/when_I_manage_the_enterprise_linked_to_the_stripe_account/and_the_attempt_to_deauthorize_and_destroy_succeeds/redirects_to_unauthorized.yml @@ -0,0 +1,235 @@ +--- +http_interactions: +- request: + method: post + uri: https://api.stripe.com/v1/accounts + body: + encoding: UTF-8 + string: type=standard&country=AU&email=jumping.jack%40example.com&business_type=non_profit + headers: + User-Agent: + - Stripe/v1 RubyBindings/10.10.0 + Authorization: + - Bearer + Content-Type: + - application/x-www-form-urlencoded + X-Stripe-Client-Telemetry: + - '{"last_request_metrics":{"request_id":"req_zfQDRPw4pwuL9V","request_duration_ms":2003}}' + Stripe-Version: + - '2023-10-16' + X-Stripe-Client-User-Agent: + - '{"bindings_version":"10.10.0","lang":"ruby","lang_version":"3.1.4 p223 (2023-03-30)","platform":"x86_64-linux","engine":"ruby","publisher":"stripe","uname":"Linux + version 6.5.0-25-generic (buildd@bos03-amd64-044) (x86_64-linux-gnu-gcc-12 + (Ubuntu 12.3.0-1ubuntu1~22.04) 12.3.0, GNU ld (GNU Binutils for Ubuntu) 2.38) + #25~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Tue Feb 20 16:09:15 UTC 2","hostname":"ff-LAT"}' + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + response: + status: + code: 200 + message: OK + headers: + Server: + - nginx + Date: + - Sun, 17 Mar 2024 13:21:08 GMT + Content-Type: + - application/json + Content-Length: + - '3527' + Connection: + - keep-alive + Access-Control-Allow-Credentials: + - 'true' + Access-Control-Allow-Methods: + - GET,HEAD,PUT,PATCH,POST,DELETE + Access-Control-Allow-Origin: + - "*" + Access-Control-Expose-Headers: + - Request-Id, Stripe-Manage-Version, Stripe-Should-Retry, X-Stripe-External-Auth-Required, + X-Stripe-Privileged-Session-Required + Access-Control-Max-Age: + - '300' + Cache-Control: + - no-cache, no-store + Content-Security-Policy: + - report-uri https://q.stripe.com/csp-report?p=v1%2Faccounts; block-all-mixed-content; + default-src 'none'; base-uri 'none'; form-action 'none'; frame-ancestors 'none'; + img-src 'self'; script-src 'self' 'report-sample'; style-src 'self' + Cross-Origin-Opener-Policy-Report-Only: + - same-origin; report-to=https://q.stripe.com/coop-report + Idempotency-Key: + - b4d7d361-5bba-4806-a9bd-7eaec4dbc361 + Original-Request: + - req_Kn4sy7JqIW8lyd + Request-Id: + - req_Kn4sy7JqIW8lyd + Stripe-Should-Retry: + - 'false' + Stripe-Version: + - '2023-10-16' + Vary: + - Origin + X-Stripe-Routing-Context-Priority-Tier: + - api-testmode + Strict-Transport-Security: + - max-age=63072000; includeSubDomains; preload + body: + encoding: UTF-8 + string: |- + { + "id": "acct_1OvJeA4Dl7fsDvNo", + "object": "account", + "business_profile": { + "annual_revenue": null, + "estimated_worker_count": null, + "mcc": null, + "name": null, + "product_description": null, + "support_address": null, + "support_email": null, + "support_phone": null, + "support_url": null, + "url": null + }, + "business_type": "non_profit", + "capabilities": {}, + "charges_enabled": false, + "company": { + "address": { + "city": null, + "country": "AU", + "line1": null, + "line2": null, + "postal_code": null, + "state": null + }, + "directors_provided": false, + "executives_provided": false, + "name": null, + "owners_provided": false, + "tax_id_provided": false, + "verification": { + "document": { + "back": null, + "details": null, + "details_code": null, + "front": null + } + } + }, + "controller": { + "is_controller": true, + "type": "application" + }, + "country": "AU", + "created": 1710681667, + "default_currency": "aud", + "details_submitted": false, + "email": "jumping.jack@example.com", + "external_accounts": { + "object": "list", + "data": [], + "has_more": false, + "total_count": 0, + "url": "/v1/accounts/acct_1OvJeA4Dl7fsDvNo/external_accounts" + }, + "future_requirements": { + "alternatives": [], + "current_deadline": null, + "currently_due": [], + "disabled_reason": null, + "errors": [], + "eventually_due": [], + "past_due": [], + "pending_verification": [] + }, + "metadata": {}, + "payouts_enabled": false, + "requirements": { + "alternatives": [], + "current_deadline": null, + "currently_due": [ + "business_profile.product_description", + "business_profile.support_phone", + "business_profile.url", + "external_account", + "tos_acceptance.date", + "tos_acceptance.ip" + ], + "disabled_reason": "requirements.past_due", + "errors": [], + "eventually_due": [ + "business_profile.product_description", + "business_profile.support_phone", + "business_profile.url", + "external_account", + "tos_acceptance.date", + "tos_acceptance.ip" + ], + "past_due": [ + "external_account", + "tos_acceptance.date", + "tos_acceptance.ip" + ], + "pending_verification": [] + }, + "settings": { + "bacs_debit_payments": { + "display_name": null, + "service_user_number": null + }, + "branding": { + "icon": null, + "logo": null, + "primary_color": null, + "secondary_color": null + }, + "card_issuing": { + "tos_acceptance": { + "date": null, + "ip": null + } + }, + "card_payments": { + "decline_on": { + "avs_failure": false, + "cvc_failure": false + }, + "statement_descriptor_prefix": null, + "statement_descriptor_prefix_kana": null, + "statement_descriptor_prefix_kanji": null + }, + "dashboard": { + "display_name": null, + "timezone": "Etc/UTC" + }, + "invoices": { + "default_account_tax_ids": null + }, + "payments": { + "statement_descriptor": null, + "statement_descriptor_kana": null, + "statement_descriptor_kanji": null + }, + "payouts": { + "debit_negative_balances": true, + "schedule": { + "delay_days": 2, + "interval": "daily" + }, + "statement_descriptor": null + }, + "sepa_debit_payments": {} + }, + "tos_acceptance": { + "date": null, + "ip": null, + "user_agent": null + }, + "type": "standard" + } + recorded_at: Sun, 17 Mar 2024 13:21:08 GMT +recorded_with: VCR 6.2.0 diff --git a/spec/fixtures/vcr_cassettes/Stripe-v10.10.0/Admin_StripeAccountsController/_status/when_I_manage_the_specified_enterprise/when_Stripe_is_enabled/when_a_stripe_account_is_associated_with_the_specified_enterprise/but_access_has_been_revoked_or_does_not_exist_on_stripe_s_servers/returns_with_a_status_of_access_revoked_.yml b/spec/fixtures/vcr_cassettes/Stripe-v10.10.0/Admin_StripeAccountsController/_status/when_I_manage_the_specified_enterprise/when_Stripe_is_enabled/when_a_stripe_account_is_associated_with_the_specified_enterprise/but_access_has_been_revoked_or_does_not_exist_on_stripe_s_servers/returns_with_a_status_of_access_revoked_.yml new file mode 100644 index 0000000000..1463e89343 --- /dev/null +++ b/spec/fixtures/vcr_cassettes/Stripe-v10.10.0/Admin_StripeAccountsController/_status/when_I_manage_the_specified_enterprise/when_Stripe_is_enabled/when_a_stripe_account_is_associated_with_the_specified_enterprise/but_access_has_been_revoked_or_does_not_exist_on_stripe_s_servers/returns_with_a_status_of_access_revoked_.yml @@ -0,0 +1,305 @@ +--- +http_interactions: +- request: + method: post + uri: https://api.stripe.com/v1/accounts + body: + encoding: UTF-8 + string: type=standard&country=AU&email=jumping.jack%40example.com&business_type=non_profit + headers: + User-Agent: + - Stripe/v1 RubyBindings/10.10.0 + Authorization: + - Bearer + Content-Type: + - application/x-www-form-urlencoded + X-Stripe-Client-Telemetry: + - '{"last_request_metrics":{"request_id":"req_a6vV2cQ3GJ5sRJ","request_duration_ms":1938}}' + Stripe-Version: + - '2023-10-16' + X-Stripe-Client-User-Agent: + - '{"bindings_version":"10.10.0","lang":"ruby","lang_version":"3.1.4 p223 (2023-03-30)","platform":"x86_64-linux","engine":"ruby","publisher":"stripe","uname":"Linux + version 6.5.0-25-generic (buildd@bos03-amd64-044) (x86_64-linux-gnu-gcc-12 + (Ubuntu 12.3.0-1ubuntu1~22.04) 12.3.0, GNU ld (GNU Binutils for Ubuntu) 2.38) + #25~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Tue Feb 20 16:09:15 UTC 2","hostname":"ff-LAT"}' + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + response: + status: + code: 200 + message: OK + headers: + Server: + - nginx + Date: + - Sun, 17 Mar 2024 13:21:12 GMT + Content-Type: + - application/json + Content-Length: + - '3527' + Connection: + - keep-alive + Access-Control-Allow-Credentials: + - 'true' + Access-Control-Allow-Methods: + - GET,HEAD,PUT,PATCH,POST,DELETE + Access-Control-Allow-Origin: + - "*" + Access-Control-Expose-Headers: + - Request-Id, Stripe-Manage-Version, Stripe-Should-Retry, X-Stripe-External-Auth-Required, + X-Stripe-Privileged-Session-Required + Access-Control-Max-Age: + - '300' + Cache-Control: + - no-cache, no-store + Content-Security-Policy: + - report-uri https://q.stripe.com/csp-report?p=v1%2Faccounts; block-all-mixed-content; + default-src 'none'; base-uri 'none'; form-action 'none'; frame-ancestors 'none'; + img-src 'self'; script-src 'self' 'report-sample'; style-src 'self' + Cross-Origin-Opener-Policy-Report-Only: + - same-origin; report-to=https://q.stripe.com/coop-report + Idempotency-Key: + - ca4e3616-46a9-4695-9ff9-a64dd1bb7b00 + Original-Request: + - req_21vo6s5eLQyzPx + Request-Id: + - req_21vo6s5eLQyzPx + Stripe-Should-Retry: + - 'false' + Stripe-Version: + - '2023-10-16' + Vary: + - Origin + X-Stripe-Routing-Context-Priority-Tier: + - api-testmode + Strict-Transport-Security: + - max-age=63072000; includeSubDomains; preload + body: + encoding: UTF-8 + string: |- + { + "id": "acct_1OvJeFQRrcL6OxB4", + "object": "account", + "business_profile": { + "annual_revenue": null, + "estimated_worker_count": null, + "mcc": null, + "name": null, + "product_description": null, + "support_address": null, + "support_email": null, + "support_phone": null, + "support_url": null, + "url": null + }, + "business_type": "non_profit", + "capabilities": {}, + "charges_enabled": false, + "company": { + "address": { + "city": null, + "country": "AU", + "line1": null, + "line2": null, + "postal_code": null, + "state": null + }, + "directors_provided": false, + "executives_provided": false, + "name": null, + "owners_provided": false, + "tax_id_provided": false, + "verification": { + "document": { + "back": null, + "details": null, + "details_code": null, + "front": null + } + } + }, + "controller": { + "is_controller": true, + "type": "application" + }, + "country": "AU", + "created": 1710681672, + "default_currency": "aud", + "details_submitted": false, + "email": "jumping.jack@example.com", + "external_accounts": { + "object": "list", + "data": [], + "has_more": false, + "total_count": 0, + "url": "/v1/accounts/acct_1OvJeFQRrcL6OxB4/external_accounts" + }, + "future_requirements": { + "alternatives": [], + "current_deadline": null, + "currently_due": [], + "disabled_reason": null, + "errors": [], + "eventually_due": [], + "past_due": [], + "pending_verification": [] + }, + "metadata": {}, + "payouts_enabled": false, + "requirements": { + "alternatives": [], + "current_deadline": null, + "currently_due": [ + "business_profile.product_description", + "business_profile.support_phone", + "business_profile.url", + "external_account", + "tos_acceptance.date", + "tos_acceptance.ip" + ], + "disabled_reason": "requirements.past_due", + "errors": [], + "eventually_due": [ + "business_profile.product_description", + "business_profile.support_phone", + "business_profile.url", + "external_account", + "tos_acceptance.date", + "tos_acceptance.ip" + ], + "past_due": [ + "external_account", + "tos_acceptance.date", + "tos_acceptance.ip" + ], + "pending_verification": [] + }, + "settings": { + "bacs_debit_payments": { + "display_name": null, + "service_user_number": null + }, + "branding": { + "icon": null, + "logo": null, + "primary_color": null, + "secondary_color": null + }, + "card_issuing": { + "tos_acceptance": { + "date": null, + "ip": null + } + }, + "card_payments": { + "decline_on": { + "avs_failure": false, + "cvc_failure": false + }, + "statement_descriptor_prefix": null, + "statement_descriptor_prefix_kana": null, + "statement_descriptor_prefix_kanji": null + }, + "dashboard": { + "display_name": null, + "timezone": "Etc/UTC" + }, + "invoices": { + "default_account_tax_ids": null + }, + "payments": { + "statement_descriptor": null, + "statement_descriptor_kana": null, + "statement_descriptor_kanji": null + }, + "payouts": { + "debit_negative_balances": true, + "schedule": { + "delay_days": 2, + "interval": "daily" + }, + "statement_descriptor": null + }, + "sepa_debit_payments": {} + }, + "tos_acceptance": { + "date": null, + "ip": null, + "user_agent": null + }, + "type": "standard" + } + recorded_at: Sun, 17 Mar 2024 13:21:12 GMT +- request: + method: get + uri: https://api.stripe.com/v1/accounts/acct_fake_account + body: + encoding: US-ASCII + string: '' + headers: + User-Agent: + - Stripe/v1 RubyBindings/10.10.0 + Authorization: + - Bearer + Content-Type: + - application/x-www-form-urlencoded + X-Stripe-Client-Telemetry: + - '{"last_request_metrics":{"request_id":"req_21vo6s5eLQyzPx","request_duration_ms":1718}}' + Stripe-Version: + - '2023-10-16' + X-Stripe-Client-User-Agent: + - '{"bindings_version":"10.10.0","lang":"ruby","lang_version":"3.1.4 p223 (2023-03-30)","platform":"x86_64-linux","engine":"ruby","publisher":"stripe","uname":"Linux + version 6.5.0-25-generic (buildd@bos03-amd64-044) (x86_64-linux-gnu-gcc-12 + (Ubuntu 12.3.0-1ubuntu1~22.04) 12.3.0, GNU ld (GNU Binutils for Ubuntu) 2.38) + #25~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Tue Feb 20 16:09:15 UTC 2","hostname":"ff-LAT"}' + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + response: + status: + code: 403 + message: Forbidden + headers: + Server: + - nginx + Date: + - Sun, 17 Mar 2024 13:21:13 GMT + Content-Type: + - application/json + Content-Length: + - '366' + Connection: + - keep-alive + Access-Control-Allow-Credentials: + - 'true' + Access-Control-Allow-Methods: + - GET,HEAD,PUT,PATCH,POST,DELETE + Access-Control-Allow-Origin: + - "*" + Access-Control-Expose-Headers: + - Request-Id, Stripe-Manage-Version, Stripe-Should-Retry, X-Stripe-External-Auth-Required, + X-Stripe-Privileged-Session-Required + Access-Control-Max-Age: + - '300' + Cache-Control: + - no-cache, no-store + Vary: + - Origin + Strict-Transport-Security: + - max-age=63072000; includeSubDomains; preload + body: + encoding: UTF-8 + string: | + { + "error": { + "message": "The provided key 'sk_test_******************************uCJm' does not have access to account 'acct_fake_account' (or that account does not exist). Application access may have been revoked.", + "type": "invalid_request_error", + "code": "account_invalid", + "doc_url": "https://stripe.com/docs/error-codes/account-invalid" + } + } + recorded_at: Sun, 17 Mar 2024 13:21:13 GMT +recorded_with: VCR 6.2.0 diff --git a/spec/fixtures/vcr_cassettes/Stripe-v10.10.0/Admin_StripeAccountsController/_status/when_I_manage_the_specified_enterprise/when_Stripe_is_enabled/when_a_stripe_account_is_associated_with_the_specified_enterprise/which_is_connected/returns_with_a_status_of_connected_.yml b/spec/fixtures/vcr_cassettes/Stripe-v10.10.0/Admin_StripeAccountsController/_status/when_I_manage_the_specified_enterprise/when_Stripe_is_enabled/when_a_stripe_account_is_associated_with_the_specified_enterprise/which_is_connected/returns_with_a_status_of_connected_.yml new file mode 100644 index 0000000000..74d438448a --- /dev/null +++ b/spec/fixtures/vcr_cassettes/Stripe-v10.10.0/Admin_StripeAccountsController/_status/when_I_manage_the_specified_enterprise/when_Stripe_is_enabled/when_a_stripe_account_is_associated_with_the_specified_enterprise/which_is_connected/returns_with_a_status_of_connected_.yml @@ -0,0 +1,463 @@ +--- +http_interactions: +- request: + method: post + uri: https://api.stripe.com/v1/accounts + body: + encoding: UTF-8 + string: type=standard&country=AU&email=jumping.jack%40example.com&business_type=non_profit + headers: + User-Agent: + - Stripe/v1 RubyBindings/10.10.0 + Authorization: + - Bearer + Content-Type: + - application/x-www-form-urlencoded + X-Stripe-Client-Telemetry: + - '{"last_request_metrics":{"request_id":"req_21vo6s5eLQyzPx","request_duration_ms":1718}}' + Stripe-Version: + - '2023-10-16' + X-Stripe-Client-User-Agent: + - '{"bindings_version":"10.10.0","lang":"ruby","lang_version":"3.1.4 p223 (2023-03-30)","platform":"x86_64-linux","engine":"ruby","publisher":"stripe","uname":"Linux + version 6.5.0-25-generic (buildd@bos03-amd64-044) (x86_64-linux-gnu-gcc-12 + (Ubuntu 12.3.0-1ubuntu1~22.04) 12.3.0, GNU ld (GNU Binutils for Ubuntu) 2.38) + #25~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Tue Feb 20 16:09:15 UTC 2","hostname":"ff-LAT"}' + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + response: + status: + code: 200 + message: OK + headers: + Server: + - nginx + Date: + - Sun, 17 Mar 2024 13:21:14 GMT + Content-Type: + - application/json + Content-Length: + - '3527' + Connection: + - keep-alive + Access-Control-Allow-Credentials: + - 'true' + Access-Control-Allow-Methods: + - GET,HEAD,PUT,PATCH,POST,DELETE + Access-Control-Allow-Origin: + - "*" + Access-Control-Expose-Headers: + - Request-Id, Stripe-Manage-Version, Stripe-Should-Retry, X-Stripe-External-Auth-Required, + X-Stripe-Privileged-Session-Required + Access-Control-Max-Age: + - '300' + Cache-Control: + - no-cache, no-store + Content-Security-Policy: + - report-uri https://q.stripe.com/csp-report?p=v1%2Faccounts; block-all-mixed-content; + default-src 'none'; base-uri 'none'; form-action 'none'; frame-ancestors 'none'; + img-src 'self'; script-src 'self' 'report-sample'; style-src 'self' + Cross-Origin-Opener-Policy-Report-Only: + - same-origin; report-to=https://q.stripe.com/coop-report + Idempotency-Key: + - c54432df-9b07-4311-9e9d-4189cd6c9d0e + Original-Request: + - req_xTmV2oAzhyhwYD + Request-Id: + - req_xTmV2oAzhyhwYD + Stripe-Should-Retry: + - 'false' + Stripe-Version: + - '2023-10-16' + Vary: + - Origin + X-Stripe-Routing-Context-Priority-Tier: + - api-testmode + Strict-Transport-Security: + - max-age=63072000; includeSubDomains; preload + body: + encoding: UTF-8 + string: |- + { + "id": "acct_1OvJeHQMadqd9TMZ", + "object": "account", + "business_profile": { + "annual_revenue": null, + "estimated_worker_count": null, + "mcc": null, + "name": null, + "product_description": null, + "support_address": null, + "support_email": null, + "support_phone": null, + "support_url": null, + "url": null + }, + "business_type": "non_profit", + "capabilities": {}, + "charges_enabled": false, + "company": { + "address": { + "city": null, + "country": "AU", + "line1": null, + "line2": null, + "postal_code": null, + "state": null + }, + "directors_provided": false, + "executives_provided": false, + "name": null, + "owners_provided": false, + "tax_id_provided": false, + "verification": { + "document": { + "back": null, + "details": null, + "details_code": null, + "front": null + } + } + }, + "controller": { + "is_controller": true, + "type": "application" + }, + "country": "AU", + "created": 1710681674, + "default_currency": "aud", + "details_submitted": false, + "email": "jumping.jack@example.com", + "external_accounts": { + "object": "list", + "data": [], + "has_more": false, + "total_count": 0, + "url": "/v1/accounts/acct_1OvJeHQMadqd9TMZ/external_accounts" + }, + "future_requirements": { + "alternatives": [], + "current_deadline": null, + "currently_due": [], + "disabled_reason": null, + "errors": [], + "eventually_due": [], + "past_due": [], + "pending_verification": [] + }, + "metadata": {}, + "payouts_enabled": false, + "requirements": { + "alternatives": [], + "current_deadline": null, + "currently_due": [ + "business_profile.product_description", + "business_profile.support_phone", + "business_profile.url", + "external_account", + "tos_acceptance.date", + "tos_acceptance.ip" + ], + "disabled_reason": "requirements.past_due", + "errors": [], + "eventually_due": [ + "business_profile.product_description", + "business_profile.support_phone", + "business_profile.url", + "external_account", + "tos_acceptance.date", + "tos_acceptance.ip" + ], + "past_due": [ + "external_account", + "tos_acceptance.date", + "tos_acceptance.ip" + ], + "pending_verification": [] + }, + "settings": { + "bacs_debit_payments": { + "display_name": null, + "service_user_number": null + }, + "branding": { + "icon": null, + "logo": null, + "primary_color": null, + "secondary_color": null + }, + "card_issuing": { + "tos_acceptance": { + "date": null, + "ip": null + } + }, + "card_payments": { + "decline_on": { + "avs_failure": false, + "cvc_failure": false + }, + "statement_descriptor_prefix": null, + "statement_descriptor_prefix_kana": null, + "statement_descriptor_prefix_kanji": null + }, + "dashboard": { + "display_name": null, + "timezone": "Etc/UTC" + }, + "invoices": { + "default_account_tax_ids": null + }, + "payments": { + "statement_descriptor": null, + "statement_descriptor_kana": null, + "statement_descriptor_kanji": null + }, + "payouts": { + "debit_negative_balances": true, + "schedule": { + "delay_days": 2, + "interval": "daily" + }, + "statement_descriptor": null + }, + "sepa_debit_payments": {} + }, + "tos_acceptance": { + "date": null, + "ip": null, + "user_agent": null + }, + "type": "standard" + } + recorded_at: Sun, 17 Mar 2024 13:21:15 GMT +- request: + method: get + uri: https://api.stripe.com/v1/accounts/acct_1OvJeHQMadqd9TMZ + body: + encoding: US-ASCII + string: '' + headers: + User-Agent: + - Stripe/v1 RubyBindings/10.10.0 + Authorization: + - Bearer + Content-Type: + - application/x-www-form-urlencoded + X-Stripe-Client-Telemetry: + - '{"last_request_metrics":{"request_id":"req_xTmV2oAzhyhwYD","request_duration_ms":1850}}' + Stripe-Version: + - '2023-10-16' + X-Stripe-Client-User-Agent: + - '{"bindings_version":"10.10.0","lang":"ruby","lang_version":"3.1.4 p223 (2023-03-30)","platform":"x86_64-linux","engine":"ruby","publisher":"stripe","uname":"Linux + version 6.5.0-25-generic (buildd@bos03-amd64-044) (x86_64-linux-gnu-gcc-12 + (Ubuntu 12.3.0-1ubuntu1~22.04) 12.3.0, GNU ld (GNU Binutils for Ubuntu) 2.38) + #25~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Tue Feb 20 16:09:15 UTC 2","hostname":"ff-LAT"}' + Accept-Encoding: + - gzip;q=1.0,deflate;q=0.6,identity;q=0.3 + Accept: + - "*/*" + response: + status: + code: 200 + message: OK + headers: + Server: + - nginx + Date: + - Sun, 17 Mar 2024 13:21:15 GMT + Content-Type: + - application/json + Content-Length: + - '3527' + Connection: + - keep-alive + Access-Control-Allow-Credentials: + - 'true' + Access-Control-Allow-Methods: + - GET,HEAD,PUT,PATCH,POST,DELETE + Access-Control-Allow-Origin: + - "*" + Access-Control-Expose-Headers: + - Request-Id, Stripe-Manage-Version, Stripe-Should-Retry, X-Stripe-External-Auth-Required, + X-Stripe-Privileged-Session-Required + Access-Control-Max-Age: + - '300' + Cache-Control: + - no-cache, no-store + Content-Security-Policy: + - report-uri https://q.stripe.com/csp-report?p=v1%2Faccounts%2F%3Aaccount; block-all-mixed-content; + default-src 'none'; base-uri 'none'; form-action 'none'; frame-ancestors 'none'; + img-src 'self'; script-src 'self' 'report-sample'; style-src 'self' + Cross-Origin-Opener-Policy-Report-Only: + - same-origin; report-to=https://q.stripe.com/coop-report + Request-Id: + - req_jC41Ef46bi6BFZ + Stripe-Account: + - acct_1OvJeHQMadqd9TMZ + Stripe-Version: + - '2023-10-16' + Vary: + - Origin + X-Stripe-Routing-Context-Priority-Tier: + - api-testmode + Strict-Transport-Security: + - max-age=63072000; includeSubDomains; preload + body: + encoding: UTF-8 + string: |- + { + "id": "acct_1OvJeHQMadqd9TMZ", + "object": "account", + "business_profile": { + "annual_revenue": null, + "estimated_worker_count": null, + "mcc": null, + "name": null, + "product_description": null, + "support_address": null, + "support_email": null, + "support_phone": null, + "support_url": null, + "url": null + }, + "business_type": "non_profit", + "capabilities": {}, + "charges_enabled": false, + "company": { + "address": { + "city": null, + "country": "AU", + "line1": null, + "line2": null, + "postal_code": null, + "state": null + }, + "directors_provided": false, + "executives_provided": false, + "name": null, + "owners_provided": false, + "tax_id_provided": false, + "verification": { + "document": { + "back": null, + "details": null, + "details_code": null, + "front": null + } + } + }, + "controller": { + "is_controller": true, + "type": "application" + }, + "country": "AU", + "created": 1710681674, + "default_currency": "aud", + "details_submitted": false, + "email": "jumping.jack@example.com", + "external_accounts": { + "object": "list", + "data": [], + "has_more": false, + "total_count": 0, + "url": "/v1/accounts/acct_1OvJeHQMadqd9TMZ/external_accounts" + }, + "future_requirements": { + "alternatives": [], + "current_deadline": null, + "currently_due": [], + "disabled_reason": null, + "errors": [], + "eventually_due": [], + "past_due": [], + "pending_verification": [] + }, + "metadata": {}, + "payouts_enabled": false, + "requirements": { + "alternatives": [], + "current_deadline": null, + "currently_due": [ + "business_profile.product_description", + "business_profile.support_phone", + "business_profile.url", + "external_account", + "tos_acceptance.date", + "tos_acceptance.ip" + ], + "disabled_reason": "requirements.past_due", + "errors": [], + "eventually_due": [ + "business_profile.product_description", + "business_profile.support_phone", + "business_profile.url", + "external_account", + "tos_acceptance.date", + "tos_acceptance.ip" + ], + "past_due": [ + "external_account", + "tos_acceptance.date", + "tos_acceptance.ip" + ], + "pending_verification": [] + }, + "settings": { + "bacs_debit_payments": { + "display_name": null, + "service_user_number": null + }, + "branding": { + "icon": null, + "logo": null, + "primary_color": null, + "secondary_color": null + }, + "card_issuing": { + "tos_acceptance": { + "date": null, + "ip": null + } + }, + "card_payments": { + "decline_on": { + "avs_failure": false, + "cvc_failure": false + }, + "statement_descriptor_prefix": null, + "statement_descriptor_prefix_kana": null, + "statement_descriptor_prefix_kanji": null + }, + "dashboard": { + "display_name": null, + "timezone": "Etc/UTC" + }, + "invoices": { + "default_account_tax_ids": null + }, + "payments": { + "statement_descriptor": null, + "statement_descriptor_kana": null, + "statement_descriptor_kanji": null + }, + "payouts": { + "debit_negative_balances": true, + "schedule": { + "delay_days": 2, + "interval": "daily" + }, + "statement_descriptor": null + }, + "sepa_debit_payments": {} + }, + "tos_acceptance": { + "date": null, + "ip": null, + "user_agent": null + }, + "type": "standard" + } + recorded_at: Sun, 17 Mar 2024 13:21:15 GMT +recorded_with: VCR 6.2.0