moneytree-rails 0.1.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5d3cb24c4e2a58def5e8f26fdd8ec1bce493b0deea44320eb30eed239a16f470
4
- data.tar.gz: c8d266821266b5b886777afd8f45ed0bb19af5fb11b74de5145f77e25dd10b18
3
+ metadata.gz: 67bc801735c6a51cc96dc8d32831573f612e2ed40cca75270e6ed463753c1416
4
+ data.tar.gz: 3755d3a5849a64c19e39db7462e4f72955fd00ccca000733ade198d97fdb0663
5
5
  SHA512:
6
- metadata.gz: ee2779c427433363015894190d09a801cb2cb8ecc3b7eb746cf067149b95486acd8c221ddbc074f0f943b7baf6bcd5845b3c22ccb59cb8464cac11fba5b4d760
7
- data.tar.gz: 04de96735920050133081445ffae416e9248a08d0f33e6c1e806b0f9968a53a0dc8da60c2fa4d0274455a021fc251fb6662cfb567e712449e158bdccf71e6327
6
+ metadata.gz: f7eaa48325fef12a693942550477ad567a8a15e7107c201297b7c0f9f5ce7a64f6ed9a23a6f743ded0cad0c440d4b409860b1d51d5bedf6f117457a5f2122af9
7
+ data.tar.gz: d66488bf874e22215c8f6d2793189ca6fb15f47fb9d820f95d538ff362a371c5789af8909c560b4938cd6fb65386dc5d94d8e198bc36a0883a20408777e320e9
data/README.md CHANGED
@@ -1,18 +1,8 @@
1
1
  # 🚧 WORK IN PROGRESS 🚧
2
2
 
3
- - [ ] OAuth
4
- - [ ] Controller actions
5
- - [ ] Scopes
6
- - [ ] Square
7
- - [ ] Stripe
8
- - [ ] Braintree
9
- - [ ] Moneytree models
10
- - [ ] Payment gateway, belongs to account
11
- - [ ] Cards
12
- - [ ] Customers
13
- - [ ] Payments
14
- - [ ] Refunds
15
- - [ ] Notifications
3
+ Currently only supports:
4
+
5
+ - Oauth flow for stripe
16
6
 
17
7
  # Moneytree 💵 🌴
18
8
 
@@ -29,13 +19,13 @@ functionality with almost no work on your end:
29
19
  - 👩‍💻PSP account creation, (with commission)
30
20
  - ⚙️ Webhooks
31
21
  - 💳 PCI compliance with Javascript libraries
32
- - 🧲 Platform fees
22
+ - 🧲 Platform fees a.k.a. Market Places
33
23
 
34
24
  Currently we support the following PSP's:
35
25
 
36
- - Square
26
+ - ~~Square~~
37
27
  - Stripe
38
- - Braintree
28
+ - ~~Braintree~~
39
29
 
40
30
  But if you want to add more PSP's, we make it easy to do so. Read our
41
31
  [Contributing](https://github.com/kieranklaassen/moneytree#contributing) section to learn more.
@@ -57,13 +47,10 @@ Add the latest version of Moneytree to your gem Gemfile by running:
57
47
  ```bash
58
48
  $ bundle add moneytree-rails
59
49
  $ bundle install
60
- $ bundle exec moneytree init
50
+ $ rails g moneytree:install:migrations
51
+ $ rails g db:migrate
61
52
  ```
62
53
 
63
- Or your can use environment variables:
64
-
65
- FIXME: add
66
-
67
54
  ## Configuration
68
55
 
69
56
  Do you need to make some changes to how Moneytree is used? You can create an initializer
@@ -71,17 +58,40 @@ Do you need to make some changes to how Moneytree is used? You can create an ini
71
58
 
72
59
  ```ruby
73
60
  Moneytree.setup do |config|
74
- config.enabled_psps = [:square, :stripe, :braintree]
75
- config.account_class = 'Account'
76
- config.order_class = 'Order'
77
- config.transaction_class = 'Transaction'
78
-
79
- config.square_credentials = {
80
- app_id: ENV['SQUARE_APP_ID'],
81
- app_secret: ENV['SQUARE_APP_SECRET'],
82
- environment: Rails.env.production? : 'production' : 'sandbox',
83
- oauth_domain: Rails.env.production? ? 'https://connect.squareup.com' : 'https://connect.squareupsandbox.com'
61
+ config.current_account = :current_merchant
62
+ config.stripe_credentials = {
63
+ api_key: ENV['STRIPE_API_KEY'],
64
+ client_id: ENV['STRIPE_CLIENT_ID']
84
65
  }
66
+ config.oauth_redirect = '/welcome_back'
67
+ end
68
+ ```
69
+
70
+ Add to your routes and authenticate if needed:
71
+
72
+ ```ruby
73
+ authenticate :user, ->(u) { u.owner? } do
74
+ mount Moneytree::Engine => '/moneytree'
75
+ end
76
+ ```
77
+
78
+ Include account concern into your model and make sure the following attributes work:
79
+
80
+ ```ruby
81
+ class Merchant < ApplicationRecord
82
+ include Moneytree::Account
83
+
84
+ def email
85
+ owner.email
86
+ end
87
+
88
+ def currency_code
89
+ currency.code
90
+ end
91
+
92
+ def website
93
+ 'https://www.boomtown.com'
94
+ end
85
95
  end
86
96
  ```
87
97
 
@@ -95,6 +105,10 @@ transaction attached for the payment. You can name these models however you want
95
105
 
96
106
  ### The API
97
107
 
108
+ #### Moneytree::PaymentGateway
109
+
110
+ ##### #method here
111
+
98
112
  ## Development
99
113
 
100
114
  After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can
@@ -119,6 +133,7 @@ The gem is available as open source under the terms of the [MIT License](https:/
119
133
  Everyone interacting in the Moneytree project's codebases, issue trackers, chat rooms and mailing lists is expected to
120
134
  follow the [code of conduct](https://github.com/kieranklaassen/moneytree/blob/master/CODE_OF_CONDUCT.md).
121
135
 
136
+ ```
122
137
  rails g model payment_gateway psp_credentials:text moneytree_psp:integer account:references{polymorphic}
123
138
 
124
139
  owner t.string :name t.text :psp_credentials t.integer :moneytree_psp
@@ -134,3 +149,5 @@ rails g model customers t.string :first_name t.string :last_name t.string :email
134
149
 
135
150
  rails g model cards t.string :card_brand t.string :last_4 t.integer :expiration_month t.integer :expiration_year
136
151
  t.string :cardholder_name t.string :fingerprint t.integer :moneytree_psp t.references :customer t.references :account
152
+
153
+ ```
@@ -8,7 +8,7 @@ module Moneytree
8
8
  def callback
9
9
  payment_gateway = PaymentGateway.create!(psp: 'stripe', account: current_account)
10
10
  payment_gateway.oauth_callback(payment_gateway_params)
11
- redirect_to '/', notice: 'Connected to Stripe'
11
+ redirect_to Moneytree.oauth_redirect, notice: 'Connected to Stripe'
12
12
  end
13
13
 
14
14
  private
@@ -0,0 +1 @@
1
+ require 'moneytree'
@@ -16,9 +16,11 @@ module Moneytree
16
16
  mattr_accessor :enabled_psps
17
17
  mattr_accessor :stripe_credentials
18
18
  mattr_accessor :current_account
19
+ mattr_accessor :oauth_redirect
19
20
 
20
21
  @@enabled_psps = PSPS
21
22
  @@current_account = :current_account
23
+ @@oauth_redirect = '/'
22
24
 
23
25
  def self.setup
24
26
  yield self
@@ -1,3 +1,3 @@
1
1
  module Moneytree
2
- VERSION = '0.1.1'
2
+ VERSION = '0.1.2'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: moneytree-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kieran Klaassen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-09-28 00:00:00.000000000 Z
11
+ date: 2020-09-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -65,6 +65,7 @@ files:
65
65
  - app/views/layouts/moneytree/application.html.erb
66
66
  - config/routes.rb
67
67
  - db/migrate/20200914151648_create_moneytree_payment_gateways.rb
68
+ - lib/moneytree-rails.rb
68
69
  - lib/moneytree.rb
69
70
  - lib/moneytree/account.rb
70
71
  - lib/moneytree/engine.rb