ishapi 0.1.8.171 → 0.1.8.172
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/payments_controller.rb +18 -11
- data/app/controllers/ishapi/users_controller.rb +15 -1
- data/app/views/ishapi/markers/_index.jbuilder +13 -2
- data/app/views/ishapi/newsitems/_index.jbuilder +2 -1
- data/app/views/ishapi/reports/show.jbuilder +6 -4
- data/app/views/ishapi/users/_account.jbuilder +7 -7
- data/app/views/ishapi/users/account.jbuilder +1 -1
- data/app/views/ishapi/videos/_show.jbuilder +1 -0
- data/config/routes.rb +1 -10
- metadata +2 -3
- data/app/controllers/ishapi/unrestricted_controller.rb-trash +0 -25
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7b51cdb462ddeb86fe0fd4e10c6b3b7e9dfea2fffef44b773f2d1748a1a3b8d8
|
4
|
+
data.tar.gz: 1f5c3705a6b9eb7828dee1296113d222058d9015665d4f183429e72714beb3e3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a43ea617b94979fada76da3479dea3e62efce08e61484e2e17c32687de0f83c0a9df5e9fdc7ec79beba43e5453ff61f91405c654477815b99b793a8443e85035
|
7
|
+
data.tar.gz: de56a014a64631b435557e85dbdca01fc979d52ca66230e84a5f806c95dde9c938067ca29e2d304b5251759298580a190a8031d970798a42654510ee9adc5a68
|
@@ -43,14 +43,16 @@ module Ishapi
|
|
43
43
|
end
|
44
44
|
end
|
45
45
|
|
46
|
-
## This is for guyd _vp_
|
46
|
+
## This is for guyd _vp_ 2020-07-21
|
47
|
+
## It's been a while! _vp_ 2022-03-01
|
47
48
|
def create2
|
48
49
|
authorize! :create, ::Ish::Payment
|
50
|
+
current_user.profile.update_attributes({ is_purchasing: true })
|
49
51
|
|
50
52
|
begin
|
51
53
|
amount_cents = 503 # @TODO: change
|
52
54
|
|
53
|
-
::Stripe.api_key = STRIPE_SK
|
55
|
+
::Stripe.api_key = ::STRIPE_SK
|
54
56
|
intent = Stripe::PaymentIntent.create({
|
55
57
|
amount: amount_cents,
|
56
58
|
currency: 'usd',
|
@@ -59,18 +61,20 @@ module Ishapi
|
|
59
61
|
|
60
62
|
payment = Ish::Payment.create!(
|
61
63
|
client_secret: intent.client_secret,
|
62
|
-
email:
|
64
|
+
email: current_user.email,
|
63
65
|
payment_intent_id: intent.id,
|
64
|
-
profile_id:
|
66
|
+
profile_id: current_user.profile.id )
|
65
67
|
|
66
68
|
render json: { client_secret: intent.client_secret }
|
67
69
|
rescue Mongoid::Errors::DocumentNotFound => e
|
68
|
-
puts! e, '
|
70
|
+
puts! e, '#create2 Mongoid::Errors::DocumentNotFound'
|
69
71
|
render :status => 404, :json => e
|
70
72
|
end
|
71
73
|
end
|
72
74
|
|
75
|
+
##
|
73
76
|
## webhook
|
77
|
+
##
|
74
78
|
def stripe_confirm
|
75
79
|
authorize! :open_permission, ::Ishapi
|
76
80
|
payload = request.body.read
|
@@ -78,7 +82,7 @@ module Ishapi
|
|
78
82
|
begin
|
79
83
|
event = Stripe::Event.construct_from(JSON.parse(payload, symbolize_names: true))
|
80
84
|
rescue StandardError => e
|
81
|
-
puts! e, '
|
85
|
+
puts! e, 'could not #stripe_confirm'
|
82
86
|
render status: 400, json: { status: :not_ok }
|
83
87
|
return
|
84
88
|
end
|
@@ -87,8 +91,11 @@ module Ishapi
|
|
87
91
|
|
88
92
|
payment = Ish::Payment.where( payment_intent_id: payment_intent.id ).first
|
89
93
|
if payment && payment_intent['status'] == 'succeeded'
|
94
|
+
|
90
95
|
payment.update_attributes( status: :confirmed )
|
91
|
-
|
96
|
+
n_unlocks = payment.profile.n_unlocks + 5
|
97
|
+
|
98
|
+
payment.profile.update_attributes!( n_unlocks: n_unlocks, is_purchasing: false ) # @TODO: it's not always 5? adjust
|
92
99
|
end
|
93
100
|
|
94
101
|
render status: 200, json: { status: :ok }
|
@@ -98,18 +105,18 @@ module Ishapi
|
|
98
105
|
authorize! :unlock, ::Ish::Payment
|
99
106
|
item = Object::const_get(params['kind']).find params['id']
|
100
107
|
|
101
|
-
puts! params, 'unlocking...'
|
102
|
-
|
103
108
|
existing = Purchase.where( user_profile: @current_user.profile, item: item ).first
|
104
109
|
if existing
|
105
110
|
render status: 200, json: { status: :ok, message: 'already purchased' }
|
106
111
|
return
|
107
112
|
end
|
108
113
|
|
109
|
-
@current_user.profile.
|
114
|
+
@current_user.profile.inc( n_unlocks: -item.premium_tier )
|
115
|
+
|
110
116
|
purchase = ::Gameui::PremiumPurchase.create!( item: item, user_profile: @current_user.profile, )
|
111
117
|
|
112
|
-
|
118
|
+
@profile = @current_user.profile
|
119
|
+
render 'ishapi/users/account'
|
113
120
|
end
|
114
121
|
|
115
122
|
end
|
@@ -3,7 +3,7 @@ require_dependency "ishapi/application_controller"
|
|
3
3
|
module Ishapi
|
4
4
|
class UsersController < ApplicationController
|
5
5
|
|
6
|
-
skip_authorization_check only: %i| fb_sign_in login |
|
6
|
+
skip_authorization_check only: %i| create fb_sign_in login |
|
7
7
|
|
8
8
|
before_action :check_profile_hard, only: %i| account |
|
9
9
|
|
@@ -17,6 +17,20 @@ module Ishapi
|
|
17
17
|
}, status: 401
|
18
18
|
end
|
19
19
|
|
20
|
+
def create
|
21
|
+
@profile = Profile.new( email: params[:email] )
|
22
|
+
@user = User.new( email: params[:email], password: params[:password], profile: @profile )
|
23
|
+
|
24
|
+
if @profile.save && @user.save
|
25
|
+
@jwt_token = encode(user_id: @user.id.to_s)
|
26
|
+
render 'login'
|
27
|
+
else
|
28
|
+
render json: {
|
29
|
+
messages: [],
|
30
|
+
}, status: 401
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
20
34
|
def fb_sign_in
|
21
35
|
authorize! :fb_sign_in, Ishapi
|
22
36
|
# render :json => { :status => :ok }
|
@@ -16,7 +16,18 @@ json.markers do
|
|
16
16
|
json.title_img_path marker.title_image ? marker.title_image.image.url(:thumb) : image_missing
|
17
17
|
json.item_type marker.item_type
|
18
18
|
json.url marker.url
|
19
|
-
|
20
|
-
|
19
|
+
|
20
|
+
## @TODO: this is copy-pasted and should be abstracted.
|
21
|
+
destination = marker.destination
|
22
|
+
json.premium_tier destination.premium_tier
|
23
|
+
json.id destination.id.to_s
|
24
|
+
if destination.is_premium
|
25
|
+
json.premium_tier destination.premium_tier
|
26
|
+
json.is_premium destination.premium_tier > 0
|
27
|
+
if current_user && current_user.profile
|
28
|
+
json.is_purchased current_user.profile.has_premium_purchase( destination )
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
21
32
|
end
|
22
33
|
end
|
@@ -39,7 +39,8 @@ json.newsitems do
|
|
39
39
|
json.id item.report_id.to_s
|
40
40
|
json.item_type item.report.class.name
|
41
41
|
json.name item.report.name
|
42
|
-
json.reportname item.report.slug
|
42
|
+
json.reportname item.report.slug # @TODO: @deprecated, remove
|
43
|
+
json.slug item.report.slug
|
43
44
|
json.subhead item.report.subhead
|
44
45
|
json.username item.report.user_profile.name if item.report.user_profile
|
45
46
|
|
@@ -8,10 +8,12 @@ key = [ @report, params ]
|
|
8
8
|
json.cache! key do
|
9
9
|
json.report do
|
10
10
|
json.id @report.id.to_s
|
11
|
+
json.item_type @report.class.name
|
11
12
|
json.name @report.name
|
12
|
-
json.reportname @report.slug
|
13
|
+
json.reportname @report.slug # @TODO: @deprecated, remove
|
14
|
+
json.slug @report.slug
|
13
15
|
if @report.photo
|
14
|
-
json.photo_url @report.photo.photo.url( :small )
|
16
|
+
json.photo_url @report.photo.photo.url( :small )
|
15
17
|
json.thumb_url @report.photo.photo.url( :thumb )
|
16
18
|
end
|
17
19
|
|
@@ -22,7 +24,7 @@ json.cache! key do
|
|
22
24
|
json.cityname @report.city.cityname if @report.city
|
23
25
|
json.subhead @report.subhead
|
24
26
|
json.description @report.descr
|
25
|
-
|
27
|
+
|
26
28
|
if @report.photo
|
27
29
|
json.photo do
|
28
30
|
json.thumb_url @report.photo.photo.url :thumb
|
@@ -42,5 +44,5 @@ json.cache! key do
|
|
42
44
|
json.large_url @report.photo.photo.url :large
|
43
45
|
end
|
44
46
|
end
|
45
|
-
|
47
|
+
|
46
48
|
end
|
@@ -1,15 +1,15 @@
|
|
1
1
|
|
2
|
-
json.id @profile.id
|
2
|
+
json.id @profile.id.to_s
|
3
3
|
json.name @profile.name
|
4
4
|
json.email @profile.email
|
5
5
|
json.profile_photo_url @profile.profile_photo.photo.url( :thumb ) if @profile.profile_photo
|
6
6
|
|
7
|
-
json.n_reports
|
8
|
-
json.n_galleries
|
9
|
-
json.n_videos
|
10
|
-
json.n_stars
|
11
|
-
json.n_unlocks
|
12
|
-
|
7
|
+
json.n_reports @profile.reports.count
|
8
|
+
json.n_galleries @profile.galleries.count
|
9
|
+
json.n_videos @profile.videos.count
|
10
|
+
json.n_stars @profile.n_stars # @TODO: which one is deprecated?
|
11
|
+
json.n_unlocks @profile.n_unlocks # @TODO: which one is deprecated?
|
12
|
+
json.is_purchasing @profile.is_purchasing
|
13
13
|
if @profile.current_city
|
14
14
|
json.current_city @profile.current_city
|
15
15
|
end
|
@@ -1,2 +1,2 @@
|
|
1
1
|
|
2
|
-
json.partial! 'account'
|
2
|
+
json.partial! 'ishapi/users/account'
|
data/config/routes.rb
CHANGED
@@ -8,16 +8,6 @@ Ishapi::Engine.routes.draw do
|
|
8
8
|
get 'cities/view/:cityname', :to => 'cities#show'
|
9
9
|
get 'cities/features', :to => 'cities#features'
|
10
10
|
|
11
|
-
## @TODO: remove all co-tailors stuff
|
12
|
-
=begin
|
13
|
-
post 'co_tailors/orders', :to => 'orders#create'
|
14
|
-
post 'co_tailors/order_items', :to => 'order_items#create'
|
15
|
-
post 'co_tailors/measurements', :to => 'measurements#update'
|
16
|
-
get 'co_tailors/products/by-kind/:kind', :to => 'products#show'
|
17
|
-
namespace :co_tailors do
|
18
|
-
end
|
19
|
-
=end
|
20
|
-
|
21
11
|
get 'events/view/:eventname', :to => 'events#show'
|
22
12
|
|
23
13
|
get 'galleries', :to => 'galleries#index'
|
@@ -73,6 +63,7 @@ Ishapi::Engine.routes.draw do
|
|
73
63
|
get 'users/profile', to: 'users#show' # @TODO: only for testing! accessToken must be hidden
|
74
64
|
match 'users/long_term_token', to: 'application#long_term_token', via: [ :get, :post ]
|
75
65
|
post 'users/login', to: 'users#login'
|
66
|
+
post 'users', to: 'users#create'
|
76
67
|
|
77
68
|
get 'venues', :to => 'venues#index'
|
78
69
|
get 'venues/view/:venuename', :to => 'venues#show'
|
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.172
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- piousbox
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-03-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -273,7 +273,6 @@ files:
|
|
273
273
|
- app/controllers/ishapi/sites_controller.rb
|
274
274
|
- app/controllers/ishapi/stock_watches_controller.rb
|
275
275
|
- app/controllers/ishapi/tags_controller.rb
|
276
|
-
- app/controllers/ishapi/unrestricted_controller.rb-trash
|
277
276
|
- app/controllers/ishapi/user_profiles_controller.rb
|
278
277
|
- app/controllers/ishapi/users_controller.rb
|
279
278
|
- app/controllers/ishapi/venues_controller.rb
|
@@ -1,25 +0,0 @@
|
|
1
|
-
module Ishapi
|
2
|
-
class UnrestrictedController < ActionController::Base
|
3
|
-
protect_from_forgery :prepend => true, :with => :exception
|
4
|
-
layout :false
|
5
|
-
|
6
|
-
before_action :set_current_ability
|
7
|
-
|
8
|
-
check_authorization
|
9
|
-
skip_before_action :verify_authenticity_token
|
10
|
-
|
11
|
-
|
12
|
-
private
|
13
|
-
|
14
|
-
|
15
|
-
def set_current_ability
|
16
|
-
@current_ability ||= ::Ishapi::Ability.new( User.new )
|
17
|
-
end
|
18
|
-
|
19
|
-
def puts! a, b=''
|
20
|
-
puts "+++ +++ #{b}"
|
21
|
-
puts a.inspect
|
22
|
-
end
|
23
|
-
|
24
|
-
end
|
25
|
-
end
|