mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2025-02-21 15:54:22 +01:00
ability to disable the online payments through an env var
This commit is contained in:
parent
d977838d52
commit
539eb08b89
@ -1,10 +1,12 @@
|
|||||||
# Changelog Fab Manager
|
# Changelog Fab Manager
|
||||||
|
|
||||||
|
- Ability to disable online payments though an environment variable
|
||||||
- Log changes in Invoices or InvoiceItems records for better handling of accounting certification issues
|
- Log changes in Invoices or InvoiceItems records for better handling of accounting certification issues
|
||||||
- Upgrade dev environments from ruby 2.3.6 to 2.3.8 (#143)
|
- Upgrade dev environments from ruby 2.3.6 to 2.3.8 (#143)
|
||||||
- Fix a bug: Users with role 'member' cannot download their invoices
|
- Fix a bug: Users with role 'member' cannot download their invoices
|
||||||
- Fix a bug: Wallet credit inputs does not allow to put zeros at the end of the decimal part of the amount
|
- Fix a bug: Wallet credit inputs does not allow to put zeros at the end of the decimal part of the amount
|
||||||
- [TODO DEPLOY] `rake db:migrate`
|
- [TODO DEPLOY] `rake db:migrate`
|
||||||
|
- [TODO DEPLOY] add the `FABLAB_WITHOUT_ONLINE_PAYMENT` environment variable (see [doc/environment.md](doc/environment.md) for configuration details)
|
||||||
- [TODO DEPLOY] -> (only dev) `rvm install ruby-2.3.8 && rvm use && bundle install`
|
- [TODO DEPLOY] -> (only dev) `rvm install ruby-2.3.8 && rvm use && bundle install`
|
||||||
|
|
||||||
## v4.0.4 2019 August 14
|
## v4.0.4 2019 August 14
|
||||||
|
@ -82,6 +82,8 @@ angular.module('application', ['ngCookies', 'ngResource', 'ngSanitize', 'ui.rout
|
|||||||
$rootScope.fablabWithoutPlans = Fablab.withoutPlans;
|
$rootScope.fablabWithoutPlans = Fablab.withoutPlans;
|
||||||
// Global config: it true, the whole 'Spaces' features will be disabled in the application
|
// Global config: it true, the whole 'Spaces' features will be disabled in the application
|
||||||
$rootScope.fablabWithoutSpaces = Fablab.withoutSpaces;
|
$rootScope.fablabWithoutSpaces = Fablab.withoutSpaces;
|
||||||
|
// Global config: if true, all payments will be disabled in the application for the members (only admins will be able to proceed reservations)
|
||||||
|
$rootScope.fablabWithoutOnlinePayment = Fablab.withoutOnlinePayment;
|
||||||
|
|
||||||
// Global function to allow the user to navigate to the previous screen (ie. $state).
|
// Global function to allow the user to navigate to the previous screen (ie. $state).
|
||||||
// If no previous $state were recorded, navigate to the home page
|
// If no previous $state were recorded, navigate to the home page
|
||||||
|
@ -126,8 +126,8 @@ Application.Controllers.controller('EventsController', ['$scope', '$state', 'Eve
|
|||||||
}
|
}
|
||||||
]);
|
]);
|
||||||
|
|
||||||
Application.Controllers.controller('ShowEventController', ['$scope', '$state', '$stateParams', 'Event', '$uibModal', 'Member', 'Reservation', 'Price', 'CustomAsset', 'eventPromise', 'growl', '_t', 'Wallet', 'helpers', 'dialogs', 'priceCategoriesPromise', 'settingsPromise',
|
Application.Controllers.controller('ShowEventController', ['$scope', '$state', '$stateParams', '$rootScope', 'Event', '$uibModal', 'Member', 'Reservation', 'Price', 'CustomAsset', 'eventPromise', 'growl', '_t', 'Wallet', 'helpers', 'dialogs', 'priceCategoriesPromise', 'settingsPromise',
|
||||||
function ($scope, $state, $stateParams, Event, $uibModal, Member, Reservation, Price, CustomAsset, eventPromise, growl, _t, Wallet, helpers, dialogs, priceCategoriesPromise, settingsPromise) {
|
function ($scope, $state, $stateParams, $rootScope, Event, $uibModal, Member, Reservation, Price, CustomAsset, eventPromise, growl, _t, Wallet, helpers, dialogs, priceCategoriesPromise, settingsPromise) {
|
||||||
/* PUBLIC SCOPE */
|
/* PUBLIC SCOPE */
|
||||||
|
|
||||||
// reservations for the currently shown event
|
// reservations for the currently shown event
|
||||||
@ -278,7 +278,11 @@ Application.Controllers.controller('ShowEventController', ['$scope', '$state', '
|
|||||||
return Wallet.getWalletByUser({ user_id: $scope.ctrl.member.id }, function (wallet) {
|
return Wallet.getWalletByUser({ user_id: $scope.ctrl.member.id }, function (wallet) {
|
||||||
const amountToPay = helpers.getAmountToPay($scope.reserve.amountTotal, wallet.amount);
|
const amountToPay = helpers.getAmountToPay($scope.reserve.amountTotal, wallet.amount);
|
||||||
if (($scope.currentUser.role !== 'admin') && (amountToPay > 0)) {
|
if (($scope.currentUser.role !== 'admin') && (amountToPay > 0)) {
|
||||||
return payByStripe(reservation);
|
if ($rootScope.fablabWithoutOnlinePayment) {
|
||||||
|
growl.error(_t('online_payment_disabled'));
|
||||||
|
} else {
|
||||||
|
return payByStripe(reservation);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
if (($scope.currentUser.role === 'admin') || (amountToPay === 0)) {
|
if (($scope.currentUser.role === 'admin') || (amountToPay === 0)) {
|
||||||
return payOnSite(reservation);
|
return payOnSite(reservation);
|
||||||
|
@ -98,7 +98,11 @@ Application.Controllers.controller('PlansIndexController', ['$scope', '$rootScop
|
|||||||
Wallet.getWalletByUser({ user_id: $scope.ctrl.member.id }, function (wallet) {
|
Wallet.getWalletByUser({ user_id: $scope.ctrl.member.id }, function (wallet) {
|
||||||
const amountToPay = helpers.getAmountToPay($scope.cart.total, wallet.amount);
|
const amountToPay = helpers.getAmountToPay($scope.cart.total, wallet.amount);
|
||||||
if (($scope.currentUser.role !== 'admin') && (amountToPay > 0)) {
|
if (($scope.currentUser.role !== 'admin') && (amountToPay > 0)) {
|
||||||
return payByStripe();
|
if ($rootScope.fablabWithoutOnlinePayment) {
|
||||||
|
growl.error(_t('online_payment_disabled'));
|
||||||
|
} else {
|
||||||
|
return payByStripe();
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
if (($scope.currentUser.role === 'admin') || (amountToPay === 0)) {
|
if (($scope.currentUser.role === 'admin') || (amountToPay === 0)) {
|
||||||
return payOnSite();
|
return payOnSite();
|
||||||
|
@ -129,7 +129,11 @@ Application.Directives.directive('cart', [ '$rootScope', '$uibModal', 'dialogs',
|
|||||||
return Wallet.getWalletByUser({ user_id: $scope.user.id }, function (wallet) {
|
return Wallet.getWalletByUser({ user_id: $scope.user.id }, function (wallet) {
|
||||||
const amountToPay = helpers.getAmountToPay($scope.amountTotal, wallet.amount);
|
const amountToPay = helpers.getAmountToPay($scope.amountTotal, wallet.amount);
|
||||||
if (!$scope.isAdmin() && (amountToPay > 0)) {
|
if (!$scope.isAdmin() && (amountToPay > 0)) {
|
||||||
return payByStripe(reservation);
|
if ($rootScope.fablabWithoutOnlinePayment) {
|
||||||
|
growl.error(_t('cart.online_payment_disabled'));
|
||||||
|
} else {
|
||||||
|
return payByStripe(reservation);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
if ($scope.isAdmin() || (amountToPay === 0)) {
|
if ($scope.isAdmin() || (amountToPay === 0)) {
|
||||||
return payOnSite(reservation);
|
return payOnSite(reservation);
|
||||||
|
@ -10,6 +10,8 @@ class API::PaymentsController < API::ApiController
|
|||||||
# was successfully made. After the payment was made, the reservation/subscription will be created
|
# was successfully made. After the payment was made, the reservation/subscription will be created
|
||||||
##
|
##
|
||||||
def confirm_payment
|
def confirm_payment
|
||||||
|
render(json: { error: 'Online payment is disabled' }, status: :unauthorized) and return if Rails.application.secrets.fablab_without_online_payments
|
||||||
|
|
||||||
begin
|
begin
|
||||||
if params[:payment_method_id].present?
|
if params[:payment_method_id].present?
|
||||||
check_coupon
|
check_coupon
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
|
|
||||||
Fablab.withoutPlans = ('<%= Rails.application.secrets.fablab_without_plans %>' == 'true');
|
Fablab.withoutPlans = ('<%= Rails.application.secrets.fablab_without_plans %>' == 'true');
|
||||||
Fablab.withoutSpaces = ('<%= Rails.application.secrets.fablab_without_spaces %>' != 'false');
|
Fablab.withoutSpaces = ('<%= Rails.application.secrets.fablab_without_spaces %>' != 'false');
|
||||||
|
Fablab.withoutOnlinePayment = ('<%= Rails.application.secrets.fablab_without_online_payments %>' == 'true');
|
||||||
Fablab.disqusShortname = "<%= Rails.application.secrets.disqus_shortname %>";
|
Fablab.disqusShortname = "<%= Rails.application.secrets.disqus_shortname %>";
|
||||||
Fablab.defaultHost = "<%= Rails.application.secrets.default_host %>";
|
Fablab.defaultHost = "<%= Rails.application.secrets.default_host %>";
|
||||||
Fablab.gaId = "<%= Rails.application.secrets.google_analytics_id %>";
|
Fablab.gaId = "<%= Rails.application.secrets.google_analytics_id %>";
|
||||||
|
@ -13,6 +13,7 @@ STRIPE_CURRENCY: 'eur'
|
|||||||
INVOICE_PREFIX: Demo-FabLab-facture
|
INVOICE_PREFIX: Demo-FabLab-facture
|
||||||
FABLAB_WITHOUT_PLANS: 'false'
|
FABLAB_WITHOUT_PLANS: 'false'
|
||||||
FABLAB_WITHOUT_SPACES: 'true'
|
FABLAB_WITHOUT_SPACES: 'true'
|
||||||
|
FABLAB_WITHOUT_ONLINE_PAYMENT: 'false'
|
||||||
|
|
||||||
DEFAULT_MAIL_FROM: Fab Manager Demo <noreply@fab-manager.com>
|
DEFAULT_MAIL_FROM: Fab Manager Demo <noreply@fab-manager.com>
|
||||||
|
|
||||||
|
@ -100,6 +100,7 @@ en:
|
|||||||
incomplete_profile: "Incomplete profile"
|
incomplete_profile: "Incomplete profile"
|
||||||
unlimited: "Unlimited"
|
unlimited: "Unlimited"
|
||||||
payment_card_error: "A problem occurred with your payment card:"
|
payment_card_error: "A problem occurred with your payment card:"
|
||||||
|
online_payment_disabled: "Online payment is not available. Please contact the Fablab reception directly."
|
||||||
|
|
||||||
messages:
|
messages:
|
||||||
you_will_lose_any_unsaved_modification_if_you_quit_this_page: "You will lose any unsaved modification if you quit this page"
|
you_will_lose_any_unsaved_modification_if_you_quit_this_page: "You will lose any unsaved modification if you quit this page"
|
||||||
@ -464,3 +465,4 @@ en:
|
|||||||
confirm_payment_of_html: "{ROLE, select, admin{Payment on site} other{Pay}}: {AMOUNT}" # messageFormat interpolation (context: confirm my payment of $20.00)
|
confirm_payment_of_html: "{ROLE, select, admin{Payment on site} other{Pay}}: {AMOUNT}" # messageFormat interpolation (context: confirm my payment of $20.00)
|
||||||
a_problem_occurred_during_the_payment_process_please_try_again_later: "A problem occurred during the payment process. Please try again later."
|
a_problem_occurred_during_the_payment_process_please_try_again_later: "A problem occurred during the payment process. Please try again later."
|
||||||
none: "None"
|
none: "None"
|
||||||
|
online_payment_disabled: "Online payment is not available. Please contact the Fablab reception directly."
|
||||||
|
@ -100,6 +100,7 @@ es:
|
|||||||
incomplete_profile: "Perfil completo"
|
incomplete_profile: "Perfil completo"
|
||||||
unlimited: "Ilimitado"
|
unlimited: "Ilimitado"
|
||||||
payment_card_error: "Hubo un problema con su tarjeta:"
|
payment_card_error: "Hubo un problema con su tarjeta:"
|
||||||
|
online_payment_disabled: "El pago en línea no está disponible. Póngase en contacto directamente con la recepción de Fablab."
|
||||||
|
|
||||||
messages:
|
messages:
|
||||||
you_will_lose_any_unsaved_modification_if_you_quit_this_page: "Si cierra la página se perderán todas las modificaciones que no se hayan guardado"
|
you_will_lose_any_unsaved_modification_if_you_quit_this_page: "Si cierra la página se perderán todas las modificaciones que no se hayan guardado"
|
||||||
@ -464,3 +465,4 @@ es:
|
|||||||
confirm_payment_of_html: "{ROLE, select, admin{Payment on site} other{Pay}}: {AMOUNT}" # messageFormat interpolation (context: confirm my payment of $20.00)
|
confirm_payment_of_html: "{ROLE, select, admin{Payment on site} other{Pay}}: {AMOUNT}" # messageFormat interpolation (context: confirm my payment of $20.00)
|
||||||
a_problem_occurred_during_the_payment_process_please_try_again_later: "A problem occurred during the payment process. Please try again later."
|
a_problem_occurred_during_the_payment_process_please_try_again_later: "A problem occurred during the payment process. Please try again later."
|
||||||
none: "Ninguno"
|
none: "Ninguno"
|
||||||
|
online_payment_disabled: "El pago en línea no está disponible. Póngase en contacto directamente con la recepción de Fablab."
|
||||||
|
@ -100,6 +100,7 @@ fr:
|
|||||||
incomplete_profile: "Profil incomplet"
|
incomplete_profile: "Profil incomplet"
|
||||||
unlimited: "Illimité"
|
unlimited: "Illimité"
|
||||||
payment_card_error: "Un problème est survenu avec votre carte bancaire :"
|
payment_card_error: "Un problème est survenu avec votre carte bancaire :"
|
||||||
|
online_payment_disabled: "Le payment par carte bancaire n'est pas disponible. Merci de contacter directement l'accueil du Fablab."
|
||||||
|
|
||||||
messages:
|
messages:
|
||||||
you_will_lose_any_unsaved_modification_if_you_quit_this_page: "Vous perdrez les modifications non enregistrées si vous quittez cette page"
|
you_will_lose_any_unsaved_modification_if_you_quit_this_page: "Vous perdrez les modifications non enregistrées si vous quittez cette page"
|
||||||
@ -464,3 +465,4 @@ fr:
|
|||||||
confirm_payment_of_html: "{ROLE, select, admin{Paiement sur place} other{Payer}} : {AMOUNT}" # messageFormat interpolation (contexte : valider mon paiement de 20,00 €)
|
confirm_payment_of_html: "{ROLE, select, admin{Paiement sur place} other{Payer}} : {AMOUNT}" # messageFormat interpolation (contexte : valider mon paiement de 20,00 €)
|
||||||
a_problem_occurred_during_the_payment_process_please_try_again_later: "Il y a eu un problème lors de la procédure de paiement. Veuillez réessayer plus tard."
|
a_problem_occurred_during_the_payment_process_please_try_again_later: "Il y a eu un problème lors de la procédure de paiement. Veuillez réessayer plus tard."
|
||||||
none: "Aucune"
|
none: "Aucune"
|
||||||
|
online_payment_disabled: "Le payment par carte bancaire n'est pas disponible. Merci de contacter directement l'accueil du Fablab."
|
||||||
|
@ -100,6 +100,7 @@ pt:
|
|||||||
incomplete_profile: "Perfil incompleto"
|
incomplete_profile: "Perfil incompleto"
|
||||||
unlimited: "Ilimitado"
|
unlimited: "Ilimitado"
|
||||||
payment_card_error: "A problem occurred with your payment card:" # translation_missing
|
payment_card_error: "A problem occurred with your payment card:" # translation_missing
|
||||||
|
online_payment_disabled: "El pago en línea no está disponible. Póngase en contacto directamente con la recepción de Fablab."
|
||||||
|
|
||||||
messages:
|
messages:
|
||||||
you_will_lose_any_unsaved_modification_if_you_quit_this_page: "Você irá perder todas as modificações não salvas se sair desta página"
|
you_will_lose_any_unsaved_modification_if_you_quit_this_page: "Você irá perder todas as modificações não salvas se sair desta página"
|
||||||
@ -464,3 +465,4 @@ pt:
|
|||||||
confirm_payment_of_html: "{ROLE, select, admin{Pagamento pelo site} other{Pagar}}: {AMOUNT}" # messageFormat interpolation (context: confirm my payment of $20.00)
|
confirm_payment_of_html: "{ROLE, select, admin{Pagamento pelo site} other{Pagar}}: {AMOUNT}" # messageFormat interpolation (context: confirm my payment of $20.00)
|
||||||
a_problem_occurred_during_the_payment_process_please_try_again_later: "Um problema ocorreu durante o processo de pagamento. Por favor tente novamente mais tarde."
|
a_problem_occurred_during_the_payment_process_please_try_again_later: "Um problema ocorreu durante o processo de pagamento. Por favor tente novamente mais tarde."
|
||||||
none: "Vazio"
|
none: "Vazio"
|
||||||
|
online_payment_disabled: "O pagamento online não está disponível. Entre em contato diretamente com a recepção do Fablab."
|
||||||
|
@ -18,6 +18,7 @@ development:
|
|||||||
disqus_shortname: <%= ENV["DISQUS_SHORTNAME"] %>
|
disqus_shortname: <%= ENV["DISQUS_SHORTNAME"] %>
|
||||||
fablab_without_plans: <%= ENV["FABLAB_WITHOUT_PLANS"] %>
|
fablab_without_plans: <%= ENV["FABLAB_WITHOUT_PLANS"] %>
|
||||||
fablab_without_spaces: <%= ENV["FABLAB_WITHOUT_SPACES"] %>
|
fablab_without_spaces: <%= ENV["FABLAB_WITHOUT_SPACES"] %>
|
||||||
|
fablab_without_online_payments: <%= ENV["FABLAB_WITHOUT_ONLINE_PAYMENT"] %>
|
||||||
default_host: <%= ENV["DEFAULT_HOST"] %>
|
default_host: <%= ENV["DEFAULT_HOST"] %>
|
||||||
default_protocol: <%= ENV["DEFAULT_PROTOCOL"] %>
|
default_protocol: <%= ENV["DEFAULT_PROTOCOL"] %>
|
||||||
time_zone: <%= ENV["TIME_ZONE"] %>
|
time_zone: <%= ENV["TIME_ZONE"] %>
|
||||||
@ -53,6 +54,7 @@ test:
|
|||||||
disqus_shortname: fablab-sleede
|
disqus_shortname: fablab-sleede
|
||||||
fablab_without_plans: false
|
fablab_without_plans: false
|
||||||
fablab_without_spaces: false
|
fablab_without_spaces: false
|
||||||
|
fablab_without_online_payments: false
|
||||||
default_host: <%= ENV["DEFAULT_HOST"] %>
|
default_host: <%= ENV["DEFAULT_HOST"] %>
|
||||||
default_protocol: <%= ENV["DEFAULT_PROTOCOL"] %>
|
default_protocol: <%= ENV["DEFAULT_PROTOCOL"] %>
|
||||||
time_zone: Paris
|
time_zone: Paris
|
||||||
@ -88,6 +90,7 @@ staging:
|
|||||||
disqus_shortname: <%= ENV["DISQUS_SHORTNAME"] %>
|
disqus_shortname: <%= ENV["DISQUS_SHORTNAME"] %>
|
||||||
fablab_without_plans: <%= ENV["FABLAB_WITHOUT_PLANS"] %>
|
fablab_without_plans: <%= ENV["FABLAB_WITHOUT_PLANS"] %>
|
||||||
fablab_without_spaces: <%= ENV["FABLAB_WITHOUT_SPACES"] %>
|
fablab_without_spaces: <%= ENV["FABLAB_WITHOUT_SPACES"] %>
|
||||||
|
fablab_without_online_payments: <%= ENV["FABLAB_WITHOUT_ONLINE_PAYMENT"] %>
|
||||||
default_host: <%= ENV["DEFAULT_HOST"] %>
|
default_host: <%= ENV["DEFAULT_HOST"] %>
|
||||||
default_protocol: <%= ENV["DEFAULT_PROTOCOL"] %>
|
default_protocol: <%= ENV["DEFAULT_PROTOCOL"] %>
|
||||||
delivery_method: <%= ENV['DELIVERY_METHOD'] %>
|
delivery_method: <%= ENV['DELIVERY_METHOD'] %>
|
||||||
@ -134,6 +137,7 @@ production:
|
|||||||
disqus_shortname: <%= ENV["DISQUS_SHORTNAME"] %>
|
disqus_shortname: <%= ENV["DISQUS_SHORTNAME"] %>
|
||||||
fablab_without_plans: <%= ENV["FABLAB_WITHOUT_PLANS"] %>
|
fablab_without_plans: <%= ENV["FABLAB_WITHOUT_PLANS"] %>
|
||||||
fablab_without_spaces: <%= ENV["FABLAB_WITHOUT_SPACES"] %>
|
fablab_without_spaces: <%= ENV["FABLAB_WITHOUT_SPACES"] %>
|
||||||
|
fablab_without_online_payments: <%= ENV["FABLAB_WITHOUT_ONLINE_PAYMENT"] %>
|
||||||
default_host: <%= ENV["DEFAULT_HOST"] %>
|
default_host: <%= ENV["DEFAULT_HOST"] %>
|
||||||
default_protocol: <%= ENV["DEFAULT_PROTOCOL"] %>
|
default_protocol: <%= ENV["DEFAULT_PROTOCOL"] %>
|
||||||
delivery_method: <%= ENV['DELIVERY_METHOD'] %>
|
delivery_method: <%= ENV['DELIVERY_METHOD'] %>
|
||||||
|
@ -77,6 +77,11 @@ It is not recommended to disable plans if at least one subscription was took on
|
|||||||
If set to 'false', enable the spaces management and reservation in the application.
|
If set to 'false', enable the spaces management and reservation in the application.
|
||||||
It is not recommended to disable spaces if at least one space reservation was made on the system.
|
It is not recommended to disable spaces if at least one space reservation was made on the system.
|
||||||
|
|
||||||
|
FABLAB_WITHOUT_ONLINE_PAYMENT
|
||||||
|
|
||||||
|
If set to 'true', the online payment won't be available and the you'll be only able to process reservations when logged as admin.
|
||||||
|
Valid stripe API keys are still required, even if you don't require online payments.
|
||||||
|
|
||||||
DEFAULT_MAIL_FROM
|
DEFAULT_MAIL_FROM
|
||||||
|
|
||||||
When sending notification mails, the platform will use this address to identify the sender.
|
When sending notification mails, the platform will use this address to identify the sender.
|
||||||
|
@ -11,6 +11,7 @@ STRIPE_CURRENCY=eur
|
|||||||
INVOICE_PREFIX=Demo-FabLab-facture
|
INVOICE_PREFIX=Demo-FabLab-facture
|
||||||
FABLAB_WITHOUT_PLANS=false
|
FABLAB_WITHOUT_PLANS=false
|
||||||
FABLAB_WITHOUT_SPACES=true
|
FABLAB_WITHOUT_SPACES=true
|
||||||
|
FABLAB_WITHOUT_ONLINE_PAYMENT=true
|
||||||
|
|
||||||
DEFAULT_MAIL_FROM=Fab Manager Demo <noreply@fab-manager.com>
|
DEFAULT_MAIL_FROM=Fab Manager Demo <noreply@fab-manager.com>
|
||||||
DEFAULT_HOST=demo.fab-manager.com
|
DEFAULT_HOST=demo.fab-manager.com
|
||||||
|
Loading…
x
Reference in New Issue
Block a user