Skip to content

Commit

Permalink
Merge pull request #5 from spree-edge/added-default-value-for-stripe-…
Browse files Browse the repository at this point in the history
…connect-account-type

Added default value for stripe connect account type
  • Loading branch information
vishal-bluebash committed May 12, 2022
2 parents ce75622 + d4ebe31 commit 952baee
Show file tree
Hide file tree
Showing 7 changed files with 35 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@ def stripe_connect_url
redirect_to redirect_callback_uri
end

def account_information
end
def stripe_account_type; end

def account_information; end

private

Expand Down
11 changes: 9 additions & 2 deletions app/views/spree/admin/shared/_stripe_onboarding.html.erb
Original file line number Diff line number Diff line change
@@ -1,13 +1,20 @@
<% content_for :sidebar do %>
<ul class="nav flex-column nav-pills" data-hook="stripe_onboarding">
<% unless @vendor.stripe_connect_id.present? %>
<% if !@vendor.stripe_connect_id.present? && !current_spree_user.admin? %>
<li data-hook='admin_order_tabs_cart_details'>
<%= link_to_with_icon 'add.svg',
Spree.t(:stripe_onboarding),
onboarding_admin_vendor_setting_url(@vendor),
stripe_connect_url_admin_vendor_path(@vendor),
class: "nav-link" %>
</li>
<% end %>
<% if !@vendor.stripe_connect_id.present? && current_spree_user.admin? %>
<%= link_to_with_icon 'add.svg',
Spree.t(:stripe_account_type),
stripe_account_type_admin_vendor_url(@vendor),
class: "nav-link" %>
<% end %>
<% if @vendor.stripe_connect_id.present? %>
<li data-hook='admin_order_tabs_cart_details'>
<%= link_to_with_icon 'info.svg',
Expand Down
15 changes: 15 additions & 0 deletions app/views/spree/admin/vendors/stripe_account_type.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<h4 class="pt-5"> Stripe Account Type </h4>

<%= form_for([:admin, @vendor], url: admin_vendor_url, method: :put) do |f| %>
<div class="form-group">
<%= f.field_container :stripe_account_type do %>
<%= f.label :stripe_account_type %>
<%= f.select :stripe_account_type, Spree::Vendor.stripe_account_types.keys.map{ |x| [x.titleize, x] }, {:include_blank => true}, {class: 'select2 form-control', "data-placeholder" => Spree.t(:stripe_account_type)} %>
<% end %>
</div>
<div class="form-actions" data-hook="buttons">
<%= f.submit "Submit", class: "btn btn-primary", "data-turbo": "false"%>
<span class="or"><%= Spree.t(:or) %></span>
<%= button_link_to Spree.t('actions.cancel'), edit_admin_vendor_url(@vendor), icon: 'delete' %>
</div>
<% end %>
2 changes: 1 addition & 1 deletion bin/rails
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# This command will automatically be run when you run "rails" from the root of your extension

ENGINE_ROOT = File.expand_path('../..', __FILE__)
ENGINE_PATH = File.expand_path('../../lib/spree_stripe_connect_standard_onboarding/engine', __FILE__)
ENGINE_PATH = File.expand_path('../../lib/spree_stripe_connect_onboarding/engine', __FILE__)

require 'rails/all'
require 'rails/engine/commands'
1 change: 1 addition & 0 deletions config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
member do
get :stripe_connect_url
get :account_information
get :stripe_account_type
end
end

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class ChangeDefaultValueForStripeAccountType < ActiveRecord::Migration[6.1]
def change
change_column :spree_vendors, :stripe_account_type, :string, default: 0
end
end
2 changes: 1 addition & 1 deletion lib/spree_stripe_connect_onboarding/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module SpreeStripeConnectOnboarding
VERSION = '1.0.0'.freeze
VERSION = '1.1.0'.freeze

module_function

Expand Down

0 comments on commit 952baee

Please sign in to comment.