File Coverage

lib/Net/API/Stripe/Issuing/Transaction.pm
Criterion Covered Total %
statement 19 38 50.0
branch n/a
condition n/a
subroutine 7 26 26.9
pod 19 19 100.0
total 45 83 54.2


line stmt bran cond sub pod time code
1             ##----------------------------------------------------------------------------
2             ## Stripe API - ~/lib/Net/API/Stripe/Issuing/Transaction.pm
3             ## Version v0.101.0
4             ## Copyright(c) 2019 DEGUEST Pte. Ltd.
5             ## Author: Jacques Deguest <jack@deguest.jp>
6             ## Created 2019/11/02
7             ## Modified 2022/10/29
8             ##
9             ##----------------------------------------------------------------------------
10             ## https://stripe.com/docs/api/issuing/transactions
11             package Net::API::Stripe::Issuing::Transaction;
12             BEGIN
13             {
14 2     2   22285628 use strict;
  2         13  
  2         77  
15 2     2   23 use warnings;
  2         4  
  2         74  
16 2     2   15 use parent qw( Net::API::Stripe::Generic );
  2         8  
  2         19  
17 2     2   161 use vars qw( $VERSION );
  2         5  
  2         133  
18 2     2   79 our( $VERSION ) = 'v0.101.0';
19             };
20              
21 2     2   18 use strict;
  2         7  
  2         61  
22 2     2   12 use warnings;
  2         7  
  2         1313  
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 amount_details { return( shift->_set_get_class( 'amount_details', {
31             atm_fee => { type => "number" }
32             }, @_ ) ); }
33              
34 0     0 1   sub authorization { return( shift->_set_get_scalar_or_object( 'authorization', 'Net::API::Stripe::Issuing::Authorization', @_ ) ); }
35              
36 0     0 1   sub balance_transaction { return( shift->_set_get_scalar_or_object( 'balance_transaction', 'Net::API::Stripe::Balance::Transaction', @_ ) ); }
37              
38 0     0 1   sub card { return( shift->_set_get_scalar_or_object( 'card', 'Net::API::Stripe::Payment::Card', @_ ) ); }
39              
40 0     0 1   sub cardholder { return( shift->_set_get_scalar_or_object( 'cardholder', 'Net::API::Stripe::Issuing::Card::Holder', @_ ) ); }
41              
42 0     0 1   sub created { return( shift->_set_get_datetime( 'created', @_ ) ); }
43              
44 0     0 1   sub currency { return( shift->_set_get_scalar( 'currency', @_ ) ); }
45              
46 0     0 1   sub dispute { return( shift->_set_get_scalar_or_object( 'dispute', 'Net::API::Stripe::Issuing::Dispute', @_ ) ); }
47              
48 0     0 1   sub livemode { return( shift->_set_get_boolean( 'livemode', @_ ) ); }
49              
50 0     0 1   sub merchant_amount { return( shift->_set_get_number( 'merchant_amount', @_ ) ); }
51              
52 0     0 1   sub merchant_currency { return( shift->_set_get_scalar( 'merchant_currency', @_ ) ); }
53              
54 0     0 1   sub merchant_data { return( shift->_set_get_object( 'merchant_data', 'Net::API::Stripe::Issuing::MerchantData', @_ ) ); }
55              
56 0     0 1   sub metadata { return( shift->_set_get_hash( 'metadata', @_ ) ); }
57              
58 0     0 1   sub purchase_details { return( shift->_set_get_class( 'purchase_details',
59             {
60             flight => {
61             definition => {
62             departure_at => { type => "number" },
63             passenger_name => { type => "scalar" },
64             refundable => { type => "boolean" },
65             segments => {
66             definition => {
67             arrival_airport_code => { type => "scalar" },
68             carrier => { type => "scalar" },
69             departure_airport_code => { type => "scalar" },
70             flight_number => { type => "scalar" },
71             service_class => { type => "scalar" },
72             stopover_allowed => { type => "boolean" },
73             },
74             type => "class_array",
75             },
76             travel_agency => { type => "scalar" },
77             },
78             type => "class",
79             },
80             fuel => {
81             definition => {
82             type => { type => "scalar" },
83             unit => { type => "scalar" },
84             unit_cost_decimal => { type => "number" },
85             volume_decimal => { type => "number" },
86             },
87             type => "class",
88             },
89             lodging => {
90             definition => { check_in_at => { type => "number" }, nights => { type => "number" } },
91             type => "class",
92             },
93             receipt => {
94             definition => {
95             description => { type => "scalar" },
96             quantity => { type => "number" },
97             total => { type => "number" },
98             unit_cost => { type => "number" },
99             },
100             type => "class_array",
101             },
102             reference => { type => "scalar" },
103             }, @_ ) ); }
104              
105 0     0 1   sub type { return( shift->_set_get_scalar( 'type', @_ ) ); }
106              
107 0     0 1   sub wallet { return( shift->_set_get_scalar( 'wallet', @_ ) ); }
108              
109             1;
110              
111             __END__
112              
113             =encoding utf8
114              
115             =head1 NAME
116              
117             Net::API::Stripe::Issuing::Transaction - A Stripe Issuing Transaction Object
118              
119             =head1 SYNOPSIS
120              
121             my $trans = $stripe->issuing_transaction({
122             amount => 2000,
123             authorization => $authorization_object,
124             balance_transaction => $balance_transaction,
125             card => $card_object,
126             currency => 'jpy',
127             merchant_amount => 2000,
128             merchant_currency => 'jpy',
129             metadata => { transaction_id => 123, customer_id > 456 },
130             });
131              
132             See documentation in L<Net::API::Stripe> for example to make api calls to Stripe to create those objects.
133              
134             =head1 VERSION
135              
136             v0.101.0
137              
138             =head1 DESCRIPTION
139              
140             Any use of an issued card (L<https://stripe.com/docs/issuing>) that results in funds entering or leaving your Stripe account, such as a completed purchase or refund, is represented by an Issuing Transaction object.
141              
142             =head1 CONSTRUCTOR
143              
144             =head2 new( %ARG )
145              
146             Creates a new L<Net::API::Stripe::Issuing::Transaction> object.
147             It may also take an hash like arguments, that also are method of the same name.
148              
149             =head1 METHODS
150              
151             =head2 id string
152              
153             Unique identifier for the object.
154              
155             =head2 object string, value is "issuing.transaction"
156              
157             String representing the object’s type. Objects of the same type share the same value.
158              
159             =head2 amount integer
160              
161             The transaction amount, which will be reflected in your balance. This amount is in your currency and in the L<smallest currency unit|https://stripe.com/docs/currencies#zero-decimal>.
162              
163             =head2 amount_details hash
164              
165             Detailed breakdown of amount components. These amounts are denominated in `currency` and in the L<smallest currency unit|https://stripe.com/docs/currencies#zero-decimal>.
166              
167             It has the following properties:
168              
169             =over 4
170              
171             =item I<atm_fee> integer
172              
173             The fee charged by the ATM for the cash withdrawal.
174              
175             =back
176              
177             =head2 authorization string (expandable)
178              
179             The Authorization object that led to this transaction.
180              
181             When expanded, this is a L<Net::API::Stripe::Issuing::Authorization> object.
182              
183             =head2 balance_transaction string (expandable)
184              
185             When expanded, this is a L<Net::API::Stripe::Balance::Transaction> object.
186              
187             =head2 card string (expandable)
188              
189             The card used to make this transaction.
190              
191             When expanded, this is a L<Net::API::Stripe::Payment::Card> object.
192              
193             =head2 cardholder string (expandable)
194              
195             The cardholder to whom this transaction belongs.
196              
197             When expanded, this is a L<Net::API::Stripe::Issuing::Card::Holder> object.
198              
199             =head2 created timestamp
200              
201             Time at which the object was created. Measured in seconds since the Unix epoch.
202              
203             =head2 currency currency
204              
205             Three-letter ISO currency code, in lowercase. Must be a supported currency.
206              
207             =head2 dispute string (expandable)
208              
209             When expanded, this is a L<Net::API::Stripe::Issuing::Dispute> object.
210              
211             =head2 livemode boolean
212              
213             Has the value true if the object exists in live mode or the value false if the object exists in test mode.
214              
215             =head2 merchant_amount integer
216              
217             The amount that the merchant will receive, denominated in L</merchant_currency> and in the smallest currency unit. It will be different from L</amount> if the merchant is taking payment in a different currency.
218              
219             =head2 merchant_currency currency
220              
221             The currency with which the merchant is taking payment.
222              
223             =head2 merchant_data hash
224              
225             More information about the user involved in the transaction.
226              
227             This is a L<Net::API::Stripe::Issuing::MerchantData> object.
228              
229             =head2 metadata hash
230              
231             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.
232              
233             =head2 purchase_details hash
234              
235             Additional purchase information that is optionally provided by the merchant.
236              
237             It has the following properties:
238              
239             =over 4
240              
241             =item I<flight> hash
242              
243             Information about the flight that was purchased with this transaction.
244              
245             =over 8
246              
247             =item I<departure_at> integer
248              
249             The time that the flight departed.
250              
251             =item I<passenger_name> string
252              
253             The name of the passenger.
254              
255             =item I<refundable> boolean
256              
257             Whether the ticket is refundable.
258              
259             =item I<segments> array
260              
261             The legs of the trip.
262              
263             =over 12
264              
265             =item I<arrival_airport_code> string
266              
267             The three-letter IATA airport code of the flight's destination.
268              
269             =item I<carrier> string
270              
271             The airline carrier code.
272              
273             =item I<departure_airport_code> string
274              
275             The three-letter IATA airport code that the flight departed from.
276              
277             =item I<flight_number> string
278              
279             The flight number.
280              
281             =item I<service_class> string
282              
283             The flight's service class.
284              
285             =item I<stopover_allowed> boolean
286              
287             Whether a stopover is allowed on this flight.
288              
289             =back
290              
291             =item I<travel_agency> string
292              
293             The travel agency that issued the ticket.
294              
295             =back
296              
297             =item I<fuel> hash
298              
299             Information about fuel that was purchased with this transaction.
300              
301             =over 8
302              
303             =item I<type> string
304              
305             The type of fuel that was purchased. One of `diesel`, `unleaded_plus`, `unleaded_regular`, `unleaded_super`, or `other`.
306              
307             =item I<unit> string
308              
309             The units for `volume_decimal`. One of `us_gallon` or `liter`.
310              
311             =item I<unit_cost_decimal> decimal_string
312              
313             The cost in cents per each unit of fuel, represented as a decimal string with at most 12 decimal places.
314              
315             =item I<volume_decimal> decimal_string
316              
317             The volume of the fuel that was pumped, represented as a decimal string with at most 12 decimal places.
318              
319             =back
320              
321             =item I<lodging> hash
322              
323             Information about lodging that was purchased with this transaction.
324              
325             =over 8
326              
327             =item I<check_in_at> integer
328              
329             The time of checking into the lodging.
330              
331             =item I<nights> integer
332              
333             The number of nights stayed at the lodging.
334              
335             =back
336              
337             =item I<receipt> array
338              
339             The line items in the purchase.
340              
341             =over 8
342              
343             =item I<description> string
344              
345             The description of the item. The maximum length of this field is 26 characters.
346              
347             =item I<quantity> decimal
348              
349             The quantity of the item.
350              
351             =item I<total> integer
352              
353             The total for this line item in cents.
354              
355             =item I<unit_cost> integer
356              
357             The unit cost of the item in cents.
358              
359             =back
360              
361             =item I<reference> string
362              
363             A merchant-specific order number.
364              
365             =back
366              
367             =head2 type string
368              
369             One of capture, refund, cash_withdrawal, refund_reversal, dispute, or dispute_loss.
370              
371             =head2 wallet string
372              
373             The digital wallet used for this transaction. One of C<apple_pay>, C<google_pay>, or C<samsung_pay>.
374              
375             =head1 API SAMPLE
376              
377             {
378             "id": "ipi_fake123456789",
379             "object": "issuing.transaction",
380             "amount": -100,
381             "authorization": "iauth_fake123456789",
382             "balance_transaction": null,
383             "card": "ic_fake123456789",
384             "cardholder": null,
385             "created": 1571480456,
386             "currency": "usd",
387             "dispute": null,
388             "livemode": false,
389             "merchant_amount": -100,
390             "merchant_currency": "usd",
391             "merchant_data": {
392             "category": "taxicabs_limousines",
393             "city": "San Francisco",
394             "country": "US",
395             "name": "Rocket Rides",
396             "network_id": "1234567890",
397             "postal_code": "94107",
398             "state": "CA",
399             "url": null
400             },
401             "metadata": {},
402             "type": "capture"
403             }
404              
405             =head1 HISTORY
406              
407             =head2 v0.1
408              
409             Initial version
410              
411             =head1 AUTHOR
412              
413             Jacques Deguest E<lt>F<jack@deguest.jp>E<gt>
414              
415             =head1 SEE ALSO
416              
417             Stripe API documentation:
418              
419             L<https://stripe.com/docs/api/issuing/transactions>, L<https://stripe.com/docs/issuing/transactions>
420              
421             =head1 COPYRIGHT & LICENSE
422              
423             Copyright (c) 2019-2020 DEGUEST Pte. Ltd.
424              
425             You can use, copy, modify and redistribute this package and associated
426             files under the same terms as Perl itself.
427              
428             =cut