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