<?php
/**
 * SeekQuarry/Yioop -- Credit Card Configuration
 *
 * Copyright (C) 2009 - 2026  Chris Pollett chris@pollett.org
 * All rights reserved
 *
 * This file is a no-op stub deliberately placed under a different
 * license from the rest of Yioop. A working implementation that uses
 * stripe.com for payment processing can be obtained from
 * https://www.seekquarry.com/ and dropped into APP_DIR/configs/ to
 * enable real credit card processing.
 *
 * @author Chris Pollett chris@pollett.org
 * @license All rights reserved
 * @link https://www.seekquarry.com/
 * @copyright 2009 - 2026
 * @filesource
 */
namespace seekquarry\yioop\configs;

/**
 * CreditConfig handles taking payment where a site sells keyword
 * advertising.
 *
 * This class is a "blank" implementation that does not charge credit cards
 * An implementation that uses stripe.com for payment processing can be
 * obtained from seekquarry.com. Putting that implementation in the
 * APP_DIR/configs/ folder would that enable real credit card processing in
 * Yioop
 */
class CreditConfig
{
    /**
     * isActive says whether the copy of CreditConfig in use is one that
     * can really take money: charge a card, receive a coin, and so on.
     * The copy that ships with Yioop cannot, and answers no.
     *
     * @return bool whether a real credit card processing class is use
     */
    public static function isActive()
    {
        return false;
    }
    /**
     * getAttribute gives the value a form field should carry, where a
     * payment service wants one of its own on the field it reads. It is
     * looked up by the attribute's name and the value it holds.
     * @param string $name of attribute (usually data-)
     * @param string $value value of attribute
     * @return string field value of the correspond input tag
     */
    public static function getAttribute($name, $value)
    {
        return "data-ignore";
    }
    /**
     * charge takes the money, on the server rather than in the browser,
     * against the card the payment service has already been shown.
     *
     * @param float $amount dollar amount to charge the card
     * @param string $token token issued for transaction from the card
     *      processing agency
     * @param string &$message message to use as for reason for charge
     * @return bool whether or not the charge was successful
     */
    public static function charge($amount, $token, &$message)
    {
        return true;
    }
}
