File Coverage

blib/lib/Net/API/Stripe/Order/Return.pm
Criterion Covered Total %
statement 7 16 43.7
branch n/a
condition n/a
subroutine 3 12 25.0
pod 9 9 100.0
total 19 37 51.3


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