ishapi 0.1.8.36 → 0.1.8.37
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/controllers/ishapi/invoices_controller.rb +23 -0
- data/app/controllers/ishapi/payments_controller.rb +43 -0
- data/config/routes.rb +4 -0
- data/lib/ishapi/engine.rb +3 -0
- metadata +32 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4dee14eefbde818c41667b40b82c0850482c1cbc
|
4
|
+
data.tar.gz: 965912f318a528a15b8e7d7077757af502cae50d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f15c94689e0769cc4eb9c6b6fd244392735549905c96d8a70336b2c33eae108672ae4c33d73e2da209057bb2b1cc8d73ffde716c74c5bc8d0eeba627782cadeb
|
7
|
+
data.tar.gz: 3bd41edd499d0ef39598e630ca5f10135a261466b8d9df041c5aa6e16db2509393114568bc26602d24ec3409b9cb7cc56d00f77c7a7d31eb0ca60349eabb9fba
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require_dependency "ishapi/application_controller"
|
2
|
+
module Ishapi
|
3
|
+
class InvoicesController < ApplicationController
|
4
|
+
|
5
|
+
def search
|
6
|
+
authorize! :open_permission, ::Ishapi
|
7
|
+
begin
|
8
|
+
p = IshModels::UserProfile.find_by( :email => params[:email] )
|
9
|
+
i = Ish::Invoice.find_by( :number => params[:number] )
|
10
|
+
if i.profile == p && i.amount == params[:amount].to_f && i.payments.count == 0
|
11
|
+
render :json => { :status => :ok }
|
12
|
+
else
|
13
|
+
render :status => 404, :json => {} # :json => { :status => 404, :code => 404, :message => 'Not Found1' }
|
14
|
+
end
|
15
|
+
rescue Mongoid::Errors::DocumentNotFound => e
|
16
|
+
puts! e, 'e'
|
17
|
+
render :status => 404, :json => {} # :json => { :status => 404, :code => 404, :message => 'Not Found1' }
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
@@ -0,0 +1,43 @@
|
|
1
|
+
require_dependency "ishapi/application_controller"
|
2
|
+
module Ishapi
|
3
|
+
class PaymentsController < ApplicationController
|
4
|
+
|
5
|
+
def create
|
6
|
+
authorize! :open_permission, ::Ishapi
|
7
|
+
begin
|
8
|
+
profile = IshModels::UserProfile.find_by( :email => params[:email] )
|
9
|
+
invoice = Ish::Invoice.find_by( :number => params[:number] )
|
10
|
+
payment = Ish::Payment.new :invoice => invoice, :profile => profile, :amount => params[:amount]
|
11
|
+
amount_cents = ( params[:amount].to_f * 100 ).to_i
|
12
|
+
|
13
|
+
::Stripe.api_key = STRIPE_SK
|
14
|
+
acct = Stripe::Account.create(
|
15
|
+
:country => 'US',
|
16
|
+
:type => 'custom'
|
17
|
+
)
|
18
|
+
charge = ::Stripe::Charge.create(
|
19
|
+
:amount => amount_cents,
|
20
|
+
:currency => 'usd',
|
21
|
+
:source => params[:token][:id],
|
22
|
+
:destination => {
|
23
|
+
:account => acct,
|
24
|
+
}
|
25
|
+
)
|
26
|
+
puts! charge, 'charge'
|
27
|
+
# byebug
|
28
|
+
|
29
|
+
payment.charge = JSON.parse( charge.to_json )
|
30
|
+
if payment.save
|
31
|
+
render :json => { :status => :ok }
|
32
|
+
else
|
33
|
+
render :status => 404, :json => {}
|
34
|
+
end
|
35
|
+
rescue Mongoid::Errors::DocumentNotFound => e
|
36
|
+
puts! e, 'e'
|
37
|
+
render :status => 404, :json => {}
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
data/config/routes.rb
CHANGED
@@ -9,6 +9,8 @@ Ishapi::Engine.routes.draw do
|
|
9
9
|
get 'galleries', :to => 'galleries#index'
|
10
10
|
get 'galleries/view/:galleryname', :to => 'galleries#show'
|
11
11
|
|
12
|
+
post 'invoices/search', :to => 'invoices#search'
|
13
|
+
|
12
14
|
namespace :my do
|
13
15
|
post 'reports', :to => 'reports#index'
|
14
16
|
get 'reports', :to => 'reports#index'
|
@@ -18,6 +20,8 @@ Ishapi::Engine.routes.draw do
|
|
18
20
|
# resources :videos
|
19
21
|
end
|
20
22
|
|
23
|
+
post 'payments', :to => 'payments#create'
|
24
|
+
|
21
25
|
get 'reports', :to => 'reports#index'
|
22
26
|
get 'reports/view/:name_seo', :to => 'reports#show'
|
23
27
|
|
data/lib/ishapi/engine.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ishapi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.8.
|
4
|
+
version: 0.1.8.37
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- piousbox
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-11-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -122,6 +122,34 @@ dependencies:
|
|
122
122
|
- - "~>"
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: '6.0'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: rack-throttle
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - "~>"
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0.5'
|
132
|
+
type: :runtime
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - "~>"
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0.5'
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: stripe
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - ">="
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: '0'
|
146
|
+
type: :runtime
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - ">="
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: '0'
|
125
153
|
description: " Description of Ishapi."
|
126
154
|
email:
|
127
155
|
- piousbox@gmail.com
|
@@ -146,12 +174,14 @@ files:
|
|
146
174
|
- app/controllers/ishapi/cities_controller.rb~
|
147
175
|
- app/controllers/ishapi/galleries_controller.rb
|
148
176
|
- app/controllers/ishapi/galleries_controller.rb~
|
177
|
+
- app/controllers/ishapi/invoices_controller.rb
|
149
178
|
- app/controllers/ishapi/my/my_controller.rb
|
150
179
|
- app/controllers/ishapi/my/my_controller.rb~
|
151
180
|
- app/controllers/ishapi/my/reports_controller.rb
|
152
181
|
- app/controllers/ishapi/my/reports_controller.rb~
|
153
182
|
- app/controllers/ishapi/newsitems_controller.rb
|
154
183
|
- app/controllers/ishapi/newsitems_controller.rb~
|
184
|
+
- app/controllers/ishapi/payments_controller.rb
|
155
185
|
- app/controllers/ishapi/reports_controller.rb
|
156
186
|
- app/controllers/ishapi/reports_controller.rb~
|
157
187
|
- app/controllers/ishapi/sites_controller.rb
|