From 0d483882de92522ff498910bdf2aec62036ccbc4 Mon Sep 17 00:00:00 2001 From: Rob Harrington Date: Mon, 16 Oct 2017 10:34:50 +1100 Subject: [PATCH] Update helper messages in Stripe Connect config UI --- .../admin/stripe_connect_settings_controller.rb | 4 ++-- app/views/admin/stripe_connect_settings/edit.html.haml | 4 +--- config/locales/en.yml | 3 +-- .../admin/stripe_connect_settings_controller_spec.rb | 8 ++++---- 4 files changed, 8 insertions(+), 11 deletions(-) diff --git a/app/controllers/admin/stripe_connect_settings_controller.rb b/app/controllers/admin/stripe_connect_settings_controller.rb index b4ab06d3b3..ad7892d8aa 100644 --- a/app/controllers/admin/stripe_connect_settings_controller.rb +++ b/app/controllers/admin/stripe_connect_settings_controller.rb @@ -7,12 +7,12 @@ module Admin before_filter :load_settings, only: [:edit] def edit - return @stripe_account = { status: :empty_api_key } if Stripe.api_key.blank? + return @stripe_account = { status: :empty_api_key_error_html } if Stripe.api_key.blank? attrs = %i[id business_name charges_enabled] @obfuscated_secret_key = obfuscated_secret_key @stripe_account = Stripe::Account.retrieve.to_hash.slice(*attrs).merge(status: :ok) rescue Stripe::AuthenticationError - @stripe_account = { status: :auth_fail } + @stripe_account = { status: :auth_fail_error } end def update diff --git a/app/views/admin/stripe_connect_settings/edit.html.haml b/app/views/admin/stripe_connect_settings/edit.html.haml index 43d90b4574..37fdd2e846 100644 --- a/app/views/admin/stripe_connect_settings/edit.html.haml +++ b/app/views/admin/stripe_connect_settings/edit.html.haml @@ -6,8 +6,6 @@ %fieldset.no-border-bottom %legend = t('.settings') - .alert-box.warning - = t(".stripe_beta_warning") = form_for @settings, as: :settings, url: main_app.admin_stripe_connect_settings_path, :method => :put do |f| .row .twelve.columns.alpha.omega @@ -50,4 +48,4 @@ = t(".charges_enabled_warning") - else .alert-box.error - = t(".#{@stripe_account[:status]}_error") + = t(".#{@stripe_account[:status]}") diff --git a/config/locales/en.yml b/config/locales/en.yml index b759c83bdc..785c1066ac 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -748,7 +748,6 @@ en: edit: title: "Stripe Connect" settings: "Settings" - stripe_beta_warning: "Warning: The Stripe Connect integration is currently in beta and should not be enabled in production yet" stripe_connect_enabled: Enable shops to accept payments using Stripe Connect? no_api_key_msg: No Stripe account exists for this enterprise. configuration_explanation_html: For detailed instructions on configuring the Stripe Connect integration, please consult this guide. @@ -760,7 +759,7 @@ en: charges_enabled: Charges Enabled charges_enabled_warning: "Warning: Charges are not enabled for your account" auth_fail_error: The API key you provided is invalid - empty_api_key_error: No Stripe API key has been provided. To set your API key, please follow the instructions at + empty_api_key_error_html: No Stripe API key has been provided. To set your API key, please follow these instructions # Admin controllers controllers: diff --git a/spec/controllers/admin/stripe_connect_settings_controller_spec.rb b/spec/controllers/admin/stripe_connect_settings_controller_spec.rb index 7d0b47974e..267e583586 100644 --- a/spec/controllers/admin/stripe_connect_settings_controller_spec.rb +++ b/spec/controllers/admin/stripe_connect_settings_controller_spec.rb @@ -26,9 +26,9 @@ describe Admin::StripeConnectSettingsController, type: :controller do allow(Stripe).to receive(:api_key) { nil } end - it "sets the account status to :empty_api_key" do + it "sets the account status to :empty_api_key_error_html" do spree_get :edit - expect(assigns(:stripe_account)[:status]).to eq :empty_api_key + expect(assigns(:stripe_account)[:status]).to eq :empty_api_key_error_html expect(assigns(:settings).stripe_connect_enabled).to be true end end @@ -44,9 +44,9 @@ describe Admin::StripeConnectSettingsController, type: :controller do to_return(:status => 401, :body => "{\"error\": {\"message\": \"Invalid API Key provided: sk_test_****xxxx\"}}") end - it "sets the account status to :auth_fail" do + it "sets the account status to :auth_fail_error" do spree_get :edit - expect(assigns(:stripe_account)[:status]).to eq :auth_fail + expect(assigns(:stripe_account)[:status]).to eq :auth_fail_error expect(assigns(:settings).stripe_connect_enabled).to be true end end