File Coverage

blib/lib/Net/API/Stripe/Dispute.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/Dispute.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/disputes/object
11             package Net::API::Stripe::Dispute;
12             BEGIN
13             {
14 1     1   811 use strict;
  1         2  
  1         29  
15 1     1   4 use parent qw( Net::API::Stripe::Generic );
  1         2  
  1         5  
16 1     1   299 our( $VERSION ) = 'v0.100.0';
17             };
18              
19 0     0 1   sub id { return( shift->_set_get_scalar( 'id', @_ ) ); }
20              
21 0     0 1   sub object { return( shift->_set_get_scalar( 'object', @_ ) ); }
22              
23 0     0 1   sub amount { return( shift->_set_get_number( 'amount', @_ ) ); }
24              
25 0     0 1   sub balance_transaction { return( shift->_set_get_scalar_or_object( 'balance_transaction', 'Net::API::Stripe::Balance::Transaction', @_ ) ); }
26              
27             ## Array that contains Net::API::Stripe::Balance::Transaction
28 0     0 1   sub balance_transactions { return( shift->_set_get_object_array( 'balance_transactions', 'Net::API::Stripe::Balance::Transaction', @_ ) ); }
29              
30 0     0 1   sub charge { return( shift->_set_get_scalar_or_object( 'charge', 'Net::API::Stripe::Charge', @_ ) ); }
31              
32 0     0 1   sub created { return( shift->_set_get_datetime( 'created', @_ ) ); }
33              
34 0     0 1   sub currency { return( shift->_set_get_scalar( 'currency', @_ ) ); }
35              
36 0     0 1   sub disputed_transaction { return( shift->_set_get_scalar_or_object( 'disputed_transaction', 'Net::API::Stripe::Balance::Transaction', @_ ) ); }
37              
38 0     0 1   sub evidence { return( shift->_set_get_object( 'evidence', 'Net::API::Stripe::Dispute::Evidence', @_ ) ); }
39              
40 0     0 1   sub evidence_details { return( shift->_set_get_object( 'evidence_details', 'Net::API::Stripe::Dispute::EvidenceDetails', @_ ) ); }
41              
42 0     0 1   sub is_charge_refundable { return( shift->_set_get_boolean( 'is_charge_refundable', @_ ) ); }
43              
44 0     0 1   sub livemode { return( shift->_set_get_boolean( 'livemode', @_ ) ); }
45              
46 0     0 1   sub metadata { return( shift->_set_get_hash( 'metadata', @_ ) ); }
47              
48 0     0 1   sub reason { return( shift->_set_get_scalar( 'reason', @_ ) ); }
49              
50 0     0 1   sub status { return( shift->_set_get_scalar( 'status', @_ ) ); }
51              
52             1;
53              
54             __END__
55              
56             =encoding utf8
57              
58             =head1 NAME
59              
60             Net::API::Stripe::Dispute - A Stripe Dispute Object
61              
62             =head1 SYNOPSIS
63              
64             my $dispute = $stripe->dispute({
65             amount => 2000,
66             # could also use a Net::API::Stripe::Charge object
67             charge => 'ch_fake124567890',
68             currency => 'jpy',
69             # Or a Stripe transaction id such as trn_fake1234567890
70             disputed_transaction => $transaction_object,
71             evidence => $dispute_evidence_object,
72             is_charge_refundable => $stripe->true,
73             metadata => { transaction_id => 123, customer_id => 456 },
74             reason => 'insufficient_funds',
75             status => 'warning_needs_response',
76             });
77              
78             See documentation in L<Net::API::Stripe> for example to make api calls to Stripe to create those objects.
79              
80             =head1 VERSION
81              
82             v0.100.0
83              
84             =head1 DESCRIPTION
85              
86             From the documentation:
87              
88             A dispute occurs when a customer questions your charge with their card issuer. When this happens, you're given the opportunity to respond to the dispute with evidence that shows that the charge is legitimate. You can find more information about the dispute process in L<Stripe Disputes and Fraud documentation|https://stripe.com/docs/disputes>.
89              
90             =head1 CONSTRUCTOR
91              
92             =over 4
93              
94             =item B<new>( %ARG )
95              
96             Creates a new L<Net::API::Stripe::Dispute> object.
97              
98             =back
99              
100             =head1 METHODS
101              
102             =over 4
103              
104             =item B<id> string
105              
106             Unique identifier for the object.
107              
108             =item B<object> string, value is "dispute"
109              
110             String representing the object’s type. Objects of the same type share the same value.
111              
112             =item B<amount> integer
113              
114             Disputed amount. Usually the amount of the charge, but can differ (usually because of currency fluctuation or because only part of the order is disputed).
115              
116             =item B<balance_transaction>
117              
118             It seems this property is removed from the API documentation or maybe an omission?
119              
120             This is an id or a L<Net::API::Stripe::Balance::Transaction> object.
121              
122             =item B<balance_transactions> array, contains: balance_transaction object
123              
124             List of zero, one, or two balance transactions that show funds withdrawn and reinstated to your Stripe account as a result of this dispute.
125              
126             This is an array of L<Net::API::Stripe::Balance::Transaction> objects.
127              
128             =item B<charge> string (expandable)
129              
130             ID of the charge that was disputed or an L<Net::API::Stripe::Charge> object.
131              
132             =item B<created> timestamp
133              
134             Time at which the object was created. Measured in seconds since the Unix epoch.
135              
136             =item B<currency> currency
137              
138             Three-letter ISO currency code, in lowercase. Must be a supported currency.
139              
140             =item B<disputed_transaction> string (expandable)
141              
142             When expanded, this is a L<Net::API::Stripe::Balance::Transaction> object.
143              
144             =item B<evidence> hash
145              
146             Evidence provided to respond to a dispute. Updating any field in the hash will submit all fields in the hash for review.
147              
148             =over 8
149              
150             =item B<access_activity_log>
151              
152             =item B<billing_address>
153              
154             =item B<cancellation_policy>
155              
156             =item B<cancellation_policy_disclosure>
157              
158             =item B<cancellation_rebuttal>
159              
160             =item B<customer_communication>
161              
162             =item B<customer_email_address>
163              
164             =item B<customer_name>
165              
166             =item B<customer_purchase_ip>
167              
168             =item B<customer_signature>
169              
170             =item B<duplicate_charge_documentation>
171              
172             =item B<duplicate_charge_explanation>
173              
174             =item B<duplicate_charge_id>
175              
176             =item B<product_description>
177              
178             =item B<receipt>
179              
180             =item B<refund_policy>
181              
182             =item B<refund_policy_disclosure>
183              
184             =item B<refund_refusal_explanation>
185              
186             =item B<service_date>
187              
188             =item B<service_documentation>
189              
190             =item B<shipping_address>
191              
192             =item B<shipping_carrier>
193              
194             =item B<shipping_date>
195              
196             =item B<shipping_documentation>
197              
198             =item B<shipping_tracking_number>
199              
200             =item B<uncategorized_file>
201              
202             =item B<uncategorized_text>
203              
204             =back
205              
206             =item B<evidence_details> hash
207              
208             Information about the evidence submission. This is a L<Net::API::Stripe::Dispute::EvidenceDetails> object.
209              
210             =item B<is_charge_refundable> boolean
211              
212             If true, it is still possible to refund the disputed payment. Once the payment has been fully refunded, no further funds will be withdrawn from your Stripe account as a result of this dispute.
213              
214             =item B<livemode> boolean
215              
216             Has the value true if the object exists in live mode or the value false if the object exists in test mode.
217              
218             =item B<metadata> hash
219              
220             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.
221              
222             =item B<reason> string
223              
224             Reason given by cardholder for dispute. Possible values are bank_cannot_process, check_returned, credit_not_processed, customer_initiated, debit_not_authorized, duplicate, fraudulent, general, incorrect_account_details, insufficient_funds, product_not_received, product_unacceptable, subscription_canceled, or unrecognized. Read more about dispute reasons.
225              
226             =item B<status> string
227              
228             Current status of dispute. Possible values are warning_needs_response, warning_under_review, warning_closed, needs_response, under_review, charge_refunded, won, or lost.
229              
230             =back
231              
232             =head1 API SAMPLE
233              
234             {
235             "id": "dp_fake123456789",
236             "object": "dispute",
237             "amount": 1000,
238             "balance_transactions": [],
239             "charge": "ch_fake123456789",
240             "created": 1571197169,
241             "currency": "jpy",
242             "evidence": {
243             "access_activity_log": null,
244             "billing_address": null,
245             "cancellation_policy": null,
246             "cancellation_policy_disclosure": null,
247             "cancellation_rebuttal": null,
248             "customer_communication": null,
249             "customer_email_address": null,
250             "customer_name": null,
251             "customer_purchase_ip": null,
252             "customer_signature": null,
253             "duplicate_charge_documentation": null,
254             "duplicate_charge_explanation": null,
255             "duplicate_charge_id": null,
256             "product_description": null,
257             "receipt": null,
258             "refund_policy": null,
259             "refund_policy_disclosure": null,
260             "refund_refusal_explanation": null,
261             "service_date": null,
262             "service_documentation": null,
263             "shipping_address": null,
264             "shipping_carrier": null,
265             "shipping_date": null,
266             "shipping_documentation": null,
267             "shipping_tracking_number": null,
268             "uncategorized_file": null,
269             "uncategorized_text": null
270             },
271             "evidence_details": {
272             "due_by": 1572911999,
273             "has_evidence": false,
274             "past_due": false,
275             "submission_count": 0
276             },
277             "is_charge_refundable": true,
278             "livemode": false,
279             "metadata": {},
280             "reason": "general",
281             "status": "warning_needs_response"
282             }
283              
284             =head1 HISTORY
285              
286             =head2 v0.1
287              
288             Initial version
289              
290             =head1 AUTHOR
291              
292             Jacques Deguest E<lt>F<jack@deguest.jp>E<gt>
293              
294             =head1 SEE ALSO
295              
296             Stripe API documentation:
297              
298             L<https://stripe.com/docs/api/disputes>, L<https://stripe.com/docs/disputes>
299              
300             =head1 COPYRIGHT & LICENSE
301              
302             Copyright (c) 2019-2020 DEGUEST Pte. Ltd.
303              
304             You can use, copy, modify and redistribute this package and associated
305             files under the same terms as Perl itself.
306              
307             =cut
308