1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2024-12-01 12:24:28 +01:00

(fix) cant pay order with coupon

This commit is contained in:
Du Peng 2022-09-07 17:24:14 +02:00
parent d98082a2c4
commit 6d2239bc15
2 changed files with 2 additions and 2 deletions

View File

@ -11,7 +11,7 @@ class Checkout::PaymentService
raise Cart::InactiveProductError unless Orders::OrderService.new.all_products_is_active?(order)
CouponService.new.validate(coupon_code, order.statistic_profile.user)
CouponService.new.validate(coupon_code, order.statistic_profile.user.id)
amount = debit_amount(order)
if operator.privileged? || amount.zero?

View File

@ -10,7 +10,7 @@ module Payments::PaymentConcern
end
def debit_amount(order, coupon_code = nil)
total = CouponService.new.apply(order.total, coupon_code, order.statistic_profile.user)
total = CouponService.new.apply(order.total, coupon_code, order.statistic_profile.user.id)
wallet_debit = get_wallet_debit(order.statistic_profile.user, total)
total - wallet_debit
end