| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
7
|
|
|
7
|
|
34
|
use strict; |
|
|
7
|
|
|
|
|
11
|
|
|
|
7
|
|
|
|
|
169
|
|
|
2
|
7
|
|
|
7
|
|
37
|
use warnings; |
|
|
7
|
|
|
|
|
14
|
|
|
|
7
|
|
|
|
|
182
|
|
|
3
|
7
|
|
|
7
|
|
35
|
use MRO::Compat 'c3'; |
|
|
7
|
|
|
|
|
14
|
|
|
|
7
|
|
|
|
|
192
|
|
|
4
|
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
package WebService::Shippo::Transaction; |
|
6
|
7
|
|
|
7
|
|
34
|
use Carp ( 'confess' ); |
|
|
7
|
|
|
|
|
14
|
|
|
|
7
|
|
|
|
|
401
|
|
|
7
|
7
|
|
|
7
|
|
39
|
use Scalar::Util ( 'blessed' ); |
|
|
7
|
|
|
|
|
14
|
|
|
|
7
|
|
|
|
|
348
|
|
|
8
|
7
|
|
|
|
|
2178
|
use base qw( |
|
9
|
|
|
|
|
|
|
WebService::Shippo::Item |
|
10
|
|
|
|
|
|
|
WebService::Shippo::Create |
|
11
|
|
|
|
|
|
|
WebService::Shippo::Fetch |
|
12
|
|
|
|
|
|
|
WebService::Shippo::Async |
|
13
|
7
|
|
|
7
|
|
33
|
); |
|
|
7
|
|
|
|
|
14
|
|
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub api_resource () { 'transactions' } |
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub collection_class () { 'WebService::Shippo::Transactions' } |
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub item_class () { __PACKAGE__ } |
|
20
|
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub get_shipping_label |
|
22
|
|
|
|
|
|
|
{ |
|
23
|
0
|
|
|
0
|
0
|
|
my ( $invocant, $transaction_id, %params ) = @_; |
|
24
|
0
|
0
|
|
|
|
|
confess "Expected a transaction id" |
|
25
|
|
|
|
|
|
|
unless $transaction_id; |
|
26
|
0
|
|
|
|
|
|
my $transaction; |
|
27
|
0
|
0
|
|
|
|
|
if ( $invocant->is_same_object( $transaction_id ) ) { |
|
28
|
0
|
|
|
|
|
|
$transaction = $invocant; |
|
29
|
|
|
|
|
|
|
} |
|
30
|
|
|
|
|
|
|
else { |
|
31
|
0
|
|
|
|
|
|
$transaction = WebService::Shippo::Transaction->fetch( $transaction_id ); |
|
32
|
|
|
|
|
|
|
} |
|
33
|
|
|
|
|
|
|
$transaction->wait_if_status_in( 'QUEUED', 'WAITING' ) |
|
34
|
0
|
0
|
|
|
|
|
unless $params{async}; |
|
35
|
0
|
|
|
|
|
|
return $transaction->label_url; |
|
36
|
|
|
|
|
|
|
} |
|
37
|
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
BEGIN { |
|
39
|
7
|
|
|
7
|
|
40
|
no warnings 'once'; |
|
|
7
|
|
|
|
|
16
|
|
|
|
7
|
|
|
|
|
221
|
|
|
40
|
7
|
|
|
7
|
|
193
|
*Shippo::Transaction:: = *WebService::Shippo::Transaction::; |
|
41
|
|
|
|
|
|
|
} |
|
42
|
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
1; |
|
44
|
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=pod |
|
46
|
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
=encoding utf8 |
|
48
|
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
=head1 NAME |
|
50
|
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
WebService::Shippo::Transaction - Transaction class |
|
52
|
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=head1 VERSION |
|
54
|
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
version 0.0.21 |
|
56
|
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
58
|
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
A Transaction is the purchase of a shipment label for a given shipment |
|
60
|
|
|
|
|
|
|
rate. Transactions can be as simple as posting a rate identifier, but |
|
61
|
|
|
|
|
|
|
also allow you to define further label parameters, such as pickup and |
|
62
|
|
|
|
|
|
|
notifications. |
|
63
|
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
Transactions can only be created for rates that are less than 7 days |
|
65
|
|
|
|
|
|
|
old and whose C attribute is B. |
|
66
|
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
Transactions are created asynchronously. The response time depends |
|
68
|
|
|
|
|
|
|
exclusively on the carrier's server. |
|
69
|
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
=head1 API DOCUMENTATION |
|
71
|
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
For more information about Transactions, consult the Shippo API |
|
73
|
|
|
|
|
|
|
documentation: |
|
74
|
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=over 2 |
|
76
|
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
=item * L |
|
78
|
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=back |
|
80
|
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=head1 REPOSITORY |
|
82
|
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=over 2 |
|
84
|
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=item * L |
|
86
|
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=item * L |
|
88
|
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=back |
|
90
|
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
=head1 AUTHOR |
|
92
|
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
Iain Campbell |
|
94
|
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
|
96
|
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
This software is copyright (c) 2015 by Iain Campbell. |
|
98
|
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
You may distribute this software under the terms of either the GNU General |
|
100
|
|
|
|
|
|
|
Public License or the Artistic License, as specified in the Perl README |
|
101
|
|
|
|
|
|
|
file. |
|
102
|
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
=cut |