Add 1€ service fee to all order-related pages and Stripe integration

- Added 1€ service fee to order total calculation in Order model
- Updated checkout page to display fee breakdown (subtotal + 1€ fee = total)
- Updated payment success page to show fee breakdown
- Updated order show page to display fee breakdown
- Updated payment cancel page to show fee breakdown
- Modified Stripe session creation to include service fee as separate line item
- Updated order model tests to account for the 1€ service fee
- Enhanced overall pricing transparency for users

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
This commit is contained in:
kbe
2025-09-07 01:29:24 +02:00
parent cc03bfad49
commit 0ede98efa4
7 changed files with 79 additions and 24 deletions

View File

@@ -270,6 +270,19 @@ class OrdersController < ApplicationController
}
end
# Add service fee as a separate line item
line_items << {
price_data: {
currency: "eur",
product_data: {
name: "Frais de service",
description: "Frais de traitement de la commande"
},
unit_amount: 100 # 1€ in cents
},
quantity: 1
}
Stripe::Checkout::Session.create(
payment_method_types: [ "card" ],
line_items: line_items,