README.md in moneytree-rails-0.1.1 vs README.md in moneytree-rails-0.1.2
- old
+ new
@@ -1,21 +1,11 @@
# π§ WORK IN PROGRESS π§
-- [ ] OAuth
- - [ ] Controller actions
- - [ ] Scopes
- - [ ] Square
- - [ ] Stripe
- - [ ] Braintree
-- [ ] Moneytree models
- - [ ] Payment gateway, belongs to account
- - [ ] Cards
- - [ ] Customers
- - [ ] Payments
- - [ ] Refunds
-- [ ] Notifications
+Currently only supports:
+- Oauth flow for stripe
+
# Moneytree π΅ π΄
[](https://github.com/kieranklaassen/moneytree/actions)
[](https://badge.fury.io/rb/moneytree-rails)
@@ -27,17 +17,17 @@
- π΅πΆπ·π΄ Multi-currency
- π OAuth to link your PSP account
- π©βπ»PSP account creation, (with commission)
- βοΈ Webhooks
- π³ PCI compliance with Javascript libraries
-- 𧲠Platform fees
+- 𧲠Platform fees a.k.a. Market Places
Currently we support the following PSP's:
-- Square
+- ~~Square~~
- Stripe
-- Braintree
+- ~~Braintree~~
But if you want to add more PSP's, we make it easy to do so. Read our
[Contributing](https://github.com/kieranklaassen/moneytree#contributing) section to learn more.
## Installation
@@ -55,48 +45,72 @@
Add the latest version of Moneytree to your gem Gemfile by running:
```bash
$ bundle add moneytree-rails
$ bundle install
-$ bundle exec moneytree init
+$ rails g moneytree:install:migrations
+$ rails g db:migrate
```
-Or your can use environment variables:
-
-FIXME: add
-
## Configuration
Do you need to make some changes to how Moneytree is used? You can create an initializer
`config/initializers/moneytree.rb`
```ruby
Moneytree.setup do |config|
- config.enabled_psps = [:square, :stripe, :braintree]
- config.account_class = 'Account'
- config.order_class = 'Order'
- config.transaction_class = 'Transaction'
-
- config.square_credentials = {
- app_id: ENV['SQUARE_APP_ID'],
- app_secret: ENV['SQUARE_APP_SECRET'],
- environment: Rails.env.production? : 'production' : 'sandbox',
- oauth_domain: Rails.env.production? ? 'https://connect.squareup.com' : 'https://connect.squareupsandbox.com'
+ config.current_account = :current_merchant
+ config.stripe_credentials = {
+ api_key: ENV['STRIPE_API_KEY'],
+ client_id: ENV['STRIPE_CLIENT_ID']
}
+ config.oauth_redirect = '/welcome_back'
end
```
+Add to your routes and authenticate if needed:
+
+```ruby
+ authenticate :user, ->(u) { u.owner? } do
+ mount Moneytree::Engine => '/moneytree'
+ end
+```
+
+Include account concern into your model and make sure the following attributes work:
+
+```ruby
+class Merchant < ApplicationRecord
+ include Moneytree::Account
+
+ def email
+ owner.email
+ end
+
+ def currency_code
+ currency.code
+ end
+
+ def website
+ 'https://www.boomtown.com'
+ end
+end
+```
+
## Usage
### The Primitives
Before you start using the Gem, it is good to understand the models and what they do. This Gem is made for people that
need payments for transactional orders. Think, an account holder that sells products. When an order is made there is a
transaction attached for the payment. You can name these models however you want yourself.
### The API
+#### Moneytree::PaymentGateway
+
+##### #method here
+
## Development
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can
also run `bin/console` for an interactive prompt that will allow you to experiment.
@@ -117,10 +131,11 @@
## Code of Conduct
Everyone interacting in the Moneytree project's codebases, issue trackers, chat rooms and mailing lists is expected to
follow the [code of conduct](https://github.com/kieranklaassen/moneytree/blob/master/CODE_OF_CONDUCT.md).
+```
rails g model payment_gateway psp_credentials:text moneytree_psp:integer account:references{polymorphic}
owner t.string :name t.text :psp_credentials t.integer :moneytree_psp
rails g model orders t.string :description t.string :remote_identifier t.references :customer t.references :account
@@ -132,5 +147,7 @@
rails g model customers t.string :first_name t.string :last_name t.string :email t.string :remote_identifier t.integer
:moneytree_psp t.references :account
rails g model cards t.string :card_brand t.string :last_4 t.integer :expiration_month t.integer :expiration_year
t.string :cardholder_name t.string :fingerprint t.integer :moneytree_psp t.references :customer t.references :account
+
+```