moneytree-rails 0.1.4 β 0.1.9
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 +4 -4
- data/README.md +6 -1
- data/app/controllers/moneytree/oauth/square_controller.rb +1 -1
- data/app/controllers/moneytree/oauth/stripe_controller.rb +4 -3
- data/app/controllers/moneytree/webhooks/square_controller.rb +1 -1
- data/app/controllers/moneytree/webhooks/stripe_controller.rb +4 -4
- data/app/models/moneytree/payment.rb +2 -2
- data/app/models/moneytree/payment_gateway.rb +2 -4
- data/app/models/moneytree/refund.rb +1 -1
- data/app/models/moneytree/transaction.rb +1 -1
- data/lib/moneytree/order.rb +3 -1
- data/lib/moneytree/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '079364d1a5759325bd0978da80070be3054ca7833db677991a779b9cf60f40d1'
|
4
|
+
data.tar.gz: 75dda268ddb18e96f8570ef591b5bb5687743e764a066f0196c8a435b364511d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d934abaf84e4eb8136807226535cd3659da2cd9ed71b4f8d684c7cf0730aa90cbca25c771203686dce76598961c025c289124dbabb177e2e0c60ad418f979c78
|
7
|
+
data.tar.gz: 7db374f8ed29d853755e362d60e0ea3fad3ea86d19a846153fb6109dacd787d2a27c8279fc119dc90df98797587334d4e71ff6677b16af7819279ea1e26d500e
|
data/README.md
CHANGED
@@ -13,7 +13,7 @@ functionality with almost no work on your end:
|
|
13
13
|
- π΅πΆπ·π΄ Multi-currency
|
14
14
|
- π OAuth to link your PSP account
|
15
15
|
- π©βπ» PSP account creation, (with commission)
|
16
|
-
- βοΈ
|
16
|
+
- βοΈ Webhooks
|
17
17
|
- π³ ~~PCI compliance with Javascript libraries~~ comming soon
|
18
18
|
- π§² Platform fees a.k.a. Market Places
|
19
19
|
|
@@ -95,6 +95,11 @@ class Merchant < ApplicationRecord
|
|
95
95
|
def website
|
96
96
|
'https://www.boomtown.com'
|
97
97
|
end
|
98
|
+
|
99
|
+
# Optional, will be called by Moneytree after authenticating with the PSP
|
100
|
+
def moneytree_oauth_callback
|
101
|
+
puts "Hurray, I just got associated with a Moneytree gateway!"
|
102
|
+
end
|
98
103
|
end
|
99
104
|
```
|
100
105
|
|
@@ -1,12 +1,13 @@
|
|
1
1
|
module Moneytree
|
2
2
|
module Oauth
|
3
|
-
class StripeController < ApplicationController
|
3
|
+
class StripeController < Moneytree::ApplicationController
|
4
4
|
def new
|
5
5
|
redirect_to stripe_oauth_url
|
6
6
|
end
|
7
7
|
|
8
8
|
def callback
|
9
|
-
|
9
|
+
# TODO: Remove this module prefix once we figure out how to properly autoload this.
|
10
|
+
payment_gateway = Moneytree::PaymentGateway.create!(psp: 'stripe', account: current_account)
|
10
11
|
payment_gateway.oauth_callback(payment_gateway_params)
|
11
12
|
redirect_to Moneytree.oauth_redirect, notice: 'Connected to Stripe'
|
12
13
|
end
|
@@ -26,7 +27,7 @@ module Moneytree
|
|
26
27
|
query: {
|
27
28
|
response_type: :code,
|
28
29
|
client_id: Moneytree.stripe_credentials[:client_id],
|
29
|
-
scope: PaymentProvider::Stripe::PERMISSION,
|
30
|
+
scope: Moneytree::PaymentProvider::Stripe::PERMISSION,
|
30
31
|
redirect_uri: oauth_stripe_callback_url,
|
31
32
|
'stripe_user[email]': current_account.email,
|
32
33
|
'stripe_user[url]': current_account.website,
|
@@ -1,6 +1,6 @@
|
|
1
1
|
module Moneytree
|
2
2
|
module Webhooks
|
3
|
-
class StripeController < ApplicationController
|
3
|
+
class StripeController < Moneytree::ApplicationController
|
4
4
|
skip_before_action :verify_authenticity_token
|
5
5
|
|
6
6
|
def create
|
@@ -29,7 +29,7 @@ module Moneytree
|
|
29
29
|
return if transaction.completed?
|
30
30
|
|
31
31
|
transaction.process_response(
|
32
|
-
TransactionResponse.new(:success, '', { charge_id: stripe_object.id })
|
32
|
+
Moneytree::TransactionResponse.new(:success, '', { charge_id: stripe_object.id })
|
33
33
|
)
|
34
34
|
|
35
35
|
if Moneytree.order_status_trigger_method
|
@@ -47,7 +47,7 @@ module Moneytree
|
|
47
47
|
next if refund.completed?
|
48
48
|
|
49
49
|
refund.process_response(
|
50
|
-
TransactionResponse.new(:success, '')
|
50
|
+
Moneytree::TransactionResponse.new(:success, '')
|
51
51
|
)
|
52
52
|
if Moneytree.order_status_trigger_method
|
53
53
|
transaction.order.send(Moneytree.order_status_trigger_method, transaction)
|
@@ -56,7 +56,7 @@ module Moneytree
|
|
56
56
|
end
|
57
57
|
|
58
58
|
def transaction
|
59
|
-
@transaction ||= Transaction.find(stripe_object.metadata[:moneytree_transaction_id])
|
59
|
+
@transaction ||= Moneytree::Transaction.find(stripe_object.metadata[:moneytree_transaction_id])
|
60
60
|
end
|
61
61
|
|
62
62
|
def stripe_object
|
@@ -8,13 +8,11 @@ module Moneytree
|
|
8
8
|
# FIXME: enable https://github.com/ankane/lockbox
|
9
9
|
delegate :oauth_link, :scope_correct?, :charge, :refund, to: :payment_provider
|
10
10
|
|
11
|
-
|
12
|
-
# has_many :transactions
|
13
|
-
# has_many :customers
|
14
|
-
# has_many :cards
|
11
|
+
has_many :transactions
|
15
12
|
|
16
13
|
def oauth_callback(params)
|
17
14
|
update! psp_credentials: payment_provider.get_access_token(params)
|
15
|
+
account.send(:moneytree_oauth_callback) if account.respond_to?(:moneytree_oauth_callback, true)
|
18
16
|
end
|
19
17
|
|
20
18
|
def psp_connected?
|
data/lib/moneytree/order.rb
CHANGED
data/lib/moneytree/version.rb
CHANGED
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.
|
4
|
+
version: 0.1.9
|
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-11-
|
11
|
+
date: 2020-11-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -97,7 +97,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
97
97
|
- !ruby/object:Gem::Version
|
98
98
|
version: '0'
|
99
99
|
requirements: []
|
100
|
-
rubygems_version: 3.1.
|
100
|
+
rubygems_version: 3.1.4
|
101
101
|
signing_key:
|
102
102
|
specification_version: 4
|
103
103
|
summary: A payments engine for rails centered aorund transactional payments and orders.
|