diff --git a/CHANGELOG.md b/CHANGELOG.md index 3a557cc01..0c11aee3b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,7 @@ - Fix a bug: unable to create the first user because role member was missing - Fix a bug: disabled groups still appears as available in sign-up modal - Fix a bug: extend a current subscription for a member, does not reset his credits +- Fix a bug: once a reservation was made, the reminder of the paid price is always 0 if a coupon was used - Fix a security issue: updated nokogiri to 1.10.4 to fix [CVE-2019-5477](https://nvd.nist.gov/vuln/detail/CVE-2019-5477) - Fix a security issue: updated eslint-utils to 1.4.2 to fix [GHSA-3gx7-xhv7-5mx3](https://github.com/mysticatea/eslint-utils/security/advisories/GHSA-3gx7-xhv7-5mx3) - Fix a security issue: updated devise to 4.7.1 to fix [CVE-2019-16109](https://nvd.nist.gov/vuln/detail/CVE-2019-16109) diff --git a/app/assets/javascripts/directives/cart.js.erb b/app/assets/javascripts/directives/cart.js.erb index 547e5268c..75dcce2f0 100644 --- a/app/assets/javascripts/directives/cart.js.erb +++ b/app/assets/javascripts/directives/cart.js.erb @@ -48,6 +48,9 @@ Application.Directives.directive('cart', [ '$rootScope', '$uibModal', 'dialogs', // total amount of the elements in the cart, without considering any coupon $scope.totalNoCoupon = 0; + // once the cart was paid, retain the total amount paid by the customer + $scope.amountPaid = 0; + // Discount coupon to apply to the basket, if any $scope.coupon = { applied: null }; @@ -240,8 +243,8 @@ Application.Directives.directive('cart', [ '$rootScope', '$uibModal', 'dialogs', } }); // watch when a coupon is applied to re-compute the total price - return $scope.$watch('coupon.applied', function (newValue, oldValue) { - if ((newValue !== null) || (oldValue !== null)) { + $scope.$watch('coupon.applied', function (newValue, oldValue) { + if (newValue !== oldValue) { return updateCartPrice(); } }); @@ -588,6 +591,7 @@ Application.Directives.directive('cart', [ '$rootScope', '$uibModal', 'dialogs', var afterPayment = function (reservation) { // we set the cart content as 'paid' to display a summary of the transaction $scope.events.paid = $scope.events.reserved; + $scope.amountPaid = $scope.amountTotal; // we call the external callback if present if (typeof $scope.afterPayment === 'function') { $scope.afterPayment(reservation); } // we reset the coupon and the cart content and we unselect the slot diff --git a/app/assets/templates/shared/_cart.html.erb b/app/assets/templates/shared/_cart.html.erb index 76e4918ec..4a7179243 100644 --- a/app/assets/templates/shared/_cart.html.erb +++ b/app/assets/templates/shared/_cart.html.erb @@ -78,7 +78,7 @@ -
{{ 'cart.total_' | translate }} {{amountTotal | currency}}
+
{{ 'cart.total_' | translate }} {{amountPaid | currency}}
{{ 'cart.thank_you_your_payment_has_been_successfully_registered' | translate }}
{{ 'cart.your_invoice_will_be_available_soon_from_your_' | translate }} {{ 'cart.dashboard' }} @@ -164,4 +164,4 @@
- \ No newline at end of file +