mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2025-03-01 23:29:23 +01:00
(fix) cant pay order with coupon
This commit is contained in:
parent
d98082a2c4
commit
6d2239bc15
@ -11,7 +11,7 @@ class Checkout::PaymentService
|
|||||||
|
|
||||||
raise Cart::InactiveProductError unless Orders::OrderService.new.all_products_is_active?(order)
|
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)
|
amount = debit_amount(order)
|
||||||
if operator.privileged? || amount.zero?
|
if operator.privileged? || amount.zero?
|
||||||
|
@ -10,7 +10,7 @@ module Payments::PaymentConcern
|
|||||||
end
|
end
|
||||||
|
|
||||||
def debit_amount(order, coupon_code = nil)
|
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)
|
wallet_debit = get_wallet_debit(order.statistic_profile.user, total)
|
||||||
total - wallet_debit
|
total - wallet_debit
|
||||||
end
|
end
|
||||||
|
Loading…
x
Reference in New Issue
Block a user