File Coverage

lib/Net/API/Stripe/Dispute.pm
Criterion Covered Total %
statement 19 36 52.7
branch n/a
condition n/a
subroutine 7 24 29.1
pod 17 17 100.0
total 43 77 55.8


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