Feat: Creating PaymentMethods, Setting Fees, Availabilities
This commit is contained in:
@@ -5,6 +5,7 @@ namespace Modules\Core\Payment\Pipelines\Cart;
|
||||
use Closure;
|
||||
use Lunar\DataTypes\Price;
|
||||
use Lunar\Models\Contracts\Cart as CartContract;
|
||||
use Modules\Core\Payment\Models\PaymentMethod;
|
||||
|
||||
final class ApplyCashOnDeliveryFee
|
||||
{
|
||||
@@ -16,7 +17,7 @@ final class ApplyCashOnDeliveryFee
|
||||
public function handle(CartContract $cart, Closure $next): mixed
|
||||
{
|
||||
if (($cart->meta['payment_method'] ?? null) === 'cash-on-delivery') {
|
||||
$fee = (int) config('lunar.payments.types.cash-on-delivery.fee', 0);
|
||||
$fee = (int) (PaymentMethod::where('type', 'cash-on-delivery')->value('data->fee') ?? 0);
|
||||
|
||||
$cart->shippingTotal = new Price(
|
||||
($cart->shippingTotal?->value ?? 0) + $fee,
|
||||
|
||||
Reference in New Issue
Block a user