Revision d21df2ea
Von Steven Schubiger vor etwa 2 Jahren hinzugefügt
SL/Helper/QrBill.pm | ||
---|---|---|
30 | 30 |
# constructor. |
31 | 31 |
sub _init { |
32 | 32 |
my $self = shift; |
33 |
my ($biller_information, $biller_data, $payment_information, $invoice_recipient_data, $ref_nr_data) = @_; |
|
33 |
my ($biller_information, $biller_data, $payment_information, $invoice_recipient_data, $ref_nr_data, $additional_information) = @_;
|
|
34 | 34 |
|
35 | 35 |
my $address = sub { |
36 | 36 |
my ($href) = @_; |
... | ... | |
70 | 70 |
$ref_nr_data->{ref_number}, |
71 | 71 |
]; |
72 | 72 |
$self->{data}{additional_information} = [ |
73 |
'',
|
|
73 |
$additional_information->{unstructured_message},
|
|
74 | 74 |
'EPD', # End Payment Data |
75 | 75 |
]; |
76 | 76 |
} |
... | ... | |
79 | 79 |
# if conditions are not matched. |
80 | 80 |
sub _init_check { |
81 | 81 |
my $self = shift; |
82 |
my ($biller_information, $biller_data, $payment_information, $invoice_recipient_data, $ref_nr_data) = @_; |
|
82 |
my ($biller_information, $biller_data, $payment_information, $invoice_recipient_data, $ref_nr_data, $additional_information) = @_;
|
|
83 | 83 |
|
84 | 84 |
my $check_re = sub { |
85 | 85 |
my ($group, $href, $elem, $regex) = @_; |
... | ... | |
127 | 127 |
'reference number data' => [ |
128 | 128 |
[ 'type', qr{^(?:QRR|NON)$} ], |
129 | 129 |
], |
130 |
'additional information' => [ |
|
131 |
[ 'unstructured_message', qr{^.{0,140}$} ], |
|
132 |
], |
|
130 | 133 |
additional => { |
131 | 134 |
'ref_nr' => { |
132 | 135 |
QRR => qr{^\d{27}$}, |
... | ... | |
190 | 193 |
if ($ref_nr_data->{type} eq 'QRR') { |
191 | 194 |
$check_re->($group, $biller_information, 'iban', $regexes{additional}->{qr_iban}); |
192 | 195 |
} |
196 |
|
|
197 |
$group = 'additional information'; |
|
198 |
foreach my $re (@{$regexes{$group}}) { |
|
199 |
$check_re->($group, $additional_information, @$re); |
|
200 |
} |
|
193 | 201 |
} |
194 | 202 |
|
195 | 203 |
# Generate the QR-Code image by calling internal methods. |
... | ... | |
293 | 301 |
\%payment_information, |
294 | 302 |
\%invoice_recipient_data, |
295 | 303 |
\%ref_nr_data, |
304 |
\%additional_information, |
|
296 | 305 |
); |
297 | 306 |
$qr_image->generate($out_file); |
298 | 307 |
} or do { |
... | ... | |
308 | 317 |
|
309 | 318 |
=head2 C<new> |
310 | 319 |
|
311 |
Creates a new object. Expects five references to hashes as arguments.
|
|
320 |
Creates a new object. Expects six references to hashes as arguments.
|
|
312 | 321 |
|
313 | 322 |
The hashes are structured as follows: |
314 | 323 |
|
... | ... | |
452 | 461 |
|
453 | 462 |
=back |
454 | 463 |
|
464 |
=item C<%additional_information> |
|
465 |
|
|
466 |
Fields: unstructured_message. |
|
467 |
|
|
468 |
=over 4 |
|
469 |
|
|
470 |
=item C<unstructured_message> |
|
471 |
|
|
472 |
Maximum of 140 characters, unstructured message. |
|
473 |
|
|
474 |
=back |
|
475 |
|
|
455 | 476 |
=back |
456 | 477 |
|
457 | 478 |
=head2 C<generate> |
Auch abrufbar als: Unified diff
Swiss QR-Bill: QrBill.pm: Verarbeite/validiere die unstrukturierte Mitteilung