mirror of
https://github.com/neocities/neocities.git
synced 2025-04-25 01:32:36 +02:00
always use parent site for paypal supporter data
This commit is contained in:
parent
b949154df0
commit
5cfb849554
1 changed files with 9 additions and 7 deletions
|
@ -141,11 +141,13 @@ get '/supporter/paypal/return' do
|
||||||
redirect '/supporter'
|
redirect '/supporter'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
site = current_site.parent || current_site
|
||||||
|
|
||||||
ppr = PayPal::Recurring.new(paypal_recurring_authorization_hash.merge(
|
ppr = PayPal::Recurring.new(paypal_recurring_authorization_hash.merge(
|
||||||
frequency: 1,
|
frequency: 1,
|
||||||
token: params[:token],
|
token: params[:token],
|
||||||
period: :monthly,
|
period: :monthly,
|
||||||
reference: current_site.id.to_s,
|
reference: site.id.to_s,
|
||||||
payer_id: params[:PayerID],
|
payer_id: params[:PayerID],
|
||||||
start_at: 1.month.from_now,
|
start_at: 1.month.from_now,
|
||||||
failed: 3,
|
failed: 3,
|
||||||
|
@ -154,12 +156,12 @@ get '/supporter/paypal/return' do
|
||||||
|
|
||||||
paypal_response = ppr.create_recurring_profile
|
paypal_response = ppr.create_recurring_profile
|
||||||
|
|
||||||
current_site.paypal_token = params[:token]
|
site.paypal_token = params[:token]
|
||||||
current_site.paypal_profile_id = paypal_response.profile_id
|
site.paypal_profile_id = paypal_response.profile_id
|
||||||
current_site.paypal_active = true
|
site.paypal_active = true
|
||||||
current_site.plan_type = 'supporter'
|
site.plan_type = 'supporter'
|
||||||
current_site.plan_ended = false
|
site.plan_ended = false
|
||||||
current_site.save_changes validate: false
|
site.save_changes validate: false
|
||||||
|
|
||||||
redirect '/supporter/thanks'
|
redirect '/supporter/thanks'
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Reference in a new issue