ishapi 0.1.8.254 → 0.1.8.259
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/app/controllers/ishapi/application_controller.rb +2 -1
- data/app/controllers/ishapi/galleries_controller.rb +2 -2
- data/app/controllers/ishapi/maps_controller.rb +1 -2
- data/app/controllers/ishapi/payments_controller.rb +38 -30
- data/app/views/ishapi/maps/_show.jbuilder +1 -0
- data/app/views/ishapi/user_profiles/_account.jbuilder +5 -8
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2b2b1dfb4bd9597b2d12c84d53282ee8574c15ef652c4beafbe9238b382c49f3
|
4
|
+
data.tar.gz: c845cd0828bc8316ca4884bd8484637dc04bcc42990cad24b9ea63bafa705ea5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4b5fffc9ea10304e43316a34ef25190e08e7ade5958b2fc2218a41924d93e0fc8ec4c237b7ea4eaf8a892c7dd2fc5a3c2fe8bbcd648c9484424c7e802578828f
|
7
|
+
data.tar.gz: 8b4a8eae4b0af269d71b0e0552e7061b2cf0f97e263b94f813ad7e5b766e488df49483a3c8a7b28223245f0998b007404c9138e9d5166a4a254d4ce663be4b40
|
@@ -10,6 +10,7 @@ class ::Ishapi::ApplicationController < ActionController::Base
|
|
10
10
|
end
|
11
11
|
|
12
12
|
## POST /api/users/long_term_token , a FB login flow
|
13
|
+
## 2023-03-29 _vp_ This should not work, needs to be rewritten.
|
13
14
|
def long_term_token
|
14
15
|
accessToken = request.headers[:accessToken]
|
15
16
|
accessToken ||= params[:accessToken]
|
@@ -27,7 +28,7 @@ class ::Ishapi::ApplicationController < ActionController::Base
|
|
27
28
|
@current_profile = Ish::UserProfile.find_by( email: @current_user.email )
|
28
29
|
|
29
30
|
# send the jwt to client
|
30
|
-
@jwt_token = encode(
|
31
|
+
@jwt_token = encode(user_profile_id: @current_user.profile.id.to_s)
|
31
32
|
|
32
33
|
render json: {
|
33
34
|
email: @current_user.email,
|
@@ -25,7 +25,7 @@ module Ishapi
|
|
25
25
|
respond_to do |format|
|
26
26
|
format.json do
|
27
27
|
|
28
|
-
if @gallery.
|
28
|
+
if @gallery.is_premium
|
29
29
|
if @current_user&.profile&.has_premium_purchase( @gallery )
|
30
30
|
render 'show_premium_unlocked'
|
31
31
|
else
|
@@ -38,7 +38,7 @@ module Ishapi
|
|
38
38
|
end
|
39
39
|
format.html do
|
40
40
|
|
41
|
-
if @gallery.
|
41
|
+
if @gallery.is_premium
|
42
42
|
if @current_user&.profile&.has_premium_purchase( @gallery )
|
43
43
|
render 'show_premium_unlocked'
|
44
44
|
else
|
@@ -18,8 +18,7 @@ class Ishapi::MapsController < Ishapi::ApplicationController
|
|
18
18
|
|
19
19
|
authorize! :show, @map
|
20
20
|
|
21
|
-
@newsitems = @location.newsitems.page( params[:newsitems_page]
|
22
|
-
).per( @location.newsitems_page_size )
|
21
|
+
@newsitems = @location.newsitems.page( params[:newsitems_page] ).per( @location.newsitems_page_size )
|
23
22
|
|
24
23
|
@markers = @map.markers.permitted_to(@current_profile).order_by(ordering: :asc)
|
25
24
|
# case @map.ordering_type
|
@@ -3,51 +3,58 @@ class Ishapi::PaymentsController < ::Ishapi::ApplicationController
|
|
3
3
|
|
4
4
|
before_action :check_profile, only: %i| create unlock |
|
5
5
|
|
6
|
+
protect_from_forgery with: :exception
|
7
|
+
skip_before_action :verify_authenticity_token, only: %i| stripe_confirm |
|
8
|
+
|
6
9
|
# alphabetized : )
|
7
10
|
|
8
11
|
## _vp_ 2020-07-21 This is for guyd
|
9
12
|
## _vp_ 2022-03-01 It's been a while!
|
10
13
|
## _vp_ 2022-09-04 continue
|
14
|
+
## _vp_ 2023-03-29 Continue
|
11
15
|
##
|
12
16
|
## @TODO: cannot proceed if already is_purchasing?
|
13
17
|
## @TODO: and this doesn't say what you're buying! herehere
|
14
18
|
##
|
15
19
|
def create
|
16
|
-
authorize! :create,
|
17
|
-
|
18
|
-
puts! @current_profile, 'current_profile'
|
20
|
+
authorize! :create, Ish::Payment.new
|
19
21
|
|
20
22
|
@current_profile.update_attributes({ is_purchasing: true })
|
21
23
|
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
profile_id: @current_profile.id,
|
37
|
-
)
|
38
|
-
render json: {
|
39
|
-
client_secret: intent.client_secret,
|
40
|
-
clientSecret: intent.client_secret,
|
41
|
-
}
|
42
|
-
|
43
|
-
rescue Mongoid::Errors::DocumentNotFound => e
|
44
|
-
puts! e, '#create2 Mongoid::Errors::DocumentNotFound'
|
45
|
-
render :status => 404, :json => e
|
24
|
+
amount_cents = params[:amount_cents].to_i # @TODO: change
|
25
|
+
|
26
|
+
::Stripe.api_key = ::STRIPE_SK
|
27
|
+
intent = Stripe::PaymentIntent.create({
|
28
|
+
amount: amount_cents,
|
29
|
+
currency: 'usd',
|
30
|
+
metadata: { integration_check: "accept_a_payment" },
|
31
|
+
})
|
32
|
+
|
33
|
+
item_type = case params[:item_type]
|
34
|
+
when 'Ish::Location'
|
35
|
+
'Gameui::Map'
|
36
|
+
else
|
37
|
+
throw "item_type not implemented: #{params[:item_type]}"
|
46
38
|
end
|
39
|
+
item = item_type.constantize.find params[:item_id]
|
40
|
+
|
41
|
+
payment = Ish::Payment.create!(
|
42
|
+
client_secret: intent.client_secret,
|
43
|
+
email: @current_profile.email,
|
44
|
+
item: item,
|
45
|
+
payment_intent_id: intent.id,
|
46
|
+
profile_id: @current_profile.id,
|
47
|
+
)
|
48
|
+
render json: {
|
49
|
+
client_secret: intent.client_secret,
|
50
|
+
clientSecret: intent.client_secret,
|
51
|
+
}
|
52
|
+
|
47
53
|
end
|
48
54
|
|
49
55
|
##
|
50
56
|
## webhook
|
57
|
+
## _vp_ 2023-03-29 Continue
|
51
58
|
##
|
52
59
|
def stripe_confirm
|
53
60
|
authorize! :open_permission, ::Ishapi
|
@@ -62,11 +69,12 @@ class Ishapi::PaymentsController < ::Ishapi::ApplicationController
|
|
62
69
|
end
|
63
70
|
|
64
71
|
payment_intent = event.data.object
|
72
|
+
puts! payment_intent, 'payment_intent'
|
65
73
|
|
66
74
|
payment = Ish::Payment.where( payment_intent_id: payment_intent.id ).first
|
67
75
|
if payment && payment_intent['status'] == 'succeeded'
|
68
76
|
|
69
|
-
payment.update_attributes( status:
|
77
|
+
payment.update_attributes( status: Ish::Payment::STATUS_CONFIRMED )
|
70
78
|
n_unlocks = payment.profile.n_unlocks + 1 # @TODO: it's not always 5, adjust! herehere
|
71
79
|
|
72
80
|
payment.profile.update_attributes!( n_unlocks: n_unlocks, is_purchasing: false )
|
@@ -82,7 +90,7 @@ class Ishapi::PaymentsController < ::Ishapi::ApplicationController
|
|
82
90
|
authorize! :unlock, ::Ish::Payment
|
83
91
|
item = Object::const_get(params['kind']).find params['id']
|
84
92
|
|
85
|
-
existing =
|
93
|
+
existing = Ish::Payment.where( profile: @current_profile, item: item ).first
|
86
94
|
if existing
|
87
95
|
render status: 200, json: { status: :ok, message: 'already purchased' }
|
88
96
|
return
|
@@ -90,7 +98,7 @@ class Ishapi::PaymentsController < ::Ishapi::ApplicationController
|
|
90
98
|
|
91
99
|
@current_profile.inc( n_unlocks: -item.premium_tier )
|
92
100
|
|
93
|
-
purchase = ::
|
101
|
+
purchase = ::Ish::Payment.create!( item: item, profile: @current_profile, )
|
94
102
|
|
95
103
|
@profile = @current_profile
|
96
104
|
render 'ishapi/user_profiles/account'
|
@@ -7,15 +7,12 @@ json.profile_photo_url profile.profile_photo.photo.url( :thumb ) if profile.prof
|
|
7
7
|
json.n_reports profile.reports.count
|
8
8
|
json.n_galleries profile.galleries.count
|
9
9
|
json.n_videos profile.videos.count
|
10
|
-
|
10
|
+
|
11
11
|
json.n_unlocks profile.n_unlocks # @TODO: which one is deprecated?
|
12
12
|
json.is_purchasing profile.is_purchasing
|
13
|
-
if profile.current_city
|
14
|
-
json.current_city profile.current_city
|
15
|
-
end
|
16
13
|
|
17
|
-
json.bookmarks profile.bookmarks do |b|
|
18
|
-
|
19
|
-
|
20
|
-
end
|
14
|
+
# json.bookmarks profile.bookmarks do |b|
|
15
|
+
# json.name b.name
|
16
|
+
# json.slug b.slug
|
17
|
+
# end
|
21
18
|
|
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.259
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- piousbox
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-03-
|
11
|
+
date: 2023-03-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|