<commit_before><?php namespace Kameli\QuickpayApi\Form;

abstract class Builder
{
    /**
     * The URL for the form action
     */
    const FORM_ACTION = 'https://secure.quickpay.dk/form/';

    /**
     * The protocol version
     * @var int
     */
    protected $protocol = 7;

    /**
     * Test mode status
     * @var int
     */
    protected $testmode = 0;

    /**
     * The Quickpay ID
     * @var int
     */
    protected $merchant;

    /**
     * The md5 checksum
     * @var string
     */
    protected $md5Check;

    /**
     * The form fields
     * @var array
     */
    protected $fields = [];

    /**
     * The custom form fields
     * @var array
     */
    protected $customFields = [];

    /**
     * The fields to include in the md5 checksum
     * @var array
     */
    protected static $md5checkFields = array(
        'protocol',
        'msgtype',
        'merchant',
        'language',
        'ordernumber',
        'amount',
        'currency',
        'continueurl',
        'cancelurl',
        'callbackurl',
        'autocapture',
        'autofee',
        'cardtypelock',
        'description',
        'group',
        'testmode',
        'splitpayment',
        'forcemobile',
        'deadline',
        'cardhash'
    );

    /**
     * Make a new form builder object from the Quickpay account information
     * @param int $quickpayID
     * @param string $md5check
     */
    public function __construct($quickpayID, $md5check) {
        $this->merchant = $quickpayID;
        $this->md5Check = $md5check;
    }

    /**
     * Get the form action
     * @return string
     */
    public function getAction() {
        return static::FORM_ACTION;
    }

    /**
     * Set the language on the payment gateway
     * @param string $code
     * @return $this
     */
    public function setLanguage($code) {
        $this->setField('language', $code);

        return $this;
    }

    /**
     * Set the order number
     * @param string $ordernumber
     * @return $this
     */
    public function setOrdernumber($ordernumber) {
        $this->setField('ordernumber', $ordernumber);

        return $this;
    }

    /**
     * Set the amount in it's smallest unit 1,23 DKK is 123
     * @param int $amount
     * @return $this
     */
    public function setAmount($amount) {
        $this->setField('amount', $amount);

        return $this;
    }

    /**
     * Set the currency
     * @param string $currency
     * @return $this
     */
    public function setCurrency($currency) {
        $this->setField('currency', $currency);

        return $this;
    }

    /**
     * Set the url to redirect to after a successful transaction
     * @param string $url
     * @return $this
     */
    public function setContinueUrl($url) {
        $this->setField('continueurl', $url);

        return $this;
    }

    /**
     * Set the url to redirect to after a cancelled transaction
     * @param string $url
     * @return $this
     */
    public function setCancelUrl($url) {
        $this->setField('cancelurl', $url);

        return $this;
    }

    /**
     * Set the callback url to
     * @param string $url
     * @return $this
     */
    public function setCallbackUrl($url) {
        $this->setField('callbackurl', $url);

        return $this;
    }

    /**
     * Set a field value
     * @param string $name
     * @param mixed $value
     * @return $this
     */
    public function setField($name, $value) {
        $this->fields[$name] = $value;

        return $this;
    }

    /**
     * Set the fields from an array of attributes
     * @param array $inputFields<commit_msg>Add a few more setters<commit_after><?php namespace Kameli\QuickpayApi\Form;

abstract class Builder
{
    /**
     * The URL for the form action
     */
    const FORM_ACTION = 'https://secure.quickpay.dk/form/';

    /**
     * The protocol version
     * @var int
     */
    protected $protocol = 7;

    /**
     * Test mode status
     * @var int
     */
    protected $testmode = 0;

    /**
     * The Quickpay ID
     * @var int
     */
    protected $merchant;

    /**
     * The md5 checksum
     * @var string
     */
    protected $md5Check;

    /**
     * The form fields
     * @var array
     */
    protected $fields = [];

    /**
     * The custom form fields
     * @var array
     */
    protected $customFields = [];

    /**
     * The fields to include in the md5 checksum
     * @var array
     */
    protected static $md5checkFields = array(
        'protocol',
        'msgtype',
        'merchant',
        'language',
        'ordernumber',
        'amount',
        'currency',
        'continueurl',
        'cancelurl',
        'callbackurl',
        'autocapture',
        'autofee',
        'cardtypelock',
        'description',
        'group',
        'testmode',
        'splitpayment',
        'forcemobile',
        'deadline',
        'cardhash'
    );

    /**
     * Make a new form builder object from the Quickpay account information
     * @param int $quickpayID
     * @param string $md5check
     */
    public function __construct($quickpayID, $md5check) {
        $this->merchant = $quickpayID;
        $this->md5Check = $md5check;
    }

    /**
     * Get the form action
     * @return string
     */
    public function getAction() {
        return static::FORM_ACTION;
    }

    /**
     * Set the language on the payment gateway
     * @param string $code
     * @return $this
     */
    public function setLanguage($code) {
        $this->setField('language', $code);

        return $this;
    }

    /**
     * Set the order number
     * @param string $ordernumber
     * @return $this
     */
    public function setOrdernumber($ordernumber) {
        $this->setField('ordernumber', $ordernumber);

        return $this;
    }

    /**
     * Set the amount in it's smallest unit 1,23 DKK is 123
     * @param int $amount
     * @return $this
     */
    public function setAmount($amount) {
        $this->setField('amount', $amount);

        return $this;
    }

    /**
     * Set the currency
     * @param string $currency
     * @return $this
     */
    public function setCurrency($currency) {
        $this->setField('currency', $currency);

        return $this;
    }

    /**
     * Set the url to redirect to after a successful transaction
     * @param string $url
     * @return $this
     */
    public function setContinueUrl($url) {
        $this->setField('continueurl', $url);

        return $this;
    }

    /**
     * Set the url to redirect to after a cancelled transaction
     * @param string $url
     * @return $this
     */
    public function setCancelUrl($url) {
        $this->setField('cancelurl', $url);

        return $this;
    }

    /**
     * Set the callback url to
     * @param string $url
     * @return $this
     */
    public function setCallbackUrl($url) {
        $this->setField('callbackurl', $url);

        return $this;
    }

    /**
     * Set the description
     * @param string $description
     * @return $this
     */
    public function setDescription($description) {
        $this->setField('description', $description);

        return $this;
    }

    /**
     * Enable auto capture
     * @return $this
     */
    public function enableAutocapture() {
        $this->setField('autocapture', 1);

        return $this;
    }

    /**
     * Enable test mode
     * @return $this
     */
    public function enableTestmode() {
        $this->testmode = 1;

        return $this;
    }

    /**
     * Set a field value
     * @param string $name
     * @param mixed $value
     * @return $this
     */
    public function setField($name, $value) {
        $this->fields[$name] = $value;

        return $this;
    }

    /**
     * Set the fields from an array of attributes
     * @param array $inputFields
{'fraction_non_alphanumeric': 0.1249050873196659, 'fraction_numerical': 0.004302708175145533, 'mean_word_length': 1.7661883094154707, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 26, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4925149', 'n_tokens_mistral': 2368, 'n_tokens_neox': 2285, 'n_words': 632}