The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

SWIFT::Factory::ApplicationHeader - Provide an Application Header Block (Block 2) for a SWIFT message.

SYNOPSIS

  use SWIFT::Factory::ApplicationHeader;
  my $hdr2=SWIFT::Factory::ApplicationHeader->new();

DESCRIPTION

This class is primarily intended to be used by the different SWIFT::Factory::MTnnn modules to provide full SWIFT messages for input to the SWIFT network.

Nevertheless, there is nothing prohibiting an application to directly use this class for whatever purpose.

Given reasonable parameter values in the constructor, the string() method in this class will return an Application Header Block (Block nbr 2) that can be used in a SWIFT message sent to the SWIFT network.

CONSTRUCTOR

new( MESSAGE_TYPE=>300, BIC=>'VALIDBIC', TERMINAL=>'X', BRANCH_CODE=>'XXX', MESSAGE_PRIORITY=>'N', DELIVERY_MONITORING=>1, OBSOLESCENCE_PERIOD=>'' )

    The parameters may be given in arbitrary order. Many parameters have builtin default values. If the calling application doesn't provide the parameter at all, the object will apply the default value.

    MESSAGE_TYPE=>

    Technically optional, but it's hard to see a reason not to provide this parameter.

    A numeric scalar value that indicates the message type being provided. For an MT300 message, use the value 300. For an MT515, use 515. Etc.

    BIC=>

    An eight character scalar value that contains a valid receiver BIC.

    The receiver BIC is technically optional, but it will probably quite rarely make sense to instantiate an object of this class without specifying a BIC.

    TERMINAL=>

    Optional. A one character scalar value that identifies the receiving terminal.

    Default value: 'X'. It is very unusual that the sending party would populate this entity with anything else than the default value. It is thereby recommended that most applications don't provide this parameter at all.

    BRANCH_CODE=>

    Optional. A three character scalar value that identifies the branch code at the receiver.

    Default value: 'XXX'.

    MESSAGE_PRIORITY=>

    Optional. A one character scalar value indicating the requested network priority for the message.

    If given, use one of the values:

     SWIFT::Factory::ApplicationHeader::MSG_PRIORITY_SYSTEM();
     SWIFT::Factory::ApplicationHeader::MSG_PRIORITY_URGENT();
     SWIFT::Factory::ApplicationHeader::MSG_PRIORITY_NORMAL();

    Default value provided by the class:

     SWIFT::Factory::ApplicationHeader::MSG_PRIORITY_NORMAL();

    DELIVERY_MONITORING=>

    Technically optional. SWIFT requires this entity for urgent messages. A one digit numeric scalar value or a zero length string.

    If given, use one of the values:

     SWIFT::Factory::ApplicationHeader::MONITORING_NON_DELIVERY();
     SWIFT::Factory::ApplicationHeader::MONITORING_DELIVERY_NOTIFICATION();
     SWIFT::Factory::ApplicationHeader::MONITORING_DELIVERY_BOTH();

    Default value provided by the class: A zero length string which implies No monitoring.

    OBSOLESCENCE_PERIOD=>

    Optional. A numeric scalar value expressing the delay in units of 5 minutes. I.e. 3 means 15 minutes and 20 means 100 minutes.

    Maximum three digits long. See the relevant SWIFT handbook for details.

    Default value provided by the class: A zero length string which implies No obsolescence period.

Typical example of a constructor

As can be seen above, the constructor can take a high number of parameters. Nevertheless, in most cases only a small subset of these parameters will be provided by the calling application. The object will then provide reasonable default values for the missing parameters.

 use SWIFT::Factory::ApplicationHeader;

 my $h2 = SWIFT::Factory::ApplicationHeader->new(MESSAGE_TYPE=>300,
                                                 BIC=>'VALIDBIC',
                                                 DELIVERY_MONITORING=>SWIFT::Factory::ApplicationHeader->MONITORING_NON_DELIVERY);

PUBLIC CLASS METHODS

Class methods are always called with the fully qualified name, like:

 print SWIFT::Factory::ApplicationHeader::MSG_PRIORITY_SYSTEM();

(The new() constructor is a typical example of a class method.)

MSG_PRIORITY_SYSTEM

Returns a valid code for a SWIFT System message. This can be used to feed the new() constructor with the code for a System message in the MESSAGE_TYPE=> parameter.

MSG_PRIORITY_URGENT

Returns a valid code for an Urgent SWIFT message. This can be used to feed the new() constructor with the code for an Urgent message in the MESSAGE_TYPE=> parameter.

MSG_PRIORITY_NORMAL

Returns a valid code for a Normal SWIFT message. This can be used to explicitly feed the new() constructor with the code for a Normal message in the MESSAGE_TYPE=> parameter, even though this is the default value in the constructor.

MONITORING_NON_DELIVERY

Returns a valid code for requesting a Non delivery message from the SWIFT network.

This can be used to feed the new() constructor with the code for a Non delivery request in the DELIVERY_MONITORING=> parameter.

MONITORING_DELIVERY_NOTIFICATION

Returns a valid code for requesting a Delivery notification message from the SWIFT network.

This can be used to feed the new() constructor with the code for a Delivery notification request in the DELIVERY_MONITORING=> parameter.

MONITORING_DELIVERY_BOTH

Returns a valid code for requesting a combination of a Non delivery message and a Delivery notification message from the SWIFT network.

This can be used to feed the new() constructor with the code for a Combined request in the DELIVERY_MONITORING=> parameter.

PUBLIC OBJECT METHODS

borken()

A really broken alias for invalid(). Will execute exactly the same code as the invalid() method.

invalid()

Will return the number of errors detected in the objects instance data.

The class can never be charged to guarrantee that the provided string() will be fully compliant with the SWIFT standards or SWIFT verification rules. It can only point out known problems in the object as it is curently loaded.

BETA

Please beware that the current implementation of invalid() doesn't check anything at all. Consider it a placeholder for now. When time permits, the method will be filled with validation code.

Return value:

As it stands, the method will always return zero, since it wasn't able to discover any error at all.

provide()

An alias for string(). Will execute exactly the same code as the string() method.

string()

Will return a fully formatted string containing an Application Header Block 2 for a SWIFT message.

VERSION()

Will return the version of this Perl module. (This method is inherited from the UNIVERSAL class.)

AUTHOR

BIKER, <biker_cpan@hotmail.com>

COPYRIGHT

Copyright (c) 2003, BIKER. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

SEE ALSO

Appropriate SWIFT documentation.

1 POD Error

The following errors were encountered while parsing the POD:

Around line 134:

You can't have =items (as at line 141) unless the first thing after the =over is an =item