From b444cdf1ea857f373b17a6a48bbcf2486d798999 Mon Sep 17 00:00:00 2001 From: Flaburgan <flaburgan@geexxx.fr> Date: Tue, 2 Dec 2014 13:29:58 +0100 Subject: [PATCH] Add currency and allow unhosted button to paypal donation --- Changelog.md | 7 +++++- app/views/shared/_donatepod.html.haml | 25 +++++++++++----------- app/views/shared/_right_sections.html.haml | 2 +- config/defaults.yml | 6 +++++- config/diaspora.yml.example | 21 +++++++++++++----- 5 files changed, 40 insertions(+), 21 deletions(-) diff --git a/Changelog.md b/Changelog.md index 3de3e3bd83..b995a511d9 100644 --- a/Changelog.md +++ b/Changelog.md @@ -50,6 +50,11 @@ It is now possible to enable an automatic proxying of external assets, for examp This is disabled by default since it requires the installation of additional packages and might cause some traffic. Check the [wiki page](https://wiki.diasporafoundation.org/Installation/Camo) for more information and detailed installation instructions. +## Paypal unhosted button and currency +Podmins can now set the currency for donations, and use an unhosted button if they can't use +a hosted one. Note: you need to **copy the new settings from diaspora.yml.example to your +diaspora.yml file**. The existing settings from 0.4.x and before will not work any more. + ## Refactor * Redesign contacts page [#5153](https://github.com/diaspora/diaspora/pull/5153) * Improve profile page design on mobile [#5084](https://github.com/diaspora/diaspora/pull/5084) @@ -129,7 +134,7 @@ This is disabled by default since it requires the installation of additional pac * Make the source code URL configurable [#5410](https://github.com/diaspora/diaspora/pull/5410) * Prefill publisher on the tag pages [#5442](https://github.com/diaspora/diaspora/pull/5442) * Allows users to export their data in JSON format from their user settings page [#5354](https://github.com/diaspora/diaspora/pull/5354) - +* Allow to set unhosted button and currency for paypal donation [#5452](https://github.com/diaspora/diaspora/pull/5452) # 0.4.1.2 diff --git a/app/views/shared/_donatepod.html.haml b/app/views/shared/_donatepod.html.haml index 89b1fe7f2c..7bc4fe4de7 100644 --- a/app/views/shared/_donatepod.html.haml +++ b/app/views/shared/_donatepod.html.haml @@ -1,16 +1,15 @@ -- if AppConfig.settings.paypal_hosted_button_id.present? +- if AppConfig.settings.paypal_donations.enable? PayPal: - %form{:action => "https://www.paypal.com/cgi-bin/webscr", :method => "post"} - %input{:name => "cmd", :type => "hidden", :value => "_s-xclick"} - %input{:name => "hosted_button_id", :type => "hidden", :value => AppConfig.settings.paypal_hosted_button_id} - %input{:name => "on0", :type => "hidden", :value => "Type"} - %input{:name => "modify", :type => "hidden", :value => "2"} - %select{:name => "os0"} - %option{:value => "Mocha"} Mocha : $3.00USD - %option{:value => "Americano"} Americano : $5.00USD - %option{:value => "Box o' Joe"} Box o' Joe : $20.00USD - %input{:name => "currency_code", :type => "hidden", :value => "USD"} - %input{:name => "submit", :type => "submit", :value => t('aspects.index.donate')} + %form{action: "https://www.paypal.com/cgi-bin/webscr", method: "post", target: "_blank"} + %input{name: "cmd", type: "hidden", value: "_s-xclick"} + - if AppConfig.settings.paypal_donations.paypal_hosted_button_id.present? + %input{name: "hosted_button_id", type: "hidden", value: AppConfig.settings.paypal_donations.paypal_hosted_button_id} + -if AppConfig.settings.paypal_donations.paypal_unhosted_button_encrypted.present? + %input{name: "encrypted", type: "hidden", value: AppConfig.settings.paypal_donations.paypal_unhosted_button_encrypted} + %input{name: "currency_code", type: "hidden", value: AppConfig.settings.paypal_donations.currency} + %input{name: "submit", type: "submit", value: t('aspects.index.donate')} + - if AppConfig.bitcoin_donation_address Bitcoin: - %input{:type => "text", :id => "bitcoin_address", :value => AppConfig.bitcoin_donation_address, :readonly => true} + %input{type: "text", id: "bitcoin_address", value: AppConfig.bitcoin_donation_address, readonly: true} + diff --git a/app/views/shared/_right_sections.html.haml b/app/views/shared/_right_sections.html.haml index 86899fe8e9..7293937179 100644 --- a/app/views/shared/_right_sections.html.haml +++ b/app/views/shared/_right_sections.html.haml @@ -68,7 +68,7 @@ .content != t('bookmarklet.explanation', :link => link_to(t('bookmarklet.post_something'), bookmarklet_url)) -- if AppConfig.settings.paypal_hosted_button_id.present? || AppConfig.bitcoin_donation_address +- if AppConfig.settings.paypal_donations.enable? || AppConfig.bitcoin_donation_address .section .title .icons-coffee diff --git a/config/defaults.yml b/config/defaults.yml index 0b64dd50bb..0d9cf8bc1e 100644 --- a/config/defaults.yml +++ b/config/defaults.yml @@ -95,7 +95,11 @@ defaults: invitations: open: true count: 25 - paypal_hosted_button_id: + paypal_donations: + enable: false + currency: USD + paypal_hosted_button_id: + paypal_unhosted_button_encrypted: bitcoin_address: community_spotlight: enable: false diff --git a/config/diaspora.yml.example b/config/diaspora.yml.example index 99853fb975..aab2d49b46 100644 --- a/config/diaspora.yml.example +++ b/config/diaspora.yml.example @@ -399,11 +399,22 @@ configuration: ## Section ## invitations on your pod. #count: 25 - ## Paypal donations - ## You can provide the ID of a hosted Paypal button here to allow your users - ## to send donations to help run their pod. If you leave this out your users - ## will see a button to donate to the Diaspora Foundation instead :) - #paypal_hosted_button_id: "change_me" + ## Paypal donations (disabled by default) + ## You can set details for a Paypal button here to allow donations + ## towards running the pod. + ## First, enable the function, then set the currency in which you + ## wish to receive donations, and **either** a hosted button id + ## **or** an encrypted key for an unhosted button. + paypal_donations: ## Section + #enable: false + + ## Currency used (USD, EUR...) + #currency: USD + + ## hosted Paypal button id + #paypal_hosted_button_id: "change_me" + ## OR encrypted key of unhosted button + #paypal_unhosted_button_encrypted: "-----BEGIN PKCS7-----" ## Bitcoin donations ## You can provide a bitcoin address here to allow your users to provide -- GitLab