File Coverage

blib/lib/Regru/API/Bill.pm
Criterion Covered Total %
statement 13 13 100.0
branch n/a
condition n/a
subroutine 5 5 100.0
pod n/a
total 18 18 100.0


line stmt bran cond sub pod time code
1             package Regru::API::Bill;
2              
3             # ABSTRACT: REG.API v2 invoice management
4              
5 1     1   613 use strict;
  1         3  
  1         30  
6 1     1   5 use warnings;
  1         2  
  1         24  
7 1     1   5 use Moo;
  1         1  
  1         7  
8 1     1   2809 use namespace::autoclean;
  1         3  
  1         6  
9              
10             our $VERSION = '0.050'; # VERSION
11             our $AUTHORITY = 'cpan:CHIM'; # AUTHORITY
12              
13             with 'Regru::API::Role::Client';
14              
15             has '+namespace' => (
16             default => sub { 'bill' },
17             );
18              
19 1     1   4 sub available_methods {[qw(
20             nop
21             get_not_payed
22             get_for_period
23             change_pay_type
24             delete
25             )]}
26              
27             __PACKAGE__->namespace_methods;
28             __PACKAGE__->meta->make_immutable;
29              
30             1; # End of Regru::API::Bill
31              
32             __END__
33              
34             =pod
35              
36             =encoding UTF-8
37              
38             =head1 NAME
39              
40             Regru::API::Bill - REG.API v2 invoice management
41              
42             =head1 VERSION
43              
44             version 0.050
45              
46             =head1 DESCRIPTION
47              
48             REG.API invoices management section.
49              
50             =head1 ATTRIBUTES
51              
52             =head2 namespace
53              
54             Always returns the name of category: C<bill>. For internal uses only.
55              
56             =head1 REG.API METHODS
57              
58             =head2 nop
59              
60             For testing purposes. Scope: B<everyone>. Typical usage:
61              
62             $resp = $client->bill->nop(
63             bill_id => 12345,
64             );
65              
66             # or
67             $resp = $client->bill->nop(
68             bills => [ 12345, 12346 ],
69             );
70              
71             Returns payment status for requested invoice or error code (in some cases).
72              
73             More info at L<Invoice management: nop|https://www.reg.com/support/help/api2#bill_nop>.
74              
75             =head2 get_not_payed
76              
77             Obtains a list of unpaid invoices. Scope: B<clients>. Typical usage:
78              
79             $resp = $client->bill->get_not_payed(
80             limit => 10, offset => 40,
81             );
82              
83             Returns a list of unpaind invoices if any.
84              
85             More info at L<Invoice management: get_not_payed|https://www.reg.com/support/help/api2#bill_get_not_payed>.
86              
87             =head2 get_for_period
88              
89             Obtains a list of invoices for the defined period. Scope: B<partners>. Typical usage:
90              
91             $resp = $client->bill->get_for_period(
92             limit => 5,
93             start_date => '1917-10-26',
94             end_date => '1917-10-07',
95             );
96              
97             Returns a list of invoices at given period if any.
98              
99             More info at L<Invoice management: get_for_period|https://www.reg.com/support/help/api2#bill_get_for_period>
100              
101             =head2 change_pay_type
102              
103             This one allows to change payment method for selected invoice(s). Scope: B<clients>. Typical usage:
104              
105             $resp = $client->bill->change_pay_type(
106             bills => [ 12345, 12346 ],
107             pay_type => 'prepay',
108             currency => 'USD',
109             );
110              
111             Returns a list of invoices with payment information and status.
112              
113             More info at L<Invoice management: change_pay_type|https://www.reg.com/support/help/api2#bill_change_pay_type>
114              
115             =head2 delete
116              
117             Allows to delete unpaid invoices. Scope: B<clients>. Typical usage:
118              
119             $resp = $client->bill->delete(
120             bills => [ 12345, 12346, 12347 ],
121             );
122              
123             Returns a list of invoices which requested to delete and its status.
124              
125             More info at L<Invoice management: delete|https://www.reg.com/support/help/api2#bill_delete>
126              
127             =head1 CAVEATS
128              
129             Bear in mind that might be errors during API requests. You should always check API call status.
130             See L<Common error codes|https://www.reg.com/support/help/api2#common_errors>.
131              
132             =head1 SEE ALSO
133              
134             L<Regru::API>
135              
136             L<Regru::API::Role::Client>
137              
138             L<REG.API Invoice management|https://www.reg.com/support/help/api2#bill_functions>
139              
140             L<REG.API Common error codes|https://www.reg.com/support/help/api2#common_errors>
141              
142             =head1 BUGS
143              
144             Please report any bugs or feature requests on the bugtracker website
145             L<https://github.com/regru/regru-api-perl/issues>
146              
147             When submitting a bug or request, please include a test-file or a
148             patch to an existing test-file that illustrates the bug or desired
149             feature.
150              
151             =head1 AUTHORS
152              
153             =over 4
154              
155             =item *
156              
157             Polina Shubina <shubina@reg.ru>
158              
159             =item *
160              
161             Anton Gerasimov <a.gerasimov@reg.ru>
162              
163             =back
164              
165             =head1 COPYRIGHT AND LICENSE
166              
167             This software is copyright (c) 2013 by REG.RU LLC.
168              
169             This is free software; you can redistribute it and/or modify it under
170             the same terms as the Perl 5 programming language system itself.
171              
172             =cut