| 1 | package Finance::Bank::Postbank_de::APIv1::Account; | ||
| 2 | 10 | ▶ | use Moo; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 3 | 10 | ▶ | use Filter::signatures; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | 10 | ▶ | no warnings 'experimental::signatures'; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | 10 | ▶ | use feature 'signatures'; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 6 | 10 | extends 'HAL::Resource'; | |
| 7 | |||
| 8 | 10 | our $VERSION = '0.57'; | |
| 9 | |||
| 10 | =head1 NAME | ||
| 11 | |||
| 12 | Finance::Bank::Postbank_de::APIv1::Account - Postbank Account | ||
| 13 | |||
| 14 | =head1 SYNOPSIS | ||
| 15 | |||
| 16 | for my $account ($bp->get_accounts()) { | ||
| 17 | print $account->productType; | ||
| 18 | print $account->name; | ||
| 19 | print $account->iban; | ||
| 20 | print $account->currency; | ||
| 21 | print $account->amount; | ||
| 22 | } | ||
| 23 | |||
| 24 | =head1 ACCESSORS | ||
| 25 | |||
| 26 | =over 4 | ||
| 27 | |||
| 28 | =item * | ||
| 29 | |||
| 30 | C<accountHolder> | ||
| 31 | |||
| 32 | =item * | ||
| 33 | |||
| 34 | =item * | ||
| 35 | |||
| 36 | C<name> | ||
| 37 | |||
| 38 | =item * | ||
| 39 | |||
| 40 | C<iban> | ||
| 41 | |||
| 42 | =item * | ||
| 43 | |||
| 44 | C<currency> | ||
| 45 | |||
| 46 | =item * | ||
| 47 | |||
| 48 | C<amount> | ||
| 49 | |||
| 50 | =item * | ||
| 51 | |||
| 52 | C<productType> | ||
| 53 | |||
| 54 | =back | ||
| 55 | |||
| 56 | =cut | ||
| 57 | |||
| 58 | 10 | has [ 'accountHolder', 'name', 'iban', 'currency', 'amount', | |
| 59 | 'productType', | ||
| 60 | ] => ( is => 'ro' ); | ||
| 61 | |||
| 62 | =head1 METHODS | ||
| 63 | |||
| 64 | =head2 C<< ->transactions >> | ||
| 65 | |||
| 66 | Returns the transactions in this account as a list | ||
| 67 | of L<Finance::Bank::Postbank_de::APIv1::Transaction> objects. | ||
| 68 | |||
| 69 | =cut | ||
| 70 | |||
| 71 | 0 | ▶ | sub transactions_future( $self ) { |
|
Subroutine
transactions_future: not called CC=1 SCAR=6.9
Pod
undocumented
| |||
| 72 | 0 | ▶ | $self->fetch_resource_future( 'transactions' )->then(sub( $r ) { |
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||
| 73 | $self->inflate_list( | ||
| 74 | 'Finance::Bank::Postbank_de::APIv1::Transaction', | ||
| 75 | $r->_embedded->{transactionDTOList} | ||
| 76 | ) | ||
| 77 | 0 | }); | |
| 78 | } | ||
| 79 | |||
| 80 | 0 | ▶ | sub transactions( $self ) { |
|
Subroutine
transactions: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 81 | 0 | $self->transactions_future->get | |
| 82 | } | ||
| 83 | |||
| 84 | 0 | ▶ | sub transactions_csv_future( $self ) { |
|
Subroutine
transactions_csv_future: not called CC=1 SCAR=6.9
Pod
undocumented
| |||
| 85 | 0 | ▶ | $self->fetch_resource_future( 'transactions' )->then(sub( $r ) { |
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||
| 86 | 0 | my $tr = HAL::Resource->new( %$r ); | |
| 87 | 0 | $self->ua->get( $tr->resource_url('transactions_csv' )); | |
| 88 | 0 | Future->done( $self->ua->content ); | |
| 89 | 0 | }); | |
| 90 | } | ||
| 91 | |||
| 92 | =head2 C<< ->transactions_csv >> | ||
| 93 | |||
| 94 | =cut | ||
| 95 | |||
| 96 | 0 | ▶ | sub transactions_csv( $self ) { |
|
Subroutine
transactions_csv: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 97 | 0 | $self->transactions_csv_future->get | |
| 98 | } | ||
| 99 | |||
| 100 | 0 | ▶ | sub transactions_xml_future( $self ) { |
|
Subroutine
transactions_xml_future: not called CC=1 SCAR=6.9
Pod
undocumented
| |||
| 101 | 0 | ▶ | $self->fetch_resource_future( 'transactions' )->then(sub( $r ) { |
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||
| 102 | 0 | my $tr = HAL::Resource->new( %$r ); | |
| 103 | 0 | $self->ua->get( $tr->resource_url('transactions_xml' )); | |
| 104 | 0 | Future->done( $self->ua->content ); | |
| 105 | 0 | }); | |
| 106 | } | ||
| 107 | |||
| 108 | =head2 C<< ->transactions_xml >> | ||
| 109 | |||
| 110 | =cut | ||
| 111 | |||
| 112 | 0 | ▶ | sub transactions_xml( $self ) { |
|
Subroutine
transactions_xml: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 113 | 0 | $self->transactions_xml_future->get | |
| 114 | } | ||
| 115 | |||
| 116 | =head2 C<< ->is_depot >> | ||
| 117 | |||
| 118 | Returns true if the account is a brokerage account. | ||
| 119 | |||
| 120 | =cut | ||
| 121 | |||
| 122 | 0 | ▶ | sub is_depot( $self ) { |
|
Subroutine
is_depot: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 123 | 0 | $self->productType =~ /^depot$/i | |
| 124 | } | ||
| 125 | |||
| 126 | =head2 C<< ->is_mortgage >> | ||
| 127 | |||
| 128 | Returns true if the account is a mortgage repayment account | ||
| 129 | ("Baufinanzierung"). | ||
| 130 | |||
| 131 | =cut | ||
| 132 | |||
| 133 | 0 | ▶ | sub is_mortgage( $self ) { |
|
Subroutine
is_mortgage: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 134 | 0 | $self->productType =~ /^baufinanzierung$/i | |
| 135 | } | ||
| 136 | |||
| 137 | =head2 C<< ->is_checking >> | ||
| 138 | |||
| 139 | Returns true if the account is a simple checking account. | ||
| 140 | |||
| 141 | =cut | ||
| 142 | |||
| 143 | 0 | ▶ | sub is_checking( $self ) { |
|
Subroutine
is_checking: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 144 | 0 | $self->productType =~ /^giro$/i | |
| 145 | } | ||
| 146 | |||
| 147 | =head2 C<< ->is_savings >> | ||
| 148 | |||
| 149 | Returns true if the account is a simple savings account. | ||
| 150 | |||
| 151 | =cut | ||
| 152 | |||
| 153 | 0 | ▶ | sub is_savings( $self ) { |
|
Subroutine
is_savings: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 154 | 0 | $self->productType =~ /^spar$/i | |
| 155 | } | ||
| 156 | |||
| 157 | =head2 C<< ->is_calldeposit >> | ||
| 158 | |||
| 159 | Returns true if the account is a call deposit account. | ||
| 160 | |||
| 161 | =cut | ||
| 162 | |||
| 163 | 0 | ▶ | sub is_calldeposit( $self ) { |
|
Subroutine
is_calldeposit: not called CC=1 SCAR=6.9
Pod
documented
| |||
| 164 | 0 | $self->productType =~ /^tagesgeld$/i | |
| 165 | } | ||
| 166 | |||
| 167 | 10 | 1; | |
| 168 | |||
| 169 | =head1 AUTHOR | ||
| 170 | |||
| 171 | Max Maischein, E<lt>corion@cpan.orgE<gt> | ||
| 172 | |||
| 173 | =head1 SEE ALSO | ||
| 174 | |||
| 175 | L<perl>, L<WWW::Mechanize>. | ||
| 176 | |||
| 177 | =head1 REPOSITORY | ||
| 178 | |||
| 179 | The public repository of this module is | ||
| 180 | L<https://github.com/Corion/Finance-Bank-Postbank_de>. | ||
| 181 | |||
| 182 | =head1 SUPPORT | ||
| 183 | |||
| 184 | The public support forum of this module is | ||
| 185 | L<https://perlmonks.org/>. | ||
| 186 | |||
| 187 | =head1 BUG TRACKER | ||
| 188 | |||
| 189 | Please report bugs in this module via the RT CPAN bug queue at | ||
| 190 | L<https://rt.cpan.org/Public/Dist/Display.html?Name=Finance-Bank-Postbank_de> | ||
| 191 | or via mail to L<finance-bank-postbank_de-Bugs@rt.cpan.org>. | ||
| 192 | |||
| 193 | =head1 COPYRIGHT (c) | ||
| 194 | |||
| 195 | Copyright 2003-2019 by Max Maischein C<corion@cpan.org>. | ||
| 196 | |||
| 197 | =head1 LICENSE | ||
| 198 | |||
| 199 | This module is released under the same terms as Perl itself. | ||
| 200 | |||
| 201 | =cut | ||