File Coverage

blib/lib/Net/API/Stripe/Refund.pm
Criterion Covered Total %
statement 7 23 30.4
branch n/a
condition n/a
subroutine 3 19 15.7
pod 16 16 100.0
total 26 58 44.8


line stmt bran cond sub pod time code
1             ##----------------------------------------------------------------------------
2             ## Stripe API - ~/lib/Net/API/Stripe/Refund.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/refunds
11             package Net::API::Stripe::Refund;
12             BEGIN
13             {
14 1     1   1346 use strict;
  1         2  
  1         28  
15 1     1   4 use parent qw( Net::API::Stripe::Generic );
  1         2  
  1         4  
16 1     1   365 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 balance_transaction { shift->_set_get_scalar_or_object( 'balance_transaction', 'Net::API::Stripe::Balance::Transaction', @_ ); }
26              
27 0     0 1   sub charge { shift->_set_get_scalar_or_object( 'charge', 'Net::API::Stripe::Charge', @_ ); }
28              
29 0     0 1   sub created { shift->_set_get_datetime( 'created', @_ ); }
30              
31 0     0 1   sub currency { shift->_set_get_scalar( 'currency', @_ ); }
32              
33 0     0 1   sub description { return( shift->_set_get_scalar( 'description', @_ ) ); }
34              
35 0     0 1   sub failure_balance_transaction { shift->_set_get_scalar_or_object( 'failure_balance_transaction', 'Net::API::Stripe::Balance::Transaction', @_ ); }
36              
37 0     0 1   sub failure_reason { shift->_set_get_scalar( 'failure_reason', @_ ); }
38              
39 0     0 1   sub metadata { shift->_set_get_hash( 'metadata', @_ ); }
40              
41 0     0 1   sub reason { shift->_set_get_scalar( 'reason', @_ ); }
42              
43 0     0 1   sub receipt_number { shift->_set_get_scalar( 'receipt_number', @_ ); }
44              
45 0     0 1   sub source_transfer_reversal { shift->_set_get_scalar_or_object( 'source_transfer_reversal', 'Net::API::Stripe::Connect::Transfer::Reversal', @_ ); }
46              
47 0     0 1   sub status { shift->_set_get_scalar( 'status', @_ ); }
48              
49 0     0 1   sub transfer_reversal { shift->_set_get_scalar_or_object( 'transfer_reversal', 'Net::API::Stripe::Connect::Transfer::Reversal', @_ ); }
50              
51             1;
52              
53             __END__
54              
55             =encoding utf8
56              
57             =head1 NAME
58              
59             Net::API::Stripe::Refund - A Stripe Refund Object
60              
61             =head1 SYNOPSIS
62              
63             my $refund = $stripe->refund({
64             amount => 2000,
65             charge => $charge_object,
66             currency => 'jpy',
67             description => 'Cancelled service order',
68             metadata => { transaction_id => 123, customer_id => 456 },
69             reason => 'requested_by_customer',
70             });
71              
72             See documentation in L<Net::API::Stripe> for example to make api calls to Stripe to create those objects.
73              
74             =head1 VERSION
75              
76             v0.100.0
77              
78             =head1 DESCRIPTION
79              
80             Refund objects allow you to refund a charge that has previously been created but not yet refunded. Funds will be refunded to the credit or debit card that was originally charged.
81              
82             =head1 CONSTRUCTOR
83              
84             =over 4
85              
86             =item B<new>( %ARG )
87              
88             Creates a new L<Net::API::Stripe::Refund> object.
89             It may also take an hash like arguments, that also are method of the same name.
90              
91             =back
92              
93             =head1 METHODS
94              
95             =over 4
96              
97             =item B<id> string
98              
99             Unique identifier for the object.
100              
101             =item B<object> string, value is "refund"
102              
103             String representing the object’s type. Objects of the same type share the same value.
104              
105             =item B<amount> integer
106              
107             Amount, in JPY.
108              
109             =item B<balance_transaction> string (expandable)
110              
111             Balance transaction that describes the impact on your account balance.
112              
113             When expanded, this is a L<Net::API::Stripe::Balance::Transaction> object.
114              
115             =item B<charge> string (expandable)
116              
117             ID of the charge that was refunded. When expanded, this is a L<Net::API::Stripe::Charge> object.
118              
119             =item B<created> timestamp
120              
121             Time at which the object was created. Measured in seconds since the Unix epoch. This is a C<DateTime> object.
122              
123             =item B<currency> currency
124              
125             Three-letter ISO currency code, in lowercase. Must be a supported currency.
126              
127             =item B<description> string
128              
129             An arbitrary string attached to the object. Often useful for displaying to users. (Available on non-card refunds only)
130              
131             =item B<failure_balance_transaction> string (expandable)
132              
133             If the refund failed, this balance transaction describes the adjustment made on your account balance that reverses the initial balance transaction. This is a L<Net::API::Stripe::Balance::Transaction>
134              
135             =item B<failure_reason> string
136              
137             If the refund failed, the reason for refund failure if known. Possible values are lost_or_stolen_card, expired_or_canceled_card, or unknown.
138              
139             =item B<metadata> hash
140              
141             Set of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format.
142              
143             =item B<reason> string
144              
145             Reason for the refund. If set, possible values are duplicate, fraudulent, and requested_by_customer.
146              
147             =item B<receipt_number> string
148              
149             This is the transaction number that appears on email receipts sent for this refund.
150              
151             =item B<source_transfer_reversal> string (expandable)
152              
153             The transfer reversal that is associated with the refund. Only present if the charge came from another Stripe account. See the Connect documentation for details. This is a L<Net::API::Stripe::Connect::Transfer::Reversal>
154              
155             =item B<status> string
156              
157             Status of the refund. For credit card refunds, this can be pending, succeeded, or failed. For other types of refunds, it can be pending, succeeded, failed, or canceled. Refer to L<Stripe refunds documentation|https://stripe.com/docs/refunds#failed-refunds> for more details.
158              
159             =item B<transfer_reversal> string (expandable)
160              
161             If the accompanying transfer was reversed, the transfer reversal object. Only applicable if the charge was created using the destination parameter. This is a L<Net::API::Stripe::Connect::Transfer::Reversal> object.
162              
163             =back
164              
165             =head1 API SAMPLE
166              
167             {
168             "id": "re_fake123456789",
169             "object": "refund",
170             "amount": 30200,
171             "balance_transaction": "txn_fake123456789",
172             "charge": "ch_fake123456789",
173             "created": 1540736617,
174             "currency": "jpy",
175             "metadata": {},
176             "reason": null,
177             "receipt_number": null,
178             "source_transfer_reversal": null,
179             "status": "succeeded",
180             "transfer_reversal": null
181             }
182              
183             =head1 HISTORY
184              
185             =head2 v0.1
186              
187             Initial version
188              
189             =head1 AUTHOR
190              
191             Jacques Deguest E<lt>F<jack@deguest.jp>E<gt>
192              
193             =head1 SEE ALSO
194              
195             Stripe API documentation:
196              
197             L<https://stripe.com/docs/api/refunds>, L<https://stripe.com/docs/refunds>
198              
199             =head1 COPYRIGHT & LICENSE
200              
201             Copyright (c) 2019-2020 DEGUEST Pte. Ltd.
202              
203             You can use, copy, modify and redistribute this package and associated
204             files under the same terms as Perl itself.
205              
206             =cut