<?php

/**
 * Test Payment Gateway for Phone Orders
 * @author Ashok Basnet <ashok.basnet@mtc.co.uk>
 * @package MtcPharmacy\Subscriptions\Classes\PaymentGateways
 * @date 20/08/2025
 */

namespace MtcPharmacy\Subscriptions\Classes\PaymentGateways;

use MtcPharmacy\Subscriptions\Classes\Subscription;
use MtcPharmacy\Subscriptions\Classes\SubscriptionLog;
use MtcPharmacy\Subscriptions\Classes\PaymentGatewayInterface;


class TestPaymentGateway extends PaymentGatewayInterface
{

    public function processPayment()
    {
        $subscription = Subscription::find($this->order->subscription_id);

        $orderObj = new \Order($this->order->id);

        $orderObj->markPaid();

        SubscriptionLog::logPaymentAttempted(
            $subscription,
            $orderObj->getTotalCost(),
            SubscriptionLog::SOURCE_SYSTEM,
            ['command' => 'payment_attempted', 'order_id' => $this->order->id]
        );

        return true;

    }

    public function getPreviousPaymentInfo()
    {
        return null;
    }
}