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 payment method selection to the install generator #3731

Merged
merged 5 commits into from
Aug 19, 2020

Conversation

elia
Copy link
Member

@elia elia commented Aug 12, 2020

Description

This improves the install generator making the final result better equipped for production use.

The default payment method is PayPal Commerce Platform that has a convenient no-code-required onboarding process. New methods can be added easily for similar solutions, which are encouraged.

Checklist:

  • I have followed Pull Request guidelines
  • I have added a detailed description into each commit message
  • I have updated Guides and README accordingly to this change (if needed)
  • I have added tests to cover this change (if needed)
  • I have attached screenshots to this PR for visual changes (if needed)

Preview

      create  config/initializers/spree.rb
      append  public/robots.txt
       exist  app/assets/images
      create  vendor/assets/javascripts/spree/frontend
      create  vendor/assets/javascripts/spree/backend
      create  vendor/assets/stylesheets/spree/frontend
      create  vendor/assets/stylesheets/spree/backend
      create  vendor/assets/images/spree/frontend
      create  vendor/assets/images/spree/backend
      create  vendor/assets/javascripts/spree/frontend/all.js
      create  vendor/assets/stylesheets/spree/frontend/all.css
      create  vendor/assets/javascripts/spree/backend/all.js
      create  vendor/assets/stylesheets/spree/backend/all.css
      create  app/overrides

  Solidus has a default authentication extension that uses Devise.
  You can find more info at https://github.com/solidusio/solidus_auth_devise.

  Would you like to install it? (y/n) 
     gemfile  solidus_auth_devise

  You can select a payment method to be included in the installation process.
  Please select a payment method name: [paypal, none] (paypal) 
     gemfile  solidus_paypal_commerce_platform
      append  db/seeds.rb
     copying  migrations
    creating  database
        rake  db:create

help banner:

Usage:
  rails generate spree:install [options]

Options:
  [--skip-namespace], [--no-skip-namespace]                            # Skip namespace (affects only isolated applications)
  [--migrate=Run Solidus migrations], [--no-migrate]                   # Indicates when to generate migrate
                                                                       # Default: true
  [--seed=Load seed data (migrations must be run)], [--no-seed]        # Indicates when to generate seed
                                                                       # Default: true
  [--sample=Load sample data (migrations must be run)], [--no-sample]  # Indicates when to generate sample
                                                                       # Default: true
  [--auto-accept], [--no-auto-accept]                                  # Indicates when to generate auto accept
  [--user-class=USER_CLASS]                                            # Indicates when to generate user class
  [--admin-email=ADMIN_EMAIL]                                          # Indicates when to generate admin email
  [--admin-password=ADMIN_PASSWORD]                                    # Indicates when to generate admin password
  [--lib-name=LIB_NAME]                                                # Indicates when to generate lib name
                                                                       # Default: spree
  [--with-authentication], [--no-with-authentication]                  # Indicates when to generate with authentication
                                                                       # Default: true
  [--enforce-available-locales], [--no-enforce-available-locales]      # Indicates when to generate enforce available locales
  [--payment-method=PAYMENT_METHOD]                                    # Indicates which payment method to install.
                                                                       # Default: paypal
                                                                       # Possible values: paypal, none

Runtime options:
  -f, [--force]                    # Overwrite files that already exist
  -p, [--pretend], [--no-pretend]  # Run but do not make any changes
  -q, [--quiet], [--no-quiet]      # Suppress status output
  -s, [--skip], [--no-skip]        # Skip files that already exist

Description:
    Create spree files for install generator.

Copy link
Member

@aldesantis aldesantis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me!

available_methods = PAYMENT_METHODS.keys

payment_method_name = ask("
You can now select a payment method to be included in the installation process.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would drop the now. For sure it's a novelty at the moment of writing, but it won't be for long 📆


payment_method_name = ask("
You can now select a payment method to be included in the installation process.
Please select a payment method name?", limited_to: available_methods, default: available_methods.first)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please select a payment method name? -> the question mark in this sentence seems a bit odd to me, what about removing it or changing the wording?

@elia elia force-pushed the elia/payment-method-setup branch from 73e6736 to b3c1ab2 Compare August 17, 2020 14:02
@elia elia requested a review from spaghetticode August 17, 2020 14:02
elia added 2 commits August 17, 2020 16:02
Defaults to paypal commerce platform, additional methods can be added
in the future.
The option is true by default and should still be true for empty or
bad input.
@elia elia force-pushed the elia/payment-method-setup branch from b3c1ab2 to e5e6d30 Compare August 17, 2020 14:03
@spaghetticode spaghetticode marked this pull request as ready for review August 19, 2020 16:19
Copy link
Member

@spaghetticode spaghetticode left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@elia thank you 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants