Skip to content

Latest commit

 

History

History
100 lines (66 loc) · 2.61 KB

README.md

File metadata and controls

100 lines (66 loc) · 2.61 KB

Shopline

CI/CD Dependabot Status

E-commerce app. Shop online with Shopline. You shop, we ship!

Homepage Dashboard Dashboard-Dark Orders Orders-Dark

Setup

Prerequisites

Create .env file at the root of the project directory. Copy the content of .env.template.erb to .env then update the username and password based on your database credentials. Get STRIPE_SECRET_KEY and STRIPE_WEBHOOK_SECRET from your Stripe account

Install dependencies and setup database

bin/setup

Start local web server

bin/dev

Go to http://localhost:3000

Use Stripe CLI to simulate Stripe events in your local environment or learn more about Webhooks

stripe listen --forward-to localhost:3000/stripe_webhooks

Testing Payments

To test Stripe payments, use the following test card details:

  • Card Number: 4242 4242 4242 4242
  • Expiration: Any future date
  • CVC: Any 3-digit number

Set up a production Stripe webhook

  1. Go to the Stripe Dashboard and create a new webhook for your production environment.
  2. Set the endpoint URL to your production route (e.g., https://yourdomain.com/stripe_webhooks).
  3. Select the events you want to listen for (e.g., checkout.session.completed, customer.created).

Testing

Setup test database

bin/rails db:test:prepare

Default: Run all spec files (i.e., those matching spec/**/*_spec.rb)

bin/rspec

Run all spec files in a single directory (recursively)

bin/rspec spec/models

Run a single spec file

bin/rspec spec/models/product_spec.rb

Use the plain-English descriptions to generate a report of where the application conforms to (or fails to meet) the spec

bin/rspec --format documentation spec/models/product_spec.rb

Run a single example from a spec file (by line number)

bin/rspec spec/models/product_spec.rb:8

See all options for running specs

bin/rspec --help