<?php
/**
 * Manual (offline) payment gateway.
 *
 * @package Lucrativeit_Subscription_Recurring_Billing
 */

if ( ! defined( 'ABSPATH' ) ) {
	exit;
}

/**
 * Manual gateway: an invoice is generated and the customer pays out of band.
 */
class LUCRSURE_Manual_Gateway extends LUCRSURE_Abstract_Gateway {

	/**
	 * Constructor.
	 */
	public function __construct() {
		$this->id                  = 'manual';
		$this->title               = __( 'Manual / Offline', 'lucrativeit-subscription-recurring-billing' );
		$this->automatic_recurring = false;
	}

	/**
	 * Whether manual payment is offered on the public checkout page.
	 *
	 * @return bool
	 */
	public function is_enabled() {
		$config = $this->config();

		if ( ! array_key_exists( 'enabled', $config ) ) {
			return true;
		}

		return ! empty( $config['enabled'] );
	}

	/**
	 * {@inheritDoc}
	 */
	public function create_payment( array $invoice ) {
		return array(
			'success'            => true,
			'payment_url'        => '',
			'gateway_payment_id' => '',
			'message'            => __( 'Invoice generated. Awaiting manual payment.', 'lucrativeit-subscription-recurring-billing' ),
		);
	}
}
