File Coverage

lib/Net/API/Stripe/Order/Return.pm
Criterion Covered Total %
statement 19 28 67.8
branch n/a
condition n/a
subroutine 7 16 43.7
pod 9 9 100.0
total 35 53 66.0


line stmt bran cond sub pod time code
1             ##----------------------------------------------------------------------------
2             ## Stripe API - ~/lib/Net/API/Stripe/Order/Return.pm
3             ## Version v0.100.0
4             ## Copyright(c) 2019 DEGUEST Pte. Ltd.
5             ## Author: Jacques Deguest <jack@deguest.jp>
6             ## Created 2019/11/02
7             ## Modified 2020/05/15
8             ##
9             ##----------------------------------------------------------------------------
10             ## https://stripe.com/docs/api/order_returns/object
11             package Net::API::Stripe::Order::Return;
12             BEGIN
13             {
14 1     1   1066 use strict;
  1         3  
  1         33  
15 1     1   6 use warnings;
  1         3  
  1         30  
16 1     1   5 use parent qw( Net::API::Stripe::Generic );
  1         5  
  1         7  
17 1     1   68 use vars qw( $VERSION );
  1         2  
  1         52  
18 1     1   20 our( $VERSION ) = 'v0.100.0';
19             };
20              
21 1     1   5 use strict;
  1         3  
  1         39  
22 1     1   8 use warnings;
  1         1  
  1         276  
23              
24 0     0 1   sub id { return( shift->_set_get_scalar( 'id', @_ ) ); }
25              
26 0     0 1   sub object { return( shift->_set_get_scalar( 'object', @_ ) ); }
27              
28 0     0 1   sub amount { return( shift->_set_get_number( 'amount', @_ ) ); }
29              
30 0     0 1   sub created { return( shift->_set_get_datetime( 'created', @_ ) ); }
31              
32 0     0 1   sub currency { return( shift->_set_get_scalar( 'currency', @_ ) ); }
33              
34             # Array of Net::API::Stripe::Order::Item
35 0     0 1   sub items { return( shift->_set_get_object_array( 'items', 'Net::API::Stripe::Order::Item', @_ ) ); }
36              
37 0     0 1   sub livemode { return( shift->_set_get_boolean( 'livemode', @_ ) ); }
38              
39 0     0 1   sub order { return( shift->_set_get_scalar_or_object( 'order', 'Net::API::Stripe::Order', @_ ) ); }
40              
41 0     0 1   sub refund { return( shift->_set_get_scalar_or_object( 'refund', 'Net::API::Stripe::Refund', @_ ) ); }
42              
43             1;
44              
45             __END__
46              
47             =encoding utf8
48              
49             =head1 NAME
50              
51             Net::API::Stripe::Order::Return - A Stripe Order Return Object
52              
53             =head1 SYNOPSIS
54              
55             my $return = $stripe->return({
56             amount => 2000,
57             currency => 'jpy',
58             items => [ $item_object1, $item_object2 ],
59             order => $order_object,
60             refund => undef,
61             });
62              
63             See documentation in L<Net::API::Stripe> for example to make api calls to Stripe to create those objects.
64              
65             =head1 VERSION
66              
67             v0.100.0
68              
69             =head1 DESCRIPTION
70              
71             A return represents the full or partial return of a number of order items (L<https://stripe.com/docs/api/order_returns#order_items>). Returns always belong to an order, and may optionally contain a refund.
72              
73             =head1 CONSTRUCTOR
74              
75             =head2 new( %ARG )
76              
77             Creates a new L<Net::API::Stripe::Order::Return> object.
78              
79             =head1 METHODS
80              
81             =head2 id string
82              
83             Unique identifier for the object.
84              
85             =head2 object string, value is "order_return"
86              
87             String representing the object’s type. Objects of the same type share the same value.
88              
89             =head2 amount integer
90              
91             A positive integer in the smallest currency unit (that is, 100 cents for $1.00, or 1 for ¥1, Japanese Yen being a zero-decimal currency) representing the total amount for the returned line item.
92              
93             =head2 created timestamp
94              
95             Time at which the object was created. Measured in seconds since the Unix epoch.
96              
97             =head2 currency currency
98              
99             Three-letter ISO currency code, in lowercase. Must be a supported currency.
100              
101             =head2 items array of hashes
102              
103             The items included in this order return.
104              
105             This is an array of L<Net::API::Stripe::Order::Item> objects.
106              
107             =head2 livemode boolean
108              
109             Has the value true if the object exists in live mode or the value false if the object exists in test mode.
110              
111             =head2 order string (expandable)
112              
113             The order that this return includes items from.
114              
115             When expanded, this is a L<Net::API::Stripe::Order> object.
116              
117             =head2 refund string (expandable)
118              
119             The ID of the refund issued for this return.
120              
121             When expanded, this is a L<Net::API::Stripe::Refund> object.
122              
123             =head1 API SAMPLE
124              
125             {
126             "id": "orret_fake123456789",
127             "object": "order_return",
128             "amount": 1500,
129             "created": 1571480456,
130             "currency": "jpy",
131             "items": [
132             {
133             "object": "order_item",
134             "amount": 1500,
135             "currency": "jpy",
136             "description": "Provider, Inc investor yearly membership",
137             "parent": "sk_fake123456789",
138             "quantity": null,
139             "type": "sku"
140             }
141             ],
142             "livemode": false,
143             "order": "or_fake123456789",
144             "refund": "re_fake123456789"
145             }
146              
147             =head1 HISTORY
148              
149             =head2 v0.1
150              
151             Initial version
152              
153             =head1 AUTHOR
154              
155             Jacques Deguest E<lt>F<jack@deguest.jp>E<gt>
156              
157             =head1 SEE ALSO
158              
159             Stripe API documentation:
160              
161             L<https://stripe.com/docs/api/order_returns>
162              
163             =head1 COPYRIGHT & LICENSE
164              
165             Copyright (c) 2019-2020 DEGUEST Pte. Ltd.
166              
167             You can use, copy, modify and redistribute this package and associated
168             files under the same terms as Perl itself.
169              
170             =cut