Frank Dupont > SWIFT-Factory-BasicHeader > SWIFT::Factory::BasicHeader

Download:
SWIFT-Factory-BasicHeader-0.03.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Module Version: 0.03   Source  

NAME ^

SWIFT::Factory::BasicHeader - Provides a Basic Header Block (Block 1) for a SWIFT message.

SYNOPSIS ^

  use SWIFT::Factory::BasicHeader;
  my $hdr1=SWIFT::Factory::BasicHeader->new();

DESCRIPTION ^

This module 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 module for whatever purpose.

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

CONSTRUCTOR ^

new( APPLICATION_ID=>'F', SERVICE_ID=>1, BIC=>'VALIDBIC', TERMINAL=>'X', BRANCH_CODE=>'XXX', SESSION_NBR=>0, INPUT_SEQUENCE_NBR=>0)

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.

APPLICATION_ID=>

Optional. A one character value that indicates the application within which the message is being sent.

Valid values are:

  'F' (FIN = All user-to-user, FIN system and FIN system msgs),
  'A' (GPA = Most GPA system mesgs)
  and
  'L' (Certain GPA msgs, for ex. LOGIN).

  Default value: 'F', which is the most commonly used application.

  To set this value, use one of:

  SWIFT::Factory::BasicHeader->APP_ID_FIN,
  SWIFT::Factory::BasicHeader->APP_ID_GPA,
  and
  SWIFT::Factory::BasicHeader->APP_ID_GPA_LOG.

  Yes, these are 'constants', and yes, since they are class methods they are available before calling the constructor.
  Opposit of the object methods that are functional only after having called the new() constructor.

SERVICE_ID=>

Optional. A numeric value that identifies the type of data that is being sent. Maximum two characters long. See the relevant SWIFT handbook for details.

Default value: 1, which will output as '01'.

BIC=>

Technically optional, but it will probably quite rarely make sense to instantiate an object of this class without specifying a BIC. An eight character value that contains a valid receiver BIC.

TERMINAL=>

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

Default value: 'X'.

BRANCH_CODE=>

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

Default value: 'XXX'.

SESSION_NBR=>

Optional. A numeric value. Maximum four characters long. See the relevant SWIFT handbook for details.

Default value: 0, which will output as '0000'.

INPUT_SEQUENCE_NBR=>

Optional. A numeric value. Maximum six characters long. See the relevant SWIFT handbook for details.

Default value: 0, which will output as '000000'.

Typical example of a constructor

 use SWIFT::Factory::BasicHeader;

 my $h1 = new(APPLICATION_ID=>SWIFT::Factory::BasicHeader->APP_ID_FIN,
              BIC=>'VALIDBIC',
              INPUT_SEQUENCE_NBR=>2)

PUBLIC CLASS METHODS ^

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

 print SWIFT::Factory::BasicHeader::APP_ID_FIN();

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

APP_ID_FIN

Returns a valid code for the Application ID in a SWIFT User-to-user or FIN message. This can be used to explicitly feed the new() constructor with the code for a User-to-user or FIN message in the APPLICATION_ID=> parameter, even though this is the default value in the constructor.

APP_ID_GPA

Returns a valid code for the Application ID in a SWIFT GPA message. This can be used to feed the new() constructor with the code for a normal GPA message in the APPLICATION_ID=> parameter.

APP_ID_GPA_LOG

Returns a valid code for the Application ID in a SWIFT Specific GPA message. This can be used to feed the new() constructor with the code for a Specific GPA message in the APPLICATION_ID=> parameter.

This Application ID is used for some GPA login messages. Please, see the specific SWIFT documentation for details.

SERVICE_ID_USER_2_USER

Returns a valid code for the Service ID in a SWIFT message. There are several values for this ID, but the User-to-user ID is the most commonly used.

This can be used to explicitly feed the new() constructor with the code for a User-to-user message in the SERVICE_ID=> parameter, even though this is the default value in the constructor.

For any other Service ID's, please see the relevant SWIFT documentation. If you frequently use another value, please contact me and I might include the value as a class method in this module.

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 currently 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 a Basic Header Block 1 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.

syntax highlighting: