| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Stancer::Core::Iterator::Payment; |
|
2
|
|
|
|
|
|
|
|
|
3
|
13
|
|
|
13
|
|
342150
|
use 5.020; |
|
|
13
|
|
|
|
|
59
|
|
|
4
|
13
|
|
|
13
|
|
85
|
use strict; |
|
|
13
|
|
|
|
|
27
|
|
|
|
13
|
|
|
|
|
403
|
|
|
5
|
13
|
|
|
13
|
|
76
|
use warnings; |
|
|
13
|
|
|
|
|
136
|
|
|
|
13
|
|
|
|
|
1117
|
|
|
6
|
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
# ABSTRACT: Iterate through payments |
|
8
|
|
|
|
|
|
|
our $VERSION = '1.0.3'; # VERSION |
|
9
|
|
|
|
|
|
|
|
|
10
|
13
|
|
|
13
|
|
7485
|
use Stancer::Exceptions::InvalidSearchOrderId; |
|
|
13
|
|
|
|
|
62
|
|
|
|
13
|
|
|
|
|
607
|
|
|
11
|
13
|
|
|
13
|
|
8794
|
use Stancer::Exceptions::InvalidSearchUniqueId; |
|
|
13
|
|
|
|
|
62
|
|
|
|
13
|
|
|
|
|
733
|
|
|
12
|
13
|
|
|
13
|
|
1074
|
use Stancer::Payment; |
|
|
13
|
|
|
|
|
40
|
|
|
|
13
|
|
|
|
|
445
|
|
|
13
|
|
|
|
|
|
|
|
|
14
|
13
|
|
|
13
|
|
90
|
use Moo; |
|
|
13
|
|
|
|
|
33
|
|
|
|
13
|
|
|
|
|
99
|
|
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
extends 'Stancer::Core::Iterator'; |
|
17
|
|
|
|
|
|
|
|
|
18
|
13
|
|
|
13
|
|
6246
|
use namespace::clean; |
|
|
13
|
|
|
|
|
37
|
|
|
|
13
|
|
|
|
|
92
|
|
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub _create_element { |
|
22
|
37
|
|
|
37
|
|
266
|
my ($class, @args) = @_; |
|
23
|
|
|
|
|
|
|
|
|
24
|
37
|
|
|
|
|
2014
|
return Stancer::Payment->new(@args); |
|
25
|
|
|
|
|
|
|
} |
|
26
|
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub _element_key { |
|
28
|
6
|
|
|
6
|
|
79
|
return 'payments'; |
|
29
|
|
|
|
|
|
|
} |
|
30
|
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
sub search { |
|
33
|
36
|
|
|
36
|
1
|
144
|
my ($class, @args) = @_; |
|
34
|
36
|
|
|
|
|
132
|
my $data; |
|
35
|
36
|
|
|
|
|
127
|
my $params = {}; |
|
36
|
|
|
|
|
|
|
|
|
37
|
36
|
100
|
|
|
|
186
|
if (scalar @args == 1) { |
|
38
|
5
|
|
|
|
|
20
|
$data = $args[0]; |
|
39
|
|
|
|
|
|
|
} else { |
|
40
|
31
|
|
|
|
|
175
|
$data = {@args}; |
|
41
|
|
|
|
|
|
|
} |
|
42
|
|
|
|
|
|
|
|
|
43
|
36
|
100
|
|
|
|
340
|
$params->{created} = $class->_search_filter_created($data) if defined $data->{created}; |
|
44
|
32
|
100
|
|
|
|
215
|
$params->{created_until} = $class->_search_filter_created_until($data) if defined $data->{created_until}; |
|
45
|
27
|
100
|
|
|
|
202
|
$params->{limit} = $class->_search_filter_limit($data) if defined $data->{limit}; |
|
46
|
24
|
100
|
|
|
|
431
|
$params->{start} = $class->_search_filter_start($data) if defined $data->{start}; |
|
47
|
|
|
|
|
|
|
|
|
48
|
22
|
100
|
|
|
|
192
|
$params->{order_id} = $class->_search_filter_order_id($data) if defined $data->{order_id}; |
|
49
|
21
|
100
|
|
|
|
151
|
$params->{unique_id} = $class->_search_filter_unique_id($data) if defined $data->{unique_id}; |
|
50
|
|
|
|
|
|
|
|
|
51
|
20
|
|
|
|
|
222
|
return $class->SUPER::search($params); |
|
52
|
|
|
|
|
|
|
} |
|
53
|
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
sub _search_filter_order_id { |
|
55
|
10
|
|
|
10
|
|
45
|
my ($class, $data) = @_; |
|
56
|
10
|
|
|
|
|
42
|
my $len = length $data->{order_id}; |
|
57
|
|
|
|
|
|
|
|
|
58
|
10
|
100
|
|
|
|
61
|
if ($len > 36) { |
|
59
|
1
|
|
|
|
|
4
|
my $message = 'Invalid order ID.'; |
|
60
|
|
|
|
|
|
|
|
|
61
|
1
|
|
|
|
|
19
|
Stancer::Exceptions::InvalidSearchOrderId->throw(message => $message); |
|
62
|
|
|
|
|
|
|
} |
|
63
|
|
|
|
|
|
|
|
|
64
|
9
|
|
|
|
|
54
|
return $data->{order_id}; |
|
65
|
|
|
|
|
|
|
} |
|
66
|
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
sub _search_filter_unique_id { |
|
68
|
3
|
|
|
3
|
|
11
|
my ($class, $data) = @_; |
|
69
|
3
|
|
|
|
|
10
|
my $len = length $data->{unique_id}; |
|
70
|
|
|
|
|
|
|
|
|
71
|
3
|
100
|
|
|
|
39
|
Stancer::Exceptions::InvalidSearchUniqueId->throw() if $len > 36; |
|
72
|
|
|
|
|
|
|
|
|
73
|
2
|
|
|
|
|
10
|
return $data->{unique_id}; |
|
74
|
|
|
|
|
|
|
} |
|
75
|
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
1; |
|
77
|
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
__END__ |
|
79
|
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=pod |
|
81
|
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
=encoding UTF-8 |
|
83
|
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=head1 NAME |
|
85
|
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
Stancer::Core::Iterator::Payment - Iterate through payments |
|
87
|
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=head1 VERSION |
|
89
|
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
version 1.0.3 |
|
91
|
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
93
|
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
You should not use this class directly. |
|
95
|
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
This module is an internal class, regrouping method for every API object list. |
|
97
|
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=head1 METHODS |
|
99
|
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
=head2 C<< Stancer::Core::Iterator::Payment->new(I<$sub>) : I<self> >> |
|
101
|
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
Create a new iterator. |
|
103
|
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
A subroutine, C<$sub> is mandatory, it will be used on every iteration. |
|
105
|
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
=head2 C<< $iterator->next() : I<Payment>|I<undef> >> |
|
107
|
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
Return the next payment object or C<undef> if no more element to iterate. |
|
109
|
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
=head2 C<< Stancer::Core::Iterator::Payment->search(I<%terms>) : I<self> >> |
|
111
|
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
=head2 C<< Stancer::Core::Iterator::Payment->search(I<\%terms>) : I<self> >> |
|
113
|
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
You may use L<Stancer::Payment/list> instead. |
|
115
|
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
=head1 USAGE |
|
117
|
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
=head2 Logging |
|
119
|
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
We use the L<Log::Any> framework for logging events. |
|
123
|
|
|
|
|
|
|
You may tell where it should log using any available L<Log::Any::Adapter> module. |
|
124
|
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
For example, to log everything to a file you just have to add a line to your script, like this: |
|
126
|
|
|
|
|
|
|
#! /usr/bin/env perl |
|
127
|
|
|
|
|
|
|
use Log::Any::Adapter (File => '/var/log/payment.log'); |
|
128
|
|
|
|
|
|
|
use Stancer::Core::Iterator::Payment; |
|
129
|
|
|
|
|
|
|
|
|
130
|
|
|
|
|
|
|
You must import C<Log::Any::Adapter> before our libraries, to initialize the logger instance before use. |
|
131
|
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
You can choose your log level on import directly: |
|
133
|
|
|
|
|
|
|
use Log::Any::Adapter (File => '/var/log/payment.log', log_level => 'info'); |
|
134
|
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
Read the L<Log::Any> documentation to know what other options you have. |
|
136
|
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
=cut |
|
138
|
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
=head1 SECURITY |
|
140
|
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
=over |
|
142
|
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
=item * |
|
144
|
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
Never, never, NEVER register a card or a bank account number in your database. |
|
146
|
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
=item * |
|
148
|
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
Always uses HTTPS in card/SEPA in communication. |
|
150
|
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
=item * |
|
152
|
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
Our API will never give you a complete card/SEPA number, only the last four digits. |
|
154
|
|
|
|
|
|
|
If you need to keep track, use these last four digit. |
|
155
|
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
=back |
|
157
|
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
=cut |
|
159
|
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
=head1 BUGS |
|
161
|
|
|
|
|
|
|
|
|
162
|
|
|
|
|
|
|
Please report any bugs or feature requests on the bugtracker website |
|
163
|
|
|
|
|
|
|
L<https://gitlab.com/wearestancer/library/lib-perl/-/issues> or by email to |
|
164
|
|
|
|
|
|
|
L<bug-stancer@rt.cpan.org|mailto:bug-stancer@rt.cpan.org>. |
|
165
|
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
When submitting a bug or request, please include a test-file or a |
|
167
|
|
|
|
|
|
|
patch to an existing test-file that illustrates the bug or desired |
|
168
|
|
|
|
|
|
|
feature. |
|
169
|
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
=head1 AUTHOR |
|
171
|
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
Joel Da Silva <jdasilva@cpan.org> |
|
173
|
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
|
175
|
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
This software is Copyright (c) 2018-2024 by Stancer / Iliad78. |
|
177
|
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
This is free software, licensed under: |
|
179
|
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
The Artistic License 2.0 (GPL Compatible) |
|
181
|
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
=cut |