<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">=head1 NAME

FixMyStreet::App::Form::Waste::Billing - billing information for garden subs and renewals

=head1 DESCRIPTION

=cut

package FixMyStreet::App::Form::Waste::Billing;

use utf8;
use HTML::FormHandler::Moose::Role;
use FixMyStreet::SMS;

has_field payment_method =&gt; (
    type =&gt; 'Select',
    label =&gt; 'How do you want to pay?',
    required =&gt; 1,
    widget =&gt; 'RadioGroup',
);

sub options_payment_method {
    my $form = shift;
    my @options = (
        { value =&gt; 'direct_debit', label =&gt; 'Direct Debit', hint =&gt; 'Set up your payment details once, and weâ€™ll automatically renew your subscription each year, until you tell us to stop. You can cancel or amend at any time.', data_hide =&gt; '#form-cheque_reference-row' },
        { value =&gt; 'credit_card', label =&gt; 'Debit or Credit Card', data_hide =&gt; '#form-cheque_reference-row' },
    );
    if ($form-&gt;{c}-&gt;stash-&gt;{waste_features}-&gt;{dd_disabled}) {
        shift @options;
    }
    if ($form-&gt;{c}-&gt;cobrand-&gt;waste_cheque_payments) {
        push @options, { label =&gt; 'Cheque Payment', value =&gt; 'cheque', data_show =&gt; '#form-cheque_reference-row' };
    }
    return @options;
}

has_field cheque_reference =&gt; (
    type =&gt; 'Text',
    label =&gt; 'Payment reference',
    required_when =&gt; { payment_method =&gt; 'cheque' },
);

has_field name =&gt; (
    type =&gt; 'Text',
    label =&gt; 'Full name',
    required =&gt; 1,
    validate_method =&gt; sub {
        my $self = shift;
        $self-&gt;add_error('Please enter your full name.')
            if length($self-&gt;value) &lt; 5
                || $self-&gt;value !~ m/\s/
                || $self-&gt;value =~ m/\ba\s*n+on+((y|o)mo?u?s)?(ly)?\b/i;
    },
);

has_field phone =&gt; (
    type =&gt; 'Text',
    label =&gt; 'Telephone number',
    validate_method =&gt; sub {
        my $self = shift;
        my $parsed = FixMyStreet::SMS-&gt;parse_username($self-&gt;value);
        $self-&gt;add_error('Please provide a valid phone number')
            unless $parsed-&gt;{phone};
    }
);

has_field email =&gt; (
    type =&gt; 'Email',
);

1;
</pre></body></html>