| 1 | package SWIFT::Factory::BasicHeader; | ||
| 2 | 1 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 3 | 1 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | |||
| 5 | 1 | ▶ | use vars qw($VERSION); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 6 | 1 | $VERSION = '0.03'; | |
| 7 | |||
| 8 | 1 | ▶ | BEGIN{ |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 9 | 1 | *provide=*string; | |
| 10 | 1 | *borken=*invalid; | |
| 11 | } | ||
| 12 | |||
| 13 | 1 | ▶ | use constant APP_ID_FIN=>'F'; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 14 | 1 | ▶ | use constant APP_ID_GPA=>'A'; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 15 | 1 | ▶ | use constant APP_ID_GPA_LOG=>'L'; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 16 | |||
| 17 | 1 | ▶ | use constant SERVICE_ID_USER_2_USER=>1; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 18 | |||
| 19 | ########################################################################################################### | ||
| 20 | # The Basic Header is block number 1 of a SWIFT message. | ||
| 21 | # This block appears in all SWIFT messages. | ||
| 22 | # | ||
| 23 | # The block is normally built for "input", which in SWIFT | ||
| 24 | # speak means "input to the SWIFT network". | ||
| 25 | # | ||
| 26 | # This module will implement an "Input Basic Header". | ||
| 27 | # | ||
| 28 | # To create an output basic block, subclass this class and | ||
| 29 | # implement the required specifics. | ||
| 30 | ########################################################################################################### | ||
| 31 | 0 | ▶ | sub new { |
|
Subroutine
new: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 32 | 0 | my$self={}; | |
| 33 | 0 | bless($self,shift())->_init(@_); | |
| 34 | } | ||
| 35 | |||
| 36 | ########################################################################################################### | ||
| 37 | # The class cannot guarantee that the provided string will be valid in the SWIFT network. | ||
| 38 | # It can point out that it's found some invalid data, though. | ||
| 39 | # Return number of problems detected. | ||
| 40 | 0 | ▶ | sub invalid { |
|
Subroutine
invalid: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 41 | 0 | my$self=shift; | |
| 42 | |||
| 43 | # Implement verifications here! | ||
| 44 | 0 | 0; | |
| 45 | } | ||
| 46 | |||
| 47 | ########################################################################################################### | ||
| 48 | 0 | ▶ | sub string { |
|
Subroutine
string: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 49 | 0 | my$self=shift; | |
| 50 | '{1:'. | ||
| 51 | $self->{APP_ID}. | ||
| 52 | sprintf("%02u",$self->{SERVICE_ID}). | ||
| 53 | $self->{BIC}. | ||
| 54 | $self->{TERMINAL}. | ||
| 55 | $self->{BRANCH_CODE}. | ||
| 56 | sprintf("%04u",$self->{SESS_NBR}). | ||
| 57 | 0 | sprintf("%06u",$self->{I_SEQ_NBR}). | |
| 58 | '}'; | ||
| 59 | } | ||
| 60 | |||
| 61 | ########################################################################################################### | ||
| 62 | 0 | ▶ | sub _init { |
|
Subroutine
_init: not called CC=1 SCAR=6.9
| |||
| 63 | 0 | my$self=shift; | |
| 64 | 0 | my%args=( | |
| 65 | APPLICATION_ID=>APP_ID_FIN, | ||
| 66 | SERVICE_ID=>SERVICE_ID_USER_2_USER, | ||
| 67 | BIC=>'X'x8, # Reciever BIC for SWIFT input msg. | ||
| 68 | TERMINAL=>'X', # Reciever Terminal for SWIFT input msg. | ||
| 69 | BRANCH_CODE=>'X'x3, # Reciever Branch code for SWIFT input msg. | ||
| 70 | SESSION_NBR=>0, | ||
| 71 | INPUT_SEQUENCE_NBR=>0, | ||
| 72 | @_ | ||
| 73 | ); | ||
| 74 | 0 | $self->{APP_ID}=$args{APPLICATION_ID}; | |
| 75 | 0 | $self->{SERVICE_ID}=$args{SERVICE_ID}; | |
| 76 | 0 | $self->{BIC}=$args{BIC}; | |
| 77 | 0 | $self->{TERMINAL}=$args{TERMINAL}; | |
| 78 | 0 | $self->{BRANCH_CODE}=$args{BRANCH_CODE}; | |
| 79 | 0 | $self->{SESS_NBR}=$args{SESSION_NBR}; | |
| 80 | 0 | $self->{I_SEQ_NBR}=$args{INPUT_SEQUENCE_NBR}; | |
| 81 | 0 | $self; | |
| 82 | } | ||
| 83 | |||
| 84 | ########################################################################################################### | ||
| 85 | 1 | 'Choppers rule'; | |
| 86 | __END__ | ||