Business-DK-FI

 view release on metacpan or  search on metacpan

lib/Business/DK/FI.pm  view on Meta::CPAN

    my $fi_number = generate(1);

    if ($fi_number eq '000000000000018') {
        print "we have a FI number\n";
    }


=head1 DESCRIPTION

FI numbers are numbers used on GIRO payment forms. These can be used to do
online payments in banks or at in physical banks or post offices.

The module currently only supports FI numbers in the following series:

=over

=item * 71

=item * 75

=back

=head1 SUBROUTINES AND METHODS

=head2 validate

Takes a single argument. 15 digit FI number. Returns true (1) or false (0)
indicating whether the provided parameter adheres to specification.

=head2 validateFI

Less intrusive exported variation of L</validate>. It is actually L</validate>
which is wrapping L</validateFI>.

=head2 generate

Simple FI generation method. Takes an arbitrary number adhering to the following requirements: 

=over

=item * length between 1 and 14

=item * value between 1 and 99999999999999

=back

Returns a valid FI number.

=head2 PRIVATE SUBROUTINES AND METHODS

=head2 _calculate_checksum

This method calculates a checksum, it takes a single number as parameter and returns the calculated checksum.

=head2 _calculate_sum

This method calculates a sum it takes a number and a reference to an array of control cifers. It calculates a single sum based on the number and the control cifer and returns this.

=head1 DIAGNOSTICS

All methods B<die> if their API is not respected. Method calls can with success be wrapped in L<Try::Tiny> or C<eval> blocks.

=head1 CONFIGURATION AND ENVIRONMENT

The module requires no special configuration or environment.

=head1 DEPENDENCIES

=over

=item * L<Params::Validate>

=item * L<Readonly>

=item * L<Exporter>

=item * L<English>

=back

=head1 BUGS AND LIMITATIONS

This module has no known bugs or limitations.

=head1 BUG REPORTING

Please report issues via CPAN RT:

=over

=item * L<http://rt.cpan.org/NoAuth/Bugs.html?Dist=Business-DK-FI>

=back

or by sending mail to

=over

=item * C<< <bug-Business-DK-FI@rt.cpan.org> >>

=back

=head1 TEST AND QUALITY

=head2 TEST COVERAGE

    ---------------------------- ------ ------ ------ ------ ------ ------ ------
    File                           stmt   bran   cond    sub    pod   time  total
    ---------------------------- ------ ------ ------ ------ ------ ------ ------
    blib/lib/Business/DK/FI.pm    100.0  100.0    n/a  100.0  100.0   34.8  100.0
    ...b/Class/Business/DK/FI.pm   97.6   83.3    n/a  100.0  100.0   65.2   96.9
    Total                          99.1   90.0    n/a  100.0  100.0  100.0   98.7
    ---------------------------- ------ ------ ------ ------ ------ ------ ------

=head1 QUALITY AND CODING STANDARD

The code passes L<Perl::Critic> tests at severity 1 (I<brutal>) with a set of policies disabled. please see F<t/perlcriticrc> and the list below:

=over

=item * L<Perl::Critic::Policy::ValuesAndExpressions::ProhibitConstantPragma>, please
see: L<http://logiclab.jira.com/wiki/display/OPEN/Perl-Critic-Policy-ValuesAndExpressions-ProhibitConstantPragma>

=item * L<Perl::Critic::Policy::Documentation::RequirePodLinksIncludeText>, this
is listed in the L</TODO> it requires numerous changes to the distribution POD.

=item * L<Perl::Critic::Policy::NamingConventions::Capitalization>, L</validateFI> is exported both as L</validateFI> and L</validate> and B<FI> is our used acronym
so we try to stick to this

=item * L<Perl::Critic::Policy::ControlStructures::ProhibitCStyleForLoops>, this
is for the main algorithm, it was easier to do with a B<C-style for loop>

=item * L<Perl::Critic::Policy::Subroutines::RequireArgUnpacking>, this is due to
the way: L<Params::Validate> is used

=item * L<Perl::Critic::Policy::ValuesAndExpressions::ProhibitMagicNumbers>, we
use long control numbers

=item * L<Perl::Critic:.:Policy::Variables::ProhibitPunctuationVars>

=back

=head1 TODO

Please see the distribution F<TODO> file also and the distribution road map at:
    L<http://logiclab.jira.com/browse/BDKFI#selectedTab=com.atlassian.jira.plugin.system.project%3Aroadmap-panel>

=head1 SEE ALSO

=over

=item * http://www.pbs.dk/

=item * L<Try::Tiny>

=item * L<Business::DK::CVR>

=item * L<Business::DK::CPR>

=item * L<Business::DK::PO>

=item * L<Business::DK::Postalcode>

=item * L<Business::DK::Phonenumber>

=back

=head1 AUTHOR

Jonas B. Nielsen, (jonasbn) - C<< <jonasbn@cpan.org> >>

=head1 COPYRIGHT

Business-DK-FI and related is (C) by Jonas B. Nielsen, (jonasbn) 2009-2016

=head1 LICENSE

Business-DK-FI and related is released under the Artistic License 2.0

See the included license file for details

=cut



( run in 2.195 seconds using v1.01-cache-2.11-cpan-ff9377addf4 )