diff --git a/app/controllers/api/payments_controller.rb b/app/controllers/api/payments_controller.rb index 2d11b9963..6fb1d1296 100644 --- a/app/controllers/api/payments_controller.rb +++ b/app/controllers/api/payments_controller.rb @@ -40,11 +40,7 @@ class API::PaymentsController < API::ApiController end def check_plan - plan_id = if params[:cart_items][:subscription] - subscription_params[:plan_id] - elsif params[:cart_items][:reservation] - reservation_params[:plan_id] - end + plan_id = (cart_items_params[:subscription][:plan_id] if cart_items_params[:subscription]) return unless plan_id @@ -106,7 +102,7 @@ class API::PaymentsController < API::ApiController end def reservation_params - params[:cart_items].require(:reservation).permit(:reservable_id, :reservable_type, :plan_id, :nb_reserve_places, + params[:cart_items].require(:reservation).permit(:reservable_id, :reservable_type, :nb_reserve_places, tickets_attributes: %i[event_price_category_id booked], slots_attributes: %i[id start_at end_at availability_id offered]) end @@ -116,9 +112,12 @@ class API::PaymentsController < API::ApiController end def cart_items_params - params[:cart_items].require(:reservation).permit(:reservable_id, :reservable_type, :plan_id, :user_id, :nb_reserve_places, - tickets_attributes: %i[event_price_category_id booked], - slots_attributes: %i[id start_at end_at availability_id offered]) + params.require(:cart_items).permit(subscription: :plan_id, + reservation: [ + :reservable_id, :reservable_type, :nb_reserve_places, + tickets_attributes: %i[event_price_category_id booked], + slots_attributes: %i[id start_at end_at availability_id offered] + ]) end def coupon_params diff --git a/app/frontend/src/javascript/components/payment/stripe/stripe-form.tsx b/app/frontend/src/javascript/components/payment/stripe/stripe-form.tsx index 1a6ca8234..70a7ef4d9 100644 --- a/app/frontend/src/javascript/components/payment/stripe/stripe-form.tsx +++ b/app/frontend/src/javascript/components/payment/stripe/stripe-form.tsx @@ -7,7 +7,7 @@ import { PaymentConfirmation } from '../../../models/payment'; import StripeAPI from '../../../api/stripe'; interface StripeFormProps extends GatewayFormProps { - onSuccess: (result: SetupIntent|PaymentConfirmation|any) => void, + onSuccess: (result: SetupIntent|PaymentConfirmation) => void, } /** diff --git a/app/frontend/src/javascript/directives/cart.js b/app/frontend/src/javascript/directives/cart.js index 3e75f39b7..0d8ca2794 100644 --- a/app/frontend/src/javascript/directives/cart.js +++ b/app/frontend/src/javascript/directives/cart.js @@ -724,7 +724,7 @@ Application.Directives.directive('cart', ['$rootScope', '$uibModal', 'dialogs', return Price.compute(mkCartItems(items, '')).$promise; }, cartItems () { - return mkCartItems(items, 'card'); + return mkCartItems(items, ''); }, wallet () { return Wallet.getWalletByUser({ user_id: $scope.user.id }).$promise; @@ -770,7 +770,7 @@ Application.Directives.directive('cart', ['$rootScope', '$uibModal', 'dialogs', // how should we collect payments for the payment schedule $scope.method = { - payment_method: settings.payment_gateway + payment_method: 'card' }; // "valid" Button label @@ -787,7 +787,7 @@ Application.Directives.directive('cart', ['$rootScope', '$uibModal', 'dialogs', * Callback to process the local payment, triggered on button click */ $scope.ok = function () { - if ($scope.schedule && $scope.method.payment_method === settings.payment_gateway) { + if ($scope.schedule && $scope.method.payment_method === 'card') { // check that the online payment is enabled if (settings.online_payment_module !== 'true') { return growl.error(_t('app.shared.cart.online_payment_disabled')); @@ -865,7 +865,7 @@ Application.Directives.directive('cart', ['$rootScope', '$uibModal', 'dialogs', if (AuthService.isAuthorized(['admin', 'manager']) && $rootScope.currentUser.id !== cartItems.customer_id) { method = $scope.method.payment_method; } else { - method = settings.payment_gateway; + method = 'card'; } } if ($scope.amount > 0) { diff --git a/app/frontend/templates/shared/valid_reservation_modal.html b/app/frontend/templates/shared/valid_reservation_modal.html index 7c0b5cd83..4bfb9b26a 100644 --- a/app/frontend/templates/shared/valid_reservation_modal.html +++ b/app/frontend/templates/shared/valid_reservation_modal.html @@ -22,10 +22,10 @@ -

{{ 'app.shared.valid_reservation_modal.stripe_collection_info' }}

+

{{ 'app.shared.valid_reservation_modal.card_collection_info' }}

{{ 'app.shared.valid_reservation_modal.check_collection_info' }}

@@ -49,8 +49,8 @@