line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Hibiscus::XMLRPC; |
2
|
1
|
|
|
1
|
|
13006
|
use strict; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
26
|
|
3
|
1
|
|
|
1
|
|
456
|
use Moo 2; # or Moo::Lax if you can't have Moo v2 |
|
1
|
|
|
|
|
9135
|
|
|
1
|
|
|
|
|
4
|
|
4
|
1
|
|
|
1
|
|
1364
|
use Filter::signatures; # so the subroutine signatures work on Perls that don't support them |
|
1
|
|
|
|
|
18198
|
|
|
1
|
|
|
|
|
24
|
|
5
|
1
|
|
|
1
|
|
4
|
no warnings 'experimental::signatures'; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
25
|
|
6
|
1
|
|
|
1
|
|
4
|
use feature 'signatures'; |
|
1
|
|
|
|
|
0
|
|
|
1
|
|
|
|
|
19
|
|
7
|
1
|
|
|
1
|
|
471
|
use URI; |
|
1
|
|
|
|
|
2985
|
|
|
1
|
|
|
|
|
22
|
|
8
|
1
|
|
|
1
|
|
457
|
use XMLRPC::PurePerl; |
|
1
|
|
|
|
|
35225
|
|
|
1
|
|
|
|
|
42
|
|
9
|
|
|
|
|
|
|
|
10
|
1
|
|
|
1
|
|
6
|
use vars qw($VERSION); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
458
|
|
11
|
|
|
|
|
|
|
$VERSION = '0.02'; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
=head1 NAME |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
Hibiscus::XMLRPC - talk to Hibiscus via XMLRPC |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
=head1 SYNOPSIS |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
my $client = Hibiscus::XMLRPC->new( |
20
|
|
|
|
|
|
|
url => 'https://127.0.0.1:8080/xmlrpc/', # the default |
21
|
|
|
|
|
|
|
user => $hbciuser, |
22
|
|
|
|
|
|
|
password => $hbcipass, |
23
|
|
|
|
|
|
|
); |
24
|
|
|
|
|
|
|
my $tr = $client->transactions()->get; |
25
|
|
|
|
|
|
|
for my $transaction (@$tr) { |
26
|
|
|
|
|
|
|
... |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
=cut |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
has 'ua' => ( |
32
|
|
|
|
|
|
|
is => 'lazy', |
33
|
|
|
|
|
|
|
default => sub { require Future::HTTP; Future::HTTP->new }, |
34
|
|
|
|
|
|
|
); |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
has 'url' => ( |
37
|
|
|
|
|
|
|
is => 'ro', |
38
|
|
|
|
|
|
|
default => sub { URI->new('https://127.0.0.1:8080/xmlrpc/') }, |
39
|
|
|
|
|
|
|
); |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
has 'user' => ( |
42
|
|
|
|
|
|
|
is => 'rw', |
43
|
|
|
|
|
|
|
); |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
has 'password' => ( |
46
|
|
|
|
|
|
|
is => 'rw', |
47
|
|
|
|
|
|
|
); |
48
|
|
|
|
|
|
|
|
49
|
0
|
0
|
|
0
|
0
|
|
sub call($self,$method,@params) { |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
50
|
0
|
|
|
|
|
|
my $payload = $self->encode_request($method,@params); |
51
|
|
|
|
|
|
|
|
52
|
0
|
|
|
|
|
|
my $url = $self->url; |
53
|
0
|
|
0
|
|
|
|
my( $userinfo ) = $url->userinfo || ''; |
54
|
0
|
|
|
|
|
|
my( $user, $password ) = split /:/, $userinfo; |
55
|
0
|
|
0
|
|
|
|
$user ||= $self->user; |
56
|
0
|
|
0
|
|
|
|
$password ||= $self->password; |
57
|
0
|
|
|
|
|
|
$url->userinfo( "$user:$password" ); |
58
|
|
|
|
|
|
|
|
59
|
0
|
|
|
|
|
|
$self->ua->http_post( |
60
|
|
|
|
|
|
|
$url, |
61
|
|
|
|
|
|
|
$payload, |
62
|
|
|
|
|
|
|
headers => { |
63
|
|
|
|
|
|
|
'Content-Type' => 'text/xml', |
64
|
|
|
|
|
|
|
}, |
65
|
0
|
0
|
|
0
|
|
|
)->then(sub($body, $headers) { |
|
0
|
0
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
66
|
0
|
|
|
|
|
|
Future->done( |
67
|
|
|
|
|
|
|
$self->decode_result($body) |
68
|
|
|
|
|
|
|
); |
69
|
0
|
|
|
|
|
|
}); |
70
|
|
|
|
|
|
|
} |
71
|
|
|
|
|
|
|
|
72
|
0
|
0
|
|
0
|
0
|
|
sub encode_request($self,$method,@params) { |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
73
|
0
|
|
|
|
|
|
XMLRPC::PurePerl->encode_call_xmlrpc($method,@params) |
74
|
|
|
|
|
|
|
} |
75
|
|
|
|
|
|
|
|
76
|
0
|
0
|
|
0
|
0
|
|
sub decode_result($self,$body) { |
|
0
|
0
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
77
|
0
|
|
|
|
|
|
XMLRPC::PurePerl->decode_xmlrpc($body) |
78
|
|
|
|
|
|
|
} |
79
|
|
|
|
|
|
|
|
80
|
0
|
0
|
|
0
|
0
|
|
sub BUILDARGS($class, %options) { |
|
0
|
0
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
# Upgrade strings to URI::URL |
82
|
0
|
0
|
0
|
|
|
|
if( $options{ url } and not ref $options{ url }) { |
83
|
0
|
|
|
|
|
|
$options{ url } = URI->new( $options{ url } ); |
84
|
|
|
|
|
|
|
}; |
85
|
|
|
|
|
|
|
|
86
|
0
|
|
|
|
|
|
\%options |
87
|
|
|
|
|
|
|
} |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=head2 C<< ->transactions %filter >> |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
my $transactions = $jameica->transactions( |
92
|
|
|
|
|
|
|
{ |
93
|
|
|
|
|
|
|
"datum:min" => '2015-01-01', # or '01.01.2015' |
94
|
|
|
|
|
|
|
'datum:max' => '2015-12-31', # or '31.12.2015' |
95
|
|
|
|
|
|
|
} |
96
|
|
|
|
|
|
|
)->get; |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
Fetches all transactions that match the given filter and returns |
99
|
|
|
|
|
|
|
them as an arrayref. If no filter is given, all transactions are returned. |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
The keys for each transaction are: |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
{ |
104
|
|
|
|
|
|
|
'konto_id' => '99', |
105
|
|
|
|
|
|
|
'betrag' => '-999,99', |
106
|
|
|
|
|
|
|
'gvcode' => '835', |
107
|
|
|
|
|
|
|
'zweck' => 'Zins 999,99 Tilg 999,99', |
108
|
|
|
|
|
|
|
'datum' => '2016-04-29', |
109
|
|
|
|
|
|
|
'customer_ref' => 'NONREF', |
110
|
|
|
|
|
|
|
'valuta' => '2016-04-30', |
111
|
|
|
|
|
|
|
'id' => '657', |
112
|
|
|
|
|
|
|
'umsatz_typ' => 'Kredit', |
113
|
|
|
|
|
|
|
'empfaenger_name' => 'IBAN ...', |
114
|
|
|
|
|
|
|
'saldo' => '99999.99' |
115
|
|
|
|
|
|
|
}, |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
See L |
118
|
|
|
|
|
|
|
for the list of allowed parameters. |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
=cut |
121
|
|
|
|
|
|
|
|
122
|
0
|
0
|
|
0
|
1
|
|
sub transactions($self, %filter) { |
|
0
|
0
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
123
|
0
|
|
|
|
|
|
$self->call( |
124
|
|
|
|
|
|
|
'hibiscus.xmlrpc.umsatz.list', |
125
|
|
|
|
|
|
|
\%filter |
126
|
|
|
|
|
|
|
) |
127
|
|
|
|
|
|
|
} |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
1; |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
__END__ |