File Coverage

lib/Net/API/Stripe.pm
Criterion Covered Total %
statement 140 1663 8.4
branch 0 1604 0.0
condition 0 620 0.0
subroutine 47 118 39.8
pod 22 27 81.4
total 209 4032 5.1


line stmt bran cond sub pod time code
1             # -*- perl -*-
2             ##----------------------------------------------------------------------------
3             ## Stripe API - ~/lib/Net/API/Stripe.pm
4             ## Version v2.0.2
5             ## Copyright(c) 2022 DEGUEST Pte. Ltd.
6             ## Author: Jacques Deguest <jack@deguest.jp>
7             ## Created 2018/07/19
8             ## Modified 2022/12/19
9             ## All rights reserved.
10             ##
11             ##
12             ## This program is free software; you can redistribute it and/or modify it
13             ## under the same terms as Perl itself.
14             ##----------------------------------------------------------------------------
15             package Net::API::Stripe;
16             BEGIN
17             {
18 1     1   33747318 use strict;
  1         6  
  1         56  
19 1     1   8 use warnings;
  1         2  
  1         59  
20 1     1   8 use warnings::register;
  1         1  
  1         341  
21 1     1   10 use common::sense;
  1         8  
  1         34  
22 1     1   155 use parent qw( Module::Generic );
  1         3  
  1         19  
23 1         220 use vars qw(
24             $VERSION $VERBOSE $DEBUG $BROWSER $ERROR_CODE_TO_STRING $TYPE2CLASS
25             $EXPANDABLES_BY_CLASS $EXPANDABLES $EXPAND_MAX_DEPTH $EXCEPTION_CLASS
26             $AUTOLOAD_SUBS $AUTOLOAD
27 1     1   162 );
  1         1  
28 1     1   790 use Cookie;
  1         5439340  
  1         16  
29 1     1   659 use Encode ();
  1         3  
  1         40  
30 1     1   11 use Data::UUID;
  1         4  
  1         153  
31             # use Net::OAuth;
32             # use Crypt::OpenSSL::RSA;
33 1     1   787 use Data::Random qw( rand_chars );
  1         12030  
  1         73  
34 1     1   10 use DateTime;
  1         1  
  1         24  
35 1     1   8 use DateTime::Format::Strptime;
  1         4  
  1         12  
36 1     1   768 use Devel::Confess;
  1         8315  
  1         4  
37 1     1   85 use Digest::MD5 qw( md5_base64 );
  1         2  
  1         73  
38 1     1   568 use Digest::SHA ();
  1         2703  
  1         33  
39 1     1   946 use HTTP::Promise;
  1         44995278  
  1         16  
40 1     1   448 use HTTP::Promise::Headers;
  1         3  
  1         25  
41 1     1   6 use HTTP::Promise::Message;
  1         3  
  1         12  
42 1     1   263 use HTTP::Promise::Request;
  1         2  
  1         11  
43 1     1   246 use JSON;
  1         2  
  1         11  
44 1     1   853 use MIME::QuotedPrint ();
  1         1382  
  1         25  
45 1     1   10 use MIME::Base64 ();
  1         4  
  1         28  
46 1     1   6 use Module::Generic::File qw( sys_tmpdir );
  1         1  
  1         12  
47 1     1   1010 use Net::IP;
  1         51680  
  1         210  
48 1     1   11 use Nice::Try;
  1         4  
  1         12  
49 1     1   7114860 use Regexp::Common;
  1         3  
  1         40  
50 1     1   945 use Scalar::Util ();
  1         2  
  1         21  
51 1     1   4 use URI::Escape;
  1         2  
  1         76  
52 1     1   7 use Want;
  1         1  
  1         56  
53 1     1   5 use constant API_BASE => 'https://api.stripe.com/v1';
  1         2  
  1         83  
54 1     1   5 use constant FILES_BASE => 'https://files.stripe.com/v1';
  1         13  
  1         57  
55 1     1   6 use constant STRIPE_WEBHOOK_SOURCE_IP => [qw( 54.187.174.169 54.187.205.235 54.187.216.72 54.241.31.99 54.241.31.102 54.241.34.107 )];
  1         2  
  1         91  
56 1     1   4 our $VERSION = 'v2.0.2';
57 1         20 our $EXCEPTION_CLASS = 'Net::API::Stripe::Exception';
58             };
59              
60 1     1   6 use strict;
  1         1  
  1         27  
61 1     1   4 use warnings;
  1         2  
  1         5938  
62              
63             our $VERBOSE = 0;
64             our $DEBUG = 0;
65             our $BROWSER = 'Net::API::Stripe/' . $VERSION;
66              
67             our $ERROR_CODE_TO_STRING =
68             {
69             400 => "The request was unacceptable, due to a missing required parameter.",
70             401 => "No valid API key provided.",
71             402 => "The parameters were valid but the request failed.",
72             403 => "The API key doesn't have permissions to perform the request.",
73             404 => "The requested resource doesn't exist.",
74             409 => "The request conflicts with another request.",
75             429 => "Too many requests hit the API too quickly. We recommend an exponential backoff of your requests.",
76             500 => "Something went wrong on Stripe's end.",
77             502 => "Something went wrong on Stripe's end.",
78             503 => "Something went wrong on Stripe's end.",
79             504 => "Something went wrong on Stripe's end.",
80             # Payout: https://stripe.com/docs/api/payouts/failures
81             account_closed => "The bank account has been closed.",
82             # Payout
83             account_frozen => "The bank account has been frozen.",
84             amount_too_large => "The specified amount is greater than the maximum amount allowed. Use a lower amount and try again.",
85             amount_too_small => "The specified amount is less than the minimum amount allowed. Use a higher amount and try again.",
86             api_connection_error => "Failure to connect to Stripe's API.",
87             api_error => "Striipe API error",
88             api_key_expired => "The API key provided has expired",
89             authentication_error => "Failure to properly authenticate yourself in the request.",
90             balance_insufficient => "The transfer or payout could not be completed because the associated account does not have a sufficient balance available.",
91             bank_account_exists => "The bank account provided already exists on the specified Customer object. If the bank account should also be attached to a different customer, include the correct customer ID when making the request again.",
92             # Payout: https://stripe.com/docs/api/payouts/failures
93             bank_account_restricted => "The bank account has restrictions on either the type, or the number, of payouts allowed. This normally indicates that the bank account is a savings or other non-checking account.",
94             bank_account_unusable => "The bank account provided cannot be used for payouts. A different bank account must be used.",
95             bank_account_unverified => "Your Connect platform is attempting to share an unverified bank account with a connected account.",
96             # Payout
97             bank_ownership_changed => "The destination bank account is no longer valid because its branch has changed ownership.",
98             card_declined => "The card has been declined.",
99             card_error => "Card error",
100             charge_already_captured => "The charge you’re attempting to refund has already been refunded.",
101             # Payout
102             could_not_process => "The bank could not process this payout.",
103             # Payout
104             debit_not_authorized => "Debit transactions are not approved on the bank account. (Stripe requires bank accounts to be set up for both credit and debit payouts.)",
105             # Payout
106             declined => "The bank has declined this transfer. Please contact the bank before retrying.",
107             email_invalid => "The email address is invalid.",
108             expired_card => "The card has expired. Check the expiration date or use a different card.",
109             idempotency_error => "Idempotency error",
110             # Payout
111             incorrect_account_holder_name => "Your bank notified us that the bank account holder name on file is incorrect.",
112             incorrect_cvc => "The card’s security code is incorrect. Check the card’s security code or use a different card.",
113             incorrect_number => "The card number is incorrect. Check the card’s number or use a different card.",
114             incorrect_zip => "The card’s postal code is incorrect. Check the card’s postal code or use a different card.",
115             instant_payouts_unsupported => "The debit card provided as an external account does not support instant payouts. Provide another debit card or use a bank account instead.",
116             # Payout
117             insufficient_funds => "Your Stripe account has insufficient funds to cover the payout.",
118             # Payout
119             invalid_account_number => "The routing number seems correct, but the account number is invalid.",
120             invalid_card_type => "The card provided as an external account is not a debit card. Provide a debit card or use a bank account instead.",
121             invalid_charge_amount => "The specified amount is invalid. The charge amount must be a positive integer in the smallest currency unit, and not exceed the minimum or maximum amount.",
122             # Payout
123             invalid_currency => "The bank was unable to process this payout because of its currency. This is probably because the bank account cannot accept payments in that currency.",
124             invalid_cvc => "The card’s security code is invalid. Check the card’s security code or use a different card.",
125             invalid_expiry_month => "The card’s expiration month is incorrect. Check the expiration date or use a different card.",
126             invalid_expiry_year => "The card’s expiration year is incorrect. Check the expiration date or use a different card.",
127             invalid_number => "The card number is invalid. Check the card details or use a different card.",
128             invalid_request_error => "Invalid request error. Request has invalid parameters.",
129             livemode_mismatch => "Test and live mode API keys, requests, and objects are only available within the mode they are in.",
130             missing => "Both a customer and source ID have been provided, but the source has not been saved to the customer. ",
131             # Payout
132             no_account => "The bank account details on file are probably incorrect. No bank account could be located with those details.",
133             parameter_invalid_empty => "One or more required values were not provided. Make sure requests include all required parameters.",
134             parameter_invalid_integer => "One or more of the parameters requires an integer, but the values provided were a different type. Make sure that only supported values are provided for each attribute.",
135             parameter_invalid_string_blank => "One or more values provided only included whitespace. Check the values in your request and update any that contain only whitespace.",
136             parameter_invalid_string_empty => "One or more required string values is empty. Make sure that string values contain at least one character.",
137             parameter_missing => "One or more required values are missing.",
138             parameter_unknown => "The request contains one or more unexpected parameters. Remove these and try again.",
139             payment_method_unactivated => "The charge cannot be created as the payment method used has not been activated.",
140             payouts_not_allowed => "Payouts have been disabled on the connected account.",
141             platform_api_key_expired => "The API key provided by your Connect platform has expired.",
142             postal_code_invalid => "The postal code provided was incorrect.",
143             processing_error => "An error occurred while processing the card. Check the card details are correct or use a different card.",
144             rate_limit => "Too many requests hit the API too quickly. We recommend an exponential backoff of your requests.",
145             rate_limit_error => "Too many requests hit the API too quickly.",
146             testmode_charges_only => "This account has not been activated and can only make test charges.",
147             tls_version_unsupported => "Your integration is using an older version of TLS that is unsupported. You must be using TLS 1.2 or above.",
148             token_already_used => "The token provided has already been used. You must create a new token before you can retry this request.",
149             transfers_not_allowed => "The requested transfer cannot be created. Contact us if you are receiving this error.",
150             # Payout
151             unsupported_card => "The bank no longer supports payouts to this card.",
152             upstream_order_creation_failed => "The order could not be created. Check the order details and then try again.",
153             url_invalid => "The URL provided is invalid.",
154             validation_error => "Stripe client-side library error: improper field validation",
155             };
156              
157             our $TYPE2CLASS =
158             {
159             "account" => "Net::API::Stripe::Connect::Account",
160             "account_bank_account" => "Net::API::Stripe::Connect::ExternalAccount::Bank",
161             "account_card" => "Net::API::Stripe::Connect::ExternalAccount::Card",
162             "account_link" => "Net::API::Stripe::Connect::Account::Link",
163             "ach_credit_transfer" => "Net::API::Stripe::Payment::Source::ACHCreditTransfer",
164             "ach_debit" => "Net::API::Stripe::Payment::Source::ACHDebit",
165             "additional_document" => "Net::API::Stripe::Connect::Account::Document",
166             "address" => "Net::API::Stripe::Address",
167             "address_kana" => "Net::API::Stripe::AddressKana",
168             "address_kanji" => "Net::API::Stripe::AddressKanji",
169             "application" => "Net::API::Stripe::Connect::Account",
170             "application_fee" => "Net::API::Stripe::Connect::ApplicationFee",
171             "authorization_controls" => "Net::API::Stripe::Issuing::Card::AuthorizationsControl",
172             "balance" => "Net::API::Stripe::Balance",
173             "balance_transaction" => "Net::API::Stripe::Balance::Transaction",
174             # "bank_account" => "Net::API::Stripe::Connect::ExternalAccount::Bank",
175             # which inherits from Net::API::Stripe::Connect::ExternalAccount::Bank
176             "bank_account" => "Net::API::Stripe::Customer::BankAccount",
177             "billing" => "Net::API::Stripe::Billing::Details",
178             "billing_address" => "Net::API::Stripe::Address",
179             "billing_details" => "Net::API::Stripe::Billing::Details",
180             "billing_portal_configuration" => "Net::API::Stripe::Billing::PortalConfiguration",
181             "billing_portal.session" => "Net::API::Stripe::Billing::PortalSession",
182             "billing_thresholds" => "Net::API::Stripe::Billing::Thresholds",
183             "bitcoin_transaction" => "Net::API::Stripe::Bitcoin::Transaction",
184             "branding" => "Net::API::Stripe::Connect::Account::Branding",
185             "business_profile" => "Net::API::Stripe::Connect::Business::Profile",
186             "capability" => "Net::API::Stripe::Connect::Account::Capability",
187             # "card" => "Net::API::Stripe::Connect::ExternalAccount::Card",
188             # which inherits from Net::API::Stripe::Connect::ExternalAccount::Card
189             "card" => "Net::API::Stripe::Customer::Card",
190             "card_payments" => "Net::API::Stripe::Connect::Account::Settings::CardPayments",
191             "cardholder" => "Net::API::Stripe::Issuing::Card::Holder",
192             "cash_balance" => "Net::API::Stripe::Cash::Balance",
193             "charge" => "Net::API::Stripe::Charge",
194             "charges" => "Net::API::Stripe::List",
195             "checkout.session" => "Net::API::Stripe::Checkout::Session",
196             "checkout_session" => "Net::API::Stripe::Checkout::Session",
197             "code_verification" => "Net::API::Stripe::Payment::Source::CodeVerification",
198             "company" => "Net::API::Stripe::Connect::Account::Company",
199             "country_spec" => "Net::API::Stripe::Connect::CountrySpec",
200             "coupon" => "Net::API::Stripe::Billing::Coupon",
201             "credit_note" => "Net::API::Stripe::Billing::CreditNote",
202             "credit_note_line_item" => "Net::API::Stripe::Billing::CreditNote::LineItem",
203             "credit_noteline_item" => "Net::API::Stripe::Billing::CreditNote::LineItem",
204             "customer" => "Net::API::Stripe::Customer",
205             "customer_address" => "Net::API::Stripe::Address",
206             "customer_balance_transaction" => "Net::API::Stripe::Customer::BalanceTransaction",
207             "customer_bank_account" => "Net::API::Stripe::Connect::ExternalAccount::Bank",
208             "customer_cash_balance_transaction" => "Net::API::Stripe::Cash::Transaction",
209             "customer_shipping" => "Net::API::Stripe::Shipping",
210             "dashboard" => "Net::API::Stripe::Connect::Account::Settings::Dashboard",
211             "data" => "Net::API::Stripe::Event::Data",
212             "discount" => "Net::API::Stripe::Billing::Discount",
213             "dispute" => "Net::API::Stripe::Dispute",
214             "dispute_evidence" => "Net::API::Stripe::Dispute::Evidence",
215             "document" => "Net::API::Stripe::Connect::Account::Document",
216             "early_fraud_warning" => "Net::API::Stripe::Fraud",
217             "error" => "Net::API::Stripe::Error",
218             "event" => "Net::API::Stripe::Event",
219             "evidence" => "Net::API::Stripe::Issuing::Dispute::Evidence",
220             "evidence_details" => "Net::API::Stripe::Dispute::EvidenceDetails",
221             "external_accounts" => "Net::API::Stripe::List",
222             "fee_refund" => "Net::API::Stripe::Connect::ApplicationFee::Refund",
223             "file" => "Net::API::Stripe::File",
224             "file_link" => "Net::API::Stripe::File::Link",
225             "fraud_value_list" => "Net::API::Stripe::Fraud::ValueList",
226             "fraud_value_list_item" => "Net::API::Stripe::Fraud::ValueList::Item",
227             "fraud_warning" => "Net::API::Stripe::Fraud",
228             "fraudulent" => "Net::API::Stripe::Issuing::Dispute::Evidence::Fraudulent",
229             "generated_from" => "Net::API::Stripe::Payment::GeneratedFrom",
230             "identity_verification_report" => "Net::API::Stripe::Identity::VerificationReport",
231             "identity_verification_session" => "Net::API::Stripe::Identity::VerificationSession",
232             "individual" => "Net::API::Stripe::Connect::Person",
233             "inventory" => "Net::API::Stripe::Order::SKU::Inventory",
234             "invoice" => "Net::API::Stripe::Billing::Invoice",
235             "invoice_customer_balance_settings" => "Net::API::Stripe::Billing::Invoice::BalanceSettings",
236             "invoice_settings" => "Net::API::Stripe::Billing::Invoice::Settings",
237             "invoiceitem" => "Net::API::Stripe::Billing::Invoice::Item",
238             "invoice_item" => "Net::API::Stripe::Billing::Invoice::Item",
239             "ip_address_location" => "Net::API::Stripe::GeoLocation",
240             "issuing.authorization" => "Net::API::Stripe::Issuing::Authorization",
241             "issuing.card" => "Net::API::Stripe::Issuing::Card",
242             "issuing.cardholder" => "Net::API::Stripe::Issuing::Card::Holder",
243             "issuing.dispute" => "Net::API::Stripe::Issuing::Dispute",
244             "issuing.transaction" => "Net::API::Stripe::Issuing::Transaction",
245             "issuing_authorization" => "Net::API::Stripe::Issuing::Authorization",
246             "issuing_card" => "Net::API::Stripe::Issuing::Card",
247             "issuing_cardholder" => "Net::API::Stripe::Issuing::Card::Holder",
248             "issuing_dispute" => "Net::API::Stripe::Issuing::Dispute",
249             "issuing_transaction" => "Net::API::Stripe::Issuing::Transaction",
250             "item" => "Net::API::Stripe::List::Item",
251             "items" => "Net::API::Stripe::List",
252             "last_payment_error" => "Net::API::Stripe::Error",
253             "last_setup_error" => "Net::API::Stripe::Error",
254             "line_item" => "Net::API::Stripe::Billing::Invoice::LineItem",
255             "lines" => "Net::API::Stripe::List",
256             "links" => "Net::API::Stripe::List",
257             "list" => "Net::API::Stripe::List",
258             "list_items" => "Net::API::Stripe::List",
259             "login_link" => "Net::API::Stripe::Connect::Account::LoginLink",
260             "mandate" => "Net::API::Stripe::Mandate",
261             "merchant_data" => "Net::API::Stripe::Issuing::MerchantData",
262             "next_action" => "Net::API::Stripe::Payment::Intent::NextAction",
263             "order" => "Net::API::Stripe::Order",
264             "order_legacy" => "Net::API::Stripe::Order",
265             "order_item" => "Net::API::Stripe::Order::Item",
266             "order_return" => "Net::API::Stripe::Order::Return",
267             "other" => "Net::API::Stripe::Issuing::Dispute::Evidence::Other",
268             "outcome" => "Net::API::Stripe::Charge::Outcome",
269             "owner" => "Net::API::Stripe::Payment::Source::Owner",
270             "package_dimensions" => "Net::API::Stripe::Order::SKU::PackageDimensions",
271             "payment_intent" => "Net::API::Stripe::Payment::Intent",
272             "payment_method" => "Net::API::Stripe::Payment::Method",
273             "payment_method_details" => "Net::API::Stripe::Payment::Method::Details",
274             "payments" => "Net::API::Stripe::Connect::Account::Settings::Payments",
275             "payout" => "Net::API::Stripe::Payout",
276             "payouts" => "Net::API::Stripe::Connect::Account::Settings::Payouts",
277             "pending_invoice_item_interval" => "Net::API::Stripe::Billing::Plan",
278             "period" => "Net::API::Stripe::Billing::Invoice::Period",
279             "person" => "Net::API::Stripe::Connect::Person",
280             "plan" => "Net::API::Stripe::Billing::Plan",
281             "portal_configuration" => "Net::API::Stripe::Billing::PortalConfiguration",
282             "portal_session" => "Net::API::Stripe::Billing::PortalSession",
283             "price" => "Net::API::Stripe::Price",
284             "product" => "Net::API::Stripe::Product",
285             "promotion_code" => "Net::API::Stripe::Billing::PromotionCode",
286             "quote" => "Net::API::Stripe::Billing::Quote",
287             "radar.early_fraud_warning" => "Net::API::Stripe::Fraud",
288             "radar.value_list" => "Net::API::Stripe::Fraud::ValueList",
289             "radar.value_list_item" => "Net::API::Stripe::Fraud::ValueList::Item",
290             "radar_early_fraud_warning" => "Net::API::Stripe::Fraud",
291             "radar_value_list" => "Net::API::Stripe::Fraud::ValueList",
292             "radar_value_list_item" => "Net::API::Stripe::Fraud::ValueList::Item",
293             "receiver" => "Net::API::Stripe::Payment::Source::Receiver",
294             "redirect" => "Net::API::Stripe::Payment::Source::Redirect",
295             "refund" => "Net::API::Stripe::Refund",
296             "refunds" => "Net::API::Stripe::Charge::Refunds",
297             "relationship" => "Net::API::Stripe::Connect::Account::Relationship",
298             "report_run" => "Net::API::Stripe::Reporting::ReportRun",
299             "report_type" => "Net::API::Stripe::Reporting::ReportType",
300             "reporting.report_run" => "Net::API::Stripe::Reporting::ReportRun",
301             "reporting.report_type" => "Net::API::Stripe::Reporting::ReportType",
302             "reporting_report_run" => "Net::API::Stripe::Reporting::ReportRun",
303             "reporting_report_type" => "Net::API::Stripe::Reporting::ReportType",
304             "request" => "Net::API::Stripe::Event::Request",
305             "requirements" => "Net::API::Stripe::Connect::Account::Requirements",
306             "result" => "Net::API::Stripe::File",
307             "returns" => "Net::API::Stripe::Order::Returns",
308             "reversals" => "Net::API::Stripe::Connect::Transfer::Reversals",
309             "review" => "Net::API::Stripe::Fraud::Review",
310             "review_session" => "Net::API::Stripe::Fraud::Review::Session",
311             "scheduled_query_run" => "Net::API::Stripe::Sigma::ScheduledQueryRun",
312             "settings" => "Net::API::Stripe::Connect::Account::Settings",
313             "setup_attempt" => "Net::API::Stripe::SetupAttempt",
314             "setup_intent" => "Net::API::Stripe::Payment::Intent::Setup",
315             "shipping" => "Net::API::Stripe::Shipping",
316             "shipping_address" => "Net::API::Stripe::Address",
317             "shipping_rate" => "Net::API::Stripe::Shipping::Rate",
318             "sku" => "Net::API::Stripe::Order::SKU",
319             "source" => "Net::API::Stripe::Payment::Source",
320             "source_order" => "Net::API::Stripe::Order",
321             "sources" => "Net::API::Stripe::Customer::Sources",
322             "status_transitions" => "Net::API::Stripe::Billing::Invoice::StatusTransition",
323             "subscription" => "Net::API::Stripe::Billing::Subscription",
324             "subscription_item" => "Net::API::Stripe::Billing::Subscription::Item",
325             "subscription_schedule" => "Net::API::Stripe::Billing::Subscription::Schedule",
326             "subscriptions" => "Net::API::Stripe::List",
327             "support_address" => "Net::API::Stripe::Address",
328             "tax_code" => "Net::API::Stripe::Product::TaxCode",
329             "tax_id" => "Net::API::Stripe::Customer::TaxId",
330             "tax_ids" => "Net::API::Stripe::Customer::TaxIds",
331             "tax_info" => "Net::API::Stripe::Customer::TaxInfo",
332             "tax_info_verification" => "Net::API::Stripe::Customer::TaxInfoVerification",
333             "tax_rate" => "Net::API::Stripe::Tax::Rate",
334             "terminal.connection_token" => "Net::API::Stripe::Terminal::ConnectionToken",
335             "terminal.location" => "Net::API::Stripe::Terminal::Location",
336             "terminal.reader" => "Net::API::Stripe::Terminal::Reader",
337             "terminal_connection_token" => "Net::API::Stripe::Terminal::ConnectionToken",
338             "terminal_location" => "Net::API::Stripe::Terminal::Location",
339             "terminal_reader" => "Net::API::Stripe::Terminal::Reader",
340             "threshold_reason" => "Net::API::Stripe::Billing::Thresholds",
341             "token" => "Net::API::Stripe::Token",
342             "topup" => "Net::API::Stripe::Connect::TopUp",
343             "tos_acceptance" => "Net::API::Stripe::Connect::Account::TosAcceptance",
344             "transactions" => "Net::API::Stripe::List",
345             "transfer" => "Net::API::Stripe::Connect::Transfer",
346             "transfer_data" => "Net::API::Stripe::Payment::Intent::TransferData",
347             "transfer_reversal" => "Net::API::Stripe::Connect::Transfer::Reversal",
348             "transform_usage" => "Net::API::Stripe::Billing::Plan::TransformUsage",
349             "usage_record" => "Net::API::Stripe::Billing::UsageRecord",
350             "verification" => "Net::API::Stripe::Connect::Account::Verification",
351             "verification_data" => "Net::API::Stripe::Issuing::Authorization::VerificationData",
352             "verification_fields" => "Net::API::Stripe::Connect::CountrySpec::VerificationFields",
353             "verified_address" => "Net::API::Stripe::Address",
354             "webhook_endpoint" => "Net::API::Stripe::WebHook::Object",
355             };
356              
357             our $EXPANDABLES_BY_CLASS =
358             {
359             "account" => {},
360             "account_bank_account" => { account => ["account"], customer => ["customer"] },
361             "account_card" => { account => ["account"], customer => ["customer"] },
362             "account_link" => {},
363             "address" => {},
364             "address_kana" => {},
365             "address_kanji" => {},
366             "application_fee" => {
367             account => ["account"],
368             application => ["account"],
369             balance_transaction => ["balance_transaction"],
370             charge => ["charge"],
371             originating_transaction => ["charge"],
372             },
373             "apps.secret" => {},
374             "balance" => {},
375             "balance_transaction" => {
376             source => [
377             "charge",
378             "dispute",
379             "fee_refund",
380             "payout",
381             "application_fee",
382             "refund",
383             "topup",
384             "issuing_transaction",
385             "transfer",
386             "transfer_reversal",
387             ],
388             },
389             "bank_account" => { account => ["account"], customer => ["customer"] },
390             "billing_details" => {},
391             "billing_portal.configuration" => { application => ["account"] },
392             "billing_portal.session" => { configuration => ["billing_portal.configuration"] },
393             "billing_thresholds" => {},
394             "business_profile" => {},
395             "capability" => { account => ["account"] },
396             "card" => { account => ["account"], customer => ["customer"] },
397             "cash_balance" => {},
398             "charge" => {
399             application => ["account"],
400             application_fee => ["application_fee"],
401             balance_transaction => ["balance_transaction"],
402             customer => ["customer"],
403             failure_balance_transaction => ["balance_transaction", "balance_transaction"],
404             invoice => ["invoice"],
405             on_behalf_of => ["account"],
406             payment_intent => ["payment_intent"],
407             review => ["review"],
408             source_transfer => ["transfer"],
409             transfer => ["transfer"],
410             },
411             "checkout.session" => {
412             customer => ["customer"],
413             payment_intent => ["payment_intent"],
414             payment_link => ["payment_link"],
415             setup_intent => ["setup_intent"],
416             subscription => ["subscription"],
417             },
418             "code_verification" => {},
419             "company" => {},
420             "country_spec" => {},
421             "coupon" => {},
422             "credit_note" => {
423             customer => ["customer"],
424             customer_balance_transaction => ["customer_balance_transaction"],
425             invoice => ["invoice"],
426             refund => ["refund"],
427             },
428             "credit_note_line_item" => {},
429             "customer" => {
430             default_source => ["bank_account", "card", "source"],
431             test_clock => ["test_helpers.test_clock", "test_helpers.test_clock"],
432             },
433             "customer_balance_transaction" => {
434             credit_note => ["credit_note"],
435             customer => ["customer"],
436             invoice => ["invoice"],
437             },
438             "customer_cash_balance_transaction" => { customer => ["customer"] },
439             "data" => {},
440             "discount" => { customer => ["customer"], promotion_code => ["promotion_code"] },
441             "dispute" => { charge => ["charge"], payment_intent => ["payment_intent"] },
442             "dispute_evidence" => {
443             cancellation_policy => ["file"],
444             customer_communication => ["file"],
445             customer_signature => ["file"],
446             duplicate_charge_documentation => ["file"],
447             receipt => ["file"],
448             refund_policy => ["file"],
449             service_documentation => ["file"],
450             shipping_documentation => ["file"],
451             uncategorized_file => ["file"],
452             },
453             "document" => {},
454             "error" => {},
455             "event" => {},
456             "evidence" => {},
457             "evidence_details" => {},
458             "fee_refund" => {
459             balance_transaction => ["balance_transaction"],
460             fee => ["application_fee"],
461             },
462             "file" => {},
463             "file_link" => { file => ["file"] },
464             "financial_connections.account" => {
465             ownership => [
466             "financial_connections.account_ownership",
467             "financial_connections.account_ownership",
468             ],
469             },
470             "financial_connections.account_owner" => {},
471             "financial_connections.account_ownership" => {},
472             "financial_connections.session" => {},
473             "funding_instructions" => {},
474             "identity.verification_report" => {},
475             "identity.verification_session" => {
476             last_verification_report => [
477             "identity_verification_report",
478             "identity_verification_report",
479             ],
480             },
481             "invoice" => {
482             account_tax_ids => ["tax_id"],
483             application => ["account"],
484             charge => ["charge"],
485             customer => ["customer"],
486             default_payment_method => ["payment_method"],
487             default_source => ["bank_account", "card", "source"],
488             discounts => ["discount"],
489             on_behalf_of => ["account"],
490             payment_intent => ["payment_intent"],
491             quote => ["quote"],
492             subscription => ["subscription"],
493             test_clock => ["test_helpers.test_clock"],
494             },
495             "invoice_settings" => { default_payment_method => ["payment_method"] },
496             "invoiceitem" => {
497             customer => ["customer"],
498             discounts => ["discount"],
499             invoice => ["invoice"],
500             subscription => ["subscription"],
501             test_clock => ["test_helpers.test_clock"],
502             },
503             "ip_address_location" => {},
504             "issuing.authorization" => { cardholder => ["issuing_cardholder"] },
505             "issuing.card" => {
506             replaced_by => ["issuing_card"],
507             replacement_for => ["issuing_card"],
508             },
509             "issuing.cardholder" => {},
510             "issuing.dispute" => { transaction => ["issuing_transaction"] },
511             "issuing.transaction" => {
512             authorization => ["issuing_authorization"],
513             balance_transaction => ["balance_transaction"],
514             card => ["issuing_card"],
515             cardholder => ["issuing_cardholder"],
516             dispute => ["issuing_dispute"],
517             },
518             "item" => {},
519             "line_item" => { discounts => ["discount"] },
520             "login_link" => {},
521             "mandate" => { payment_method => ["payment_method"] },
522             "merchant_data" => {},
523             "next_action" => {},
524             "outcome" => {},
525             "owner" => {},
526             "package_dimensions" => {},
527             "payment_intent" => {
528             application => ["account"],
529             customer => ["customer"],
530             invoice => ["invoice"],
531             on_behalf_of => ["account"],
532             payment_method => ["payment_method"],
533             review => ["review"],
534             },
535             "payment_link" => { on_behalf_of => ["account"] },
536             "payment_method" => { customer => ["customer"] },
537             "payment_method_details" => {},
538             "payout" => {
539             balance_transaction => ["balance_transaction"],
540             destination => ["card", "bank_account"],
541             failure_balance_transaction => ["balance_transaction"],
542             original_payout => ["payout"],
543             reversed_by => ["payout"],
544             },
545             "period" => {},
546             "person" => {},
547             "plan" => { product => ["product"] },
548             "price" => { product => ["product"] },
549             "product" => {
550             default_price => ["price", "price"],
551             tax_code => ["tax_code", "tax_code"],
552             },
553             "promotion_code" => { customer => ["customer"] },
554             "quote" => {
555             application => ["account"],
556             customer => ["customer"],
557             default_tax_rates => ["tax_rate"],
558             discounts => ["discount"],
559             invoice => ["invoice"],
560             on_behalf_of => ["account"],
561             subscription => ["subscription"],
562             subscription_schedule => ["subscription_schedule"],
563             test_clock => ["test_helpers.test_clock"],
564             },
565             "radar.early_fraud_warning" => {
566             charge => ["charge"],
567             payment_intent => ["payment_intent", "payment_intent"],
568             },
569             "radar.value_list" => {},
570             "radar.value_list_item" => {},
571             "receiver" => {},
572             "redirect" => {},
573             "refund" => {
574             balance_transaction => ["balance_transaction"],
575             charge => ["charge"],
576             failure_balance_transaction => ["balance_transaction"],
577             payment_intent => ["payment_intent"],
578             source_transfer_reversal => ["transfer_reversal"],
579             transfer_reversal => ["transfer_reversal"],
580             },
581             "relationship" => {},
582             "reporting.report_run" => {},
583             "reporting.report_type" => {},
584             "request" => {},
585             "requirements" => {},
586             "review" => { charge => ["charge"], payment_intent => ["payment_intent"] },
587             "scheduled_query_run" => {},
588             "settings" => {},
589             "setup_attempt" => {
590             application => ["account"],
591             customer => ["customer"],
592             on_behalf_of => ["account"],
593             payment_method => ["payment_method"],
594             setup_intent => ["setup_intent"],
595             },
596             "setup_intent" => {
597             application => ["account"],
598             customer => ["customer"],
599             latest_attempt => ["setup_attempt"],
600             mandate => ["mandate"],
601             on_behalf_of => ["account"],
602             payment_method => ["payment_method"],
603             single_use_mandate => ["mandate"],
604             },
605             "shipping" => {},
606             "shipping_rate" => { tax_code => ["tax_code"] },
607             "source" => {},
608             "source_order" => {},
609             "status_transitions" => {},
610             "subscription" => {
611             application => ["account"],
612             customer => ["customer"],
613             default_payment_method => ["payment_method"],
614             default_source => ["bank_account", "card", "source"],
615             latest_invoice => ["invoice"],
616             pending_setup_intent => ["setup_intent"],
617             schedule => ["subscription_schedule"],
618             test_clock => ["test_helpers.test_clock"],
619             },
620             "subscription_item" => {},
621             "subscription_schedule" => {
622             application => ["account", "account"],
623             customer => ["customer"],
624             subscription => ["subscription"],
625             test_clock => ["test_helpers.test_clock", "test_helpers.test_clock"],
626             },
627             "tax_code" => {},
628             "tax_id" => { customer => ["customer"] },
629             "tax_rate" => {},
630             "terminal.configuration" => { splashscreen => ["file", "file"] },
631             "terminal.connection_token" => {},
632             "terminal.location" => {},
633             "terminal.reader" => { location => ["terminal_location"] },
634             "test_helpers.test_clock" => {},
635             "token" => {},
636             "topup" => { balance_transaction => ["balance_transaction"] },
637             "tos_acceptance" => {},
638             "transfer" => {
639             balance_transaction => ["balance_transaction"],
640             destination => ["account"],
641             destination_payment => ["charge"],
642             source_transaction => ["charge"],
643             },
644             "transfer_data" => { destination => ["account"] },
645             "transfer_reversal" => {
646             balance_transaction => ["balance_transaction"],
647             destination_payment_refund => ["refund"],
648             source_refund => ["refund"],
649             transfer => ["transfer"],
650             },
651             "transform_usage" => {},
652             "treasury.credit_reversal" => { transaction => ["treasury.transaction", "treasury.transaction"] },
653             "treasury.debit_reversal" => { transaction => ["treasury.transaction", "treasury.transaction"] },
654             "treasury.financial_account" => {},
655             "treasury.financial_account_features" => {},
656             "treasury.inbound_transfer" => { transaction => ["treasury.transaction", "treasury.transaction"] },
657             "treasury.outbound_payment" => {
658             transaction => [
659             "treasury.transaction",
660             "treasury.transaction",
661             "treasury.transaction",
662             ],
663             },
664             "treasury.outbound_transfer" => {
665             transaction => [
666             "treasury.transaction",
667             "treasury.transaction",
668             "treasury.transaction",
669             ],
670             },
671             "treasury.received_credit" => { transaction => ["treasury.transaction", "treasury.transaction"] },
672             "treasury.received_debit" => { transaction => ["treasury.transaction", "treasury.transaction"] },
673             "treasury.transaction" => {},
674             "treasury.transaction_entry" => { transaction => ["treasury.transaction", "treasury.transaction"] },
675             "usage_record" => {},
676             "usage_record_summary" => {},
677             "verification" => {},
678             "verification_data" => {},
679             "verification_fields" => {},
680             "webhook_endpoint" => {},
681             };
682              
683             # As per Stripe documentation: https://stripe.com/docs/api/expanding_objects
684             our $EXPANDABLES = {};
685             our $EXPAND_MAX_DEPTH = 4;
686              
687             {
688             my $get_expandables;
689             $get_expandables = sub
690             {
691             my $class = shift( @_ ) || CORE::return;
692             my $pref = shift( @_ );
693             my $depth = shift( @_ ) || 0;
694             # print( "." x $depth, "Checking class \"$class\" with prefix \"$pref\" and depth $depth\n" );
695             CORE::return if( $depth > $EXPAND_MAX_DEPTH );
696             CORE::return if( !CORE::exists( $EXPANDABLES_BY_CLASS->{ $class } ) );
697             my $ref = $EXPANDABLES_BY_CLASS->{ $class };
698             my $list = [];
699             CORE::push( @$list, $pref ) if( CORE::length( $pref ) );
700             foreach my $prop ( sort( keys( %$ref ) ) )
701             {
702             my $target_classes = ref( $ref->{ $prop } ) eq 'ARRAY' ? $ref->{ $prop } : [ $ref->{ $prop } ];
703             my $new_prefix = CORE::length( $pref ) ? "${pref}.${prop}" : $prop;
704             my $this_path = [split(/\./, $new_prefix)];
705             my $this_depth = scalar( @$this_path );
706             foreach my $target_class ( @$target_classes )
707             {
708             my $res = $get_expandables->( $target_class, $new_prefix, $this_depth );
709             CORE::push( @$list, @$res ) if( ref( $res ) && scalar( @$res ) );
710             }
711             }
712             CORE::return( $list );
713             };
714              
715             if( !scalar( keys( %$EXPANDABLES ) ) )
716             {
717             foreach my $prop ( sort( keys( %$EXPANDABLES_BY_CLASS ) ) )
718             {
719             if( !scalar( keys( %{$EXPANDABLES_BY_CLASS->{ $prop }} ) ) )
720             {
721             $EXPANDABLES->{ $prop } = [];
722             next;
723             }
724             my $res = $get_expandables->( $prop, '', 0 );
725             $EXPANDABLES->{ $prop } = $res if( ref( $res ) && scalar( @$res ) );
726             }
727             $EXPANDABLES->{invoice_item} = $EXPANDABLES->{invoiceitem};
728             }
729             }
730              
731             sub init;
732             sub api_uri;
733             sub auth;
734             sub browser;
735             sub code2error;
736             sub conf_file;
737             sub cookie_file;
738             sub currency;
739             sub delete;
740             sub encode_with_json;
741             sub expand;
742             sub fields;
743             sub file_api_uri;
744             sub generate_uuid;
745             sub get;
746             sub http_client;
747             sub http_request;
748             sub http_response;
749             sub ignore_unknown_parameters;
750             sub json;
751             sub key;
752             sub livemode;
753             sub post;
754             sub post_multipart;
755             sub version;
756             sub webhook_validate_signature;
757             sub webhook_validate_caller_ip;
758             sub account;
759             sub account_bank_account;
760             sub account_bank_account_create;
761             sub account_bank_account_delete;
762             sub account_bank_account_list;
763             sub account_bank_account_retrieve;
764             sub account_bank_account_update;
765             sub account_bank_accounts;
766             sub account_card;
767             sub account_card_create;
768             sub account_card_delete;
769             sub account_card_list;
770             sub account_card_retrieve;
771             sub account_card_update;
772             sub account_cards;
773             sub account_create;
774             sub account_delete;
775             sub account_link;
776             sub account_link_create;
777             sub account_links;
778             sub account_list;
779             sub account_reject;
780             sub account_retrieve;
781             sub account_token_create;
782             sub account_update;
783             sub accounts;
784             sub address;
785             sub address_kana;
786             sub address_kanji;
787             sub amount;
788             sub application_fee;
789             sub application_fee_list;
790             sub application_fee_refund;
791             sub application_fee_retrieve;
792             sub application_fees;
793             sub apps_secret;
794             sub apps_secret_delete;
795             sub apps_secret_find;
796             sub apps_secret_list;
797             sub apps_secret_set;
798             sub apps_secrets;
799             sub authorization;
800             sub balance;
801             sub balance_retrieve;
802             sub balance_transaction;
803             sub balance_transaction_list;
804             sub balance_transaction_retrieve;
805             sub balance_transactions;
806             sub balances;
807             sub bank_account;
808             sub bank_account_create;
809             sub bank_account_delete;
810             sub bank_account_list;
811             sub bank_account_retrieve;
812             sub bank_account_update;
813             sub bank_account_verify;
814             sub bank_accounts;
815             sub bank_token_create;
816             sub billing_details;
817             sub billing_portal_configuration;
818             sub billing_portal_configuration_create;
819             sub billing_portal_configuration_list;
820             sub billing_portal_configuration_retrieve;
821             sub billing_portal_configuration_update;
822             sub billing_portal_configurations;
823             sub billing_portal_session;
824             sub billing_portal_session_create;
825             sub billing_portal_sessions;
826             sub billing_thresholds;
827             sub business_profile;
828             sub capability;
829             sub capability_list;
830             sub capability_retrieve;
831             sub capability_update;
832             sub capabilitys;
833             sub card;
834             sub card_create;
835             sub card_delete;
836             sub card_holder;
837             sub card_list;
838             sub card_retrieve;
839             sub card_token_create;
840             sub card_update;
841             sub cards;
842             sub cash_balance;
843             sub cash_balance_retrieve;
844             sub cash_balance_update;
845             sub cash_balances;
846             sub cash_transction;
847             sub charge;
848             sub charge_capture;
849             sub charge_create;
850             sub charge_list;
851             sub charge_retrieve;
852             sub charge_search;
853             sub charge_update;
854             sub charges;
855             sub checkout_session;
856             sub checkout_session_create;
857             sub checkout_session_expire;
858             sub checkout_session_items;
859             sub checkout_session_list;
860             sub checkout_session_retrieve;
861             sub checkout_sessions;
862             sub code_verification;
863             sub company;
864             sub connection_token;
865             sub country_spec;
866             sub country_spec_list;
867             sub country_spec_retrieve;
868             sub country_specs;
869             sub coupon;
870             sub coupon_create;
871             sub coupon_delete;
872             sub coupon_list;
873             sub coupon_retrieve;
874             sub coupon_update;
875             sub coupons;
876             sub credit_note;
877             sub credit_note_create;
878             sub credit_note_line_item;
879             sub credit_note_line_item_list;
880             sub credit_note_line_items;
881             sub credit_note_lines;
882             sub credit_note_lines_preview;
883             sub credit_note_list;
884             sub credit_note_preview;
885             sub credit_note_retrieve;
886             sub credit_note_update;
887             sub credit_note_void;
888             sub credit_notes;
889             sub customer;
890             sub customer_balance_transaction;
891             sub customer_balance_transaction_create;
892             sub customer_balance_transaction_list;
893             sub customer_balance_transaction_retrieve;
894             sub customer_balance_transaction_update;
895             sub customer_balance_transactions;
896             sub customer_bank_account;
897             sub customer_bank_account_create;
898             sub customer_bank_account_delete;
899             sub customer_bank_account_list;
900             sub customer_bank_account_retrieve;
901             sub customer_bank_account_update;
902             sub customer_bank_account_verify;
903             sub customer_bank_accounts;
904             sub customer_cash_balance_transaction;
905             sub customer_cash_balance_transaction_fund_cash_balance;
906             sub customer_cash_balance_transaction_list;
907             sub customer_cash_balance_transaction_retrieve;
908             sub customer_cash_balance_transactions;
909             sub customer_create;
910             sub customer_delete;
911             sub customer_delete_discount;
912             sub customer_list;
913             sub customer_payment_method;
914             sub customer_payment_methods;
915             sub customer_retrieve;
916             sub customer_search;
917             sub customer_tax_id;
918             sub customer_update;
919             sub customers;
920             sub cvc_update_token_create;
921             sub data;
922             sub discount;
923             sub discount_delete;
924             sub discounts;
925             sub dispute;
926             sub dispute_close;
927             sub dispute_evidence;
928             sub dispute_list;
929             sub dispute_retrieve;
930             sub dispute_update;
931             sub disputes;
932             sub document;
933             sub event;
934             sub event_list;
935             sub event_retrieve;
936             sub events;
937             sub evidence;
938             sub evidence_details;
939             sub fee_refund;
940             sub fee_refund_create;
941             sub fee_refund_list;
942             sub fee_refund_retrieve;
943             sub fee_refund_update;
944             sub fee_refunds;
945             sub file;
946             sub file_create;
947             sub file_link;
948             sub file_link_create;
949             sub file_link_list;
950             sub file_link_retrieve;
951             sub file_link_update;
952             sub file_links;
953             sub file_list;
954             sub file_retrieve;
955             sub files;
956             sub financial_connections_account;
957             sub financial_connections_account_disconnect;
958             sub financial_connections_account_list;
959             sub financial_connections_account_owner;
960             sub financial_connections_account_owner_list;
961             sub financial_connections_account_owners;
962             sub financial_connections_account_ownership;
963             sub financial_connections_account_refresh;
964             sub financial_connections_account_retrieve;
965             sub financial_connections_accounts;
966             sub financial_connections_session;
967             sub financial_connections_session_create;
968             sub financial_connections_session_retrieve;
969             sub financial_connections_sessions;
970             sub fraud;
971             sub funding_instructions;
972             sub funding_instructions_create;
973             sub funding_instructions_fund;
974             sub funding_instructions_list;
975             sub funding_instructionss;
976             sub identity_verification_report;
977             sub identity_verification_report_list;
978             sub identity_verification_report_retrieve;
979             sub identity_verification_reports;
980             sub identity_verification_session;
981             sub identity_verification_session_cancel;
982             sub identity_verification_session_create;
983             sub identity_verification_session_list;
984             sub identity_verification_session_redact;
985             sub identity_verification_session_retrieve;
986             sub identity_verification_session_update;
987             sub identity_verification_sessions;
988             sub invoice;
989             sub invoice_create;
990             sub invoice_delete;
991             sub invoice_finalise;
992             sub invoice_finalize;
993             sub invoice_item;
994             sub invoice_item_create;
995             sub invoice_item_delete;
996             sub invoice_item_list;
997             sub invoice_item_retrieve;
998             sub invoice_item_update;
999             sub invoice_items;
1000             sub invoice_line_item;
1001             sub invoice_lines;
1002             sub invoice_lines_upcoming;
1003             sub invoice_list;
1004             sub invoice_pay;
1005             sub invoice_retrieve;
1006             sub invoice_search;
1007             sub invoice_send;
1008             sub invoice_settings;
1009             sub invoice_uncollectible;
1010             sub invoice_upcoming;
1011             sub invoice_update;
1012             sub invoice_void;
1013             sub invoice_write_off;
1014             sub invoiceitem;
1015             sub invoiceitem_create;
1016             sub invoiceitem_delete;
1017             sub invoiceitem_list;
1018             sub invoiceitem_retrieve;
1019             sub invoiceitem_update;
1020             sub invoiceitems;
1021             sub invoices;
1022             sub ip_address_location;
1023             sub issuing_authorization;
1024             sub issuing_authorization_approve;
1025             sub issuing_authorization_decline;
1026             sub issuing_authorization_list;
1027             sub issuing_authorization_retrieve;
1028             sub issuing_authorization_update;
1029             sub issuing_authorizations;
1030             sub issuing_card;
1031             sub issuing_card_create;
1032             sub issuing_card_deliver;
1033             sub issuing_card_fail;
1034             sub issuing_card_list;
1035             sub issuing_card_retrieve;
1036             sub issuing_card_return;
1037             sub issuing_card_ship;
1038             sub issuing_card_update;
1039             sub issuing_cardholder;
1040             sub issuing_cardholder_create;
1041             sub issuing_cardholder_list;
1042             sub issuing_cardholder_retrieve;
1043             sub issuing_cardholder_update;
1044             sub issuing_cardholders;
1045             sub issuing_cards;
1046             sub issuing_dispute;
1047             sub issuing_dispute_create;
1048             sub issuing_dispute_list;
1049             sub issuing_dispute_retrieve;
1050             sub issuing_dispute_submit;
1051             sub issuing_dispute_update;
1052             sub issuing_disputes;
1053             sub issuing_transaction;
1054             sub issuing_transaction_list;
1055             sub issuing_transaction_retrieve;
1056             sub issuing_transaction_update;
1057             sub issuing_transactions;
1058             sub item;
1059             sub line_item;
1060             sub line_item_lines;
1061             sub line_items;
1062             sub location;
1063             sub login_link;
1064             sub login_link_create;
1065             sub login_links;
1066             sub mandate;
1067             sub mandate_retrieve;
1068             sub mandates;
1069             sub merchant_data;
1070             sub next_action;
1071             sub order;
1072             sub order_item;
1073             sub outcome;
1074             sub owner;
1075             sub package_dimensions;
1076             sub payment_intent;
1077             sub payment_intent_apply_customer_balance;
1078             sub payment_intent_cancel;
1079             sub payment_intent_capture;
1080             sub payment_intent_confirm;
1081             sub payment_intent_create;
1082             sub payment_intent_increment;
1083             sub payment_intent_increment_authorization;
1084             sub payment_intent_list;
1085             sub payment_intent_reconcile;
1086             sub payment_intent_retrieve;
1087             sub payment_intent_search;
1088             sub payment_intent_update;
1089             sub payment_intent_verify;
1090             sub payment_intent_verify_microdeposits;
1091             sub payment_intents;
1092             sub payment_link;
1093             sub payment_link_create;
1094             sub payment_link_items;
1095             sub payment_link_line_items;
1096             sub payment_link_list;
1097             sub payment_link_retrieve;
1098             sub payment_link_update;
1099             sub payment_links;
1100             sub payment_method;
1101             sub payment_method_attach;
1102             sub payment_method_create;
1103             sub payment_method_detach;
1104             sub payment_method_details;
1105             sub payment_method_list;
1106             sub payment_method_list_customer_payment_methods;
1107             sub payment_method_retrieve;
1108             sub payment_method_retrieve_customer_payment_method;
1109             sub payment_method_update;
1110             sub payment_methods;
1111             sub payout;
1112             sub payout_cancel;
1113             sub payout_create;
1114             sub payout_list;
1115             sub payout_retrieve;
1116             sub payout_reverse;
1117             sub payout_update;
1118             sub payouts;
1119             sub period;
1120             sub person;
1121             sub person_create;
1122             sub person_delete;
1123             sub person_list;
1124             sub person_retrieve;
1125             sub person_token_create;
1126             sub person_update;
1127             sub persons;
1128             sub pii_token_create;
1129             sub plan;
1130             sub plan_by_product;
1131             sub plan_create;
1132             sub plan_delete;
1133             sub plan_list;
1134             sub plan_retrieve;
1135             sub plan_update;
1136             sub plans;
1137             sub portal_configuration;
1138             sub portal_configuration_create;
1139             sub portal_configuration_list;
1140             sub portal_configuration_retrieve;
1141             sub portal_configuration_update;
1142             sub portal_configurations;
1143             sub portal_session;
1144             sub portal_session_create;
1145             sub portal_sessions;
1146             sub price;
1147             sub price_create;
1148             sub price_list;
1149             sub price_retrieve;
1150             sub price_search;
1151             sub price_update;
1152             sub prices;
1153             sub product;
1154             sub product_by_name;
1155             sub product_create;
1156             sub product_delete;
1157             sub product_list;
1158             sub product_retrieve;
1159             sub product_search;
1160             sub product_update;
1161             sub products;
1162             sub promotion_code;
1163             sub promotion_code_create;
1164             sub promotion_code_list;
1165             sub promotion_code_retrieve;
1166             sub promotion_code_update;
1167             sub promotion_codes;
1168             sub quote;
1169             sub quote_accept;
1170             sub quote_cancel;
1171             sub quote_create;
1172             sub quote_download;
1173             sub quote_finalize;
1174             sub quote_line_items;
1175             sub quote_lines;
1176             sub quote_list;
1177             sub quote_retrieve;
1178             sub quote_update;
1179             sub quote_upfront_line_items;
1180             sub quote_upfront_lines;
1181             sub quotes;
1182             sub radar_early_fraud_warning;
1183             sub radar_early_fraud_warning_list;
1184             sub radar_early_fraud_warning_retrieve;
1185             sub radar_early_fraud_warnings;
1186             sub radar_value_list;
1187             sub radar_value_list_create;
1188             sub radar_value_list_delete;
1189             sub radar_value_list_item;
1190             sub radar_value_list_item_create;
1191             sub radar_value_list_item_delete;
1192             sub radar_value_list_item_list;
1193             sub radar_value_list_item_retrieve;
1194             sub radar_value_list_items;
1195             sub radar_value_list_list;
1196             sub radar_value_list_retrieve;
1197             sub radar_value_list_update;
1198             sub radar_value_lists;
1199             sub reader;
1200             sub receiver;
1201             sub redirect;
1202             sub refund;
1203             sub refund_cancel;
1204             sub refund_create;
1205             sub refund_list;
1206             sub refund_retrieve;
1207             sub refund_update;
1208             sub refunds;
1209             sub relationship;
1210             sub reporting_report_run;
1211             sub reporting_report_run_create;
1212             sub reporting_report_run_list;
1213             sub reporting_report_run_retrieve;
1214             sub reporting_report_runs;
1215             sub reporting_report_type;
1216             sub reporting_report_type_list;
1217             sub reporting_report_type_retrieve;
1218             sub reporting_report_types;
1219             sub request;
1220             sub requirements;
1221             sub return;
1222             sub review;
1223             sub review_approve;
1224             sub review_list;
1225             sub review_retrieve;
1226             sub reviews;
1227             sub schedule;
1228             sub schedule_cancel;
1229             sub schedule_create;
1230             sub schedule_list;
1231             sub schedule_query;
1232             sub schedule_release;
1233             sub schedule_retrieve;
1234             sub schedule_update;
1235             sub scheduled_query_run;
1236             sub scheduled_query_run_list;
1237             sub scheduled_query_run_retrieve;
1238             sub scheduled_query_runs;
1239             sub schedules;
1240             sub session;
1241             sub session_create;
1242             sub session_expire;
1243             sub session_list;
1244             sub session_retrieve;
1245             sub session_retrieve_items;
1246             sub sessions;
1247             sub settings;
1248             sub setup_attempt;
1249             sub setup_attempt_list;
1250             sub setup_attempts;
1251             sub setup_intent;
1252             sub setup_intent_cancel;
1253             sub setup_intent_confirm;
1254             sub setup_intent_create;
1255             sub setup_intent_list;
1256             sub setup_intent_retrieve;
1257             sub setup_intent_update;
1258             sub setup_intent_verify;
1259             sub setup_intent_verify_microdeposits;
1260             sub setup_intents;
1261             sub shipping;
1262             sub shipping_rate;
1263             sub shipping_rate_create;
1264             sub shipping_rate_list;
1265             sub shipping_rate_retrieve;
1266             sub shipping_rate_update;
1267             sub shipping_rates;
1268             sub sku;
1269             sub source;
1270             sub source_attach;
1271             sub source_create;
1272             sub source_detach;
1273             sub source_order;
1274             sub source_retrieve;
1275             sub source_update;
1276             sub sources;
1277             sub status_transitions;
1278             sub subscription;
1279             sub subscription_cancel;
1280             sub subscription_create;
1281             sub subscription_delete;
1282             sub subscription_delete_discount;
1283             sub subscription_item;
1284             sub subscription_item_create;
1285             sub subscription_item_delete;
1286             sub subscription_item_list;
1287             sub subscription_item_retrieve;
1288             sub subscription_item_update;
1289             sub subscription_items;
1290             sub subscription_list;
1291             sub subscription_retrieve;
1292             sub subscription_schedule;
1293             sub subscription_schedule_cancel;
1294             sub subscription_schedule_create;
1295             sub subscription_schedule_list;
1296             sub subscription_schedule_release;
1297             sub subscription_schedule_retrieve;
1298             sub subscription_schedule_update;
1299             sub subscription_schedules;
1300             sub subscription_search;
1301             sub subscription_update;
1302             sub subscriptions;
1303             sub tax_code;
1304             sub tax_code_list;
1305             sub tax_code_retrieve;
1306             sub tax_codes;
1307             sub tax_id;
1308             sub tax_id_create;
1309             sub tax_id_delete;
1310             sub tax_id_list;
1311             sub tax_id_retrieve;
1312             sub tax_ids;
1313             sub tax_rate;
1314             sub tax_rate_create;
1315             sub tax_rate_list;
1316             sub tax_rate_retrieve;
1317             sub tax_rate_update;
1318             sub tax_rates;
1319             sub terminal_configuration;
1320             sub terminal_configuration_create;
1321             sub terminal_configuration_delete;
1322             sub terminal_configuration_list;
1323             sub terminal_configuration_retrieve;
1324             sub terminal_configuration_update;
1325             sub terminal_configurations;
1326             sub terminal_connection_token;
1327             sub terminal_connection_token_create;
1328             sub terminal_connection_tokens;
1329             sub terminal_location;
1330             sub terminal_location_create;
1331             sub terminal_location_delete;
1332             sub terminal_location_list;
1333             sub terminal_location_retrieve;
1334             sub terminal_location_update;
1335             sub terminal_locations;
1336             sub terminal_reader;
1337             sub terminal_reader_cancel_action;
1338             sub terminal_reader_create;
1339             sub terminal_reader_delete;
1340             sub terminal_reader_list;
1341             sub terminal_reader_present_payment_method;
1342             sub terminal_reader_process_payment_intent;
1343             sub terminal_reader_process_setup_intent;
1344             sub terminal_reader_retrieve;
1345             sub terminal_reader_set_reader_display;
1346             sub terminal_reader_update;
1347             sub terminal_readers;
1348             sub test_helpers_test_clock;
1349             sub test_helpers_test_clock_advance;
1350             sub test_helpers_test_clock_create;
1351             sub test_helpers_test_clock_delete;
1352             sub test_helpers_test_clock_list;
1353             sub test_helpers_test_clock_retrieve;
1354             sub test_helpers_test_clocks;
1355             sub token;
1356             sub token_create;
1357             sub token_create_account;
1358             sub token_create_bank_account;
1359             sub token_create_card;
1360             sub token_create_cvc_update;
1361             sub token_create_person;
1362             sub token_create_pii;
1363             sub token_retrieve;
1364             sub tokens;
1365             sub topup;
1366             sub topup_cancel;
1367             sub topup_create;
1368             sub topup_list;
1369             sub topup_retrieve;
1370             sub topup_update;
1371             sub topups;
1372             sub tos_acceptance;
1373             sub transfer;
1374             sub transfer_create;
1375             sub transfer_data;
1376             sub transfer_list;
1377             sub transfer_retrieve;
1378             sub transfer_reversal;
1379             sub transfer_reversal_create;
1380             sub transfer_reversal_list;
1381             sub transfer_reversal_retrieve;
1382             sub transfer_reversal_update;
1383             sub transfer_reversals;
1384             sub transfer_update;
1385             sub transfers;
1386             sub transform_usage;
1387             sub treasury_credit_reversal;
1388             sub treasury_credit_reversal_create;
1389             sub treasury_credit_reversal_list;
1390             sub treasury_credit_reversal_retrieve;
1391             sub treasury_credit_reversals;
1392             sub treasury_debit_reversal;
1393             sub treasury_debit_reversal_create;
1394             sub treasury_debit_reversal_list;
1395             sub treasury_debit_reversal_retrieve;
1396             sub treasury_debit_reversals;
1397             sub treasury_financial_account;
1398             sub treasury_financial_account_create;
1399             sub treasury_financial_account_features;
1400             sub treasury_financial_account_features_retrieve;
1401             sub treasury_financial_account_features_update;
1402             sub treasury_financial_account_featuress;
1403             sub treasury_financial_account_list;
1404             sub treasury_financial_account_retrieve;
1405             sub treasury_financial_account_update;
1406             sub treasury_financial_accounts;
1407             sub treasury_inbound_transfer;
1408             sub treasury_inbound_transfer_cancel;
1409             sub treasury_inbound_transfer_create;
1410             sub treasury_inbound_transfer_fail;
1411             sub treasury_inbound_transfer_list;
1412             sub treasury_inbound_transfer_retrieve;
1413             sub treasury_inbound_transfer_return;
1414             sub treasury_inbound_transfer_succeed;
1415             sub treasury_inbound_transfers;
1416             sub treasury_outbound_payment;
1417             sub treasury_outbound_payment_cancel;
1418             sub treasury_outbound_payment_create;
1419             sub treasury_outbound_payment_fail;
1420             sub treasury_outbound_payment_list;
1421             sub treasury_outbound_payment_post;
1422             sub treasury_outbound_payment_retrieve;
1423             sub treasury_outbound_payment_return;
1424             sub treasury_outbound_payments;
1425             sub treasury_outbound_transfer;
1426             sub treasury_outbound_transfer_cancel;
1427             sub treasury_outbound_transfer_create;
1428             sub treasury_outbound_transfer_fail;
1429             sub treasury_outbound_transfer_list;
1430             sub treasury_outbound_transfer_post;
1431             sub treasury_outbound_transfer_retrieve;
1432             sub treasury_outbound_transfer_return;
1433             sub treasury_outbound_transfers;
1434             sub treasury_received_credit;
1435             sub treasury_received_credit_list;
1436             sub treasury_received_credit_received_credit;
1437             sub treasury_received_credit_retrieve;
1438             sub treasury_received_credits;
1439             sub treasury_received_debit;
1440             sub treasury_received_debit_list;
1441             sub treasury_received_debit_received_debit;
1442             sub treasury_received_debit_retrieve;
1443             sub treasury_received_debits;
1444             sub treasury_transaction;
1445             sub treasury_transaction_entry;
1446             sub treasury_transaction_entry_list;
1447             sub treasury_transaction_entry_retrieve;
1448             sub treasury_transaction_entrys;
1449             sub treasury_transaction_list;
1450             sub treasury_transaction_retrieve;
1451             sub treasury_transactions;
1452             sub usage_record;
1453             sub usage_record_create;
1454             sub usage_record_list;
1455             sub usage_record_summary;
1456             sub usage_records;
1457             sub value_list;
1458             sub value_list_item;
1459             sub verification;
1460             sub verification_data;
1461             sub verification_fields;
1462             sub webhook;
1463             sub webhook_endpoint;
1464             sub webhook_endpoint_create;
1465             sub webhook_endpoint_delete;
1466             sub webhook_endpoint_list;
1467             sub webhook_endpoint_retrieve;
1468             sub webhook_endpoint_update;
1469             sub webhook_endpoints;
1470              
1471             sub init
1472             {
1473 0     0 1   my $self = shift( @_ );
1474             # $self->{token} = '' unless( length( $self->{token} ) );
1475 0 0         $self->{amount} = '' unless( length( $self->{amount} ) );
1476 0   0       $self->{currency} ||= 'jpy';
1477 0 0         $self->{description} = '' unless( length( $self->{description} ) );
1478 0 0         $self->{card} = '' unless( length( $self->{card} ) );
1479 0 0         $self->{version} = '' unless( length( $self->{version} ) );
1480 0 0         $self->{key} = '' unless( length( $self->{key} ) );
1481 0 0         $self->{cookie_file} = '' unless( length( $self->{cookie_file} ) );
1482 0 0         $self->{browser} = $BROWSER unless( length( $self->{browser} ) );
1483 0 0         $self->{encode_with_json} = 0 unless( length( $self->{encode_with_json} ) );
1484 0 0         $self->{api_uri} = URI->new( API_BASE ) unless( length( $self->{api_uri} ) );
1485 0 0         $self->{file_api_uri} = URI->new( FILES_BASE ) unless( length( $self->{file_api_uri} ) );
1486             # Ask Module::Generic to check if corresponding method exists for each parameter submitted,
1487             # and if so, use it to set the value of the key in hash parameters
1488 0           $self->{_init_strict_use_sub} = 1;
1489 0 0         $self->{temp_dir} = sys_tmpdir() unless( length( $self->{temp_dir} ) );
1490             # Blank on purpose, which means it was not set. If it has a value like 0 or 1, the user has set it and it takes precedence.
1491 0           $self->{livemode} = '';
1492 0 0         $self->{ignore_unknown_parameters} = '' unless( length( $self->{ignore_unknown_parameters} ) );
1493 0 0         $self->{expand} = '' unless( length( $self->{expand} ) );
1494             # Json configuration file
1495 0           $self->{conf_file} = '';
1496 0           $self->{conf_data} = {};
1497 0           $self->{_exception_class} = $EXCEPTION_CLASS;
1498 0 0         $self->SUPER::init( @_ ) || return( $self->pass_error );
1499 0 0         if( $self->{conf_file} )
1500             {
1501 0           my $json = $self->{conf_data};
1502 0 0 0       $self->{livemode} = $json->{livemode} if( CORE::length( $json->{livemode} ) && !CORE::length( $self->{livemode} ) );
1503 0 0         if( !$self->{key} )
1504             {
1505 0 0         $self->{key} = $self->{livemode} ? $json->{live_secret_key} : $json->{test_secret_key};
1506             }
1507 0           for( qw( browser cookie_file temp_dir version ) )
1508             {
1509 0 0 0       $self->{ $_ } = $json->{ $_ } if( !$self->{ $_ } && length( $json->{ $_ } ) );
1510             }
1511             }
1512 0           $self->{stripe_error} = '';
1513 0           $self->{http_response} = '';
1514 0           $self->{http_request} = '';
1515 0 0         CORE::return( $self->error( "No Stripe API private key was provided!" ) ) if( !$self->{key} );
1516 0 0         CORE::return( $self->error( "No Stripe api version was specified. I was expecting something like ''." ) ) if( !$self->{version} );
1517 0           $self->key( $self->{key} );
1518 0 0         $self->livemode( $self->{key} =~ /_live/ ? 1 : 0 );
1519 0           CORE::return( $self );
1520             }
1521              
1522             # NOTE: core method
1523             sub api_uri
1524             {
1525 0     0 1   my $self = shift( @_ );
1526 0 0         if( @_ )
1527             {
1528 0           my $url = shift( @_ );
1529 0 0 0       try
  0            
  0            
  0            
  0            
  0            
  0            
  0            
1530 0     0     {
1531 0           $self->{api_uri} = URI->new( $url );
1532             }
1533 0 0 0       catch( $e )
  0 0 0        
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
1534 0     0     {
1535 0           CORE::return( $self->error( "Bad URI ($url) provided for base Stripe api: $e" ) );
1536 1 0 0 1   8 }
  1 0 0     2  
  1 0 0     1242  
  0 0 0        
  0 0 0        
  0 0 0        
  0 0 0        
  0 0 0        
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
1537             }
1538 0 0 0       CORE::return( $self->{api_uri}->clone ) if( Scalar::Util::blessed( $self->{api_uri} ) && $self->{api_uri}->isa( 'URI' ) );
1539 0           CORE::return( $self->{api_uri} );
1540             }
1541              
1542             # NOTE: core method
1543 0     0 0   sub auth { CORE::return( shift->_set_get_scalar( 'auth', @_ ) ); }
1544              
1545             # NOTE: core method
1546 0     0 1   sub browser { CORE::return( shift->_set_get_scalar( 'browser', @_ ) ); }
1547              
1548             # NOTE: core method
1549             sub code2error
1550             {
1551 0     0 1   my $self = shift( @_ );
1552 0   0       my $code = shift( @_ ) || CORE::return( $self->error( "No code was provided to get the related error" ) );
1553 0 0         CORE::return( $self->error( "No code found for $code" ) ) if( !exists( $ERROR_CODE_TO_STRING->{ $code } ) );
1554 0           CORE::return( $ERROR_CODE_TO_STRING->{ $code } );
1555             }
1556              
1557             # sub connect { CORE::return( shift->_instantiate( 'connect', 'Net::API::Stripe::Connect' ) ) }
1558             # NOTE: core method
1559             sub conf_file
1560             {
1561 0     0 1   my $self = shift( @_ );
1562 0 0         if( @_ )
1563             {
1564 0           my $file = shift( @_ );
1565 0           my $f = Module::Generic::File::file( $file );
1566 0 0         if( !$f->exists )
    0          
1567             {
1568 0           CORE::return( $self->error( "Configuration file $file does not exist." ) );
1569             }
1570             elsif( $f->is_empty )
1571             {
1572 0           CORE::return( $self->error( "Configuration file $file is empty." ) );
1573             }
1574 0   0       my $data = $f->load_utf8 ||
1575             CORE::return( $self->error( "Unable to open configuration file $file: ", $f->error ) );
1576 0 0 0       try
  0            
  0            
  0            
  0            
  0            
  0            
  0            
1577 0     0     {
1578 0           my $json = JSON->new->relaxed->decode( $data );
1579 0           $self->{conf_data} = $json;
1580 0           $self->{conf_file} = $file;
1581             }
1582 0 0 0       catch( $e )
  0 0 0        
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
1583 0     0     {
1584 0           CORE::return( $self->error( "An error occured while json decoding configuration file $file: $e" ) );
1585 1 0 0 1   8 }
  1 0 0     4  
  1 0 0     456  
  0 0 0        
  0 0 0        
  0 0 0        
  0 0 0        
  0 0 0        
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
1586             }
1587 0           CORE::return( $self->{conf_data} );
1588             }
1589              
1590             # NOTE: core method
1591 0     0 0   sub cookie_file { CORE::return( shift->_set_get_file( 'cookie_file', @_ ) ); }
1592              
1593             # NOTE: core method
1594             sub currency
1595             {
1596 0     0 1   my $self = shift( @_ );
1597 0 0         if( @_ )
1598             {
1599 0           $self->_set_get( 'currency', lc( shift( @_ ) ) );
1600             }
1601 0           CORE::return( $self->{ 'currency' } );
1602             }
1603              
1604             # NOTE: core method
1605             sub delete
1606             {
1607 0     0 1   my $self = shift( @_ );
1608 0   0       my $path = shift( @_ ) || CORE::return( $self->error( "No api endpoint (path) was provided." ) );
1609 0           my $args = shift( @_ );
1610 0 0 0       CORE::return( $self->error( "http query parameters provided were not a hash reference." ) ) if( $args && ref( $args ) ne 'HASH' );
1611 0           my $api = $self->api_uri->clone;
1612 0 0 0       if( $self->_is_object( $path ) && $path->can( 'path' ) )
1613             {
1614 0           $api->path( undef() );
1615 0           $path = $path->path;
1616             }
1617             else
1618             {
1619 0 0         substr( $path, 0, 0 ) = '/' unless( substr( $path, 0, 1 ) eq '/' );
1620             }
1621 0 0 0       $path .= '?' . $self->_encode_params( $args ) if( $args && %$args );
1622 0           my $req = HTTP::Promise::Request->new( 'DELETE', $api . $path );
1623 0           CORE::return( $self->_make_request( $req ) );
1624             }
1625              
1626             # NOTE: core method
1627 0     0 1   sub encode_with_json { CORE::return( shift->_set_get( 'encode_with_json', @_ ) ); }
1628              
1629             # NOTE: core method
1630             # Can be 'all' or an integer representing a depth
1631 0     0 1   sub expand { CORE::return( shift->_set_get_scalar( 'expand', @_ ) ); }
1632              
1633             # NOTE: core method
1634             sub fields
1635             {
1636 0     0 1   my $self = shift( @_ );
1637 0   0       my $type = shift( @_ ) || CORE::return( $self->error( "No object type was provided to get its list of methods." ) );
1638 0           my $class;
1639 0 0         if( $class = $self->_is_object( $type ) )
1640             {
1641             }
1642             else
1643             {
1644 0           $class = $self->_object_type_to_class( $type );
1645             }
1646 1     1   8 no strict 'refs';
  1         2  
  1         1002  
1647 0 0         if( !$self->_is_class_loaded( $class ) )
1648             {
1649 0           $self->_load_class( $class );
1650             }
1651 0           my @methods = grep{ defined &{"${class}::$_"} } keys( %{"${class}::"} );
  0            
  0            
  0            
1652 0           CORE::return( \@methods );
1653             }
1654              
1655             # NOTE: core method
1656             sub file_api_uri
1657             {
1658 0     0 0   my $self = shift( @_ );
1659 0 0         if( @_ )
1660             {
1661 0           my $url = shift( @_ );
1662 0 0 0       try
  0            
  0            
  0            
  0            
  0            
  0            
  0            
1663 0     0     {
1664 0           $self->{file_api_uri} = URI->new( $url );
1665             }
1666 0 0 0       catch( $e )
  0 0 0        
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
1667 0     0     {
1668 0           CORE::return( $self->error( "Bad URI ($url) provided for base files Stripe api: $e" ) );
1669 1 0 0 1   8 }
  1 0 0     3  
  1 0 0     2387  
  0 0 0        
  0 0 0        
  0 0 0        
  0 0 0        
  0 0 0        
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
1670             }
1671 0 0 0       CORE::return( $self->{file_api_uri}->clone ) if( Scalar::Util::blessed( $self->{file_api_uri} ) && $self->{file_api_uri}->isa( 'URI' ) );
1672 0           CORE::return( $self->{file_api_uri} );
1673             }
1674              
1675             # NOTE: core method
1676             sub generate_uuid
1677             {
1678 0     0 1   CORE::return( Data::UUID->new->create_str );
1679             }
1680              
1681             # NOTE: core method
1682             sub get
1683             {
1684 0     0 1   my $self = shift( @_ );
1685 0   0       my $path = shift( @_ ) || CORE::return( $self->error( "No api endpoint (path) was provided." ) );
1686 0           my $args = shift( @_ );
1687 0 0 0       CORE::return( $self->error( "http query parameters provided were not a hash reference." ) ) if( $args && ref( $args ) ne 'HASH' );
1688 0           my $expand = $self->expand;
1689 0 0 0       if( ( !exists( $args->{expand} ) &&
      0        
      0        
      0        
      0        
1690             (
1691             $expand eq 'all' ||
1692             ( $expand =~ /^\d+$/ && $expand > 2 )
1693             )
1694             )
1695             ||
1696             (
1697             exists( $args->{expand} ) &&
1698             (
1699             $args->{expand} eq 'all' ||
1700             ( $args->{expand} =~ /^\d+$/ && $args->{expand} > 2 )
1701             )
1702             ) )
1703             {
1704             # Because anything more will likely trigger URI too long
1705 0           $args->{expand} = 2;
1706             }
1707 0 0         my $api = CORE::exists( $args->{_file_api} ) ? $self->file_api_uri->clone : $self->api_uri->clone;
1708 0 0 0       if( $self->_is_object( $path ) && $path->can( 'path' ) )
1709             {
1710 0           $api->path( undef() );
1711 0           $path = $path->path;
1712             }
1713             else
1714             {
1715 0 0         substr( $path, 0, 0 ) = '/' unless( substr( $path, 0, 1 ) eq '/' );
1716             }
1717 0 0 0       $path .= '?' . $self->_encode_params( $args ) if( $args && %$args );
1718 0           my $req = HTTP::Promise::Request->new( 'GET', $api . $path );
1719 0           CORE::return( $self->_make_request( $req ) );
1720             }
1721              
1722             # NOTE: core method
1723             sub http_client
1724             {
1725 0     0 1   my $self = shift( @_ );
1726 0 0         CORE::return( $self->{ua} ) if( $self->{ua} );
1727 0           my $cookie_file = $self->cookie_file;
1728 0           my $browser = $self->browser;
1729             # To be safe and ensure this works everywhere, we use the 'file' medium as shared data space
1730 0 0         my $ua = HTTP::Promise->new(
1731             # medium => 'file',
1732             timeout => 5,
1733             use_promise => 0,
1734             ( $self->debug > 3 ? ( debug => $self->debug ) : () ),
1735             );
1736 0 0 0       if( defined( $browser ) &&
1737             length( $browser ) )
1738             {
1739 0           $ua->agent( $browser );
1740             }
1741 0 0 0       if( defined( $cookie_file ) &&
1742             length( $cookie_file ) )
1743             {
1744 0           my $jar = Cookie::Jar->new( file => $cookie_file );
1745 0           $ua->cookie_jar( $jar );
1746             }
1747 0           $self->{ua} = $ua;
1748 0           CORE::return( $ua );
1749             }
1750              
1751             # NOTE: core method
1752 0     0 1   sub http_request { CORE::return( shift->_set_get_object( 'http_request', 'HTTP::Promise::Request', @_ ) ); }
1753              
1754             # NOTE: core method
1755 0     0 1   sub http_response { CORE::return( shift->_set_get_object( 'http_response', 'HTTP::Promise::Response', @_ ) ); }
1756              
1757             # NOTE: core method
1758 0     0 1   sub ignore_unknown_parameters { CORE::return( shift->_set_get_boolean( 'ignore_unknown_parameters', @_ ) ); }
1759              
1760             # NOTE: core method
1761 0     0 1   sub json { CORE::return( JSON->new->allow_nonref->allow_blessed->convert_blessed->relaxed ); }
1762              
1763             # NOTE: core method
1764             sub key
1765             {
1766 0     0 1   my $self = shift( @_ );
1767 0 0         if( @_ )
1768             {
1769 0           my $key = $self->{key} = shift( @_ );
1770 0           my $auth = 'Basic ' . MIME::Base64::encode_base64( $key . ':' );
1771 0           $self->auth( $auth );
1772             }
1773 0           CORE::return( $self->{key} );
1774             }
1775              
1776             # NOTE: core method
1777 0     0 1   sub livemode { CORE::return( shift->_set_get_boolean( 'livemode', @_ ) ); }
1778              
1779             # NOTE: core method
1780             sub post
1781             {
1782 0     0 1   my $self = shift( @_ );
1783 0   0       my $path = shift( @_ ) || CORE::return( $self->error( "No api endpoint (path) was provided." ) );
1784 0           my $args = shift( @_ );
1785 0 0 0       CORE::return( $self->error( "http query parameters provided were not a hash reference." ) ) if( $args && ref( $args ) ne 'HASH' );
1786 0           my $api = $self->api_uri->clone;
1787 0 0 0       if( $self->_is_object( $path ) && $path->can( 'path' ) )
1788             {
1789 0           $api->path( undef() );
1790 0           $path = $path->path;
1791             }
1792             else
1793             {
1794 0 0         substr( $path, 0, 0 ) = '/' unless( substr( $path, 0, 1 ) eq '/' );
1795             }
1796             # my $ref = $self->_encode_params( $args );
1797             # $self->message( 3, $self->dump( $ref ) ); exit;
1798 0           my $h = [];
1799 0 0         if( exists( $args->{idempotency} ) )
1800             {
1801 0 0         $args->{idempotency} = $self->generate_uuid if( !length( $args->{idempotency} ) );
1802 0           push( @$h, 'Idempotency-Key', CORE::delete( $args->{idempotency} ) );
1803             }
1804 0 0         my $req = HTTP::Promise::Request->new(
1805             'POST', $api . $path,
1806             $h,
1807             ( $args ? $self->_encode_params( $args ) : undef() )
1808             );
1809 0           CORE::return( $self->_make_request( $req ) );
1810             }
1811              
1812             # NOTE: core method
1813             # Using rfc2388 rules
1814             # https://tools.ietf.org/html/rfc2388
1815             sub post_multipart
1816             {
1817 0     0 1   my $self = shift( @_ );
1818 0   0       my $path = shift( @_ ) || CORE::return( $self->error( "No api endpoint (path) was provided." ) );
1819 0           my $args = shift( @_ );
1820 0 0 0       CORE::return( $self->error( "http query parameters provided were not a hash reference." ) ) if( $args && ref( $args ) ne 'HASH' );
1821 0           my $api = $self->api_uri->clone;
1822 0 0 0       if( $self->_is_object( $path ) && $path->can( 'path' ) )
1823             {
1824 0           $api->path( undef() );
1825 0           $path = $path->path;
1826             }
1827             else
1828             {
1829 0 0         substr( $path, 0, 0 ) = '/' unless( substr( $path, 0, 1 ) eq '/' );
1830             }
1831 0           my $h = HTTP::Promise::Headers->new(
1832             Content_Type => 'multipart/form-data',
1833             );
1834 0 0         if( exists( $args->{idempotency} ) )
1835             {
1836 0 0         $args->{idempotency} = $self->generate_uuid if( !length( $args->{idempotency} ) );
1837 0           $h->header( 'Idempotency-Key' => CORE::delete( $args->{idempotency} ) );
1838             }
1839 0           my $req = HTTP::Promise::Request->new( POST => $api . $path, $h );
1840 0           my $data = $self->_encode_params_multipart( $args, { encoding => 'quoted-printable' } );
1841 0           foreach my $f ( keys( %$data ) )
1842             {
1843 0           foreach my $ref ( @{$data->{ $f }} )
  0            
1844             {
1845 0 0         if( $ref->{filename} )
1846             {
1847 0           my $fname = $ref->{filename};
1848             $req->add_part( HTTP::Promise::Message->new(
1849             HTTP::Promise::Headers->new(
1850             Content_Disposition => "form-data; name=\"${f}\"; filename=\"${fname}\"",
1851             Content_Type => ( $ref->{type} ? $ref->{type} : 'application/octet-stream' ),
1852             ( $ref->{encoding} ? ( Content_Transfer_Encoding => $ref->{encoding} ) : undef() ),
1853             Content_Length => CORE::length( $ref->{value} ),
1854             ),
1855             $ref->{value}
1856 0 0         ));
    0          
1857             }
1858             else
1859             {
1860 0   0       $ref->{type} ||= 'text/plain';
1861             $req->add_part( HTTP::Promise::Message->new(
1862             HTTP::Promise::Headers->new(
1863             Content_Disposition => "form-data; name=\"${f}\"",
1864             Content_Type => ( $ref->{type} eq 'text/plain' ? 'text/plain;charset="utf-8"' : $ref->{type} ),
1865             Content_Length => CORE::length( $ref->{value} ),
1866             Content_Transfer_Encoding => ( $ref->{encoding} ? $ref->{encoding} : '8bit' ),
1867             ),
1868             $ref->{value}
1869 0 0         ));
    0          
1870             }
1871             }
1872             }
1873 0           CORE::return( $self->_make_request( $req ) );
1874             }
1875              
1876             # NOTE: core method
1877 0     0 1   sub version { CORE::return( shift->_set_get_scalar( 'version', @_ ) ); }
1878              
1879             # NOTE: core method
1880             sub webhook_validate_signature
1881             {
1882 0     0 0   my $self = shift( @_ );
1883 0           my $opts = {};
1884 0 0 0       $opts = shift( @_ ) if( @_ && ref( $_[0] ) eq 'HASH' );
1885 0 0         CORE::return( $self->error( "No webhook secret was provided." ) ) if( !$opts->{secret} );
1886 0 0         CORE::return( $self->error( "No Stripe signature was provided." ) ) if( !$opts->{signature} );
1887 0 0         CORE::return( $self->error( "No payload was provided." ) ) if( !CORE::length( $opts->{payload} ) );
1888             # 5 minutes
1889 0   0       $opts->{time_tolerance} ||= ( 5 * 60 );
1890 0           my $sig = $opts->{signature};
1891 0           my $max_time_spread = $opts->{time_tolerance};
1892 0           my $signing_secret = $opts->{secret};
1893 0           my $payload = $opts->{payload};
1894 0 0         $payload = Encode::decode_utf8( $payload ) if( !Encode::is_utf8( $payload ) );
1895            
1896             # Example:
1897             # Stripe-Signature: t=1492774577,
1898             # v1=5257a869e7ecebeda32affa62cdca3fa51cad7e77a0e56ff536d0ce8e108d8bd,
1899             # v0=6ffbb59b2300aae63f272406069a9788598b792a944a07aba816edb039989a39
1900 0 0         CORE::return( $self->error({ code => 400, message => "Event data received from Stripe is empty" }) ) if( !CORE::length( $sig ) );
1901 0           my @parts = split( /\,[[:blank:]]*/, $sig );
1902 0           my $q = {};
1903 0           for( @parts )
1904             {
1905 0           my( $n, $v ) = split( /[[:blank:]]*\=[[:blank:]]*/, $_, 2 );
1906 0           $q->{ $n } = $v;
1907             }
1908 0 0         CORE::return( $self->error({ code => 400, message => "No timestamp found in Stripe event data" }) ) if( !CORE::exists( $q->{t} ) );
1909 0 0         CORE::return( $self->error({ code => 400, message => "Timestamp is empty in Stripe event data received." }) ) if( !CORE::length( $q->{t} ) );
1910 0 0         CORE::return( $self->error({ code => 400, message => "No signature found in Stripe event data" }) ) if( !CORE::exists( $q->{v1} ) );
1911 0 0         CORE::return( $self->error({ code => 400, message => "Signature is empty in Stripe event data received." }) ) if( !CORE::length( $q->{v1} ) );
1912             # Must be a unix timestamp
1913 0 0         CORE::return( $self->error({ code => 400, message => "Invalid timestamp received in Stripe event data" }) ) if( $q->{t} !~ /^\d+$/ );
1914             # Must be a hash hmac with sha256, e.g. 5257a869e7ecebeda32affa62cdca3fa51cad7e77a0e56ff536d0ce8e108d8bd
1915 0 0         CORE::return( $self->error({ code => 400, message => "Invalid signature received in Stripe event data" }) ) if( $q->{v1} !~ /^[a-z0-9]{64}$/ );
1916 0           my $dt;
1917 0 0 0       try
  0            
  0            
  0            
  0            
  0            
  0            
  0            
1918 0     0     {
1919 0           $dt = DateTime->from_epoch( epoch => $q->{t}, time_zone => 'local' );
1920             }
1921 0 0 0       catch( $e )
  0 0 0        
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
1922 0     0     {
1923 0           CORE::return( $self->error({ code => 400, message => "Invalid timestamp ($q->{t}): $e" }) );
1924 1 0 0 1   9 }
  1 0 0     2  
  1 0 0     8263  
  0 0 0        
  0 0 0        
  0 0 0        
  0 0 0        
  0 0 0        
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
1925            
1926             # This needs to be in real utf8, ie NOT perl internal utf8
1927 0           my $signed_payload = Encode::encode_utf8( join( '.', $q->{t}, $payload ) );
1928 0           my $expect_sign = Digest::SHA::hmac_sha256_hex( $signed_payload, $signing_secret );
1929 0 0         CORE::return( $self->error({ code => 401, message => "Invalid signature." }) ) if( $expect_sign ne $q->{v1} );
1930 0           my $time_diff = time() - $q->{t};
1931 0 0         CORE::return( $self->error({ code => 400, message => "Bad timestamp ($q->{t}). It is set in the future: $dt" }) ) if( $time_diff < 0 );
1932 0 0         CORE::return( $self->error({ code => 406, message => "Timestamp is too old." }) ) if( $time_diff >= $max_time_spread );
1933 0           CORE::return( 1 );
1934             }
1935              
1936             # NOTE: core method
1937             # https://stripe.com/docs/ips
1938             sub webhook_validate_caller_ip
1939             {
1940 0     0 0   my $self = shift( @_ );
1941 0           my $opts = {};
1942 0 0 0       $opts = shift( @_ ) if( @_ && ref( $_[0] ) eq 'HASH' );
1943 0 0         CORE::return( $self->error({ code => 500, message => "No ip address was provided to check." }) ) if( !$opts->{ip} );
1944 0           my $err = [];
1945 0           my $ips = STRIPE_WEBHOOK_SOURCE_IP;
1946             my $ip = Net::IP->new( $opts->{ip} ) || do
1947 0   0       {
1948             warn( "Warning only: IP '", ( $opts->{ip} // '' ), "' is not valid: ", Net::IP->Error, "\n" );
1949             push( @$err, sprintf( "IP '%s' is not valid: %s", ( $opts->{ip} // '' ), Net::IP->Error ) );
1950             CORE::return( '' );
1951             };
1952 0           foreach my $stripe_ip ( @$ips )
1953             {
1954 0           my $stripe_ip_object = Net::IP->new( $stripe_ip );
1955             # We found an existing ip same as the one we are adding, so we skip
1956             # If we are given a block that has some overlapping elements, we go ahead and add it
1957             # because it would become complicated and risky to only take the ips that do not overalp in the given block
1958 0 0         if( !( $ip->overlaps( $stripe_ip_object ) == $Net::IP::IP_NO_OVERLAP ) )
1959             {
1960 0           CORE::return( $ip );
1961             }
1962             }
1963 0 0         if( $opts->{ignore_ip} )
1964             {
1965 0           CORE::return( $ip );
1966             }
1967             else
1968             {
1969 0           CORE::return( $self->error({ code => 403, message => "IP address $opts->{ip} is not a valid Stripe ip and is not authorised to access this resource." }) );
1970             }
1971             }
1972              
1973             # NOTE: All methods below are auto-generated.
1974             sub _autoload_subs
1975             {
1976 0     0     $AUTOLOAD_SUBS =
1977             {
1978             # NOTE: account()
1979             account => <<'PERL',
1980             sub account { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Connect::Account', @_ ) ); }
1981             PERL
1982             # NOTE: account_bank_account()
1983             account_bank_account => <<'PERL',
1984             sub account_bank_account { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Connect::ExternalAccount::Bank', @_ ) ); }
1985             PERL
1986             # NOTE: account_bank_account_create()
1987             account_bank_account_create => <<'PERL',
1988             sub account_bank_account_create
1989             {
1990             my $self = shift( @_ );
1991             my $args = shift( @_ );
1992             my $okParams =
1993             {
1994             expandable => { allowed => $EXPANDABLES->{ 'account_bank_account' } },
1995             default_for_currency => { type => "boolean" },
1996             external_account => { type => "string", required => 1 },
1997             metadata => { type => "hash" },
1998             };
1999             $args = $self->_contract( 'account_bank_account', $args ) || CORE::return( $self->pass_error );
2000             my $err = $self->_check_parameters( $okParams, $args );
2001             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
2002             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No account id (with parameter 'id') was provided to create its information." ) );
2003             my $hash = $self->post( "accounts/${id}", $args ) || CORE::return( $self->pass_error );
2004             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Connect::ExternalAccount::Bank', $hash ) );
2005             }
2006             PERL
2007             # NOTE: account_bank_account_delete()
2008             account_bank_account_delete => <<'PERL',
2009             sub account_bank_account_delete
2010             {
2011             my $self = shift( @_ );
2012             my $args = shift( @_ );
2013             my $okParams =
2014             {
2015             expandable => { allowed => $EXPANDABLES->{ 'account_bank_account' } },
2016             };
2017             $args = $self->_contract( 'account_bank_account', $args ) || CORE::return( $self->pass_error );
2018             my $err = $self->_check_parameters( $okParams, $args );
2019             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
2020             my $parent_id = CORE::delete( $args->{parent_id} ) || CORE::return( $self->error( "No account id (with parameter 'parent_id') was provided to delete its information." ) );
2021             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No account_bank_account id (with parameter 'id') was provided to delete its information." ) );
2022             my $hash = $self->delete( "accounts/${parent_id}/external_accounts/${id}", $args ) || CORE::return( $self->pass_error );
2023             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Connect::ExternalAccount::Bank', $hash ) );
2024             }
2025             PERL
2026             # NOTE: account_bank_account_list()
2027             account_bank_account_list => <<'PERL',
2028             sub account_bank_account_list
2029             {
2030             my $self = shift( @_ );
2031             CORE::return( $self->error( "No parameters were provided to list account bank account information." ) ) if( !scalar( @_ ) );
2032             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Connect::ExternalAccount::Bank', @_ );
2033             my $okParams =
2034             {
2035             expandable => { allowed => $EXPANDABLES->{ 'account_bank_account' }, data_prefix_is_ok => 1 },
2036             ending_before => { type => "string" },
2037             limit => { type => "string" },
2038             starting_after => { type => "string" },
2039             };
2040             my $err = $self->_check_parameters( $okParams, $args );
2041             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
2042             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No account id (with parameter 'id') was provided to list its information." ) );
2043             if( $args->{expand} )
2044             {
2045             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
2046             }
2047             my $hash = $self->get( "accounts/${id}?object=bank_account", $args ) || CORE::return( $self->pass_error );
2048             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Connect::ExternalAccount::Bank', $hash ) );
2049             }
2050             PERL
2051             # NOTE: account_bank_account_retrieve()
2052             account_bank_account_retrieve => <<'PERL',
2053             sub account_bank_account_retrieve
2054             {
2055             my $self = shift( @_ );
2056             my $args = shift( @_ );
2057             my $okParams =
2058             {
2059             expandable => { allowed => $EXPANDABLES->{ 'account_bank_account' }, data_prefix_is_ok => 1 },
2060             };
2061             $args = $self->_contract( 'account_bank_account', $args ) || CORE::return( $self->pass_error );
2062             my $err = $self->_check_parameters( $okParams, $args );
2063             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
2064             my $parent_id = CORE::delete( $args->{parent_id} ) || CORE::return( $self->error( "No account id (with parameter 'parent_id') was provided to retrieve its information." ) );
2065             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No account_bank_account id (with parameter 'id') was provided to retrieve its information." ) );
2066             my $hash = $self->get( "accounts/${parent_id}/external_accounts/${id}", $args ) || CORE::return( $self->pass_error );
2067             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Connect::ExternalAccount::Bank', $hash ) );
2068             }
2069             PERL
2070             # NOTE: account_bank_account_update()
2071             account_bank_account_update => <<'PERL',
2072             sub account_bank_account_update
2073             {
2074             my $self = shift( @_ );
2075             my $args = shift( @_ );
2076             my $okParams =
2077             {
2078             expandable => { allowed => $EXPANDABLES->{ 'account_bank_account' } },
2079             account_holder_name => { type => "string" },
2080             account_holder_type => { type => "string" },
2081             account_type => { type => "string" },
2082             default_for_currency => { type => "boolean" },
2083             metadata => { type => "hash" },
2084             };
2085             $args = $self->_contract( 'account_bank_account', $args ) || CORE::return( $self->pass_error );
2086             my $err = $self->_check_parameters( $okParams, $args );
2087             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
2088             my $parent_id = CORE::delete( $args->{parent_id} ) || CORE::return( $self->error( "No account id (with parameter 'parent_id') was provided to update its information." ) );
2089             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No account_bank_account id (with parameter 'id') was provided to update its information." ) );
2090             my $hash = $self->post( "accounts/${parent_id}/external_accounts/${id}", $args ) || CORE::return( $self->pass_error );
2091             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Connect::ExternalAccount::Bank', $hash ) );
2092             }
2093             PERL
2094             # NOTE: account_bank_accounts()
2095             account_bank_accounts => <<'PERL',
2096             # <https://stripe.com/docs/api/external_accounts>
2097             sub account_bank_accounts
2098             {
2099             my $self = shift( @_ );
2100             my $allowed = [qw( create delete list retrieve update )];
2101             my $action = shift( @_ );
2102             my $meth = $self->_get_method( 'account_bank_account', $action, $allowed ) || CORE::return( $self->pass_error );
2103             CORE::return( $self->$meth( @_ ) );
2104             }
2105             PERL
2106             # NOTE: account_card()
2107             account_card => <<'PERL',
2108             sub account_card { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Connect::ExternalAccount::Card', @_ ) ); }
2109             PERL
2110             # NOTE: account_card_create()
2111             account_card_create => <<'PERL',
2112             sub account_card_create
2113             {
2114             my $self = shift( @_ );
2115             my $args = shift( @_ );
2116             my $okParams =
2117             {
2118             expandable => { allowed => $EXPANDABLES->{ 'account_card' } },
2119             default_for_currency => { type => "boolean" },
2120             external_account => { type => "string", required => 1 },
2121             metadata => { type => "hash" },
2122             };
2123             $args = $self->_contract( 'account_card', $args ) || CORE::return( $self->pass_error );
2124             my $err = $self->_check_parameters( $okParams, $args );
2125             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
2126             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No account id (with parameter 'id') was provided to create its information." ) );
2127             my $hash = $self->post( "accounts/${id}", $args ) || CORE::return( $self->pass_error );
2128             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Connect::ExternalAccount::Card', $hash ) );
2129             }
2130             PERL
2131             # NOTE: account_card_delete()
2132             account_card_delete => <<'PERL',
2133             sub account_card_delete
2134             {
2135             my $self = shift( @_ );
2136             my $args = shift( @_ );
2137             my $okParams =
2138             {
2139             expandable => { allowed => $EXPANDABLES->{ 'account_card' } },
2140             };
2141             $args = $self->_contract( 'account_card', $args ) || CORE::return( $self->pass_error );
2142             my $err = $self->_check_parameters( $okParams, $args );
2143             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
2144             my $parent_id = CORE::delete( $args->{parent_id} ) || CORE::return( $self->error( "No account id (with parameter 'parent_id') was provided to delete its information." ) );
2145             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No account_card id (with parameter 'id') was provided to delete its information." ) );
2146             my $hash = $self->delete( "accounts/${parent_id}/external_accounts/${id}", $args ) || CORE::return( $self->pass_error );
2147             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Connect::ExternalAccount::Card', $hash ) );
2148             }
2149             PERL
2150             # NOTE: account_card_list()
2151             account_card_list => <<'PERL',
2152             sub account_card_list
2153             {
2154             my $self = shift( @_ );
2155             CORE::return( $self->error( "No parameters were provided to list account card information." ) ) if( !scalar( @_ ) );
2156             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Connect::ExternalAccount::Card', @_ );
2157             my $okParams =
2158             {
2159             expandable => { allowed => $EXPANDABLES->{ 'account_card' }, data_prefix_is_ok => 1 },
2160             ending_before => { type => "string" },
2161             limit => { type => "string" },
2162             starting_after => { type => "string" },
2163             };
2164             my $err = $self->_check_parameters( $okParams, $args );
2165             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
2166             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No account id (with parameter 'id') was provided to list its information." ) );
2167             if( $args->{expand} )
2168             {
2169             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
2170             }
2171             my $hash = $self->get( "accounts/${id}?object=card", $args ) || CORE::return( $self->pass_error );
2172             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Connect::ExternalAccount::Card', $hash ) );
2173             }
2174             PERL
2175             # NOTE: account_card_retrieve()
2176             account_card_retrieve => <<'PERL',
2177             sub account_card_retrieve
2178             {
2179             my $self = shift( @_ );
2180             my $args = shift( @_ );
2181             my $okParams =
2182             {
2183             expandable => { allowed => $EXPANDABLES->{ 'account_card' }, data_prefix_is_ok => 1 },
2184             };
2185             $args = $self->_contract( 'account_card', $args ) || CORE::return( $self->pass_error );
2186             my $err = $self->_check_parameters( $okParams, $args );
2187             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
2188             my $parent_id = CORE::delete( $args->{parent_id} ) || CORE::return( $self->error( "No account id (with parameter 'parent_id') was provided to retrieve its information." ) );
2189             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No account_card id (with parameter 'id') was provided to retrieve its information." ) );
2190             my $hash = $self->get( "accounts/${parent_id}/external_accounts/${id}", $args ) || CORE::return( $self->pass_error );
2191             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Connect::ExternalAccount::Card', $hash ) );
2192             }
2193             PERL
2194             # NOTE: account_card_update()
2195             account_card_update => <<'PERL',
2196             sub account_card_update
2197             {
2198             my $self = shift( @_ );
2199             my $args = shift( @_ );
2200             my $okParams =
2201             {
2202             expandable => { allowed => $EXPANDABLES->{ 'account_card' } },
2203             address_city => { type => "string" },
2204             address_country => { type => "string" },
2205             address_line1 => { type => "string" },
2206             address_line2 => { type => "string" },
2207             address_state => { type => "string" },
2208             address_zip => { type => "string" },
2209             default_for_currency => { type => "boolean" },
2210             exp_month => { type => "integer" },
2211             exp_year => { type => "integer" },
2212             metadata => { type => "hash" },
2213             name => { type => "string" },
2214             };
2215             $args = $self->_contract( 'account_card', $args ) || CORE::return( $self->pass_error );
2216             my $err = $self->_check_parameters( $okParams, $args );
2217             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
2218             my $parent_id = CORE::delete( $args->{parent_id} ) || CORE::return( $self->error( "No account id (with parameter 'parent_id') was provided to update its information." ) );
2219             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No account_card id (with parameter 'id') was provided to update its information." ) );
2220             my $hash = $self->post( "accounts/${parent_id}/external_accounts/${id}", $args ) || CORE::return( $self->pass_error );
2221             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Connect::ExternalAccount::Card', $hash ) );
2222             }
2223             PERL
2224             # NOTE: account_cards()
2225             account_cards => <<'PERL',
2226             # <https://stripe.com/docs/api/external_accounts>
2227             sub account_cards
2228             {
2229             my $self = shift( @_ );
2230             my $allowed = [qw( create delete list retrieve update )];
2231             my $action = shift( @_ );
2232             my $meth = $self->_get_method( 'account_card', $action, $allowed ) || CORE::return( $self->pass_error );
2233             CORE::return( $self->$meth( @_ ) );
2234             }
2235             PERL
2236             # NOTE: account_create()
2237             account_create => <<'PERL',
2238             sub account_create
2239             {
2240             my $self = shift( @_ );
2241             my $args = shift( @_ );
2242             my $okParams =
2243             {
2244             expandable => { allowed => $EXPANDABLES->{ 'account' } },
2245             account_token => { type => "string" },
2246             business_profile => { type => "hash" },
2247             business_type => { type => "string" },
2248             capabilities => { type => "hash" },
2249             company => { type => "hash" },
2250             country => { type => "string" },
2251             default_currency => { type => "string" },
2252             documents => { type => "object" },
2253             email => { type => "string" },
2254             external_account => { type => "string" },
2255             individual => { type => "hash" },
2256             metadata => { type => "hash" },
2257             settings => { type => "hash" },
2258             tos_acceptance => { type => "hash" },
2259             type => { type => "string", required => 1 },
2260             };
2261             $args = $self->_contract( 'account', $args ) || CORE::return( $self->pass_error );
2262             my $err = $self->_check_parameters( $okParams, $args );
2263             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
2264             my $hash = $self->post( "accounts", $args ) || CORE::return( $self->pass_error );
2265             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Connect::Account', $hash ) );
2266             }
2267             PERL
2268             # NOTE: account_delete()
2269             account_delete => <<'PERL',
2270             sub account_delete
2271             {
2272             my $self = shift( @_ );
2273             my $args = shift( @_ );
2274             my $okParams =
2275             {
2276             expandable => { allowed => $EXPANDABLES->{ 'account' } },
2277             };
2278             $args = $self->_contract( 'account', $args ) || CORE::return( $self->pass_error );
2279             my $err = $self->_check_parameters( $okParams, $args );
2280             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
2281             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No account id (with parameter 'id') was provided to delete its information." ) );
2282             my $hash = $self->delete( "accounts/${id}", $args ) || CORE::return( $self->pass_error );
2283             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Connect::Account', $hash ) );
2284             }
2285             PERL
2286             # NOTE: account_link()
2287             account_link => <<'PERL',
2288             sub account_link { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Connect::Account::Link', @_ ) ); }
2289             PERL
2290             # NOTE: account_link_create()
2291             account_link_create => <<'PERL',
2292             sub account_link_create
2293             {
2294             my $self = shift( @_ );
2295             my $args = shift( @_ );
2296             my $okParams =
2297             {
2298             expandable => { allowed => $EXPANDABLES->{ 'account_link' } },
2299             account => { type => "string", required => 1 },
2300             collect => { type => "string" },
2301             refresh_url => { type => "string" },
2302             return_url => { type => "string" },
2303             type => { type => "string", required => 1 },
2304             };
2305             $args = $self->_contract( 'account_link', $args ) || CORE::return( $self->pass_error );
2306             my $err = $self->_check_parameters( $okParams, $args );
2307             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
2308             my $hash = $self->post( "account_links", $args ) || CORE::return( $self->pass_error );
2309             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Connect::Account::Link', $hash ) );
2310             }
2311             PERL
2312             # NOTE: account_links()
2313             account_links => <<'PERL',
2314             # <https://stripe.com/docs/api/account_links>
2315             sub account_links
2316             {
2317             my $self = shift( @_ );
2318             my $allowed = [qw( create )];
2319             my $action = shift( @_ );
2320             my $meth = $self->_get_method( 'account_link', $action, $allowed ) || CORE::return( $self->pass_error );
2321             CORE::return( $self->$meth( @_ ) );
2322             }
2323             PERL
2324             # NOTE: account_list()
2325             account_list => <<'PERL',
2326             sub account_list
2327             {
2328             my $self = shift( @_ );
2329             CORE::return( $self->error( "No parameters were provided to list account information." ) ) if( !scalar( @_ ) );
2330             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Connect::Account', @_ );
2331             my $okParams =
2332             {
2333             expandable => { allowed => $EXPANDABLES->{ 'account' }, data_prefix_is_ok => 1 },
2334             created => { type => "timestamp" },
2335             ending_before => { type => "string" },
2336             limit => { type => "string" },
2337             starting_after => { type => "string" },
2338             };
2339             my $err = $self->_check_parameters( $okParams, $args );
2340             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
2341             if( $args->{expand} )
2342             {
2343             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
2344             }
2345             my $hash = $self->get( "accounts", $args ) || CORE::return( $self->pass_error );
2346             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Connect::Account', $hash ) );
2347             }
2348             PERL
2349             # NOTE: account_reject()
2350             account_reject => <<'PERL',
2351             sub account_reject
2352             {
2353             my $self = shift( @_ );
2354             my $args = shift( @_ );
2355             my $okParams =
2356             {
2357             expandable => { allowed => $EXPANDABLES->{ 'account' } },
2358             reason => { type => "string", required => 1 },
2359             };
2360             $args = $self->_contract( 'account', $args ) || CORE::return( $self->pass_error );
2361             my $err = $self->_check_parameters( $okParams, $args );
2362             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
2363             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No account id (with parameter 'id') was provided to reject its information." ) );
2364             my $hash = $self->post( "accounts/${id}", $args ) || CORE::return( $self->pass_error );
2365             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Connect::Account', $hash ) );
2366             }
2367             PERL
2368             # NOTE: account_retrieve()
2369             account_retrieve => <<'PERL',
2370             sub account_retrieve
2371             {
2372             my $self = shift( @_ );
2373             my $args = shift( @_ );
2374             my $okParams =
2375             {
2376             expandable => { allowed => $EXPANDABLES->{ 'account' }, data_prefix_is_ok => 1 },
2377             };
2378             $args = $self->_contract( 'account', $args ) || CORE::return( $self->pass_error );
2379             my $err = $self->_check_parameters( $okParams, $args );
2380             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
2381             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No account id (with parameter 'id') was provided to retrieve its information." ) );
2382             my $hash = $self->get( "accounts/${id}", $args ) || CORE::return( $self->pass_error );
2383             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Connect::Account', $hash ) );
2384             }
2385             PERL
2386             # NOTE: account_token_create()
2387             account_token_create => <<'PERL',
2388             sub account_token_create { CORE::return( shift->token_create( @_ ) ); }
2389             PERL
2390             # NOTE: account_update()
2391             account_update => <<'PERL',
2392             sub account_update
2393             {
2394             my $self = shift( @_ );
2395             my $args = shift( @_ );
2396             my $okParams =
2397             {
2398             expandable => { allowed => $EXPANDABLES->{ 'account' } },
2399             account_token => { type => "string" },
2400             business_profile => { type => "hash" },
2401             business_type => { type => "string" },
2402             capabilities => { type => "hash" },
2403             company => { type => "hash" },
2404             default_currency => { type => "string" },
2405             documents => { type => "object" },
2406             email => { type => "string" },
2407             external_account => { type => "string" },
2408             individual => { type => "hash" },
2409             metadata => { type => "hash" },
2410             settings => { type => "hash" },
2411             tos_acceptance => { type => "hash" },
2412             };
2413             $args = $self->_contract( 'account', $args ) || CORE::return( $self->pass_error );
2414             my $err = $self->_check_parameters( $okParams, $args );
2415             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
2416             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No account id (with parameter 'id') was provided to update its information." ) );
2417             my $hash = $self->post( "accounts/${id}", $args ) || CORE::return( $self->pass_error );
2418             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Connect::Account', $hash ) );
2419             }
2420             PERL
2421             # NOTE: accounts()
2422             accounts => <<'PERL',
2423             # <https://stripe.com/docs/api/accounts>
2424             sub accounts
2425             {
2426             my $self = shift( @_ );
2427             my $allowed = [qw( create delete list reject retrieve update )];
2428             my $action = shift( @_ );
2429             my $meth = $self->_get_method( 'account', $action, $allowed ) || CORE::return( $self->pass_error );
2430             CORE::return( $self->$meth( @_ ) );
2431             }
2432             PERL
2433             # NOTE: address()
2434             address => <<'PERL',
2435             sub address { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Address', @_ ) ); }
2436             PERL
2437             # NOTE: address_kana()
2438             address_kana => <<'PERL',
2439             sub address_kana { CORE::return( shift->_response_to_object( 'Net::API::Stripe::AddressKana', @_ ) ); }
2440             PERL
2441             # NOTE: address_kanji()
2442             address_kanji => <<'PERL',
2443             sub address_kanji { CORE::return( shift->_response_to_object( 'Net::API::Stripe::AddressKanji', @_ ) ); }
2444             PERL
2445             # NOTE: amount()
2446             amount => <<'PERL',
2447             sub amount { CORE::return( shift->_set_get_number( 'amount', @_ ) ); }
2448             PERL
2449             # NOTE: application_fee()
2450             application_fee => <<'PERL',
2451             sub application_fee { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Connect::ApplicationFee', @_ ) ); }
2452             PERL
2453             # NOTE: application_fee_list()
2454             application_fee_list => <<'PERL',
2455             sub application_fee_list
2456             {
2457             my $self = shift( @_ );
2458             CORE::return( $self->error( "No parameters were provided to list application fee information." ) ) if( !scalar( @_ ) );
2459             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Connect::ApplicationFee', @_ );
2460             my $okParams =
2461             {
2462             expandable => { allowed => $EXPANDABLES->{ 'application_fee' }, data_prefix_is_ok => 1 },
2463             charge => { type => "string" },
2464             created => { type => "timestamp" },
2465             ending_before => { type => "string" },
2466             limit => { type => "string" },
2467             starting_after => { type => "string" },
2468             };
2469             my $err = $self->_check_parameters( $okParams, $args );
2470             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
2471             if( $args->{expand} )
2472             {
2473             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
2474             }
2475             my $hash = $self->get( "application_fees", $args ) || CORE::return( $self->pass_error );
2476             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Connect::ApplicationFee', $hash ) );
2477             }
2478             PERL
2479             # NOTE: application_fee_refund()
2480             application_fee_refund => <<'PERL',
2481             sub application_fee_refund { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Connect::ApplicationFee::Refund', @_ ) ); }
2482             PERL
2483             # NOTE: application_fee_retrieve()
2484             application_fee_retrieve => <<'PERL',
2485             sub application_fee_retrieve
2486             {
2487             my $self = shift( @_ );
2488             my $args = shift( @_ );
2489             my $okParams =
2490             {
2491             expandable => { allowed => $EXPANDABLES->{ 'application_fee' }, data_prefix_is_ok => 1 },
2492             };
2493             $args = $self->_contract( 'application_fee', $args ) || CORE::return( $self->pass_error );
2494             my $err = $self->_check_parameters( $okParams, $args );
2495             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
2496             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No application_fee id (with parameter 'id') was provided to retrieve its information." ) );
2497             my $hash = $self->get( "application_fees/${id}", $args ) || CORE::return( $self->pass_error );
2498             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Connect::ApplicationFee', $hash ) );
2499             }
2500             PERL
2501             # NOTE: application_fees()
2502             application_fees => <<'PERL',
2503             # <https://stripe.com/docs/api/application_fees>
2504             sub application_fees
2505             {
2506             my $self = shift( @_ );
2507             my $allowed = [qw( list retrieve )];
2508             my $action = shift( @_ );
2509             my $meth = $self->_get_method( 'application_fee', $action, $allowed ) || CORE::return( $self->pass_error );
2510             CORE::return( $self->$meth( @_ ) );
2511             }
2512             PERL
2513             # NOTE: apps_secret()
2514             apps_secret => <<'PERL',
2515             sub apps_secret { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Connect::AppsSecret', @_ ) ); }
2516             PERL
2517             # NOTE: apps_secret_delete()
2518             apps_secret_delete => <<'PERL',
2519             sub apps_secret_delete
2520             {
2521             my $self = shift( @_ );
2522             my $args = shift( @_ );
2523             my $okParams =
2524             {
2525             expandable => { allowed => $EXPANDABLES->{ 'apps.secret' } },
2526             name => { type => "string", required => 1 },
2527             scope => { type => "hash", required => 1 },
2528             };
2529             $args = $self->_contract( 'apps.secret', $args ) || CORE::return( $self->pass_error );
2530             my $err = $self->_check_parameters( $okParams, $args );
2531             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
2532             my $hash = $self->post( "apps/secrets", $args ) || CORE::return( $self->pass_error );
2533             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Connect::AppsSecret', $hash ) );
2534             }
2535             PERL
2536             # NOTE: apps_secret_find()
2537             apps_secret_find => <<'PERL',
2538             sub apps_secret_find
2539             {
2540             my $self = shift( @_ );
2541             my $args = shift( @_ );
2542             my $okParams =
2543             {
2544             expandable => { allowed => $EXPANDABLES->{ 'apps.secret' }, data_prefix_is_ok => 1 },
2545             name => { type => "string", required => 1 },
2546             scope => { type => "hash", required => 1 },
2547             };
2548             $args = $self->_contract( 'apps.secret', $args ) || CORE::return( $self->pass_error );
2549             my $err = $self->_check_parameters( $okParams, $args );
2550             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
2551             my $hash = $self->get( "apps/secrets", $args ) || CORE::return( $self->pass_error );
2552             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Connect::AppsSecret', $hash ) );
2553             }
2554             PERL
2555             # NOTE: apps_secret_list()
2556             apps_secret_list => <<'PERL',
2557             sub apps_secret_list
2558             {
2559             my $self = shift( @_ );
2560             CORE::return( $self->error( "No parameters were provided to list apps secret information." ) ) if( !scalar( @_ ) );
2561             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Connect::AppsSecret', @_ );
2562             my $okParams =
2563             {
2564             expandable => { allowed => $EXPANDABLES->{ 'apps.secret' }, data_prefix_is_ok => 1 },
2565             ending_before => { type => "string" },
2566             limit => { type => "string" },
2567             scope => { type => "hash", required => 1 },
2568             starting_after => { type => "string" },
2569             };
2570             my $err = $self->_check_parameters( $okParams, $args );
2571             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
2572             if( $args->{expand} )
2573             {
2574             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
2575             }
2576             my $hash = $self->get( "", $args ) || CORE::return( $self->pass_error );
2577             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Connect::AppsSecret', $hash ) );
2578             }
2579             PERL
2580             # NOTE: apps_secret_set()
2581             apps_secret_set => <<'PERL',
2582             sub apps_secret_set
2583             {
2584             my $self = shift( @_ );
2585             my $args = shift( @_ );
2586             my $okParams =
2587             {
2588             expandable => { allowed => $EXPANDABLES->{ 'apps.secret' } },
2589             expires_at => { type => "timestamp" },
2590             name => { type => "string", required => 1 },
2591             payload => { type => "string", required => 1 },
2592             scope => { type => "hash", required => 1 },
2593             };
2594             $args = $self->_contract( 'apps.secret', $args ) || CORE::return( $self->pass_error );
2595             my $err = $self->_check_parameters( $okParams, $args );
2596             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
2597             my $hash = $self->post( "", $args ) || CORE::return( $self->pass_error );
2598             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Connect::AppsSecret', $hash ) );
2599             }
2600             PERL
2601             # NOTE: apps_secrets()
2602             apps_secrets => <<'PERL',
2603             # <https://stripe.com/docs/api/secret_management>
2604             sub apps_secrets
2605             {
2606             my $self = shift( @_ );
2607             my $allowed = [qw( delete find list set )];
2608             my $action = shift( @_ );
2609             my $meth = $self->_get_method( 'apps_secret', $action, $allowed ) || CORE::return( $self->pass_error );
2610             CORE::return( $self->$meth( @_ ) );
2611             }
2612             PERL
2613             # NOTE: authorization()
2614             authorization => <<'PERL',
2615             sub authorization { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Issuing::Authorization', @_ ) ); }
2616             PERL
2617             # NOTE: balance()
2618             balance => <<'PERL',
2619             sub balance { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Balance', @_ ) ); }
2620             PERL
2621             # NOTE: balance_retrieve()
2622             balance_retrieve => <<'PERL',
2623             # Retrieves the current account balance, based on the authentication that was used to make the request.
2624             sub balance_retrieve
2625             {
2626             my $self = shift( @_ );
2627             # No argument
2628             # my $hash = $self->_get( 'balance' ) || CORE::return;
2629             my $hash = $self->get( 'balance' );
2630             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Balance', $hash ) );
2631             }
2632             PERL
2633             # NOTE: balance_transaction()
2634             balance_transaction => <<'PERL',
2635             sub balance_transaction { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Balance::Transaction', @_ ) ); }
2636             PERL
2637             # NOTE: balance_transaction_list()
2638             balance_transaction_list => <<'PERL',
2639             # https://stripe.com/docs/api/balance/balance_history?lang=curl
2640             sub balance_transaction_list
2641             {
2642             my $self = shift( @_ );
2643             my $args = shift( @_ );
2644             my $okParams =
2645             {
2646             expandable => { allowed => $EXPANDABLES->{balance_transaction}, data_prefix_is_ok => 1 },
2647             'available_on' => qr/^\d+$/,
2648             'available_on.gt' => qr/^\d+$/,
2649             'available_on.gte' => qr/^\d+$/,
2650             'available_on.lt' => qr/^\d+$/,
2651             'available_on.lte' => qr/^\d+$/,
2652             'created' => qr/^\d+$/,
2653             'created.gt' => qr/^\d+$/,
2654             'created.gte' => qr/^\d+$/,
2655             'created.lt' => qr/^\d+$/,
2656             'created.lte' => qr/^\d+$/,
2657             'currency' => qr/^[a-zA-Z]{3}$/,
2658             # "A cursor for use in pagination. ending_before is an object ID that defines your place in the list."
2659             'ending_before' => qr/^\w+$/,
2660             'limit' => qr/^\d+$/,
2661             # "For automatic Stripe payouts only, only returns transactions that were payed out on the specified payout ID."
2662             'payout' => qr/^\w+$/,
2663             'source' => qr/^\w+$/,
2664             'starting_after' => qr/^\w+$/,
2665             # "Only returns transactions of the given type"
2666             'type' => qr/^(?:charge|refund|adjustment|application_fee|application_fee_refund|transfer|payment|payout|payout_failure|stripe_fee|network_cost)$/,
2667             };
2668             my $err = $self->_check_parameters( $okParams, $args );
2669             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
2670             my $hash = $self->get( 'balance_transactions', $args ) || CORE::return( $self->pass_error );
2671             CORE::return( $self->_response_to_object( 'Net::API::Stripe::List', $hash ) );
2672             }
2673             PERL
2674             # NOTE: balance_transaction_retrieve()
2675             balance_transaction_retrieve => <<'PERL',
2676             sub balance_transaction_retrieve
2677             {
2678             my $self = shift( @_ );
2679             CORE::return( $self->error( "No parameters were provided to retrieve balance transaction information." ) ) if( !scalar( @_ ) );
2680             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Balance::Transaction', @_ );
2681             my $okParams =
2682             {
2683             expandable => { allowed => $EXPANDABLES->{balance_transaction}, data_prefix_is_ok => 1 },
2684             id => { re => qr/^\w+$/, required => 1 }
2685             };
2686             my $err = $self->_check_parameters( $okParams, $args );
2687             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
2688             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No balance transaction id was provided to retrieve its information." ) );
2689             my $hash = $self->get( "balance/history/${id}" ) || CORE::return( $self->pass_error );
2690             CORE::return( $self->error( "Cannot find property 'object' in response hash reference: ", sub{ $self->dumper( $hash ) } ) ) if( !CORE::exists( $hash->{object} ) );
2691             my $class = $self->_object_type_to_class( $hash->{object} ) || CORE::return( $self->pass_error );
2692             CORE::return( $self->_response_to_object( $class, $hash ) );
2693             }
2694             PERL
2695             # NOTE: balance_transactions()
2696             balance_transactions => <<'PERL',
2697             sub balance_transactions
2698             {
2699             my $self = shift( @_ );
2700             my $allowed = [qw( retrieve list )];
2701             my $action = shift( @_ );
2702             my $meth = $self->_get_method( 'balance_transaction', $action, $allowed ) || CORE::return( $self->pass_error );
2703             CORE::return( $self->$meth( @_ ) );
2704             }
2705             PERL
2706             # NOTE: balances()
2707             balances => <<'PERL',
2708             # Stripe access points in their order on the api documentation
2709             sub balances
2710             {
2711             my $self = shift( @_ );
2712             my $allowed = [qw( retrieve )];
2713             my $action = shift( @_ );
2714             my $meth = $self->_get_method( 'balance', $action, $allowed ) || CORE::return( $self->pass_error );
2715             CORE::return( $self->$meth( @_ ) );
2716             }
2717             PERL
2718             # NOTE: bank_account()
2719             bank_account => <<'PERL',
2720             sub bank_account { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Connect::ExternalAccount::Bank', @_ ) ); }
2721             PERL
2722             # NOTE: bank_account_create()
2723             bank_account_create => <<'PERL',
2724             sub bank_account_create
2725             {
2726             my $self = shift( @_ );
2727             CORE::return( $self->error( "No parameters were provided to create a bank account" ) ) if( !scalar( @_ ) );
2728             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Connect::ExternalAccount::Bank', @_ );
2729             my $okParams =
2730             {
2731             expandable => { allowed => $EXPANDABLES->{bank_account} },
2732             account => { re => qr/^\w+$/, required => 1 },
2733             default_for_currency => {},
2734             external_account => {},
2735             metadata => { type => "hash" },
2736             source => { type => "string" },
2737             };
2738              
2739             if( $self->_is_hash( $args->{external_account} ) )
2740             {
2741             $okParams->{external_account} =
2742             {
2743             type => 'hash',
2744             fields => [qw( object! country! currency! account_holder_name account_holder_type routing_number account_number! )],
2745             };
2746             }
2747             else
2748             {
2749             $okParams->{external_account} = { type => 'scalar', re => qr/^\w+$/ };
2750             }
2751             my $id = CORE::delete( $args->{account} );
2752             $args = $self->_contract( 'bank_account', $args ) || CORE::return( $self->pass_error );
2753             my $err = $self->_check_parameters( $okParams, $args );
2754             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
2755             my $hash = $self->post( "accounts/${id}/external_accounts", $args ) || CORE::return( $self->pass_error );
2756             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Connect::ExternalAccount::Bank', $hash ) );
2757             }
2758             PERL
2759             # NOTE: bank_account_delete()
2760             bank_account_delete => <<'PERL',
2761             sub bank_account_delete
2762             {
2763             my $self = shift( @_ );
2764             CORE::return( $self->error( "No parameters were provided to delete a bank account information." ) ) if( !scalar( @_ ) );
2765             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Connect::ExternalAccount::Bank', @_ );
2766             my $okParams =
2767             {
2768             expandable => { allowed => $EXPANDABLES->{bank_account} },
2769             id => { re => qr/^\w+$/, required => 1 },
2770             account => { re => qr/^\w+$/, required => 1 },
2771             };
2772             my $err = $self->_check_parameters( $okParams, $args );
2773             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
2774             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No bank account id was provided to delete its information." ) );
2775             my $acct = CORE::delete( $args->{account} );
2776             my $hash = $self->delete( "accounts/${acct}/external_accounts/${id}", $args ) || CORE::return( $self->pass_error );
2777             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Connect::ExternalAccount::Bank', $hash ) );
2778             }
2779             PERL
2780             # NOTE: bank_account_list()
2781             bank_account_list => <<'PERL',
2782             sub bank_account_list
2783             {
2784             my $self = shift( @_ );
2785             my $args = shift( @_ );
2786             my $okParams =
2787             {
2788             expandable => { allowed => $EXPANDABLES->{bank_account} },
2789             account => { re => qr/^\w+$/, required => 1 },
2790             # "A cursor for use in pagination. ending_before is an object ID that defines your place in the list."
2791             'ending_before' => qr/^\w+$/,
2792             'limit' => qr/^\d+$/,
2793             'starting_after' => qr/^\w+$/,
2794             };
2795             my $err = $self->_check_parameters( $okParams, $args );
2796             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
2797             my $id = CORE::delete( $args->{account} );
2798             if( $args->{expand} )
2799             {
2800             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
2801             }
2802             my $hash = $self->get( "accounts/$id/external_accounts", $args ) || CORE::return( $self->pass_error );
2803             CORE::return( $self->_response_to_object( 'Net::API::Stripe::List', $hash ) );
2804             }
2805             PERL
2806             # NOTE: bank_account_retrieve()
2807             bank_account_retrieve => <<'PERL',
2808             sub bank_account_retrieve
2809             {
2810             my $self = shift( @_ );
2811             CORE::return( $self->error( "No parameters were provided to retrieve a bank account information." ) ) if( !scalar( @_ ) );
2812             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Connect::ExternalAccount::Bank', @_ );
2813             my $okParams =
2814             {
2815             expandable => { allowed => $EXPANDABLES->{bank_account} },
2816             id => { re => qr/^\w+$/, required => 1 },
2817             account => { re => qr/^\w+$/, required => 1 },
2818             };
2819             my $err = $self->_check_parameters( $okParams, $args );
2820             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
2821             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No bank account id was provided to retrieve its information." ) );
2822             my $acct = CORE::delete( $args->{account} );
2823             my $hash = $self->get( "accounts/${acct}/external_accounts/${id}", $args ) || CORE::return( $self->pass_error );
2824             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Connect::ExternalAccount::Bank', $hash ) );
2825             }
2826             PERL
2827             # NOTE: bank_account_update()
2828             bank_account_update => <<'PERL',
2829             sub bank_account_update
2830             {
2831             my $self = shift( @_ );
2832             CORE::return( $self->error( "No parameters were provided to update a bank account" ) ) if( !scalar( @_ ) );
2833             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Connect::ExternalAccount::Bank', @_ );
2834             my $okParams =
2835             {
2836             expandable => { allowed => $EXPANDABLES->{bank_account} },
2837             account => { re => qr/^\w+$/, required => 1 },
2838             account_holder_name => { type => "string" },
2839             account_holder_type => { re => qr/^(company|individual)$/, type => "string" },
2840             default_for_currency => {},
2841             id => { re => qr/^\w+$/, required => 1 },
2842             metadata => { type => "hash" },
2843             };
2844              
2845             $args = $self->_contract( 'bank_account', $args ) || CORE::return( $self->pass_error );
2846             # We found some errors
2847             my $err = $self->_check_parameters( $okParams, $args );
2848             # $self->message( 3, "Data to be posted: ", $self->dumper( $args ) ); exit;
2849             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
2850             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No bank account id was provided to update coupon's details" ) );
2851             my $acct = CORE::delete( $args->{account} );
2852             my $hash = $self->post( "accounts/${acct}/external_accounts/${id}", $args ) || CORE::return( $self->pass_error );
2853             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Connect::ExternalAccount::Bank', $hash ) );
2854             }
2855             PERL
2856             # NOTE: bank_account_verify()
2857             bank_account_verify => <<'PERL',
2858             sub bank_account_verify
2859             {
2860             my $self = shift( @_ );
2861             my $args = shift( @_ );
2862             my $okParams =
2863             {
2864             expandable => { allowed => $EXPANDABLES->{ 'bank_account' } },
2865             amounts => { type => "array" },
2866             };
2867             $args = $self->_contract( 'bank_account', $args ) || CORE::return( $self->pass_error );
2868             my $err = $self->_check_parameters( $okParams, $args );
2869             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
2870             my $parent_id = CORE::delete( $args->{parent_id} ) || CORE::return( $self->error( "No customer id (with parameter 'parent_id') was provided to verify its information." ) );
2871             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No source id (with parameter 'id') was provided to verify its information." ) );
2872             my $hash = $self->post( "customers/${parent_id}/sources/${id}", $args ) || CORE::return( $self->pass_error );
2873             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Customer::BankAccount', $hash ) );
2874             }
2875             PERL
2876             # NOTE: bank_accounts()
2877             bank_accounts => <<'PERL',
2878             # <https://stripe.com/docs/api/customer_bank_accounts>
2879             sub bank_accounts
2880             {
2881             my $self = shift( @_ );
2882             my $allowed = [qw( create delete list retrieve update verify )];
2883             my $action = shift( @_ );
2884             my $meth = $self->_get_method( 'bank_account', $action, $allowed ) || CORE::return( $self->pass_error );
2885             CORE::return( $self->$meth( @_ ) );
2886             }
2887             PERL
2888             # NOTE: bank_token_create()
2889             bank_token_create => <<'PERL',
2890             sub bank_token_create { CORE::return( shift->token_create( @_ ) ); }
2891             PERL
2892             # NOTE: billing_details()
2893             billing_details => <<'PERL',
2894             sub billing_details { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Billing::Details', @_ ) ); }
2895             PERL
2896             # NOTE: billing_portal_configuration()
2897             billing_portal_configuration => <<'PERL',
2898             sub billing_portal_configuration { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Billing::PortalConfiguration', @_ ) ); }
2899             PERL
2900             # NOTE: billing_portal_configuration_create()
2901             billing_portal_configuration_create => <<'PERL',
2902             sub billing_portal_configuration_create
2903             {
2904             my $self = shift( @_ );
2905             my $args = shift( @_ );
2906             my $okParams =
2907             {
2908             expandable => { allowed => $EXPANDABLES->{ 'billing_portal.configuration' } },
2909             business_profile => { type => "hash", required => 1 },
2910             default_return_url => { type => "string" },
2911             features => { type => "hash", required => 1 },
2912             login_page => { type => "hash" },
2913             metadata => { type => "hash" },
2914             };
2915             $args = $self->_contract( 'billing_portal.configuration', $args ) || CORE::return( $self->pass_error );
2916             my $err = $self->_check_parameters( $okParams, $args );
2917             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
2918             my $hash = $self->post( "", $args ) || CORE::return( $self->pass_error );
2919             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::PortalConfiguration', $hash ) );
2920             }
2921             PERL
2922             # NOTE: billing_portal_configuration_list()
2923             billing_portal_configuration_list => <<'PERL',
2924             sub billing_portal_configuration_list
2925             {
2926             my $self = shift( @_ );
2927             CORE::return( $self->error( "No parameters were provided to list billing portal configuration information." ) ) if( !scalar( @_ ) );
2928             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Billing::PortalConfiguration', @_ );
2929             my $okParams =
2930             {
2931             expandable => { allowed => $EXPANDABLES->{ 'billing_portal.configuration' }, data_prefix_is_ok => 1 },
2932             active => { type => "boolean" },
2933             ending_before => { type => "string" },
2934             is_default => { type => "boolean" },
2935             limit => { type => "string" },
2936             starting_after => { type => "string" },
2937             };
2938             my $err = $self->_check_parameters( $okParams, $args );
2939             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
2940             if( $args->{expand} )
2941             {
2942             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
2943             }
2944             my $hash = $self->get( "", $args ) || CORE::return( $self->pass_error );
2945             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::PortalConfiguration', $hash ) );
2946             }
2947             PERL
2948             # NOTE: billing_portal_configuration_retrieve()
2949             billing_portal_configuration_retrieve => <<'PERL',
2950             sub billing_portal_configuration_retrieve
2951             {
2952             my $self = shift( @_ );
2953             my $args = shift( @_ );
2954             my $okParams =
2955             {
2956             expandable => { allowed => $EXPANDABLES->{ 'billing_portal.configuration' }, data_prefix_is_ok => 1 },
2957             };
2958             $args = $self->_contract( 'billing_portal.configuration', $args ) || CORE::return( $self->pass_error );
2959             my $err = $self->_check_parameters( $okParams, $args );
2960             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
2961             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No billing_portal.configuration id (with parameter 'id') was provided to retrieve its information." ) );
2962             my $hash = $self->get( "billing_portal/configurations/${id}", $args ) || CORE::return( $self->pass_error );
2963             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::PortalConfiguration', $hash ) );
2964             }
2965             PERL
2966             # NOTE: billing_portal_configuration_update()
2967             billing_portal_configuration_update => <<'PERL',
2968             sub billing_portal_configuration_update
2969             {
2970             my $self = shift( @_ );
2971             my $args = shift( @_ );
2972             my $okParams =
2973             {
2974             expandable => { allowed => $EXPANDABLES->{ 'billing_portal.configuration' } },
2975             active => { type => "boolean" },
2976             business_profile => { type => "hash" },
2977             default_return_url => { type => "string" },
2978             features => { type => "hash" },
2979             login_page => { type => "hash" },
2980             metadata => { type => "hash" },
2981             };
2982             $args = $self->_contract( 'billing_portal.configuration', $args ) || CORE::return( $self->pass_error );
2983             my $err = $self->_check_parameters( $okParams, $args );
2984             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
2985             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No billing_portal.configuration id (with parameter 'id') was provided to update its information." ) );
2986             my $hash = $self->post( "billing_portal/configurations/${id}", $args ) || CORE::return( $self->pass_error );
2987             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::PortalConfiguration', $hash ) );
2988             }
2989             PERL
2990             # NOTE: billing_portal_configurations()
2991             billing_portal_configurations => <<'PERL',
2992             # <https://stripe.com/docs/api/customer_portal>
2993             sub billing_portal_configurations
2994             {
2995             my $self = shift( @_ );
2996             my $allowed = [qw( create list retrieve update )];
2997             my $action = shift( @_ );
2998             my $meth = $self->_get_method( 'billing_portal_configuration', $action, $allowed ) || CORE::return( $self->pass_error );
2999             CORE::return( $self->$meth( @_ ) );
3000             }
3001             PERL
3002             # NOTE: billing_portal_session()
3003             billing_portal_session => <<'PERL',
3004             sub billing_portal_session { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Billing::PortalSession', @_ ) ); }
3005             PERL
3006             # NOTE: billing_portal_session_create()
3007             billing_portal_session_create => <<'PERL',
3008             sub billing_portal_session_create
3009             {
3010             my $self = shift( @_ );
3011             my $args = shift( @_ );
3012             my $okParams =
3013             {
3014             expandable => { allowed => $EXPANDABLES->{ 'billing_portal.session' } },
3015             configuration => { type => "string" },
3016             customer => { type => "string", required => 1 },
3017             locale => { type => "string" },
3018             on_behalf_of => { type => "string" },
3019             return_url => { type => "string" },
3020             };
3021             $args = $self->_contract( 'billing_portal.session', $args ) || CORE::return( $self->pass_error );
3022             my $err = $self->_check_parameters( $okParams, $args );
3023             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
3024             my $hash = $self->post( "", $args ) || CORE::return( $self->pass_error );
3025             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::PortalSession', $hash ) );
3026             }
3027             PERL
3028             # NOTE: billing_portal_sessions()
3029             billing_portal_sessions => <<'PERL',
3030             # <https://stripe.com/docs/api/customer_portal>
3031             sub billing_portal_sessions
3032             {
3033             my $self = shift( @_ );
3034             my $allowed = [qw( create )];
3035             my $action = shift( @_ );
3036             my $meth = $self->_get_method( 'billing_portal_session', $action, $allowed ) || CORE::return( $self->pass_error );
3037             CORE::return( $self->$meth( @_ ) );
3038             }
3039             PERL
3040             # NOTE: billing_thresholds()
3041             billing_thresholds => <<'PERL',
3042             sub billing_thresholds { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Billing::Thresholds', @_ ) ); }
3043             PERL
3044             # NOTE: business_profile()
3045             business_profile => <<'PERL',
3046             sub business_profile { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Connect::Business::Profile', @_ ) ); }
3047             PERL
3048             # NOTE: capability()
3049             capability => <<'PERL',
3050             # sub billing { CORE::return( shift->_instantiate( 'billing', 'Net::API::Stripe::Billing' ) ) }
3051             sub capability { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Connect::Account::Capability', @_ ) ); }
3052             PERL
3053             # NOTE: capability_list()
3054             capability_list => <<'PERL',
3055             sub capability_list
3056             {
3057             my $self = shift( @_ );
3058             CORE::return( $self->error( "No parameters were provided to list capability information." ) ) if( !scalar( @_ ) );
3059             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Connect::Account::Capability', @_ );
3060             my $okParams =
3061             {
3062             expandable => { allowed => $EXPANDABLES->{ 'capability' }, data_prefix_is_ok => 1 },
3063             };
3064             my $err = $self->_check_parameters( $okParams, $args );
3065             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
3066             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No account id (with parameter 'id') was provided to list its information." ) );
3067             if( $args->{expand} )
3068             {
3069             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
3070             }
3071             my $hash = $self->get( "accounts/${id}/capabilities", $args ) || CORE::return( $self->pass_error );
3072             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Connect::Account::Capability', $hash ) );
3073             }
3074             PERL
3075             # NOTE: capability_retrieve()
3076             capability_retrieve => <<'PERL',
3077             sub capability_retrieve
3078             {
3079             my $self = shift( @_ );
3080             my $args = shift( @_ );
3081             my $okParams =
3082             {
3083             expandable => { allowed => $EXPANDABLES->{ 'capability' }, data_prefix_is_ok => 1 },
3084             };
3085             $args = $self->_contract( 'capability', $args ) || CORE::return( $self->pass_error );
3086             my $err = $self->_check_parameters( $okParams, $args );
3087             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
3088             my $parent_id = CORE::delete( $args->{parent_id} ) || CORE::return( $self->error( "No account id (with parameter 'parent_id') was provided to retrieve its information." ) );
3089             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No account.capability id (with parameter 'id') was provided to retrieve its information." ) );
3090             my $hash = $self->get( "accounts/${parent_id}/capabilities/${id}", $args ) || CORE::return( $self->pass_error );
3091             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Connect::Account::Capability', $hash ) );
3092             }
3093             PERL
3094             # NOTE: capability_update()
3095             capability_update => <<'PERL',
3096             sub capability_update
3097             {
3098             my $self = shift( @_ );
3099             my $args = shift( @_ );
3100             my $okParams =
3101             {
3102             expandable => { allowed => $EXPANDABLES->{ 'capability' } },
3103             requested => { type => "boolean" },
3104             };
3105             $args = $self->_contract( 'capability', $args ) || CORE::return( $self->pass_error );
3106             my $err = $self->_check_parameters( $okParams, $args );
3107             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
3108             my $parent_id = CORE::delete( $args->{parent_id} ) || CORE::return( $self->error( "No account id (with parameter 'parent_id') was provided to update its information." ) );
3109             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No account.capability id (with parameter 'id') was provided to update its information." ) );
3110             my $hash = $self->post( "accounts/${parent_id}/capabilities/${id}", $args ) || CORE::return( $self->pass_error );
3111             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Connect::Account::Capability', $hash ) );
3112             }
3113             PERL
3114             # NOTE: capabilitys()
3115             capabilitys => <<'PERL',
3116             # <https://stripe.com/docs/api/capabilities>
3117             sub capabilitys
3118             {
3119             my $self = shift( @_ );
3120             my $allowed = [qw( list retrieve update )];
3121             my $action = shift( @_ );
3122             my $meth = $self->_get_method( 'capability', $action, $allowed ) || CORE::return( $self->pass_error );
3123             CORE::return( $self->$meth( @_ ) );
3124             }
3125             PERL
3126             # NOTE: card()
3127             card => <<'PERL',
3128             sub card { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Connect::ExternalAccount::Card', @_ ) ); }
3129             PERL
3130             # NOTE: card_create()
3131             card_create => <<'PERL',
3132             sub card_create
3133             {
3134             my $self = shift( @_ );
3135             CORE::return( $self->error( "No parameters were provided to create card" ) ) if( !scalar( @_ ) );
3136             my $args = {};
3137             my $card_fields = [qw( object number exp_month exp_year cvc currency name metadata default_for_currency address_line1 address_line2 address_city address_state address_zip address_country )];
3138             my $okParams =
3139             {
3140             expandable => { allowed => $EXPANDABLES->{card} },
3141             id => { re => qr/^\w+$/, required => 1 },
3142             # Token
3143             source => { type => 'hash', required => 1 },
3144             metadata => { type => 'hash' },
3145             };
3146            
3147             if( $self->_is_object( $_[0] ) && $_[0]->isa( 'Net::API::Stripe::Customer' ) )
3148             {
3149             $args = $_[0]->as_hash({ json => 1 });
3150             $okParams->{_cleanup} = 1;
3151             }
3152             elsif( $self->_is_object( $_[0] ) && $_[0]->isa( 'Net::API::Stripe::Payment::Card' ) )
3153             {
3154             $args = $_[0]->as_hash({ json => 1 });
3155             $args->{id} = CORE::delete( $args->{customer} );
3156             my $ref = {};
3157             @$ref{ @$card_fields } = @$args{ @$card_fields };
3158             $args->{source} = $ref;
3159             $okParams->{_cleanup} = 1;
3160             }
3161             else
3162             {
3163             $args = $self->_get_args( @_ );
3164             }
3165            
3166             $args = $self->_contract( 'card', $args ) || CORE::return( $self->pass_error );
3167             my $err = $self->_check_parameters( $okParams, $args );
3168             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
3169             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No customer id was provided to create a card for the customer" ) );
3170             my $hash = $self->post( "customers/${id}/sources", $args ) || CORE::return( $self->pass_error );
3171             CORE::return( $self->error( "Cannot find property 'object' in response hash reference: ", sub{ $self->dumper( $hash ) } ) ) if( !CORE::exists( $hash->{object} ) );
3172             my $class = $self->_object_type_to_class( $hash->{object} ) || CORE::return( $self->pass_error );
3173             # CORE::return( $self->_response_to_object( 'Net::API::Stripe::Payment::Card', $hash ) );
3174             CORE::return( $self->_response_to_object( $class, $hash ) );
3175             }
3176             PERL
3177             # NOTE: card_delete()
3178             card_delete => <<'PERL',
3179             sub card_delete
3180             {
3181             my $self = shift( @_ );
3182             CORE::return( $self->error( "No parameters were provided to delete card" ) ) if( !scalar( @_ ) );
3183             my $args = {};
3184             if( $self->_is_object( $_[0] ) && $_[0]->isa( 'Net::API::Stripe::Customer' ) )
3185             {
3186             my $cust = shift( @_ );
3187             CORE::return( $self->error( "No customer id was found in this customer object." ) ) if( !$cust->id );
3188             CORE::return( $self->error( "No source is set for the credit card to delete for this customer." ) ) if( !$cust->source );
3189             CORE::return( $self->error( "No credit card id found for this customer source to delete." ) ) if( !$cust->source->id );
3190             $args->{id} = $cust->id;
3191             $args->{card_id} = $cust->source->id;
3192             $args->{expand} = 'all';
3193             }
3194             elsif( $self->_is_object( $_[0] ) && $_[0]->isa( 'Net::API::Stripe::Payment::Card' ) )
3195             {
3196             my $card = shift( @_ );
3197             CORE::return( $self->error( "No card id was found in this card object." ) ) if( !$card->id );
3198             CORE::return( $self->error( "No customer object is set for this card object." ) ) if( !$card->customer );
3199             CORE::return( $self->error( "No customer id found in the customer object in this card object." ) ) if( !$card->customer->id );
3200             $args->{card_id} = $card->id;
3201             $args->{id} = $card->customer->id;
3202             $args->{expand} = 'all';
3203             }
3204             else
3205             {
3206             $args = $self->_get_args( @_ );
3207             }
3208             my $okParams =
3209             {
3210             expandable => { allowed => $EXPANDABLES->{card} },
3211             id => { re => qr/^\w+$/, required => 1 },
3212             card_id => { re => qr/^\w+$/, required => 1 },
3213             };
3214             my $err = $self->_check_parameters( $okParams, $args );
3215             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
3216             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No customer id was provided to delete his/her card" ) );
3217             my $cardId = CORE::delete( $args->{card_id} ) || CORE::return( $self->error( "No card id was provided to delete customer's card" ) );
3218             my $hash = $self->delete( "customers/${id}/sources/${cardId}", $args ) || CORE::return( $self->pass_error );
3219             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Payment::Card', $hash ) );
3220             }
3221             PERL
3222             # NOTE: card_holder()
3223             card_holder => <<'PERL',
3224             sub card_holder { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Issuing::Card::Holder', @_ ) ); }
3225             PERL
3226             # NOTE: card_list()
3227             card_list => <<'PERL',
3228             sub card_list
3229             {
3230             my $self = shift( @_ );
3231             CORE::return( $self->error( "No parameters were provided to list customer's cards." ) ) if( !scalar( @_ ) );
3232             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Customer', @_ );
3233             my $okParams =
3234             {
3235             expandable => { allowed => $EXPANDABLES->{card}, data_prefix_is_ok => 1 },
3236             ending_before => qr/^\w+$/,
3237             id => { re => /^\w+$/, required => 1 },
3238             limit => qr/^\d+$/,
3239             starting_after => qr/^\w+$/,
3240             };
3241             my $err = $self->_check_parameters( $okParams, $args );
3242             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
3243             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No customer id was provided to list his/her cards" ) );
3244             if( $args->{expand} )
3245             {
3246             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
3247             }
3248             my $hash = $self->get( "customers/${id}/sources", $args ) || CORE::return( $self->pass_error );
3249             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Payment::Card::List', $hash ) );
3250             }
3251             PERL
3252             # NOTE: card_retrieve()
3253             card_retrieve => <<'PERL',
3254             sub card_retrieve
3255             {
3256             my $self = shift( @_ );
3257             CORE::return( $self->error( "No parameters were provided to retrieve card information." ) ) if( !scalar( @_ ) );
3258             # my $args = $self->_get_args_from_object( 'Net::API::Stripe::Payment::Card', @_ );
3259             my $args = {};
3260             my $okParams =
3261             {
3262             expandable => { allowed => $EXPANDABLES->{card} },
3263             id => { re => qr/^\w+$/, required => 1 },
3264             customer => { re => qr/^\w+$/, required => 1 },
3265             };
3266             if( $self->_is_object( $_[0] ) && $_[0]->isa( 'Net::API::Stripe::Customer' ) )
3267             {
3268             my $cust = shift( @_ );
3269             CORE::return( $self->error( "No customer id was found in this customer object." ) ) if( !$cust->id );
3270             CORE::return( $self->error( "No source is set for the credit card to delete for this customer." ) ) if( !$cust->source );
3271             CORE::return( $self->error( "No credit card id found for this customer source to delete." ) ) if( !$cust->source->id );
3272             $args->{customer} = $cust->id;
3273             $args->{id} = $cust->source->id;
3274             $args->{expand} = 'all';
3275             $okParams->{_cleanup} = 1;
3276             }
3277             elsif( $self->_is_object( $_[0] ) && $_[0]->isa( 'Net::API::Stripe::Payment::Card' ) )
3278             {
3279             my $card = shift( @_ );
3280             CORE::return( $self->error( "No card id was found in this card object." ) ) if( !$card->id );
3281             CORE::return( $self->error( "No customer object is set for this card object." ) ) if( !$card->customer );
3282             CORE::return( $self->error( "No customer id found in the customer object in this card object." ) ) if( !$card->customer->id );
3283             $args->{customer} = $card->customer->id;
3284             $args->{expand} = 'all';
3285             $okParams->{_cleanup} = 1;
3286             }
3287             else
3288             {
3289             $args = $self->_get_args( @_ );
3290             }
3291             my $err = $self->_check_parameters( $okParams, $args );
3292             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
3293             my $id = CORE::delete( $args->{customer} ) || CORE::return( $self->error( "No customer id was provided to retrieve his/her card" ) );
3294             my $cardId = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No card id was provided to retrieve customer's card" ) );
3295             my $hash = $self->get( "customers/${id}/sources/${cardId}", $args ) || CORE::return( $self->pass_error );
3296             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Payment::Card', $hash ) );
3297             }
3298             PERL
3299             # NOTE: card_token_create()
3300             card_token_create => <<'PERL',
3301             sub card_token_create { CORE::return( shift->token_create( @_ ) ); }
3302             PERL
3303             # NOTE: card_update()
3304             card_update => <<'PERL',
3305             sub card_update
3306             {
3307             my $self = shift( @_ );
3308             CORE::return( $self->error( "No parameters were provided to update card." ) ) if( !scalar( @_ ) );
3309             my $args = {};
3310             my $okParams =
3311             {
3312             expandable => { allowed => $EXPANDABLES->{card} },
3313             id => { re => qr/^\w+$/, required => 1 },
3314             customer => { re => qr/^\w+$/, required => 1 },
3315             address_city => qr/^.*?$/,
3316             address_country => qr/^[a-zA-Z]{2}$/,
3317             address_line1 => qr/^.*?$/,
3318             address_line2 => qr/^.*?$/,
3319             address_state => qr/^.*?$/,
3320             address_zip => qr/^.*?$/,
3321             exp_month => qr/^\d{1,2}$/,
3322             exp_year => qr/^\d{1,2}$/,
3323             metadata => sub{ CORE::return( ref( $_[0] ) eq 'HASH' ? undef() : sprintf( "A hash ref was expected, but instead received '%s'", $_[0] ) ) },
3324             name => qr/^.*?$/,
3325             };
3326             if( $self->_is_object( $_[0] ) && $_[0]->isa( 'Net::API::Stripe::Customer' ) )
3327             {
3328             my $cust = shift( @_ );
3329             CORE::return( $self->error( "No customer id was found in this customer object." ) ) if( !$cust->id );
3330             CORE::return( $self->error( "No source is set for the credit card to delete for this customer." ) ) if( !$cust->source );
3331             CORE::return( $self->error( "No credit card id found for this customer source to delete." ) ) if( !$cust->source->id );
3332             $args = $cust->source->as_hash({ json => 1 });
3333             $args->{customer} = $cust->id;
3334             $args->{expand} = 'all';
3335             $okParams->{_cleanup} = 1;
3336             }
3337             elsif( $self->_is_object( $_[0] ) && $_[0]->isa( 'Net::API::Stripe::Payment::Card' ) )
3338             {
3339             my $card = shift( @_ );
3340             CORE::return( $self->error( "No card id was found in this card object." ) ) if( !$card->id );
3341             CORE::return( $self->error( "No customer object is set for this card object." ) ) if( !$card->customer );
3342             CORE::return( $self->error( "No customer id found in the customer object in this card object." ) ) if( !$card->customer->id );
3343             $args = $card->as_hash({ json => 1 });
3344             $args->{customer} = $card->customer->id;
3345             $args->{expand} = 'all';
3346             $okParams->{_cleanup} = 1;
3347             }
3348             else
3349             {
3350             $args = $self->_get_args( @_ );
3351             }
3352             $args = $self->_contract( 'card', $args ) || CORE::return( $self->pass_error );
3353             my $err = $self->_check_parameters( $okParams, $args );
3354             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
3355             my $id = CORE::delete( $args->{customer} ) || CORE::return( $self->error( "No customer id was provided to update his/her card." ) );
3356             my $cardId = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No card id was provided to update customer's card" ) );
3357             my $hash = $self->post( "customers/${id}/sources/${cardId}", $args ) || CORE::return( $self->pass_error );
3358             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Payment::Card', $hash ) );
3359             }
3360             PERL
3361             # NOTE: cards()
3362             cards => <<'PERL',
3363             sub cards
3364             {
3365             my $self = shift( @_ );
3366             my $action = shift( @_ );
3367             my $allowed = [qw( create retrieve update delete list )];
3368             my $meth = $self->_get_method( 'card', $action, $allowed ) || CORE::return( $self->pass_error );
3369             CORE::return( $self->$meth( @_ ) );
3370             }
3371             PERL
3372             # NOTE: cash_balance()
3373             cash_balance => <<'PERL',
3374             sub cash_balance { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Cash::Balance', @_ ) ); }
3375             PERL
3376             # NOTE: cash_balance_retrieve()
3377             cash_balance_retrieve => <<'PERL',
3378             sub cash_balance_retrieve
3379             {
3380             my $self = shift( @_ );
3381             CORE::return( $self->error( "No parameters were provided to retrieve a customer cash balance" ) ) if( !scalar( @_ ) );
3382             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Cash::Balance', @_ );
3383             my $okParams =
3384             {
3385             expandable => { allowed => $EXPANDABLES->{cash_balance} },
3386             customer => { re => qr/^\w+$/, required => 1 }
3387             };
3388             my $err = $self->_check_parameters( $okParams, $args );
3389             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
3390             my $cust = CORE::delete( $args->{customer} ) || CORE::return( $self->error( "No customer id was provided to retrieve his/her cash balance details" ) );
3391             my $hash = $self->get( "customers/${cust}/cash_balance", $args ) || CORE::return( $self->pass_error );
3392             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Cash::Balance', $hash ) );
3393             }
3394             PERL
3395             # NOTE: cash_balance_update()
3396             cash_balance_update => <<'PERL',
3397             sub cash_balance_update
3398             {
3399             my $self = shift( @_ );
3400             CORE::return( $self->error( "No parameters were provided to update a customer cash balance" ) ) if( !scalar( @_ ) );
3401             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Cash::Balance', @_ );
3402             my $okParams =
3403             {
3404             expandable => { allowed => $EXPANDABLES->{cash_balance} },
3405             customer => { re => qr/^\w+$/, required => 1 },
3406             settings => { fields => ["reconciliation_mode"], type => "hash" },
3407             };
3408              
3409             $args = $self->_contract( 'cash_balance', $args ) || CORE::return( $self->pass_error );
3410             # We found some errors
3411             my $err = $self->_check_parameters( $okParams, $args );
3412             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
3413             my $cust = CORE::delete( $args->{customer} ) || CORE::return( $self->error( "No customer id was provided to update his/her cash balance details" ) );
3414             my $hash = $self->post( "customers/${cust}/cash_balance", $args ) || CORE::return( $self->pass_error );
3415             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Cash::Balance', $hash ) );
3416             }
3417             PERL
3418             # NOTE: cash_balances()
3419             cash_balances => <<'PERL',
3420             sub cash_balances
3421             {
3422             my $self = shift( @_ );
3423             my $allowed = [qw( retrieve update )];
3424             my $action = shift( @_ );
3425             my $args = $self->_get_args( @_ );
3426             my $cust = CORE::delete( $args->{customer} ) || CORE::return( $self->error( "No customer id was provided to retrieve or update its cash balance details" ) );
3427             my $meth = $self->_get_method( "customers/${cust}/cash_balance", $action, $allowed ) || CORE::return( $self->pass_error );
3428             CORE::return( $self->$meth( $args ) );
3429             }
3430             PERL
3431             # NOTE: cash_transction()
3432             cash_transction => <<'PERL',
3433             sub cash_transction { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Cash::Transaction', @_ ) ); }
3434             PERL
3435             # NOTE: charge()
3436             charge => <<'PERL',
3437             sub charge { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Charge', @_ ) ); }
3438             PERL
3439             # NOTE: charge_capture()
3440             charge_capture => <<'PERL',
3441             sub charge_capture
3442             {
3443             my $self = shift( @_ );
3444             CORE::return( $self->error( "No parameters were provided to update a charge." ) ) if( !scalar( @_ ) );
3445             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Charge', @_ );
3446             my $okParams =
3447             {
3448             id => { re => qr/^\w+$/, required => 1 },
3449             amount => qr/^\d+$/,
3450             application_fee_amount => qr/^\d+$/,
3451             destination => [qw( amount )],
3452             expandable => { allowed => $EXPANDABLES->{charge} },
3453             receipt_email => qr/.*?/,
3454             statement_descriptor => qr/^.*?$/,
3455             statement_descriptor_suffix => qr/^.*?$/,
3456             transfer_data => [qw( amount )],
3457             transfer_group => qr/^.*?$/,
3458             };
3459             my $err = $self->_check_parameters( $okParams, $args );
3460             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
3461             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No charge id was provided to update its charge details." ) );
3462             CORE::return( $self->error( "Destination specified, but not account property provided" ) ) if( exists( $args->{destination} ) && !scalar( grep( /^account$/, @{$args->{destination}} ) ) );
3463             my $hash = $self->post( "charges/${id}/capture", $args ) || CORE::return( $self->pass_error );
3464             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Charge', $hash ) );
3465             }
3466             PERL
3467             # NOTE: charge_create()
3468             charge_create => <<'PERL',
3469             # https://stripe.com/docs/api/charges/create
3470             sub charge_create
3471             {
3472             my $self = shift( @_ );
3473             CORE::return( $self->error( "No parameters were provided to create charge." ) ) if( !scalar( @_ ) );
3474             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Charge', @_ );
3475             CORE::return( $self->error( "No amount was provided" ) ) if( !exists( $args->{amount} ) || !length( $args->{amount} ) );
3476             $args->{currency} ||= $self->currency;
3477             my $okParams =
3478             {
3479             expandable => { allowed => $EXPANDABLES->{charge} },
3480             amount => { re => qr/^\d+$/, required => 1, type => "integer" },
3481             application_fee_amount => qr/^\d+$/,
3482             capture => { type => "boolean" },
3483             currency => { re => qr/^[a-zA-Z]{3}$/, required => 1 },
3484             customer => qr/^\w+$/,
3485             description => qr/^.*?$/,
3486             destination => ["account", "amount"],
3487             idempotency => qr/^.*?$/,
3488             metadata => { type => "hash" },
3489             on_behalf_of => qr/^\w+$/,
3490             radar_options => { type => "hash" },
3491             receipt_email => qr/.*?/,
3492             shipping => {
3493             fields => ["address", "name", "carrier", "phone", "tracking_number"],
3494             type => "hash",
3495             },
3496             source => qr/^\w+$/,
3497             statement_descriptor => qr/^.*?$/,
3498             statement_descriptor_suffix => qr/^.*?$/,
3499             transfer_data => { fields => ["destination", "amount"], type => "hash" },
3500             transfer_group => qr/^.*?$/,
3501             };
3502              
3503            
3504             $args = $self->_contract( 'charge', $args ) || CORE::return( $self->pass_error );
3505             # We found some errors
3506             my $err = $self->_check_parameters( $okParams, $args );
3507             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
3508            
3509             $args->{currency} = lc( $args->{currency} );
3510             CORE::return( $self->error( "Destination specified, but no account property provided" ) ) if( exists( $args->{destination} ) && !scalar( grep( /^account$/, @{$args->{destination}} ) ) );
3511             my $hash = $self->post( 'charges', $args ) || CORE::return( $self->pass_error );
3512             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Charge', $hash ) );
3513             }
3514             PERL
3515             # NOTE: charge_list()
3516             charge_list => <<'PERL',
3517             sub charge_list
3518             {
3519             my $self = shift( @_ );
3520             my $args = shift( @_ );
3521             my $okParams =
3522             {
3523             expandable => { allowed => $EXPANDABLES->{charge}, data_prefix_is_ok => 1 },
3524             'created' => qr/^\d+$/,
3525             'created.gt' => qr/^\d+$/,
3526             'created.gte' => qr/^\d+$/,
3527             'created.lt' => qr/^\d+$/,
3528             'created.lte' => qr/^\d+$/,
3529             'customer' => qr/^\w+$/,
3530             # "A cursor for use in pagination. ending_before is an object ID that defines your place in the list."
3531             'ending_before' => qr/^\w+$/,
3532             'limit' => qr/^\d+$/,
3533             'payment_intent' => qr/^\w+$/,
3534             'source' => [qw( object )],
3535             'starting_after' => qr/^\w+$/,
3536             'transfer_group' => qr/^.*?$/,
3537             };
3538             my $err = $self->_check_parameters( $okParams, $args );
3539             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
3540             if( $args->{source} )
3541             {
3542             CORE::return( $self->error( "Invalid source value. It should one of all, alipay_account, bank_account, bitcoin_receiver or card" ) ) if( $args->{source}->{object} !~ /^(?:all|alipay_account|bank_account|bitcoin_receiver|card)$/ );
3543             }
3544             if( $args->{expand} )
3545             {
3546             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
3547             }
3548             my $hash = $self->get( 'charges', $args ) || CORE::return( $self->pass_error );
3549             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Charge::List', $hash ) );
3550             }
3551             PERL
3552             # NOTE: charge_retrieve()
3553             charge_retrieve => <<'PERL',
3554             sub charge_retrieve
3555             {
3556             my $self = shift( @_ );
3557             CORE::return( $self->error( "No parameters were provided to retrieve a charge" ) ) if( !scalar( @_ ) );
3558             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Charge', @_ );
3559             my $okParams =
3560             {
3561             expandable => { allowed => $EXPANDABLES->{charge} },
3562             id => { re => qr/^\w+$/, required => 1 }
3563             };
3564             my $err = $self->_check_parameters( $okParams, $args );
3565             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
3566             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No charge id was provided to retrieve its charge details" ) );
3567             my $hash = $self->get( "charges/${id}", $args ) || CORE::return( $self->pass_error );
3568             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Charge', $hash ) );
3569             }
3570             PERL
3571             # NOTE: charge_search()
3572             charge_search => <<'PERL',
3573             sub charge_search
3574             {
3575             my $self = shift( @_ );
3576             CORE::return( $self->error( "No parameters were provided to search charges." ) ) if( !scalar( @_ ) );
3577             my $args = shift( @_ );
3578             my $okParams =
3579             {
3580             expandable => { allowed => $EXPANDABLES->{charge}, data_prefix_is_ok => 1 },
3581             limit => qr/^\d+$/,
3582             page => qr/^\d+$/,
3583             query => { re => qr/^.*?$/, required => 1, type => "string" },
3584             };
3585              
3586             my $err = $self->_check_parameters( $okParams, $args );
3587             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
3588             if( $args->{expand} )
3589             {
3590             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
3591             }
3592             my $hash = $self->get( "charges/search", $args ) || CORE::return( $self->pass_error );
3593             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Charge::List', $hash ) );
3594             }
3595             PERL
3596             # NOTE: charge_update()
3597             charge_update => <<'PERL',
3598             sub charge_update
3599             {
3600             my $self = shift( @_ );
3601             CORE::return( $self->error( "No parameters were provided to update a charge" ) ) if( !scalar( @_ ) );
3602             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Charge', @_ );
3603             my $okParams =
3604             {
3605             expandable => { allowed => $EXPANDABLES->{charge} },
3606             customer => qr/^\w+$/,
3607             description => qr/^.*?$/,
3608             fraud_details => { fields => ["user_report"], type => "hash" },
3609             id => { re => qr/^\w+$/, required => 1 },
3610             metadata => { type => "hash" },
3611             receipt_email => qr/.*?/,
3612             shipping => {
3613             fields => ["address", "name", "carrier", "phone", "tracking_number"],
3614             type => "hash",
3615             },
3616             transfer_group => qr/^.*?$/,
3617             };
3618              
3619             $args = $self->_contract( 'charge', $args ) || CORE::return( $self->pass_error );
3620             # We found some errors
3621             my $err = $self->_check_parameters( $okParams, $args );
3622             if( $args->{fraud_details} )
3623             {
3624             my $this = $args->{fraud_details};
3625             if( $this->{user_report} !~ /^(?:fraudulent|safe)$/ )
3626             {
3627             CORE::return( $self->error( "Invalid value for fraud_details. It should be either fraudulent or safe" ) );
3628             }
3629             }
3630             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
3631             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No charge id was provided to update its charge details" ) );
3632             my $hash = $self->post( "charges/${id}", $args ) || CORE::return( $self->pass_error );
3633             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Charge', $hash ) );
3634             }
3635             PERL
3636             # NOTE: charges()
3637             charges => <<'PERL',
3638             sub charges
3639             {
3640             my $self = shift( @_ );
3641             my $allowed = [qw( create retrieve update capture list search )];
3642             my $action = shift( @_ );
3643             my $args = $self->_get_args( @_ );
3644             my $meth = $self->_get_method( 'charge', $action, $allowed ) || CORE::return( $self->pass_error );
3645             CORE::return( $self->$meth( $args ) );
3646             }
3647             PERL
3648             # NOTE: checkout_session()
3649             checkout_session => <<'PERL',
3650             sub checkout_session { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Checkout::Session', @_ ) ); }
3651             PERL
3652             # NOTE: checkout_session_create()
3653             checkout_session_create => <<'PERL',
3654             sub checkout_session_create
3655             {
3656             my $self = shift( @_ );
3657             my $args = shift( @_ );
3658             my $okParams =
3659             {
3660             expandable => { allowed => $EXPANDABLES->{ 'checkout.session' } },
3661             after_expiration => { type => "hash" },
3662             allow_promotion_codes => { type => "boolean" },
3663             automatic_tax => { type => "hash" },
3664             billing_address_collection => { type => "string" },
3665             cancel_url => { type => "string", required => 1 },
3666             client_reference_id => { type => "string" },
3667             consent_collection => { type => "hash" },
3668             currency => { type => "string" },
3669             customer => { type => "string" },
3670             customer_creation => { type => "string" },
3671             customer_email => { type => "string" },
3672             customer_update => { type => "object" },
3673             discounts => { type => "array" },
3674             expires_at => { type => "timestamp" },
3675             line_items => { type => "hash" },
3676             locale => { type => "string" },
3677             metadata => { type => "hash" },
3678             mode => { type => "string" },
3679             payment_intent_data => { type => "object" },
3680             payment_method_collection => { type => "string" },
3681             payment_method_options => { type => "hash" },
3682             payment_method_types => { type => "array" },
3683             phone_number_collection => { type => "hash" },
3684             setup_intent_data => { type => "object" },
3685             shipping_address_collection => { type => "hash" },
3686             shipping_options => { type => "array" },
3687             submit_type => { type => "string" },
3688             subscription_data => { type => "object" },
3689             success_url => { type => "string", required => 1 },
3690             tax_id_collection => { type => "hash" },
3691             };
3692             $args = $self->_contract( 'checkout.session', $args ) || CORE::return( $self->pass_error );
3693             my $err = $self->_check_parameters( $okParams, $args );
3694             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
3695             my $hash = $self->post( "", $args ) || CORE::return( $self->pass_error );
3696             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Checkout::Session', $hash ) );
3697             }
3698             PERL
3699             # NOTE: checkout_session_expire()
3700             checkout_session_expire => <<'PERL',
3701             sub checkout_session_expire
3702             {
3703             my $self = shift( @_ );
3704             my $args = shift( @_ );
3705             my $okParams =
3706             {
3707             expandable => { allowed => $EXPANDABLES->{ 'checkout.session' } },
3708             };
3709             $args = $self->_contract( 'checkout.session', $args ) || CORE::return( $self->pass_error );
3710             my $err = $self->_check_parameters( $okParams, $args );
3711             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
3712             my $hash = $self->post( "", $args ) || CORE::return( $self->pass_error );
3713             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Checkout::Session', $hash ) );
3714             }
3715             PERL
3716             # NOTE: checkout_session_items()
3717             checkout_session_items => <<'PERL',
3718             sub checkout_session_items
3719             {
3720             my $self = shift( @_ );
3721             CORE::return( $self->error( "No parameters were provided to items checkout session information." ) ) if( !scalar( @_ ) );
3722             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Checkout::Session', @_ );
3723             my $okParams =
3724             {
3725             expandable => { allowed => $EXPANDABLES->{ 'checkout.session' }, data_prefix_is_ok => 1 },
3726             ending_before => { type => "string" },
3727             limit => { type => "string" },
3728             starting_after => { type => "string" },
3729             };
3730             my $err = $self->_check_parameters( $okParams, $args );
3731             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
3732             my $hash = $self->get( "", $args ) || CORE::return( $self->pass_error );
3733             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Checkout::Session', $hash ) );
3734             }
3735             PERL
3736             # NOTE: checkout_session_list()
3737             checkout_session_list => <<'PERL',
3738             sub checkout_session_list
3739             {
3740             my $self = shift( @_ );
3741             CORE::return( $self->error( "No parameters were provided to list checkout session information." ) ) if( !scalar( @_ ) );
3742             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Checkout::Session', @_ );
3743             my $okParams =
3744             {
3745             expandable => { allowed => $EXPANDABLES->{ 'checkout.session' }, data_prefix_is_ok => 1 },
3746             customer => { type => "string" },
3747             customer_details => { type => "hash" },
3748             ending_before => { type => "string" },
3749             limit => { type => "string" },
3750             payment_intent => { type => "string" },
3751             starting_after => { type => "string" },
3752             subscription => { type => "string" },
3753             };
3754             my $err = $self->_check_parameters( $okParams, $args );
3755             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
3756             if( $args->{expand} )
3757             {
3758             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
3759             }
3760             my $hash = $self->get( "", $args ) || CORE::return( $self->pass_error );
3761             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Checkout::Session', $hash ) );
3762             }
3763             PERL
3764             # NOTE: checkout_session_retrieve()
3765             checkout_session_retrieve => <<'PERL',
3766             sub checkout_session_retrieve
3767             {
3768             my $self = shift( @_ );
3769             my $args = shift( @_ );
3770             my $okParams =
3771             {
3772             expandable => { allowed => $EXPANDABLES->{ 'checkout.session' }, data_prefix_is_ok => 1 },
3773             };
3774             $args = $self->_contract( 'checkout.session', $args ) || CORE::return( $self->pass_error );
3775             my $err = $self->_check_parameters( $okParams, $args );
3776             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
3777             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No checkout.session id (with parameter 'id') was provided to retrieve its information." ) );
3778             my $hash = $self->get( "checkout/sessions/${id}", $args ) || CORE::return( $self->pass_error );
3779             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Checkout::Session', $hash ) );
3780             }
3781             PERL
3782             # NOTE: checkout_sessions()
3783             checkout_sessions => <<'PERL',
3784             # <https://stripe.com/docs/api/checkout/sessions>
3785             sub checkout_sessions
3786             {
3787             my $self = shift( @_ );
3788             my $allowed = [qw( create expire items list retrieve )];
3789             my $action = shift( @_ );
3790             my $meth = $self->_get_method( 'checkout_session', $action, $allowed ) || CORE::return( $self->pass_error );
3791             CORE::return( $self->$meth( @_ ) );
3792             }
3793             PERL
3794             # NOTE: code_verification()
3795             code_verification => <<'PERL',
3796             sub code_verification { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Payment::Source::CodeVerification', @_ ) ); }
3797             PERL
3798             # NOTE: company()
3799             company => <<'PERL',
3800             sub company { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Connect::Account::Company', @_ ) ); }
3801             PERL
3802             # NOTE: connection_token()
3803             connection_token => <<'PERL',
3804             sub connection_token { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Terminal::ConnectionToken', @_ ) ); }
3805             PERL
3806             # NOTE: country_spec()
3807             country_spec => <<'PERL',
3808             sub country_spec { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Connect::CountrySpec', @_ ) ); }
3809             PERL
3810             # NOTE: country_spec_list()
3811             country_spec_list => <<'PERL',
3812             sub country_spec_list
3813             {
3814             my $self = shift( @_ );
3815             CORE::return( $self->error( "No parameters were provided to list country spec information." ) ) if( !scalar( @_ ) );
3816             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Connect::CountrySpec', @_ );
3817             my $okParams =
3818             {
3819             expandable => { allowed => $EXPANDABLES->{ 'country_spec' }, data_prefix_is_ok => 1 },
3820             ending_before => { type => "string" },
3821             limit => { type => "string" },
3822             starting_after => { type => "string" },
3823             };
3824             my $err = $self->_check_parameters( $okParams, $args );
3825             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
3826             if( $args->{expand} )
3827             {
3828             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
3829             }
3830             my $hash = $self->get( "country_specs", $args ) || CORE::return( $self->pass_error );
3831             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Connect::CountrySpec', $hash ) );
3832             }
3833             PERL
3834             # NOTE: country_spec_retrieve()
3835             country_spec_retrieve => <<'PERL',
3836             sub country_spec_retrieve
3837             {
3838             my $self = shift( @_ );
3839             my $args = shift( @_ );
3840             my $okParams =
3841             {
3842             expandable => { allowed => $EXPANDABLES->{ 'country_spec' }, data_prefix_is_ok => 1 },
3843             };
3844             $args = $self->_contract( 'country_spec', $args ) || CORE::return( $self->pass_error );
3845             my $err = $self->_check_parameters( $okParams, $args );
3846             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
3847             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No country_spec id (with parameter 'id') was provided to retrieve its information." ) );
3848             my $hash = $self->get( "country_specs/${id}", $args ) || CORE::return( $self->pass_error );
3849             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Connect::CountrySpec', $hash ) );
3850             }
3851             PERL
3852             # NOTE: country_specs()
3853             country_specs => <<'PERL',
3854             # <https://stripe.com/docs/api/country_specs>
3855             sub country_specs
3856             {
3857             my $self = shift( @_ );
3858             my $allowed = [qw( list retrieve )];
3859             my $action = shift( @_ );
3860             my $meth = $self->_get_method( 'country_spec', $action, $allowed ) || CORE::return( $self->pass_error );
3861             CORE::return( $self->$meth( @_ ) );
3862             }
3863             PERL
3864             # NOTE: coupon()
3865             coupon => <<'PERL',
3866             sub coupon { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Product::Coupon', @_ ) ); }
3867             PERL
3868             # NOTE: coupon_create()
3869             coupon_create => <<'PERL',
3870             sub coupon_create
3871             {
3872             my $self = shift( @_ );
3873             CORE::return( $self->error( "No parameters were provided to create a coupon" ) ) if( !scalar( @_ ) );
3874             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Product::Coupon', @_ );
3875             my $okParams =
3876             {
3877             expandable => { allowed => $EXPANDABLES->{coupon} },
3878             amount_off => { re => qr/^\d+$/, type => "integer" },
3879             applies_to => { type => "hash" },
3880             currency => { re => qr/^[a-zA-Z]{3}$/, type => "string" },
3881             currency_options => { type => "hash" },
3882             duration => { re => qr/^(forever|once|repeating)$/, type => "string" },
3883             duration_in_months => { re => qr/^\d+$/, type => "integer" },
3884             id => { type => "string" },
3885             max_redemptions => { re => qr/^\d+$/, type => "integer" },
3886             metadata => { type => "hash" },
3887             name => { type => "string" },
3888             percent_off => sub { ... },
3889             redeem_by => { type => "timestamp" },
3890             };
3891              
3892             $args = $self->_contract( 'coupon', $args ) || CORE::return( $self->pass_error );
3893             my $err = $self->_check_parameters( $okParams, $args );
3894             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
3895             my $hash = $self->post( 'coupons', $args ) || CORE::return( $self->pass_error );
3896             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Product::Coupon', $hash ) );
3897             }
3898             PERL
3899             # NOTE: coupon_delete()
3900             coupon_delete => <<'PERL',
3901             sub coupon_delete
3902             {
3903             my $self = shift( @_ );
3904             CORE::return( $self->error( "No parameters were provided to delete coupon information." ) ) if( !scalar( @_ ) );
3905             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Product::Coupon', @_ );
3906             my $okParams =
3907             {
3908             expandable => { allowed => $EXPANDABLES->{coupon} },
3909             id => { re => qr/^\S+$/, required => 1 }
3910             };
3911             my $err = $self->_check_parameters( $okParams, $args );
3912             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
3913             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No coupon id was provided to delete its information." ) );
3914             my $hash = $self->delete( "coupons/${id}", $args ) || CORE::return( $self->pass_error );
3915             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Product::Coupon', $hash ) );
3916             }
3917             PERL
3918             # NOTE: coupon_list()
3919             coupon_list => <<'PERL',
3920             sub coupon_list
3921             {
3922             my $self = shift( @_ );
3923             my $args = shift( @_ );
3924             my $okParams =
3925             {
3926             expandable => { allowed => $EXPANDABLES->{coupon} },
3927             'created' => qr/^\d+$/,
3928             'created.gt' => qr/^\d+$/,
3929             'created.gte' => qr/^\d+$/,
3930             'created.lt' => qr/^\d+$/,
3931             'created.lte' => qr/^\d+$/,
3932             # "A cursor for use in pagination. ending_before is an object ID that defines your place in the list."
3933             'ending_before' => qr/^\w+$/,
3934             'limit' => qr/^\d+$/,
3935             'starting_after' => qr/^\w+$/,
3936             };
3937             my $err = $self->_check_parameters( $okParams, $args );
3938             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
3939             if( $args->{expand} )
3940             {
3941             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
3942             }
3943             my $hash = $self->get( 'coupons', $args ) || CORE::return( $self->pass_error );
3944             CORE::return( $self->_response_to_object( 'Net::API::Stripe::List', $hash ) );
3945             }
3946             PERL
3947             # NOTE: coupon_retrieve()
3948             coupon_retrieve => <<'PERL',
3949             sub coupon_retrieve
3950             {
3951             my $self = shift( @_ );
3952             CORE::return( $self->error( "No parameters were provided to retrieve coupon information." ) ) if( !scalar( @_ ) );
3953             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Product::Coupon', @_ );
3954             my $okParams =
3955             {
3956             expandable => { allowed => $EXPANDABLES->{coupon} },
3957             id => { re => qr/^\S+$/, required => 1 }
3958             };
3959             my $err = $self->_check_parameters( $okParams, $args );
3960             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
3961             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No coupon id was provided to retrieve its information." ) );
3962             my $hash = $self->get( "coupons/${id}", $args ) || CORE::return( $self->pass_error );
3963             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Product::Coupon', $hash ) );
3964             }
3965             PERL
3966             # NOTE: coupon_update()
3967             coupon_update => <<'PERL',
3968             sub coupon_update
3969             {
3970             my $self = shift( @_ );
3971             CORE::return( $self->error( "No parameters were provided to update a coupon" ) ) if( !scalar( @_ ) );
3972             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Product::Coupon', @_ );
3973             my $okParams =
3974             {
3975             expandable => { allowed => $EXPANDABLES->{coupon} },
3976             currency_options => { type => "hash" },
3977             id => { re => qr/^\S+$/, required => 1 },
3978             metadata => { type => "hash" },
3979             name => { type => "string" },
3980             };
3981              
3982             $args = $self->_contract( 'coupon', $args ) || CORE::return( $self->pass_error );
3983             # We found some errors
3984             my $err = $self->_check_parameters( $okParams, $args );
3985             # $self->message( 3, "Data to be posted: ", $self->dumper( $args ) ); exit;
3986             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
3987             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No coupon id was provided to update coupon's details" ) );
3988             my $hash = $self->post( "coupons/${id}", $args ) || CORE::return( $self->pass_error );
3989             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Product::Coupon', $hash ) );
3990             }
3991             PERL
3992             # NOTE: coupons()
3993             coupons => <<'PERL',
3994             sub coupons
3995             {
3996             my $self = shift( @_ );
3997             my $action = shift( @_ );
3998             my $allowed = [qw( create retrieve update delete list )];
3999             my $meth = $self->_get_method( 'coupon', $action, $allowed ) || CORE::return( $self->pass_error );
4000             CORE::return( $self->$meth( @_ ) );
4001             }
4002             PERL
4003             # NOTE: credit_note()
4004             credit_note => <<'PERL',
4005             sub credit_note { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Billing::CreditNote', @_ ) ); }
4006             PERL
4007             # NOTE: credit_note_create()
4008             credit_note_create => <<'PERL',
4009             sub credit_note_create
4010             {
4011             my $self = shift( @_ );
4012             CORE::return( $self->error( "No parameters were provided to create a credit note" ) ) if( !scalar( @_ ) );
4013             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Billing::CreditNote', @_ );
4014             # If we are provided with an invoice object, we change our value for only its id
4015             if( $args->{_object} &&
4016             $self->_is_object( $args->{_object}->{invoice} ) &&
4017             $args->{_object}->invoice->isa( 'Net::API::Stripe::Billing::Invoice' ) )
4018             {
4019             my $cred = CORE::delete( $args->{_object} );
4020             $args->{invoice} = $cred->invoice->id || CORE::return( $self->error( "The Invoice object provided for this credit note has no id." ) );
4021             }
4022            
4023             my $okParams =
4024             {
4025             expandable => { allowed => $EXPANDABLES->{credit_note} },
4026             amount => { re => qr/^\d+$/, type => "integer" },
4027             credit_amount => { re => qr/^\d+$/, type => "integer" },
4028             invoice => { re => qr/^\w+$/, required => 1, type => "string" },
4029             lines => {
4030             fields => [
4031             "amount",
4032             "description",
4033             "invoice_line_item",
4034             "quantity",
4035             "tax_rates",
4036             "type",
4037             "unit_amount",
4038             "unit_amount_decimal",
4039             ],
4040             type => "array",
4041             },
4042             memo => { type => "string" },
4043             metadata => { type => "hash" },
4044             out_of_band_amount => { re => qr/^\d+$/, type => "integer" },
4045             reason => {
4046             re => qr/^(duplicate|fraudulent|order_change|product_unsatisfactory)$/,
4047             type => "string",
4048             },
4049             refund => { re => qr/^\w+$/, type => "string" },
4050             refund_amount => { re => qr/^\d+$/, type => "integer" },
4051             };
4052              
4053             $args = $self->_contract( 'credit_note', $args ) || CORE::return( $self->pass_error );
4054             my $err = $self->_check_parameters( $okParams, $args );
4055             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
4056             my $hash = $self->post( 'credit_notes', $args ) || CORE::return( $self->pass_error );
4057             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::CreditNote', $hash ) );
4058             }
4059             PERL
4060             # NOTE: credit_note_line_item()
4061             credit_note_line_item => <<'PERL',
4062             sub credit_note_line_item { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Billing::CreditNote::LineItem', @_ ) ); }
4063             PERL
4064             # NOTE: credit_note_line_item_list()
4065             credit_note_line_item_list => <<'PERL',
4066             sub credit_note_line_item_list
4067             {
4068             my $self = shift( @_ );
4069             CORE::return( $self->error( "No parameters were provided to list credit note line item information." ) ) if( !scalar( @_ ) );
4070             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Billing::CreditNote::LineItem', @_ );
4071             my $okParams =
4072             {
4073             expandable => { allowed => $EXPANDABLES->{ 'credit_note_line_item' }, data_prefix_is_ok => 1 },
4074             amount => { type => "integer" },
4075             credit_amount => { type => "string" },
4076             ending_before => { type => "string" },
4077             invoice => { type => "string", required => 1 },
4078             limit => { type => "string" },
4079             lines => { type => "string" },
4080             memo => { type => "string" },
4081             metadata => { type => "string" },
4082             out_of_band_amount => { type => "string" },
4083             reason => { type => "string" },
4084             refund => { type => "string" },
4085             refund_amount => { type => "string" },
4086             starting_after => { type => "string" },
4087             };
4088             my $err = $self->_check_parameters( $okParams, $args );
4089             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
4090             if( $args->{expand} )
4091             {
4092             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
4093             }
4094             my $hash = $self->get( "credit_notes/preview/lines", $args ) || CORE::return( $self->pass_error );
4095             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::CreditNote::LineItem', $hash ) );
4096             }
4097             PERL
4098             # NOTE: credit_note_line_items()
4099             credit_note_line_items => <<'PERL',
4100             # <https://stripe.com/docs/api/credit_notes>
4101             sub credit_note_line_items
4102             {
4103             my $self = shift( @_ );
4104             my $allowed = [qw( list )];
4105             my $action = shift( @_ );
4106             my $meth = $self->_get_method( 'credit_note_line_item', $action, $allowed ) || CORE::return( $self->pass_error );
4107             CORE::return( $self->$meth( @_ ) );
4108             }
4109             PERL
4110             # NOTE: credit_note_lines()
4111             credit_note_lines => <<'PERL',
4112             sub credit_note_lines
4113             {
4114             my $self = shift( @_ );
4115             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Billing::CreditNote', @_ );
4116             CORE::return( $self->error( "No credit note id was provided to retrieve its information." ) ) if( !CORE::length( $args->{id} ) );
4117             my $okParams =
4118             {
4119             id => { re => qr/^\w+$/, required => 1 },
4120             # "A cursor for use in pagination. ending_before is an object ID that defines your place in the list."
4121             ending_before => { re => qr/^\w+$/ },
4122             limit => { re => qr/^\d+$/ },
4123             starting_after => { re => qr/^\w+$/ },
4124             };
4125             my $err = $self->_check_parameters( $okParams, $args );
4126             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
4127             my $id = CORE::delete( $args->{id} );
4128             my $hash = $self->get( "credit_notes/${id}/lines", $args ) || CORE::return( $self->pass_error );
4129             CORE::return( $self->_response_to_object( 'Net::API::Stripe::List', $hash ) );
4130             }
4131             PERL
4132             # NOTE: credit_note_lines_preview()
4133             credit_note_lines_preview => <<'PERL',
4134             sub credit_note_lines_preview
4135             {
4136             my $self = shift( @_ );
4137             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Billing::CreditNote', @_ );
4138             # CORE::return( $self->error( "No credit note id was provided to retrieve its information." ) ) if( !CORE::length( $args->{id} ) );
4139             CORE::return( $self->error( "No invoice id or object was provided." ) ) if( !CORE::length( $args->{invoice} ) );
4140             if( $args->{_object} &&
4141             $self->_is_object( $args->{_object}->{invoice} ) &&
4142             $args->{_object}->invoice->isa( 'Net::API::Stripe::Billing::Invoice' ) )
4143             {
4144             my $cred = CORE::delete( $args->{_object} );
4145             $args->{invoice} = $cred->invoice->id || CORE::return( $self->error( "The Invoice object provided for this credit note has no id." ) );
4146             }
4147            
4148             my $okParams =
4149             {
4150             expandable => { allowed => $EXPANDABLES->{credit_note_lines} },
4151             # id => { re => qr/^\w+$/, required => 1 },
4152             invoice => { re => qr/^\w+$/, required => 1 },
4153             amount => { re => qr/^\d+$/ },
4154             credit_amount => { re => qr/^\d+$/ },
4155             ending_before => { re => qr/^\w+$/ },
4156             limit => { re => qr/^\d+$/ },
4157             lines => { type => 'array', fields => [qw( amount description invoice_line_item quantity tax_rates type unit_amount unit_amount_decimal )] },
4158             memo => {},
4159             metadata => { type => 'hash' },
4160             out_of_band_amount => { re => qr/^\d+$/ },
4161             reason => { re => qr/^(duplicate|fraudulent|order_change|product_unsatisfactory)$/ },
4162             refund => { re => qr/^\w+$/ },
4163             refund_amount => { re => qr/^\d+$/ },
4164             starting_after => { re => qr/^\w+$/ },
4165             };
4166             my $err = $self->_check_parameters( $okParams, $args );
4167             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
4168             my $id = CORE::delete( $args->{id} );
4169             my $hash = $self->get( "credit_notes/preview/${id}/lines", $args ) || CORE::return( $self->pass_error );
4170             CORE::return( $self->_response_to_object( 'Net::API::Stripe::List', $hash ) );
4171             }
4172             PERL
4173             # NOTE: credit_note_list()
4174             credit_note_list => <<'PERL',
4175             sub credit_note_list
4176             {
4177             my $self = shift( @_ );
4178             my $args = shift( @_ );
4179             my $okParams =
4180             {
4181             expandable => { allowed => $EXPANDABLES->{credit_note}, data_prefix_is_ok => 1 },
4182             created => qr/^\d+$/,
4183             'created.gt' => qr/^\d+$/,
4184             'created.gte' => qr/^\d+$/,
4185             'created.lt' => qr/^\d+$/,
4186             'created.lte' => qr/^\d+$/,
4187             customer => { type => "string" },
4188             ending_before => qr/^\w+$/,
4189             invoice => { type => "string" },
4190             limit => qr/^\d+$/,
4191             starting_after => qr/^\w+$/,
4192             };
4193              
4194             my $err = $self->_check_parameters( $okParams, $args );
4195             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
4196             if( $args->{expand} )
4197             {
4198             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
4199             }
4200             my $hash = $self->get( 'coupons', $args ) || CORE::return( $self->pass_error );
4201             CORE::return( $self->_response_to_object( 'Net::API::Stripe::List', $hash ) );
4202             }
4203             PERL
4204             # NOTE: credit_note_preview()
4205             credit_note_preview => <<'PERL',
4206             sub credit_note_preview
4207             {
4208             my $self = shift( @_ );
4209             CORE::return( $self->error( "No parameters were provided to preview a credit note" ) ) if( !scalar( @_ ) );
4210             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Billing::CreditNote', @_ );
4211            
4212             my $obj = $args->{_object};
4213             # If we are provided with an invoice object, we change our value for only its id
4214             if( $obj && $obj->invoice )
4215             {
4216             $args->{invoice} = $obj->invoice->id || CORE::return( $self->error( "The Invoice object provided for this credit note has no id." ) );
4217             }
4218            
4219             my $okParams =
4220             {
4221             expandable => { allowed => $EXPANDABLES->{credit_note}, data_prefix_is_ok => 1 },
4222             amount => { re => qr/^\d+$/, type => "integer" },
4223             credit_amount => { re => qr/^\d+$/, type => "string" },
4224             invoice => { required => 1, type => "string" },
4225             lines => {
4226             fields => [
4227             "amount",
4228             "description",
4229             "invoice_line_item",
4230             "quantity",
4231             "tax_rates",
4232             "type",
4233             "unit_amount",
4234             "unit_amount_decimal",
4235             ],
4236             type => "array",
4237             },
4238             memo => { type => "string" },
4239             metadata => { type => "hash" },
4240             out_of_band_amount => { re => qr/^\d+$/, type => "integer" },
4241             reason => {
4242             re => qr/^(duplicate|fraudulent|order_change|product_unsatisfactory)$/,
4243             type => "string",
4244             },
4245             refund => { re => qr/^\w+$/, type => "string" },
4246             refund_amount => { re => qr/^\d+$/, type => "string" },
4247             };
4248              
4249             my $err = $self->_check_parameters( $okParams, $args );
4250             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
4251             my $hash = $self->post( 'credit_notes/preview', $args ) || CORE::return( $self->pass_error );
4252             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::CreditNote', $hash ) );
4253             }
4254             PERL
4255             # NOTE: credit_note_retrieve()
4256             credit_note_retrieve => <<'PERL',
4257             sub credit_note_retrieve
4258             {
4259             my $self = shift( @_ );
4260             CORE::return( $self->error( "No parameters were provided to retrieve credit note information." ) ) if( !scalar( @_ ) );
4261             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Billing::CreditNote', @_ );
4262             my $okParams =
4263             {
4264             expandable => { allowed => $EXPANDABLES->{credit_note} },
4265             id => { re => qr/^\w+$/, required => 1 }
4266             };
4267             my $err = $self->_check_parameters( $okParams, $args );
4268             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
4269             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No credit note id was provided to retrieve its information." ) );
4270             my $hash = $self->get( "credit_notes/${id}", $args ) || CORE::return( $self->pass_error );
4271             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::CreditNote', $hash ) );
4272             }
4273             PERL
4274             # NOTE: credit_note_update()
4275             credit_note_update => <<'PERL',
4276             sub credit_note_update
4277             {
4278             my $self = shift( @_ );
4279             CORE::return( $self->error( "No parameters were provided to update a credit note" ) ) if( !scalar( @_ ) );
4280             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Billing::CreditNote', @_ );
4281             my $okParams =
4282             {
4283             expandable => { allowed => $EXPANDABLES->{credit_note} },
4284             id => { re => qr/^\w+$/, required => 1 },
4285             memo => { type => "string" },
4286             metadata => { type => "hash" },
4287             };
4288              
4289             $args = $self->_contract( 'credit_note', $args ) || CORE::return( $self->pass_error );
4290             # We found some errors
4291             my $err = $self->_check_parameters( $okParams, $args );
4292             # $self->message( 3, "Data to be posted: ", $self->dumper( $args ) ); exit;
4293             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
4294             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No credit note id was provided to update credit note's details" ) );
4295             my $hash = $self->post( "credit_notes/${id}", $args ) || CORE::return( $self->pass_error );
4296             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::CreditNote', $hash ) );
4297             }
4298             PERL
4299             # NOTE: credit_note_void()
4300             credit_note_void => <<'PERL',
4301             sub credit_note_void
4302             {
4303             my $self = shift( @_ );
4304             CORE::return( $self->error( "No parameters were provided to void credit note information." ) ) if( !scalar( @_ ) );
4305             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Billing::CreditNote', @_ );
4306             my $okParams =
4307             {
4308             expandable => { allowed => $EXPANDABLES->{credit_note} },
4309             id => { re => qr/^\w+$/, required => 1 }
4310             };
4311             my $err = $self->_check_parameters( $okParams, $args );
4312             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
4313             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No credit note id was provided to void it." ) );
4314             my $hash = $self->post( "credit_notes/${id}/void", $args ) || CORE::return( $self->pass_error );
4315             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::CreditNote', $hash ) );
4316             }
4317             PERL
4318             # NOTE: credit_notes()
4319             credit_notes => <<'PERL',
4320             sub credit_notes
4321             {
4322             my $self = shift( @_ );
4323             my $action = shift( @_ );
4324             # delete is an alias of void to make it more mnemotechnical to remember
4325             $action = 'void' if( $action eq 'delete' );
4326             my $allowed = [qw( preview create lines lines_preview retrieve update void list )];
4327             my $meth = $self->_get_method( 'coupons', $action, $allowed ) || CORE::return( $self->pass_error );
4328             CORE::return( $self->$meth( @_ ) );
4329             }
4330             PERL
4331             # NOTE: customer()
4332             customer => <<'PERL',
4333             sub customer { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Customer', @_ ) ); }
4334             PERL
4335             # NOTE: customer_balance_transaction()
4336             customer_balance_transaction => <<'PERL',
4337             sub customer_balance_transaction { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Customer::BalanceTransaction', @_ ) ); }
4338             PERL
4339             # NOTE: customer_balance_transaction_create()
4340             customer_balance_transaction_create => <<'PERL',
4341             sub customer_balance_transaction_create
4342             {
4343             my $self = shift( @_ );
4344             CORE::return( $self->error( "No parameters were provided to create a customer balance transaction" ) ) if( !scalar( @_ ) );
4345             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Customer::BalanceTransaction', @_ );
4346             my $okParams =
4347             {
4348             expandable => { allowed => $EXPANDABLES->{customer_balance_transaction} },
4349             amount => { re => qr/^\d+$/, required => 1, type => "integer" },
4350             currency => { re => qr/^[A-Z]{3}$/, required => 1, type => "string" },
4351             customer => { re => qr/^\w+$/, required => 1 },
4352             description => { type => "string" },
4353             metadata => { type => "hash" },
4354             };
4355              
4356             $args = $self->_contract( 'customer_balance_transaction', $args ) || CORE::return( $self->pass_error );
4357             my $err = $self->_check_parameters( $okParams, $args );
4358             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
4359             my $id = CORE::delete( $args->{customer} ) || CORE::return( $self->error( "No customer id was provided to create a balance transaction." ) );
4360             my $hash = $self->post( "customers/${id}/balance_transactions" ) || CORE::return( $self->pass_error );
4361             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Customer::BalanceTransaction', $hash ) );
4362             }
4363             PERL
4364             # NOTE: customer_balance_transaction_list()
4365             customer_balance_transaction_list => <<'PERL',
4366             sub customer_balance_transaction_list
4367             {
4368             my $self = shift( @_ );
4369             my $args = shift( @_ );
4370             my $okParams =
4371             {
4372             expandable => { allowed => $EXPANDABLES->{customer_balance_transaction}, data_prefix_is_ok => 1 },
4373             customer => { re => qr/^\w+$/, required => 1 },
4374             # "A cursor for use in pagination. ending_before is an object ID that defines your place in the list."
4375             'ending_before' => qr/^\w+$/,
4376             'limit' => qr/^\d+$/,
4377             'starting_after' => qr/^\w+$/,
4378             };
4379             my $err = $self->_check_parameters( $okParams, $args );
4380             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
4381             my $cust = CORE::delete( $args->{customer} ) || CORE::return( $self->error( "No customer id was provided to get a list of his/her balance transactions." ) );
4382             if( $args->{expand} )
4383             {
4384             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
4385             }
4386             my $hash = $self->get( "customers/${cust}/balance_transactions", $args ) || CORE::return( $self->pass_error );
4387             CORE::return( $self->_response_to_object( 'Net::API::Stripe::List', $hash ) );
4388             }
4389             PERL
4390             # NOTE: customer_balance_transaction_retrieve()
4391             customer_balance_transaction_retrieve => <<'PERL',
4392             sub customer_balance_transaction_retrieve
4393             {
4394             my $self = shift( @_ );
4395             CORE::return( $self->error( "No parameters were provided to retrieve customer balance transaction information." ) ) if( !scalar( @_ ) );
4396             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Customer::BalanceTransaction', @_ );
4397             my $okParams =
4398             {
4399             expandable => { allowed => $EXPANDABLES->{customer_balance_transaction} },
4400             id => { re => qr/^\w+$/, required => 1 },
4401             customer => { re => qr/^\w+$/, required => 1 },
4402             };
4403             my $err = $self->_check_parameters( $okParams, $args );
4404             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
4405             my $cust = CORE::delete( $args->{customer} ) || CORE::return( $self->error( "No customer id was provided to retrieve his/her bank account information." ) );
4406             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No customer balance transaction information id was provided to retrieve its information." ) );
4407             my $hash = $self->get( "customers/${cust}/balance_transactions/${id}", $args ) || CORE::return( $self->pass_error );
4408             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Customer::BalanceTransaction', $hash ) );
4409             }
4410             PERL
4411             # NOTE: customer_balance_transaction_update()
4412             customer_balance_transaction_update => <<'PERL',
4413             sub customer_balance_transaction_update
4414             {
4415             my $self = shift( @_ );
4416             CORE::return( $self->error( "No parameters were provided to update the customer balance transaction" ) ) if( !scalar( @_ ) );
4417             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Customer::BalanceTransaction', @_ );
4418             my $okParams =
4419             {
4420             expandable => { allowed => $EXPANDABLES->{customer_balance_transaction} },
4421             customer => { re => qr/^\w+$/, required => 1 },
4422             description => { type => "string" },
4423             id => { re => qr/^\w+$/, required => 1 },
4424             metadata => { type => "hash" },
4425             };
4426              
4427             $args = $self->_contract( 'customer_bank_account', $args ) || CORE::return( $self->pass_error );
4428             # We found some errors
4429             my $err = $self->_check_parameters( $okParams, $args );
4430             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
4431             my $cust = CORE::delete( $args->{customer} ) || CORE::return( $self->error( "No customer id was provided to update the customer's balance transaction details" ) );
4432             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No balance transaction id was provided to update its details" ) );
4433             my $hash = $self->post( "customers/${cust}/balance_transactions/${id}", $args ) || CORE::return( $self->pass_error );
4434             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Customer::BalanceTransaction', $hash ) );
4435             }
4436             PERL
4437             # NOTE: customer_balance_transactions()
4438             customer_balance_transactions => <<'PERL',
4439             sub customer_balance_transactions
4440             {
4441             my $self = shift( @_ );
4442             my $allowed = [qw( create retrieve update list )];
4443             my $action = shift( @_ );
4444             my $meth = $self->_get_method( 'customer_balance_transaction', $action, $allowed ) || CORE::return( $self->pass_error );
4445             CORE::return( $self->$meth( @_ ) );
4446             }
4447             PERL
4448             # NOTE: customer_bank_account()
4449             customer_bank_account => <<'PERL',
4450             sub customer_bank_account { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Customer::BankAccount', @_ ) ); }
4451             PERL
4452             # NOTE: customer_bank_account_create()
4453             customer_bank_account_create => <<'PERL',
4454             sub customer_bank_account_create
4455             {
4456             my $self = shift( @_ );
4457             CORE::return( $self->error( "No parameters were provided to create a customer bank account" ) ) if( !scalar( @_ ) );
4458             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Payment::Source', @_ );
4459             my $okParams =
4460             {
4461             expandable => { allowed => $EXPANDABLES->{customer_bank_account} },
4462             id => { re => qr/^\w+$/, required => 1 },
4463             object => { type => 'string', re => qr/^bank_account$/ },
4464             country => { re => qr/^[A-Z]{2}$/, required => 1 },
4465             currency => { re => qr/^[A-Z]{3}$/, required => 1 },
4466             account_holder_name => { re => qr/^.*?$/ },
4467             account_holder_type => { re => qr/^.*?$/ },
4468             routing_number => {},
4469             account_number => {},
4470             metadata => { type => 'hash' },
4471             };
4472             $args = $self->_contract( 'customer_bank_account', $args ) || CORE::return( $self->pass_error );
4473             my $err = $self->_check_parameters( $okParams, $args );
4474             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
4475             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No customer id was provided to create a bank account." ) );
4476             my $hash = $self->post( "customers/${id}/sources" ) || CORE::return( $self->pass_error );
4477             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Customer::BankAccount', $hash ) );
4478             }
4479             PERL
4480             # NOTE: customer_bank_account_delete()
4481             customer_bank_account_delete => <<'PERL',
4482             sub customer_bank_account_delete
4483             {
4484             my $self = shift( @_ );
4485             CORE::return( $self->error( "No parameters were provided to delete customer bank account." ) ) if( !scalar( @_ ) );
4486             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Customer::BankAccount', @_ );
4487             my $okParams =
4488             {
4489             expandable => { allowed => $EXPANDABLES->{customer_bank_account} },
4490             id => { re => qr/^\w+$/, required => 1 },
4491             customer => { re => qr/^\w+$/, required => 1 },
4492             };
4493             my $err = $self->_check_parameters( $okParams, $args );
4494             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
4495             my $cust = CORE::delete( $args->{customer} ) || CORE::return( $self->error( "No customer id was provided to delete his/her bank account." ) );
4496             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No customer bank accuont id was provided to delete." ) );
4497             my $hash = $self->delete( "customers/${cust}/sources/${id}" ) || CORE::return( $self->pass_error );
4498             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Customer::BankAccount', $hash ) );
4499             }
4500             PERL
4501             # NOTE: customer_bank_account_list()
4502             customer_bank_account_list => <<'PERL',
4503             sub customer_bank_account_list
4504             {
4505             my $self = shift( @_ );
4506             my $args = shift( @_ );
4507             my $okParams =
4508             {
4509             expandable => { allowed => $EXPANDABLES->{customer_bank_account}, data_prefix_is_ok => 1 },
4510             customer => { re => qr/^\w+$/, required => 1 },
4511             # "A cursor for use in pagination. ending_before is an object ID that defines your place in the list."
4512             'ending_before' => qr/^\w+$/,
4513             'limit' => qr/^\d+$/,
4514             'starting_after' => qr/^\w+$/,
4515             };
4516             my $err = $self->_check_parameters( $okParams, $args );
4517             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
4518             my $cust = CORE::delete( $args->{customer} ) || CORE::return( $self->error( "No customer id was provided to get a list of his/her bank accounts." ) );
4519             if( $args->{expand} )
4520             {
4521             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
4522             }
4523             my $hash = $self->get( "customers/${cust}/sources", $args ) || CORE::return( $self->pass_error );
4524             CORE::return( $self->_response_to_object( 'Net::API::Stripe::List', $hash ) );
4525             }
4526             PERL
4527             # NOTE: customer_bank_account_retrieve()
4528             customer_bank_account_retrieve => <<'PERL',
4529             sub customer_bank_account_retrieve
4530             {
4531             my $self = shift( @_ );
4532             CORE::return( $self->error( "No parameters were provided to retrieve customer bank account information." ) ) if( !scalar( @_ ) );
4533             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Customer::BankAccount', @_ );
4534             my $okParams =
4535             {
4536             expandable => { allowed => $EXPANDABLES->{customer_bank_account} },
4537             id => { re => qr/^\w+$/, required => 1 },
4538             customer => { re => qr/^\w+$/, required => 1 },
4539             };
4540             my $err = $self->_check_parameters( $okParams, $args );
4541             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
4542             my $cust = CORE::delete( $args->{customer} ) || CORE::return( $self->error( "No customer id was provided to retrieve his/her bank account information." ) );
4543             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No customer bank account id was provided to retrieve its information." ) );
4544             my $hash = $self->get( "customers/${cust}/sources/${id}", $args ) || CORE::return( $self->pass_error );
4545             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Customer::BankAccount', $hash ) );
4546             }
4547             PERL
4548             # NOTE: customer_bank_account_update()
4549             customer_bank_account_update => <<'PERL',
4550             sub customer_bank_account_update
4551             {
4552             my $self = shift( @_ );
4553             CORE::return( $self->error( "No parameters were provided to update the customer bank account" ) ) if( !scalar( @_ ) );
4554             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Customer::BankAccount', @_ );
4555             my $okParams =
4556             {
4557             expandable => { allowed => $EXPANDABLES->{customer_bank_account} },
4558             id => { re => qr/^\w+$/, required => 1 },
4559             customer => { re => qr/^\w+$/, required => 1 },
4560             account_holder_name => { re => qr/^.*?$/ },
4561             account_holder_type => {},
4562             metadata => { type => 'hash' },
4563             };
4564             $args = $self->_contract( 'customer_bank_account', $args ) || CORE::return( $self->pass_error );
4565             # We found some errors
4566             my $err = $self->_check_parameters( $okParams, $args );
4567             # $self->message( 3, "Data to be posted: ", $self->dumper( $args ) ); exit;
4568             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
4569             my $cust = CORE::delete( $args->{customer} ) || CORE::return( $self->error( "No customer id was provided to update the customer's bank account details" ) );
4570             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No bank account id was provided to update its details" ) );
4571             my $hash = $self->post( "customers/${cust}/sources/${id}", $args ) || CORE::return( $self->pass_error );
4572             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Customer::BankAccount', $hash ) );
4573             }
4574             PERL
4575             # NOTE: customer_bank_account_verify()
4576             customer_bank_account_verify => <<'PERL',
4577             sub customer_bank_account_verify
4578             {
4579             my $self = shift( @_ );
4580             CORE::return( $self->error( "No parameters were provided to verify customer bank account information." ) ) if( !scalar( @_ ) );
4581             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Customer::BankAccount', @_ );
4582             my $okParams =
4583             {
4584             expandable => { allowed => $EXPANDABLES->{customer_bank_account} },
4585             id => { re => qr/^\w+$/, required => 1 },
4586             customer => { re => qr/^\w+$/, required => 1 },
4587             amounts => { type => 'array', re => qr/^\d+$/ },
4588             };
4589             my $err = $self->_check_parameters( $okParams, $args );
4590             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
4591             my $cust = CORE::delete( $args->{customer} ) || CORE::return( $self->error( "No customer id was provided to verify his/her bank account." ) );
4592             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No customer bank account id was provided to verify." ) );
4593             my $hash = $self->post( "customers/${cust}/sources/${id}/verify", $args ) || CORE::return( $self->pass_error );
4594             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Customer::BankAccount', $hash ) );
4595             }
4596             PERL
4597             # NOTE: customer_bank_accounts()
4598             customer_bank_accounts => <<'PERL',
4599             sub customer_bank_accounts
4600             {
4601             my $self = shift( @_ );
4602             my $action = shift( @_ );
4603             my $allowed = [qw( create retrieve update verify delete list )];
4604             my $meth = $self->_get_method( 'customer', $action, $allowed ) || CORE::return( $self->pass_error );
4605             CORE::return( $self->$meth( @_ ) );
4606             }
4607             PERL
4608             # NOTE: customer_cash_balance_transaction()
4609             customer_cash_balance_transaction => <<'PERL',
4610             sub customer_cash_balance_transaction { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Cash::Transaction', @_ ) ); }
4611             PERL
4612             # NOTE: customer_cash_balance_transaction_fund_cash_balance()
4613             customer_cash_balance_transaction_fund_cash_balance => <<'PERL',
4614             sub customer_cash_balance_transaction_fund_cash_balance
4615             {
4616             my $self = shift( @_ );
4617             my $args = shift( @_ );
4618             my $okParams =
4619             {
4620             expandable => { allowed => $EXPANDABLES->{ 'customer_cash_balance_transaction' } },
4621             amount => { type => "integer", required => 1 },
4622             currency => { type => "string", required => 1 },
4623             reference => { type => "string" },
4624             };
4625             $args = $self->_contract( 'customer_cash_balance_transaction', $args ) || CORE::return( $self->pass_error );
4626             my $err = $self->_check_parameters( $okParams, $args );
4627             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
4628             my $customer = CORE::delete( $args->{customer} ) || CORE::return( $self->error( "No customer id (with parameter 'customer') was provided to fund_cash_balance its information." ) );
4629             my $hash = $self->post( "test_helpers/customers/${customer}/fund_cash_balance", $args ) || CORE::return( $self->pass_error );
4630             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Cash::Transaction', $hash ) );
4631             }
4632             PERL
4633             # NOTE: customer_cash_balance_transaction_list()
4634             customer_cash_balance_transaction_list => <<'PERL',
4635             sub customer_cash_balance_transaction_list
4636             {
4637             my $self = shift( @_ );
4638             CORE::return( $self->error( "No parameters were provided to list customer cash balance transaction information." ) ) if( !scalar( @_ ) );
4639             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Cash::Transaction', @_ );
4640             my $okParams =
4641             {
4642             expandable => { allowed => $EXPANDABLES->{ 'customer_cash_balance_transaction' }, data_prefix_is_ok => 1 },
4643             ending_before => { type => "string" },
4644             limit => { type => "string" },
4645             starting_after => { type => "string" },
4646             };
4647             my $err = $self->_check_parameters( $okParams, $args );
4648             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
4649             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No customer id (with parameter 'id') was provided to list its information." ) );
4650             if( $args->{expand} )
4651             {
4652             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
4653             }
4654             my $hash = $self->get( "customers/${id}/cash_balance_transactions", $args ) || CORE::return( $self->pass_error );
4655             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Cash::Transaction', $hash ) );
4656             }
4657             PERL
4658             # NOTE: customer_cash_balance_transaction_retrieve()
4659             customer_cash_balance_transaction_retrieve => <<'PERL',
4660             sub customer_cash_balance_transaction_retrieve
4661             {
4662             my $self = shift( @_ );
4663             my $args = shift( @_ );
4664             my $okParams =
4665             {
4666             expandable => { allowed => $EXPANDABLES->{ 'customer_cash_balance_transaction' }, data_prefix_is_ok => 1 },
4667             };
4668             $args = $self->_contract( 'customer_cash_balance_transaction', $args ) || CORE::return( $self->pass_error );
4669             my $err = $self->_check_parameters( $okParams, $args );
4670             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
4671             my $parent_id = CORE::delete( $args->{parent_id} ) || CORE::return( $self->error( "No customer id (with parameter 'parent_id') was provided to retrieve its information." ) );
4672             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No customer_cash_balance_transaction id (with parameter 'id') was provided to retrieve its information." ) );
4673             my $hash = $self->get( "customers/${parent_id}/cash_balance_transactions/${id}", $args ) || CORE::return( $self->pass_error );
4674             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Cash::Transaction', $hash ) );
4675             }
4676             PERL
4677             # NOTE: customer_cash_balance_transactions()
4678             customer_cash_balance_transactions => <<'PERL',
4679             # <https://stripe.com/docs/api/cash_balance>
4680             sub customer_cash_balance_transactions
4681             {
4682             my $self = shift( @_ );
4683             my $allowed = [qw( fund_cash_balance list retrieve )];
4684             my $action = shift( @_ );
4685             my $meth = $self->_get_method( 'customer_cash_balance_transaction', $action, $allowed ) || CORE::return( $self->pass_error );
4686             CORE::return( $self->$meth( @_ ) );
4687             }
4688             PERL
4689             # NOTE: customer_create()
4690             customer_create => <<'PERL',
4691             # https://stripe.com/docs/api/customers/create?lang=curl
4692             sub customer_create
4693             {
4694             my $self = shift( @_ );
4695             CORE::return( $self->error( "No parameters were provided to create customer" ) ) if( !scalar( @_ ) );
4696             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Customer', @_ );
4697             my $okParams =
4698             {
4699             expandable => { allowed => $EXPANDABLES->{customer} },
4700             account_balance => { re => qr/^\-?\d+$/ },
4701             address => {
4702             fields => ["line1", "city", "country", "line2", "postal_code", "state"],
4703             package => "Net::API::Stripe::Address",
4704             type => "hash",
4705             },
4706             balance => { re => qr/^\-?\d+$/, type => "integer" },
4707             cash_balance => { type => "hash" },
4708             coupon => { type => "string" },
4709             default_source => { re => qr/^\w+$/ },
4710             description => { type => "string" },
4711             email => { type => "string" },
4712             id => {},
4713             invoice_prefix => { re => qr/^[A-Z0-9]{3,12}$/, type => "string" },
4714             invoice_settings => {
4715             fields => ["custom_fields", "default_payment_method", "footer"],
4716             package => "Net::API::Stripe::Billing::Invoice::Settings",
4717             type => "hash",
4718             },
4719             metadata => { type => "hash" },
4720             name => { type => "string" },
4721             next_invoice_sequence => { type => "integer" },
4722             payment_method => { type => "string" },
4723             phone => { type => "string" },
4724             preferred_locales => { type => "array" },
4725             promotion_code => { type => "string" },
4726             shipping => {
4727             fields => ["address", "name", "carrier", "phone", "tracking_number"],
4728             package => "Net::API::Stripe::Shipping",
4729             type => "hash",
4730             },
4731             source => { re => qr/^\w+$/, type => "string" },
4732             tax => { type => "hash" },
4733             tax_exempt => { re => qr/^(none|exempt|reverse)$/, type => "string" },
4734             tax_id_data => { package => "Net::API::Stripe::Customer::TaxId", type => "array" },
4735             tax_info => {
4736             fields => ["tax_id", "type"],
4737             package => "Net::API::Stripe::Customer::TaxInfo",
4738             },
4739             test_clock => { type => "string" },
4740             };
4741              
4742             $args = $self->_contract( 'customer', $args ) || CORE::return( $self->pass_error );
4743             my $err = $self->_check_parameters( $okParams, $args );
4744             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
4745             CORE::return( $self->error( "Invalid tax type value provided. It can only be set to vat" ) ) if( $args->{tax_info} && $args->{tax_info}->{type} ne 'vat' );
4746             my $hash = $self->post( 'customers', $args ) || CORE::return( $self->pass_error );
4747             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Customer', $hash ) );
4748             }
4749             PERL
4750             # NOTE: customer_delete()
4751             customer_delete => <<'PERL',
4752             # https://stripe.com/docs/api/customers/delete?lang=curl
4753             # "Permanently deletes a customer. It cannot be undone. Also immediately cancels any active subscriptions on the customer."
4754             sub customer_delete
4755             {
4756             my $self = shift( @_ );
4757             CORE::return( $self->error( "No parameters were provided to delete customer information." ) ) if( !scalar( @_ ) );
4758             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Customer', @_ );
4759             my $okParams =
4760             {
4761             expandable => { allowed => $EXPANDABLES->{customer} },
4762             id => { re => qr/^\w+$/, required => 1 }
4763             };
4764             my $err = $self->_check_parameters( $okParams, $args );
4765             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
4766             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No customer id was provided to delete its information." ) );
4767             my $hash = $self->delete( "customers/${id}" ) || CORE::return( $self->pass_error );
4768             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Customer', $hash ) );
4769             }
4770             PERL
4771             # NOTE: customer_delete_discount()
4772             customer_delete_discount => <<'PERL',
4773             sub customer_delete_discount
4774             {
4775             my $self = shift( @_ );
4776             CORE::return( $self->error( "No parameters were provided to delete customer discount." ) ) if( !scalar( @_ ) );
4777             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Customer', @_ );
4778             my $okParams =
4779             {
4780             expandable => { allowed => $EXPANDABLES->{discount}},
4781             id => { re => qr/^\w+$/, required => 1 }
4782             };
4783             my $err = $self->_check_parameters( $okParams, $args );
4784             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
4785             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No customer id was provided to delete its coupon." ) );
4786             my $hash = $self->delete( "customers/${id}/discount", $args ) || CORE::return( $self->pass_error );
4787             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::Discount', $hash ) );
4788             }
4789             PERL
4790             # NOTE: customer_list()
4791             customer_list => <<'PERL',
4792             sub customer_list
4793             {
4794             my $self = shift( @_ );
4795             my $args = shift( @_ );
4796             my $okParams =
4797             {
4798             expandable => { allowed => $EXPANDABLES->{customer}, data_prefix_is_ok => 1 },
4799             created => qr/^\d+$/,
4800             'created.gt' => qr/^\d+$/,
4801             'created.gte' => qr/^\d+$/,
4802             'created.lt' => qr/^\d+$/,
4803             'created.lte' => qr/^\d+$/,
4804             email => qr/.*?/,
4805             ending_before => qr/^\w+$/,
4806             limit => qr/^\d+$/,
4807             starting_after => qr/^\w+$/,
4808             test_clock => { type => "string" },
4809             };
4810              
4811             my $err = $self->_check_parameters( $okParams, $args );
4812             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
4813             if( $args->{source} )
4814             {
4815             CORE::return( $self->error( "Invalid source value. It should one of all, alipay_account, bank_account, bitcoin_receiver or card" ) ) if( $args->{source}->{object} !~ /^(?:all|alipay_account|bank_account|bitcoin_receiver|card)$/ );
4816             }
4817             if( $args->{expand} )
4818             {
4819             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
4820             }
4821             my $hash = $self->get( 'customers', $args ) || CORE::return( $self->pass_error );
4822             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Customer::List', $hash ) );
4823             }
4824             PERL
4825             # NOTE: customer_payment_method()
4826             customer_payment_method => <<'PERL',
4827             sub customer_payment_method
4828             {
4829             my $self = shift( @_ );
4830             CORE::return( $self->error( "No parameters were provided to retrieve customer payment method information." ) ) if( !scalar( @_ ) );
4831             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Payment::Method', @_ );
4832             my $okParams =
4833             {
4834             expandable => { allowed => $EXPANDABLES->{payment_method} },
4835             # Payment method id
4836             id => { re => qr/^\w+$/, required => 1 },
4837             # Customer id
4838             customer => { re => qr/^\w+$/, required => 1 },
4839             };
4840             my $err = $self->_check_parameters( $okParams, $args );
4841             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
4842             my $cust = CORE::delete( $args->{customer} ) || CORE::return( $self->error( "No customer id was provided to retrieve its payment method information." ) );
4843             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No payment method id was provided to retrieve its information." ) );
4844             my $hash = $self->get( "customers/${cust}/payment_methods/${id}", $args ) || CORE::return( $self->pass_error );
4845             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Payment::Method', $hash ) );
4846             }
4847             PERL
4848             # NOTE: customer_payment_methods()
4849             customer_payment_methods => <<'PERL',
4850             sub customer_payment_methods
4851             {
4852             my $self = shift( @_ );
4853             CORE::return( $self->error( "No parameters were provided to list a customer payment methods" ) ) if( !scalar( @_ ) );
4854             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Customer', @_ );
4855             my $okParams =
4856             {
4857             expandable => { allowed => $EXPANDABLES->{payment_method}, data_prefix_is_ok => 1 },
4858             id => { re => qr/^\w+$/, required => 1 },
4859             };
4860             my $err = $self->_check_parameters( $okParams, $args );
4861             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
4862             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No customer id was provided to get the list of his/her payment methods." ) );
4863             if( $args->{expand} )
4864             {
4865             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
4866             }
4867             my $hash = $self->get( "customers/${id}/payment_methods", $args ) || CORE::return( $self->pass_error );
4868             CORE::return( $self->_response_to_object( 'Net::API::Stripe::List', $hash ) );
4869             }
4870             PERL
4871             # NOTE: customer_retrieve()
4872             customer_retrieve => <<'PERL',
4873             sub customer_retrieve
4874             {
4875             my $self = shift( @_ );
4876             CORE::return( $self->error( "No parameters were provided to retrieve customer information." ) ) if( !scalar( @_ ) );
4877             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Customer', @_ );
4878             my $okParams =
4879             {
4880             expandable => { allowed => $EXPANDABLES->{customer} },
4881             id => { re => qr/^\w+$/, required => 1 },
4882             };
4883             my $err = $self->_check_parameters( $okParams, $args );
4884             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
4885             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No customer id was provided to retrieve its information." ) );
4886             my $hash = $self->get( "customers/${id}", $args ) || CORE::return( $self->pass_error );
4887             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Customer', $hash ) );
4888             }
4889             PERL
4890             # NOTE: customer_search()
4891             customer_search => <<'PERL',
4892             sub customer_search
4893             {
4894             my $self = shift( @_ );
4895             CORE::return( $self->error( "No parameters were provided to search customers." ) ) if( !scalar( @_ ) );
4896             my $args = shift( @_ );
4897             my $okParams =
4898             {
4899             expandable => { allowed => $EXPANDABLES->{customer}, data_prefix_is_ok => 1 },
4900             limit => qr/^\d+$/,
4901             page => qr/^\d+$/,
4902             query => { re => qr/^.*?$/, required => 1, type => "string" },
4903             };
4904              
4905             my $err = $self->_check_parameters( $okParams, $args );
4906             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
4907             if( $args->{expand} )
4908             {
4909             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
4910             }
4911             my $hash = $self->get( "customers/search", $args ) || CORE::return( $self->pass_error );
4912             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Customer::List', $hash ) );
4913             }
4914             PERL
4915             # NOTE: customer_tax_id()
4916             customer_tax_id => <<'PERL',
4917             sub customer_tax_id { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Customer::TaxId', @_ ) ); }
4918             PERL
4919             # NOTE: customer_update()
4920             customer_update => <<'PERL',
4921             # https://stripe.com/docs/api/customers/update?lang=curl
4922             sub customer_update
4923             {
4924             my $self = shift( @_ );
4925             CORE::return( $self->error( "No parameters were provided to update a customer" ) ) if( !scalar( @_ ) );
4926             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Customer', @_ );
4927             my $okParams =
4928             {
4929             expandable => { allowed => $EXPANDABLES->{customer} },
4930             account_balance => { re => qr/^\d+$/ },
4931             address => {
4932             fields => ["line1", "line2", "city", "postal_code", "state", "country"],
4933             type => "hash",
4934             },
4935             balance => { type => "integer" },
4936             cash_balance => { type => "hash" },
4937             coupon => { type => "string" },
4938             default_source => { re => qr/^\w+$/, type => "string" },
4939             description => { type => "string" },
4940             email => { type => "string" },
4941             id => { re => qr/^\w+$/, required => 1 },
4942             invoice_prefix => { re => qr/^[A-Z0-9]{3,12}$/, type => "string" },
4943             invoice_settings => {
4944             fields => ["custom_fields", "default_payment_method", "footer"],
4945             type => "hash",
4946             },
4947             metadata => { type => "hash" },
4948             name => { type => "string" },
4949             next_invoice_sequence => { type => "integer" },
4950             phone => { type => "string" },
4951             preferred_locales => { type => "array" },
4952             promotion_code => { type => "string" },
4953             shipping => {
4954             fields => ["address", "name", "carrier", "phone", "tracking_number"],
4955             type => "hash",
4956             },
4957             source => { re => qr/^\w+$/, type => "string" },
4958             tax => { type => "hash" },
4959             tax_exempt => { re => qr/^(none|exempt|reverse)$/, type => "string" },
4960             tax_info => { fields => ["tax_id", "type"] },
4961             };
4962              
4963             $args = $self->_contract( 'customer', $args ) || CORE::return( $self->pass_error );
4964             # We found some errors
4965             my $err = $self->_check_parameters( $okParams, $args );
4966             if( $args->{fraud_details} )
4967             {
4968             my $this = $args->{fraud_details};
4969             if( $this->{user_report} !~ /^(?:fraudulent|safe)$/ )
4970             {
4971             CORE::return( $self->error( "Invalid value for fraud_details. It should be either fraudulent or safe" ) );
4972             }
4973             }
4974             if( $self->_is_object( $args->{invoice_settings}->{default_payment_method} ) )
4975             {
4976             $args->{invoice_settings}->{default_payment_method} = $args->{invoice_settings}->{default_payment_method}->id;
4977             }
4978             # $self->message( 3, "Data to be posted: ", $self->dumper( $args ) ); exit;
4979             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
4980             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No customer id was provided to update customer's details" ) );
4981             my $hash = $self->post( "customers/${id}", $args ) || CORE::return( $self->pass_error );
4982             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Customer', $hash ) );
4983             }
4984             PERL
4985             # NOTE: customers()
4986             customers => <<'PERL',
4987             sub customers
4988             {
4989             my $self = shift( @_ );
4990             my $action = shift( @_ );
4991             my $allowed = [qw( create retrieve update delete delete_discount list search payment_methods )];
4992             my $meth = $self->_get_method( 'customer', $action, $allowed ) || CORE::return( $self->pass_error );
4993             CORE::return( $self->$meth( @_ ) );
4994             }
4995             PERL
4996             # NOTE: cvc_update_token_create()
4997             cvc_update_token_create => <<'PERL',
4998             sub cvc_update_token_create { CORE::return( shift->token_create( @_ ) ); }
4999             PERL
5000             # NOTE: data()
5001             data => <<'PERL',
5002             sub data { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Event::Data', @_ ) ); }
5003             PERL
5004             # NOTE: discount()
5005             discount => <<'PERL',
5006             sub discount { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Billing::Discount', @_ ) ); }
5007             PERL
5008             # NOTE: discount_delete()
5009             discount_delete => <<'PERL',
5010             sub discount_delete
5011             {
5012             my $self = shift( @_ );
5013             CORE::return( $self->error( "No parameters were provided to delete discount information." ) ) if( !scalar( @_ ) );
5014             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Billing::Discount', @_ );
5015             my $okParams =
5016             {
5017             expandable => { allowed => $EXPANDABLES->{ 'discount' } },
5018             };
5019             my $err = $self->_check_parameters( $okParams, $args );
5020             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
5021             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No subscription id (with parameter 'id') was provided to delete its information." ) );
5022             my $hash = $self->delete( "subscriptions/${id}/discount", $args ) || CORE::return( $self->pass_error );
5023             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::Discount', $hash ) );
5024             }
5025             PERL
5026             # NOTE: discounts()
5027             discounts => <<'PERL',
5028             # <https://stripe.com/docs/api/discounts>
5029             sub discounts
5030             {
5031             my $self = shift( @_ );
5032             my $allowed = [qw( delete delete_customer delete_subscription )];
5033             my $action = shift( @_ );
5034             my $meth = $self->_get_method( 'discount', $action, $allowed ) || CORE::return( $self->pass_error );
5035             CORE::return( $self->$meth( @_ ) );
5036             }
5037             PERL
5038             # NOTE: dispute()
5039             dispute => <<'PERL',
5040             sub dispute { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Dispute', @_ ) ); }
5041             PERL
5042             # NOTE: dispute_close()
5043             dispute_close => <<'PERL',
5044             sub dispute_close
5045             {
5046             my $self = shift( @_ );
5047             CORE::return( $self->error( "No parameters were provided to close dispute." ) ) if( !scalar( @_ ) );
5048             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Dispute', @_ );
5049             my $okParams =
5050             {
5051             expandable => { allowed => $EXPANDABLES->{dispute} },
5052             id => { re => qr/^\w+$/, required => 1 }
5053             };
5054             my $err = $self->_check_parameters( $okParams, $args );
5055             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
5056             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No dispute id was provided to close." ) );
5057             my $hash = $self->delete( "disputes/${id}/close", $args ) || CORE::return( $self->pass_error );
5058             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Dispute', $hash ) );
5059             }
5060             PERL
5061             # NOTE: dispute_evidence()
5062             dispute_evidence => <<'PERL',
5063             sub dispute_evidence { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Dispute', @_ ) ); }
5064             PERL
5065             # NOTE: dispute_list()
5066             dispute_list => <<'PERL',
5067             sub dispute_list
5068             {
5069             my $self = shift( @_ );
5070             my $args = shift( @_ );
5071             my $okParams =
5072             {
5073             expandable => { allowed => $EXPANDABLES->{dispute}, data_prefix_is_ok => 1 },
5074             charge => { re => qr/.*?/, type => "string" },
5075             created => { re => qr/^\d+$/, type => "timestamp" },
5076             'created.gt' => { re => qr/^\d+$/ },
5077             'created.gte' => { re => qr/^\d+$/ },
5078             'created.lt' => { re => qr/^\d+$/ },
5079             'created.lte' => { re => qr/^\d+$/ },
5080             ending_before => { re => qr/^\w+$/, type => "string" },
5081             limit => { re => qr/^\d+$/, type => "string" },
5082             payment_intent => { re => qr/^\w+$/, type => "string" },
5083             starting_after => { re => qr/^\w+$/, type => "string" },
5084             };
5085              
5086             my $err = $self->_check_parameters( $okParams, $args );
5087             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
5088             if( $args->{expand} )
5089             {
5090             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
5091             }
5092             my $hash = $self->get( 'disputes', $args ) || CORE::return( $self->pass_error );
5093             CORE::return( $self->_response_to_object( 'Net::API::Stripe::List', $hash ) );
5094             }
5095             PERL
5096             # NOTE: dispute_retrieve()
5097             dispute_retrieve => <<'PERL',
5098             sub dispute_retrieve
5099             {
5100             my $self = shift( @_ );
5101             CORE::return( $self->error( "No parameters were provided to retrieve dispute information." ) ) if( !scalar( @_ ) );
5102             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Dispute', @_ );
5103             my $okParams =
5104             {
5105             expandable => { allowed => $EXPANDABLES->{dispute} },
5106             id => { re => qr/^\w+$/, required => 1 }
5107             };
5108             my $err = $self->_check_parameters( $okParams, $args );
5109             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
5110             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No dispute id was provided to retrieve its information." ) );
5111             my $hash = $self->get( "disputes/${id}", $args ) || CORE::return( $self->pass_error );
5112             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Dispute', $hash ) );
5113             }
5114             PERL
5115             # NOTE: dispute_update()
5116             dispute_update => <<'PERL',
5117             sub dispute_update
5118             {
5119             my $self = shift( @_ );
5120             CORE::return( $self->error( "No parameters were provided to update a dispute" ) ) if( !scalar( @_ ) );
5121             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Dispute', @_ );
5122             my $okParams =
5123             {
5124             expandable => { allowed => $EXPANDABLES->{dispute} },
5125             evidence => {
5126             fields => [
5127             "access_activity_log",
5128             "billing_address",
5129             "cancellation_policy",
5130             "cancellation_policy_disclosure",
5131             "cancellation_rebuttal",
5132             "customer_communication",
5133             "customer_email_address",
5134             "customer_name",
5135             "customer_purchase_ip",
5136             "customer_signature",
5137             "duplicate_charge_documentation",
5138             "duplicate_charge_explanation",
5139             "duplicate_charge_id",
5140             "product_description",
5141             "receipt",
5142             "refund_policy",
5143             "refund_policy_disclosure",
5144             "refund_refusal_explanation",
5145             "service_date",
5146             "service_documentation",
5147             "shipping_address",
5148             "shipping_carrier",
5149             "shipping_date",
5150             "shipping_documentation",
5151             "shipping_tracking_number",
5152             "uncategorized_file",
5153             "uncategorized_text",
5154             ],
5155             type => "hash",
5156             },
5157             id => { re => qr/^\w+$/, required => 1 },
5158             metadata => { type => "hash" },
5159             submit => { type => "boolean" },
5160             };
5161              
5162             $args = $self->_contract( 'dispute', $args ) || CORE::return( $self->pass_error );
5163             # We found some errors
5164             my $err = $self->_check_parameters( $okParams, $args );
5165             # $self->message( 3, "Data to be posted: ", $self->dumper( $args ) ); exit;
5166             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
5167             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No dispute id was provided to update dispute's details" ) );
5168             my $hash = $self->post( "disputes/${id}", $args ) || CORE::return( $self->pass_error );
5169             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Dispute', $hash ) );
5170             }
5171             PERL
5172             # NOTE: disputes()
5173             disputes => <<'PERL',
5174             sub disputes
5175             {
5176             my $self = shift( @_ );
5177             my $action = shift( @_ );
5178             my $allowed = [qw( close retrieve update list )];
5179             my $meth = $self->_get_method( 'dispute', $action, $allowed ) || CORE::return( $self->pass_error );
5180             CORE::return( $self->$meth( @_ ) );
5181             }
5182             PERL
5183             # NOTE: document()
5184             document => <<'PERL',
5185             sub document { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Connect::Account::Document', @_ ) ); }
5186             PERL
5187             # NOTE: event()
5188             event => <<'PERL',
5189             sub event { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Event', @_ ) ); }
5190             PERL
5191             # NOTE: event_list()
5192             event_list => <<'PERL',
5193             sub event_list
5194             {
5195             my $self = shift( @_ );
5196             my $args = shift( @_ );
5197             my $okParams =
5198             {
5199             expandable => { allowed => $EXPANDABLES->{event}, data_prefix_is_ok => 1 },
5200             created => { re => qr/^\d+$/, type => "timestamp" },
5201             'created.gt' => { re => qr/^\d+$/ },
5202             'created.gte' => { re => qr/^\d+$/ },
5203             'created.lt' => { re => qr/^\d+$/ },
5204             'created.lte' => { re => qr/^\d+$/ },
5205             delivery_success => { re => qr/.*?/, type => "string" },
5206             ending_before => { re => qr/^\w+$/, type => "string" },
5207             limit => { re => qr/^\d+$/, type => "string" },
5208             starting_after => { re => qr/^\w+$/, type => "string" },
5209             type => { re => qr/^\w+$/, type => "string" },
5210             types => { type => "string" },
5211             };
5212              
5213             my $err = $self->_check_parameters( $okParams, $args );
5214             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
5215             if( $args->{expand} )
5216             {
5217             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
5218             }
5219             my $hash = $self->get( 'events', $args ) || CORE::return( $self->pass_error );
5220             CORE::return( $self->_response_to_object( 'Net::API::Stripe::List', $hash ) );
5221             }
5222             PERL
5223             # NOTE: event_retrieve()
5224             event_retrieve => <<'PERL',
5225             sub event_retrieve
5226             {
5227             my $self = shift( @_ );
5228             CORE::return( $self->error( "No parameters were provided to retrieve event information." ) ) if( !scalar( @_ ) );
5229             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Event', @_ );
5230             my $okParams =
5231             {
5232             expandable => { allowed => $EXPANDABLES->{event} },
5233             id => { re => qr/^\w+$/, required => 1 }
5234             };
5235             my $err = $self->_check_parameters( $okParams, $args );
5236             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
5237             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No event id was provided to retrieve its information." ) );
5238             my $hash = $self->get( "events/${id}", $args ) || CORE::return( $self->pass_error );
5239             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Event', $hash ) );
5240             }
5241             PERL
5242             # NOTE: events()
5243             events => <<'PERL',
5244             sub events
5245             {
5246             my $self = shift( @_ );
5247             my $action = shift( @_ );
5248             my $allowed = [qw( retrieve list )];
5249             my $meth = $self->_get_method( 'events', $action, $allowed ) || CORE::return( $self->pass_error );
5250             CORE::return( $self->$meth( @_ ) );
5251             }
5252             PERL
5253             # NOTE: evidence()
5254             evidence => <<'PERL',
5255             sub evidence { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Issuing::Dispute::Evidence', @_ ) ); }
5256             PERL
5257             # NOTE: evidence_details()
5258             evidence_details => <<'PERL',
5259             sub evidence_details { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Dispute::EvidenceDetails', @_ ) ); }
5260             PERL
5261             # NOTE: fee_refund()
5262             fee_refund => <<'PERL',
5263             sub fee_refund { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Connect::ApplicationFee::Refund', @_ ) ); }
5264             PERL
5265             # NOTE: fee_refund_create()
5266             fee_refund_create => <<'PERL',
5267             sub fee_refund_create
5268             {
5269             my $self = shift( @_ );
5270             my $args = shift( @_ );
5271             my $okParams =
5272             {
5273             expandable => { allowed => $EXPANDABLES->{ 'fee_refund' } },
5274             amount => { type => "integer" },
5275             metadata => { type => "hash" },
5276             };
5277             $args = $self->_contract( 'fee_refund', $args ) || CORE::return( $self->pass_error );
5278             my $err = $self->_check_parameters( $okParams, $args );
5279             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
5280             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No application_fee id (with parameter 'id') was provided to create its information." ) );
5281             my $hash = $self->post( "application_fees/${id}/refunds", $args ) || CORE::return( $self->pass_error );
5282             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Connect::ApplicationFee::Refund', $hash ) );
5283             }
5284             PERL
5285             # NOTE: fee_refund_list()
5286             fee_refund_list => <<'PERL',
5287             sub fee_refund_list
5288             {
5289             my $self = shift( @_ );
5290             CORE::return( $self->error( "No parameters were provided to list fee refund information." ) ) if( !scalar( @_ ) );
5291             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Connect::ApplicationFee::Refund', @_ );
5292             my $okParams =
5293             {
5294             expandable => { allowed => $EXPANDABLES->{ 'fee_refund' }, data_prefix_is_ok => 1 },
5295             ending_before => { type => "string" },
5296             limit => { type => "string" },
5297             starting_after => { type => "string" },
5298             };
5299             my $err = $self->_check_parameters( $okParams, $args );
5300             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
5301             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No application_fee id (with parameter 'id') was provided to list its information." ) );
5302             if( $args->{expand} )
5303             {
5304             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
5305             }
5306             my $hash = $self->get( "application_fees/${id}/refunds", $args ) || CORE::return( $self->pass_error );
5307             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Connect::ApplicationFee::Refund', $hash ) );
5308             }
5309             PERL
5310             # NOTE: fee_refund_retrieve()
5311             fee_refund_retrieve => <<'PERL',
5312             sub fee_refund_retrieve
5313             {
5314             my $self = shift( @_ );
5315             my $args = shift( @_ );
5316             my $okParams =
5317             {
5318             expandable => { allowed => $EXPANDABLES->{ 'fee_refund' }, data_prefix_is_ok => 1 },
5319             };
5320             $args = $self->_contract( 'fee_refund', $args ) || CORE::return( $self->pass_error );
5321             my $err = $self->_check_parameters( $okParams, $args );
5322             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
5323             my $parent_id = CORE::delete( $args->{parent_id} ) || CORE::return( $self->error( "No application_fee id (with parameter 'parent_id') was provided to retrieve its information." ) );
5324             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No refund id (with parameter 'id') was provided to retrieve its information." ) );
5325             my $hash = $self->get( "application_fees/${parent_id}/refunds/${id}", $args ) || CORE::return( $self->pass_error );
5326             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Connect::ApplicationFee::Refund', $hash ) );
5327             }
5328             PERL
5329             # NOTE: fee_refund_update()
5330             fee_refund_update => <<'PERL',
5331             sub fee_refund_update
5332             {
5333             my $self = shift( @_ );
5334             my $args = shift( @_ );
5335             my $okParams =
5336             {
5337             expandable => { allowed => $EXPANDABLES->{ 'fee_refund' } },
5338             metadata => { type => "hash" },
5339             };
5340             $args = $self->_contract( 'fee_refund', $args ) || CORE::return( $self->pass_error );
5341             my $err = $self->_check_parameters( $okParams, $args );
5342             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
5343             my $parent_id = CORE::delete( $args->{parent_id} ) || CORE::return( $self->error( "No application_fee id (with parameter 'parent_id') was provided to update its information." ) );
5344             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No refund id (with parameter 'id') was provided to update its information." ) );
5345             my $hash = $self->post( "application_fees/${parent_id}/refunds/${id}", $args ) || CORE::return( $self->pass_error );
5346             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Connect::ApplicationFee::Refund', $hash ) );
5347             }
5348             PERL
5349             # NOTE: fee_refunds()
5350             fee_refunds => <<'PERL',
5351             # <https://stripe.com/docs/api/fee_refunds>
5352             sub fee_refunds
5353             {
5354             my $self = shift( @_ );
5355             my $allowed = [qw( create list retrieve update )];
5356             my $action = shift( @_ );
5357             my $meth = $self->_get_method( 'fee_refund', $action, $allowed ) || CORE::return( $self->pass_error );
5358             CORE::return( $self->$meth( @_ ) );
5359             }
5360             PERL
5361             # NOTE: file()
5362             file => <<'PERL',
5363             sub file { CORE::return( shift->_response_to_object( 'Net::API::Stripe::File', @_ ) ); }
5364             PERL
5365             # NOTE: file_create()
5366             file_create => <<'PERL',
5367             sub file_create
5368             {
5369             my $self = shift( @_ );
5370             CORE::return( $self->error( "No parameters were provided to create a file" ) ) if( !scalar( @_ ) );
5371             my $args = $self->_get_args_from_object( 'Net::API::Stripe::File', @_ );
5372             my $okParams =
5373             {
5374             expandable => { allowed => $EXPANDABLES->{file} },
5375             expand => { allowed => [] },
5376             file => { required => 1, type => "string" },
5377             file_link_data => { field => ["create", "expires_at", "metadata"], type => "hash" },
5378             purpose => {
5379             re => qr/^(business_icon|business_logo|customer_signature|dispute_evidence|identity_document|pci_document|tax_document_user_upload)$/,
5380             required => 1,
5381             type => "string",
5382             },
5383             };
5384              
5385             $args = $self->_contract( 'file', $args ) || CORE::return( $self->pass_error );
5386             my $err = $self->_check_parameters( $okParams, $args );
5387             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
5388             if( !CORE::length( $args->{file} ) )
5389             {
5390             CORE::return( $self->error( "No file was provided to upload." ) );
5391             }
5392             my $file = Module::Generic::File::file( $args->{file} );
5393             if( !$file->exists )
5394             {
5395             CORE::return( $self->error( "File \"$file\" does not exist." ) );
5396             }
5397             elsif( $file->is_empty )
5398             {
5399             CORE::return( $self->error( "File \"$file\" is empty." ) );
5400             }
5401             elsif( !$file->can_read )
5402             {
5403             CORE::return( $self->error( "File \"$file\" does not have read permission for us (uid = $>)." ) );
5404             }
5405             $args->{file} = { _filepath => $file };
5406             my $hash = $self->post_multipart( 'files', $args ) || CORE::return( $self->pass_error );
5407             CORE::return( $self->_response_to_object( 'Net::API::Stripe::File', $hash ) );
5408             }
5409             PERL
5410             # NOTE: file_link()
5411             file_link => <<'PERL',
5412             sub file_link { CORE::return( shift->_response_to_object( 'Net::API::Stripe::File::Link', @_ ) ); }
5413             PERL
5414             # NOTE: file_link_create()
5415             file_link_create => <<'PERL',
5416             sub file_link_create
5417             {
5418             my $self = shift( @_ );
5419             CORE::return( $self->error( "No parameters were provided to create a file link" ) ) if( !scalar( @_ ) );
5420             my $args = $self->_get_args_from_object( 'Net::API::Stripe::File::Link', @_ );
5421            
5422             my $okParams =
5423             {
5424             expandable => { allowed => $EXPANDABLES->{file_link} },
5425             expires_at => { type => "timestamp" },
5426             file => { package => "Net::API::Stripe::File", required => 1, type => "string" },
5427             metadata => { type => "hash" },
5428             };
5429              
5430             $args = $self->_contract( 'file_link', $args ) || CORE::return( $self->pass_error );
5431             my $err = $self->_check_parameters( $okParams, $args );
5432             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
5433             my $hash = $self->post( 'file_links', $args ) || CORE::return( $self->pass_error );
5434             CORE::return( $self->_response_to_object( 'Net::API::Stripe::File::Link', $hash ) );
5435             }
5436             PERL
5437             # NOTE: file_link_list()
5438             file_link_list => <<'PERL',
5439             sub file_link_list
5440             {
5441             my $self = shift( @_ );
5442             my $args = $self->_get_args( @_ );
5443             if( $self->_is_object( $args->{file} ) && $args->{file}->isa( 'Net::API::Stripe::File' ) )
5444             {
5445             $args->{file} = $args->{file}->id || CORE::return( $self->error( "No file id could be found in this file object." ) );
5446             }
5447             my $okParams =
5448             {
5449             expandable => { allowed => $EXPANDABLES->{file_link}, data_prefix_is_ok => 1 },
5450             created => qr/^\d+$/,
5451             'created.gt' => qr/^\d+$/,
5452             'created.gte' => qr/^\d+$/,
5453             'created.lt' => qr/^\d+$/,
5454             'created.lte' => qr/^\d+$/,
5455             ending_before => qr/^\w+$/,
5456             expand => { allowed => ["file"] },
5457             expired => { type => "boolean" },
5458             file => { type => "string" },
5459             limit => qr/^\d+$/,
5460             starting_after => qr/^\w+$/,
5461             };
5462              
5463             my $err = $self->_check_parameters( $okParams, $args );
5464             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
5465             if( $args->{expand} )
5466             {
5467             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
5468             }
5469             my $hash = $self->get( 'file_links', $args ) || CORE::return( $self->pass_error );
5470             CORE::return( $self->_response_to_object( 'Net::API::Stripe::List', $hash ) );
5471             }
5472             PERL
5473             # NOTE: file_link_retrieve()
5474             file_link_retrieve => <<'PERL',
5475             sub file_link_retrieve
5476             {
5477             my $self = shift( @_ );
5478             CORE::return( $self->error( "No parameters were provided to retrieve file link information." ) ) if( !scalar( @_ ) );
5479             my $args = $self->_get_args_from_object( 'Net::API::Stripe::File::Link', @_ );
5480             my $okParams =
5481             {
5482             expand => { allowed => $EXPANDABLES->{file_link} },
5483             id => { re => qr/^\w+$/, required => 1 }
5484             };
5485             my $err = $self->_check_parameters( $okParams, $args );
5486             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
5487             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No file link id was provided to retrieve its information." ) );
5488             my $hash = $self->get( "file_links/${id}", $args ) || CORE::return( $self->pass_error );
5489             CORE::return( $self->_response_to_object( 'Net::API::Stripe::File::Link', $hash ) );
5490             }
5491             PERL
5492             # NOTE: file_link_update()
5493             file_link_update => <<'PERL',
5494             sub file_link_update
5495             {
5496             my $self = shift( @_ );
5497             CORE::return( $self->error( "No parameters were provided to update a file link" ) ) if( !scalar( @_ ) );
5498             my $args = $self->_get_args_from_object( 'Net::API::Stripe::File::Link', @_ );
5499             my $okParams =
5500             {
5501             expandable => { allowed => $EXPANDABLES->{file_link} },
5502             expires_at => { type => "timestamp" },
5503             id => { re => qr/^\w+$/, required => 1 },
5504             metadata => { type => "hash" },
5505             };
5506              
5507             $args = $self->_contract( 'file_link', $args ) || CORE::return( $self->pass_error );
5508             # We found some errors
5509             my $err = $self->_check_parameters( $okParams, $args );
5510             # $self->message( 3, "Data to be posted: ", $self->dumper( $args ) ); exit;
5511             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
5512             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No file link id was provided to update its details" ) );
5513             my $hash = $self->post( "file_links/${id}", $args ) || CORE::return( $self->pass_error );
5514             CORE::return( $self->_response_to_object( 'Net::API::Stripe::File::Link', $hash ) );
5515             }
5516             PERL
5517             # NOTE: file_links()
5518             file_links => <<'PERL',
5519             sub file_links
5520             {
5521             my $self = shift( @_ );
5522             my $action = shift( @_ );
5523             my $allowed = [qw( create retrieve update list )];
5524             my $meth = $self->_get_method( 'file_links', $action, $allowed ) || CORE::return( $self->pass_error );
5525             CORE::return( $self->$meth( @_ ) );
5526             }
5527             PERL
5528             # NOTE: file_list()
5529             file_list => <<'PERL',
5530             sub file_list
5531             {
5532             my $self = shift( @_ );
5533             my $args = shift( @_ );
5534             my $okParams =
5535             {
5536             expandable => { allowed => $EXPANDABLES->{file}, data_prefix_is_ok => 1 },
5537             created => qr/^\d+$/,
5538             'created.gt' => qr/^\d+$/,
5539             'created.gte' => qr/^\d+$/,
5540             'created.lt' => qr/^\d+$/,
5541             'created.lte' => qr/^\d+$/,
5542             ending_before => qr/^\w+$/,
5543             expand => { allowed => [] },
5544             limit => qr/^\d+$/,
5545             purpose => { type => "string" },
5546             starting_after => qr/^\w+$/,
5547             };
5548              
5549             my $err = $self->_check_parameters( $okParams, $args );
5550             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
5551             if( $args->{expand} )
5552             {
5553             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
5554             }
5555             my $hash = $self->get( 'files', $args ) || CORE::return( $self->pass_error );
5556             CORE::return( $self->_response_to_object( 'Net::API::Stripe::List', $hash ) );
5557             }
5558             PERL
5559             # NOTE: file_retrieve()
5560             file_retrieve => <<'PERL',
5561             sub file_retrieve
5562             {
5563             my $self = shift( @_ );
5564             CORE::return( $self->error( "No parameters were provided to retrieve file information." ) ) if( !scalar( @_ ) );
5565             my $args = $self->_get_args_from_object( 'Net::API::Stripe::File', @_ );
5566             my $okParams =
5567             {
5568             expand => { allowed => $EXPANDABLES->{file} },
5569             id => { re => qr/^\w+$/, required => 1 }
5570             };
5571             my $err = $self->_check_parameters( $okParams, $args );
5572             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
5573             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No file id was provided to retrieve its information." ) );
5574             my $hash = $self->get( "files/${id}", $args ) || CORE::return( $self->pass_error );
5575             CORE::return( $self->_response_to_object( 'Net::API::Stripe::File', $hash ) );
5576             }
5577             PERL
5578             # NOTE: files()
5579             files => <<'PERL',
5580             # sub fraud { CORE::return( shift->_instantiate( 'fraud', 'Net::API::Stripe::Fraud' ) ) }
5581             sub files
5582             {
5583             my $self = shift( @_ );
5584             my $action = shift( @_ );
5585             my $allowed = [qw( create retrieve list )];
5586             my $meth = $self->_get_method( 'files', $action, $allowed ) || CORE::return( $self->pass_error );
5587             CORE::return( $self->$meth( @_ ) );
5588             }
5589             PERL
5590             # NOTE: financial_connections_account()
5591             financial_connections_account => <<'PERL',
5592             sub financial_connections_account { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Financial::Connections::Account', @_ ) ); }
5593             PERL
5594             # NOTE: financial_connections_account_disconnect()
5595             financial_connections_account_disconnect => <<'PERL',
5596             sub financial_connections_account_disconnect
5597             {
5598             my $self = shift( @_ );
5599             my $args = shift( @_ );
5600             my $okParams =
5601             {
5602             expandable => { allowed => $EXPANDABLES->{ 'financial_connections.account' } },
5603             };
5604             $args = $self->_contract( 'financial_connections.account', $args ) || CORE::return( $self->pass_error );
5605             my $err = $self->_check_parameters( $okParams, $args );
5606             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
5607             my $hash = $self->post( "", $args ) || CORE::return( $self->pass_error );
5608             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Financial::Connections::Account', $hash ) );
5609             }
5610             PERL
5611             # NOTE: financial_connections_account_list()
5612             financial_connections_account_list => <<'PERL',
5613             sub financial_connections_account_list
5614             {
5615             my $self = shift( @_ );
5616             CORE::return( $self->error( "No parameters were provided to list financial connections account information." ) ) if( !scalar( @_ ) );
5617             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Financial::Connections::Account', @_ );
5618             my $okParams =
5619             {
5620             expandable => { allowed => $EXPANDABLES->{ 'financial_connections.account' }, data_prefix_is_ok => 1 },
5621             account_holder => { type => "hash" },
5622             ending_before => { type => "string" },
5623             limit => { type => "string" },
5624             session => { type => "string" },
5625             starting_after => { type => "string" },
5626             };
5627             my $err = $self->_check_parameters( $okParams, $args );
5628             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
5629             if( $args->{expand} )
5630             {
5631             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
5632             }
5633             my $hash = $self->get( "financial_connections/accounts", $args ) || CORE::return( $self->pass_error );
5634             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Financial::Connections::Account', $hash ) );
5635             }
5636             PERL
5637             # NOTE: financial_connections_account_owner()
5638             financial_connections_account_owner => <<'PERL',
5639             sub financial_connections_account_owner { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Financial::Connections::AccountOwner', @_ ) ); }
5640             PERL
5641             # NOTE: financial_connections_account_owner_list()
5642             financial_connections_account_owner_list => <<'PERL',
5643             sub financial_connections_account_owner_list
5644             {
5645             my $self = shift( @_ );
5646             CORE::return( $self->error( "No parameters were provided to list financial connections account owner information." ) ) if( !scalar( @_ ) );
5647             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Financial::Connections::AccountOwner', @_ );
5648             my $okParams =
5649             {
5650             expandable => { allowed => $EXPANDABLES->{ 'financial_connections.account_owner' }, data_prefix_is_ok => 1 },
5651             ending_before => { type => "string" },
5652             limit => { type => "string" },
5653             ownership => { type => "string", required => 1 },
5654             starting_after => { type => "string" },
5655             };
5656             my $err = $self->_check_parameters( $okParams, $args );
5657             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
5658             if( $args->{expand} )
5659             {
5660             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
5661             }
5662             my $hash = $self->get( "?ownership=:ownership_id", $args ) || CORE::return( $self->pass_error );
5663             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Financial::Connections::AccountOwner', $hash ) );
5664             }
5665             PERL
5666             # NOTE: financial_connections_account_owners()
5667             financial_connections_account_owners => <<'PERL',
5668             # <https://stripe.com/docs/api/financial_connections/ownership>
5669             sub financial_connections_account_owners
5670             {
5671             my $self = shift( @_ );
5672             my $allowed = [qw( list )];
5673             my $action = shift( @_ );
5674             my $meth = $self->_get_method( 'financial_connections_account_owner', $action, $allowed ) || CORE::return( $self->pass_error );
5675             CORE::return( $self->$meth( @_ ) );
5676             }
5677             PERL
5678             # NOTE: financial_connections_account_ownership()
5679             financial_connections_account_ownership => <<'PERL',
5680             sub financial_connections_account_ownership { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Financial::Connections::AccountOwnership', @_ ) ); }
5681             PERL
5682             # NOTE: financial_connections_account_refresh()
5683             financial_connections_account_refresh => <<'PERL',
5684             sub financial_connections_account_refresh
5685             {
5686             my $self = shift( @_ );
5687             CORE::return( $self->error( "No parameters were provided to refresh financial connections account information." ) ) if( !scalar( @_ ) );
5688             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Financial::Connections::Account', @_ );
5689             my $okParams =
5690             {
5691             expandable => { allowed => $EXPANDABLES->{ 'financial_connections.account' } },
5692             features => { type => "array", required => 1 },
5693             };
5694             my $err = $self->_check_parameters( $okParams, $args );
5695             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
5696             my $hash = $self->post( "", $args ) || CORE::return( $self->pass_error );
5697             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Financial::Connections::Account', $hash ) );
5698             }
5699             PERL
5700             # NOTE: financial_connections_account_retrieve()
5701             financial_connections_account_retrieve => <<'PERL',
5702             sub financial_connections_account_retrieve
5703             {
5704             my $self = shift( @_ );
5705             my $args = shift( @_ );
5706             my $okParams =
5707             {
5708             expandable => { allowed => $EXPANDABLES->{ 'financial_connections.account' }, data_prefix_is_ok => 1 },
5709             };
5710             $args = $self->_contract( 'financial_connections.account', $args ) || CORE::return( $self->pass_error );
5711             my $err = $self->_check_parameters( $okParams, $args );
5712             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
5713             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No account id (with parameter 'id') was provided to retrieve its information." ) );
5714             my $hash = $self->get( "financial_connections/accounts/${id}", $args ) || CORE::return( $self->pass_error );
5715             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Financial::Connections::Account', $hash ) );
5716             }
5717             PERL
5718             # NOTE: financial_connections_accounts()
5719             financial_connections_accounts => <<'PERL',
5720             # <https://stripe.com/docs/api/financial_connections/accounts>
5721             sub financial_connections_accounts
5722             {
5723             my $self = shift( @_ );
5724             my $allowed = [qw( disconnect list refresh retrieve )];
5725             my $action = shift( @_ );
5726             my $meth = $self->_get_method( 'financial_connections_account', $action, $allowed ) || CORE::return( $self->pass_error );
5727             CORE::return( $self->$meth( @_ ) );
5728             }
5729             PERL
5730             # NOTE: financial_connections_session()
5731             financial_connections_session => <<'PERL',
5732             sub financial_connections_session { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Financial::Connections::Session', @_ ) ); }
5733             PERL
5734             # NOTE: financial_connections_session_create()
5735             financial_connections_session_create => <<'PERL',
5736             sub financial_connections_session_create
5737             {
5738             my $self = shift( @_ );
5739             my $args = shift( @_ );
5740             my $okParams =
5741             {
5742             expandable => { allowed => $EXPANDABLES->{ 'financial_connections.session' } },
5743             account_holder => { type => "hash", required => 1 },
5744             filters => { type => "hash" },
5745             permissions => { type => "array", required => 1 },
5746             };
5747             $args = $self->_contract( 'financial_connections.session', $args ) || CORE::return( $self->pass_error );
5748             my $err = $self->_check_parameters( $okParams, $args );
5749             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
5750             my $hash = $self->post( "financial_connections/sessions", $args ) || CORE::return( $self->pass_error );
5751             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Financial::Connections::Session', $hash ) );
5752             }
5753             PERL
5754             # NOTE: financial_connections_session_retrieve()
5755             financial_connections_session_retrieve => <<'PERL',
5756             sub financial_connections_session_retrieve
5757             {
5758             my $self = shift( @_ );
5759             my $args = shift( @_ );
5760             my $okParams =
5761             {
5762             expandable => { allowed => $EXPANDABLES->{ 'financial_connections.session' }, data_prefix_is_ok => 1 },
5763             };
5764             $args = $self->_contract( 'financial_connections.session', $args ) || CORE::return( $self->pass_error );
5765             my $err = $self->_check_parameters( $okParams, $args );
5766             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
5767             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No financial_connections.session id (with parameter 'id') was provided to retrieve its information." ) );
5768             my $hash = $self->get( "financial_connections/sessions/${id}", $args ) || CORE::return( $self->pass_error );
5769             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Financial::Connections::Session', $hash ) );
5770             }
5771             PERL
5772             # NOTE: financial_connections_sessions()
5773             financial_connections_sessions => <<'PERL',
5774             # <https://stripe.com/docs/api/financial_connections/session>
5775             sub financial_connections_sessions
5776             {
5777             my $self = shift( @_ );
5778             my $allowed = [qw( create retrieve )];
5779             my $action = shift( @_ );
5780             my $meth = $self->_get_method( 'financial_connections_session', $action, $allowed ) || CORE::return( $self->pass_error );
5781             CORE::return( $self->$meth( @_ ) );
5782             }
5783             PERL
5784             # NOTE: fraud()
5785             fraud => <<'PERL',
5786             sub fraud { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Fraud', @_ ) ); }
5787             PERL
5788             # NOTE: funding_instructions()
5789             funding_instructions => <<'PERL',
5790             sub funding_instructions { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Issuing::FundingInstructions', @_ ) ); }
5791             PERL
5792             # NOTE: funding_instructions_create()
5793             funding_instructions_create => <<'PERL',
5794             sub funding_instructions_create
5795             {
5796             my $self = shift( @_ );
5797             my $args = shift( @_ );
5798             my $okParams =
5799             {
5800             expandable => { allowed => $EXPANDABLES->{ 'funding_instructions' } },
5801             bank_transfer => { type => "hash", required => 1 },
5802             currency => { type => "string", required => 1 },
5803             funding_type => { type => "string", required => 1 },
5804             };
5805             $args = $self->_contract( 'funding_instructions', $args ) || CORE::return( $self->pass_error );
5806             my $err = $self->_check_parameters( $okParams, $args );
5807             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
5808             my $hash = $self->post( "issuing/funding_instructions", $args ) || CORE::return( $self->pass_error );
5809             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Issuing::FundingInstructions', $hash ) );
5810             }
5811             PERL
5812             # NOTE: funding_instructions_fund()
5813             funding_instructions_fund => <<'PERL',
5814             sub funding_instructions_fund
5815             {
5816             my $self = shift( @_ );
5817             my $args = shift( @_ );
5818             my $okParams =
5819             {
5820             expandable => { allowed => $EXPANDABLES->{ 'funding_instructions' } },
5821             amount => { type => "string", required => 1 },
5822             currency => { type => "string", required => 1 },
5823             };
5824             $args = $self->_contract( 'funding_instructions', $args ) || CORE::return( $self->pass_error );
5825             my $err = $self->_check_parameters( $okParams, $args );
5826             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
5827             my $hash = $self->post( "test_helpers/issuing/fund_balance", $args ) || CORE::return( $self->pass_error );
5828             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Issuing::FundingInstructions', $hash ) );
5829             }
5830             PERL
5831             # NOTE: funding_instructions_list()
5832             funding_instructions_list => <<'PERL',
5833             sub funding_instructions_list
5834             {
5835             my $self = shift( @_ );
5836             CORE::return( $self->error( "No parameters were provided to list funding instructions information." ) ) if( !scalar( @_ ) );
5837             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Issuing::FundingInstructions', @_ );
5838             my $okParams =
5839             {
5840             expandable => { allowed => $EXPANDABLES->{ 'funding_instructions' }, data_prefix_is_ok => 1 },
5841             ending_before => { type => "string" },
5842             limit => { type => "string" },
5843             starting_after => { type => "string" },
5844             };
5845             my $err = $self->_check_parameters( $okParams, $args );
5846             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
5847             if( $args->{expand} )
5848             {
5849             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
5850             }
5851             my $hash = $self->get( "issuing/funding_instructions", $args ) || CORE::return( $self->pass_error );
5852             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Issuing::FundingInstructions', $hash ) );
5853             }
5854             PERL
5855             # NOTE: funding_instructionss()
5856             funding_instructionss => <<'PERL',
5857             # <https://stripe.com/docs/api/issuing/funding_instructions>
5858             sub funding_instructionss
5859             {
5860             my $self = shift( @_ );
5861             my $allowed = [qw( create fund list )];
5862             my $action = shift( @_ );
5863             my $meth = $self->_get_method( 'funding_instructions', $action, $allowed ) || CORE::return( $self->pass_error );
5864             CORE::return( $self->$meth( @_ ) );
5865             }
5866             PERL
5867             # NOTE: identity_verification_report()
5868             identity_verification_report => <<'PERL',
5869             sub identity_verification_report { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Identity::VerificationReport', @_ ) ); }
5870             PERL
5871             # NOTE: identity_verification_report_list()
5872             identity_verification_report_list => <<'PERL',
5873             sub identity_verification_report_list
5874             {
5875             my $self = shift( @_ );
5876             CORE::return( $self->error( "No parameters were provided to list identity verification report information." ) ) if( !scalar( @_ ) );
5877             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Identity::VerificationReport', @_ );
5878             my $okParams =
5879             {
5880             expandable => { allowed => $EXPANDABLES->{ 'identity.verification_report' }, data_prefix_is_ok => 1 },
5881             created => { type => "timestamp" },
5882             ending_before => { type => "string" },
5883             limit => { type => "string" },
5884             starting_after => { type => "string" },
5885             type => { type => "string" },
5886             verification_session => { type => "string" },
5887             };
5888             my $err = $self->_check_parameters( $okParams, $args );
5889             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
5890             if( $args->{expand} )
5891             {
5892             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
5893             }
5894             my $hash = $self->get( "", $args ) || CORE::return( $self->pass_error );
5895             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Identity::VerificationReport', $hash ) );
5896             }
5897             PERL
5898             # NOTE: identity_verification_report_retrieve()
5899             identity_verification_report_retrieve => <<'PERL',
5900             sub identity_verification_report_retrieve
5901             {
5902             my $self = shift( @_ );
5903             my $args = shift( @_ );
5904             my $okParams =
5905             {
5906             expandable => { allowed => $EXPANDABLES->{ 'identity.verification_report' }, data_prefix_is_ok => 1 },
5907             };
5908             $args = $self->_contract( 'identity.verification_report', $args ) || CORE::return( $self->pass_error );
5909             my $err = $self->_check_parameters( $okParams, $args );
5910             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
5911             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No identity.verification_report id (with parameter 'id') was provided to retrieve its information." ) );
5912             my $hash = $self->get( "identity/verification_reports/${id}", $args ) || CORE::return( $self->pass_error );
5913             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Identity::VerificationReport', $hash ) );
5914             }
5915             PERL
5916             # NOTE: identity_verification_reports()
5917             identity_verification_reports => <<'PERL',
5918             # <https://stripe.com/docs/api/identity/verification_reports>
5919             sub identity_verification_reports
5920             {
5921             my $self = shift( @_ );
5922             my $allowed = [qw( list retrieve )];
5923             my $action = shift( @_ );
5924             my $meth = $self->_get_method( 'identity_verification_report', $action, $allowed ) || CORE::return( $self->pass_error );
5925             CORE::return( $self->$meth( @_ ) );
5926             }
5927             PERL
5928             # NOTE: identity_verification_session()
5929             identity_verification_session => <<'PERL',
5930             sub identity_verification_session { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Identity::VerificationSession', @_ ) ); }
5931             PERL
5932             # NOTE: identity_verification_session_cancel()
5933             identity_verification_session_cancel => <<'PERL',
5934             sub identity_verification_session_cancel
5935             {
5936             my $self = shift( @_ );
5937             my $args = shift( @_ );
5938             my $okParams =
5939             {
5940             expandable => { allowed => $EXPANDABLES->{ 'identity.verification_session' } },
5941             };
5942             $args = $self->_contract( 'identity.verification_session', $args ) || CORE::return( $self->pass_error );
5943             my $err = $self->_check_parameters( $okParams, $args );
5944             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
5945             my $hash = $self->post( "", $args ) || CORE::return( $self->pass_error );
5946             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Identity::VerificationSession', $hash ) );
5947             }
5948             PERL
5949             # NOTE: identity_verification_session_create()
5950             identity_verification_session_create => <<'PERL',
5951             sub identity_verification_session_create
5952             {
5953             my $self = shift( @_ );
5954             my $args = shift( @_ );
5955             my $okParams =
5956             {
5957             expandable => { allowed => $EXPANDABLES->{ 'identity.verification_session' } },
5958             metadata => { type => "hash" },
5959             options => { type => "hash" },
5960             return_url => { type => "string" },
5961             type => { type => "string", required => 1 },
5962             };
5963             $args = $self->_contract( 'identity.verification_session', $args ) || CORE::return( $self->pass_error );
5964             my $err = $self->_check_parameters( $okParams, $args );
5965             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
5966             my $hash = $self->post( "", $args ) || CORE::return( $self->pass_error );
5967             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Identity::VerificationSession', $hash ) );
5968             }
5969             PERL
5970             # NOTE: identity_verification_session_list()
5971             identity_verification_session_list => <<'PERL',
5972             sub identity_verification_session_list
5973             {
5974             my $self = shift( @_ );
5975             CORE::return( $self->error( "No parameters were provided to list identity verification session information." ) ) if( !scalar( @_ ) );
5976             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Identity::VerificationSession', @_ );
5977             my $okParams =
5978             {
5979             expandable => { allowed => $EXPANDABLES->{ 'identity.verification_session' }, data_prefix_is_ok => 1 },
5980             created => { type => "timestamp" },
5981             ending_before => { type => "string" },
5982             limit => { type => "string" },
5983             starting_after => { type => "string" },
5984             status => { type => "string" },
5985             };
5986             my $err = $self->_check_parameters( $okParams, $args );
5987             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
5988             if( $args->{expand} )
5989             {
5990             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
5991             }
5992             my $hash = $self->get( "", $args ) || CORE::return( $self->pass_error );
5993             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Identity::VerificationSession', $hash ) );
5994             }
5995             PERL
5996             # NOTE: identity_verification_session_redact()
5997             identity_verification_session_redact => <<'PERL',
5998             sub identity_verification_session_redact
5999             {
6000             my $self = shift( @_ );
6001             my $args = shift( @_ );
6002             my $okParams =
6003             {
6004             expandable => { allowed => $EXPANDABLES->{ 'identity.verification_session' } },
6005             };
6006             $args = $self->_contract( 'identity.verification_session', $args ) || CORE::return( $self->pass_error );
6007             my $err = $self->_check_parameters( $okParams, $args );
6008             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
6009             my $hash = $self->post( "", $args ) || CORE::return( $self->pass_error );
6010             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Identity::VerificationSession', $hash ) );
6011             }
6012             PERL
6013             # NOTE: identity_verification_session_retrieve()
6014             identity_verification_session_retrieve => <<'PERL',
6015             sub identity_verification_session_retrieve
6016             {
6017             my $self = shift( @_ );
6018             my $args = shift( @_ );
6019             my $okParams =
6020             {
6021             expandable => { allowed => $EXPANDABLES->{ 'identity.verification_session' }, data_prefix_is_ok => 1 },
6022             };
6023             $args = $self->_contract( 'identity.verification_session', $args ) || CORE::return( $self->pass_error );
6024             my $err = $self->_check_parameters( $okParams, $args );
6025             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
6026             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No identity.verification_session id (with parameter 'id') was provided to retrieve its information." ) );
6027             my $hash = $self->get( "identity/verification_sessions/${id}", $args ) || CORE::return( $self->pass_error );
6028             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Identity::VerificationSession', $hash ) );
6029             }
6030             PERL
6031             # NOTE: identity_verification_session_update()
6032             identity_verification_session_update => <<'PERL',
6033             sub identity_verification_session_update
6034             {
6035             my $self = shift( @_ );
6036             my $args = shift( @_ );
6037             my $okParams =
6038             {
6039             expandable => { allowed => $EXPANDABLES->{ 'identity.verification_session' } },
6040             metadata => { type => "hash" },
6041             options => { type => "hash" },
6042             type => { type => "string" },
6043             };
6044             $args = $self->_contract( 'identity.verification_session', $args ) || CORE::return( $self->pass_error );
6045             my $err = $self->_check_parameters( $okParams, $args );
6046             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
6047             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No identity.verification_session id (with parameter 'id') was provided to update its information." ) );
6048             my $hash = $self->post( "identity/verification_sessions/${id}", $args ) || CORE::return( $self->pass_error );
6049             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Identity::VerificationSession', $hash ) );
6050             }
6051             PERL
6052             # NOTE: identity_verification_sessions()
6053             identity_verification_sessions => <<'PERL',
6054             # <https://stripe.com/docs/api/identity/verification_sessions>
6055             sub identity_verification_sessions
6056             {
6057             my $self = shift( @_ );
6058             my $allowed = [qw( cancel create list redact retrieve update )];
6059             my $action = shift( @_ );
6060             my $meth = $self->_get_method( 'identity_verification_session', $action, $allowed ) || CORE::return( $self->pass_error );
6061             CORE::return( $self->$meth( @_ ) );
6062             }
6063             PERL
6064             # NOTE: invoice()
6065             invoice => <<'PERL',
6066             sub invoice { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Billing::Invoice', @_ ) ); }
6067             PERL
6068             # NOTE: invoice_create()
6069             invoice_create => <<'PERL',
6070             sub invoice_create
6071             {
6072             my $self = shift( @_ );
6073             CORE::return( $self->error( "No parameters were provided to create an invoice" ) ) if( !scalar( @_ ) );
6074             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Billing::Invoice', @_ );
6075             my $obj = $args->{_object};
6076             # If we are provided with an invoice object, we change our value for only its id
6077             if( ( $obj && $obj->customer ) ||
6078             ( $self->_is_object( $args->{customer} ) && $args->{customer}->isa( 'Net::API::Stripe::Customer' ) ) )
6079             {
6080             my $cust = $obj ? $obj->customer : $args->{customer};
6081             $args->{customer} = $cust->id || CORE::return( $self->error( "The Customer object provided for this invoice has no id." ) );
6082             }
6083            
6084             if( ( $obj && $obj->subscription ) ||
6085             ( $args->{subscription} && $self->_is_object( $args->{subscription} ) && $args->{subscription}->isa( 'Net::API::Stripe::Billing::Subscription' ) ) )
6086             {
6087             my $sub = $obj ? $obj->subscription : $args->{subscription};
6088             $args->{subscription} = $sub->id || CORE::return( $self->error( "The Subscription object provided for this invoice has no id." ) );
6089             }
6090            
6091             my $okParams =
6092             {
6093             expandable => { allowed => $EXPANDABLES->{invoice} },
6094             account_tax_ids => { type => "array" },
6095             application_fee_amount => { re => qr/^\d+$/, type => "integer" },
6096             auto_advance => { type => "boolean" },
6097             automatic_tax => { fields => ["enabled"], type => "hash" },
6098             collection_method => { re => qr/^(charge_automatically|send_invoice)$/, type => "string" },
6099             currency => { type => "currency" },
6100             custom_fields => { fields => ["name", "value"], type => "array" },
6101             customer => { re => qr/^\w+$/, type => "string" },
6102             days_until_due => { re => qr/^\d+$/, type => "integer" },
6103             default_payment_method => { re => qr/^\w+$/, type => "string" },
6104             default_source => { re => qr/^\w+$/, type => "string" },
6105             default_tax_rates => { re => qr/^\d+(?:\.\d+)?$/, type => "array" },
6106             description => { type => "string" },
6107             discounts => { fields => ["coupon", "discount"], type => "array" },
6108             due_date => { type => "timestamp" },
6109             footer => { type => "string" },
6110             metadata => { type => "hash" },
6111             on_behalf_of => { re => qr/^\w+$/, type => "string" },
6112             payment_settings => {
6113             fields => [
6114             "payment_method_options.acss_debit",
6115             "payment_method_options.acss_debit.mandate_options",
6116             "payment_method_options.acss_debit.mandate_options.transaction_type",
6117             "payment_method_options.acss_debit.verification_method",
6118             "payment_method_options.bancontact",
6119             "payment_method_options.bancontact.preferred_language",
6120             "payment_method_options.card",
6121             "payment_method_options.card.request_three_d_secure",
6122             "payment_method_options.customer_balance",
6123             "payment_method_options.customer_balance.bank_transfer",
6124             "payment_method_options.customer_balance.bank_transfer.eu_bank_transfer",
6125             "payment_method_options.customer_balance.bank_transfer.eu_bank_transfer.country",
6126             "payment_method_options.customer_balance.bank_transfer.type",
6127             "payment_method_options.customer_balance.funding_type",
6128             "payment_method_options.konbini",
6129             "payment_method_options.us_bank_account",
6130             "payment_method_options.us_bank_account.financial_connections",
6131             "payment_method_options.us_bank_account.financial_connections.permissions",
6132             "payment_method_options.us_bank_account.verification_method",
6133             "payment_method_types",
6134             ],
6135             type => "hash",
6136             },
6137             pending_invoice_items_behavior => { type => "string" },
6138             rendering_options => { fields => ["amount_tax_display"], type => "hash" },
6139             statement_descriptor => { type => "string" },
6140             subscription => { re => qr/^\w+$/, type => "string" },
6141             tax_percent => { re => qr/^\d+(?:\.\d+)?$/ },
6142             transfer_data => { fields => ["destination", "amount"], type => "hash" },
6143             };
6144              
6145             $args = $self->_contract( 'invoice', $args ) || CORE::return( $self->pass_error );
6146             my $err = $self->_check_parameters( $okParams, $args );
6147             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
6148             my $hash = $self->post( 'invoices', $args ) || CORE::return( $self->pass_error );
6149             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::Invoice', $hash ) );
6150             }
6151             PERL
6152             # NOTE: invoice_delete()
6153             invoice_delete => <<'PERL',
6154             # NOTE: Delete a draft invoice
6155             sub invoice_delete
6156             {
6157             my $self = shift( @_ );
6158             CORE::return( $self->error( "No parameters were provided to delete a draft invoice." ) ) if( !scalar( @_ ) );
6159             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Billing::Invoice', @_ );
6160             my $okParams =
6161             {
6162             expandable => { allowed => $EXPANDABLES->{invoice} },
6163             id => { re => qr/^\w+$/, required => 1 }
6164             };
6165             my $err = $self->_check_parameters( $okParams, $args );
6166             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
6167             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No draft invoice id was provided to delete its information." ) );
6168             my $hash = $self->delete( "invoices/${id}", $args ) || CORE::return( $self->pass_error );
6169             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::Invoice', $hash ) );
6170             }
6171             PERL
6172             # NOTE: invoice_finalise()
6173             invoice_finalise => <<'PERL',
6174             sub invoice_finalise
6175             {
6176             my $self = shift( @_ );
6177             CORE::return( $self->error( "No parameters were provided to pay invoice." ) ) if( !scalar( @_ ) );
6178             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Billing::Invoice', @_ );
6179             my $okParams =
6180             {
6181             expandable => { allowed => $EXPANDABLES->{invoice} },
6182             id => { re => qr/^\w+$/, required => 1 },
6183             auto_advance => {},
6184             };
6185             $args = $self->_contract( 'invoice', $args ) || CORE::return( $self->pass_error );
6186             my $err = $self->_check_parameters( $okParams, $args );
6187             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
6188             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No invoice id was provided to pay it." ) );
6189             my $hash = $self->post( "invoices/${id}/finalize", $args ) || CORE::return( $self->pass_error );
6190             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::Invoice', $hash ) );
6191             }
6192             PERL
6193             # NOTE: invoice_finalize()
6194             invoice_finalize => <<'PERL',
6195             sub invoice_finalize
6196             {
6197             my $self = shift( @_ );
6198             my $args = shift( @_ );
6199             my $okParams =
6200             {
6201             expandable => { allowed => $EXPANDABLES->{ 'invoice' } },
6202             auto_advance => { type => "boolean" },
6203             };
6204             $args = $self->_contract( 'invoice', $args ) || CORE::return( $self->pass_error );
6205             my $err = $self->_check_parameters( $okParams, $args );
6206             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
6207             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No invoice id (with parameter 'id') was provided to finalize its information." ) );
6208             my $hash = $self->post( "invoices/${id}", $args ) || CORE::return( $self->pass_error );
6209             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::Invoice', $hash ) );
6210             }
6211             PERL
6212             # NOTE: invoice_item()
6213             invoice_item => <<'PERL',
6214             # Make everyone happy, British English and American English
6215             sub invoice_item { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Billing::Invoice::Item', @_ ) ); }
6216             PERL
6217             # NOTE: invoice_item_create()
6218             invoice_item_create => <<'PERL',
6219             sub invoice_item_create
6220             {
6221             my $self = shift( @_ );
6222             CORE::return( $self->error( "No parameters were provided to create an invoice item" ) ) if( !scalar( @_ ) );
6223             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Billing::Invoice::Item', @_ );
6224             my $okParams =
6225             {
6226             expandable => { allowed => $EXPANDABLES->{invoiceitem} },
6227             customer => { re => qr/^\w+$/, required => 1 },
6228             amount => { type => 'integer' },
6229             currency => { type => 'string' },
6230             description => {},
6231             metadata => { type => 'hash' },
6232             period => { fields => [qw( end! start! )] },
6233             price => { re => qr/^\w+$/ },
6234             discountable => { type => 'boolean' },
6235             discounts => { type => 'array', fields => [qw( coupon discount )] },
6236             invoice => { re => qr/^\w+$/ },
6237             price_data => { fields => [qw(
6238             currency!
6239             product!
6240             unit_amount_decimal!
6241             tax_behavior
6242             unit_amount
6243             )] },
6244             quantity => { type => 'integer' },
6245             subscription => { re => qr/^\w+$/ },
6246             tax_rates => { type => 'array' },
6247             unit_amount => { type => 'integer' },
6248             unit_amount_decimal => { type => 'decimal' },
6249             };
6250             $args = $self->_contract( 'invoiceitem', $args ) || CORE::return( $self->pass_error );
6251             my $err = $self->_check_parameters( $okParams, $args );
6252             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
6253             my $hash = $self->post( 'invoiceitems', $args ) || CORE::return( $self->pass_error );
6254             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::Invoice::Item', $hash ) );
6255             }
6256             PERL
6257             # NOTE: invoice_item_delete()
6258             invoice_item_delete => <<'PERL',
6259             sub invoice_item_delete
6260             {
6261             my $self = shift( @_ );
6262             CORE::return( $self->error( "No parameters were provided to delete an invoice item information." ) ) if( !scalar( @_ ) );
6263             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Billing::Invoice::Item', @_ );
6264             my $okParams =
6265             {
6266             expandable => { allowed => $EXPANDABLES->{invoiceitem} },
6267             id => { re => qr/^\w+$/, required => 1 }
6268             };
6269             my $err = $self->_check_parameters( $okParams, $args );
6270             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
6271             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No invoice item id was provided to delete its information." ) );
6272             my $hash = $self->delete( "invoiceitems/${id}", $args ) || CORE::return( $self->pass_error );
6273             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::Invoice::Item', $hash ) );
6274             }
6275             PERL
6276             # NOTE: invoice_item_list()
6277             invoice_item_list => <<'PERL',
6278             sub invoice_item_list
6279             {
6280             my $self = shift( @_ );
6281             my $args = $self->_get_args( @_ );
6282             my $okParams =
6283             {
6284             expandable => { allowed => $EXPANDABLES->{invoiceitem} },
6285             created => { re => qr/^\d+$/ },
6286             'created.gt' => { re => qr/^\d+$/ },
6287             'created.gte' => { re => qr/^\d+$/ },
6288             'created.lt' => { re => qr/^\d+$/ },
6289             'created.lte' => { re => qr/^\d+$/ },
6290             invoice => { re => qr/^\w+$/ },
6291             ending_before => {},
6292             limit => { re => qr/^\d+$/ },
6293             pending => { type => 'boolean' },
6294             starting_after => {},
6295             };
6296             my $err = $self->_check_parameters( $okParams, $args );
6297             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
6298             if( $args->{expand} )
6299             {
6300             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
6301             }
6302             my $hash = $self->get( 'invoiceitems', $args ) || CORE::return( $self->pass_error );
6303             CORE::return( $self->_response_to_object( 'Net::API::Stripe::List', $hash ) );
6304             }
6305             PERL
6306             # NOTE: invoice_item_retrieve()
6307             invoice_item_retrieve => <<'PERL',
6308             sub invoice_item_retrieve
6309             {
6310             my $self = shift( @_ );
6311             CORE::return( $self->error( "No parameters were provided to retrieve invoice item information." ) ) if( !scalar( @_ ) );
6312             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Billing::Invoice::Item', @_ );
6313             my $okParams =
6314             {
6315             expandable => { allowed => $EXPANDABLES->{invoiceitem} },
6316             id => { re => qr/^\w+$/, required => 1 }
6317             };
6318             my $err = $self->_check_parameters( $okParams, $args );
6319             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
6320             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No invoice item id was provided to retrieve its information." ) );
6321             my $hash = $self->get( "invoiceitems/${id}", $args ) || CORE::return( $self->pass_error );
6322             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::Invoice::Item', $hash ) );
6323             }
6324             PERL
6325             # NOTE: invoice_item_update()
6326             invoice_item_update => <<'PERL',
6327             sub invoice_item_update
6328             {
6329             my $self = shift( @_ );
6330             CORE::return( $self->error( "No parameters were provided to update an invoice item." ) ) if( !scalar( @_ ) );
6331             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Billing::Invoice::Item', @_ );
6332             my $okParams =
6333             {
6334             expandable => { allowed => $EXPANDABLES->{invoiceitem} },
6335             id => { re => qr/^\w+$/, required => 1 },
6336             amount => { type => 'integer' },
6337             description => {},
6338             metadata => { type => 'hash' },
6339             period => { fields => [qw( end! start! )] },
6340             price => { re => qr/^\w+$/ },
6341             discountable => { type => 'boolean' },
6342             discounts => { type => 'array', fields => [qw( coupon discount )] },
6343             price_data => { fields => [qw(
6344             currency!
6345             product!
6346             unit_amount_decimal!
6347             tax_behavior
6348             unit_amount
6349             )] },
6350             quantity => { type => 'integer' },
6351             tax_rates => { type => 'array' },
6352             unit_amount => { type => 'integer' },
6353             unit_amount_decimal => { type => 'decimal' },
6354             };
6355             $args = $self->_contract( 'invoiceitem', $args ) || CORE::return( $self->pass_error );
6356             # We found some errors
6357             my $err = $self->_check_parameters( $okParams, $args );
6358             # $self->message( 3, "Data to be posted: ", $self->dumper( $args ) ); exit;
6359             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
6360             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No product id was provided to update product's details" ) );
6361             my $hash = $self->post( "invoiceitems/${id}", $args ) || CORE::return( $self->pass_error );
6362             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::Invoice::Item', $hash ) );
6363             }
6364             PERL
6365             # NOTE: invoice_items()
6366             invoice_items => <<'PERL',
6367             sub invoice_items
6368             {
6369             my $self = shift( @_ );
6370             my $action = shift( @_ );
6371             my $allowed = [qw( create retrieve update list delete )];
6372             my $meth = $self->_get_method( 'invoice_item', $action, $allowed ) || CORE::return( $self->pass_error );
6373             CORE::return( $self->$meth( @_ ) );
6374             }
6375             PERL
6376             # NOTE: invoice_line_item()
6377             invoice_line_item => <<'PERL',
6378             sub invoice_line_item { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Billing::Invoice::LineItem', @_ ) ); }
6379             PERL
6380             # NOTE: invoice_lines()
6381             invoice_lines => <<'PERL',
6382             sub invoice_lines
6383             {
6384             my $self = shift( @_ );
6385             CORE::return( $self->error( "No parameters were provided to get the invoice line items." ) ) if( !scalar( @_ ) );
6386             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Billing::Invoice', @_ );
6387             # There are no expandable properties as of 2020-02-14
6388             my $okParams =
6389             {
6390             id => { re => qr/^\w+$/, required => 1 },
6391             # "A cursor for use in pagination. ending_before is an object ID that defines your place in the list."
6392             ending_before => { re => qr/^\w+$/ },
6393             limit => { re => qr/^\d+$/ },
6394             starting_after => { re => qr/^\w+$/ },
6395             };
6396             my $err = $self->_check_parameters( $okParams, $args );
6397             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
6398             my $id = CORE::delete( $args->{id} );
6399             if( $args->{expand} )
6400             {
6401             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
6402             }
6403             my $hash = $self->get( "invoices/${id}/lines", $args ) || CORE::return( $self->pass_error );
6404             CORE::return( $self->_response_to_object( 'Net::API::Stripe::List', $hash ) );
6405             }
6406             PERL
6407             # NOTE: invoice_lines_upcoming()
6408             invoice_lines_upcoming => <<'PERL',
6409             # NOTE: Retrieve an upcoming invoice's line items
6410             sub invoice_lines_upcoming
6411             {
6412             my $self = shift( @_ );
6413             CORE::return( $self->error( "No parameters were provided to get the incoming invoice line items." ) ) if( !scalar( @_ ) );
6414             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Billing::Invoice', @_ );
6415             # If any
6416             my $obj = $args->{_object};
6417             if( ( $obj && $obj->customer ) ||
6418             ( $self->_is_object( $args->{customer} ) && $args->{customer}->isa( 'Net::API::Stripe::Customer' ) ) )
6419             {
6420             my $cust = $obj ? $obj-customer : $args->{customer};
6421             $args->{customer} = $cust->id || CORE::return( $self->error( "No customer id could be found in this customer object." ) );
6422             }
6423            
6424             if( ( $obj && $obj->schedule && $obj->schedule->id ) ||
6425             ( $args->{schedule} && $self->_is_object( $args->{schedule} ) && $args->{schedule}->isa( 'Net::API::Stripe::Billing::Subscription::Schedule' ) ) )
6426             {
6427             my $sched = $obj ? $obj->schedule : $args->{schedule};
6428             $args->{schedule} = $sched->id || CORE::return( $self->error( "No subscription schedule id could be found in this subscription schedule object." ) );
6429             }
6430            
6431             if( ( $obj && $obj->subscription && $obj->subscription->id ) ||
6432             ( $args->{subscription} && $self->_is_object( $args->{subscription} ) && $args->{subscription}->isa( 'Net::API::Stripe::Billing::Subscription' ) ) )
6433             {
6434             my $sub = $obj ? $obj->subscription : $args->{subscription};
6435             $args->{subscription} = $sub->id || CORE::return( $self->error( "No subscription id could be found in this subscription object." ) );
6436             }
6437            
6438             my $okParams =
6439             {
6440             customer => { re => qr/^\w+$/ },
6441             coupon => {},
6442             ending_before => { re => qr/^\w+$/ },
6443             invoice_items => { type => 'array', fields => [qw( amount currency description discountable invoiceitem metadata period.end period.start quantity tax_rates unit_amount unit_amount_decimal )] },
6444             limit => { re => qr/^\d+$/ },
6445             schedule => { re => qr/^\w+$/ },
6446             starting_after => { re => qr/^\w+$/ },
6447             subscription => { re => qr/^\w+$/ },
6448             # A timestamp
6449             subscription_billing_cycle_anchor => {},
6450             # A timestamp
6451             subscription_cancel_at => {},
6452             # Boolean
6453             subscription_cancel_at_period_end => {},
6454             # "This simulates the subscription being canceled or expired immediately."
6455             subscription_cancel_now => {},
6456             subscription_default_tax_rates => { type => 'array' },
6457             subscription_items => {},
6458             subscription_prorate => { re => qr/^(subscription_items|subscription|subscription_items|subscription_trial_end)$/ },
6459             subscription_proration_behavior => { re => qr/^(create_prorations|none|always_invoice)$/ },
6460             # Timestamp
6461             subscription_proration_date => {},
6462             # Timestamp
6463             subscription_start_date => {},
6464             subscription_tax_percent=> { re => qr/^\d+(\.\d+)?$/ },
6465             subscription_trial_end => {},
6466             subscription_trial_from_plan => {},
6467             };
6468             my $err = $self->_check_parameters( $okParams, $args );
6469             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
6470             if( $args->{expand} )
6471             {
6472             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
6473             }
6474             my $hash = $self->get( 'invoices/upcoming/lines', $args ) || CORE::return( $self->pass_error );
6475             CORE::return( $self->_response_to_object( 'Net::API::Stripe::List', $hash ) );
6476             }
6477             PERL
6478             # NOTE: invoice_list()
6479             invoice_list => <<'PERL',
6480             sub invoice_list
6481             {
6482             my $self = shift( @_ );
6483             my $args = $self->_get_args( @_ );
6484             if( $self->_is_object( $args->{customer} ) && $args->{customer}->isa( 'Net::API::Stripe::Customer' ) )
6485             {
6486             $args->{customer} = $args->{customer}->id || CORE::return( $self->error( "No customer id could be found in this customer object." ) );
6487             }
6488            
6489             if( $args->{subscription} && $self->_is_object( $args->{subscription} ) && $args->{subscription}->isa( 'Net::API::Stripe::Billing::Subscription' ) )
6490             {
6491             $args->{subscription} = $args->{subscription}->id || CORE::return( $self->error( "No subscription id could be found in this subscription object." ) );
6492             }
6493            
6494             my $okParams =
6495             {
6496             expandable => { allowed => $EXPANDABLES->{invoice}, data_prefix_is_ok => 1 },
6497             collection_method => { re => qr/^(charge_automatically|send_invoice)$/, type => "string" },
6498             created => { re => qr/^\d+$/, type => "timestamp" },
6499             'created.gt' => { re => qr/^\d+$/ },
6500             'created.gte' => { re => qr/^\d+$/ },
6501             'created.lt' => { re => qr/^\d+$/ },
6502             'created.lte' => { re => qr/^\d+$/ },
6503             customer => { re => qr/^\w+$/, type => "string" },
6504             due_date => { type => "timestamp" },
6505             'due_date.gt' => { re => qr/^\d+$/ },
6506             'due_date.gte' => { re => qr/^\d+$/ },
6507             'due_date.lt' => { re => qr/^\d+$/ },
6508             'due_date.lte' => { re => qr/^\d+$/ },
6509             ending_before => { re => qr/^\w+$/, type => "string" },
6510             limit => { re => qr/^\d+$/, type => "string" },
6511             starting_after => { re => qr/^\w+$/, type => "string" },
6512             status => { re => qr/^(draft|open|paid|uncollectible|void)$/, type => "string" },
6513             subscription => { re => qr/^\w+$/, type => "string" },
6514             };
6515              
6516             my $err = $self->_check_parameters( $okParams, $args );
6517             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
6518             if( $args->{expand} )
6519             {
6520             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
6521             }
6522             my $hash = $self->get( 'invoices', $args ) || CORE::return( $self->pass_error );
6523             CORE::return( $self->_response_to_object( 'Net::API::Stripe::List', $hash ) );
6524             }
6525             PERL
6526             # NOTE: invoice_pay()
6527             invoice_pay => <<'PERL',
6528             sub invoice_pay
6529             {
6530             my $self = shift( @_ );
6531             CORE::return( $self->error( "No parameters were provided to pay invoice." ) ) if( !scalar( @_ ) );
6532             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Billing::Invoice', @_ );
6533             my $obj = $args->{_object};
6534             if( ( $obj && $obj->payment_method ) ||
6535             ( $args->{payment_method} && $self->_is_object( $args->{payment_method} ) && $args->{payment_method}->isa( 'Net::API::Stripe::Payment::Method' ) ) )
6536             {
6537             my $pm = $obj ? $obj->payment_method : $args->{payment_method};
6538             $args->{payment_method} = $pm->id || CORE::return( $self->error( "No payment method id could be found in this payment method object." ) );
6539             }
6540            
6541             if( ( $obj && $obj->source ) ||
6542             ( $args->{source} && $self->_is_object( $args->{source} ) && $args->{source}->isa( 'Net::API::Stripe::Payment::Source' ) ) )
6543             {
6544             my $src = $obj ? $obj->source : $args->{source};
6545             $args->{source} = $src->id || CORE::return( $self->error( "No payment source id could be found in this payment source object." ) );
6546             }
6547             my $okParams =
6548             {
6549             expandable => { allowed => $EXPANDABLES->{invoice} },
6550             forgive => { type => "boolean" },
6551             id => { re => qr/^\w+$/, required => 1 },
6552             mandate => { type => "string" },
6553             off_session => { type => "boolean" },
6554             paid_out_of_band => { type => "boolean" },
6555             payment_method => { re => qr/^\w+$/, type => "string" },
6556             source => { re => qr/^\w+$/, type => "string" },
6557             };
6558              
6559             $args = $self->_contract( 'invoice', $args ) || CORE::return( $self->pass_error );
6560             my $err = $self->_check_parameters( $okParams, $args );
6561             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
6562             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No invoice id was provided to pay it." ) );
6563             my $hash = $self->post( "invoices/${id}/pay", $args ) || CORE::return( $self->pass_error );
6564             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::Invoice', $hash ) );
6565             }
6566             PERL
6567             # NOTE: invoice_retrieve()
6568             invoice_retrieve => <<'PERL',
6569             sub invoice_retrieve
6570             {
6571             my $self = shift( @_ );
6572             CORE::return( $self->error( "No parameters were provided to retrieve invoice information." ) ) if( !scalar( @_ ) );
6573             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Billing::Invoice', @_ );
6574             my $okParams =
6575             {
6576             expandable => { allowed => $EXPANDABLES->{invoice} },
6577             id => { re => qr/^\w+$/, required => 1 }
6578             };
6579             my $err = $self->_check_parameters( $okParams, $args );
6580             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
6581             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No invoice id was provided to retrieve its information." ) );
6582             my $hash = $self->get( "invoices/${id}", $args ) || CORE::return( $self->pass_error );
6583             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::Invoice', $hash ) );
6584             }
6585             PERL
6586             # NOTE: invoice_search()
6587             invoice_search => <<'PERL',
6588             sub invoice_search
6589             {
6590             my $self = shift( @_ );
6591             CORE::return( $self->error( "No parameters were provided to search for an invoice information." ) ) if( !scalar( @_ ) );
6592             my $args = shift( @_ );
6593             my $okParams =
6594             {
6595             expandable => { allowed => $EXPANDABLES->{invoice}, data_prefix_is_ok => 1 },
6596             limit => qr/^\d+$/,
6597             page => qr/^\d+$/,
6598             query => { re => qr/^.*?$/, required => 1, type => "string" },
6599             };
6600              
6601             my $err = $self->_check_parameters( $okParams, $args );
6602             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
6603             if( $args->{expand} )
6604             {
6605             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
6606             }
6607             my $hash = $self->get( "invoices/search", $args ) || CORE::return( $self->pass_error );
6608             CORE::return( $self->_response_to_object( 'Net::API::Stripe::List', $hash ) );
6609             }
6610             PERL
6611             # NOTE: invoice_send()
6612             invoice_send => <<'PERL',
6613             # NOTE: Send an invoice for manual payment
6614             sub invoice_send
6615             {
6616             my $self = shift( @_ );
6617             CORE::return( $self->error( "No parameters were provided to send invoice." ) ) if( !scalar( @_ ) );
6618             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Billing::Invoice', @_ );
6619             my $okParams =
6620             {
6621             expandable => { allowed => $EXPANDABLES->{invoice} },
6622             id => { re => qr/^\w+$/, required => 1 },
6623             };
6624             $args = $self->_contract( 'invoice', $args ) || CORE::return( $self->pass_error );
6625             my $err = $self->_check_parameters( $okParams, $args );
6626             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
6627             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No invoice id was provided to send it." ) );
6628             my $hash = $self->post( "invoices/${id}/send", $args ) || CORE::return( $self->pass_error );
6629             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::Invoice', $hash ) );
6630             }
6631             PERL
6632             # NOTE: invoice_settings()
6633             invoice_settings => <<'PERL',
6634             sub invoice_settings { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Billing::Invoice::Settings', @_ ) ); }
6635             PERL
6636             # NOTE: invoice_uncollectible()
6637             invoice_uncollectible => <<'PERL',
6638             sub invoice_uncollectible
6639             {
6640             my $self = shift( @_ );
6641             my $args = shift( @_ );
6642             my $okParams =
6643             {
6644             expandable => { allowed => $EXPANDABLES->{ 'invoice' } },
6645             };
6646             $args = $self->_contract( 'invoice', $args ) || CORE::return( $self->pass_error );
6647             my $err = $self->_check_parameters( $okParams, $args );
6648             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
6649             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No invoice id (with parameter 'id') was provided to uncollectible its information." ) );
6650             my $hash = $self->post( "invoices/${id}", $args ) || CORE::return( $self->pass_error );
6651             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::Invoice', $hash ) );
6652             }
6653             PERL
6654             # NOTE: invoice_upcoming()
6655             invoice_upcoming => <<'PERL',
6656             sub invoice_upcoming
6657             {
6658             my $self = shift( @_ );
6659             CORE::return( $self->error( "No parameters were provided to retrieve an upcoming invoice." ) ) if( !scalar( @_ ) );
6660             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Billing::Invoice', @_ );
6661            
6662             my $obj = $args->{_object};
6663             if( ( $obj && $obj->customer ) ||
6664             ( $self->_is_object( $args->{customer} ) && $args->{customer}->isa( 'Net::API::Stripe::Customer' ) ) )
6665             {
6666             my $cust = $obj ? $obj->customer : $args->{customer};
6667             $args->{customer} = $cust->id || CORE::return( $self->error( "No customer id could be found in this customer object." ) );
6668             }
6669            
6670             if( ( $obj && $obj->schedule ) ||
6671             ( $args->{schedule} && $self->_is_object( $args->{schedule} ) && $args->{schedule}->isa( 'Net::API::Stripe::Billing::Subscription::Schedule' ) ) )
6672             {
6673             my $sched = $obj ? $obj->schedule : $args->{schedule};
6674             $args->{schedule} = $sched->id || CORE::return( $self->error( "No subscription schedule id could be found in this subscription schedule object." ) );
6675             }
6676            
6677             if( ( $obj && $obj->subscription ) ||
6678             ( $args->{subscription} && $self->_is_object( $args->{subscription} ) && $args->{subscription}->isa( 'Net::API::Stripe::Billing::Subscription' ) ) )
6679             {
6680             my $sub = $obj ? $obj->subscription : $args->{subscription};
6681             $args->{subscription} = $sub->id || CORE::return( $self->error( "No subscription id could be found in this subscription object." ) );
6682             }
6683            
6684             my $okParams =
6685             {
6686             expandable => { allowed => $EXPANDABLES->{invoice}, data_prefix_is_ok => 1 },
6687             automatic_tax => { type => "boolean" },
6688             coupon => { type => "string" },
6689             currency => { type => "currency" },
6690             customer => { re => qr/^\w+$/, type => "string" },
6691             customer_details => {
6692             fields => [
6693             "address",
6694             "address.city",
6695             "address.country",
6696             "address.line1",
6697             "address.line2",
6698             "address.postal_code",
6699             "address.state",
6700             "shipping",
6701             "shipping.address",
6702             "shipping.address.city",
6703             "shipping.address.country",
6704             "shipping.address.line1",
6705             "shipping.address.line2",
6706             "shipping.address.postal_code",
6707             "shipping.address.state",
6708             "shipping.name",
6709             "shipping.phone",
6710             "tax",
6711             "tax.ip_address",
6712             "tax_exempt",
6713             "tax_ids",
6714             "tax_ids.type",
6715             "tax_ids.value",
6716             ],
6717             type => "hash",
6718             },
6719             discounts => { fields => ["coupon", "discount"], type => "array" },
6720             invoice_items => {
6721             fields => [
6722             "amount",
6723             "currency",
6724             "description",
6725             "discountable",
6726             "discounts",
6727             "discounts.coupon",
6728             "discounts.discount",
6729             "invoiceitem",
6730             "metadata",
6731             "period.end!",
6732             "period.start!",
6733             "quantity",
6734             "tax_rates",
6735             "unit_amount",
6736             "unit_amount_decimal",
6737             ],
6738             type => "array",
6739             },
6740             schedule => { re => qr/^\w+$/, type => "string" },
6741             subscription => { re => qr/^\w+$/, type => "string" },
6742             subscription_billing_cycle_anchor => { type => "string" },
6743             subscription_cancel_at => { type => "string" },
6744             subscription_cancel_at_period_end => { type => "string" },
6745             subscription_cancel_now => { type => "string" },
6746             subscription_default_tax_rates => { type => "array" },
6747             subscription_items => { type => "string" },
6748             subscription_prorate => {
6749             re => qr/^(subscription_items|subscription|subscription_items|subscription_trial_end)$/,
6750             },
6751             subscription_proration_behavior => {
6752             re => qr/^(create_prorations|none|always_invoice)$/,
6753             type => "string",
6754             },
6755             subscription_proration_date => { type => "integer" },
6756             subscription_start_date => { type => "string" },
6757             subscription_tax_percent => { re => qr/^\d+(\.\d+)?$/ },
6758             subscription_trial_end => { type => "string" },
6759             subscription_trial_from_plan => { type => "string" },
6760             };
6761              
6762             $args = $self->_contract( 'invoice', $args ) || CORE::return( $self->pass_error );
6763             my $err = $self->_check_parameters( $okParams, $args );
6764             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
6765             my $hash = $self->post( 'invoices/upcoming', $args ) || CORE::return( $self->pass_error );
6766             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::Invoice', $hash ) );
6767             }
6768             PERL
6769             # NOTE: invoice_update()
6770             invoice_update => <<'PERL',
6771             sub invoice_update
6772             {
6773             my $self = shift( @_ );
6774             CORE::return( $self->error( "No parameters were provided to update an invoice" ) ) if( !scalar( @_ ) );
6775             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Billing::Invoice', @_ );
6776            
6777             my $okParams =
6778             {
6779             expandable => { allowed => $EXPANDABLES->{invoice} },
6780             account_tax_ids => { type => "array" },
6781             application_fee_amount => { re => qr/^\d+$/, type => "integer" },
6782             auto_advance => { type => "boolean" },
6783             automatic_tax => { fields => ["enabled"], type => "hash" },
6784             collection_method => { re => qr/^(charge_automatically|send_invoice)$/, type => "string" },
6785             custom_fields => { fields => ["name", "value"], type => "array" },
6786             days_until_due => { re => qr/^\d+$/, type => "integer" },
6787             default_payment_method => { re => qr/^\w+$/, type => "string" },
6788             default_source => { re => qr/^\w+$/, type => "string" },
6789             default_tax_rates => { re => qr/^\d+(?:\.\d+)?$/, type => "array" },
6790             description => { type => "string" },
6791             discounts => { fields => ["coupon", "discount"], type => "array" },
6792             due_date => { type => "timestamp" },
6793             footer => { type => "string" },
6794             id => { re => qr/^\w+$/, required => 1 },
6795             metadata => { type => "hash" },
6796             on_behalf_of => { re => qr/^\w+$/, type => "string" },
6797             payment_settings => {
6798             fields => [
6799             "payment_method_options.acss_debit",
6800             "payment_method_options.acss_debit.mandate_options",
6801             "payment_method_options.acss_debit.mandate_options.transaction_type",
6802             "payment_method_options.acss_debit.verification_method",
6803             "payment_method_options.bancontact",
6804             "payment_method_options.bancontact.preferred_language",
6805             "payment_method_options.card",
6806             "payment_method_options.card.request_three_d_secure",
6807             "payment_method_options.customer_balance",
6808             "payment_method_options.customer_balance.bank_transfer",
6809             "payment_method_options.customer_balance.bank_transfer.eu_bank_transfer",
6810             "payment_method_options.customer_balance.bank_transfer.eu_bank_transfer.country",
6811             "payment_method_options.customer_balance.bank_transfer.type",
6812             "payment_method_options.customer_balance.funding_type",
6813             "payment_method_options.konbini",
6814             "payment_method_options.us_bank_account",
6815             "payment_method_options.us_bank_account.financial_connections",
6816             "payment_method_options.us_bank_account.financial_connections.permissions",
6817             "payment_method_options.us_bank_account.verification_method",
6818             "payment_method_types",
6819             ],
6820             type => "hash",
6821             },
6822             rendering_options => { fields => ["amount_tax_display"], type => "hash" },
6823             statement_descriptor => { type => "string" },
6824             transfer_data => { fields => ["destination", "amount"], type => "hash" },
6825             };
6826              
6827             $args = $self->_contract( 'invoice', $args ) || CORE::return( $self->pass_error );
6828             # We found some errors
6829             my $err = $self->_check_parameters( $okParams, $args );
6830             # $self->message( 3, "Data to be posted: ", $self->dumper( $args ) ); exit;
6831             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
6832             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No invoice id was provided to update invoice's details" ) );
6833             my $hash = $self->post( "invoices/${id}", $args ) || CORE::return( $self->pass_error );
6834             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::Invoice', $hash ) );
6835             }
6836             PERL
6837             # NOTE: invoice_void()
6838             invoice_void => <<'PERL',
6839             sub invoice_void
6840             {
6841             my $self = shift( @_ );
6842             CORE::return( $self->error( "No parameters were provided to void invoice information." ) ) if( !scalar( @_ ) );
6843             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Billing::Invoice', @_ );
6844             my $okParams =
6845             {
6846             expandable => { allowed => $EXPANDABLES->{invoice} },
6847             id => { re => qr/^\w+$/, required => 1 }
6848             };
6849             my $err = $self->_check_parameters( $okParams, $args );
6850             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
6851             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No invoice id was provided to void it." ) );
6852             my $hash = $self->post( "invoices/${id}/void", $args ) || CORE::return( $self->pass_error );
6853             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::Invoice', $hash ) );
6854             }
6855             PERL
6856             # NOTE: invoice_write_off()
6857             invoice_write_off => <<'PERL',
6858             # NOTE: Mark an invoice as uncollectible
6859             sub invoice_write_off
6860             {
6861             my $self = shift( @_ );
6862             CORE::return( $self->error( "No parameters were provided to make invoice uncollectible." ) ) if( !scalar( @_ ) );
6863             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Billing::Invoice', @_ );
6864             my $okParams =
6865             {
6866             expandable => { allowed => $EXPANDABLES->{invoice} },
6867             id => { re => qr/^\w+$/, required => 1 }
6868             };
6869             my $err = $self->_check_parameters( $okParams, $args );
6870             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
6871             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No invoice id was provided to make it uncollectible." ) );
6872             my $hash = $self->post( "invoices/${id}/mark_uncollectible", $args ) || CORE::return( $self->pass_error );
6873             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::Invoice', $hash ) );
6874             }
6875             PERL
6876             # NOTE: invoiceitem()
6877             invoiceitem => <<'PERL',
6878             sub invoiceitem { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Billing::Invoice::Item', @_ ) ); }
6879             PERL
6880             # NOTE: invoiceitem_create()
6881             invoiceitem_create => <<'PERL',
6882             sub invoiceitem_create
6883             {
6884             my $self = shift( @_ );
6885             my $args = shift( @_ );
6886             my $okParams =
6887             {
6888             expandable => { allowed => $EXPANDABLES->{ 'invoiceitem' } },
6889             amount => { type => "integer" },
6890             currency => { type => "string" },
6891             customer => { type => "string", required => 1 },
6892             description => { type => "string" },
6893             discountable => { type => "boolean" },
6894             discounts => { type => "array" },
6895             invoice => { type => "string" },
6896             metadata => { type => "hash" },
6897             period => { type => "hash" },
6898             price => { type => "hash" },
6899             price_data => { type => "object" },
6900             quantity => { type => "integer" },
6901             subscription => { type => "string" },
6902             tax_rates => { type => "array" },
6903             unit_amount => { type => "integer" },
6904             unit_amount_decimal => { type => "decimal" },
6905             };
6906             $args = $self->_contract( 'invoiceitem', $args ) || CORE::return( $self->pass_error );
6907             my $err = $self->_check_parameters( $okParams, $args );
6908             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
6909             my $hash = $self->post( "invoiceitems", $args ) || CORE::return( $self->pass_error );
6910             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::Invoice::Item', $hash ) );
6911             }
6912             PERL
6913             # NOTE: invoiceitem_delete()
6914             invoiceitem_delete => <<'PERL',
6915             sub invoiceitem_delete
6916             {
6917             my $self = shift( @_ );
6918             my $args = shift( @_ );
6919             my $okParams =
6920             {
6921             expandable => { allowed => $EXPANDABLES->{ 'invoiceitem' } },
6922             };
6923             $args = $self->_contract( 'invoiceitem', $args ) || CORE::return( $self->pass_error );
6924             my $err = $self->_check_parameters( $okParams, $args );
6925             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
6926             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No invoiceitem id (with parameter 'id') was provided to delete its information." ) );
6927             my $hash = $self->delete( "invoiceitems/${id}", $args ) || CORE::return( $self->pass_error );
6928             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::Invoice::Item', $hash ) );
6929             }
6930             PERL
6931             # NOTE: invoiceitem_list()
6932             invoiceitem_list => <<'PERL',
6933             sub invoiceitem_list
6934             {
6935             my $self = shift( @_ );
6936             CORE::return( $self->error( "No parameters were provided to list invoiceitem information." ) ) if( !scalar( @_ ) );
6937             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Billing::Invoice::Item', @_ );
6938             my $okParams =
6939             {
6940             expandable => { allowed => $EXPANDABLES->{ 'invoiceitem' }, data_prefix_is_ok => 1 },
6941             created => { type => "hash" },
6942             customer => { type => "string" },
6943             ending_before => { type => "string" },
6944             invoice => { type => "string" },
6945             limit => { type => "string" },
6946             pending => { type => "string" },
6947             starting_after => { type => "string" },
6948             };
6949             my $err = $self->_check_parameters( $okParams, $args );
6950             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
6951             if( $args->{expand} )
6952             {
6953             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
6954             }
6955             my $hash = $self->get( "invoiceitems", $args ) || CORE::return( $self->pass_error );
6956             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::Invoice::Item', $hash ) );
6957             }
6958             PERL
6959             # NOTE: invoiceitem_retrieve()
6960             invoiceitem_retrieve => <<'PERL',
6961             sub invoiceitem_retrieve
6962             {
6963             my $self = shift( @_ );
6964             my $args = shift( @_ );
6965             my $okParams =
6966             {
6967             expandable => { allowed => $EXPANDABLES->{ 'invoiceitem' }, data_prefix_is_ok => 1 },
6968             };
6969             $args = $self->_contract( 'invoiceitem', $args ) || CORE::return( $self->pass_error );
6970             my $err = $self->_check_parameters( $okParams, $args );
6971             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
6972             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No invoiceitem id (with parameter 'id') was provided to retrieve its information." ) );
6973             my $hash = $self->get( "invoiceitems/${id}", $args ) || CORE::return( $self->pass_error );
6974             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::Invoice::Item', $hash ) );
6975             }
6976             PERL
6977             # NOTE: invoiceitem_update()
6978             invoiceitem_update => <<'PERL',
6979             sub invoiceitem_update
6980             {
6981             my $self = shift( @_ );
6982             my $args = shift( @_ );
6983             my $okParams =
6984             {
6985             expandable => { allowed => $EXPANDABLES->{ 'invoiceitem' } },
6986             amount => { type => "integer" },
6987             description => { type => "string" },
6988             discountable => { type => "boolean" },
6989             discounts => { type => "array" },
6990             metadata => { type => "hash" },
6991             period => { type => "hash" },
6992             price => { type => "hash" },
6993             price_data => { type => "object" },
6994             quantity => { type => "integer" },
6995             tax_rates => { type => "array" },
6996             unit_amount => { type => "integer" },
6997             unit_amount_decimal => { type => "decimal" },
6998             };
6999             $args = $self->_contract( 'invoiceitem', $args ) || CORE::return( $self->pass_error );
7000             my $err = $self->_check_parameters( $okParams, $args );
7001             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
7002             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No invoiceitem id (with parameter 'id') was provided to update its information." ) );
7003             my $hash = $self->post( "invoiceitems/${id}", $args ) || CORE::return( $self->pass_error );
7004             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::Invoice::Item', $hash ) );
7005             }
7006             PERL
7007             # NOTE: invoiceitems()
7008             invoiceitems => <<'PERL',
7009             # <https://stripe.com/docs/api/invoiceitems>
7010             sub invoiceitems
7011             {
7012             my $self = shift( @_ );
7013             my $allowed = [qw( create delete list retrieve update )];
7014             my $action = shift( @_ );
7015             my $meth = $self->_get_method( 'invoiceitem', $action, $allowed ) || CORE::return( $self->pass_error );
7016             CORE::return( $self->$meth( @_ ) );
7017             }
7018             PERL
7019             # NOTE: invoices()
7020             invoices => <<'PERL',
7021             # <https://stripe.com/docs/api/invoices>
7022             sub invoices
7023             {
7024             my $self = shift( @_ );
7025             my $allowed = [qw( create delete finalise finalize invoice_write_off lines lines_upcoming list pay retrieve search send uncollectible upcoming update void )];
7026             my $action = shift( @_ );
7027             my $meth = $self->_get_method( 'invoice', $action, $allowed ) || CORE::return( $self->pass_error );
7028             CORE::return( $self->$meth( @_ ) );
7029             }
7030             PERL
7031             # NOTE: ip_address_location()
7032             ip_address_location => <<'PERL',
7033             sub ip_address_location { CORE::return( shift->_response_to_object( 'Net::API::Stripe::GeoLocation', @_ ) ); }
7034             PERL
7035             # NOTE: issuing_authorization()
7036             issuing_authorization => <<'PERL',
7037             sub issuing_authorization { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Issuing::Authorization', @_ ) ); }
7038             PERL
7039             # NOTE: issuing_authorization_approve()
7040             issuing_authorization_approve => <<'PERL',
7041             sub issuing_authorization_approve
7042             {
7043             my $self = shift( @_ );
7044             my $args = shift( @_ );
7045             my $okParams =
7046             {
7047             expandable => { allowed => $EXPANDABLES->{ 'issuing.authorization' } },
7048             amount => { type => "integer" },
7049             metadata => { type => "hash" },
7050             };
7051             $args = $self->_contract( 'issuing.authorization', $args ) || CORE::return( $self->pass_error );
7052             my $err = $self->_check_parameters( $okParams, $args );
7053             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
7054             my $hash = $self->post( "", $args ) || CORE::return( $self->pass_error );
7055             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Issuing::Authorization', $hash ) );
7056             }
7057             PERL
7058             # NOTE: issuing_authorization_decline()
7059             issuing_authorization_decline => <<'PERL',
7060             sub issuing_authorization_decline
7061             {
7062             my $self = shift( @_ );
7063             my $args = shift( @_ );
7064             my $okParams =
7065             {
7066             expandable => { allowed => $EXPANDABLES->{ 'issuing.authorization' } },
7067             metadata => { type => "hash" },
7068             };
7069             $args = $self->_contract( 'issuing.authorization', $args ) || CORE::return( $self->pass_error );
7070             my $err = $self->_check_parameters( $okParams, $args );
7071             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
7072             my $hash = $self->post( "", $args ) || CORE::return( $self->pass_error );
7073             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Issuing::Authorization', $hash ) );
7074             }
7075             PERL
7076             # NOTE: issuing_authorization_list()
7077             issuing_authorization_list => <<'PERL',
7078             sub issuing_authorization_list
7079             {
7080             my $self = shift( @_ );
7081             CORE::return( $self->error( "No parameters were provided to list issuing authorization information." ) ) if( !scalar( @_ ) );
7082             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Issuing::Authorization', @_ );
7083             my $okParams =
7084             {
7085             expandable => { allowed => $EXPANDABLES->{ 'issuing.authorization' }, data_prefix_is_ok => 1 },
7086             card => { type => "hash" },
7087             cardholder => { type => "string" },
7088             created => { type => "timestamp" },
7089             ending_before => { type => "string" },
7090             limit => { type => "string" },
7091             starting_after => { type => "string" },
7092             status => { type => "string" },
7093             };
7094             my $err = $self->_check_parameters( $okParams, $args );
7095             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
7096             if( $args->{expand} )
7097             {
7098             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
7099             }
7100             my $hash = $self->get( "", $args ) || CORE::return( $self->pass_error );
7101             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Issuing::Authorization', $hash ) );
7102             }
7103             PERL
7104             # NOTE: issuing_authorization_retrieve()
7105             issuing_authorization_retrieve => <<'PERL',
7106             sub issuing_authorization_retrieve
7107             {
7108             my $self = shift( @_ );
7109             my $args = shift( @_ );
7110             my $okParams =
7111             {
7112             expandable => { allowed => $EXPANDABLES->{ 'issuing.authorization' }, data_prefix_is_ok => 1 },
7113             };
7114             $args = $self->_contract( 'issuing.authorization', $args ) || CORE::return( $self->pass_error );
7115             my $err = $self->_check_parameters( $okParams, $args );
7116             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
7117             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No issuing.authorization id (with parameter 'id') was provided to retrieve its information." ) );
7118             my $hash = $self->get( "issuing/authorizations/${id}", $args ) || CORE::return( $self->pass_error );
7119             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Issuing::Authorization', $hash ) );
7120             }
7121             PERL
7122             # NOTE: issuing_authorization_update()
7123             issuing_authorization_update => <<'PERL',
7124             sub issuing_authorization_update
7125             {
7126             my $self = shift( @_ );
7127             my $args = shift( @_ );
7128             my $okParams =
7129             {
7130             expandable => { allowed => $EXPANDABLES->{ 'issuing.authorization' } },
7131             metadata => { type => "hash" },
7132             };
7133             $args = $self->_contract( 'issuing.authorization', $args ) || CORE::return( $self->pass_error );
7134             my $err = $self->_check_parameters( $okParams, $args );
7135             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
7136             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No issuing.authorization id (with parameter 'id') was provided to update its information." ) );
7137             my $hash = $self->post( "issuing/authorizations/${id}", $args ) || CORE::return( $self->pass_error );
7138             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Issuing::Authorization', $hash ) );
7139             }
7140             PERL
7141             # NOTE: issuing_authorizations()
7142             issuing_authorizations => <<'PERL',
7143             # <https://stripe.com/docs/api/issuing/authorizations>
7144             sub issuing_authorizations
7145             {
7146             my $self = shift( @_ );
7147             my $allowed = [qw( approve decline list retrieve update )];
7148             my $action = shift( @_ );
7149             my $meth = $self->_get_method( 'issuing_authorization', $action, $allowed ) || CORE::return( $self->pass_error );
7150             CORE::return( $self->$meth( @_ ) );
7151             }
7152             PERL
7153             # NOTE: issuing_card()
7154             issuing_card => <<'PERL',
7155             # sub issuing { CORE::return( shift->_instantiate( 'issuing', 'Net::API::Stripe::Issuing' ) ) }
7156             sub issuing_card { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Issuing::Card', @_ ) ); }
7157             PERL
7158             # NOTE: issuing_card_create()
7159             issuing_card_create => <<'PERL',
7160             sub issuing_card_create
7161             {
7162             my $self = shift( @_ );
7163             my $args = shift( @_ );
7164             my $okParams =
7165             {
7166             expandable => { allowed => $EXPANDABLES->{ 'issuing.card' } },
7167             cardholder => { type => "hash" },
7168             currency => { type => "string", required => 1 },
7169             metadata => { type => "hash" },
7170             replacement_for => { type => "string" },
7171             replacement_reason => { type => "string" },
7172             shipping => { type => "hash" },
7173             spending_controls => { type => "hash" },
7174             status => { type => "string" },
7175             type => { type => "string", required => 1 },
7176             };
7177             $args = $self->_contract( 'issuing.card', $args ) || CORE::return( $self->pass_error );
7178             my $err = $self->_check_parameters( $okParams, $args );
7179             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
7180             my $hash = $self->post( "", $args ) || CORE::return( $self->pass_error );
7181             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Issuing::Card', $hash ) );
7182             }
7183             PERL
7184             # NOTE: issuing_card_deliver()
7185             issuing_card_deliver => <<'PERL',
7186             sub issuing_card_deliver
7187             {
7188             my $self = shift( @_ );
7189             my $args = shift( @_ );
7190             my $okParams =
7191             {
7192             expandable => { allowed => $EXPANDABLES->{ 'issuing.card' } },
7193             };
7194             $args = $self->_contract( 'issuing.card', $args ) || CORE::return( $self->pass_error );
7195             my $err = $self->_check_parameters( $okParams, $args );
7196             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
7197             my $card = CORE::delete( $args->{card} ) || CORE::return( $self->error( "No issuing.card id (with parameter 'card') was provided to deliver its information." ) );
7198             my $hash = $self->post( "test_helpers/issuing/cards/${card}/shipping", $args ) || CORE::return( $self->pass_error );
7199             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Issuing::Card', $hash ) );
7200             }
7201             PERL
7202             # NOTE: issuing_card_fail()
7203             issuing_card_fail => <<'PERL',
7204             sub issuing_card_fail
7205             {
7206             my $self = shift( @_ );
7207             my $args = shift( @_ );
7208             my $okParams =
7209             {
7210             expandable => { allowed => $EXPANDABLES->{ 'issuing.card' } },
7211             };
7212             $args = $self->_contract( 'issuing.card', $args ) || CORE::return( $self->pass_error );
7213             my $err = $self->_check_parameters( $okParams, $args );
7214             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
7215             my $card = CORE::delete( $args->{card} ) || CORE::return( $self->error( "No issuing.card id (with parameter 'card') was provided to fail its information." ) );
7216             my $hash = $self->post( "test_helpers/issuing/cards/${card}/shipping", $args ) || CORE::return( $self->pass_error );
7217             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Issuing::Card', $hash ) );
7218             }
7219             PERL
7220             # NOTE: issuing_card_list()
7221             issuing_card_list => <<'PERL',
7222             sub issuing_card_list
7223             {
7224             my $self = shift( @_ );
7225             CORE::return( $self->error( "No parameters were provided to list issuing card information." ) ) if( !scalar( @_ ) );
7226             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Issuing::Card', @_ );
7227             my $okParams =
7228             {
7229             expandable => { allowed => $EXPANDABLES->{ 'issuing.card' }, data_prefix_is_ok => 1 },
7230             cardholder => { type => "hash" },
7231             created => { type => "timestamp" },
7232             ending_before => { type => "string" },
7233             exp_month => { type => "integer" },
7234             exp_year => { type => "integer" },
7235             last4 => { type => "string" },
7236             limit => { type => "string" },
7237             starting_after => { type => "string" },
7238             status => { type => "string" },
7239             type => { type => "string" },
7240             };
7241             my $err = $self->_check_parameters( $okParams, $args );
7242             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
7243             if( $args->{expand} )
7244             {
7245             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
7246             }
7247             my $hash = $self->get( "", $args ) || CORE::return( $self->pass_error );
7248             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Issuing::Card', $hash ) );
7249             }
7250             PERL
7251             # NOTE: issuing_card_retrieve()
7252             issuing_card_retrieve => <<'PERL',
7253             sub issuing_card_retrieve
7254             {
7255             my $self = shift( @_ );
7256             my $args = shift( @_ );
7257             my $okParams =
7258             {
7259             expandable => { allowed => $EXPANDABLES->{ 'issuing.card' }, data_prefix_is_ok => 1 },
7260             };
7261             $args = $self->_contract( 'issuing.card', $args ) || CORE::return( $self->pass_error );
7262             my $err = $self->_check_parameters( $okParams, $args );
7263             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
7264             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No issuing.card id (with parameter 'id') was provided to retrieve its information." ) );
7265             my $hash = $self->get( "issuing/cards/${id}", $args ) || CORE::return( $self->pass_error );
7266             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Issuing::Card', $hash ) );
7267             }
7268             PERL
7269             # NOTE: issuing_card_return()
7270             issuing_card_return => <<'PERL',
7271             sub issuing_card_return
7272             {
7273             my $self = shift( @_ );
7274             my $args = shift( @_ );
7275             my $okParams =
7276             {
7277             expandable => { allowed => $EXPANDABLES->{ 'issuing.card' } },
7278             };
7279             $args = $self->_contract( 'issuing.card', $args ) || CORE::return( $self->pass_error );
7280             my $err = $self->_check_parameters( $okParams, $args );
7281             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
7282             my $card = CORE::delete( $args->{card} ) || CORE::return( $self->error( "No issuing.card id (with parameter 'card') was provided to return its information." ) );
7283             my $hash = $self->post( "test_helpers/issuing/cards/${card}/shipping", $args ) || CORE::return( $self->pass_error );
7284             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Issuing::Card', $hash ) );
7285             }
7286             PERL
7287             # NOTE: issuing_card_ship()
7288             issuing_card_ship => <<'PERL',
7289             sub issuing_card_ship
7290             {
7291             my $self = shift( @_ );
7292             my $args = shift( @_ );
7293             my $okParams =
7294             {
7295             expandable => { allowed => $EXPANDABLES->{ 'issuing.card' } },
7296             };
7297             $args = $self->_contract( 'issuing.card', $args ) || CORE::return( $self->pass_error );
7298             my $err = $self->_check_parameters( $okParams, $args );
7299             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
7300             my $card = CORE::delete( $args->{card} ) || CORE::return( $self->error( "No issuing.card id (with parameter 'card') was provided to ship its information." ) );
7301             my $hash = $self->post( "test_helpers/issuing/cards/${card}/shipping", $args ) || CORE::return( $self->pass_error );
7302             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Issuing::Card', $hash ) );
7303             }
7304             PERL
7305             # NOTE: issuing_card_update()
7306             issuing_card_update => <<'PERL',
7307             sub issuing_card_update
7308             {
7309             my $self = shift( @_ );
7310             my $args = shift( @_ );
7311             my $okParams =
7312             {
7313             expandable => { allowed => $EXPANDABLES->{ 'issuing.card' } },
7314             cancellation_reason => { type => "string" },
7315             metadata => { type => "hash" },
7316             pin => { type => "object" },
7317             spending_controls => { type => "hash" },
7318             status => { type => "string" },
7319             };
7320             $args = $self->_contract( 'issuing.card', $args ) || CORE::return( $self->pass_error );
7321             my $err = $self->_check_parameters( $okParams, $args );
7322             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
7323             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No issuing.card id (with parameter 'id') was provided to update its information." ) );
7324             my $hash = $self->post( "issuing/cards/${id}", $args ) || CORE::return( $self->pass_error );
7325             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Issuing::Card', $hash ) );
7326             }
7327             PERL
7328             # NOTE: issuing_cardholder()
7329             issuing_cardholder => <<'PERL',
7330             sub issuing_cardholder { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Issuing::Card::Holder', @_ ) ); }
7331             PERL
7332             # NOTE: issuing_cardholder_create()
7333             issuing_cardholder_create => <<'PERL',
7334             sub issuing_cardholder_create
7335             {
7336             my $self = shift( @_ );
7337             my $args = shift( @_ );
7338             my $okParams =
7339             {
7340             expandable => { allowed => $EXPANDABLES->{ 'issuing.cardholder' } },
7341             billing => { type => "hash", required => 1 },
7342             company => { type => "hash" },
7343             email => { type => "string" },
7344             individual => { type => "hash" },
7345             metadata => { type => "hash" },
7346             name => { type => "string", required => 1 },
7347             phone_number => { type => "string" },
7348             spending_controls => { type => "hash" },
7349             status => { type => "string" },
7350             type => { type => "string", required => 1 },
7351             };
7352             $args = $self->_contract( 'issuing.cardholder', $args ) || CORE::return( $self->pass_error );
7353             my $err = $self->_check_parameters( $okParams, $args );
7354             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
7355             my $hash = $self->post( "", $args ) || CORE::return( $self->pass_error );
7356             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Issuing::Card::Holder', $hash ) );
7357             }
7358             PERL
7359             # NOTE: issuing_cardholder_list()
7360             issuing_cardholder_list => <<'PERL',
7361             sub issuing_cardholder_list
7362             {
7363             my $self = shift( @_ );
7364             CORE::return( $self->error( "No parameters were provided to list issuing cardholder information." ) ) if( !scalar( @_ ) );
7365             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Issuing::Card::Holder', @_ );
7366             my $okParams =
7367             {
7368             expandable => { allowed => $EXPANDABLES->{ 'issuing.cardholder' }, data_prefix_is_ok => 1 },
7369             created => { type => "timestamp" },
7370             email => { type => "string" },
7371             ending_before => { type => "string" },
7372             limit => { type => "string" },
7373             phone_number => { type => "string" },
7374             starting_after => { type => "string" },
7375             status => { type => "string" },
7376             type => { type => "string" },
7377             };
7378             my $err = $self->_check_parameters( $okParams, $args );
7379             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
7380             if( $args->{expand} )
7381             {
7382             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
7383             }
7384             my $hash = $self->get( "", $args ) || CORE::return( $self->pass_error );
7385             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Issuing::Card::Holder', $hash ) );
7386             }
7387             PERL
7388             # NOTE: issuing_cardholder_retrieve()
7389             issuing_cardholder_retrieve => <<'PERL',
7390             sub issuing_cardholder_retrieve
7391             {
7392             my $self = shift( @_ );
7393             my $args = shift( @_ );
7394             my $okParams =
7395             {
7396             expandable => { allowed => $EXPANDABLES->{ 'issuing.cardholder' }, data_prefix_is_ok => 1 },
7397             };
7398             $args = $self->_contract( 'issuing.cardholder', $args ) || CORE::return( $self->pass_error );
7399             my $err = $self->_check_parameters( $okParams, $args );
7400             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
7401             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No issuing.cardholder id (with parameter 'id') was provided to retrieve its information." ) );
7402             my $hash = $self->get( "issuing/cardholders/${id}", $args ) || CORE::return( $self->pass_error );
7403             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Issuing::Card::Holder', $hash ) );
7404             }
7405             PERL
7406             # NOTE: issuing_cardholder_update()
7407             issuing_cardholder_update => <<'PERL',
7408             sub issuing_cardholder_update
7409             {
7410             my $self = shift( @_ );
7411             my $args = shift( @_ );
7412             my $okParams =
7413             {
7414             expandable => { allowed => $EXPANDABLES->{ 'issuing.cardholder' } },
7415             billing => { type => "hash" },
7416             company => { type => "hash" },
7417             email => { type => "string" },
7418             individual => { type => "hash" },
7419             metadata => { type => "hash" },
7420             phone_number => { type => "string" },
7421             spending_controls => { type => "hash" },
7422             status => { type => "string" },
7423             };
7424             $args = $self->_contract( 'issuing.cardholder', $args ) || CORE::return( $self->pass_error );
7425             my $err = $self->_check_parameters( $okParams, $args );
7426             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
7427             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No issuing.cardholder id (with parameter 'id') was provided to update its information." ) );
7428             my $hash = $self->post( "issuing/cardholders/${id}", $args ) || CORE::return( $self->pass_error );
7429             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Issuing::Card::Holder', $hash ) );
7430             }
7431             PERL
7432             # NOTE: issuing_cardholders()
7433             issuing_cardholders => <<'PERL',
7434             # <https://stripe.com/docs/api/issuing/cardholders>
7435             sub issuing_cardholders
7436             {
7437             my $self = shift( @_ );
7438             my $allowed = [qw( create list retrieve update )];
7439             my $action = shift( @_ );
7440             my $meth = $self->_get_method( 'issuing_cardholder', $action, $allowed ) || CORE::return( $self->pass_error );
7441             CORE::return( $self->$meth( @_ ) );
7442             }
7443             PERL
7444             # NOTE: issuing_cards()
7445             issuing_cards => <<'PERL',
7446             # <https://stripe.com/docs/api/issuing/cards>
7447             sub issuing_cards
7448             {
7449             my $self = shift( @_ );
7450             my $allowed = [qw( create deliver fail list retrieve return ship update )];
7451             my $action = shift( @_ );
7452             my $meth = $self->_get_method( 'issuing_card', $action, $allowed ) || CORE::return( $self->pass_error );
7453             CORE::return( $self->$meth( @_ ) );
7454             }
7455             PERL
7456             # NOTE: issuing_dispute()
7457             issuing_dispute => <<'PERL',
7458             sub issuing_dispute { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Issuing::Dispute', @_ ) ); }
7459             PERL
7460             # NOTE: issuing_dispute_create()
7461             issuing_dispute_create => <<'PERL',
7462             sub issuing_dispute_create
7463             {
7464             my $self = shift( @_ );
7465             my $args = shift( @_ );
7466             my $okParams =
7467             {
7468             expandable => { allowed => $EXPANDABLES->{ 'issuing.dispute' } },
7469             evidence => { type => "hash" },
7470             metadata => { type => "hash" },
7471             transaction => { type => "string" },
7472             };
7473             $args = $self->_contract( 'issuing.dispute', $args ) || CORE::return( $self->pass_error );
7474             my $err = $self->_check_parameters( $okParams, $args );
7475             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
7476             my $hash = $self->post( "", $args ) || CORE::return( $self->pass_error );
7477             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Issuing::Dispute', $hash ) );
7478             }
7479             PERL
7480             # NOTE: issuing_dispute_list()
7481             issuing_dispute_list => <<'PERL',
7482             sub issuing_dispute_list
7483             {
7484             my $self = shift( @_ );
7485             CORE::return( $self->error( "No parameters were provided to list issuing dispute information." ) ) if( !scalar( @_ ) );
7486             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Issuing::Dispute', @_ );
7487             my $okParams =
7488             {
7489             expandable => { allowed => $EXPANDABLES->{ 'issuing.dispute' }, data_prefix_is_ok => 1 },
7490             created => { type => "timestamp" },
7491             ending_before => { type => "string" },
7492             limit => { type => "string" },
7493             starting_after => { type => "string" },
7494             status => { type => "string" },
7495             transaction => { type => "string" },
7496             };
7497             my $err = $self->_check_parameters( $okParams, $args );
7498             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
7499             if( $args->{expand} )
7500             {
7501             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
7502             }
7503             my $hash = $self->get( "", $args ) || CORE::return( $self->pass_error );
7504             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Issuing::Dispute', $hash ) );
7505             }
7506             PERL
7507             # NOTE: issuing_dispute_retrieve()
7508             issuing_dispute_retrieve => <<'PERL',
7509             sub issuing_dispute_retrieve
7510             {
7511             my $self = shift( @_ );
7512             my $args = shift( @_ );
7513             my $okParams =
7514             {
7515             expandable => { allowed => $EXPANDABLES->{ 'issuing.dispute' }, data_prefix_is_ok => 1 },
7516             };
7517             $args = $self->_contract( 'issuing.dispute', $args ) || CORE::return( $self->pass_error );
7518             my $err = $self->_check_parameters( $okParams, $args );
7519             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
7520             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No issuing.dispute id (with parameter 'id') was provided to retrieve its information." ) );
7521             my $hash = $self->get( "issuing/disputes/${id}", $args ) || CORE::return( $self->pass_error );
7522             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Issuing::Dispute', $hash ) );
7523             }
7524             PERL
7525             # NOTE: issuing_dispute_submit()
7526             issuing_dispute_submit => <<'PERL',
7527             sub issuing_dispute_submit
7528             {
7529             my $self = shift( @_ );
7530             my $args = shift( @_ );
7531             my $okParams =
7532             {
7533             expandable => { allowed => $EXPANDABLES->{ 'issuing.dispute' } },
7534             metadata => { type => "hash" },
7535             };
7536             $args = $self->_contract( 'issuing.dispute', $args ) || CORE::return( $self->pass_error );
7537             my $err = $self->_check_parameters( $okParams, $args );
7538             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
7539             my $hash = $self->post( "", $args ) || CORE::return( $self->pass_error );
7540             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Issuing::Dispute', $hash ) );
7541             }
7542             PERL
7543             # NOTE: issuing_dispute_update()
7544             issuing_dispute_update => <<'PERL',
7545             sub issuing_dispute_update
7546             {
7547             my $self = shift( @_ );
7548             my $args = shift( @_ );
7549             my $okParams =
7550             {
7551             expandable => { allowed => $EXPANDABLES->{ 'issuing.dispute' } },
7552             evidence => { type => "hash" },
7553             metadata => { type => "hash" },
7554             };
7555             $args = $self->_contract( 'issuing.dispute', $args ) || CORE::return( $self->pass_error );
7556             my $err = $self->_check_parameters( $okParams, $args );
7557             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
7558             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No issuing.dispute id (with parameter 'id') was provided to update its information." ) );
7559             my $hash = $self->post( "issuing/disputes/${id}", $args ) || CORE::return( $self->pass_error );
7560             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Issuing::Dispute', $hash ) );
7561             }
7562             PERL
7563             # NOTE: issuing_disputes()
7564             issuing_disputes => <<'PERL',
7565             # <https://stripe.com/docs/api/issuing/disputes>
7566             sub issuing_disputes
7567             {
7568             my $self = shift( @_ );
7569             my $allowed = [qw( create list retrieve submit update )];
7570             my $action = shift( @_ );
7571             my $meth = $self->_get_method( 'issuing_dispute', $action, $allowed ) || CORE::return( $self->pass_error );
7572             CORE::return( $self->$meth( @_ ) );
7573             }
7574             PERL
7575             # NOTE: issuing_transaction()
7576             issuing_transaction => <<'PERL',
7577             sub issuing_transaction { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Issuing::Transaction', @_ ) ); }
7578             PERL
7579             # NOTE: issuing_transaction_list()
7580             issuing_transaction_list => <<'PERL',
7581             sub issuing_transaction_list
7582             {
7583             my $self = shift( @_ );
7584             CORE::return( $self->error( "No parameters were provided to list issuing transaction information." ) ) if( !scalar( @_ ) );
7585             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Issuing::Transaction', @_ );
7586             my $okParams =
7587             {
7588             expandable => { allowed => $EXPANDABLES->{ 'issuing.transaction' }, data_prefix_is_ok => 1 },
7589             card => { type => "string" },
7590             cardholder => { type => "string" },
7591             created => { type => "timestamp" },
7592             ending_before => { type => "string" },
7593             limit => { type => "string" },
7594             starting_after => { type => "string" },
7595             type => { type => "string" },
7596             };
7597             my $err = $self->_check_parameters( $okParams, $args );
7598             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
7599             if( $args->{expand} )
7600             {
7601             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
7602             }
7603             my $hash = $self->get( "", $args ) || CORE::return( $self->pass_error );
7604             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Issuing::Transaction', $hash ) );
7605             }
7606             PERL
7607             # NOTE: issuing_transaction_retrieve()
7608             issuing_transaction_retrieve => <<'PERL',
7609             sub issuing_transaction_retrieve
7610             {
7611             my $self = shift( @_ );
7612             my $args = shift( @_ );
7613             my $okParams =
7614             {
7615             expandable => { allowed => $EXPANDABLES->{ 'issuing.transaction' }, data_prefix_is_ok => 1 },
7616             };
7617             $args = $self->_contract( 'issuing.transaction', $args ) || CORE::return( $self->pass_error );
7618             my $err = $self->_check_parameters( $okParams, $args );
7619             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
7620             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No issuing.transaction id (with parameter 'id') was provided to retrieve its information." ) );
7621             my $hash = $self->get( "issuing/transactions/${id}", $args ) || CORE::return( $self->pass_error );
7622             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Issuing::Transaction', $hash ) );
7623             }
7624             PERL
7625             # NOTE: issuing_transaction_update()
7626             issuing_transaction_update => <<'PERL',
7627             sub issuing_transaction_update
7628             {
7629             my $self = shift( @_ );
7630             my $args = shift( @_ );
7631             my $okParams =
7632             {
7633             expandable => { allowed => $EXPANDABLES->{ 'issuing.transaction' } },
7634             metadata => { type => "hash" },
7635             };
7636             $args = $self->_contract( 'issuing.transaction', $args ) || CORE::return( $self->pass_error );
7637             my $err = $self->_check_parameters( $okParams, $args );
7638             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
7639             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No issuing.transaction id (with parameter 'id') was provided to update its information." ) );
7640             my $hash = $self->post( "issuing/transactions/${id}", $args ) || CORE::return( $self->pass_error );
7641             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Issuing::Transaction', $hash ) );
7642             }
7643             PERL
7644             # NOTE: issuing_transactions()
7645             issuing_transactions => <<'PERL',
7646             # <https://stripe.com/docs/api/issuing/transactions>
7647             sub issuing_transactions
7648             {
7649             my $self = shift( @_ );
7650             my $allowed = [qw( list retrieve update )];
7651             my $action = shift( @_ );
7652             my $meth = $self->_get_method( 'issuing_transaction', $action, $allowed ) || CORE::return( $self->pass_error );
7653             CORE::return( $self->$meth( @_ ) );
7654             }
7655             PERL
7656             # NOTE: item()
7657             item => <<'PERL',
7658             sub item { CORE::return( shift->_response_to_object( 'Net::API::Stripe::List::Item', @_ ) ); }
7659             PERL
7660             # NOTE: line_item()
7661             line_item => <<'PERL',
7662             sub line_item { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Billing::Invoice::LineItem', @_ ) ); }
7663             PERL
7664             # NOTE: line_item_lines()
7665             line_item_lines => <<'PERL',
7666             sub line_item_lines
7667             {
7668             my $self = shift( @_ );
7669             CORE::return( $self->error( "No parameters were provided to lines line item information." ) ) if( !scalar( @_ ) );
7670             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Billing::Invoice::LineItem', @_ );
7671             my $okParams =
7672             {
7673             expandable => { allowed => $EXPANDABLES->{ 'line_item' }, data_prefix_is_ok => 1 },
7674             automatic_tax => { type => "hash" },
7675             coupon => { type => "string" },
7676             currency => { type => "string" },
7677             customer => { type => "string" },
7678             customer_details => { type => "hash" },
7679             discounts => { type => "array" },
7680             ending_before => { type => "string" },
7681             invoice_items => { type => "string" },
7682             limit => { type => "string" },
7683             schedule => { type => "string" },
7684             starting_after => { type => "string" },
7685             subscription => { type => "string" },
7686             subscription_billing_cycle_anchor => { type => "string" },
7687             subscription_cancel_at => { type => "string" },
7688             subscription_cancel_at_period_end => { type => "string" },
7689             subscription_cancel_now => { type => "string" },
7690             subscription_default_tax_rates => { type => "string" },
7691             subscription_items => { type => "string" },
7692             subscription_proration_behavior => { type => "string" },
7693             subscription_proration_date => { type => "string" },
7694             subscription_start_date => { type => "string" },
7695             subscription_trial_end => { type => "string" },
7696             subscription_trial_from_plan => { type => "string" },
7697             };
7698             my $err = $self->_check_parameters( $okParams, $args );
7699             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
7700             my $hash = $self->get( "invoices/upcoming", $args ) || CORE::return( $self->pass_error );
7701             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::Invoice::LineItem', $hash ) );
7702             }
7703             PERL
7704             # NOTE: line_items()
7705             line_items => <<'PERL',
7706             # <https://stripe.com/docs/api/invoices>
7707             sub line_items
7708             {
7709             my $self = shift( @_ );
7710             my $allowed = [qw( lines )];
7711             my $action = shift( @_ );
7712             my $meth = $self->_get_method( 'line_item', $action, $allowed ) || CORE::return( $self->pass_error );
7713             CORE::return( $self->$meth( @_ ) );
7714             }
7715             PERL
7716             # NOTE: location()
7717             location => <<'PERL',
7718             sub location { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Terminal::Location', @_ ) ); }
7719             PERL
7720             # NOTE: login_link()
7721             login_link => <<'PERL',
7722             sub login_link { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Connect::Account::LoginLink', @_ ) ); }
7723             PERL
7724             # NOTE: login_link_create()
7725             login_link_create => <<'PERL',
7726             sub login_link_create
7727             {
7728             my $self = shift( @_ );
7729             my $args = shift( @_ );
7730             my $okParams =
7731             {
7732             expandable => { allowed => $EXPANDABLES->{ 'login_link' } },
7733             };
7734             $args = $self->_contract( 'login_link', $args ) || CORE::return( $self->pass_error );
7735             my $err = $self->_check_parameters( $okParams, $args );
7736             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
7737             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No account id (with parameter 'id') was provided to create its information." ) );
7738             my $hash = $self->post( "accounts/${id}/login_links", $args ) || CORE::return( $self->pass_error );
7739             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Connect::Account::LoginLink', $hash ) );
7740             }
7741             PERL
7742             # NOTE: login_links()
7743             login_links => <<'PERL',
7744             # <https://stripe.com/docs/api/accounts>
7745             sub login_links
7746             {
7747             my $self = shift( @_ );
7748             my $allowed = [qw( create )];
7749             my $action = shift( @_ );
7750             my $meth = $self->_get_method( 'login_link', $action, $allowed ) || CORE::return( $self->pass_error );
7751             CORE::return( $self->$meth( @_ ) );
7752             }
7753             PERL
7754             # NOTE: mandate()
7755             mandate => <<'PERL',
7756             sub mandate { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Mandate' ) ) }
7757             PERL
7758             # NOTE: mandate_retrieve()
7759             mandate_retrieve => <<'PERL',
7760             sub mandate_retrieve
7761             {
7762             my $self = shift( @_ );
7763             CORE::return( $self->error( "No parameters were provided to retrieve a mandate" ) ) if( !scalar( @_ ) );
7764             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Mandate', @_ );
7765             my $okParams =
7766             {
7767             expandable => { allowed => $EXPANDABLES->{mandate} },
7768             id => { re => qr/^\w+$/, required => 1 },
7769             };
7770             my $err = $self->_check_parameters( $okParams, $args );
7771             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
7772             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No mandate id was provided to retrieve its information." ) );
7773             my $hash = $self->get( "mandates/${id}", $args ) || CORE::return( $self->pass_error );
7774             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Mandate', $hash ) );
7775             }
7776             PERL
7777             # NOTE: mandates()
7778             mandates => <<'PERL',
7779             sub mandates
7780             {
7781             my $self = shift( @_ );
7782             my $action = shift( @_ );
7783             my $allowed = [qw( retrieve )];
7784             my $meth = $self->_get_method( 'mandate', $action, $allowed ) || CORE::return( $self->pass_error );
7785             CORE::return( $self->$meth( @_ ) );
7786             }
7787             PERL
7788             # NOTE: merchant_data()
7789             merchant_data => <<'PERL',
7790             sub merchant_data { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Issuing::MerchantData', @_ ) ); }
7791             PERL
7792             # NOTE: next_action()
7793             next_action => <<'PERL',
7794             sub next_action { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Payment::Intent::NextAction', @_ ) ); }
7795             PERL
7796             # NOTE: order()
7797             order => <<'PERL',
7798             sub order { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Order' ) ) }
7799             PERL
7800             # NOTE: order_item()
7801             order_item => <<'PERL',
7802             sub order_item { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Order::Item' ) ) }
7803             PERL
7804             # NOTE: outcome()
7805             outcome => <<'PERL',
7806             sub outcome { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Charge::Outcome', @_ ) ); }
7807             PERL
7808             # NOTE: owner()
7809             owner => <<'PERL',
7810             sub owner { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Payment::Source::Owner', @_ ) ); }
7811             PERL
7812             # NOTE: package_dimensions()
7813             package_dimensions => <<'PERL',
7814             sub package_dimensions { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Order::SKU::PackageDimensions', @_ ) ); }
7815             PERL
7816             # NOTE: payment_intent()
7817             payment_intent => <<'PERL',
7818             # subs to access child packages
7819             sub payment_intent { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Payment::Intent', @_ ) ); }
7820             PERL
7821             # NOTE: payment_intent_apply_customer_balance()
7822             payment_intent_apply_customer_balance => <<'PERL',
7823             sub payment_intent_apply_customer_balance
7824             {
7825             my $self = shift( @_ );
7826             my $args = shift( @_ );
7827             my $okParams =
7828             {
7829             expandable => { allowed => $EXPANDABLES->{ 'payment_intent' } },
7830             amount => { type => "integer" },
7831             currency => { type => "string" },
7832             };
7833             $args = $self->_contract( 'payment_intent', $args ) || CORE::return( $self->pass_error );
7834             my $err = $self->_check_parameters( $okParams, $args );
7835             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
7836             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No payment_intent id (with parameter 'id') was provided to apply_customer_balance its information." ) );
7837             my $hash = $self->post( "payment_intents/${id}", $args ) || CORE::return( $self->pass_error );
7838             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Payment::Intent', $hash ) );
7839             }
7840             PERL
7841             # NOTE: payment_intent_cancel()
7842             payment_intent_cancel => <<'PERL',
7843             sub payment_intent_cancel
7844             {
7845             my $self = shift( @_ );
7846             CORE::return( $self->error( "No parameters were provided to cancel a payment intent" ) ) if( !scalar( @_ ) );
7847             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Payment::Intent', @_ );
7848             my $okParams =
7849             {
7850             expandable => { allowed => $EXPANDABLES->{payment_intent} },
7851             amount_to_capture => {},
7852             cancellation_reason => { type => "string" },
7853             id => { re => qr/^\w+$/, required => 1 },
7854             };
7855              
7856             $args = $self->_contract( 'payment_intent', $args ) || CORE::return( $self->pass_error );
7857             my $err = $self->_check_parameters( $okParams, $args );
7858             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
7859             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No payment intent id was provided to cancel it." ) );
7860             my $hash = $self->post( "payment_intents/${id}/cancel", $args ) || CORE::return( $self->pass_error );
7861             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Payment::Intent', $hash ) );
7862             }
7863             PERL
7864             # NOTE: payment_intent_capture()
7865             payment_intent_capture => <<'PERL',
7866             sub payment_intent_capture
7867             {
7868             my $self = shift( @_ );
7869             CORE::return( $self->error( "No parameters were provided to capture a payment intent" ) ) if( !scalar( @_ ) );
7870             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Payment::Intent', @_ );
7871             my $okParams =
7872             {
7873             expandable => { allowed => $EXPANDABLES->{payment_intent} },
7874             amount_to_capture => { type => "integer" },
7875             application_fee_amount => { type => "integer" },
7876             id => { re => qr/^\w+$/, required => 1 },
7877             statement_descriptor => { type => "string" },
7878             statement_descriptor_suffix => { type => "string" },
7879             transfer_data => { fields => ["amount"], type => "hash" },
7880             };
7881              
7882             $args = $self->_contract( 'payment_intent', $args ) || CORE::return( $self->pass_error );
7883             my $err = $self->_check_parameters( $okParams, $args );
7884             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
7885             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No payment intent id was provided to capture it." ) );
7886             my $hash = $self->post( "payment_intents/${id}/capture", $args ) || CORE::return( $self->pass_error );
7887             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Payment::Intent', $hash ) );
7888             }
7889             PERL
7890             # NOTE: payment_intent_confirm()
7891             payment_intent_confirm => <<'PERL',
7892             sub payment_intent_confirm
7893             {
7894             my $self = shift( @_ );
7895             CORE::return( $self->error( "No parameters were provided to confirm a payment intent" ) ) if( !scalar( @_ ) );
7896             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Payment::Intent', @_ );
7897             my $okParams =
7898             {
7899             expandable => { allowed => $EXPANDABLES->{payment_intent} },
7900             capture_method => { type => "string" },
7901             error_on_requires_action => { type => "boolean" },
7902             id => { re => qr/^\w+$/, required => 1 },
7903             mandate => { type => "string" },
7904             mandate_data => {
7905             fields => [
7906             "customer_acceptance.accepted_at",
7907             "customer_acceptance.offline",
7908             "customer_acceptance.online",
7909             "customer_acceptance.online.ip_address",
7910             "customer_acceptance.online.user_agent",
7911             "customer_acceptance.type",
7912             ],
7913             type => "hash",
7914             },
7915             off_session => { type => "string" },
7916             payment_method => { package => "Net::API::Stripe::Payment::Method", type => "string" },
7917             payment_method_data => {
7918             fields => [
7919             "alipay",
7920             "au_becs_debit",
7921             "au_becs_debit.account_number!",
7922             "au_becs_debit.bsb_number!",
7923             "bacs_debit",
7924             "bacs_debit.account_number",
7925             "bacs_debit.sort_code",
7926             "bancontact",
7927             "billing_details",
7928             "billing_details.address",
7929             "billing_details.address.city",
7930             "billing_details.address.country",
7931             "billing_details.address.line1",
7932             "billing_details.address.line2",
7933             "billing_details.address.postal_code",
7934             "billing_details.address.state",
7935             "billing_details.email",
7936             "billing_details.name",
7937             "billing_details.phone",
7938             "eps",
7939             "fpx",
7940             "fpx.bank!",
7941             "giropay",
7942             "grabpay",
7943             "ideal",
7944             "ideal.bank",
7945             "interac_present",
7946             "metadata",
7947             "oxxo",
7948             "p24",
7949             "p24.bank",
7950             "sepa_debit",
7951             "sepa_debit.iban!",
7952             "sofort",
7953             "sofort.country!",
7954             "type",
7955             ],
7956             type => "object",
7957             },
7958             payment_method_options => {
7959             fields => [
7960             "alipay",
7961             "bancontact",
7962             "bancontact.preferred_language",
7963             "card",
7964             "card.cvc_token",
7965             "card.installments",
7966             "card.installments.enabled",
7967             "card.installments.plan",
7968             "card.installments.plan.count!",
7969             "card.installments.plan.interval!",
7970             "card.installments.plan.type!",
7971             "card.network",
7972             "card.request_three_d_secure",
7973             "oxxo.expires_after_days",
7974             "p24",
7975             "sepa_debit",
7976             "sepa_debit.mandate_options",
7977             "sofort",
7978             "sofort.preferred_language",
7979             "type",
7980             ],
7981             type => "hash",
7982             },
7983             payment_method_types => { type => "array" },
7984             radar_options => { type => "object" },
7985             receipt_email => { type => "string" },
7986             return_url => { type => "string" },
7987             setup_future_usage => { type => "string" },
7988             shipping => { package => "Net::API::Stripe::Shipping", type => "hash" },
7989             use_stripe_sdk => { type => "boolean" },
7990             };
7991              
7992             $args = $self->_contract( 'payment_intent', $args ) || CORE::return( $self->pass_error );
7993             my $err = $self->_check_parameters( $okParams, $args );
7994             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
7995             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No payment intent id was provided to confirm it." ) );
7996             my $hash = $self->post( "payment_intents/${id}/confirm", $args ) || CORE::return( $self->pass_error );
7997             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Payment::Intent', $hash ) );
7998             }
7999             PERL
8000             # NOTE: payment_intent_create()
8001             payment_intent_create => <<'PERL',
8002             sub payment_intent_create
8003             {
8004             my $self = shift( @_ );
8005             CORE::return( $self->error( "No parameters were provided to create a payment intent" ) ) if( !scalar( @_ ) );
8006             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Payment::Intent', @_ );
8007             my $okParams =
8008             {
8009             expandable => { allowed => $EXPANDABLES->{payment_intent} },
8010             amount => { required => 1, type => "integer" },
8011             application_fee_amount => { type => "integer" },
8012             automatic_payment_methods => { type => "hash" },
8013             capture_method => { type => "string" },
8014             confirm => { required => 1, type => "boolean" },
8015             confirmation_method => { type => "string" },
8016             currency => { required => 1, type => "string" },
8017             customer => { re => qr/^\w+$/, type => "string" },
8018             description => { type => "string" },
8019             error_on_requires_action => { type => "boolean" },
8020             mandate => { re => qr/^\w+$/, type => "string" },
8021             mandate_data => {
8022             fields => [
8023             "customer_acceptance!",
8024             "customer_acceptance.type!",
8025             "customer_acceptance.accepted_at",
8026             "customer_acceptance.offline",
8027             "customer_acceptance.online",
8028             "customer_acceptance.online.ip_address!",
8029             "customer_acceptance.online.user_agent!",
8030             ],
8031             type => "object",
8032             },
8033             metadata => { type => "hash" },
8034             off_session => { type => "boolean" },
8035             on_behalf_of => { re => qr/^\w+$/, type => "string" },
8036             payment_method => { re => qr/^\w+$/, type => "string" },
8037             payment_method_data => {
8038             fields => [
8039             "alipay",
8040             "au_becs_debit",
8041             "au_becs_debit.account_number!",
8042             "au_becs_debit.bsb_number!",
8043             "bacs_debit",
8044             "bacs_debit.account_number",
8045             "bacs_debit.sort_code",
8046             "bancontact",
8047             "billing_details",
8048             "billing_details.address",
8049             "billing_details.address.city",
8050             "billing_details.address.country",
8051             "billing_details.address.line1",
8052             "billing_details.address.line2",
8053             "billing_details.address.postal_code",
8054             "billing_details.address.state",
8055             "billing_details.email",
8056             "billing_details.name",
8057             "billing_details.phone",
8058             "eps",
8059             "fpx",
8060             "fpx.bank!",
8061             "giropay",
8062             "grabpay",
8063             "ideal",
8064             "ideal.bank",
8065             "interac_present",
8066             "metadata",
8067             "oxxo",
8068             "p24",
8069             "p24.bank",
8070             "sepa_debit",
8071             "sepa_debit.iban!",
8072             "sofort",
8073             "sofort.country!",
8074             "type!",
8075             ],
8076             type => "object",
8077             },
8078             payment_method_options => {
8079             fields => [
8080             "alipay",
8081             "bancontact",
8082             "bancontact.preferred_language",
8083             "card",
8084             "card.cvc_token",
8085             "card.installments",
8086             "card.installments.enabled",
8087             "card.installments.plan",
8088             "card.installments.plan.count!",
8089             "card.installments.plan.interval!",
8090             "card.installments.plan.type!",
8091             "card.network",
8092             "card.request_three_d_secure",
8093             "oxxo.expires_after_days",
8094             "p24",
8095             "sepa_debit",
8096             "sepa_debit.mandate_options",
8097             "sofort",
8098             "sofort.preferred_language",
8099             "type",
8100             ],
8101             type => "hash",
8102             },
8103             payment_method_types => { type => "array" },
8104             radar_options => { type => "object" },
8105             receipt_email => { type => "string" },
8106             return_url => { type => "string" },
8107             setup_future_usage => { type => "string" },
8108             shipping => {
8109             fields => ["address!", "carrier", "name!", "phone", "tracking_number"],
8110             type => "hash",
8111             },
8112             statement_descriptor => { type => "string" },
8113             statement_descriptor_suffix => { type => "string" },
8114             transfer_data => { type => "hash" },
8115             transfer_group => { type => "string" },
8116             use_stripe_sdk => { type => "boolean" },
8117             };
8118              
8119             $args = $self->_contract( 'payment_intent', $args ) || CORE::return( $self->pass_error );
8120             my $err = $self->_check_parameters( $okParams, $args );
8121             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
8122             my $hash = $self->post( 'payment_intents', $args ) || CORE::return( $self->pass_error );
8123             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Payment::Intent', $hash ) );
8124             }
8125             PERL
8126             # NOTE: payment_intent_increment()
8127             payment_intent_increment => <<'PERL',
8128             sub payment_intent_increment
8129             {
8130             my $self = shift( @_ );
8131             CORE::return( $self->error( "No parameters were provided to increment a payment intent" ) ) if( !scalar( @_ ) );
8132             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Payment::Intent', @_ );
8133             my $okParams =
8134             {
8135             expandable => { allowed => $EXPANDABLES->{payment_intent} },
8136             id => { re => qr/^\w+$/, required => 1 },
8137             amount => { re => qr/^\d+$/, required => 1 },
8138             description => { re => qr/^.*?$/ },
8139             metadata => {},
8140             application_fee_amount => { re => qr/^\d+$/ },
8141             transfer_data => { fields => [qw( amount )] },
8142             };
8143             my $err = $self->_check_parameters( $okParams, $args );
8144             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
8145             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No payment intent id was provided to increment it." ) );
8146             my $hash = $self->post( "payment_intents/${id}/increment_authorization", $args ) || CORE::return( $self->pass_error );
8147             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Payment::Intent', $hash ) );
8148             }
8149             PERL
8150             # NOTE: payment_intent_increment_authorization()
8151             payment_intent_increment_authorization => <<'PERL',
8152             sub payment_intent_increment_authorization
8153             {
8154             my $self = shift( @_ );
8155             my $args = shift( @_ );
8156             my $okParams =
8157             {
8158             expandable => { allowed => $EXPANDABLES->{ 'payment_intent' } },
8159             amount => { type => "integer", required => 1 },
8160             application_fee_amount => { type => "integer" },
8161             description => { type => "string" },
8162             metadata => { type => "hash" },
8163             transfer_data => { type => "hash" },
8164             };
8165             $args = $self->_contract( 'payment_intent', $args ) || CORE::return( $self->pass_error );
8166             my $err = $self->_check_parameters( $okParams, $args );
8167             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
8168             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No payment_intent id (with parameter 'id') was provided to increment_authorization its information." ) );
8169             my $hash = $self->post( "payment_intents/${id}", $args ) || CORE::return( $self->pass_error );
8170             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Payment::Intent', $hash ) );
8171             }
8172             PERL
8173             # NOTE: payment_intent_list()
8174             payment_intent_list => <<'PERL',
8175             sub payment_intent_list
8176             {
8177             my $self = shift( @_ );
8178             my $args = $self->_get_args( @_ );
8179             my $okParams =
8180             {
8181             expandable => { allowed => $EXPANDABLES->{payment_intent}, data_prefix_is_ok => 1 },
8182             created => qr/^\d+$/,
8183             'created.gt' => qr/^\d+$/,
8184             'created.gte' => qr/^\d+$/,
8185             'created.lt' => qr/^\d+$/,
8186             'created.lte' => qr/^\d+$/,
8187             customer => { type => "string" },
8188             ending_before => qr/^\w+$/,
8189             limit => qr/^\d+$/,
8190             starting_after => qr/^\w+$/,
8191             };
8192              
8193             my $err = $self->_check_parameters( $okParams, $args );
8194             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
8195             if( $args->{expand} )
8196             {
8197             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
8198             }
8199             my $hash = $self->get( 'payment_methods', $args ) || CORE::return( $self->pass_error );
8200             CORE::return( $self->_response_to_object( 'Net::API::Stripe::List', $hash ) );
8201             }
8202             PERL
8203             # NOTE: payment_intent_reconcile()
8204             payment_intent_reconcile => <<'PERL',
8205             sub payment_intent_reconcile
8206             {
8207             my $self = shift( @_ );
8208             CORE::return( $self->error( "No parameters were provided to reconcile a customer balance payment intent" ) ) if( !scalar( @_ ) );
8209             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Payment::Intent', @_ );
8210             my $okParams =
8211             {
8212             expandable => { allowed => $EXPANDABLES->{payment_intent} },
8213             id => { re => qr/^\w+$/, required => 1 },
8214             amount => { re => qr/^\d+$/ },
8215             currency => { re => qr/^[a-zA-Z]{3}$/ },
8216             };
8217             my $err = $self->_check_parameters( $okParams, $args );
8218             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
8219             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No payment intent id was provided to reconcile its customer balance." ) );
8220             my $hash = $self->post( "payment_intents/${id}/apply_customer_balance", $args ) || CORE::return( $self->pass_error );
8221             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Payment::Intent', $hash ) );
8222             }
8223             PERL
8224             # NOTE: payment_intent_retrieve()
8225             payment_intent_retrieve => <<'PERL',
8226             sub payment_intent_retrieve
8227             {
8228             my $self = shift( @_ );
8229             CORE::return( $self->error( "No parameters were provided to retrieve a payment intent" ) ) if( !scalar( @_ ) );
8230             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Payment::Intent', @_ );
8231             my $okParams =
8232             {
8233             expandable => { allowed => $EXPANDABLES->{payment_intent}, data_prefix_is_ok => 1 },
8234             client_secret => { required => 1, type => "string" },
8235             id => { re => qr/^\w+$/, required => 1 },
8236             };
8237              
8238             my $err = $self->_check_parameters( $okParams, $args );
8239             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
8240             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No payment intent id was provided to retrieve it." ) );
8241             my $hash = $self->get( "payment_intents/${id}", $args ) || CORE::return( $self->pass_error );
8242             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Payment::Intent', $hash ) );
8243             }
8244             PERL
8245             # NOTE: payment_intent_search()
8246             payment_intent_search => <<'PERL',
8247             sub payment_intent_search
8248             {
8249             my $self = shift( @_ );
8250             CORE::return( $self->error( "No parameters were provided to search payment intents." ) ) if( !scalar( @_ ) );
8251             my $args = shift( @_ );
8252             my $okParams =
8253             {
8254             expandable => { allowed => $EXPANDABLES->{payment_intent}, data_prefix_is_ok => 1 },
8255             limit => qr/^\d+$/,
8256             page => qr/^\d+$/,
8257             query => { re => qr/^.*?$/, required => 1, type => "string" },
8258             };
8259              
8260             my $err = $self->_check_parameters( $okParams, $args );
8261             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
8262             if( $args->{expand} )
8263             {
8264             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
8265             }
8266             my $hash = $self->get( "payment_methods/search", $args ) || CORE::return( $self->pass_error );
8267             CORE::return( $self->_response_to_object( 'Net::API::Stripe::List', $hash ) );
8268             }
8269             PERL
8270             # NOTE: payment_intent_update()
8271             payment_intent_update => <<'PERL',
8272             sub payment_intent_update
8273             {
8274             my $self = shift( @_ );
8275             CORE::return( $self->error( "No parameters were provided to update a payment intent" ) ) if( !scalar( @_ ) );
8276             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Payment::Intent', @_ );
8277             my $okParams =
8278             {
8279             expandable => { allowed => $EXPANDABLES->{payment_intent} },
8280             amount => { required => 1, type => "integer" },
8281             application_fee_amount => { type => "integer" },
8282             capture_method => { type => "string" },
8283             currency => { type => "string" },
8284             customer => { re => qr/^\w+$/, type => "string" },
8285             description => { type => "string" },
8286             metadata => { type => "hash" },
8287             payment_method => { re => qr/^\w+$/, type => "string" },
8288             payment_method_data => {
8289             fields => [
8290             "alipay",
8291             "au_becs_debit",
8292             "au_becs_debit.account_number!",
8293             "au_becs_debit.bsb_number!",
8294             "bacs_debit",
8295             "bacs_debit.account_number",
8296             "bacs_debit.sort_code",
8297             "bancontact",
8298             "billing_details",
8299             "billing_details.address",
8300             "billing_details.address.city",
8301             "billing_details.address.country",
8302             "billing_details.address.line1",
8303             "billing_details.address.line2",
8304             "billing_details.address.postal_code",
8305             "billing_details.address.state",
8306             "billing_details.email",
8307             "billing_details.name",
8308             "billing_details.phone",
8309             "eps",
8310             "fpx",
8311             "fpx.bank!",
8312             "giropay",
8313             "grabpay",
8314             "ideal",
8315             "ideal.bank",
8316             "interac_present",
8317             "metadata",
8318             "oxxo",
8319             "p24",
8320             "p24.bank",
8321             "sepa_debit",
8322             "sepa_debit.iban!",
8323             "sofort",
8324             "sofort.country!",
8325             "type!",
8326             ],
8327             type => "object",
8328             },
8329             payment_method_options => {
8330             fields => [
8331             "alipay",
8332             "bancontact",
8333             "bancontact.preferred_language",
8334             "card",
8335             "card.cvc_token",
8336             "card.installments",
8337             "card.installments.enabled",
8338             "card.installments.plan",
8339             "card.installments.plan.count!",
8340             "card.installments.plan.interval!",
8341             "card.installments.plan.type!",
8342             "card.network",
8343             "card.request_three_d_secure",
8344             "oxxo.expires_after_days",
8345             "p24",
8346             "sepa_debit",
8347             "sepa_debit.mandate_options",
8348             "sofort",
8349             "sofort.preferred_language",
8350             "type",
8351             ],
8352             type => "hash",
8353             },
8354             payment_method_types => { type => "array" },
8355             receipt_email => { type => "string" },
8356             setup_future_usage => { type => "string" },
8357             shipping => {
8358             fields => ["address!", "carrier", "name!", "phone", "tracking_number"],
8359             type => "hash",
8360             },
8361             statement_descriptor => { type => "string" },
8362             statement_descriptor_suffix => { type => "string" },
8363             transfer_data => { type => "hash" },
8364             transfer_group => { type => "string" },
8365             };
8366              
8367             $args = $self->_contract( 'payment_intent', $args ) || CORE::return( $self->pass_error );
8368             my $err = $self->_check_parameters( $okParams, $args );
8369             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
8370             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No payment intent id was provided to capture it." ) );
8371             my $hash = $self->post( "payment_intents/${id}", $args ) || CORE::return( $self->pass_error );
8372             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Payment::Intent', $hash ) );
8373             }
8374             PERL
8375             # NOTE: payment_intent_verify()
8376             payment_intent_verify => <<'PERL',
8377             sub payment_intent_verify
8378             {
8379             my $self = shift( @_ );
8380             CORE::return( $self->error( "No parameters were provided to verify microdeposits on a payment intent" ) ) if( !scalar( @_ ) );
8381             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Payment::Intent', @_ );
8382             my $okParams =
8383             {
8384             expandable => { allowed => $EXPANDABLES->{payment_intent} },
8385             id => { re => qr/^\w+$/, required => 1 },
8386             client_secret => {},
8387             amounts => { type => 'array', re => qr/^\d+$/ },
8388             descriptor_code => { re => qr/^.*?$/ },
8389             };
8390             my $err = $self->_check_parameters( $okParams, $args );
8391             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
8392             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No payment intent id was provided to verify microdeposits on it." ) );
8393             my $hash = $self->post( "payment_intents/${id}/verify_microdeposits", $args ) || CORE::return( $self->pass_error );
8394             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Payment::Intent', $hash ) );
8395             }
8396             PERL
8397             # NOTE: payment_intent_verify_microdeposits()
8398             payment_intent_verify_microdeposits => <<'PERL',
8399             sub payment_intent_verify_microdeposits
8400             {
8401             my $self = shift( @_ );
8402             CORE::return( $self->error( "No parameters were provided to verify_microdeposits payment intent information." ) ) if( !scalar( @_ ) );
8403             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Payment::Intent', @_ );
8404             my $okParams =
8405             {
8406             expandable => { allowed => $EXPANDABLES->{ 'payment_intent' } },
8407             amounts => { type => "array" },
8408             client_secret => { type => "string", required => 1 },
8409             descriptor_code => { type => "string" },
8410             };
8411             my $err = $self->_check_parameters( $okParams, $args );
8412             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
8413             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No payment_intent id (with parameter 'id') was provided to verify_microdeposits its information." ) );
8414             my $hash = $self->post( "payment_intents/${id}", $args ) || CORE::return( $self->pass_error );
8415             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Payment::Intent', $hash ) );
8416             }
8417             PERL
8418             # NOTE: payment_intents()
8419             payment_intents => <<'PERL',
8420             # <https://stripe.com/docs/api/payment_intents>
8421             sub payment_intents
8422             {
8423             my $self = shift( @_ );
8424             my $allowed = [qw( apply_customer_balance cancel capture confirm create increment increment_authorization list reconcile retrieve search update verify verify_microdeposits )];
8425             my $action = shift( @_ );
8426             my $meth = $self->_get_method( 'payment_intent', $action, $allowed ) || CORE::return( $self->pass_error );
8427             CORE::return( $self->$meth( @_ ) );
8428             }
8429             PERL
8430             # NOTE: payment_link()
8431             payment_link => <<'PERL',
8432             sub payment_link { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Payment::Link', @_ ) ); }
8433             PERL
8434             # NOTE: payment_link_create()
8435             payment_link_create => <<'PERL',
8436             sub payment_link_create
8437             {
8438             my $self = shift( @_ );
8439             CORE::return( $self->error( "No parameters were provided to create a payment link." ) ) if( !scalar( @_ ) );
8440             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Payment::Link', @_ );
8441             my $okParams =
8442             {
8443             expandable => { allowed => $EXPANDABLES->{payment_link} },
8444             after_completion => {
8445             fields => [
8446             "type!",
8447             "hosted_confirmation",
8448             "hosted_confirmation.custom_message",
8449             "redirect",
8450             "redirect.url!",
8451             ],
8452             type => "hash",
8453             },
8454             allow_promotion_codes => { type => "boolean" },
8455             application_fee_amount => { type => "integer" },
8456             application_fee_percent => { type => "decimal" },
8457             automatic_tax => { fields => ["enabled!"], type => "hash" },
8458             billing_address_collection => { type => "string" },
8459             consent_collection => { fields => ["promotions"], type => "hash" },
8460             currency => { type => "currency" },
8461             customer_creation => { type => "string" },
8462             line_items => {
8463             fields => [
8464             "price!",
8465             "quantity!",
8466             "adjustable_quantity.enabled!",
8467             "adjustable_quantity.maximum",
8468             "adjustable_quantity.minimum",
8469             ],
8470             required => 1,
8471             type => "array",
8472             },
8473             metadata => { type => "hash" },
8474             on_behalf_of => { re => qr/^\w+$/, type => "string" },
8475             payment_intent_data => { fields => ["capture_method", "setup_future_usage"], type => "hash" },
8476             payment_method_collection => { type => "string" },
8477             payment_method_type => { type => "string" },
8478             payment_method_types => { type => "array" },
8479             phone_number_collection => { fields => ["enabled!"], type => "hash" },
8480             shipping_address_collection => { fields => ["allowed_countries"], type => "hash" },
8481             shipping_options => { fields => ["shipping_rate"], type => "array" },
8482             submit_type => { type => "string" },
8483             subscription_data => { fields => ["trial_period_days"], type => "hash" },
8484             tax_id_collection => { fields => ["enabled"], type => "hash" },
8485             transfer_data => { fields => ["destination!", "amount"], type => "hash" },
8486             };
8487              
8488             $args = $self->_contract( 'payment_link', $args ) || CORE::return( $self->pass_error );
8489             my $err = $self->_check_parameters( $okParams, $args );
8490             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
8491             my $hash = $self->post( 'payment_links', $args ) || CORE::return( $self->pass_error );
8492             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Payment::Link', $hash ) );
8493             }
8494             PERL
8495             # NOTE: payment_link_items()
8496             payment_link_items => <<'PERL',
8497             sub payment_link_items
8498             {
8499             my $self = shift( @_ );
8500             CORE::return( $self->error( "No parameters were provided to retrieve payment link information." ) ) if( !scalar( @_ ) );
8501             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Payment::Link', @_ );
8502             my $okParams =
8503             {
8504             expandable => { allowed => $EXPANDABLES->{payment_link} },
8505             id => { re => qr/^\w+$/, required => 1 },
8506             ending_before => { re => qr/^\w+$/ },
8507             limit => { re => qr/^\d+$/ },
8508             starting_after => { re => qr/^\w+$/ },
8509             };
8510             my $err = $self->_check_parameters( $okParams, $args );
8511             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
8512             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No product id was provided to retrieve its information." ) );
8513             my $hash = $self->get( "payment_links/${id}/line_items", $args ) || CORE::return( $self->pass_error );
8514             CORE::return( $self->_response_to_object( 'Net::API::Stripe::List', $hash ) );
8515             }
8516             PERL
8517             # NOTE: payment_link_line_items()
8518             payment_link_line_items => <<'PERL',
8519             sub payment_link_line_items
8520             {
8521             my $self = shift( @_ );
8522             CORE::return( $self->error( "No parameters were provided to line_items payment link information." ) ) if( !scalar( @_ ) );
8523             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Payment::Link', @_ );
8524             my $okParams =
8525             {
8526             expandable => { allowed => $EXPANDABLES->{ 'payment_link' }, data_prefix_is_ok => 1 },
8527             ending_before => { type => "string" },
8528             limit => { type => "string" },
8529             starting_after => { type => "string" },
8530             };
8531             my $err = $self->_check_parameters( $okParams, $args );
8532             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
8533             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No payment_link id (with parameter 'id') was provided to line_items its information." ) );
8534             my $hash = $self->get( "payment_links/${id}/line_items", $args ) || CORE::return( $self->pass_error );
8535             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Payment::Link', $hash ) );
8536             }
8537             PERL
8538             # NOTE: payment_link_list()
8539             payment_link_list => <<'PERL',
8540             sub payment_link_list
8541             {
8542             my $self = shift( @_ );
8543             my $args = $self->_get_args( @_ );
8544             my $okParams =
8545             {
8546             expandable => { allowed => $EXPANDABLES->{payment_link}, data_prefix_is_ok => 1 },
8547             active => { type => "boolean" },
8548             arrival_date => { re => qr/^\d+$/ },
8549             'arrival_date.gt' => { re => qr/^\d+$/ },
8550             'arrival_date.gte' => { re => qr/^\d+$/ },
8551             'arrival_date.lt' => { re => qr/^\d+$/ },
8552             'arrival_date.lte' => { re => qr/^\d+$/ },
8553             created => { re => qr/^\d+$/ },
8554             'created.gt' => { re => qr/^\d+$/ },
8555             'created.gte' => { re => qr/^\d+$/ },
8556             'created.lt' => { re => qr/^\d+$/ },
8557             'created.lte' => { re => qr/^\d+$/ },
8558             destination => { re => qr/^\w+$/ },
8559             ending_before => { re => qr/^\w+$/, type => "string" },
8560             limit => { re => qr/^\d+$/, type => "string" },
8561             starting_after => { re => qr/^\w+$/, type => "string" },
8562             status => { re => qr/^(pending|paid|failed|canceled)$/ },
8563             };
8564              
8565             my $err = $self->_check_parameters( $okParams, $args );
8566             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
8567             if( $args->{expand} )
8568             {
8569             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
8570             }
8571             my $hash = $self->get( 'payment_links', $args ) || CORE::return( $self->pass_error );
8572             CORE::return( $self->_response_to_object( 'Net::API::Stripe::List', $hash ) );
8573             }
8574             PERL
8575             # NOTE: payment_link_retrieve()
8576             payment_link_retrieve => <<'PERL',
8577             sub payment_link_retrieve
8578             {
8579             my $self = shift( @_ );
8580             CORE::return( $self->error( "No parameters were provided to retrieve payment link information." ) ) if( !scalar( @_ ) );
8581             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Payment::Link', @_ );
8582             my $okParams =
8583             {
8584             expandable => { allowed => $EXPANDABLES->{payment_link} },
8585             id => { re => qr/^\w+$/, required => 1 },
8586             };
8587             my $err = $self->_check_parameters( $okParams, $args );
8588             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
8589             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No payment link id was provided to retrieve its information." ) );
8590             my $hash = $self->get( "payment_links/${id}", $args ) || CORE::return( $self->pass_error );
8591             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Payment::Link', $hash ) );
8592             }
8593             PERL
8594             # NOTE: payment_link_update()
8595             payment_link_update => <<'PERL',
8596             sub payment_link_update
8597             {
8598             my $self = shift( @_ );
8599             CORE::return( $self->error( "No parameters were provided to update a payment link" ) ) if( !scalar( @_ ) );
8600             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Payout', @_ );
8601             my $okParams =
8602             {
8603             expandable => { allowed => $EXPANDABLES->{payment_link} },
8604             active => { type => "boolean" },
8605             after_completion => { type => "hash" },
8606             allow_promotion_codes => { type => "boolean" },
8607             automatic_tax => { type => "hash" },
8608             billing_address_collection => { type => "string" },
8609             customer_creation => { type => "string" },
8610             id => { re => qr/^\w+$/, required => 1 },
8611             line_items => { type => "hash" },
8612             metadata => { type => "hash" },
8613             payment_method_collection => { type => "string" },
8614             payment_method_types => { type => "array" },
8615             shipping_address_collection => { type => "hash" },
8616             };
8617              
8618             $args = $self->_contract( 'payment_link', $args ) || CORE::return( $self->pass_error );
8619             my $err = $self->_check_parameters( $okParams, $args );
8620             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
8621             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No payment id was provided to update its details" ) );
8622             my $hash = $self->post( "payment_links/${id}", $args ) || CORE::return( $self->pass_error );
8623             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Payout', $hash ) );
8624             }
8625             PERL
8626             # NOTE: payment_links()
8627             payment_links => <<'PERL',
8628             # <https://stripe.com/docs/api/payment_links/payment_links>
8629             sub payment_links
8630             {
8631             my $self = shift( @_ );
8632             my $allowed = [qw( create items line_items list retrieve update )];
8633             my $action = shift( @_ );
8634             my $meth = $self->_get_method( 'payment_link', $action, $allowed ) || CORE::return( $self->pass_error );
8635             CORE::return( $self->$meth( @_ ) );
8636             }
8637             PERL
8638             # NOTE: payment_method()
8639             payment_method => <<'PERL',
8640             sub payment_method { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Payment::Method', @_ ) ); }
8641             PERL
8642             # NOTE: payment_method_attach()
8643             payment_method_attach => <<'PERL',
8644             sub payment_method_attach
8645             {
8646             my $self = shift( @_ );
8647             CORE::return( $self->error( "No parameters were provided to attach a payment method" ) ) if( !scalar( @_ ) );
8648             my $args;
8649             if( $self->_is_object( $_[0] ) )
8650             {
8651             if( $_[0]->isa( 'Net::API::Stripe::Customer' ) )
8652             {
8653             $args = $self->_get_args_from_object( 'Net::API::Stripe::Customer', @_ );
8654             my $obj = $args->{_object};
8655             $args->{customer} = $obj->id;
8656             $args->{id} = $obj->payment_method->id if( $obj->payment_method );
8657             }
8658             elsif( $_[0]->isa( 'Net::API::Stripe::Payment::Method' ) )
8659             {
8660             $args = $self->_get_args_from_object( 'Net::API::Stripe::Payment::Method', @_ );
8661             }
8662             }
8663             else
8664             {
8665             $args = $self->_get_args( @_ );
8666             }
8667             my $okParams =
8668             {
8669             expandable => { allowed => $EXPANDABLES->{payment_method} },
8670             customer => { re => qr/^\w+$/, required => 1, type => "string" },
8671             id => { re => qr/^\w+$/, required => 1 },
8672             };
8673              
8674             $args = $self->_contract( 'payment_method', $args ) || CORE::return( $self->pass_error );
8675             my $err = $self->_check_parameters( $okParams, $args );
8676             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
8677             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No payment method id was provided to attach to attach it to the customer with id \"$args->{customer}\"." ) );
8678             my $hash = $self->post( "payment_methods/${id}/attach", $args ) || CORE::return( $self->pass_error );
8679             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Payment::Method', $hash ) );
8680             }
8681             PERL
8682             # NOTE: payment_method_create()
8683             payment_method_create => <<'PERL',
8684             sub payment_method_create
8685             {
8686             my $self = shift( @_ );
8687             CORE::return( $self->error( "No parameters were provided to create a payment_method" ) ) if( !scalar( @_ ) );
8688             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Payment::Method', @_ );
8689             my $okParams =
8690             {
8691             expandable => { allowed => $EXPANDABLES->{payment_method} },
8692             acss_debit => { type => "hash" },
8693             affirm => { type => "hash" },
8694             afterpay_clearpay => { type => "hash" },
8695             alipay => { type => "hash" },
8696             au_becs_debit => { type => "hash" },
8697             bacs_debit => { type => "hash" },
8698             bancontact => { type => "hash" },
8699             billing_details => {
8700             fields => [
8701             "address.city",
8702             "address.country",
8703             "address.line1",
8704             "address.line2",
8705             "address.postal_code",
8706             "address.state",
8707             "email",
8708             "name",
8709             "phone",
8710             ],
8711             type => "hash",
8712             },
8713             blik => { type => "hash" },
8714             boleto => { type => "hash" },
8715             card => {
8716             fields => ["exp_month", "exp_year", "number", "cvc"],
8717             type => "hash",
8718             },
8719             customer_balance => { type => "hash" },
8720             eps => { type => "hash" },
8721             fpx => { fields => ["bank"], type => "hash" },
8722             giropay => { type => "hash" },
8723             grabpay => { type => "hash" },
8724             ideal => { fields => ["bank"], type => "hash" },
8725             interac_present => { type => "hash" },
8726             klarna => { type => "hash" },
8727             konbini => { type => "hash" },
8728             link => { type => "hash" },
8729             metadata => { type => "hash" },
8730             oxxo => { type => "hash" },
8731             p24 => { type => "hash" },
8732             paynow => { type => "hash" },
8733             promptpay => { type => "hash" },
8734             radar_options => { type => "hash" },
8735             sepa_debit => { fields => ["iban"], type => "hash" },
8736             sofort => { type => "hash" },
8737             type => {
8738             re => qr/^(?:card|fpx|ideal|sepa_debit)$/,
8739             required => 1,
8740             type => "string",
8741             },
8742             us_bank_account => { type => "hash" },
8743             wechat_pay => { type => "hash" },
8744             };
8745              
8746             $args = $self->_contract( 'payment_method', $args ) || CORE::return( $self->pass_error );
8747             my $err = $self->_check_parameters( $okParams, $args );
8748             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
8749             my $hash = $self->post( 'payment_methods', $args ) || CORE::return( $self->pass_error );
8750             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Payment::Method', $hash ) );
8751             }
8752             PERL
8753             # NOTE: payment_method_detach()
8754             payment_method_detach => <<'PERL',
8755             # https://stripe.com/docs/api/payment_methods/detach
8756             sub payment_method_detach
8757             {
8758             my $self = shift( @_ );
8759             CORE::return( $self->error( "No parameters were provided to detach a payment method." ) ) if( !scalar( @_ ) );
8760             my $args;
8761             if( $self->_is_object( $_[0] ) )
8762             {
8763             if( $_[0]->isa( 'Net::API::Stripe::Customer' ) )
8764             {
8765             $args = $self->_get_args_from_object( 'Net::API::Stripe::Customer', @_ );
8766             my $obj = $args->{_object};
8767             $args->{customer} = $obj->id;
8768             if( $obj->payment_method )
8769             {
8770             $args->{id} = $obj->payment_method->id;
8771             }
8772             elsif( $obj->invoice_settings->default_payment_method )
8773             {
8774             $args->{id} = $obj->invoice_settings->default_payment_method->id;
8775             }
8776             CORE::return( $self->error( "No payent method id could be found in this customer object." ) ) if( !$args->{id} );
8777             }
8778             elsif( $_[0]->isa( 'Net::API::Stripe::Payment::Method' ) )
8779             {
8780             $args = $self->_get_args_from_object( 'Net::API::Stripe::Payment::Method', @_ );
8781             }
8782             }
8783             else
8784             {
8785             $args = $self->_get_args( @_ );
8786             }
8787             my $okParams =
8788             {
8789             expandable => { allowed => $EXPANDABLES->{payment_method} },
8790             id => { re => qr/^\w+$/, required => 1 },
8791             };
8792             my $err = $self->_check_parameters( $okParams, $args );
8793             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
8794             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No payment method id was provided to attach it to the customer with id \"$args->{customer}\"." ) );
8795             my $hash = $self->post( "payment_methods/${id}/detach", $args ) || CORE::return( $self->pass_error );
8796             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Payment::Method', $hash ) );
8797             }
8798             PERL
8799             # NOTE: payment_method_details()
8800             payment_method_details => <<'PERL',
8801             sub payment_method_details { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Payment::Method::Details', @_ ) ); }
8802             PERL
8803             # NOTE: payment_method_list()
8804             payment_method_list => <<'PERL',
8805             sub payment_method_list
8806             {
8807             my $self = shift( @_ );
8808             my $args = $self->_get_args( @_ );
8809             my $okParams =
8810             {
8811             expandable => { allowed => $EXPANDABLES->{payment_method}, data_prefix_is_ok => 1 },
8812             customer => { required => 1, type => "string" },
8813             ending_before => { type => "string" },
8814             limit => { re => qr/^\d+$/, type => "string" },
8815             starting_after => { type => "string" },
8816             type => {
8817             re => qr/^(?:card|fpx|ideal|sepa_debit)$/,
8818             required => 1,
8819             type => "string",
8820             },
8821             };
8822              
8823             my $err = $self->_check_parameters( $okParams, $args );
8824             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
8825             if( $args->{expand} )
8826             {
8827             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
8828             }
8829             my $hash = $self->get( 'payment_methods', $args ) || CORE::return( $self->pass_error );
8830             CORE::return( $self->_response_to_object( 'Net::API::Stripe::List', $hash ) );
8831             }
8832             PERL
8833             # NOTE: payment_method_list_customer_payment_methods()
8834             payment_method_list_customer_payment_methods => <<'PERL',
8835             sub payment_method_list_customer_payment_methods
8836             {
8837             my $self = shift( @_ );
8838             CORE::return( $self->error( "No parameters were provided to list_customer_payment_methods payment method information." ) ) if( !scalar( @_ ) );
8839             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Payment::Method', @_ );
8840             my $okParams =
8841             {
8842             expandable => { allowed => $EXPANDABLES->{ 'payment_method' }, data_prefix_is_ok => 1 },
8843             ending_before => { type => "string" },
8844             limit => { type => "string" },
8845             starting_after => { type => "string" },
8846             type => { type => "string", required => 1 },
8847             };
8848             my $err = $self->_check_parameters( $okParams, $args );
8849             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
8850             my $customer = CORE::delete( $args->{customer} ) || CORE::return( $self->error( "No customer id (with parameter 'customer') was provided to list_customer_payment_methods its information." ) );
8851             if( $args->{expand} )
8852             {
8853             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
8854             }
8855             my $hash = $self->get( "customers/${customer}/payment_methods", $args ) || CORE::return( $self->pass_error );
8856             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Payment::Method', $hash ) );
8857             }
8858             PERL
8859             # NOTE: payment_method_retrieve()
8860             payment_method_retrieve => <<'PERL',
8861             sub payment_method_retrieve
8862             {
8863             my $self = shift( @_ );
8864             CORE::return( $self->error( "No parameters were provided to retrieve payment method information." ) ) if( !scalar( @_ ) );
8865             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Payment::Method', @_ );
8866             my $okParams =
8867             {
8868             expandable => { allowed => $EXPANDABLES->{payment_method} },
8869             id => { re => qr/^\w+$/, required => 1 }
8870             };
8871             my $err = $self->_check_parameters( $okParams, $args );
8872             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
8873             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No payment method id was provided to retrieve its information." ) );
8874             my $hash = $self->get( "payment_methods/${id}", $args ) || CORE::return( $self->pass_error );
8875             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Payment::Method', $hash ) );
8876             }
8877             PERL
8878             # NOTE: payment_method_retrieve_customer_payment_method()
8879             payment_method_retrieve_customer_payment_method => <<'PERL',
8880             sub payment_method_retrieve_customer_payment_method
8881             {
8882             my $self = shift( @_ );
8883             CORE::return( $self->error( "No parameters were provided to retrieve_customer_payment_method payment method information." ) ) if( !scalar( @_ ) );
8884             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Payment::Method', @_ );
8885             my $okParams =
8886             {
8887             expandable => { allowed => $EXPANDABLES->{ 'payment_method' }, data_prefix_is_ok => 1 },
8888             };
8889             my $err = $self->_check_parameters( $okParams, $args );
8890             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
8891             my $customer = CORE::delete( $args->{customer} ) || CORE::return( $self->error( "No customer id (with parameter 'customer') was provided to retrieve_customer_payment_method its information." ) );
8892             my $payment_method = CORE::delete( $args->{payment_method} ) || CORE::return( $self->error( "No payment_method id (with parameter 'payment_method') was provided to retrieve_customer_payment_method its information." ) );
8893             if( $args->{expand} )
8894             {
8895             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
8896             }
8897             my $hash = $self->get( "customers/${customer}/payment_methods/${payment_method}", $args ) || CORE::return( $self->pass_error );
8898             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Payment::Method', $hash ) );
8899             }
8900             PERL
8901             # NOTE: payment_method_update()
8902             payment_method_update => <<'PERL',
8903             # https://stripe.com/docs/api/payment_methods/update
8904             sub payment_method_update
8905             {
8906             my $self = shift( @_ );
8907             CORE::return( $self->error( "No parameters were provided to update a payment method" ) ) if( !scalar( @_ ) );
8908             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Payment::Method', @_ );
8909             my $okParams =
8910             {
8911             expandable => { allowed => $EXPANDABLES->{payment_method} },
8912             billing_details => {
8913             fields => [
8914             "address.city",
8915             "address.country",
8916             "address.line1",
8917             "address.line2",
8918             "address.postal_code",
8919             "address.state",
8920             "email",
8921             "name",
8922             "phone",
8923             ],
8924             type => "hash",
8925             },
8926             card => { fields => ["exp_month", "exp_year"], type => "hash" },
8927             id => { re => qr/^\w+$/, required => 1 },
8928             link => { type => "hash" },
8929             metadata => { type => "hash" },
8930             sepa_debit => { fields => ["iban"] },
8931             us_bank_account => { type => "hash" },
8932             };
8933              
8934             $args = $self->_contract( 'payment_method', $args ) || CORE::return( $self->pass_error );
8935             # We found some errors
8936             my $err = $self->_check_parameters( $okParams, $args );
8937             # $self->message( 3, "Data to be posted: ", $self->dumper( $args ) ); exit;
8938             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
8939             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No payment method id was provided to update payment method's details" ) );
8940             my $hash = $self->post( "payment_methods/${id}", $args ) || CORE::return( $self->pass_error );
8941             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Payment::Method', $hash ) );
8942             }
8943             PERL
8944             # NOTE: payment_methods()
8945             payment_methods => <<'PERL',
8946             # <https://stripe.com/docs/api/payment_methods>
8947             sub payment_methods
8948             {
8949             my $self = shift( @_ );
8950             my $allowed = [qw( attach create detach list list_customer_payment_methods retrieve retrieve_customer_payment_method update )];
8951             my $action = shift( @_ );
8952             my $meth = $self->_get_method( 'payment_method', $action, $allowed ) || CORE::return( $self->pass_error );
8953             CORE::return( $self->$meth( @_ ) );
8954             }
8955             PERL
8956             # NOTE: payout()
8957             payout => <<'PERL',
8958             sub payout { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Payout', @_ ) ); }
8959             PERL
8960             # NOTE: payout_cancel()
8961             payout_cancel => <<'PERL',
8962             sub payout_cancel
8963             {
8964             my $self = shift( @_ );
8965             CORE::return( $self->error( "No parameters were provided to cancel a payout" ) ) if( !scalar( @_ ) );
8966             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Payout', @_ );
8967             my $okParams =
8968             {
8969             expandable => { allowed => $EXPANDABLES->{payout} },
8970             id => { re => qr/^\w+$/, required => 1 },
8971             };
8972             $args = $self->_contract( 'payout', $args ) || CORE::return( $self->pass_error );
8973             my $err = $self->_check_parameters( $okParams, $args );
8974             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
8975             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No payout id was provided to cancel it." ) );
8976             my $hash = $self->post( "payouts/${id}/cancel", $args ) || CORE::return( $self->pass_error );
8977             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Payout', $hash ) );
8978             }
8979             PERL
8980             # NOTE: payout_create()
8981             payout_create => <<'PERL',
8982             sub payout_create
8983             {
8984             my $self = shift( @_ );
8985             CORE::return( $self->error( "No parameters were provided to create a payout" ) ) if( !scalar( @_ ) );
8986             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Payout', @_ );
8987             my $okParams =
8988             {
8989             expandable => { allowed => $EXPANDABLES->{payout} },
8990             amount => { required => 1, type => "integer" },
8991             currency => { required => 1, type => "string" },
8992             description => { type => "string" },
8993             destination => { re => qr/^\w+$/, type => "string" },
8994             metadata => { type => "hash" },
8995             method => { re => qr/^(standard|instant)$/, type => "string" },
8996             source_type => { re => qr/^(bank_account|card|fpx)$/, type => "string" },
8997             statement_descriptor => { type => "string" },
8998             };
8999              
9000             $args = $self->_contract( 'payout', $args ) || CORE::return( $self->pass_error );
9001             my $err = $self->_check_parameters( $okParams, $args );
9002             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
9003             my $hash = $self->post( 'payouts', $args ) || CORE::return( $self->pass_error );
9004             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Payout', $hash ) );
9005             }
9006             PERL
9007             # NOTE: payout_list()
9008             payout_list => <<'PERL',
9009             sub payout_list
9010             {
9011             my $self = shift( @_ );
9012             my $args = $self->_get_args( @_ );
9013             my $okParams =
9014             {
9015             expandable => { allowed => $EXPANDABLES->{payout}, data_prefix_is_ok => 1 },
9016             arrival_date => { re => qr/^\d+$/, type => "timestamp" },
9017             'arrival_date.gt' => { re => qr/^\d+$/ },
9018             'arrival_date.gte' => { re => qr/^\d+$/ },
9019             'arrival_date.lt' => { re => qr/^\d+$/ },
9020             'arrival_date.lte' => { re => qr/^\d+$/ },
9021             created => { re => qr/^\d+$/, type => "timestamp" },
9022             'created.gt' => { re => qr/^\d+$/ },
9023             'created.gte' => { re => qr/^\d+$/ },
9024             'created.lt' => { re => qr/^\d+$/ },
9025             'created.lte' => { re => qr/^\d+$/ },
9026             destination => { re => qr/^\w+$/, type => "string" },
9027             ending_before => { re => qr/^\w+$/, type => "string" },
9028             limit => { re => qr/^\d+$/, type => "string" },
9029             starting_after => { re => qr/^\w+$/, type => "string" },
9030             status => { re => qr/^(pending|paid|failed|canceled)$/, type => "string" },
9031             };
9032              
9033             my $err = $self->_check_parameters( $okParams, $args );
9034             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
9035             if( $args->{expand} )
9036             {
9037             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
9038             }
9039             my $hash = $self->get( 'payment_methods', $args ) || CORE::return( $self->pass_error );
9040             CORE::return( $self->_response_to_object( 'Net::API::Stripe::List', $hash ) );
9041             }
9042             PERL
9043             # NOTE: payout_retrieve()
9044             payout_retrieve => <<'PERL',
9045             sub payout_retrieve
9046             {
9047             my $self = shift( @_ );
9048             CORE::return( $self->error( "No parameters were provided to retrieve payout information." ) ) if( !scalar( @_ ) );
9049             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Payout', @_ );
9050             my $okParams =
9051             {
9052             expandable => { allowed => $EXPANDABLES->{payout} },
9053             id => { re => qr/^\w+$/, required => 1 }
9054             };
9055             my $err = $self->_check_parameters( $okParams, $args );
9056             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
9057             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No payout id was provided to retrieve its information." ) );
9058             my $hash = $self->get( "payouts/${id}", $args ) || CORE::return( $self->pass_error );
9059             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Payout', $hash ) );
9060             }
9061             PERL
9062             # NOTE: payout_reverse()
9063             payout_reverse => <<'PERL',
9064             sub payout_reverse
9065             {
9066             my $self = shift( @_ );
9067             CORE::return( $self->error( "No parameters were provided to reverse payout information." ) ) if( !scalar( @_ ) );
9068             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Payout', @_ );
9069             my $okParams =
9070             {
9071             expandable => { allowed => $EXPANDABLES->{payout} },
9072             id => { re => qr/^\w+$/, required => 1 },
9073             metadata => { type => 'hash' },
9074             };
9075             my $err = $self->_check_parameters( $okParams, $args );
9076             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
9077             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No payout id was provided to reverse it." ) );
9078             my $hash = $self->get( "payouts/${id}", $args ) || CORE::return( $self->pass_error );
9079             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Payout', $hash ) );
9080             }
9081             PERL
9082             # NOTE: payout_update()
9083             payout_update => <<'PERL',
9084             sub payout_update
9085             {
9086             my $self = shift( @_ );
9087             CORE::return( $self->error( "No parameters were provided to update a payout" ) ) if( !scalar( @_ ) );
9088             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Payout', @_ );
9089             my $okParams =
9090             {
9091             expandable => { allowed => $EXPANDABLES->{payout} },
9092             id => { re => qr/^\w+$/, required => 1 },
9093             metadata => { type => 'hash' },
9094             };
9095             $args = $self->_contract( 'payout', $args ) || CORE::return( $self->pass_error );
9096             my $err = $self->_check_parameters( $okParams, $args );
9097             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
9098             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No payout id was provided to update its details" ) );
9099             my $hash = $self->post( "payouts/${id}", $args ) || CORE::return( $self->pass_error );
9100             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Payout', $hash ) );
9101             }
9102             PERL
9103             # NOTE: payouts()
9104             payouts => <<'PERL',
9105             sub payouts
9106             {
9107             my $self = shift( @_ );
9108             my $action = shift( @_ );
9109             my $allowed = [qw( create retrieve update list cancel reverse )];
9110             my $meth = $self->_get_method( 'payout', $action, $allowed ) || CORE::return( $self->pass_error );
9111             CORE::return( $self->$meth( @_ ) );
9112             }
9113             PERL
9114             # NOTE: period()
9115             period => <<'PERL',
9116             sub period { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Billing::Invoice::Period', @_ ) ); }
9117             PERL
9118             # NOTE: person()
9119             person => <<'PERL',
9120             sub person { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Connect::Person', @_ ) ); }
9121             PERL
9122             # NOTE: person_create()
9123             person_create => <<'PERL',
9124             sub person_create
9125             {
9126             my $self = shift( @_ );
9127             my $args = shift( @_ );
9128             my $okParams =
9129             {
9130             expandable => { allowed => $EXPANDABLES->{ 'person' } },
9131             address => { type => "hash" },
9132             address_kana => { type => "hash" },
9133             address_kanji => { type => "hash" },
9134             dob => { type => "hash" },
9135             documents => { type => "object" },
9136             email => { type => "string" },
9137             first_name => { type => "string" },
9138             first_name_kana => { type => "string" },
9139             first_name_kanji => { type => "string" },
9140             full_name_aliases => { type => "array" },
9141             gender => { type => "string" },
9142             id_number => { type => "string" },
9143             id_number_secondary => { type => "string" },
9144             last_name => { type => "string" },
9145             last_name_kana => { type => "string" },
9146             last_name_kanji => { type => "string" },
9147             maiden_name => { type => "string" },
9148             metadata => { type => "hash" },
9149             nationality => { type => "string" },
9150             person_token => { type => "string" },
9151             phone => { type => "string" },
9152             political_exposure => { type => "string" },
9153             registered_address => { type => "hash" },
9154             relationship => { type => "hash" },
9155             ssn_last_4 => { type => "string" },
9156             verification => { type => "hash" },
9157             };
9158             $args = $self->_contract( 'person', $args ) || CORE::return( $self->pass_error );
9159             my $err = $self->_check_parameters( $okParams, $args );
9160             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
9161             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No account id (with parameter 'id') was provided to create its information." ) );
9162             my $hash = $self->post( "accounts/${id}/persons", $args ) || CORE::return( $self->pass_error );
9163             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Connect::Person', $hash ) );
9164             }
9165             PERL
9166             # NOTE: person_delete()
9167             person_delete => <<'PERL',
9168             sub person_delete
9169             {
9170             my $self = shift( @_ );
9171             my $args = shift( @_ );
9172             my $okParams =
9173             {
9174             expandable => { allowed => $EXPANDABLES->{ 'person' } },
9175             };
9176             $args = $self->_contract( 'person', $args ) || CORE::return( $self->pass_error );
9177             my $err = $self->_check_parameters( $okParams, $args );
9178             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
9179             my $parent_id = CORE::delete( $args->{parent_id} ) || CORE::return( $self->error( "No account id (with parameter 'parent_id') was provided to delete its information." ) );
9180             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No person id (with parameter 'id') was provided to delete its information." ) );
9181             my $hash = $self->delete( "accounts/${parent_id}/persons/${id}", $args ) || CORE::return( $self->pass_error );
9182             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Connect::Person', $hash ) );
9183             }
9184             PERL
9185             # NOTE: person_list()
9186             person_list => <<'PERL',
9187             sub person_list
9188             {
9189             my $self = shift( @_ );
9190             CORE::return( $self->error( "No parameters were provided to list person information." ) ) if( !scalar( @_ ) );
9191             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Connect::Person', @_ );
9192             my $okParams =
9193             {
9194             expandable => { allowed => $EXPANDABLES->{ 'person' }, data_prefix_is_ok => 1 },
9195             ending_before => { type => "string" },
9196             limit => { type => "string" },
9197             relationship => { type => "hash" },
9198             starting_after => { type => "string" },
9199             };
9200             my $err = $self->_check_parameters( $okParams, $args );
9201             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
9202             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No account id (with parameter 'id') was provided to list its information." ) );
9203             if( $args->{expand} )
9204             {
9205             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
9206             }
9207             my $hash = $self->get( "accounts/${id}/persons", $args ) || CORE::return( $self->pass_error );
9208             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Connect::Person', $hash ) );
9209             }
9210             PERL
9211             # NOTE: person_retrieve()
9212             person_retrieve => <<'PERL',
9213             sub person_retrieve
9214             {
9215             my $self = shift( @_ );
9216             my $args = shift( @_ );
9217             my $okParams =
9218             {
9219             expandable => { allowed => $EXPANDABLES->{ 'person' }, data_prefix_is_ok => 1 },
9220             };
9221             $args = $self->_contract( 'person', $args ) || CORE::return( $self->pass_error );
9222             my $err = $self->_check_parameters( $okParams, $args );
9223             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
9224             my $parent_id = CORE::delete( $args->{parent_id} ) || CORE::return( $self->error( "No account id (with parameter 'parent_id') was provided to retrieve its information." ) );
9225             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No person id (with parameter 'id') was provided to retrieve its information." ) );
9226             my $hash = $self->get( "accounts/${parent_id}/persons/${id}", $args ) || CORE::return( $self->pass_error );
9227             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Connect::Person', $hash ) );
9228             }
9229             PERL
9230             # NOTE: person_token_create()
9231             person_token_create => <<'PERL',
9232             sub person_token_create { CORE::return( shift->token_create( @_ ) ); }
9233             PERL
9234             # NOTE: person_update()
9235             person_update => <<'PERL',
9236             sub person_update
9237             {
9238             my $self = shift( @_ );
9239             my $args = shift( @_ );
9240             my $okParams =
9241             {
9242             expandable => { allowed => $EXPANDABLES->{ 'person' } },
9243             address => { type => "hash" },
9244             address_kana => { type => "hash" },
9245             address_kanji => { type => "hash" },
9246             dob => { type => "hash" },
9247             documents => { type => "object" },
9248             email => { type => "string" },
9249             first_name => { type => "string" },
9250             first_name_kana => { type => "string" },
9251             first_name_kanji => { type => "string" },
9252             full_name_aliases => { type => "array" },
9253             gender => { type => "string" },
9254             id_number => { type => "string" },
9255             id_number_secondary => { type => "string" },
9256             last_name => { type => "string" },
9257             last_name_kana => { type => "string" },
9258             last_name_kanji => { type => "string" },
9259             maiden_name => { type => "string" },
9260             metadata => { type => "hash" },
9261             nationality => { type => "string" },
9262             person_token => { type => "string" },
9263             phone => { type => "string" },
9264             political_exposure => { type => "string" },
9265             registered_address => { type => "hash" },
9266             relationship => { type => "hash" },
9267             ssn_last_4 => { type => "string" },
9268             verification => { type => "hash" },
9269             };
9270             $args = $self->_contract( 'person', $args ) || CORE::return( $self->pass_error );
9271             my $err = $self->_check_parameters( $okParams, $args );
9272             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
9273             my $parent_id = CORE::delete( $args->{parent_id} ) || CORE::return( $self->error( "No account id (with parameter 'parent_id') was provided to update its information." ) );
9274             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No person id (with parameter 'id') was provided to update its information." ) );
9275             my $hash = $self->post( "accounts/${parent_id}/persons/${id}", $args ) || CORE::return( $self->pass_error );
9276             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Connect::Person', $hash ) );
9277             }
9278             PERL
9279             # NOTE: persons()
9280             persons => <<'PERL',
9281             # <https://stripe.com/docs/api/persons>
9282             sub persons
9283             {
9284             my $self = shift( @_ );
9285             my $allowed = [qw( create delete list retrieve update )];
9286             my $action = shift( @_ );
9287             my $meth = $self->_get_method( 'person', $action, $allowed ) || CORE::return( $self->pass_error );
9288             CORE::return( $self->$meth( @_ ) );
9289             }
9290             PERL
9291             # NOTE: pii_token_create()
9292             pii_token_create => <<'PERL',
9293             sub pii_token_create { CORE::return( shift->token_create( @_ ) ); }
9294             PERL
9295             # NOTE: plan()
9296             plan => <<'PERL',
9297             sub plan { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Billing::Plan', @_ ) ); }
9298             PERL
9299             # NOTE: plan_by_product()
9300             plan_by_product => <<'PERL',
9301             # Find plan by product id or nickname
9302             sub plan_by_product
9303             {
9304             my $self = shift( @_ );
9305             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Product', @_ );
9306             my $id = CORE::delete( $args->{id} );
9307             my $nickname = CORE::delete( $args->{nickname} );
9308             CORE::return( $self->error( "No product id or plan name was provided to find its related product." ) ) if( !$id && !$nickname );
9309             $args->{product} = $id if( $id );
9310             my $check_both_active_and_inactive = 0;
9311             if( !CORE::length( $args->{active} ) )
9312             {
9313             $check_both_active_and_inactive++;
9314             $args->{active} = $self->true;
9315             }
9316             my $list = $self->plans( list => $args ) || CORE::return( $self->pass_error );
9317             my $objects = [];
9318             while( my $this = $list->next )
9319             {
9320             # If this was specified, this is a restrictive query
9321             if( $nickname && $this->nickname eq $nickname )
9322             {
9323             CORE::push( @$objects, $this );
9324             }
9325             # or at least we have this
9326             elsif( $id )
9327             {
9328             CORE::push( @$objects, $this );
9329             }
9330             }
9331             # Now, we also have to check for inactive plans, because Stripe requires the active parameter to be provided or else it defaults to inactive
9332             # How inefficient...
9333             if( $check_both_active_and_inactive )
9334             {
9335             $args->{active} = $self->false;
9336             my $list = $self->plans( list => $args ) || CORE::return( $self->pass_error );
9337             my $objects = [];
9338             while( my $this = $list->next )
9339             {
9340             if( $nickname && $this->nickname eq $nickname )
9341             {
9342             CORE::push( @$objects, $this );
9343             }
9344             elsif( $id )
9345             {
9346             CORE::push( @$objects, $this );
9347             }
9348             }
9349             }
9350             CORE::return( $objects );
9351             }
9352             PERL
9353             # NOTE: plan_create()
9354             plan_create => <<'PERL',
9355             sub plan_create
9356             {
9357             my $self = shift( @_ );
9358             CORE::return( $self->error( "No parameters were provided to create a plan" ) ) if( !scalar( @_ ) );
9359             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Billing::Plan', @_ );
9360             my $obj = $args->{_object};
9361             if( $self->_is_object( $args->{product} ) && $args->{product}->isa( 'Net::API::Stripe::Product' ) )
9362             {
9363             my $prod_hash = $args->{product}->as_hash({ json => 1 });
9364             $args->{product} = $prod_hash;
9365             }
9366             #exit;
9367             my $okParams =
9368             {
9369             expandable => { allowed => $EXPANDABLES->{plan} },
9370             active => { type => "boolean" },
9371             aggregate_usage => { type => "string" },
9372             amount => { required => 1, type => "integer" },
9373             amount_decimal => { type => "decimal" },
9374             billing_scheme => { type => "string" },
9375             currency => { required => 1, type => "string" },
9376             id => { type => "string" },
9377             interval => { re => qr/^(?:day|week|month|year)$/, required => 1, type => "string" },
9378             interval_count => { type => "integer" },
9379             metadata => { type => "hash" },
9380             nickname => { type => "string" },
9381             product => { required => 1, type => "string" },
9382             tiers => {
9383             fields => [
9384             "up_to",
9385             "flat_amount",
9386             "flat_amount_decimal",
9387             "unit_amount",
9388             "unit_amount_decimal",
9389             ],
9390             type => "array",
9391             },
9392             tiers_mode => { re => qr/^(graduated|volume)$/, type => "string" },
9393             transform_usage => { fields => ["divide_by", "round"], type => "hash" },
9394             trial_period_days => { type => "integer" },
9395             usage_type => { re => qr/^(?:metered|licensed)$/, type => "string" },
9396             };
9397              
9398             $args = $self->_contract( 'plan', $args ) || CORE::return( $self->pass_error );
9399             my $err = $self->_check_parameters( $okParams, $args );
9400             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
9401             my $hash = $self->post( 'plans', $args ) || CORE::return( $self->pass_error );
9402             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::Plan', $hash ) );
9403             }
9404             PERL
9405             # NOTE: plan_delete()
9406             plan_delete => <<'PERL',
9407             # https://stripe.com/docs/api/customers/delete?lang=curl
9408             # "Permanently deletes a customer. It cannot be undone. Also immediately cancels any active subscriptions on the customer."
9409             sub plan_delete
9410             {
9411             my $self = shift( @_ );
9412             CORE::return( $self->error( "No parameters were provided to delete plan information." ) ) if( !scalar( @_ ) );
9413             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Billing::Plan', @_ );
9414             my $okParams =
9415             {
9416             expandable => { allowed => $EXPANDABLES->{plan} },
9417             id => { re => qr/^\w+$/, required => 1 }
9418             };
9419             my $err = $self->_check_parameters( $okParams, $args );
9420             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
9421             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No plan id was provided to delete its information." ) );
9422             my $hash = $self->delete( "plans/${id}", $args ) || CORE::return( $self->pass_error );
9423             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::Plan', $hash ) );
9424             }
9425             PERL
9426             # NOTE: plan_list()
9427             plan_list => <<'PERL',
9428             sub plan_list
9429             {
9430             my $self = shift( @_ );
9431             my $args = $self->_get_args( @_ );
9432             if( $self->_is_object( $args->{product} ) && $args->{product}->isa( 'Net::API::Stripe::Product' ) )
9433             {
9434             my $prod_hash = $args->{product}->as_hash({ json => 1 });
9435             $args->{product} = $prod_hash->{id} ? $prod_hash->{id} : undef();
9436             }
9437             my $okParams =
9438             {
9439             expandable => { allowed => $EXPANDABLES->{plan}, data_prefix_is_ok => 1 },
9440             active => { type => "boolean" },
9441             created => { re => qr/^\d+$/, type => "timestamp" },
9442             'created.gt' => { re => qr/^\d+$/ },
9443             'created.gte' => { re => qr/^\d+$/ },
9444             'created.lt' => { re => qr/^\d+$/ },
9445             'created.lte' => { re => qr/^\d+$/ },
9446             ending_before => { type => "string" },
9447             limit => { re => qr/^\d+$/, type => "string" },
9448             product => { re => qr/^\w+$/, type => "string" },
9449             starting_after => { type => "string" },
9450             };
9451              
9452             foreach my $bool ( qw( active ) )
9453             {
9454             next if( !CORE::length( $args->{ $bool } ) );
9455             $args->{ $bool } = ( $args->{ $bool } eq 'true' || ( $args->{ $bool } ne 'false' && $args->{ $bool } ) ) ? 'true' : 'false';
9456             }
9457             my $err = $self->_check_parameters( $okParams, $args );
9458             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
9459             if( $args->{expand} )
9460             {
9461             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
9462             }
9463             my $hash = $self->get( 'plans', $args ) || CORE::return( $self->pass_error );
9464             CORE::return( $self->_response_to_object( 'Net::API::Stripe::List', $hash ) );
9465             }
9466             PERL
9467             # NOTE: plan_retrieve()
9468             plan_retrieve => <<'PERL',
9469             sub plan_retrieve
9470             {
9471             my $self = shift( @_ );
9472             CORE::return( $self->error( "No parameters were provided to retrieve plan information." ) ) if( !scalar( @_ ) );
9473             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Billing::Plan', @_ );
9474             my $okParams =
9475             {
9476             expandable => { allowed => $EXPANDABLES->{plan} },
9477             id => { re => qr/^\w+$/, required => 1 }
9478             };
9479             my $err = $self->_check_parameters( $okParams, $args );
9480             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
9481             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No plan id was provided to retrieve its information." ) );
9482             my $hash = $self->get( "plans/${id}", $args ) || CORE::return( $self->pass_error );
9483             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::Plan', $hash ) );
9484             }
9485             PERL
9486             # NOTE: plan_update()
9487             plan_update => <<'PERL',
9488             # https://stripe.com/docs/api/customers/update?lang=curl
9489             sub plan_update
9490             {
9491             my $self = shift( @_ );
9492             CORE::return( $self->error( "No parameters were provided to update a plan" ) ) if( !scalar( @_ ) );
9493             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Billing::Plan', @_ );
9494             if( $self->_is_object( $args->{product} ) && $args->{product}->isa( 'Net::API::Stripe::Product' ) )
9495             {
9496             $args->{product} = $args->{product}->id;
9497             }
9498             my $okParams =
9499             {
9500             expandable => { allowed => $EXPANDABLES->{plan} },
9501             active => { re => qr/^(?:true|False)$/, type => "boolean" },
9502             id => { required => 1 },
9503             metadata => { type => "hash" },
9504             nickname => { type => "string" },
9505             product => { re => qr/^\w+$/, type => "string" },
9506             trial_period_days => { type => "integer" },
9507             };
9508              
9509             $args = $self->_contract( 'plan', $args ) || CORE::return( $self->pass_error );
9510             # We found some errors
9511             my $err = $self->_check_parameters( $okParams, $args );
9512             # $self->message( 3, "Data to be posted: ", $self->dumper( $args ) ); exit;
9513             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
9514             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No plan id was provided to update plan's details" ) );
9515             my $hash = $self->post( "plans/${id}", $args ) || CORE::return( $self->pass_error );
9516             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::Plan', $hash ) );
9517             }
9518             PERL
9519             # NOTE: plans()
9520             plans => <<'PERL',
9521             sub plans
9522             {
9523             my $self = shift( @_ );
9524             my $action = shift( @_ );
9525             my $allowed = [qw( create retrieve update list delete )];
9526             my $meth = $self->_get_method( 'plan', $action, $allowed ) || CORE::return( $self->pass_error );
9527             CORE::return( $self->$meth( @_ ) );
9528             }
9529             PERL
9530             # NOTE: portal_configuration()
9531             portal_configuration => <<'PERL',
9532             sub portal_configuration { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Billing::Plan', @_ ) ); }
9533             PERL
9534             # NOTE: portal_configuration_create()
9535             portal_configuration_create => <<'PERL',
9536             sub portal_configuration_create
9537             {
9538             my $self = shift( @_ );
9539             CORE::return( $self->error( "No parameters were provided to create a portal configuration" ) ) if( !scalar( @_ ) );
9540             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Billing::PortalConfiguration', @_ );
9541             my $okParams =
9542             {
9543             expandable => { allowed => $EXPANDABLES->{portal_configuration} },
9544             business_profile => { fields => [qw( headline privacy_policy_url terms_of_service_url )], required => 1 },
9545             default_return_url => { type => 'utl' },
9546             features => { fields => [qw(
9547             customer_update.enabled!
9548             customer_update.allowed_updates
9549             invoice_history.enabled!
9550             payment_method_update.enabled!
9551             subscription_cancel.enabled!
9552             subscription_cancel.cancellation_reason.enabled!
9553             subscription_cancel.cancellation_reason.options!
9554             subscription_cancel.mode
9555             subscription_cancel.proration_behavior
9556             subscription_pause.enabled
9557             subscription_update.default_allowed_updates!
9558             subscription_update.enabled!
9559             subscription_update.products!
9560             subscription_update.proration_behavior
9561             )], required => 1 },
9562             metadata => { type => 'hash' },
9563             };
9564             $args = $self->_contract( 'portal_configuration', $args ) || CORE::return( $self->pass_error );
9565             my $err = $self->_check_parameters( $okParams, $args );
9566             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
9567             my $hash = $self->post( 'billing_portal/configurations', $args ) || CORE::return( $self->pass_error );
9568             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::PortalConfiguration', $hash ) );
9569             }
9570             PERL
9571             # NOTE: portal_configuration_list()
9572             portal_configuration_list => <<'PERL',
9573             sub portal_configuration_list
9574             {
9575             my $self = shift( @_ );
9576             my $args = $self->_get_args( @_ );
9577             my $okParams =
9578             {
9579             expandable => { allowed => $EXPANDABLES->{portal_configuration}, data_prefix_is_ok => 1 },
9580             active => { type => 'boolean' },
9581             is_default => { type => 'boolean' },
9582             # "A cursor for use in pagination. ending_before is an object ID that defines your place in the list."
9583             ending_before => {},
9584             limit => { re => qr/^\d+$/ },
9585             starting_after => {},
9586             };
9587             my $err = $self->_check_parameters( $okParams, $args );
9588             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
9589             if( $args->{expand} )
9590             {
9591             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
9592             }
9593             my $hash = $self->get( 'billing_portal/configurations', $args ) || CORE::return( $self->pass_error );
9594             CORE::return( $self->_response_to_object( 'Net::API::Stripe::List', $hash ) );
9595             }
9596             PERL
9597             # NOTE: portal_configuration_retrieve()
9598             portal_configuration_retrieve => <<'PERL',
9599             sub portal_configuration_retrieve
9600             {
9601             my $self = shift( @_ );
9602             CORE::return( $self->error( "No parameters were provided to retrieve the portal configuration." ) ) if( !scalar( @_ ) );
9603             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Billing::PortalConfiguration', @_ );
9604             my $okParams =
9605             {
9606             expandable => { allowed => $EXPANDABLES->{portal_configuration} },
9607             id => { re => qr/^\w+$/, required => 1 }
9608             };
9609             my $err = $self->_check_parameters( $okParams, $args );
9610             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
9611             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No portal configuration id was provided to retrieve its information." ) );
9612             my $hash = $self->get( "billing_portal/configurations/${id}", $args ) || CORE::return( $self->pass_error );
9613             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::PortalConfiguration', $hash ) );
9614             }
9615             PERL
9616             # NOTE: portal_configuration_update()
9617             portal_configuration_update => <<'PERL',
9618             # https://stripe.com/docs/api/customers/update?lang=curl
9619             sub portal_configuration_update
9620             {
9621             my $self = shift( @_ );
9622             CORE::return( $self->error( "No parameters were provided to update a portal configuration" ) ) if( !scalar( @_ ) );
9623             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Billing::PortalConfiguration', @_ );
9624             my $okParams =
9625             {
9626             expandable => { allowed => $EXPANDABLES->{portal_configuration} },
9627             id => { required => 1 },
9628             active => { type => 'boolean' },
9629             business_profile => { fields => [qw( headline privacy_policy_url terms_of_service_url )] },
9630             default_return_url => { type => 'utl' },
9631             features => { fields => [qw(
9632             customer_update.enabled customer_update.allowed_updates
9633             invoice_history.enabled!
9634             payment_method_update.enabled!
9635             subscription_cancel.enabled
9636             subscription_cancel.cancellation_reason.enabled!
9637             subscription_cancel.cancellation_reason.options
9638             subscription_cancel.mode
9639             subscription_cancel.proration_behavior
9640             subscription_pause.enabled
9641             subscription_update.default_allowed_updates
9642             subscription_update.enabled
9643             subscription_update.products
9644             subscription_update.proration_behavior
9645             )] },
9646             metadata => { type => 'hash' },
9647             };
9648             $args = $self->_contract( 'portal_configuration', $args ) || CORE::return( $self->pass_error );
9649             # We found some errors
9650             my $err = $self->_check_parameters( $okParams, $args );
9651             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
9652             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No portal configuration id was provided to update its information." ) );
9653             my $hash = $self->post( "billing_portal/configurations/${id}", $args ) || CORE::return( $self->pass_error );
9654             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::PortalConfiguration', $hash ) );
9655             }
9656             PERL
9657             # NOTE: portal_configurations()
9658             portal_configurations => <<'PERL',
9659             sub portal_configurations
9660             {
9661             my $self = shift( @_ );
9662             my $action = shift( @_ );
9663             my $allowed = [qw( create retrieve update list )];
9664             my $meth = $self->_get_method( 'plan', $action, $allowed ) || CORE::return( $self->pass_error );
9665             CORE::return( $self->$meth( @_ ) );
9666             }
9667             PERL
9668             # NOTE: portal_session()
9669             portal_session => <<'PERL',
9670             sub portal_session { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Billing::PortalSession', @_ ) ); }
9671             PERL
9672             # NOTE: portal_session_create()
9673             portal_session_create => <<'PERL',
9674             sub portal_session_create
9675             {
9676             my $self = shift( @_ );
9677             CORE::return( $self->error( "No parameters were provided to create a portal session" ) ) if( !scalar( @_ ) );
9678             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Billing::PortalSession', @_ );
9679             my $okParams =
9680             {
9681             expandable => { allowed => $EXPANDABLES->{portal_session} },
9682             customer => { re => qr/^\w+$/, required => 1 },
9683             configuration => { re => qr/^\w+$/ },
9684             locale => {},
9685             on_behalf_of => { re => qr/^\w+$/ },
9686             return_url => { type => 'url' },
9687             };
9688             $args = $self->_contract( 'portal_session', $args ) || CORE::return( $self->pass_error );
9689             my $err = $self->_check_parameters( $okParams, $args );
9690             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
9691             my $hash = $self->post( 'billing_portal/sessions', $args ) || CORE::return( $self->pass_error );
9692             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::PortalSession', $hash ) );
9693             }
9694             PERL
9695             # NOTE: portal_sessions()
9696             portal_sessions => <<'PERL',
9697             sub portal_sessions
9698             {
9699             my $self = shift( @_ );
9700             my $action = shift( @_ );
9701             my $allowed = [qw( create )];
9702             my $meth = $self->_get_method( 'plan', $action, $allowed ) || CORE::return( $self->pass_error );
9703             CORE::return( $self->$meth( @_ ) );
9704             }
9705             PERL
9706             # NOTE: price()
9707             price => <<'PERL',
9708             sub price { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Price', @_ ) ); }
9709             PERL
9710             # NOTE: price_create()
9711             price_create => <<'PERL',
9712             sub price_create
9713             {
9714             my $self = shift( @_ );
9715             CORE::return( $self->error( "No parameters were provided to create a price" ) ) if( !scalar( @_ ) );
9716             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Price', @_ );
9717             my $obj = $args->{_object};
9718             if( $self->_is_object( $args->{product} ) && $args->{product}->isa( 'Net::API::Stripe::Product' ) )
9719             {
9720             my $prod_hash = $args->{product}->as_hash({ json => 1 });
9721             $args->{product} = $prod_hash;
9722             }
9723             #exit;
9724             my $okParams =
9725             {
9726             expandable => { allowed => $EXPANDABLES->{price} },
9727             active => { type => "boolean" },
9728             billing_scheme => { type => "string" },
9729             currency => { required => 1, type => "string" },
9730             currency_options => { type => "hash" },
9731             custom_unit_amount => { type => "hash" },
9732             id => {},
9733             lookup_key => { type => "string" },
9734             metadata => { type => "hash" },
9735             nickname => { type => "string" },
9736             product => { required => 1, type => "string" },
9737             product_data => {
9738             fields => [
9739             "id",
9740             "name",
9741             "active",
9742             "metadata",
9743             "statement_descriptor",
9744             "unit_label",
9745             ],
9746             type => "object",
9747             },
9748             recurring => {
9749             fields => [
9750             "interval",
9751             "aggregate_usage",
9752             "interval_count",
9753             "trial_period_days",
9754             "usage_type",
9755             ],
9756             type => "hash",
9757             },
9758             tax_behavior => { type => "string" },
9759             tiers => {
9760             fields => [
9761             "up_to",
9762             "flat_amount",
9763             "flat_amount_decimal",
9764             "unit_amount",
9765             "unit_amount_decimal",
9766             ],
9767             type => "array",
9768             },
9769             tiers_mode => { re => qr/^(graduated|volume)$/, type => "string" },
9770             transfer_lookup_key => { type => "boolean" },
9771             transform_quantity => { fields => ["divide_by", "round"], type => "hash" },
9772             unit_amount => { required => 1, type => "integer" },
9773             unit_amount_decimal => { type => "decimal" },
9774             };
9775              
9776             $args = $self->_contract( 'price', $args ) || CORE::return( $self->pass_error );
9777             my $err = $self->_check_parameters( $okParams, $args );
9778             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
9779             my $hash = $self->post( 'prices', $args ) || CORE::return( $self->pass_error );
9780             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Price', $hash ) );
9781             }
9782             PERL
9783             # NOTE: price_list()
9784             price_list => <<'PERL',
9785             sub price_list
9786             {
9787             my $self = shift( @_ );
9788             my $args = $self->_get_args( @_ );
9789             if( $self->_is_object( $args->{product} ) && $args->{product}->isa( 'Net::API::Stripe::Product' ) )
9790             {
9791             my $prod_hash = $args->{product}->as_hash({ json => 1 });
9792             $args->{product} = $prod_hash->{id} ? $prod_hash->{id} : undef();
9793             }
9794             my $okParams =
9795             {
9796             expandable => { allowed => $EXPANDABLES->{price}, data_prefix_is_ok => 1 },
9797             active => { type => "boolean" },
9798             created => { re => qr/^\d+$/, type => "timestamp" },
9799             'created.gt' => { re => qr/^\d+$/ },
9800             'created.gte' => { re => qr/^\d+$/ },
9801             'created.lt' => { re => qr/^\d+$/ },
9802             'created.lte' => { re => qr/^\d+$/ },
9803             currency => { type => "string" },
9804             ending_before => { type => "string" },
9805             limit => { re => qr/^\d+$/, type => "string" },
9806             lookup_keys => { type => "string" },
9807             product => { re => qr/^\w+$/, type => "string" },
9808             recurring => { fields => ["interval", "usage_type"], type => "hash" },
9809             starting_after => { type => "string" },
9810             type => { type => "string" },
9811             };
9812              
9813             foreach my $bool ( qw( active ) )
9814             {
9815             next if( !CORE::length( $args->{ $bool } ) );
9816             $args->{ $bool } = ( $args->{ $bool } eq 'true' || ( $args->{ $bool } ne 'false' && $args->{ $bool } ) ) ? 'true' : 'false';
9817             }
9818             my $err = $self->_check_parameters( $okParams, $args );
9819             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
9820             if( $args->{expand} )
9821             {
9822             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
9823             }
9824             my $hash = $self->get( 'prices', $args ) || CORE::return( $self->pass_error );
9825             CORE::return( $self->_response_to_object( 'Net::API::Stripe::List', $hash ) );
9826             }
9827             PERL
9828             # NOTE: price_retrieve()
9829             price_retrieve => <<'PERL',
9830             sub price_retrieve
9831             {
9832             my $self = shift( @_ );
9833             CORE::return( $self->error( "No parameters were provided to retrieve price information." ) ) if( !scalar( @_ ) );
9834             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Price', @_ );
9835             my $okParams =
9836             {
9837             expandable => { allowed => $EXPANDABLES->{price} },
9838             id => { re => qr/^\w+$/, required => 1 }
9839             };
9840             my $err = $self->_check_parameters( $okParams, $args );
9841             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
9842             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No price id was provided to retrieve its information." ) );
9843             my $hash = $self->get( "prices/${id}", $args ) || CORE::return( $self->pass_error );
9844             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Price', $hash ) );
9845             }
9846             PERL
9847             # NOTE: price_search()
9848             price_search => <<'PERL',
9849             sub price_search
9850             {
9851             my $self = shift( @_ );
9852             CORE::return( $self->error( "No parameters were provided to search for a price information." ) ) if( !scalar( @_ ) );
9853             my $args = shift( @_ );
9854             my $okParams =
9855             {
9856             expandable => { allowed => $EXPANDABLES->{price}, data_prefix_is_ok => 1 },
9857             limit => qr/^\d+$/,
9858             page => qr/^\d+$/,
9859             query => { re => qr/^.*?$/, required => 1, type => "string" },
9860             };
9861              
9862             my $err = $self->_check_parameters( $okParams, $args );
9863             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
9864             if( $args->{expand} )
9865             {
9866             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
9867             }
9868             my $hash = $self->get( "prices/search", $args ) || CORE::return( $self->pass_error );
9869             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Product', $hash ) );
9870             }
9871             PERL
9872             # NOTE: price_update()
9873             price_update => <<'PERL',
9874             # https://stripe.com/docs/api/customers/update?lang=curl
9875             sub price_update
9876             {
9877             my $self = shift( @_ );
9878             CORE::return( $self->error( "No parameters were provided to update a price object" ) ) if( !scalar( @_ ) );
9879             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Price', @_ );
9880             if( $self->_is_object( $args->{product} ) && $args->{product}->isa( 'Net::API::Stripe::Product' ) )
9881             {
9882             $args->{product} = $args->{product}->id;
9883             }
9884             my $okParams =
9885             {
9886             expandable => { allowed => $EXPANDABLES->{price} },
9887             active => { re => qr/^(?:true|False)$/, type => "boolean" },
9888             currency_options => { type => "hash" },
9889             id => { required => 1 },
9890             lookup_key => { type => "string" },
9891             metadata => { type => "hash" },
9892             nickname => { type => "string" },
9893             recurring => {
9894             fields => [
9895             "interval",
9896             "aggregate_usage",
9897             "interval_count",
9898             "trial_period_days",
9899             "usage_type",
9900             ],
9901             },
9902             tax_behavior => { type => "string" },
9903             transfer_lookup_key => { type => "boolean" },
9904             };
9905              
9906             $args = $self->_contract( 'price', $args ) || CORE::return( $self->pass_error );
9907             # We found some errors
9908             my $err = $self->_check_parameters( $okParams, $args );
9909             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
9910             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No price id was provided to update price's details" ) );
9911             my $hash = $self->post( "prices/${id}", $args ) || CORE::return( $self->pass_error );
9912             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Price', $hash ) );
9913             }
9914             PERL
9915             # NOTE: prices()
9916             prices => <<'PERL',
9917             # <https://stripe.com/docs/api/prices>
9918             sub prices
9919             {
9920             my $self = shift( @_ );
9921             my $allowed = [qw( create list retrieve search update )];
9922             my $action = shift( @_ );
9923             my $meth = $self->_get_method( 'price', $action, $allowed ) || CORE::return( $self->pass_error );
9924             CORE::return( $self->$meth( @_ ) );
9925             }
9926             PERL
9927             # NOTE: product()
9928             product => <<'PERL',
9929             sub product { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Product', @_ ) ); }
9930             PERL
9931             # NOTE: product_by_name()
9932             product_by_name => <<'PERL',
9933             sub product_by_name
9934             {
9935             my $self = shift( @_ );
9936             my $args = $self->_get_args( @_ );
9937             my $name = CORE::delete( $args->{name} );
9938             my $nickname = CORE::delete( $args->{nickname} );
9939             my $list = $self->products( list => $args ) || CORE::return( $self->pass_error );
9940             my $objects = [];
9941             while( my $this = $list->next )
9942             {
9943             if( ( $name && $this->name eq $name ) ||
9944             ( $nickname && $this->nickname eq $nickname ) )
9945             {
9946             CORE::push( @$objects, $this );
9947             }
9948             }
9949             CORE::return( $objects );
9950             }
9951             PERL
9952             # NOTE: product_create()
9953             product_create => <<'PERL',
9954             sub product_create
9955             {
9956             my $self = shift( @_ );
9957             CORE::return( $self->error( "No parameters were provided to create a product" ) ) if( !scalar( @_ ) );
9958             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Product', @_ );
9959             my $okParams =
9960             {
9961             expandable => { allowed => $EXPANDABLES->{product} },
9962             active => { type => "boolean" },
9963             attributes => sub { ... },
9964             caption => {},
9965             deactivate_on => { type => "array" },
9966             default_price_data => { type => "object" },
9967             description => { type => "string" },
9968             id => { type => "string" },
9969             images => sub { ... },
9970             metadata => { type => "hash" },
9971             name => { required => 1, type => "string" },
9972             package_dimensions => { type => "hash" },
9973             shippable => { type => "boolean" },
9974             statement_descriptor => { type => "string" },
9975             tax_code => { type => "string" },
9976             type => { re => qr/^(good|service)$/, required => 1 },
9977             unit_label => { type => "string" },
9978             url => { type => "string" },
9979             };
9980              
9981             $args = $self->_contract( 'product', $args ) || CORE::return( $self->pass_error );
9982             my $err = $self->_check_parameters( $okParams, $args );
9983             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
9984             my $hash = $self->post( 'products', $args ) || CORE::return( $self->pass_error );
9985             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Product', $hash ) );
9986             }
9987             PERL
9988             # NOTE: product_delete()
9989             product_delete => <<'PERL',
9990             # https://stripe.com/docs/api/customers/delete?lang=curl
9991             # "Permanently deletes a customer. It cannot be undone. Also immediately cancels any active subscriptions on the customer."
9992             sub product_delete
9993             {
9994             my $self = shift( @_ );
9995             CORE::return( $self->error( "No parameters were provided to delete product information." ) ) if( !scalar( @_ ) );
9996             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Product', @_ );
9997             my $okParams =
9998             {
9999             expandable => { allowed => $EXPANDABLES->{product} },
10000             id => { re => qr/^\w+$/, required => 1 }
10001             };
10002             my $err = $self->_check_parameters( $okParams, $args );
10003             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
10004             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No product id was provided to delete its information." ) );
10005             my $hash = $self->delete( "products/${id}", $args ) || CORE::return( $self->pass_error );
10006             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Product', $hash ) );
10007             }
10008             PERL
10009             # NOTE: product_list()
10010             product_list => <<'PERL',
10011             sub product_list
10012             {
10013             my $self = shift( @_ );
10014             my $args = $self->_get_args( @_ );
10015             my $okParams =
10016             {
10017             expandable => { allowed => $EXPANDABLES->{product}, data_prefix_is_ok => 1 },
10018             active => { type => "boolean" },
10019             created => { re => qr/^\d+$/, type => "timestamp" },
10020             'created.gt' => { re => qr/^\d+$/ },
10021             'created.gte' => { re => qr/^\d+$/ },
10022             'created.lt' => { re => qr/^\d+$/ },
10023             'created.lte' => { re => qr/^\d+$/ },
10024             ending_before => { type => "string" },
10025             ids => { type => "array" },
10026             limit => { re => qr/^\d+$/, type => "string" },
10027             shippable => { type => "boolean" },
10028             starting_after => { type => "string" },
10029             type => {},
10030             url => { type => "string" },
10031             };
10032              
10033             my $err = $self->_check_parameters( $okParams, $args );
10034             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
10035             if( $args->{expand} )
10036             {
10037             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
10038             }
10039             my $hash = $self->get( 'products', $args ) || CORE::return( $self->pass_error );
10040             CORE::return( $self->_response_to_object( 'Net::API::Stripe::List', $hash ) );
10041             }
10042             PERL
10043             # NOTE: product_retrieve()
10044             product_retrieve => <<'PERL',
10045             sub product_retrieve
10046             {
10047             my $self = shift( @_ );
10048             CORE::return( $self->error( "No parameters were provided to retrieve product information." ) ) if( !scalar( @_ ) );
10049             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Product', @_ );
10050             my $okParams =
10051             {
10052             expandable => { allowed => $EXPANDABLES->{product} },
10053             id => { re => qr/^\w+$/, required => 1 }
10054             };
10055             my $err = $self->_check_parameters( $okParams, $args );
10056             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
10057             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No product id was provided to retrieve its information." ) );
10058             my $hash = $self->get( "products/${id}", $args ) || CORE::return( $self->pass_error );
10059             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Product', $hash ) );
10060             }
10061             PERL
10062             # NOTE: product_search()
10063             product_search => <<'PERL',
10064             sub product_search
10065             {
10066             my $self = shift( @_ );
10067             CORE::return( $self->error( "No parameters were provided to search for a product information." ) ) if( !scalar( @_ ) );
10068             my $args = shift( @_ );
10069             my $okParams =
10070             {
10071             expandable => { allowed => $EXPANDABLES->{product}, data_prefix_is_ok => 1 },
10072             limit => qr/^\d+$/,
10073             page => qr/^\d+$/,
10074             query => { re => qr/^.*?$/, required => 1, type => "string" },
10075             };
10076              
10077             my $err = $self->_check_parameters( $okParams, $args );
10078             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
10079             if( $args->{expand} )
10080             {
10081             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
10082             }
10083             my $hash = $self->get( "products/search", $args ) || CORE::return( $self->pass_error );
10084             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Product', $hash ) );
10085             }
10086             PERL
10087             # NOTE: product_update()
10088             product_update => <<'PERL',
10089             # https://stripe.com/docs/api/customers/update?lang=curl
10090             sub product_update
10091             {
10092             my $self = shift( @_ );
10093             CORE::return( $self->error( "No parameters were provided to update a product" ) ) if( !scalar( @_ ) );
10094             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Product', @_ );
10095             my $okParams =
10096             {
10097             expandable => { allowed => $EXPANDABLES->{product} },
10098             HASH(0x55bef17244e8) => "type",
10099             HASH(0x55bef172f668) => undef,
10100             HASH(0x55bef17416b8) => "unit_label",
10101             HASH(0x55bef174e1e8) => "statement_descriptor",
10102             HASH(0x55bef17598f0) => "url",
10103             HASH(0x55bef27d6400) => "shippable",
10104             active => { type => "boolean" },
10105             attributes => sub { ... },
10106             caption => {},
10107             deactivate_on => { type => "array" },
10108             default_price => { type => "string" },
10109             description => { type => "string" },
10110             id => { re => qr/^\w+$/, required => 1 },
10111             images => sub { ... },
10112             metadata => { type => "hash" },
10113             name => "HASH(0x55bef173a200)package_dimensions",
10114             package_dimensions => { type => "hash" },
10115             shippable => { type => "boolean" },
10116             statement_descriptor => { type => "string" },
10117             tax_code => { type => "string" },
10118             unit_label => { type => "string" },
10119             url => { type => "string" },
10120             };
10121              
10122             $args = $self->_contract( 'product', $args ) || CORE::return( $self->pass_error );
10123             # We found some errors
10124             my $err = $self->_check_parameters( $okParams, $args );
10125             # $self->message( 3, "Data to be posted: ", $self->dumper( $args ) ); exit;
10126             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
10127             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No product id was provided to update product's details" ) );
10128             my $hash = $self->post( "products/${id}", $args ) || CORE::return( $self->pass_error );
10129             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Product', $hash ) );
10130             }
10131             PERL
10132             # NOTE: products()
10133             products => <<'PERL',
10134             sub products
10135             {
10136             my $self = shift( @_ );
10137             my $action = shift( @_ );
10138             my $allowed = [qw( create retrieve update list delete search )];
10139             my $meth = $self->_get_method( 'product', $action, $allowed ) || CORE::return( $self->pass_error );
10140             CORE::return( $self->$meth( @_ ) );
10141             }
10142             PERL
10143             # NOTE: promotion_code()
10144             promotion_code => <<'PERL',
10145             sub promotion_code { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Product::PromotionCode', @_ ) ); }
10146             PERL
10147             # NOTE: promotion_code_create()
10148             promotion_code_create => <<'PERL',
10149             sub promotion_code_create
10150             {
10151             my $self = shift( @_ );
10152             CORE::return( $self->error( "No parameters were provided to create a promotion code" ) ) if( !scalar( @_ ) );
10153             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Product::PromotionCode', @_ );
10154             my $okParams =
10155             {
10156             expandable => { allowed => $EXPANDABLES->{promotion_code} },
10157             active => { type => "boolean" },
10158             code => { re => qr/^.*?$/, type => "string" },
10159             coupon => { re => qr/^\w+$/, required => 1, type => "hash" },
10160             customer => { re => qr/^\w+$/, type => "string" },
10161             expires_at => { type => "timestamp" },
10162             max_redemptions => { type => "integer" },
10163             metadata => { type => "hash" },
10164             restrictions => {
10165             fields => [
10166             "restrictions.first_time_transaction",
10167             "restrictions.minimum_amount",
10168             "restrictions.minimum_amount_currency",
10169             ],
10170             type => "hash",
10171             },
10172             };
10173              
10174             $args = $self->_contract( 'promotion_code', $args ) || CORE::return( $self->pass_error );
10175             my $err = $self->_check_parameters( $okParams, $args );
10176             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
10177             my $hash = $self->post( 'promotion_codes', $args ) || CORE::return( $self->pass_error );
10178             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Product::PromotionCode', $hash ) );
10179             }
10180             PERL
10181             # NOTE: promotion_code_list()
10182             promotion_code_list => <<'PERL',
10183             sub promotion_code_list
10184             {
10185             my $self = shift( @_ );
10186             my $args = shift( @_ );
10187             my $okParams =
10188             {
10189             expandable => { allowed => $EXPANDABLES->{promotion_code}, data_prefix_is_ok => 1 },
10190             active => { type => "boolean" },
10191             code => { re => qr/^.*?$/, type => "string" },
10192             coupon => { re => qr/^\w+$/, type => "hash" },
10193             created => qr/^\d+$/,
10194             'created.gt' => qr/^\d+$/,
10195             'created.gte' => qr/^\d+$/,
10196             'created.lt' => qr/^\d+$/,
10197             'created.lte' => qr/^\d+$/,
10198             customer => { re => qr/^\w+$/, type => "string" },
10199             ending_before => qr/^\w+$/,
10200             limit => qr/^\d+$/,
10201             starting_after => qr/^\w+$/,
10202             };
10203              
10204             my $err = $self->_check_parameters( $okParams, $args );
10205             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
10206             if( $args->{expand} )
10207             {
10208             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
10209             }
10210             my $hash = $self->get( 'promotion_codes', $args ) || CORE::return( $self->pass_error );
10211             CORE::return( $self->_response_to_object( 'Net::API::Stripe::List', $hash ) );
10212             }
10213             PERL
10214             # NOTE: promotion_code_retrieve()
10215             promotion_code_retrieve => <<'PERL',
10216             sub promotion_code_retrieve
10217             {
10218             my $self = shift( @_ );
10219             CORE::return( $self->error( "No parameters were provided to retrieve promotion code information." ) ) if( !scalar( @_ ) );
10220             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Product::PromotionCode', @_ );
10221             my $okParams =
10222             {
10223             expandable => { allowed => $EXPANDABLES->{promotion_code} },
10224             id => { re => qr/^\S+$/, required => 1 }
10225             };
10226             my $err = $self->_check_parameters( $okParams, $args );
10227             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
10228             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No promotion code id was provided to retrieve its information." ) );
10229             my $hash = $self->get( "promotion_codes/${id}", $args ) || CORE::return( $self->pass_error );
10230             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Product::PromotionCode', $hash ) );
10231             }
10232             PERL
10233             # NOTE: promotion_code_update()
10234             promotion_code_update => <<'PERL',
10235             sub promotion_code_update
10236             {
10237             my $self = shift( @_ );
10238             CORE::return( $self->error( "No parameters were provided to update a promotion code" ) ) if( !scalar( @_ ) );
10239             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Product::PromotionCode', @_ );
10240             my $okParams =
10241             {
10242             expandable => { allowed => $EXPANDABLES->{promotion_code} },
10243             active => { type => "boolean" },
10244             id => { re => qr/^\S+$/, required => 1 },
10245             metadata => { type => "hash" },
10246             restrictions => { type => "hash" },
10247             };
10248              
10249             $args = $self->_contract( 'promotion_code', $args ) || CORE::return( $self->pass_error );
10250             # We found some errors
10251             my $err = $self->_check_parameters( $okParams, $args );
10252             # $self->message( 3, "Data to be posted: ", $self->dumper( $args ) ); exit;
10253             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
10254             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No promotion code id was provided to update its details" ) );
10255             my $hash = $self->post( "promotion_codes/${id}", $args ) || CORE::return( $self->pass_error );
10256             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Product::PromotionCode', $hash ) );
10257             }
10258             PERL
10259             # NOTE: promotion_codes()
10260             promotion_codes => <<'PERL',
10261             sub promotion_codes
10262             {
10263             my $self = shift( @_ );
10264             my $action = shift( @_ );
10265             my $allowed = [qw( create retrieve update list )];
10266             my $meth = $self->_get_method( 'promotion_code', $action, $allowed ) || CORE::return( $self->pass_error );
10267             CORE::return( $self->$meth( @_ ) );
10268             }
10269             PERL
10270             # NOTE: quote()
10271             quote => <<'PERL',
10272             sub quote { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Billing::Quote', @_ ) ); }
10273             PERL
10274             # NOTE: quote_accept()
10275             quote_accept => <<'PERL',
10276             sub quote_accept
10277             {
10278             my $self = shift( @_ );
10279             CORE::return( $self->error( "No parameters were provided to accept a quote." ) ) if( !scalar( @_ ) );
10280             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Billing::Quote', @_ );
10281             my $okParams =
10282             {
10283             expandable => { allowed => $EXPANDABLES->{quote} },
10284             id => { re => qr/^\w+$/, required => 1 },
10285             };
10286             my $err = $self->_check_parameters( $okParams, $args );
10287             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
10288             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No quote id was provided to accept it." ) );
10289             my $hash = $self->post( "quotes/${id}/accept", $args ) || CORE::return( $self->pass_error );
10290             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::Quote', $hash ) );
10291             }
10292             PERL
10293             # NOTE: quote_cancel()
10294             quote_cancel => <<'PERL',
10295             sub quote_cancel
10296             {
10297             my $self = shift( @_ );
10298             CORE::return( $self->error( "No parameters were provided to cancel a quote." ) ) if( !scalar( @_ ) );
10299             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Billing::Quote', @_ );
10300             my $okParams =
10301             {
10302             expandable => { allowed => $EXPANDABLES->{quote} },
10303             id => { re => qr/^\w+$/, required => 1 },
10304             };
10305             my $err = $self->_check_parameters( $okParams, $args );
10306             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
10307             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No quote id was provided to cancel it." ) );
10308             my $hash = $self->post( "quotes/${id}/cancel", $args ) || CORE::return( $self->pass_error );
10309             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::Quote', $hash ) );
10310             }
10311             PERL
10312             # NOTE: quote_create()
10313             quote_create => <<'PERL',
10314             sub quote_create
10315             {
10316             my $self = shift( @_ );
10317             CORE::return( $self->error( "No parameters were provided to create a quote" ) ) if( !scalar( @_ ) );
10318             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Billing::Quote', @_ );
10319             my $obj = $args->{_object};
10320             if( $self->_is_object( $args->{customer} ) && $args->{customer}->isa( 'Net::API::Stripe::Customer' ) )
10321             {
10322             $args->{customer} = $args->{customer}->id;
10323             }
10324             my $okParams =
10325             {
10326             expandable => { allowed => $EXPANDABLES->{quote} },
10327             application_fee_amount => { type => "integer" },
10328             application_fee_percent => { type => "decomal" },
10329             automatic_tax => { fields => ["enabled!"], type => "hash" },
10330             collection_method => { type => "string" },
10331             customer => { re => qr/^\w+$/, type => "string" },
10332             default_tax_rates => { type => "array" },
10333             description => { type => "string" },
10334             discounts => { fields => ["coupon", "discount"], type => "array" },
10335             expires_at => { type => "datetime" },
10336             footer => { type => "string" },
10337             from_quote => { fields => ["qoute!", "is_revision"], type => "hash" },
10338             header => { type => "string" },
10339             invoice_settings => { fields => ["days_until_due"], type => "hash" },
10340             line_items => {
10341             fields => [
10342             "price",
10343             "price_data",
10344             "price_data.currency!",
10345             "price_data.product!",
10346             "price_data.unit_amount_decimal!",
10347             "price_data.recurring.interval!",
10348             "price_data.recurring.interval_count",
10349             "price_data.tax_behavior",
10350             "price_data.unit_amount",
10351             "quantity",
10352             "tax_rates",
10353             ],
10354             type => "hash",
10355             },
10356             metadata => { type => "hash" },
10357             on_behalf_of => { re => qr/^\w+$/, type => "string" },
10358             subscription_data => { fields => ["effective_date", "trial_period_days"], type => "hash" },
10359             test_clock => { re => qr/^\w+$/, type => "string" },
10360             transfer_data => {
10361             fields => ["destination!", "amount", "amount_percent"],
10362             type => "hash",
10363             },
10364             };
10365              
10366             $args = $self->_contract( 'quote', $args ) || CORE::return( $self->pass_error );
10367             my $err = $self->_check_parameters( $okParams, $args );
10368             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
10369             my $hash = $self->post( 'quotes', $args ) || CORE::return( $self->pass_error );
10370             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::Quote', $hash ) );
10371             }
10372             PERL
10373             # NOTE: quote_download()
10374             quote_download => <<'PERL',
10375             sub quote_download
10376             {
10377             my $self = shift( @_ );
10378             CORE::return( $self->error( "No parameters were provided to download quote as pdf." ) ) if( !scalar( @_ ) );
10379             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Billing::Quote', @_ );
10380             my $okParams =
10381             {
10382             expandable => { allowed => $EXPANDABLES->{quote} },
10383             id => { re => qr/^\w+$/, required => 1 }
10384             };
10385             my $err = $self->_check_parameters( $okParams, $args );
10386             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
10387             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No quote id was provided to download it as pdf." ) );
10388             $args->{_file_api} = 1;
10389             my $hash = $self->get( "quotes/${id}/pdf", $args ) || CORE::return( $self->pass_error );
10390             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::Quote', $hash ) );
10391             }
10392             PERL
10393             # NOTE: quote_finalize()
10394             quote_finalize => <<'PERL',
10395             sub quote_finalize
10396             {
10397             my $self = shift( @_ );
10398             CORE::return( $self->error( "No parameters were provided to finalize a quote." ) ) if( !scalar( @_ ) );
10399             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Billing::Quote', @_ );
10400             my $okParams =
10401             {
10402             expandable => { allowed => $EXPANDABLES->{quote} },
10403             id => { re => qr/^\w+$/, required => 1 },
10404             expires_at => { type => 'datetime' },
10405             };
10406             my $err = $self->_check_parameters( $okParams, $args );
10407             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
10408             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No quote id was provided to finalize it." ) );
10409             my $hash = $self->post( "quotes/${id}/finalize", $args ) || CORE::return( $self->pass_error );
10410             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::Quote', $hash ) );
10411             }
10412             PERL
10413             # NOTE: quote_line_items()
10414             quote_line_items => <<'PERL',
10415             sub quote_line_items
10416             {
10417             my $self = shift( @_ );
10418             CORE::return( $self->error( "No parameters were provided to line_items quote information." ) ) if( !scalar( @_ ) );
10419             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Billing::Quote', @_ );
10420             my $okParams =
10421             {
10422             expandable => { allowed => $EXPANDABLES->{ 'quote' }, data_prefix_is_ok => 1 },
10423             ending_before => { type => "string" },
10424             limit => { type => "string" },
10425             starting_after => { type => "string" },
10426             };
10427             my $err = $self->_check_parameters( $okParams, $args );
10428             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
10429             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No quote id (with parameter 'id') was provided to line_items its information." ) );
10430             my $hash = $self->get( "quotes/${id}/line_items", $args ) || CORE::return( $self->pass_error );
10431             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::Quote', $hash ) );
10432             }
10433             PERL
10434             # NOTE: quote_lines()
10435             quote_lines => <<'PERL',
10436             sub quote_lines
10437             {
10438             my $self = shift( @_ );
10439             CORE::return( $self->error( "No parameters were provided to retrieve a quote line items." ) ) if( !scalar( @_ ) );
10440             my $args = $self->_get_args_as_hash( @_ );
10441             if( $self->_is_object( $args->{quote} ) && $args->{quote}->isa( 'Net::API::Stripe::Billing::Quote' ) )
10442             {
10443             $args->{id} = $args->{quote}->id;
10444             }
10445             my $okParams =
10446             {
10447             expandable => { allowed => $EXPANDABLES->{quote} },
10448             id => { re => qr/^\w+$/, required => 1 },
10449             ending_before => {},
10450             limit => { re => qr/^\d+$/ },
10451             starting_after => {},
10452             };
10453             my $err = $self->_check_parameters( $okParams, $args );
10454             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
10455             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No quote id was provided to retrieve its line items." ) );
10456             my $hash = $self->get( "quotes/${id}/line_items", $args ) || CORE::return( $self->pass_error );
10457             CORE::return( $self->_response_to_object( 'Net::API::Stripe::List', $hash ) );
10458             }
10459             PERL
10460             # NOTE: quote_list()
10461             quote_list => <<'PERL',
10462             sub quote_list
10463             {
10464             my $self = shift( @_ );
10465             my $args = $self->_get_args( @_ );
10466             if( $self->_is_object( $args->{customer} ) && $args->{customer}->isa( 'Net::API::Stripe::Customer' ) )
10467             {
10468             $args->{customer} = $args->{customer}->id;
10469             }
10470             my $okParams =
10471             {
10472             expandable => { allowed => $EXPANDABLES->{quote}, data_prefix_is_ok => 1 },
10473             customer => { re => qr/^\w+$/, type => "string" },
10474             ending_before => { type => "string" },
10475             limit => { re => qr/^\d+$/, type => "string" },
10476             starting_after => { type => "string" },
10477             status => { type => "string" },
10478             test_clock => { type => "string" },
10479             };
10480              
10481             my $err = $self->_check_parameters( $okParams, $args );
10482             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
10483             if( $args->{expand} )
10484             {
10485             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
10486             }
10487             my $hash = $self->get( 'quotes', $args ) || CORE::return( $self->pass_error );
10488             CORE::return( $self->_response_to_object( 'Net::API::Stripe::List', $hash ) );
10489             }
10490             PERL
10491             # NOTE: quote_retrieve()
10492             quote_retrieve => <<'PERL',
10493             sub quote_retrieve
10494             {
10495             my $self = shift( @_ );
10496             CORE::return( $self->error( "No parameters were provided to retrieve quote information." ) ) if( !scalar( @_ ) );
10497             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Billing::Quote', @_ );
10498             my $okParams =
10499             {
10500             expandable => { allowed => $EXPANDABLES->{quote} },
10501             id => { re => qr/^\w+$/, required => 1 }
10502             };
10503             my $err = $self->_check_parameters( $okParams, $args );
10504             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
10505             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No quote id was provided to retrieve its information." ) );
10506             my $hash = $self->get( "quotes/${id}", $args ) || CORE::return( $self->pass_error );
10507             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::Quote', $hash ) );
10508             }
10509             PERL
10510             # NOTE: quote_update()
10511             quote_update => <<'PERL',
10512             # https://stripe.com/docs/api/quotes/update
10513             sub quote_update
10514             {
10515             my $self = shift( @_ );
10516             CORE::return( $self->error( "No parameters were provided to update a quote" ) ) if( !scalar( @_ ) );
10517             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Billing::Quote', @_ );
10518             if( $self->_is_object( $args->{customer} ) && $args->{customer}->isa( 'Net::API::Stripe::Customer' ) )
10519             {
10520             $args->{customer} = $args->{customer}->id;
10521             }
10522             my $okParams =
10523             {
10524             expandable => { allowed => $EXPANDABLES->{quote} },
10525             application_fee_amount => { type => "integer" },
10526             application_fee_percent => { type => "decomal" },
10527             automatic_tax => { fields => ["enabled!"], type => "hash" },
10528             collection_method => { type => "string" },
10529             customer => { re => qr/^\w+$/, type => "string" },
10530             default_tax_rates => { type => "array" },
10531             description => { type => "string" },
10532             discounts => { fields => ["coupon", "discount"], type => "array" },
10533             expires_at => { type => "datetime" },
10534             footer => { type => "string" },
10535             from_quote => { fields => ["qoute!", "is_revision"] },
10536             header => { type => "string" },
10537             id => { required => 1 },
10538             invoice_settings => { fields => ["days_until_due"], type => "hash" },
10539             line_items => {
10540             fields => [
10541             "id",
10542             "price",
10543             "price_data",
10544             "price_data.currency!",
10545             "price_data.product!",
10546             "price_data.unit_amount_decimal!",
10547             "price_data.recurring.interval!",
10548             "price_data.recurring.interval_count",
10549             "price_data.tax_behavior",
10550             "price_data.unit_amount",
10551             "quantity",
10552             "tax_rates",
10553             ],
10554             type => "hash",
10555             },
10556             metadata => { type => "hash" },
10557             on_behalf_of => { re => qr/^\w+$/, type => "string" },
10558             subscription_data => { fields => ["effective_date", "trial_period_days"], type => "hash" },
10559             test_clock => { re => qr/^\w+$/ },
10560             transfer_data => {
10561             fields => ["destination!", "amount", "amount_percent"],
10562             type => "hash",
10563             },
10564             };
10565              
10566             $args = $self->_contract( 'quote', $args ) || CORE::return( $self->pass_error );
10567             # We found some errors
10568             my $err = $self->_check_parameters( $okParams, $args );
10569             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
10570             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No quote id was provided to update quote's details" ) );
10571             my $hash = $self->post( "quotes/${id}", $args ) || CORE::return( $self->pass_error );
10572             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::Quote', $hash ) );
10573             }
10574             PERL
10575             # NOTE: quote_upfront_line_items()
10576             quote_upfront_line_items => <<'PERL',
10577             sub quote_upfront_line_items
10578             {
10579             my $self = shift( @_ );
10580             CORE::return( $self->error( "No parameters were provided to upfront_line_items quote information." ) ) if( !scalar( @_ ) );
10581             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Billing::Quote', @_ );
10582             my $okParams =
10583             {
10584             expandable => { allowed => $EXPANDABLES->{ 'quote' }, data_prefix_is_ok => 1 },
10585             ending_before => { type => "string" },
10586             limit => { type => "string" },
10587             starting_after => { type => "string" },
10588             };
10589             my $err = $self->_check_parameters( $okParams, $args );
10590             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
10591             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No quote id (with parameter 'id') was provided to upfront_line_items its information." ) );
10592             my $hash = $self->get( "quotes/${id}", $args ) || CORE::return( $self->pass_error );
10593             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::Quote', $hash ) );
10594             }
10595             PERL
10596             # NOTE: quote_upfront_lines()
10597             quote_upfront_lines => <<'PERL',
10598             sub quote_upfront_lines
10599             {
10600             my $self = shift( @_ );
10601             CORE::return( $self->error( "No parameters were provided to retrieve a quote upfront line items." ) ) if( !scalar( @_ ) );
10602             my $args = $self->_get_args_as_hash( @_ );
10603             if( $self->_is_object( $args->{quote} ) && $args->{quote}->isa( 'Net::API::Stripe::Billing::Quote' ) )
10604             {
10605             $args->{id} = $args->{quote}->id;
10606             }
10607             my $okParams =
10608             {
10609             expandable => { allowed => $EXPANDABLES->{quote} },
10610             id => { re => qr/^\w+$/, required => 1 },
10611             ending_before => {},
10612             limit => { re => qr/^\d+$/ },
10613             starting_after => {},
10614             };
10615             my $err = $self->_check_parameters( $okParams, $args );
10616             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
10617             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No quote id was provided to retrieve its upfront line items." ) );
10618             my $hash = $self->get( "quotes/${id}/computed_upfront_line_items", $args ) || CORE::return( $self->pass_error );
10619             CORE::return( $self->_response_to_object( 'Net::API::Stripe::List', $hash ) );
10620             }
10621             PERL
10622             # NOTE: quotes()
10623             quotes => <<'PERL',
10624             # <https://stripe.com/docs/api/quotes>
10625             sub quotes
10626             {
10627             my $self = shift( @_ );
10628             my $allowed = [qw( accept cancel create download finalize line_items lines list retrieve update upfront_line_items upfront_lines )];
10629             my $action = shift( @_ );
10630             my $meth = $self->_get_method( 'quote', $action, $allowed ) || CORE::return( $self->pass_error );
10631             CORE::return( $self->$meth( @_ ) );
10632             }
10633             PERL
10634             # NOTE: radar_early_fraud_warning()
10635             radar_early_fraud_warning => <<'PERL',
10636             sub radar_early_fraud_warning { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Fraud', @_ ) ); }
10637             PERL
10638             # NOTE: radar_early_fraud_warning_list()
10639             radar_early_fraud_warning_list => <<'PERL',
10640             sub radar_early_fraud_warning_list
10641             {
10642             my $self = shift( @_ );
10643             CORE::return( $self->error( "No parameters were provided to list radar early fraud warning information." ) ) if( !scalar( @_ ) );
10644             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Fraud', @_ );
10645             my $okParams =
10646             {
10647             expandable => { allowed => $EXPANDABLES->{ 'radar.early_fraud_warning' }, data_prefix_is_ok => 1 },
10648             charge => { type => "string" },
10649             ending_before => { type => "string" },
10650             limit => { type => "string" },
10651             payment_intent => { type => "string" },
10652             starting_after => { type => "string" },
10653             };
10654             my $err = $self->_check_parameters( $okParams, $args );
10655             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
10656             if( $args->{expand} )
10657             {
10658             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
10659             }
10660             my $hash = $self->get( "", $args ) || CORE::return( $self->pass_error );
10661             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Fraud', $hash ) );
10662             }
10663             PERL
10664             # NOTE: radar_early_fraud_warning_retrieve()
10665             radar_early_fraud_warning_retrieve => <<'PERL',
10666             sub radar_early_fraud_warning_retrieve
10667             {
10668             my $self = shift( @_ );
10669             my $args = shift( @_ );
10670             my $okParams =
10671             {
10672             expandable => { allowed => $EXPANDABLES->{ 'radar.early_fraud_warning' }, data_prefix_is_ok => 1 },
10673             };
10674             $args = $self->_contract( 'radar.early_fraud_warning', $args ) || CORE::return( $self->pass_error );
10675             my $err = $self->_check_parameters( $okParams, $args );
10676             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
10677             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No radar.early_fraud_warning id (with parameter 'id') was provided to retrieve its information." ) );
10678             my $hash = $self->get( "radar/early_fraud_warnings/${id}", $args ) || CORE::return( $self->pass_error );
10679             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Fraud', $hash ) );
10680             }
10681             PERL
10682             # NOTE: radar_early_fraud_warnings()
10683             radar_early_fraud_warnings => <<'PERL',
10684             # <https://stripe.com/docs/api/radar/early_fraud_warnings>
10685             sub radar_early_fraud_warnings
10686             {
10687             my $self = shift( @_ );
10688             my $allowed = [qw( list retrieve )];
10689             my $action = shift( @_ );
10690             my $meth = $self->_get_method( 'radar_early_fraud_warning', $action, $allowed ) || CORE::return( $self->pass_error );
10691             CORE::return( $self->$meth( @_ ) );
10692             }
10693             PERL
10694             # NOTE: radar_value_list()
10695             radar_value_list => <<'PERL',
10696             sub radar_value_list { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Fraud::ValueList', @_ ) ); }
10697             PERL
10698             # NOTE: radar_value_list_create()
10699             radar_value_list_create => <<'PERL',
10700             sub radar_value_list_create
10701             {
10702             my $self = shift( @_ );
10703             my $args = shift( @_ );
10704             my $okParams =
10705             {
10706             expandable => { allowed => $EXPANDABLES->{ 'radar.value_list' } },
10707             alias => { type => "string", required => 1 },
10708             item_type => { type => "string" },
10709             metadata => { type => "hash" },
10710             name => { type => "string", required => 1 },
10711             };
10712             $args = $self->_contract( 'radar.value_list', $args ) || CORE::return( $self->pass_error );
10713             my $err = $self->_check_parameters( $okParams, $args );
10714             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
10715             my $hash = $self->post( "", $args ) || CORE::return( $self->pass_error );
10716             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Fraud::ValueList', $hash ) );
10717             }
10718             PERL
10719             # NOTE: radar_value_list_delete()
10720             radar_value_list_delete => <<'PERL',
10721             sub radar_value_list_delete
10722             {
10723             my $self = shift( @_ );
10724             my $args = shift( @_ );
10725             my $okParams =
10726             {
10727             expandable => { allowed => $EXPANDABLES->{ 'radar.value_list' } },
10728             };
10729             $args = $self->_contract( 'radar.value_list', $args ) || CORE::return( $self->pass_error );
10730             my $err = $self->_check_parameters( $okParams, $args );
10731             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
10732             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No radar.value_list id (with parameter 'id') was provided to delete its information." ) );
10733             my $hash = $self->delete( "radar/value_lists/${id}", $args ) || CORE::return( $self->pass_error );
10734             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Fraud::ValueList', $hash ) );
10735             }
10736             PERL
10737             # NOTE: radar_value_list_item()
10738             radar_value_list_item => <<'PERL',
10739             sub radar_value_list_item { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Fraud::ValueList::Item', @_ ) ); }
10740             PERL
10741             # NOTE: radar_value_list_item_create()
10742             radar_value_list_item_create => <<'PERL',
10743             sub radar_value_list_item_create
10744             {
10745             my $self = shift( @_ );
10746             my $args = shift( @_ );
10747             my $okParams =
10748             {
10749             expandable => { allowed => $EXPANDABLES->{ 'radar.value_list_item' } },
10750             value => { type => "string", required => 1 },
10751             value_list => { type => "string", required => 1 },
10752             };
10753             $args = $self->_contract( 'radar.value_list_item', $args ) || CORE::return( $self->pass_error );
10754             my $err = $self->_check_parameters( $okParams, $args );
10755             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
10756             my $hash = $self->post( "", $args ) || CORE::return( $self->pass_error );
10757             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Fraud::ValueList::Item', $hash ) );
10758             }
10759             PERL
10760             # NOTE: radar_value_list_item_delete()
10761             radar_value_list_item_delete => <<'PERL',
10762             sub radar_value_list_item_delete
10763             {
10764             my $self = shift( @_ );
10765             my $args = shift( @_ );
10766             my $okParams =
10767             {
10768             expandable => { allowed => $EXPANDABLES->{ 'radar.value_list_item' } },
10769             };
10770             $args = $self->_contract( 'radar.value_list_item', $args ) || CORE::return( $self->pass_error );
10771             my $err = $self->_check_parameters( $okParams, $args );
10772             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
10773             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No radar.value_list_item id (with parameter 'id') was provided to delete its information." ) );
10774             my $hash = $self->delete( "radar/value_list_items/${id}", $args ) || CORE::return( $self->pass_error );
10775             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Fraud::ValueList::Item', $hash ) );
10776             }
10777             PERL
10778             # NOTE: radar_value_list_item_list()
10779             radar_value_list_item_list => <<'PERL',
10780             sub radar_value_list_item_list
10781             {
10782             my $self = shift( @_ );
10783             CORE::return( $self->error( "No parameters were provided to list radar value list item information." ) ) if( !scalar( @_ ) );
10784             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Fraud::ValueList::Item', @_ );
10785             my $okParams =
10786             {
10787             expandable => { allowed => $EXPANDABLES->{ 'radar.value_list_item' }, data_prefix_is_ok => 1 },
10788             created => { type => "timestamp" },
10789             ending_before => { type => "string" },
10790             limit => { type => "string" },
10791             starting_after => { type => "string" },
10792             value => { type => "string" },
10793             value_list => { type => "string", required => 1 },
10794             };
10795             my $err = $self->_check_parameters( $okParams, $args );
10796             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
10797             if( $args->{expand} )
10798             {
10799             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
10800             }
10801             my $hash = $self->get( "", $args ) || CORE::return( $self->pass_error );
10802             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Fraud::ValueList::Item', $hash ) );
10803             }
10804             PERL
10805             # NOTE: radar_value_list_item_retrieve()
10806             radar_value_list_item_retrieve => <<'PERL',
10807             sub radar_value_list_item_retrieve
10808             {
10809             my $self = shift( @_ );
10810             my $args = shift( @_ );
10811             my $okParams =
10812             {
10813             expandable => { allowed => $EXPANDABLES->{ 'radar.value_list_item' }, data_prefix_is_ok => 1 },
10814             };
10815             $args = $self->_contract( 'radar.value_list_item', $args ) || CORE::return( $self->pass_error );
10816             my $err = $self->_check_parameters( $okParams, $args );
10817             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
10818             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No radar.value_list_item id (with parameter 'id') was provided to retrieve its information." ) );
10819             my $hash = $self->get( "radar/value_list_items/${id}", $args ) || CORE::return( $self->pass_error );
10820             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Fraud::ValueList::Item', $hash ) );
10821             }
10822             PERL
10823             # NOTE: radar_value_list_items()
10824             radar_value_list_items => <<'PERL',
10825             # <https://stripe.com/docs/api/radar/value_list_items>
10826             sub radar_value_list_items
10827             {
10828             my $self = shift( @_ );
10829             my $allowed = [qw( create delete list retrieve )];
10830             my $action = shift( @_ );
10831             my $meth = $self->_get_method( 'radar_value_list_item', $action, $allowed ) || CORE::return( $self->pass_error );
10832             CORE::return( $self->$meth( @_ ) );
10833             }
10834             PERL
10835             # NOTE: radar_value_list_list()
10836             radar_value_list_list => <<'PERL',
10837             sub radar_value_list_list
10838             {
10839             my $self = shift( @_ );
10840             CORE::return( $self->error( "No parameters were provided to list radar value list information." ) ) if( !scalar( @_ ) );
10841             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Fraud::ValueList', @_ );
10842             my $okParams =
10843             {
10844             expandable => { allowed => $EXPANDABLES->{ 'radar.value_list' }, data_prefix_is_ok => 1 },
10845             alias => { type => "string" },
10846             contains => { type => "string" },
10847             created => { type => "timestamp" },
10848             ending_before => { type => "string" },
10849             limit => { type => "string" },
10850             starting_after => { type => "string" },
10851             };
10852             my $err = $self->_check_parameters( $okParams, $args );
10853             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
10854             if( $args->{expand} )
10855             {
10856             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
10857             }
10858             my $hash = $self->get( "", $args ) || CORE::return( $self->pass_error );
10859             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Fraud::ValueList', $hash ) );
10860             }
10861             PERL
10862             # NOTE: radar_value_list_retrieve()
10863             radar_value_list_retrieve => <<'PERL',
10864             sub radar_value_list_retrieve
10865             {
10866             my $self = shift( @_ );
10867             my $args = shift( @_ );
10868             my $okParams =
10869             {
10870             expandable => { allowed => $EXPANDABLES->{ 'radar.value_list' }, data_prefix_is_ok => 1 },
10871             };
10872             $args = $self->_contract( 'radar.value_list', $args ) || CORE::return( $self->pass_error );
10873             my $err = $self->_check_parameters( $okParams, $args );
10874             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
10875             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No radar.value_list id (with parameter 'id') was provided to retrieve its information." ) );
10876             my $hash = $self->get( "radar/value_lists/${id}", $args ) || CORE::return( $self->pass_error );
10877             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Fraud::ValueList', $hash ) );
10878             }
10879             PERL
10880             # NOTE: radar_value_list_update()
10881             radar_value_list_update => <<'PERL',
10882             sub radar_value_list_update
10883             {
10884             my $self = shift( @_ );
10885             my $args = shift( @_ );
10886             my $okParams =
10887             {
10888             expandable => { allowed => $EXPANDABLES->{ 'radar.value_list' } },
10889             alias => { type => "string" },
10890             metadata => { type => "hash" },
10891             name => { type => "string" },
10892             };
10893             $args = $self->_contract( 'radar.value_list', $args ) || CORE::return( $self->pass_error );
10894             my $err = $self->_check_parameters( $okParams, $args );
10895             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
10896             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No radar.value_list id (with parameter 'id') was provided to update its information." ) );
10897             my $hash = $self->post( "radar/value_lists/${id}", $args ) || CORE::return( $self->pass_error );
10898             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Fraud::ValueList', $hash ) );
10899             }
10900             PERL
10901             # NOTE: radar_value_lists()
10902             radar_value_lists => <<'PERL',
10903             # <https://stripe.com/docs/api/radar/value_lists>
10904             sub radar_value_lists
10905             {
10906             my $self = shift( @_ );
10907             my $allowed = [qw( create delete list retrieve update )];
10908             my $action = shift( @_ );
10909             my $meth = $self->_get_method( 'radar_value_list', $action, $allowed ) || CORE::return( $self->pass_error );
10910             CORE::return( $self->$meth( @_ ) );
10911             }
10912             PERL
10913             # NOTE: reader()
10914             reader => <<'PERL',
10915             sub reader { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Terminal::Reader' ) ) }
10916             PERL
10917             # NOTE: receiver()
10918             receiver => <<'PERL',
10919             sub receiver { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Payment::Source::Receiver', @_ ) ); }
10920             PERL
10921             # NOTE: redirect()
10922             redirect => <<'PERL',
10923             sub redirect { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Payment::Source::Redirect', @_ ) ); }
10924             PERL
10925             # NOTE: refund()
10926             refund => <<'PERL',
10927             sub refund { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Refund', @_ ) ); }
10928             PERL
10929             # NOTE: refund_cancel()
10930             refund_cancel => <<'PERL',
10931             sub refund_cancel
10932             {
10933             my $self = shift( @_ );
10934             CORE::return( $self->error( "No parameters were provided to cancel a refund." ) ) if( !scalar( @_ ) );
10935             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Refund', @_ );
10936             my $okParams =
10937             {
10938             expandable => { allowed => $EXPANDABLES->{refund} },
10939             id => { re => qr/^\w+$/, required => 1 }
10940             };
10941             my $err = $self->_check_parameters( $okParams, $args );
10942             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
10943             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No refund id was provided to cancel." ) );
10944             my $hash = $self->post( "refunds/${id}/cancel", $args ) || CORE::return( $self->pass_error );
10945             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Refund', $hash ) );
10946             }
10947             PERL
10948             # NOTE: refund_create()
10949             refund_create => <<'PERL',
10950             sub refund_create
10951             {
10952             my $self = shift( @_ );
10953             CORE::return( $self->error( "No parameters were provided to create a payout" ) ) if( !scalar( @_ ) );
10954             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Refund', @_ );
10955             my $okParams =
10956             {
10957             expandable => { allowed => $EXPANDABLES->{refund} },
10958             amount => { required => 1, type => "integer" },
10959             charge => { re => qr/^\w+$/, type => "string" },
10960             metadata => { type => "hash" },
10961             payment_intent => { re => qr/^\w+$/, type => "string" },
10962             reason => {
10963             re => qr/^(duplicate|fraudulent|requested_by_customer)$/,
10964             type => "string",
10965             },
10966             refund_application_fee => { type => "boolean" },
10967             reverse_transfer => { type => "boolean" },
10968             };
10969              
10970             $args = $self->_contract( 'refund', $args ) || CORE::return( $self->pass_error );
10971             my $err = $self->_check_parameters( $okParams, $args );
10972             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
10973             my $hash = $self->post( 'refunds', $args ) || CORE::return( $self->pass_error );
10974             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Refund', $hash ) );
10975             }
10976             PERL
10977             # NOTE: refund_list()
10978             refund_list => <<'PERL',
10979             sub refund_list
10980             {
10981             my $self = shift( @_ );
10982             my $args = $self->_get_args( @_ );
10983             my $okParams =
10984             {
10985             expandable => { allowed => $EXPANDABLES->{refund}, data_prefix_is_ok => 1 },
10986             charge => { re => qr/^\w+$/, type => "string" },
10987             created => { re => qr/^\d+$/, type => "timestamp" },
10988             'created.gt' => { re => qr/^\d+$/ },
10989             'created.gte' => { re => qr/^\d+$/ },
10990             'created.lt' => { re => qr/^\d+$/ },
10991             'created.lte' => { re => qr/^\d+$/ },
10992             ending_before => { re => qr/^\w+$/, type => "string" },
10993             limit => { re => qr/^\d+$/, type => "string" },
10994             payment_intent => { re => qr/^\w+$/, type => "string" },
10995             starting_after => { re => qr/^\w+$/, type => "string" },
10996             };
10997              
10998             my $err = $self->_check_parameters( $okParams, $args );
10999             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
11000             if( $args->{expand} )
11001             {
11002             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
11003             }
11004             my $hash = $self->get( 'refunds', $args ) || CORE::return( $self->pass_error );
11005             CORE::return( $self->_response_to_object( 'Net::API::Stripe::List', $hash ) );
11006             }
11007             PERL
11008             # NOTE: refund_retrieve()
11009             refund_retrieve => <<'PERL',
11010             sub refund_retrieve
11011             {
11012             my $self = shift( @_ );
11013             CORE::return( $self->error( "No parameters were provided to retrieve refund information." ) ) if( !scalar( @_ ) );
11014             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Refund', @_ );
11015             my $okParams =
11016             {
11017             expandable => { allowed => $EXPANDABLES->{refund} },
11018             id => { re => qr/^\w+$/, required => 1 }
11019             };
11020             my $err = $self->_check_parameters( $okParams, $args );
11021             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
11022             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No refund id was provided to retrieve its information." ) );
11023             my $hash = $self->get( "refunds/${id}", $args ) || CORE::return( $self->pass_error );
11024             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Refund', $hash ) );
11025             }
11026             PERL
11027             # NOTE: refund_update()
11028             refund_update => <<'PERL',
11029             sub refund_update
11030             {
11031             my $self = shift( @_ );
11032             CORE::return( $self->error( "No parameters were provided to update a refund" ) ) if( !scalar( @_ ) );
11033             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Refund', @_ );
11034             my $okParams =
11035             {
11036             expandable => { allowed => $EXPANDABLES->{refund} },
11037             id => { re => qr/^\w+$/, required => 1 },
11038             metadata => { type => 'hash' },
11039             };
11040             $args = $self->_contract( 'refund', $args ) || CORE::return( $self->pass_error );
11041             my $err = $self->_check_parameters( $okParams, $args );
11042             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
11043             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No refund id was provided to update its details" ) );
11044             my $hash = $self->post( "refunds/${id}", $args ) || CORE::return( $self->pass_error );
11045             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Refund', $hash ) );
11046             }
11047             PERL
11048             # NOTE: refunds()
11049             refunds => <<'PERL',
11050             sub refunds
11051             {
11052             my $self = shift( @_ );
11053             my $action = shift( @_ );
11054             my $allowed = [qw( create retrieve update cancel list )];
11055             my $meth = $self->_get_method( 'refund', $action, $allowed ) || CORE::return( $self->pass_error );
11056             CORE::return( $self->$meth( @_ ) );
11057             }
11058             PERL
11059             # NOTE: relationship()
11060             relationship => <<'PERL',
11061             sub relationship { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Connect::Account::Relationship', @_ ) ); }
11062             PERL
11063             # NOTE: reporting_report_run()
11064             reporting_report_run => <<'PERL',
11065             sub reporting_report_run { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Reporting::ReportRun', @_ ) ); }
11066             PERL
11067             # NOTE: reporting_report_run_create()
11068             reporting_report_run_create => <<'PERL',
11069             sub reporting_report_run_create
11070             {
11071             my $self = shift( @_ );
11072             my $args = shift( @_ );
11073             my $okParams =
11074             {
11075             expandable => { allowed => $EXPANDABLES->{ 'reporting.report_run' } },
11076             parameters => { type => "hash" },
11077             report_type => { type => "string", required => 1 },
11078             };
11079             $args = $self->_contract( 'reporting.report_run', $args ) || CORE::return( $self->pass_error );
11080             my $err = $self->_check_parameters( $okParams, $args );
11081             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
11082             my $hash = $self->post( "", $args ) || CORE::return( $self->pass_error );
11083             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Reporting::ReportRun', $hash ) );
11084             }
11085             PERL
11086             # NOTE: reporting_report_run_list()
11087             reporting_report_run_list => <<'PERL',
11088             sub reporting_report_run_list
11089             {
11090             my $self = shift( @_ );
11091             CORE::return( $self->error( "No parameters were provided to list reporting report run information." ) ) if( !scalar( @_ ) );
11092             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Reporting::ReportRun', @_ );
11093             my $okParams =
11094             {
11095             expandable => { allowed => $EXPANDABLES->{ 'reporting.report_run' }, data_prefix_is_ok => 1 },
11096             created => { type => "timestamp" },
11097             ending_before => { type => "string" },
11098             limit => { type => "string" },
11099             starting_after => { type => "string" },
11100             };
11101             my $err = $self->_check_parameters( $okParams, $args );
11102             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
11103             if( $args->{expand} )
11104             {
11105             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
11106             }
11107             my $hash = $self->get( "", $args ) || CORE::return( $self->pass_error );
11108             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Reporting::ReportRun', $hash ) );
11109             }
11110             PERL
11111             # NOTE: reporting_report_run_retrieve()
11112             reporting_report_run_retrieve => <<'PERL',
11113             sub reporting_report_run_retrieve
11114             {
11115             my $self = shift( @_ );
11116             my $args = shift( @_ );
11117             my $okParams =
11118             {
11119             expandable => { allowed => $EXPANDABLES->{ 'reporting.report_run' }, data_prefix_is_ok => 1 },
11120             };
11121             $args = $self->_contract( 'reporting.report_run', $args ) || CORE::return( $self->pass_error );
11122             my $err = $self->_check_parameters( $okParams, $args );
11123             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
11124             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No reporting.report_run id (with parameter 'id') was provided to retrieve its information." ) );
11125             my $hash = $self->get( "reporting/report_runs/${id}", $args ) || CORE::return( $self->pass_error );
11126             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Reporting::ReportRun', $hash ) );
11127             }
11128             PERL
11129             # NOTE: reporting_report_runs()
11130             reporting_report_runs => <<'PERL',
11131             # <https://stripe.com/docs/api/reporting/report_run>
11132             sub reporting_report_runs
11133             {
11134             my $self = shift( @_ );
11135             my $allowed = [qw( create list retrieve )];
11136             my $action = shift( @_ );
11137             my $meth = $self->_get_method( 'reporting_report_run', $action, $allowed ) || CORE::return( $self->pass_error );
11138             CORE::return( $self->$meth( @_ ) );
11139             }
11140             PERL
11141             # NOTE: reporting_report_type()
11142             reporting_report_type => <<'PERL',
11143             sub reporting_report_type { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Reporting::ReportType', @_ ) ); }
11144             PERL
11145             # NOTE: reporting_report_type_list()
11146             reporting_report_type_list => <<'PERL',
11147             sub reporting_report_type_list
11148             {
11149             my $self = shift( @_ );
11150             CORE::return( $self->error( "No parameters were provided to list reporting report type information." ) ) if( !scalar( @_ ) );
11151             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Reporting::ReportType', @_ );
11152             my $okParams =
11153             {
11154             expandable => { allowed => $EXPANDABLES->{ 'reporting.report_type' }, data_prefix_is_ok => 1 },
11155             };
11156             my $err = $self->_check_parameters( $okParams, $args );
11157             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
11158             if( $args->{expand} )
11159             {
11160             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
11161             }
11162             my $hash = $self->get( "", $args ) || CORE::return( $self->pass_error );
11163             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Reporting::ReportType', $hash ) );
11164             }
11165             PERL
11166             # NOTE: reporting_report_type_retrieve()
11167             reporting_report_type_retrieve => <<'PERL',
11168             sub reporting_report_type_retrieve
11169             {
11170             my $self = shift( @_ );
11171             my $args = shift( @_ );
11172             my $okParams =
11173             {
11174             expandable => { allowed => $EXPANDABLES->{ 'reporting.report_type' }, data_prefix_is_ok => 1 },
11175             };
11176             $args = $self->_contract( 'reporting.report_type', $args ) || CORE::return( $self->pass_error );
11177             my $err = $self->_check_parameters( $okParams, $args );
11178             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
11179             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No reporting.report_type id (with parameter 'id') was provided to retrieve its information." ) );
11180             my $hash = $self->get( "reporting/report_types/${id}", $args ) || CORE::return( $self->pass_error );
11181             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Reporting::ReportType', $hash ) );
11182             }
11183             PERL
11184             # NOTE: reporting_report_types()
11185             reporting_report_types => <<'PERL',
11186             # <https://stripe.com/docs/api/reporting/report_type>
11187             sub reporting_report_types
11188             {
11189             my $self = shift( @_ );
11190             my $allowed = [qw( list retrieve )];
11191             my $action = shift( @_ );
11192             my $meth = $self->_get_method( 'reporting_report_type', $action, $allowed ) || CORE::return( $self->pass_error );
11193             CORE::return( $self->$meth( @_ ) );
11194             }
11195             PERL
11196             # NOTE: request()
11197             request => <<'PERL',
11198             sub request { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Event::Request', @_ ) ); }
11199             PERL
11200             # NOTE: requirements()
11201             requirements => <<'PERL',
11202             sub requirements { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Connect::Account::Requirements', @_ ) ); }
11203             PERL
11204             # NOTE: return()
11205             return => <<'PERL',
11206             sub return { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Order::Return' ) ) }
11207             PERL
11208             # NOTE: review()
11209             review => <<'PERL',
11210             sub review { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Fraud::Review', @_ ) ); }
11211             PERL
11212             # NOTE: review_approve()
11213             review_approve => <<'PERL',
11214             sub review_approve
11215             {
11216             my $self = shift( @_ );
11217             my $args = shift( @_ );
11218             my $okParams =
11219             {
11220             expandable => { allowed => $EXPANDABLES->{ 'review' } },
11221             };
11222             $args = $self->_contract( 'review', $args ) || CORE::return( $self->pass_error );
11223             my $err = $self->_check_parameters( $okParams, $args );
11224             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
11225             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No review id (with parameter 'id') was provided to approve its information." ) );
11226             my $hash = $self->post( "reviews/${id}", $args ) || CORE::return( $self->pass_error );
11227             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Fraud::Review', $hash ) );
11228             }
11229             PERL
11230             # NOTE: review_list()
11231             review_list => <<'PERL',
11232             sub review_list
11233             {
11234             my $self = shift( @_ );
11235             CORE::return( $self->error( "No parameters were provided to list review information." ) ) if( !scalar( @_ ) );
11236             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Fraud::Review', @_ );
11237             my $okParams =
11238             {
11239             expandable => { allowed => $EXPANDABLES->{ 'review' }, data_prefix_is_ok => 1 },
11240             created => { type => "timestamp" },
11241             ending_before => { type => "string" },
11242             limit => { type => "string" },
11243             starting_after => { type => "string" },
11244             };
11245             my $err = $self->_check_parameters( $okParams, $args );
11246             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
11247             if( $args->{expand} )
11248             {
11249             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
11250             }
11251             my $hash = $self->get( "reviews", $args ) || CORE::return( $self->pass_error );
11252             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Fraud::Review', $hash ) );
11253             }
11254             PERL
11255             # NOTE: review_retrieve()
11256             review_retrieve => <<'PERL',
11257             sub review_retrieve
11258             {
11259             my $self = shift( @_ );
11260             my $args = shift( @_ );
11261             my $okParams =
11262             {
11263             expandable => { allowed => $EXPANDABLES->{ 'review' }, data_prefix_is_ok => 1 },
11264             };
11265             $args = $self->_contract( 'review', $args ) || CORE::return( $self->pass_error );
11266             my $err = $self->_check_parameters( $okParams, $args );
11267             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
11268             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No review id (with parameter 'id') was provided to retrieve its information." ) );
11269             my $hash = $self->get( "reviews/${id}", $args ) || CORE::return( $self->pass_error );
11270             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Fraud::Review', $hash ) );
11271             }
11272             PERL
11273             # NOTE: reviews()
11274             reviews => <<'PERL',
11275             # <https://stripe.com/docs/api/radar/reviews>
11276             sub reviews
11277             {
11278             my $self = shift( @_ );
11279             my $allowed = [qw( approve list retrieve )];
11280             my $action = shift( @_ );
11281             my $meth = $self->_get_method( 'review', $action, $allowed ) || CORE::return( $self->pass_error );
11282             CORE::return( $self->$meth( @_ ) );
11283             }
11284             PERL
11285             # NOTE: schedule()
11286             schedule => <<'PERL',
11287             sub schedule { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Billing::Subscription::Schedule', @_ ) ); }
11288             PERL
11289             # NOTE: schedule_cancel()
11290             schedule_cancel => <<'PERL',
11291             # https://stripe.com/docs/api/subscription_schedules/cancel?lang=curl
11292             # "Cancels a subscription schedule and its associated subscription immediately (if the subscription schedule has an active subscription). A subscription schedule can only be canceled if its status is not_started or active."
11293             sub schedule_cancel
11294             {
11295             my $self = shift( @_ );
11296             CORE::return( $self->error( "No parameters were provided to cancel subscription schedule information." ) ) if( !scalar( @_ ) );
11297             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Billing::Subscription::Schedule', @_ );
11298             my $okParams =
11299             {
11300             expandable => { allowed => $EXPANDABLES->{schedule} },
11301             id => { re => qr/^\w+$/, required => 1 },
11302             # "If the subscription schedule is active, indicates whether or not to generate a final invoice that contains any un-invoiced metered usage and new/pending proration invoice items. Defaults to true."
11303             invoice_now => { type => 'boolean' },
11304             # "If the subscription schedule is active, indicates if the cancellation should be prorated. Defaults to true."
11305             prorate => { type => 'boolean' },
11306             };
11307             my $err = $self->_check_parameters( $okParams, $args );
11308             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
11309             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No subscription schedule id was provided to cancel." ) );
11310             my $hash = $self->post( "subscription_schedules/${id}/cancel", $args ) || CORE::return( $self->pass_error );
11311             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::Subscription::Schedule', $hash ) );
11312             }
11313             PERL
11314             # NOTE: schedule_create()
11315             schedule_create => <<'PERL',
11316             sub schedule_create
11317             {
11318             my $self = shift( @_ );
11319             CORE::return( $self->error( "No parameters were provided to create a subscription schedule" ) ) if( !scalar( @_ ) );
11320             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Billing::Subscription::Schedule', @_ );
11321             my $okParams =
11322             {
11323             expandable => { allowed => $EXPANDABLES->{schedule} },
11324             customer => {},
11325             default_settings => { fields => [qw( billing_thresholds.amount_gte billing_thresholds.reset_billing_cycle_anchor collection_method default_payment_method invoice_settings.days_until_due )] },
11326             end_behavior => { re => qr/^(release|cancel)$/ },
11327             from_subscription => {},
11328             metadata => {},
11329             phases => { type => 'array', fields => [qw(
11330             add_invoice_items.price
11331             add_invoice_items.price_data.currency!
11332             add_invoice_items.price_data.product!
11333             add_invoice_items.price_data.unit_amount_decimal
11334             add_invoice_items.price_data.unit_amount
11335             add_invoice_items.quantity
11336             add_invoice_items.tax_rates
11337            
11338             application_fee_percent
11339              
11340             billing_cycle_anchor
11341            
11342             billing_thresholds.amount_gte
11343             billing_thresholds.reset_billing_cycle_anchor
11344            
11345             collection_method
11346            
11347             coupon
11348            
11349             default_payment_method
11350            
11351             default_tax_rates
11352              
11353             end_date
11354            
11355             invoice_settings.days_until_due
11356            
11357             items!
11358             items.billing_thresholds.usage_gte!
11359             items.price
11360             items.price_data.currency!
11361             items.price_data.product!
11362             items.price_data.recurring!
11363             items.price_data.recurring.interval!
11364             items.price_data.recurring.interval_count
11365             items.price_data.unit_amount_decimal
11366             items.price_data.unit_amount
11367             items.quantity
11368             items.tax_rates
11369            
11370             iterations
11371            
11372             plans.plan
11373             plans.billing_thresholds.usage_gte
11374             plans.quantity
11375             plans.tax_rates
11376            
11377             proration_behavior
11378            
11379             tax_percent
11380            
11381             transfer_data.destination!
11382             transfer_data.amount_percent
11383            
11384             trial
11385             trial_end
11386             )]},
11387             start_date => { type => 'datetime' },
11388             };
11389            
11390             my $obj = $args->{_object};
11391             if( $obj && !length( $args->{start_date} ) && $obj->current_phase->start_date )
11392             {
11393             $args->{start_date} = $obj->current_phase->start_date->epoch;
11394             }
11395             $args = $self->_contract( 'schedule', $args ) || CORE::return( $self->pass_error );
11396             my $err = $self->_check_parameters( $okParams, $args );
11397             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
11398             my $hash = $self->post( 'subscription_schedules', $args ) || CORE::return( $self->pass_error );
11399             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::Subscription::Schedule', $hash ) );
11400             }
11401             PERL
11402             # NOTE: schedule_list()
11403             schedule_list => <<'PERL',
11404             sub schedule_list
11405             {
11406             my $self = shift( @_ );
11407             my $args = shift( @_ );
11408             my $okParams =
11409             {
11410             expandable => { allowed => $EXPANDABLES->{schedule}, data_prefix_is_ok => 1 },
11411             'canceled_at' => { re => qr/^\d+$/ },
11412             'canceled_at.gt' => { re => qr/^\d+$/ },
11413             'canceled_at.gte' => { re => qr/^\d+$/ },
11414             'canceled_at.lt' => { re => qr/^\d+$/ },
11415             'canceled_at.lte' => { re => qr/^\d+$/ },
11416             'completed_at' => { re => qr/^\d+$/ },
11417             'completed_at.gt' => { re => qr/^\d+$/ },
11418             'completed_at.gte' => { re => qr/^\d+$/ },
11419             'completed_at.lt' => { re => qr/^\d+$/ },
11420             'completed_at.lte' => { re => qr/^\d+$/ },
11421             'created' => { re => qr/^\d+$/ },
11422             'created.gt' => { re => qr/^\d+$/ },
11423             'created.gte' => { re => qr/^\d+$/ },
11424             'created.lt' => { re => qr/^\d+$/ },
11425             'created.lte' => { re => qr/^\d+$/ },
11426             'customer' => {},
11427             # "A cursor for use in pagination. ending_before is an object ID that defines your place in the list."
11428             'ending_before' => {},
11429             'limit' => { re => qr/^\d+$/ },
11430             'released_at' => { re => qr/^\d+$/ },
11431             'released_at.gt' => { re => qr/^\d+$/ },
11432             'released_at.gte' => { re => qr/^\d+$/ },
11433             'released_at.lt' => { re => qr/^\d+$/ },
11434             'released_at.lte' => { re => qr/^\d+$/ },
11435             'scheduled' => { type => 'boolean' },
11436             'starting_after' => {},
11437             };
11438             my $err = $self->_check_parameters( $okParams, $args );
11439             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
11440             if( $args->{expand} )
11441             {
11442             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
11443             }
11444             my $hash = $self->get( 'subscription_schedules', $args ) || CORE::return( $self->pass_error );
11445             CORE::return( $self->_response_to_object( 'Net::API::Stripe::List', $hash ) );
11446             }
11447             PERL
11448             # NOTE: schedule_query()
11449             schedule_query => <<'PERL',
11450             # sub session { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Session', @_ ) ); }
11451             sub schedule_query { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Sigma::ScheduledQueryRun' ) ) }
11452             PERL
11453             # NOTE: schedule_release()
11454             schedule_release => <<'PERL',
11455             # "Releases the subscription schedule immediately, which will stop scheduling of its phases, but leave any existing subscription in place. A schedule can only be released if its status is not_started or active. If the subscription schedule is currently associated with a subscription, releasing it will remove its subscription property and set the subscription’s ID to the released_subscription property."
11456             # https://stripe.com/docs/api/subscription_schedules/release
11457             sub schedule_release
11458             {
11459             my $self = shift( @_ );
11460             CORE::return( $self->error( "No parameters were provided to retrieve subscription schedule information." ) ) if( !scalar( @_ ) );
11461             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Billing::Subscription::Schedule', @_ );
11462             my $okParams =
11463             {
11464             expandable => { allowed => $EXPANDABLES->{schedule} },
11465             id => { re => qr/^\w+$/, required => 1 },
11466             preserve_cancel_date => { type => 'boolean' },
11467             };
11468             my $err = $self->_check_parameters( $okParams, $args );
11469             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
11470             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No subscription schedule id was provided to retrieve its information." ) );
11471             my $hash = $self->post( "subscription_schedules/${id}/release", $args ) || CORE::return( $self->pass_error );
11472             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::Subscription::Schedule', $hash ) );
11473             }
11474             PERL
11475             # NOTE: schedule_retrieve()
11476             schedule_retrieve => <<'PERL',
11477             sub schedule_retrieve
11478             {
11479             my $self = shift( @_ );
11480             CORE::return( $self->error( "No parameters were provided to retrieve subscription schedule information." ) ) if( !scalar( @_ ) );
11481             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Billing::Subscription::Schedule', @_ );
11482             my $okParams =
11483             {
11484             expandable => { allowed => $EXPANDABLES->{schedule} },
11485             id => { re => qr/^\w+$/, required => 1 }
11486             };
11487             my $err = $self->_check_parameters( $okParams, $args );
11488             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
11489             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No subscription schedule id was provided to retrieve its information." ) );
11490             my $hash = $self->get( "subscription_schedules/${id}", $args ) || CORE::return( $self->pass_error );
11491             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::Subscription::Schedule', $hash ) );
11492             }
11493             PERL
11494             # NOTE: schedule_update()
11495             schedule_update => <<'PERL',
11496             # https://stripe.com/docs/api/customers/update?lang=curl
11497             sub schedule_update
11498             {
11499             my $self = shift( @_ );
11500             CORE::return( $self->error( "No parameters were provided to update a subscription schedule" ) ) if( !scalar( @_ ) );
11501             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Billing::Subscription::Schedule', @_ );
11502             my $okParams =
11503             {
11504             expandable => { allowed => $EXPANDABLES->{schedule} },
11505             id => { re => qr/^\w+$/, required => 1 },
11506             default_settings => { fields => [qw( billing_thresholds.amount_gte billing_thresholds.reset_billing_cycle_anchor collection_method default_payment_method invoice_settings.days_until_due )] },
11507             end_behavior => { re => qr/^(release|cancel)$/ },
11508             from_subscription => {},
11509             metadata => { type => 'hash' },
11510             phases => { type => 'array', fields => [qw(
11511             add_invoice_items.price
11512             add_invoice_items.price_data.currency!
11513             add_invoice_items.price_data.product!
11514             add_invoice_items.price_data.unit_amount_decimal
11515             add_invoice_items.price_data.unit_amount
11516             add_invoice_items.quantity
11517             add_invoice_items.tax_rates
11518            
11519             application_fee_percent
11520            
11521             billing_cycle_anchor
11522            
11523             billing_thresholds.amount_gte
11524             billing_thresholds.reset_billing_cycle_anchor
11525            
11526             collection_method
11527             coupon
11528              
11529             default_payment_method
11530             default_tax_rates
11531              
11532             end_date
11533            
11534             invoice_settings.days_until_due
11535            
11536             items!
11537             items.billing_thresholds
11538             items.billing_thresholds.usage_gte!
11539             items.price
11540             items.price_data.currency!
11541             items.price_data.product!
11542             items.price_data.recurring!
11543             items.price_data.recurring.interval!
11544             items.price_data.recurring.interval_count
11545             items.price_data.unit_amount_decimal
11546             items.price_data.unit_amount
11547             items.quantity
11548             items.tax_rates
11549            
11550             iterations
11551            
11552             plans.plan
11553             plans.billing_thresholds.usage_gte
11554             plans.quantity
11555             plans.tax_rates
11556            
11557             proration_behavior
11558            
11559             start_date
11560            
11561             tax_percent
11562            
11563             transfer_data.destination!
11564             transfer_data.amount_percent
11565            
11566             trial
11567             trial_end
11568             )]},
11569             prorate => { type => 'boolean' },
11570             proration_behavior => { type => 'scalar' },
11571             start_date => { type => 'datetime' },
11572             };
11573             $args = $self->_contract( 'schedule', $args ) || CORE::return( $self->pass_error );
11574             # We found some errors
11575             my $err = $self->_check_parameters( $okParams, $args );
11576             # $self->message( 3, "Data to be posted: ", $self->dumper( $args ) ); exit;
11577             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
11578             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No subscription schedule id was provided to update subscription schedule's details" ) );
11579             my $hash = $self->post( "subscription_schedules/${id}", $args ) || CORE::return( $self->pass_error );
11580             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::Subscription::Schedule', $hash ) );
11581             }
11582             PERL
11583             # NOTE: scheduled_query_run()
11584             scheduled_query_run => <<'PERL',
11585             sub scheduled_query_run { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Sigma::ScheduledQueryRun', @_ ) ); }
11586             PERL
11587             # NOTE: scheduled_query_run_list()
11588             scheduled_query_run_list => <<'PERL',
11589             sub scheduled_query_run_list
11590             {
11591             my $self = shift( @_ );
11592             CORE::return( $self->error( "No parameters were provided to list scheduled query run information." ) ) if( !scalar( @_ ) );
11593             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Sigma::ScheduledQueryRun', @_ );
11594             my $okParams =
11595             {
11596             expandable => { allowed => $EXPANDABLES->{ 'scheduled_query_run' }, data_prefix_is_ok => 1 },
11597             ending_before => { type => "string" },
11598             limit => { type => "string" },
11599             starting_after => { type => "string" },
11600             };
11601             my $err = $self->_check_parameters( $okParams, $args );
11602             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
11603             if( $args->{expand} )
11604             {
11605             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
11606             }
11607             my $hash = $self->get( "sigma/scheduled_query_runs", $args ) || CORE::return( $self->pass_error );
11608             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Sigma::ScheduledQueryRun', $hash ) );
11609             }
11610             PERL
11611             # NOTE: scheduled_query_run_retrieve()
11612             scheduled_query_run_retrieve => <<'PERL',
11613             sub scheduled_query_run_retrieve
11614             {
11615             my $self = shift( @_ );
11616             my $args = shift( @_ );
11617             my $okParams =
11618             {
11619             expandable => { allowed => $EXPANDABLES->{ 'scheduled_query_run' }, data_prefix_is_ok => 1 },
11620             };
11621             $args = $self->_contract( 'scheduled_query_run', $args ) || CORE::return( $self->pass_error );
11622             my $err = $self->_check_parameters( $okParams, $args );
11623             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
11624             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No scheduled_query_run id (with parameter 'id') was provided to retrieve its information." ) );
11625             my $hash = $self->get( "sigma/scheduled_query_runs/${id}", $args ) || CORE::return( $self->pass_error );
11626             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Sigma::ScheduledQueryRun', $hash ) );
11627             }
11628             PERL
11629             # NOTE: scheduled_query_runs()
11630             scheduled_query_runs => <<'PERL',
11631             # <https://stripe.com/docs/api/sigma/scheduled_queries>
11632             sub scheduled_query_runs
11633             {
11634             my $self = shift( @_ );
11635             my $allowed = [qw( list retrieve )];
11636             my $action = shift( @_ );
11637             my $meth = $self->_get_method( 'scheduled_query_run', $action, $allowed ) || CORE::return( $self->pass_error );
11638             CORE::return( $self->$meth( @_ ) );
11639             }
11640             PERL
11641             # NOTE: schedules()
11642             schedules => <<'PERL',
11643             sub schedules
11644             {
11645             my $self = shift( @_ );
11646             my $action = shift( @_ );
11647             my $allowed = [qw( create retrieve update list cancel release )];
11648             my $meth = $self->_get_method( 'schedule', $action, $allowed ) || CORE::return( $self->pass_error );
11649             CORE::return( $self->$meth( @_ ) );
11650             }
11651             PERL
11652             # NOTE: session()
11653             session => <<'PERL',
11654             sub session { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Checkout::Session', @_ ) ); }
11655             PERL
11656             # NOTE: session_create()
11657             session_create => <<'PERL',
11658             # https://stripe.com/docs/api/checkout/sessions/create
11659             # https://stripe.com/docs/payments/checkout/fulfillment#webhooks
11660             # See webhook event checkout.session.completed
11661             sub session_create
11662             {
11663             my $self = shift( @_ );
11664             CORE::return( $self->error( "No parameters were provided to create a checkout session" ) ) if( !scalar( @_ ) );
11665             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Checkout::Session', @_ );
11666             my $okParams =
11667             {
11668             expandable => { allowed => $EXPANDABLES->{session} },
11669             cancel_url => { required => 1 },
11670             payment_method_types => { required => 1, re => qr/^(card|ideal)$/ },
11671             success_url => { required => 1 },
11672             billing_address_collection => { re => qr/^(auto|required)$/ },
11673             client_reference_id => {},
11674             # ID of an existing customer, if one exists.
11675             customer => {},
11676             customer_email => {},
11677             # array of hash reference
11678             line_items => { type => 'array', fields => [qw( amount currency name quantity description images )] },
11679             locale => { re => qr/^(local|[a-z]{2})$/ },
11680             mode => { re => qr/^(setup|subscription)$/ },
11681             payment_intent_data => { fields => [qw( application_fee_amount capture_method description metadata on_behalf_of receipt_email setup_future_usage shipping.address.line1 shipping.address.line2 shipping.address.city shipping.address.country shipping.address.postal_code shipping.address.state shipping.name shipping.carrier shipping.phone shipping.tracking_number statement_descriptor transfer_data.destination )] },
11682             setup_intent_data => { fields => [qw( description metadata on_behalf_of )] },
11683             submit_type => { re => qr/^(auto|book|donate|pay)$/ },
11684             subscription_data => { fields => [qw( items.plan items.quantity application_fee_percent metadata trial_end trial_from_plan trial_period_days )] },
11685             };
11686             $args = $self->_contract( 'session', $args ) || CORE::return( $self->pass_error );
11687             my $err = $self->_check_parameters( $okParams, $args );
11688             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
11689             my $hash = $self->post( 'checkout/sessions', $args ) || CORE::return( $self->pass_error );
11690             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Checkout::Session', $hash ) );
11691             }
11692             PERL
11693             # NOTE: session_expire()
11694             session_expire => <<'PERL',
11695             sub session_expire
11696             {
11697             my $self = shift( @_ );
11698             my $args = shift( @_ ) || CORE::return( $self->error( "No parameters were provided to expire a checkout session" ) );
11699             my $okParams =
11700             {
11701             expandable => { allowed => $EXPANDABLES->{session} },
11702             id => { re => qr/^\w+$/, required => 1 },
11703             };
11704             my $err = $self->_check_parameters( $okParams, $args );
11705             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
11706             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No tax id was provided to retrieve its details" ) );
11707             my $hash = $self->get( "checkout/sessions/${id}/expire", $args ) || CORE::return( $self->pass_error );
11708             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Checkout::Session', $hash ) );
11709             }
11710             PERL
11711             # NOTE: session_list()
11712             session_list => <<'PERL',
11713             sub session_list
11714             {
11715             my $self = shift( @_ );
11716             my $args = shift( @_ );
11717             my $okParams =
11718             {
11719             expandable => { allowed => $EXPANDABLES->{session}, data_prefix_is_ok => 1 },
11720             # "A cursor for use in pagination. ending_before is an object ID that defines your place in the list."
11721             'ending_before' => {},
11722             'limit' => { re => qr/^\d+$/ },
11723             'payment_intent' => { type => 'scalar' },
11724             'subscription' => { re => qr/^\w+$/ },
11725             'starting_after' => {},
11726             };
11727             my $err = $self->_check_parameters( $okParams, $args );
11728             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
11729             if( $args->{expand} )
11730             {
11731             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
11732             }
11733             my $hash = $self->get( 'checkout/sessions', $args ) || CORE::return( $self->pass_error );
11734             CORE::return( $self->_response_to_object( 'Net::API::Stripe::List', $hash ) );
11735             }
11736             PERL
11737             # NOTE: session_retrieve()
11738             session_retrieve => <<'PERL',
11739             sub session_retrieve
11740             {
11741             my $self = shift( @_ );
11742             my $args = shift( @_ ) || CORE::return( $self->error( "No parameters were provided to retrieve a checkout session" ) );
11743             my $okParams =
11744             {
11745             expandable => { allowed => $EXPANDABLES->{session} },
11746             id => { re => qr/^\w+$/, required => 1 },
11747             };
11748             my $err = $self->_check_parameters( $okParams, $args );
11749             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
11750             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No checkout session id was provided to retrieve its details" ) );
11751             my $hash = $self->get( "checkout/sessions/${id}", $args ) || CORE::return( $self->pass_error );
11752             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Checkout::Session', $hash ) );
11753             }
11754             PERL
11755             # NOTE: session_retrieve_items()
11756             session_retrieve_items => <<'PERL',
11757             sub session_retrieve_items
11758             {
11759             my $self = shift( @_ );
11760             my $args = shift( @_ ) || CORE::return( $self->error( "No parameters were provided to retrieve a checkout session items" ) );
11761             my $okParams =
11762             {
11763             expandable => { allowed => $EXPANDABLES->{item} },
11764             id => { re => qr/^\w+$/, required => 1 },
11765             ending_before => {},
11766             limit => { re => qr/^\d+$/ },
11767             starting_after => {},
11768             };
11769             my $err = $self->_check_parameters( $okParams, $args );
11770             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
11771             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No checkout session id was provided to retrieve its items details" ) );
11772             my $hash = $self->get( "checkout/sessions/${id}/line_items", $args ) || CORE::return( $self->pass_error );
11773             CORE::return( $self->_response_to_object( 'Net::API::Stripe::List', $hash ) );
11774             }
11775             PERL
11776             # NOTE: sessions()
11777             sessions => <<'PERL',
11778             sub sessions
11779             {
11780             my $self = shift( @_ );
11781             my $action = shift( @_ );
11782             my $allowed = [qw( create expire retrieve list retrieve_items )];
11783             my $meth = $self->_get_method( 'session', $action, $allowed ) || CORE::return( $self->pass_error );
11784             CORE::return( $self->$meth( @_ ) );
11785             }
11786             PERL
11787             # NOTE: settings()
11788             settings => <<'PERL',
11789             sub settings { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Connect::Account::Settings', @_ ) ); }
11790             PERL
11791             # NOTE: setup_attempt()
11792             setup_attempt => <<'PERL',
11793             sub setup_attempt { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Payment::Intent::Attempt', @_ ) ); }
11794             PERL
11795             # NOTE: setup_attempt_list()
11796             setup_attempt_list => <<'PERL',
11797             sub setup_attempt_list
11798             {
11799             my $self = shift( @_ );
11800             my $args = $self->_get_args( @_ );
11801             my $okParams =
11802             {
11803             expandable => { allowed => $EXPANDABLES->{setup_attempt}, data_prefix_is_ok => 1 },
11804             active => { type => "boolean" },
11805             created => { re => qr/^\d+$/, type => "timestamp" },
11806             'created.gt' => { re => qr/^\d+$/ },
11807             'created.gte' => { re => qr/^\d+$/ },
11808             'created.lt' => { re => qr/^\d+$/ },
11809             'created.lte' => { re => qr/^\d+$/ },
11810             ending_before => { type => "string" },
11811             limit => { re => qr/^\d+$/, type => "string" },
11812             setup_intent => { re => qr/^\w+$/, required => 1, type => "string" },
11813             starting_after => { type => "string" },
11814             };
11815              
11816             my $err = $self->_check_parameters( $okParams, $args );
11817             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
11818             if( $args->{expand} )
11819             {
11820             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
11821             }
11822             my $hash = $self->get( 'setup_attempts', $args ) || CORE::return( $self->pass_error );
11823             CORE::return( $self->_response_to_object( 'Net::API::Stripe::List', $hash ) );
11824             }
11825             PERL
11826             # NOTE: setup_attempts()
11827             setup_attempts => <<'PERL',
11828             sub setup_attempts
11829             {
11830             my $self = shift( @_ );
11831             my $action = shift( @_ );
11832             my $allowed = [qw( list )];
11833             my $meth = $self->_get_method( 'setup_attempts', $action, $allowed ) || CORE::return( $self->pass_error );
11834             CORE::return( $self->$meth( @_ ) );
11835             }
11836             PERL
11837             # NOTE: setup_intent()
11838             setup_intent => <<'PERL',
11839             sub setup_intent { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Payment::Intent::Attempt', @_ ) ); }
11840             PERL
11841             # NOTE: setup_intent_cancel()
11842             setup_intent_cancel => <<'PERL',
11843             sub setup_intent_cancel
11844             {
11845             my $self = shift( @_ );
11846             CORE::return( $self->error( "No parameters were provided to cancel the setup intent." ) ) if( !scalar( @_ ) );
11847             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Payment::Intent::Setup', @_ );
11848             my $okParams =
11849             {
11850             expandable => { allowed => $EXPANDABLES->{setup_intent} },
11851             cancellation_reason => {
11852             re => qr/^(?:abandoned|requested_by_customer|duplicate)$/,
11853             type => "string",
11854             },
11855             id => { re => qr/^\w+$/, required => 1 },
11856             };
11857              
11858             my $err = $self->_check_parameters( $okParams, $args );
11859             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
11860             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No setup intent id was provided to cancel." ) );
11861             my $hash = $self->post( "setup_intents/${id}/cancel", $args ) || CORE::return( $self->pass_error );
11862             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Payment::Intent::Setup', $hash ) );
11863             }
11864             PERL
11865             # NOTE: setup_intent_confirm()
11866             setup_intent_confirm => <<'PERL',
11867             sub setup_intent_confirm
11868             {
11869             my $self = shift( @_ );
11870             CORE::return( $self->error( "No parameters were provided to confirm the setup intent." ) ) if( !scalar( @_ ) );
11871             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Payment::Intent::Setup', @_ );
11872             my $okParams =
11873             {
11874             expandable => { allowed => $EXPANDABLES->{setup_intent} },
11875             id => { re => qr/^\w+$/, required => 1 },
11876             mandate_data => {
11877             fields => [
11878             "customer_acceptance.type",
11879             "customer_acceptance.accepted_at",
11880             "customer_acceptance.offline",
11881             "customer_acceptance.online.ip_address",
11882             "customer_acceptance.online.user_agent",
11883             ],
11884             type => "hash",
11885             },
11886             payment_method => { re => qr/^\w+$/, type => "string" },
11887             payment_method_data => { type => "object" },
11888             payment_method_options => {
11889             fields => [
11890             "acss_debit.currency",
11891             "acss_debit.mandate_options.custom_mandate_url",
11892             "acss_debit.mandate_options.default_for",
11893             "acss_debit.mandate_options.interval_description",
11894             "acss_debit.mandate_options.payment_schedule",
11895             "acss_debit.mandate_options.transaction_type",
11896             "acss_debit.verification_method",
11897             "card.request_three_d_secure",
11898             "sepa_debit.mandate_options",
11899             ],
11900             type => "hash",
11901             },
11902             return_url => { type => "string" },
11903             };
11904              
11905             my $err = $self->_check_parameters( $okParams, $args );
11906             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
11907             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No setup intent id was provided to confirm." ) );
11908             my $hash = $self->post( "setup_intents/${id}/confirm", $args ) || CORE::return( $self->pass_error );
11909             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Payment::Intent::Setup', $hash ) );
11910             }
11911             PERL
11912             # NOTE: setup_intent_create()
11913             setup_intent_create => <<'PERL',
11914             sub setup_intent_create
11915             {
11916             my $self = shift( @_ );
11917             CORE::return( $self->error( "No parameters were provided to create a the setup intent." ) ) if( !scalar( @_ ) );
11918             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Payment::Intent::Setup', @_ );
11919             my $okParams =
11920             {
11921             expandable => { allowed => $EXPANDABLES->{setup_intent} },
11922             attach_to_self => { type => "boolean" },
11923             confirm => { type => "boolean" },
11924             customer => { type => "string" },
11925             description => { type => "string" },
11926             flow_directions => { type => "array" },
11927             # id => { re => qr/^\w+$/, required => 1 },
11928             mandate_data => {
11929             fields => [
11930             "customer_acceptance.type",
11931             "customer_acceptance.accepted_at",
11932             "customer_acceptance.offline",
11933             "customer_acceptance.online.ip_address",
11934             "customer_acceptance.online.user_agent",
11935             ],
11936             type => "object",
11937             },
11938             metadata => { type => "hash" },
11939             on_behalf_of => { type => "string" },
11940             payment_method => { re => qr/^\w+$/, type => "string" },
11941             payment_method_data => { type => "object" },
11942             payment_method_options => {
11943             fields => [
11944             "acss_debit.currency",
11945             "acss_debit.mandate_options.custom_mandate_url",
11946             "acss_debit.mandate_options.default_for",
11947             "acss_debit.mandate_options.interval_description",
11948             "acss_debit.mandate_options.payment_schedule",
11949             "acss_debit.mandate_options.transaction_type",
11950             "acss_debit.verification_method",
11951             "card.request_three_d_secure",
11952             "sepa_debit.mandate_options",
11953             ],
11954             type => "hash",
11955             },
11956             payment_method_types => { type => "array" },
11957             return_url => { type => "string" },
11958             single_use => { fields => ["amount", "currency"], type => "object" },
11959             usage => { type => "string" },
11960             };
11961              
11962             $args = $self->_contract( 'setup_intent', $args ) || CORE::return( $self->pass_error );
11963             my $err = $self->_check_parameters( $okParams, $args );
11964             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
11965             my $hash = $self->post( 'setup_intents', $args ) || CORE::return( $self->pass_error );
11966             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Payment::Intent::Setup', $hash ) );
11967             }
11968             PERL
11969             # NOTE: setup_intent_list()
11970             setup_intent_list => <<'PERL',
11971             sub setup_intent_list
11972             {
11973             my $self = shift( @_ );
11974             my $args = $self->_get_args( @_ );
11975             my $okParams =
11976             {
11977             expandable => { allowed => $EXPANDABLES->{setup_intent}, data_prefix_is_ok => 1 },
11978             active => { type => "boolean" },
11979             attach_to_self => { type => "boolean" },
11980             created => { re => qr/^\d+$/, type => "timestamp" },
11981             'created.gt' => { re => qr/^\d+$/ },
11982             'created.gte' => { re => qr/^\d+$/ },
11983             'created.lt' => { re => qr/^\d+$/ },
11984             'created.lte' => { re => qr/^\d+$/ },
11985             customer => { re => qr/^\w+$/, type => "string" },
11986             ending_before => { type => "string" },
11987             limit => { re => qr/^\d+$/, type => "string" },
11988             payment_method => { type => "string" },
11989             starting_after => { type => "string" },
11990             };
11991              
11992             my $err = $self->_check_parameters( $okParams, $args );
11993             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
11994             if( $args->{expand} )
11995             {
11996             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
11997             }
11998             my $hash = $self->get( 'setup_intents', $args ) || CORE::return( $self->pass_error );
11999             CORE::return( $self->_response_to_object( 'Net::API::Stripe::List', $hash ) );
12000             }
12001             PERL
12002             # NOTE: setup_intent_retrieve()
12003             setup_intent_retrieve => <<'PERL',
12004             sub setup_intent_retrieve
12005             {
12006             my $self = shift( @_ );
12007             CORE::return( $self->error( "No parameters were provided to retrieve setup intent information." ) ) if( !scalar( @_ ) );
12008             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Payment::Intent::Setup', @_ );
12009             my $okParams =
12010             {
12011             expandable => { allowed => $EXPANDABLES->{setup_intent}, data_prefix_is_ok => 1 },
12012             client_secret => { required => 1, type => "string" },
12013             id => { re => qr/^\w+$/, required => 1 },
12014             };
12015              
12016             my $err = $self->_check_parameters( $okParams, $args );
12017             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
12018             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No setup intent id was provided to retrieve its information." ) );
12019             my $hash = $self->get( "setup_intents/${id}", $args ) || CORE::return( $self->pass_error );
12020             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Payment::Intent::Setup', $hash ) );
12021             }
12022             PERL
12023             # NOTE: setup_intent_update()
12024             setup_intent_update => <<'PERL',
12025             sub setup_intent_update
12026             {
12027             my $self = shift( @_ );
12028             CORE::return( $self->error( "No parameters were provided to update the setup intent." ) ) if( !scalar( @_ ) );
12029             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Payment::Intent::Setup', @_ );
12030             my $okParams =
12031             {
12032             expandable => { allowed => $EXPANDABLES->{setup_intent} },
12033             attach_to_self => { type => "boolean" },
12034             customer => { type => "string" },
12035             description => { type => "string" },
12036             flow_directions => { type => "array" },
12037             id => { re => qr/^\w+$/, required => 1 },
12038             metadata => { type => "hash" },
12039             payment_method => { re => qr/^\w+$/, type => "string" },
12040             payment_method_data => { type => "object" },
12041             payment_method_options => {
12042             fields => [
12043             "acss_debit.currency",
12044             "acss_debit.mandate_options.custom_mandate_url",
12045             "acss_debit.mandate_options.default_for",
12046             "acss_debit.mandate_options.interval_description",
12047             "acss_debit.mandate_options.payment_schedule",
12048             "acss_debit.mandate_options.transaction_type",
12049             "acss_debit.verification_method",
12050             "card.request_three_d_secure",
12051             "sepa_debit.mandate_options",
12052             ],
12053             type => "hash",
12054             },
12055             payment_method_types => { type => "array" },
12056             };
12057              
12058             $args = $self->_contract( 'setup_intent', $args ) || CORE::return( $self->pass_error );
12059             # We found some errors
12060             my $err = $self->_check_parameters( $okParams, $args );
12061             # $self->message( 3, "Data to be posted: ", $self->dumper( $args ) ); exit;
12062             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
12063             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No setup intent id was provided to update its details" ) );
12064             my $hash = $self->post( "setup_intents/${id}", $args ) || CORE::return( $self->pass_error );
12065             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Payment::Intent::Setup', $hash ) );
12066             }
12067             PERL
12068             # NOTE: setup_intent_verify()
12069             setup_intent_verify => <<'PERL',
12070             sub setup_intent_verify
12071             {
12072             my $self = shift( @_ );
12073             CORE::return( $self->error( "No parameters were provided to verify microdeposits on the setup intent." ) ) if( !scalar( @_ ) );
12074             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Payment::Intent::Setup', @_ );
12075             my $okParams =
12076             {
12077             expandable => { allowed => $EXPANDABLES->{setup_intent} },
12078             id => { re => qr/^\w+$/, required => 1 },
12079             client_secret => {},
12080             amounts => { type => 'array', re => qr/^\d+$/ },
12081             descriptor_code => { re => qr/^.*?$/ },
12082             };
12083             my $err = $self->_check_parameters( $okParams, $args );
12084             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
12085             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No setup intent id was provided to verify microdeposits on it." ) );
12086             my $hash = $self->post( "setup_intents/${id}/verify_microdeposits", $args ) || CORE::return( $self->pass_error );
12087             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Payment::Intent::Setup', $hash ) );
12088             }
12089             PERL
12090             # NOTE: setup_intent_verify_microdeposits()
12091             setup_intent_verify_microdeposits => <<'PERL',
12092             sub setup_intent_verify_microdeposits
12093             {
12094             my $self = shift( @_ );
12095             CORE::return( $self->error( "No parameters were provided to verify_microdeposits setup intent information." ) ) if( !scalar( @_ ) );
12096             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Payment::Intent::Setup', @_ );
12097             my $okParams =
12098             {
12099             expandable => { allowed => $EXPANDABLES->{ 'setup_intent' } },
12100             amounts => { type => "array" },
12101             client_secret => { type => "string", required => 1 },
12102             descriptor_code => { type => "string" },
12103             };
12104             my $err = $self->_check_parameters( $okParams, $args );
12105             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
12106             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No setup_intent id (with parameter 'id') was provided to verify_microdeposits its information." ) );
12107             my $hash = $self->post( "setup_intents/${id}", $args ) || CORE::return( $self->pass_error );
12108             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Payment::Intent::Setup', $hash ) );
12109             }
12110             PERL
12111             # NOTE: setup_intents()
12112             setup_intents => <<'PERL',
12113             # <https://stripe.com/docs/api/setup_intents>
12114             sub setup_intents
12115             {
12116             my $self = shift( @_ );
12117             my $allowed = [qw( cancel confirm create list retrieve update verify verify_microdeposits )];
12118             my $action = shift( @_ );
12119             my $meth = $self->_get_method( 'setup_intent', $action, $allowed ) || CORE::return( $self->pass_error );
12120             CORE::return( $self->$meth( @_ ) );
12121             }
12122             PERL
12123             # NOTE: shipping()
12124             shipping => <<'PERL',
12125             # sub sigma { CORE::return( shift->_instantiate( 'sigma', 'Net::API::Stripe::Sigma' ) ) }
12126             sub shipping { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Shipping', @_ ) ); }
12127             PERL
12128             # NOTE: shipping_rate()
12129             shipping_rate => <<'PERL',
12130             sub shipping_rate { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Shipping::Rate', @_ ) ); }
12131             PERL
12132             # NOTE: shipping_rate_create()
12133             shipping_rate_create => <<'PERL',
12134             sub shipping_rate_create
12135             {
12136             my $self = shift( @_ );
12137             CORE::return( $self->error( "No parameters were provided to create a shipping rate" ) ) if( !scalar( @_ ) );
12138             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Shipping::Rate', @_ );
12139             my $okParams =
12140             {
12141             expandable => { allowed => $EXPANDABLES->{shipping_rate} },
12142             delivery_estimate => {
12143             fields => [
12144             "maximum.unit",
12145             "maximum.value",
12146             "minimum.unit",
12147             "minimum.value",
12148             ],
12149             type => "hash",
12150             },
12151             display_name => { re => qr/^.+$/, required => 1, type => "string" },
12152             fixed_amount => { fields => ["amount", "currency"], required => 1, type => "hash" },
12153             metadata => { type => "hash" },
12154             tax_behavior => { type => "string" },
12155             tax_code => { type => "string" },
12156             type => { re => qr/^\w+$/, required => 1, type => "string" },
12157             };
12158              
12159             $args = $self->_contract( 'shipping_rate', $args ) || CORE::return( $self->pass_error );
12160             my $err = $self->_check_parameters( $okParams, $args );
12161             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
12162             my $hash = $self->post( "shipping_rates", $args ) || CORE::return( $self->pass_error );
12163             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Shipping::Rate', $hash ) );
12164             }
12165             PERL
12166             # NOTE: shipping_rate_list()
12167             shipping_rate_list => <<'PERL',
12168             sub shipping_rate_list
12169             {
12170             my $self = shift( @_ );
12171             CORE::return( $self->error( "No parameters were provided to list shipping rates" ) ) if( !scalar( @_ ) );
12172             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Shipping::Rate', @_ );
12173             my $okParams =
12174             {
12175             expandable => { allowed => $EXPANDABLES->{shipping_rate}, data_prefix_is_ok => 1 },
12176             active => { type => "boolean" },
12177             created => { re => qr/^\d+$/, type => "timestamp" },
12178             'created.gt' => { re => qr/^\d+$/ },
12179             'created.gte' => { re => qr/^\d+$/ },
12180             'created.lt' => { re => qr/^\d+$/ },
12181             'created.lte' => { re => qr/^\d+$/ },
12182             currency => { re => qr/^[A-Z]+$/, type => "string" },
12183             ending_before => { re => qr/^\w+$/, type => "string" },
12184             id => { re => qr/^\w+$/, required => 1 },
12185             limit => { re => qr/^\d+$/, type => "string" },
12186             starting_after => { re => qr/^\w+$/, type => "string" },
12187             };
12188              
12189             my $err = $self->_check_parameters( $okParams, $args );
12190             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
12191             if( $args->{expand} )
12192             {
12193             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
12194             }
12195             my $hash = $self->get( "shipping_rates", $args ) || CORE::return( $self->pass_error );
12196             CORE::return( $self->_response_to_object( 'Net::API::Stripe::List', $hash ) );
12197             }
12198             PERL
12199             # NOTE: shipping_rate_retrieve()
12200             shipping_rate_retrieve => <<'PERL',
12201             sub shipping_rate_retrieve
12202             {
12203             my $self = shift( @_ );
12204             CORE::return( $self->error( "No parameters were provided to retrieve a shipping rate" ) ) if( !scalar( @_ ) );
12205             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Shipping::Rate', @_ );
12206             my $okParams =
12207             {
12208             expandable => { allowed => $EXPANDABLES->{shipping_rate} },
12209             id => { re => qr/^\w+$/, required => 1 },
12210             };
12211             my $err = $self->_check_parameters( $okParams, $args );
12212             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
12213             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No shipping rate id was provided to retrieve its information" ) );
12214             my $hash = $self->get( "shipping_rates/${id}", $args ) || CORE::return( $self->pass_error );
12215             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Shipping::Rate', $hash ) );
12216             }
12217             PERL
12218             # NOTE: shipping_rate_update()
12219             shipping_rate_update => <<'PERL',
12220             sub shipping_rate_update
12221             {
12222             my $self = shift( @_ );
12223             CORE::return( $self->error( "No parameters were provided to update a shipping rate" ) ) if( !scalar( @_ ) );
12224             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Shipping::Rate', @_ );
12225             my $okParams =
12226             {
12227             expandable => { allowed => $EXPANDABLES->{shipping_rate} },
12228             active => { type => "boolean" },
12229             fixed_amount => { type => "hash" },
12230             id => { re => qr/^\w+$/, required => 1 },
12231             metadata => { type => "hash" },
12232             tax_behavior => { type => "string" },
12233             };
12234              
12235             $args = $self->_contract( 'shipping_rate', $args ) || CORE::return( $self->pass_error );
12236             # We found some errors
12237             my $err = $self->_check_parameters( $okParams, $args );
12238             # $self->message( 3, "Data to be posted: ", $self->dumper( $args ) ); exit;
12239             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
12240             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No shipping rate id was provided to update its details" ) );
12241             my $hash = $self->post( "shipping_rates/${id}", $args ) || CORE::return( $self->pass_error );
12242             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Shipping::Rate', $hash ) );
12243             }
12244             PERL
12245             # NOTE: shipping_rates()
12246             shipping_rates => <<'PERL',
12247             sub shipping_rates
12248             {
12249             my $self = shift( @_ );
12250             my $action = shift( @_ );
12251             my $allowed = [qw( create retrieve update list )];
12252             my $meth = $self->_get_method( 'shipping_rate', $action, $allowed ) || CORE::return( $self->pass_error );
12253             CORE::return( $self->$meth( @_ ) );
12254             }
12255             PERL
12256             # NOTE: sku()
12257             sku => <<'PERL',
12258             sub sku { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Order::SKU' ) ) }
12259             PERL
12260             # NOTE: source()
12261             source => <<'PERL',
12262             sub source { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Payment::Source', @_ ) ); }
12263             PERL
12264             # NOTE: source_attach()
12265             source_attach => <<'PERL',
12266             sub source_attach
12267             {
12268             my $self = shift( @_ );
12269             CORE::return( $self->error( "No parameters were provided to attach a source." ) ) if( !scalar( @_ ) );
12270             my $args;
12271             if( $self->_is_object( $_[0] ) )
12272             {
12273             if( $_[0]->isa( 'Net::API::Stripe::Customer' ) )
12274             {
12275             $args = $self->_get_args_from_object( 'Net::API::Stripe::Customer', @_ );
12276             }
12277             elsif( $_[0]->isa( 'Net::API::Stripe::Payment::Source' ) )
12278             {
12279             $args = $self->_get_args_from_object( 'Net::API::Stripe::Payment::Source', @_ );
12280             my $obj = $args->{_object};
12281             $args->{source} = $obj->id;
12282             $args->{id} = $obj->customer->id if( $obj->customer );
12283             }
12284             }
12285             else
12286             {
12287             $args = $self->_get_args( @_ );
12288             }
12289             my $okParams =
12290             {
12291             expandable => { allowed => $EXPANDABLES->{source} },
12292             id => { re => qr/^\w+$/, required => 1 },
12293             source => { re => qr/^\w+$/, required => 1, type => "string" },
12294             };
12295              
12296             $args = $self->_contract( 'source', $args ) || CORE::return( $self->pass_error );
12297             my $err = $self->_check_parameters( $okParams, $args );
12298             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
12299             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No customer id was provided to attach the source to." ) );
12300             my $hash = $self->post( "customers/${id}/sources", $args ) || CORE::return( $self->pass_error );
12301             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Payment::Source', $hash ) );
12302             }
12303             PERL
12304             # NOTE: source_create()
12305             source_create => <<'PERL',
12306             sub source_create
12307             {
12308             my $self = shift( @_ );
12309             CORE::return( $self->error( "No parameters were provided to create a source" ) ) if( !scalar( @_ ) );
12310             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Payment::Source', @_ );
12311             my $okParams =
12312             {
12313             expandable => { allowed => $EXPANDABLES->{source} },
12314             amount => { type => "integer" },
12315             currency => { type => "string" },
12316             flow => { type => "string" },
12317             mandate => {
12318             fields => [
12319             "acceptance",
12320             "acceptance.status",
12321             "acceptance.date",
12322             "acceptance.ip",
12323             "acceptance.offline.contact_email",
12324             "acceptance.online",
12325             "acceptance.type",
12326             "acceptance.user_agent",
12327             "amount",
12328             "currency",
12329             "interval",
12330             "notification_method",
12331             ],
12332             type => "object",
12333             },
12334             metadata => { type => "hash" },
12335             owner => {
12336             fields => [
12337             "address.city",
12338             "address.country",
12339             "address.line1",
12340             "address.line2",
12341             "address.postal_code",
12342             "address.state",
12343             "email",
12344             "name",
12345             "phone",
12346             ],
12347             type => "hash",
12348             },
12349             receiver => { fields => ["refund_attributes_method"], type => "hash" },
12350             redirect => { fields => ["return_url"], type => "hash" },
12351             source_order => {
12352             fields => [
12353             "items.amount",
12354             "items.currency",
12355             "items.description",
12356             "items.parent",
12357             "items.quantity",
12358             "items.type",
12359             "shipping.address.city",
12360             "shipping.address.country",
12361             "shipping.address.line1",
12362             "shipping.address.line2",
12363             "shipping.address.postal_code",
12364             "shipping.address.state",
12365             "shipping.carrier",
12366             "shipping.name",
12367             "shipping.phone",
12368             "shipping.tracking_number",
12369             ],
12370             type => "hash",
12371             },
12372             statement_descriptor => { type => "string" },
12373             token => { type => "string" },
12374             type => { required => 1, type => "string" },
12375             usage => { type => "string" },
12376             };
12377              
12378             $args = $self->_contract( 'source', $args ) || CORE::return( $self->pass_error );
12379             my $err = $self->_check_parameters( $okParams, $args );
12380             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
12381             my $hash = $self->post( 'sources', $args ) || CORE::return( $self->pass_error );
12382             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Payment::Source', $hash ) );
12383             }
12384             PERL
12385             # NOTE: source_detach()
12386             source_detach => <<'PERL',
12387             # https://stripe.com/docs/api/customers/delete?lang=curl
12388             # "Permanently deletes a customer. It cannot be undone. Also immediately cancels any active subscriptions on the customer."
12389             sub source_detach
12390             {
12391             my $self = shift( @_ );
12392             CORE::return( $self->error( "No parameters were provided to detach a source." ) ) if( !scalar( @_ ) );
12393             my $args;
12394             if( $self->_is_object( $_[0] ) )
12395             {
12396             if( $_[0]->isa( 'Net::API::Stripe::Customer' ) )
12397             {
12398             $args = $self->_get_args_from_object( 'Net::API::Stripe::Customer', @_ );
12399             }
12400             elsif( $_[0]->isa( 'Net::API::Stripe::Payment::Source' ) )
12401             {
12402             $args = $self->_get_args_from_object( 'Net::API::Stripe::Payment::Source', @_ );
12403             my $obj = $args->{_object};
12404             $args->{source} = $obj->id;
12405             $args->{id} = $obj->customer->id if( $obj->customer );
12406             }
12407             }
12408             else
12409             {
12410             $args = $self->_get_args( @_ );
12411             }
12412             my $okParams =
12413             {
12414             expandable => { allowed => $EXPANDABLES->{source} },
12415             id => { re => qr/^\w+$/, required => 1 },
12416             source => { re => qr/^\w+$/, required => 1 },
12417             };
12418             $args = $self->_contract( 'source', $args ) || CORE::return( $self->pass_error );
12419             my $err = $self->_check_parameters( $okParams, $args );
12420             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
12421             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No customer id was provided to detach the source from it." ) );
12422             my $src_id = CORE::delete( $args->{source} ) || CORE::return( $self->error( "No source id was provided to detach." ) );
12423             my $hash = $self->delete( "customers/${id}/sources/${src_id}", $args ) || CORE::return( $self->pass_error );
12424             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Payment::Source', $hash ) );
12425             }
12426             PERL
12427             # NOTE: source_order()
12428             source_order => <<'PERL',
12429             sub source_order { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Order', @_ ) ); }
12430             PERL
12431             # NOTE: source_retrieve()
12432             source_retrieve => <<'PERL',
12433             sub source_retrieve
12434             {
12435             my $self = shift( @_ );
12436             CORE::return( $self->error( "No parameters were provided to retrieve source information." ) ) if( !scalar( @_ ) );
12437             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Payment::Source', @_ );
12438             my $okParams =
12439             {
12440             expandable => { allowed => $EXPANDABLES->{source}, data_prefix_is_ok => 1 },
12441             client_secret => { type => "string" },
12442             id => { re => qr/^\w+$/, required => 1 },
12443             };
12444              
12445             $args = $self->_contract( 'source', $args ) || CORE::return( $self->pass_error );
12446             my $err = $self->_check_parameters( $okParams, $args );
12447             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
12448             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No source id was provided to retrieve its information." ) );
12449             my $hash = $self->get( "sources/${id}", $args ) || CORE::return( $self->pass_error );
12450             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Payment::Source', $hash ) );
12451             }
12452             PERL
12453             # NOTE: source_update()
12454             source_update => <<'PERL',
12455             # https://stripe.com/docs/api/sources/update?lang=curl
12456             sub source_update
12457             {
12458             my $self = shift( @_ );
12459             CORE::return( $self->error( "No parameters were provided to update a source" ) ) if( !scalar( @_ ) );
12460             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Payment::Source', @_ );
12461             my $okParams =
12462             {
12463             expandable => { allowed => $EXPANDABLES->{source} },
12464             amount => { type => "integer" },
12465             id => { re => qr/^\w+$/, required => 1 },
12466             mandate => {
12467             fields => [
12468             "acceptance",
12469             "acceptance.status",
12470             "acceptance.date",
12471             "acceptance.ip",
12472             "acceptance.offline.contact_email",
12473             "acceptance.online",
12474             "acceptance.type",
12475             "acceptance.user_agent",
12476             "amount",
12477             "currency",
12478             "interval",
12479             "notification_method",
12480             ],
12481             type => "object",
12482             },
12483             metadata => { type => "hash" },
12484             owner => {
12485             fields => [
12486             "address.city",
12487             "address.country",
12488             "address.line1",
12489             "address.line2",
12490             "address.postal_code",
12491             "address.state",
12492             "email",
12493             "name",
12494             "phone",
12495             ],
12496             type => "hash",
12497             },
12498             source_order => {
12499             fields => [
12500             "items.amount",
12501             "items.currency",
12502             "items.description",
12503             "items.parent",
12504             "items.quantity",
12505             "items.type",
12506             "shipping.address.city",
12507             "shipping.address.country",
12508             "shipping.address.line1",
12509             "shipping.address.line2",
12510             "shipping.address.postal_code",
12511             "shipping.address.state",
12512             "shipping.carrier",
12513             "shipping.name",
12514             "shipping.phone",
12515             "shipping.tracking_number",
12516             ],
12517             type => "hash",
12518             },
12519             };
12520              
12521             $args = $self->_contract( 'source', $args ) || CORE::return( $self->pass_error );
12522             # We found some errors
12523             my $err = $self->_check_parameters( $okParams, $args );
12524             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
12525             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No source id was provided to update source's details" ) );
12526             my $hash = $self->post( "sources/${id}", $args ) || CORE::return( $self->pass_error );
12527             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Payment::Source', $hash ) );
12528             }
12529             PERL
12530             # NOTE: sources()
12531             sources => <<'PERL',
12532             sub sources
12533             {
12534             my $self = shift( @_ );
12535             my $action = shift( @_ );
12536             my $allowed = [qw( create retrieve update detach attach )];
12537             my $meth = $self->_get_method( 'source', $action, $allowed ) || CORE::return( $self->pass_error );
12538             CORE::return( $self->$meth( @_ ) );
12539             }
12540             PERL
12541             # NOTE: status_transitions()
12542             status_transitions => <<'PERL',
12543             sub status_transitions { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Billing::Invoice::StatusTransition', @_ ) ); }
12544             PERL
12545             # NOTE: subscription()
12546             subscription => <<'PERL',
12547             sub subscription { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Billing::Subscription', @_ ) ); }
12548             PERL
12549             # NOTE: subscription_cancel()
12550             subscription_cancel => <<'PERL',
12551             # https://stripe.com/docs/api/customers/delete?lang=curl
12552             # "Permanently deletes a customer. It cannot be undone. Also immediately cancels any active subscriptions on the customer."
12553             sub subscription_cancel
12554             {
12555             my $self = shift( @_ );
12556             CORE::return( $self->error( "No parameters were provided to cancel subscription information." ) ) if( !scalar( @_ ) );
12557             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Billing::Subscription', @_ );
12558             my $okParams =
12559             {
12560             expandable => { allowed => $EXPANDABLES->{subscription} },
12561             id => { re => qr/^\w+$/, required => 1 }
12562             };
12563             my $err = $self->_check_parameters( $okParams, $args );
12564             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
12565             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No subscription id was provided to cancel." ) );
12566             my $hash = $self->delete( "subscriptions/${id}", $args ) || CORE::return( $self->pass_error );
12567             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::Subscription', $hash ) );
12568             }
12569             PERL
12570             # NOTE: subscription_create()
12571             subscription_create => <<'PERL',
12572             sub subscription_create
12573             {
12574             my $self = shift( @_ );
12575             CORE::return( $self->error( "No parameters were provided to create a subscription" ) ) if( !scalar( @_ ) );
12576             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Billing::Subscription', @_ );
12577             my $okParams =
12578             {
12579             expandable => { allowed => $EXPANDABLES->{subscription} },
12580             add_invoice_items => {
12581             fields => ["price", "price_data", "quantity", "tax_rates"],
12582             type => "array",
12583             },
12584             application_fee_percent => { re => qr/^[0-100]$/, type => "decimal" },
12585             automatic_tax => { fields => ["enabled!"], type => "hash" },
12586             backdate_start_date => { type => "datetime" },
12587             billing_cycle_anchor => { type => "datetime" },
12588             billing_thresholds => {
12589             fields => ["amount_gte", "reset_billing_cycle_anchor"],
12590             type => "hash",
12591             },
12592             cancel_at => { type => "datetime" },
12593             cancel_at_period_end => { type => "boolean" },
12594             collection_method => { re => qr/^(?:charge_automatically|send_invoice)$/, type => "string" },
12595             coupon => { type => "string" },
12596             currency => { type => "currency" },
12597             customer => { required => 1, type => "string" },
12598             days_until_due => { type => "integer" },
12599             default_payment_method => { type => "string" },
12600             default_source => { type => "string" },
12601             default_tax_rates => { type => "array" },
12602             description => { type => "string" },
12603             items => {
12604             fields => [
12605             "billing_thresholds.usage_gte",
12606             "metadata",
12607             "plan",
12608             "price",
12609             "price_data.currency!",
12610             "price_data.product!",
12611             "price_data.recurring!",
12612             "price_data.recurring.interval!",
12613             "price_data.recurring.interval_count",
12614             "price_data.tax_behavior",
12615             "price_data.unit_amount_decimal!",
12616             "price_data.unit_amount",
12617             "quantity",
12618             "tax_rates",
12619             ],
12620             required => 1,
12621             type => "array",
12622             },
12623             metadata => { type => "hash" },
12624             off_session => { type => "boolean" },
12625             payment_behavior => {
12626             re => qr/^(?:allow_incomplete|error_if_incomplete)$/,
12627             type => "string",
12628             },
12629             payment_settings => { class => "Net::API::Stripe::Payment::Settings", type => "object" },
12630             pending_invoice_item_interval => { fields => ["interval", "interval_count"], type => "hash" },
12631             promotion_code => { type => "string" },
12632             prorate => {},
12633             proration_behavior => {
12634             re => qr/^(billing_cycle_anchor|create_prorations|none)$/,
12635             type => "string",
12636             },
12637             tax_percent => { re => qr/^[0-100]$/ },
12638             transfer_data => { fields => ["desination", "amount_percent"], type => "hash" },
12639             trial_end => { re => qr/^(?:\d+|now)$/, type => "timestamp" },
12640             trial_from_plan => { type => "boolean" },
12641             trial_period_days => { type => "integer" },
12642             };
12643              
12644             $args = $self->_contract( 'subscription', $args ) || CORE::return( $self->pass_error );
12645             my $err = $self->_check_parameters( $okParams, $args );
12646             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
12647             my $hash = $self->post( 'subscriptions', $args ) || CORE::return( $self->pass_error );
12648             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::Subscription', $hash ) );
12649             }
12650             PERL
12651             # NOTE: subscription_delete()
12652             subscription_delete => <<'PERL',
12653             sub subscription_delete
12654             {
12655             my $self = shift( @_ );
12656             my $args = shift( @_ );
12657             my $okParams =
12658             {
12659             expandable => { allowed => $EXPANDABLES->{ 'subscription' } },
12660             invoice_now => { type => "boolean" },
12661             prorate => { type => "boolean" },
12662             };
12663             $args = $self->_contract( 'subscription', $args ) || CORE::return( $self->pass_error );
12664             my $err = $self->_check_parameters( $okParams, $args );
12665             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
12666             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No subscription id (with parameter 'id') was provided to delete its information." ) );
12667             my $hash = $self->delete( "subscriptions/${id}", $args ) || CORE::return( $self->pass_error );
12668             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::Subscription', $hash ) );
12669             }
12670             PERL
12671             # NOTE: subscription_delete_discount()
12672             subscription_delete_discount => <<'PERL',
12673             sub subscription_delete_discount
12674             {
12675             my $self = shift( @_ );
12676             CORE::return( $self->error( "No parameters were provided to delete subscription discount." ) ) if( !scalar( @_ ) );
12677             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Billing::Subscription', @_ );
12678             my $okParams =
12679             {
12680             expandable => { allowed => $EXPANDABLES->{discount} },
12681             id => { re => qr/^\w+$/, required => 1 }
12682             };
12683             my $err = $self->_check_parameters( $okParams, $args );
12684             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
12685             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No subscription id was provided to delete its coupon." ) );
12686             my $hash = $self->delete( "subscriptions/${id}/discount", $args ) || CORE::return( $self->pass_error );
12687             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::Discount', $hash ) );
12688             }
12689             PERL
12690             # NOTE: subscription_item()
12691             subscription_item => <<'PERL',
12692             sub subscription_item { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Billing::Subscription::Item', @_ ) ); }
12693             PERL
12694             # NOTE: subscription_item_create()
12695             subscription_item_create => <<'PERL',
12696             sub subscription_item_create
12697             {
12698             my $self = shift( @_ );
12699             my $args = shift( @_ );
12700             my $okParams =
12701             {
12702             expandable => { allowed => $EXPANDABLES->{ 'subscription_item' } },
12703             billing_thresholds => { type => "hash" },
12704             metadata => { type => "hash" },
12705             payment_behavior => { type => "string" },
12706             price => { type => "hash" },
12707             price_data => { type => "object" },
12708             proration_behavior => { type => "string" },
12709             proration_date => { type => "integer" },
12710             quantity => { type => "integer" },
12711             subscription => { type => "string", required => 1 },
12712             tax_rates => { type => "array" },
12713             };
12714             $args = $self->_contract( 'subscription_item', $args ) || CORE::return( $self->pass_error );
12715             my $err = $self->_check_parameters( $okParams, $args );
12716             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
12717             my $hash = $self->post( "subscription_items", $args ) || CORE::return( $self->pass_error );
12718             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::Subscription::Item', $hash ) );
12719             }
12720             PERL
12721             # NOTE: subscription_item_delete()
12722             subscription_item_delete => <<'PERL',
12723             sub subscription_item_delete
12724             {
12725             my $self = shift( @_ );
12726             my $args = shift( @_ );
12727             my $okParams =
12728             {
12729             expandable => { allowed => $EXPANDABLES->{ 'subscription_item' } },
12730             clear_usage => { type => "boolean" },
12731             proration_behavior => { type => "string" },
12732             proration_date => { type => "integer" },
12733             };
12734             $args = $self->_contract( 'subscription_item', $args ) || CORE::return( $self->pass_error );
12735             my $err = $self->_check_parameters( $okParams, $args );
12736             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
12737             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No subscription_item id (with parameter 'id') was provided to delete its information." ) );
12738             my $hash = $self->delete( "subscription_items/${id}", $args ) || CORE::return( $self->pass_error );
12739             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::Subscription::Item', $hash ) );
12740             }
12741             PERL
12742             # NOTE: subscription_item_list()
12743             subscription_item_list => <<'PERL',
12744             sub subscription_item_list
12745             {
12746             my $self = shift( @_ );
12747             CORE::return( $self->error( "No parameters were provided to list subscription item information." ) ) if( !scalar( @_ ) );
12748             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Billing::Subscription::Item', @_ );
12749             my $okParams =
12750             {
12751             expandable => { allowed => $EXPANDABLES->{ 'subscription_item' }, data_prefix_is_ok => 1 },
12752             ending_before => { type => "string" },
12753             limit => { type => "string" },
12754             starting_after => { type => "string" },
12755             subscription => { type => "string", required => 1 },
12756             };
12757             my $err = $self->_check_parameters( $okParams, $args );
12758             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
12759             if( $args->{expand} )
12760             {
12761             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
12762             }
12763             my $hash = $self->get( "subscription_items", $args ) || CORE::return( $self->pass_error );
12764             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::Subscription::Item', $hash ) );
12765             }
12766             PERL
12767             # NOTE: subscription_item_retrieve()
12768             subscription_item_retrieve => <<'PERL',
12769             sub subscription_item_retrieve
12770             {
12771             my $self = shift( @_ );
12772             my $args = shift( @_ );
12773             my $okParams =
12774             {
12775             expandable => { allowed => $EXPANDABLES->{ 'subscription_item' }, data_prefix_is_ok => 1 },
12776             };
12777             $args = $self->_contract( 'subscription_item', $args ) || CORE::return( $self->pass_error );
12778             my $err = $self->_check_parameters( $okParams, $args );
12779             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
12780             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No subscription_item id (with parameter 'id') was provided to retrieve its information." ) );
12781             my $hash = $self->get( "subscription_items/${id}", $args ) || CORE::return( $self->pass_error );
12782             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::Subscription::Item', $hash ) );
12783             }
12784             PERL
12785             # NOTE: subscription_item_update()
12786             subscription_item_update => <<'PERL',
12787             sub subscription_item_update
12788             {
12789             my $self = shift( @_ );
12790             my $args = shift( @_ );
12791             my $okParams =
12792             {
12793             expandable => { allowed => $EXPANDABLES->{ 'subscription_item' } },
12794             billing_thresholds => { type => "hash" },
12795             metadata => { type => "hash" },
12796             off_session => { type => "boolean" },
12797             payment_behavior => { type => "string" },
12798             price => { type => "hash" },
12799             price_data => { type => "object" },
12800             proration_behavior => { type => "string" },
12801             proration_date => { type => "integer" },
12802             quantity => { type => "integer" },
12803             tax_rates => { type => "array" },
12804             };
12805             $args = $self->_contract( 'subscription_item', $args ) || CORE::return( $self->pass_error );
12806             my $err = $self->_check_parameters( $okParams, $args );
12807             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
12808             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No subscription_item id (with parameter 'id') was provided to update its information." ) );
12809             my $hash = $self->post( "subscription_items/${id}", $args ) || CORE::return( $self->pass_error );
12810             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::Subscription::Item', $hash ) );
12811             }
12812             PERL
12813             # NOTE: subscription_items()
12814             subscription_items => <<'PERL',
12815             # <https://stripe.com/docs/api/subscription_items>
12816             sub subscription_items
12817             {
12818             my $self = shift( @_ );
12819             my $allowed = [qw( create delete list retrieve update )];
12820             my $action = shift( @_ );
12821             my $meth = $self->_get_method( 'subscription_item', $action, $allowed ) || CORE::return( $self->pass_error );
12822             CORE::return( $self->$meth( @_ ) );
12823             }
12824             PERL
12825             # NOTE: subscription_list()
12826             subscription_list => <<'PERL',
12827             sub subscription_list
12828             {
12829             my $self = shift( @_ );
12830             my $args = $self->_get_args( @_ );
12831             my $okParams =
12832             {
12833             expandable => { allowed => $EXPANDABLES->{subscription}, data_prefix_is_ok => 1 },
12834             active => { type => "boolean" },
12835             collection_method => { type => "string" },
12836             created => { re => qr/^\d+$/, type => "timestamp" },
12837             'created.gt' => { re => qr/^\d+$/ },
12838             'created.gte' => { re => qr/^\d+$/ },
12839             'created.lt' => { re => qr/^\d+$/ },
12840             'created.lte' => { re => qr/^\d+$/ },
12841             current_period_end => { type => "timestamp" },
12842             current_period_start => { type => "timestamp" },
12843             customer => { type => "string" },
12844             ending_before => { type => "string" },
12845             ids => { type => "array" },
12846             limit => { re => qr/^\d+$/, type => "string" },
12847             price => { type => "string" },
12848             shippable => { type => "boolean" },
12849             starting_after => { type => "string" },
12850             status => { type => "string" },
12851             test_clock => { type => "string" },
12852             };
12853              
12854             my $err = $self->_check_parameters( $okParams, $args );
12855             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
12856             if( $args->{expand} )
12857             {
12858             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
12859             }
12860             my $hash = $self->get( 'subscriptions', $args ) || CORE::return( $self->pass_error );
12861             CORE::return( $self->_response_to_object( 'Net::API::Stripe::List', $hash ) );
12862             }
12863             PERL
12864             # NOTE: subscription_retrieve()
12865             subscription_retrieve => <<'PERL',
12866             sub subscription_retrieve
12867             {
12868             my $self = shift( @_ );
12869             CORE::return( $self->error( "No parameters were provided to retrieve subscription information." ) ) if( !scalar( @_ ) );
12870             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Billing::Subscription', @_ );
12871             my $okParams =
12872             {
12873             expandable => { allowed => $EXPANDABLES->{subscription} },
12874             id => { re => qr/^\w+$/, required => 1 }
12875             };
12876             my $err = $self->_check_parameters( $okParams, $args );
12877             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
12878             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No subscription id was provided to retrieve its information." ) );
12879             my $hash = $self->get( "subscriptions/${id}", $args ) || CORE::return( $self->pass_error );
12880             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::Subscription', $hash ) );
12881             }
12882             PERL
12883             # NOTE: subscription_schedule()
12884             subscription_schedule => <<'PERL',
12885             sub subscription_schedule { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Billing::Subscription::Schedule', @_ ) ); }
12886             PERL
12887             # NOTE: subscription_schedule_cancel()
12888             subscription_schedule_cancel => <<'PERL',
12889             sub subscription_schedule_cancel
12890             {
12891             my $self = shift( @_ );
12892             my $args = shift( @_ );
12893             my $okParams =
12894             {
12895             expandable => { allowed => $EXPANDABLES->{ 'subscription_schedule' } },
12896             invoice_now => { type => "boolean" },
12897             prorate => { type => "boolean" },
12898             };
12899             $args = $self->_contract( 'subscription_schedule', $args ) || CORE::return( $self->pass_error );
12900             my $err = $self->_check_parameters( $okParams, $args );
12901             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
12902             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No subscription_schedule id (with parameter 'id') was provided to cancel its information." ) );
12903             my $hash = $self->post( "subscription_schedules/${id}", $args ) || CORE::return( $self->pass_error );
12904             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::Subscription::Schedule', $hash ) );
12905             }
12906             PERL
12907             # NOTE: subscription_schedule_create()
12908             subscription_schedule_create => <<'PERL',
12909             sub subscription_schedule_create
12910             {
12911             my $self = shift( @_ );
12912             my $args = shift( @_ );
12913             my $okParams =
12914             {
12915             expandable => { allowed => $EXPANDABLES->{ 'subscription_schedule' } },
12916             customer => { type => "string" },
12917             default_settings => { type => "hash" },
12918             end_behavior => { type => "string" },
12919             from_subscription => { type => "string" },
12920             metadata => { type => "hash" },
12921             phases => { type => "array" },
12922             start_date => { type => "string" },
12923             };
12924             $args = $self->_contract( 'subscription_schedule', $args ) || CORE::return( $self->pass_error );
12925             my $err = $self->_check_parameters( $okParams, $args );
12926             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
12927             my $hash = $self->post( "subscription_schedules", $args ) || CORE::return( $self->pass_error );
12928             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::Subscription::Schedule', $hash ) );
12929             }
12930             PERL
12931             # NOTE: subscription_schedule_list()
12932             subscription_schedule_list => <<'PERL',
12933             sub subscription_schedule_list
12934             {
12935             my $self = shift( @_ );
12936             CORE::return( $self->error( "No parameters were provided to list subscription schedule information." ) ) if( !scalar( @_ ) );
12937             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Billing::Subscription::Schedule', @_ );
12938             my $okParams =
12939             {
12940             expandable => { allowed => $EXPANDABLES->{ 'subscription_schedule' }, data_prefix_is_ok => 1 },
12941             canceled_at => { type => "timestamp" },
12942             completed_at => { type => "timestamp" },
12943             created => { type => "timestamp" },
12944             customer => { type => "string" },
12945             ending_before => { type => "string" },
12946             limit => { type => "string" },
12947             released_at => { type => "timestamp" },
12948             scheduled => { type => "string" },
12949             starting_after => { type => "string" },
12950             };
12951             my $err = $self->_check_parameters( $okParams, $args );
12952             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
12953             if( $args->{expand} )
12954             {
12955             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
12956             }
12957             my $hash = $self->get( "subscription_schedules", $args ) || CORE::return( $self->pass_error );
12958             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::Subscription::Schedule', $hash ) );
12959             }
12960             PERL
12961             # NOTE: subscription_schedule_release()
12962             subscription_schedule_release => <<'PERL',
12963             sub subscription_schedule_release
12964             {
12965             my $self = shift( @_ );
12966             my $args = shift( @_ );
12967             my $okParams =
12968             {
12969             expandable => { allowed => $EXPANDABLES->{ 'subscription_schedule' } },
12970             preserve_cancel_date => { type => "boolean" },
12971             };
12972             $args = $self->_contract( 'subscription_schedule', $args ) || CORE::return( $self->pass_error );
12973             my $err = $self->_check_parameters( $okParams, $args );
12974             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
12975             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No subscription_schedule id (with parameter 'id') was provided to release its information." ) );
12976             my $hash = $self->post( "subscription_schedules/${id}", $args ) || CORE::return( $self->pass_error );
12977             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::Subscription::Schedule', $hash ) );
12978             }
12979             PERL
12980             # NOTE: subscription_schedule_retrieve()
12981             subscription_schedule_retrieve => <<'PERL',
12982             sub subscription_schedule_retrieve
12983             {
12984             my $self = shift( @_ );
12985             my $args = shift( @_ );
12986             my $okParams =
12987             {
12988             expandable => { allowed => $EXPANDABLES->{ 'subscription_schedule' }, data_prefix_is_ok => 1 },
12989             };
12990             $args = $self->_contract( 'subscription_schedule', $args ) || CORE::return( $self->pass_error );
12991             my $err = $self->_check_parameters( $okParams, $args );
12992             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
12993             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No subscription_schedule id (with parameter 'id') was provided to retrieve its information." ) );
12994             my $hash = $self->get( "subscription_schedules/${id}", $args ) || CORE::return( $self->pass_error );
12995             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::Subscription::Schedule', $hash ) );
12996             }
12997             PERL
12998             # NOTE: subscription_schedule_update()
12999             subscription_schedule_update => <<'PERL',
13000             sub subscription_schedule_update
13001             {
13002             my $self = shift( @_ );
13003             my $args = shift( @_ );
13004             my $okParams =
13005             {
13006             expandable => { allowed => $EXPANDABLES->{ 'subscription_schedule' } },
13007             default_settings => { type => "hash" },
13008             end_behavior => { type => "string" },
13009             metadata => { type => "hash" },
13010             phases => { type => "array" },
13011             proration_behavior => { type => "string" },
13012             };
13013             $args = $self->_contract( 'subscription_schedule', $args ) || CORE::return( $self->pass_error );
13014             my $err = $self->_check_parameters( $okParams, $args );
13015             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
13016             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No subscription_schedule id (with parameter 'id') was provided to update its information." ) );
13017             my $hash = $self->post( "subscription_schedules/${id}", $args ) || CORE::return( $self->pass_error );
13018             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::Subscription::Schedule', $hash ) );
13019             }
13020             PERL
13021             # NOTE: subscription_schedules()
13022             subscription_schedules => <<'PERL',
13023             # <https://stripe.com/docs/api/subscription_schedules>
13024             sub subscription_schedules
13025             {
13026             my $self = shift( @_ );
13027             my $allowed = [qw( cancel create list release retrieve update )];
13028             my $action = shift( @_ );
13029             my $meth = $self->_get_method( 'subscription_schedule', $action, $allowed ) || CORE::return( $self->pass_error );
13030             CORE::return( $self->$meth( @_ ) );
13031             }
13032             PERL
13033             # NOTE: subscription_search()
13034             subscription_search => <<'PERL',
13035             sub subscription_search
13036             {
13037             my $self = shift( @_ );
13038             my $args = shift( @_ );
13039             my $okParams =
13040             {
13041             expandable => { allowed => $EXPANDABLES->{ 'subscription' }, data_prefix_is_ok => 1 },
13042             limit => { type => "string" },
13043             page => { type => "string" },
13044             query => { type => "string", required => 1 },
13045             };
13046             $args = $self->_contract( 'subscription', $args ) || CORE::return( $self->pass_error );
13047             my $err = $self->_check_parameters( $okParams, $args );
13048             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
13049             my $hash = $self->get( "subscriptions", $args ) || CORE::return( $self->pass_error );
13050             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::Subscription', $hash ) );
13051             }
13052             PERL
13053             # NOTE: subscription_update()
13054             subscription_update => <<'PERL',
13055             # https://stripe.com/docs/api/customers/update?lang=curl
13056             sub subscription_update
13057             {
13058             my $self = shift( @_ );
13059             CORE::return( $self->error( "No parameters were provided to update a subscription" ) ) if( !scalar( @_ ) );
13060             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Billing::Subscription', @_ );
13061             my $okParams =
13062             {
13063             expandable => { allowed => $EXPANDABLES->{subscription} },
13064             add_invoice_items => { type => "array" },
13065             application_fee_percent => { re => qr/^[0-100]$/, type => "decimal" },
13066             automatic_tax => { type => "hash" },
13067             billing_cycle_anchor => { re => qr/^\d+$/, type => "timestamp" },
13068             billing_thresholds => {
13069             fields => ["amount_gte", "reset_billing_cycle_anchor"],
13070             type => "hash",
13071             },
13072             cancel_at => { type => "timestamp" },
13073             cancel_at_period_end => { type => "boolean" },
13074             collection_method => { re => qr/^(?:charge_automatically|send_invoice)$/, type => "string" },
13075             coupon => { type => "string" },
13076             days_until_due => { type => "integer" },
13077             default_payment_method => { re => qr/^[\w\_]+$/, type => "string" },
13078             default_source => { type => "string" },
13079             default_tax_rates => { type => "array" },
13080             description => { type => "string" },
13081             id => { re => qr/^\w+$/, required => 1 },
13082             items => {
13083             fields => [
13084             "id",
13085             "plan",
13086             "billing_thresholds.usage_gte",
13087             "clear_usage",
13088             "deleted",
13089             "metadata",
13090             "quantity",
13091             "tax_rates",
13092             ],
13093             type => "array",
13094             },
13095             metadata => { type => "hash" },
13096             off_session => { type => "boolean" },
13097             pause_collection => { fields => ["behavior", "resumes_at"], type => "string" },
13098             payment_behavior => {
13099             re => qr/^(?:allow_incomplete|error_if_incomplete)$/,
13100             type => "string",
13101             },
13102             payment_settings => { type => "hash" },
13103             pending_invoice_item_interval => { fields => ["interval", "interval_count"], type => "hash" },
13104             promotion_code => { type => "string" },
13105             prorate => {},
13106             proration_behavior => { type => "string" },
13107             proration_date => { type => "datetime" },
13108             tax_percent => { re => qr/^[0-100]$/ },
13109             transfer_data => { type => "hash" },
13110             trial_end => { re => qr/^(?:\d+|now)$/, type => "timestamp" },
13111             trial_from_plan => { type => "boolean" },
13112             };
13113              
13114             $args = $self->_contract( 'subscription', $args ) || CORE::return( $self->pass_error );
13115             # We found some errors
13116             my $err = $self->_check_parameters( $okParams, $args );
13117             # $self->message( 3, "Data to be posted: ", $self->dumper( $args ) ); exit;
13118             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
13119             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No subscription id was provided to update subscription's details" ) );
13120             my $hash = $self->post( "subscriptions/${id}", $args ) || CORE::return( $self->pass_error );
13121             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::Subscription', $hash ) );
13122             }
13123             PERL
13124             # NOTE: subscriptions()
13125             subscriptions => <<'PERL',
13126             # <https://stripe.com/docs/api/subscriptions>
13127             sub subscriptions
13128             {
13129             my $self = shift( @_ );
13130             my $allowed = [qw( cancel create delete delete_discount list retrieve search update )];
13131             my $action = shift( @_ );
13132             my $meth = $self->_get_method( 'subscription', $action, $allowed ) || CORE::return( $self->pass_error );
13133             CORE::return( $self->$meth( @_ ) );
13134             }
13135             PERL
13136             # NOTE: tax_code()
13137             tax_code => <<'PERL',
13138             sub tax_code { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Product::TaxCode', @_ ) ); }
13139             PERL
13140             # NOTE: tax_code_list()
13141             tax_code_list => <<'PERL',
13142             sub tax_code_list
13143             {
13144             my $self = shift( @_ );
13145             CORE::return( $self->error( "No parameters were provided to list tax codes" ) ) if( !scalar( @_ ) );
13146             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Product::TaxCode', @_ );
13147             my $okParams =
13148             {
13149             expandable => { allowed => $EXPANDABLES->{tax_code}, data_prefix_is_ok => 1 },
13150             ending_before => { re => qr/^\w+$/, type => "string" },
13151             limit => { re => qr/^\d+$/, type => "string" },
13152             starting_after => { re => qr/^\w+$/, type => "string" },
13153             };
13154              
13155             my $err = $self->_check_parameters( $okParams, $args );
13156             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
13157             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No tax code id was provided to list its information" ) );
13158             if( $args->{expand} )
13159             {
13160             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
13161             }
13162             my $hash = $self->get( "tax_codes", $args ) || CORE::return( $self->pass_error );
13163             CORE::return( $self->_response_to_object( 'Net::API::Stripe::List', $hash ) );
13164             }
13165             PERL
13166             # NOTE: tax_code_retrieve()
13167             tax_code_retrieve => <<'PERL',
13168             sub tax_code_retrieve
13169             {
13170             my $self = shift( @_ );
13171             CORE::return( $self->error( "No parameters were provided to retrieve tax code" ) ) if( !scalar( @_ ) );
13172             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Product::TaxCode', @_ );
13173             my $okParams =
13174             {
13175             expandable => { allowed => $EXPANDABLES->{tax_code} },
13176             id => { re => qr/^\w+$/, required => 1 },
13177             };
13178             my $err = $self->_check_parameters( $okParams, $args );
13179             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
13180             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No tax id was provided to retrieve tax code information" ) );
13181             my $hash = $self->get( "tax_codes/${id}", $args ) || CORE::return( $self->pass_error );
13182             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Product::TaxCode', $hash ) );
13183             }
13184             PERL
13185             # NOTE: tax_codes()
13186             tax_codes => <<'PERL',
13187             sub tax_codes
13188             {
13189             my $self = shift( @_ );
13190             my $action = shift( @_ );
13191             my $allowed = [qw( retrieve list )];
13192             my $meth = $self->_get_method( 'tax_code', $action, $allowed ) || CORE::return( $self->pass_error );
13193             CORE::return( $self->$meth( @_ ) );
13194             }
13195             PERL
13196             # NOTE: tax_id()
13197             tax_id => <<'PERL',
13198             sub tax_id { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Billing::TaxID', @_ ) ); }
13199             PERL
13200             # NOTE: tax_id_create()
13201             tax_id_create => <<'PERL',
13202             sub tax_id_create
13203             {
13204             my $self = shift( @_ );
13205             CORE::return( $self->error( "No parameters were provided to create a tax_id" ) ) if( !scalar( @_ ) );
13206             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Billing::TaxID', @_ );
13207             my $okParams =
13208             {
13209             expandable => { allowed => $EXPANDABLES->{tax_id} },
13210             customer => { re => qr/^\w+$/, required => 1 },
13211             type => { re => qr/^\w+$/, required => 1, type => "string" },
13212             value => { required => 1, type => "string" },
13213             };
13214              
13215             $args = $self->_contract( 'tax_id', $args ) || CORE::return( $self->pass_error );
13216             my $err = $self->_check_parameters( $okParams, $args );
13217             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
13218             my $id = CORE::delete( $args->{customer} ) || CORE::return( $self->error( "No customer id was provided to create a tax_id for the customer" ) );
13219             my $hash = $self->post( "customers/$id/tax_ids", $args ) || CORE::return( $self->pass_error );
13220             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::TaxID', $hash ) );
13221             }
13222             PERL
13223             # NOTE: tax_id_delete()
13224             tax_id_delete => <<'PERL',
13225             sub tax_id_delete
13226             {
13227             my $self = shift( @_ );
13228             CORE::return( $self->error( "No parameters were provided to delete a tax_id" ) ) if( !scalar( @_ ) );
13229             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Billing::TaxID', @_ );
13230             my $okParams =
13231             {
13232             expandable => { allowed => $EXPANDABLES->{tax_id} },
13233             id => { re => qr/^\w+$/, required => 1 },
13234             customer => { re => qr/^\w+$/, required => 1 },
13235             };
13236             my $err = $self->_check_parameters( $okParams, $args );
13237             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
13238             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No tax id was provided to delete." ) );
13239             my $cust_id = CORE::delete( $args->{customer} ) || CORE::return( $self->error( "No customer id was provided to delete his/her tax_id" ) );
13240             my $hash = $self->delete( "customers/${cust_id}/tax_ids/${id}", $args ) || CORE::return( $self->pass_error );
13241             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::TaxID', $hash ) );
13242             }
13243             PERL
13244             # NOTE: tax_id_list()
13245             tax_id_list => <<'PERL',
13246             sub tax_id_list
13247             {
13248             my $self = shift( @_ );
13249             CORE::return( $self->error( "No parameters were provided to list customer's tax ids" ) ) if( !scalar( @_ ) );
13250             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Customer', @_ );
13251             my $okParams =
13252             {
13253             expandable => { allowed => $EXPANDABLES->{tax_id}, data_prefix_is_ok => 1 },
13254             customer => { re => qr/^\w+$/, required => 1 },
13255             # "A cursor for use in pagination. ending_before is an object ID that defines your place in the list."
13256             ending_before => qr/^\w+$/,
13257             limit => qr/^\d+$/,
13258             starting_after => qr/^\w+$/,
13259             };
13260             my $err = $self->_check_parameters( $okParams, $args );
13261             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
13262             my $id = CORE::delete( $args->{customer} ) || CORE::delete( $args->{id} ) || CORE::return( $self->error( "No customer id was provided to list his/her tax ids" ) );
13263             if( $args->{expand} )
13264             {
13265             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
13266             }
13267             my $hash = $self->get( "customers/${id}/tax_ids", $args ) || CORE::return( $self->pass_error );
13268             CORE::return( $self->_response_to_object( 'Net::API::Stripe::List', $hash ) );
13269             }
13270             PERL
13271             # NOTE: tax_id_retrieve()
13272             tax_id_retrieve => <<'PERL',
13273             sub tax_id_retrieve
13274             {
13275             my $self = shift( @_ );
13276             CORE::return( $self->error( "No parameters were provided to retrieve tax_id" ) ) if( !scalar( @_ ) );
13277             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Billing::TaxID', @_ );
13278             my $okParams =
13279             {
13280             expandable => { allowed => $EXPANDABLES->{tax_id} },
13281             id => { re => qr/^\w+$/, required => 1 },
13282             customer => { re => qr/^\w+$/, required => 1 },
13283             };
13284             my $err = $self->_check_parameters( $okParams, $args );
13285             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
13286             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No tax id was provided to retrieve customer's tax_id" ) );
13287             my $cust_id = CORE::delete( $args->{customer} ) || CORE::return( $self->error( "No customer id was provided to retrieve his/her tax_id" ) );
13288             my $hash = $self->get( "customers/${cust_id}/tax_ids/${id}", $args ) || CORE::return( $self->pass_error );
13289             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::TaxID', $hash ) );
13290             }
13291             PERL
13292             # NOTE: tax_ids()
13293             tax_ids => <<'PERL',
13294             sub tax_ids
13295             {
13296             my $self = shift( @_ );
13297             my $action = shift( @_ );
13298             my $allowed = [qw( create retrieve delete list )];
13299             my $meth = $self->_get_method( 'tax_id', $action, $allowed ) || CORE::return( $self->pass_error );
13300             CORE::return( $self->$meth( @_ ) );
13301             }
13302             PERL
13303             # NOTE: tax_rate()
13304             tax_rate => <<'PERL',
13305             sub tax_rate { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Tax::Rate', @_ ) ); }
13306             PERL
13307             # NOTE: tax_rate_create()
13308             tax_rate_create => <<'PERL',
13309             sub tax_rate_create
13310             {
13311             my $self = shift( @_ );
13312             CORE::return( $self->error( "No parameters were provided to create a tax rate" ) ) if( !scalar( @_ ) );
13313             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Tax::Rate', @_ );
13314             my $okParams =
13315             {
13316             expandable => { allowed => $EXPANDABLES->{tax_rate} },
13317             active => { type => "boolean" },
13318             country => { re => qr/^[A-Z]+$/, type => "string" },
13319             description => { type => "string" },
13320             display_name => { re => qr/^.+$/, required => 1, type => "string" },
13321             inclusive => { required => 1, type => "boolean" },
13322             jurisdiction => { re => qr/^[A-Z]+$/, type => "string" },
13323             metadata => { type => "hash" },
13324             percentage => { required => 1, type => "integer" },
13325             state => { type => "string" },
13326             tax_type => { type => "string" },
13327             };
13328              
13329             $args = $self->_contract( 'tax_rate', $args ) || CORE::return( $self->pass_error );
13330             my $err = $self->_check_parameters( $okParams, $args );
13331             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
13332             my $hash = $self->post( "tax_rates", $args ) || CORE::return( $self->pass_error );
13333             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Tax::Rate', $hash ) );
13334             }
13335             PERL
13336             # NOTE: tax_rate_list()
13337             tax_rate_list => <<'PERL',
13338             sub tax_rate_list
13339             {
13340             my $self = shift( @_ );
13341             CORE::return( $self->error( "No parameters were provided to list tax rates" ) ) if( !scalar( @_ ) );
13342             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Tax::Rate', @_ );
13343             my $okParams =
13344             {
13345             expandable => { allowed => $EXPANDABLES->{tax_rate}, data_prefix_is_ok => 1 },
13346             active => { type => "boolean" },
13347             created => { re => qr/^\d+$/, type => "timestamp" },
13348             'created.gt' => { re => qr/^\d+$/ },
13349             'created.gte' => { re => qr/^\d+$/ },
13350             'created.lt' => { re => qr/^\d+$/ },
13351             'created.lte' => { re => qr/^\d+$/ },
13352             ending_before => { re => qr/^\w+$/, type => "string" },
13353             id => { re => qr/^\w+$/, required => 1 },
13354             inclusive => { type => "boolean" },
13355             limit => { re => qr/^\d+$/, type => "string" },
13356             starting_after => { re => qr/^\w+$/, type => "string" },
13357             };
13358              
13359             my $err = $self->_check_parameters( $okParams, $args );
13360             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
13361             if( $args->{expand} )
13362             {
13363             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
13364             }
13365             my $hash = $self->get( "tax_rates", $args ) || CORE::return( $self->pass_error );
13366             CORE::return( $self->_response_to_object( 'Net::API::Stripe::List', $hash ) );
13367             }
13368             PERL
13369             # NOTE: tax_rate_retrieve()
13370             tax_rate_retrieve => <<'PERL',
13371             sub tax_rate_retrieve
13372             {
13373             my $self = shift( @_ );
13374             CORE::return( $self->error( "No parameters were provided to retrieve a tax rate" ) ) if( !scalar( @_ ) );
13375             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Tax::Rate', @_ );
13376             my $okParams =
13377             {
13378             expandable => { allowed => $EXPANDABLES->{tax_rate} },
13379             id => { re => qr/^\w+$/, required => 1 },
13380             };
13381             my $err = $self->_check_parameters( $okParams, $args );
13382             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
13383             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No tax id was provided to retrieve a tax rate" ) );
13384             my $hash = $self->get( "tax_rates/${id}", $args ) || CORE::return( $self->pass_error );
13385             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Tax::Rate', $hash ) );
13386             }
13387             PERL
13388             # NOTE: tax_rate_update()
13389             tax_rate_update => <<'PERL',
13390             sub tax_rate_update
13391             {
13392             my $self = shift( @_ );
13393             CORE::return( $self->error( "No parameters were provided to update a tax rate" ) ) if( !scalar( @_ ) );
13394             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Tax::Rate', @_ );
13395             my $okParams =
13396             {
13397             expandable => { allowed => $EXPANDABLES->{tax_rate} },
13398             active => { type => "boolean" },
13399             country => { re => qr/^[A-Z]+$/, type => "string" },
13400             description => { type => "string" },
13401             display_name => { re => qr/^.+$/, required => 1, type => "string" },
13402             id => { re => qr/^\w+$/, required => 1 },
13403             jurisdiction => { re => qr/^[A-Z]+$/, type => "string" },
13404             metadata => { type => "hash" },
13405             state => { type => "string" },
13406             tax_type => { type => "string" },
13407             };
13408              
13409             $args = $self->_contract( 'tax_rate', $args ) || CORE::return( $self->pass_error );
13410             # We found some errors
13411             my $err = $self->_check_parameters( $okParams, $args );
13412             # $self->message( 3, "Data to be posted: ", $self->dumper( $args ) ); exit;
13413             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
13414             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No tax rate id was provided to update its details" ) );
13415             my $hash = $self->post( "tax_rates/${id}", $args ) || CORE::return( $self->pass_error );
13416             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Tax::Rate', $hash ) );
13417             }
13418             PERL
13419             # NOTE: tax_rates()
13420             tax_rates => <<'PERL',
13421             sub tax_rates
13422             {
13423             my $self = shift( @_ );
13424             my $action = shift( @_ );
13425             my $allowed = [qw( create retrieve update list )];
13426             my $meth = $self->_get_method( 'tax_rate', $action, $allowed ) || CORE::return( $self->pass_error );
13427             CORE::return( $self->$meth( @_ ) );
13428             }
13429             PERL
13430             # NOTE: terminal_configuration()
13431             terminal_configuration => <<'PERL',
13432             sub terminal_configuration { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Terminal::Configuration', @_ ) ); }
13433             PERL
13434             # NOTE: terminal_configuration_create()
13435             terminal_configuration_create => <<'PERL',
13436             sub terminal_configuration_create
13437             {
13438             my $self = shift( @_ );
13439             my $args = shift( @_ );
13440             my $okParams =
13441             {
13442             expandable => { allowed => $EXPANDABLES->{ 'terminal.configuration' } },
13443             bbpos_wisepos_e => { type => "hash" },
13444             tipping => { type => "hash" },
13445             verifone_p400 => { type => "hash" },
13446             };
13447             $args = $self->_contract( 'terminal.configuration', $args ) || CORE::return( $self->pass_error );
13448             my $err = $self->_check_parameters( $okParams, $args );
13449             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
13450             my $hash = $self->post( "", $args ) || CORE::return( $self->pass_error );
13451             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Terminal::Configuration', $hash ) );
13452             }
13453             PERL
13454             # NOTE: terminal_configuration_delete()
13455             terminal_configuration_delete => <<'PERL',
13456             sub terminal_configuration_delete
13457             {
13458             my $self = shift( @_ );
13459             my $args = shift( @_ );
13460             my $okParams =
13461             {
13462             expandable => { allowed => $EXPANDABLES->{ 'terminal.configuration' } },
13463             };
13464             $args = $self->_contract( 'terminal.configuration', $args ) || CORE::return( $self->pass_error );
13465             my $err = $self->_check_parameters( $okParams, $args );
13466             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
13467             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No terminal.configuration id (with parameter 'id') was provided to delete its information." ) );
13468             my $hash = $self->delete( "terminal/configurations/${id}", $args ) || CORE::return( $self->pass_error );
13469             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Terminal::Configuration', $hash ) );
13470             }
13471             PERL
13472             # NOTE: terminal_configuration_list()
13473             terminal_configuration_list => <<'PERL',
13474             sub terminal_configuration_list
13475             {
13476             my $self = shift( @_ );
13477             CORE::return( $self->error( "No parameters were provided to list terminal configuration information." ) ) if( !scalar( @_ ) );
13478             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Terminal::Configuration', @_ );
13479             my $okParams =
13480             {
13481             expandable => { allowed => $EXPANDABLES->{ 'terminal.configuration' }, data_prefix_is_ok => 1 },
13482             ending_before => { type => "string" },
13483             is_account_default => { type => "boolean" },
13484             limit => { type => "string" },
13485             starting_after => { type => "string" },
13486             };
13487             my $err = $self->_check_parameters( $okParams, $args );
13488             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
13489             if( $args->{expand} )
13490             {
13491             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
13492             }
13493             my $hash = $self->get( "", $args ) || CORE::return( $self->pass_error );
13494             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Terminal::Configuration', $hash ) );
13495             }
13496             PERL
13497             # NOTE: terminal_configuration_retrieve()
13498             terminal_configuration_retrieve => <<'PERL',
13499             sub terminal_configuration_retrieve
13500             {
13501             my $self = shift( @_ );
13502             my $args = shift( @_ );
13503             my $okParams =
13504             {
13505             expandable => { allowed => $EXPANDABLES->{ 'terminal.configuration' }, data_prefix_is_ok => 1 },
13506             };
13507             $args = $self->_contract( 'terminal.configuration', $args ) || CORE::return( $self->pass_error );
13508             my $err = $self->_check_parameters( $okParams, $args );
13509             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
13510             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No terminal.configuration id (with parameter 'id') was provided to retrieve its information." ) );
13511             my $hash = $self->get( "terminal/configurations/${id}", $args ) || CORE::return( $self->pass_error );
13512             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Terminal::Configuration', $hash ) );
13513             }
13514             PERL
13515             # NOTE: terminal_configuration_update()
13516             terminal_configuration_update => <<'PERL',
13517             sub terminal_configuration_update
13518             {
13519             my $self = shift( @_ );
13520             my $args = shift( @_ );
13521             my $okParams =
13522             {
13523             expandable => { allowed => $EXPANDABLES->{ 'terminal.configuration' } },
13524             bbpos_wisepos_e => { type => "hash" },
13525             tipping => { type => "hash" },
13526             verifone_p400 => { type => "hash" },
13527             };
13528             $args = $self->_contract( 'terminal.configuration', $args ) || CORE::return( $self->pass_error );
13529             my $err = $self->_check_parameters( $okParams, $args );
13530             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
13531             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No terminal.configuration id (with parameter 'id') was provided to update its information." ) );
13532             my $hash = $self->post( "terminal/configurations/${id}", $args ) || CORE::return( $self->pass_error );
13533             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Terminal::Configuration', $hash ) );
13534             }
13535             PERL
13536             # NOTE: terminal_configurations()
13537             terminal_configurations => <<'PERL',
13538             # <https://stripe.com/docs/api/terminal/configuration>
13539             sub terminal_configurations
13540             {
13541             my $self = shift( @_ );
13542             my $allowed = [qw( create delete list retrieve update )];
13543             my $action = shift( @_ );
13544             my $meth = $self->_get_method( 'terminal_configuration', $action, $allowed ) || CORE::return( $self->pass_error );
13545             CORE::return( $self->$meth( @_ ) );
13546             }
13547             PERL
13548             # NOTE: terminal_connection_token()
13549             terminal_connection_token => <<'PERL',
13550             sub terminal_connection_token { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Terminal::ConnectionToken', @_ ) ); }
13551             PERL
13552             # NOTE: terminal_connection_token_create()
13553             terminal_connection_token_create => <<'PERL',
13554             sub terminal_connection_token_create
13555             {
13556             my $self = shift( @_ );
13557             my $args = shift( @_ );
13558             my $okParams =
13559             {
13560             expandable => { allowed => $EXPANDABLES->{ 'terminal.connection_token' } },
13561             location => { type => "string" },
13562             };
13563             $args = $self->_contract( 'terminal.connection_token', $args ) || CORE::return( $self->pass_error );
13564             my $err = $self->_check_parameters( $okParams, $args );
13565             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
13566             my $hash = $self->post( "", $args ) || CORE::return( $self->pass_error );
13567             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Terminal::ConnectionToken', $hash ) );
13568             }
13569             PERL
13570             # NOTE: terminal_connection_tokens()
13571             terminal_connection_tokens => <<'PERL',
13572             # <https://stripe.com/docs/api/terminal/connection_tokens>
13573             sub terminal_connection_tokens
13574             {
13575             my $self = shift( @_ );
13576             my $allowed = [qw( create )];
13577             my $action = shift( @_ );
13578             my $meth = $self->_get_method( 'terminal_connection_token', $action, $allowed ) || CORE::return( $self->pass_error );
13579             CORE::return( $self->$meth( @_ ) );
13580             }
13581             PERL
13582             # NOTE: terminal_location()
13583             terminal_location => <<'PERL',
13584             sub terminal_location { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Terminal::Location', @_ ) ); }
13585             PERL
13586             # NOTE: terminal_location_create()
13587             terminal_location_create => <<'PERL',
13588             sub terminal_location_create
13589             {
13590             my $self = shift( @_ );
13591             my $args = shift( @_ );
13592             my $okParams =
13593             {
13594             expandable => { allowed => $EXPANDABLES->{ 'terminal.location' } },
13595             address => { type => "hash", required => 1 },
13596             configuration_overrides => { type => "string" },
13597             display_name => { type => "string", required => 1 },
13598             metadata => { type => "hash" },
13599             };
13600             $args = $self->_contract( 'terminal.location', $args ) || CORE::return( $self->pass_error );
13601             my $err = $self->_check_parameters( $okParams, $args );
13602             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
13603             my $hash = $self->post( "", $args ) || CORE::return( $self->pass_error );
13604             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Terminal::Location', $hash ) );
13605             }
13606             PERL
13607             # NOTE: terminal_location_delete()
13608             terminal_location_delete => <<'PERL',
13609             sub terminal_location_delete
13610             {
13611             my $self = shift( @_ );
13612             my $args = shift( @_ );
13613             my $okParams =
13614             {
13615             expandable => { allowed => $EXPANDABLES->{ 'terminal.location' } },
13616             };
13617             $args = $self->_contract( 'terminal.location', $args ) || CORE::return( $self->pass_error );
13618             my $err = $self->_check_parameters( $okParams, $args );
13619             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
13620             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No terminal.location id (with parameter 'id') was provided to delete its information." ) );
13621             my $hash = $self->delete( "terminal/locations/${id}", $args ) || CORE::return( $self->pass_error );
13622             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Terminal::Location', $hash ) );
13623             }
13624             PERL
13625             # NOTE: terminal_location_list()
13626             terminal_location_list => <<'PERL',
13627             sub terminal_location_list
13628             {
13629             my $self = shift( @_ );
13630             CORE::return( $self->error( "No parameters were provided to list terminal location information." ) ) if( !scalar( @_ ) );
13631             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Terminal::Location', @_ );
13632             my $okParams =
13633             {
13634             expandable => { allowed => $EXPANDABLES->{ 'terminal.location' }, data_prefix_is_ok => 1 },
13635             ending_before => { type => "string" },
13636             limit => { type => "string" },
13637             starting_after => { type => "string" },
13638             };
13639             my $err = $self->_check_parameters( $okParams, $args );
13640             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
13641             if( $args->{expand} )
13642             {
13643             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
13644             }
13645             my $hash = $self->get( "", $args ) || CORE::return( $self->pass_error );
13646             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Terminal::Location', $hash ) );
13647             }
13648             PERL
13649             # NOTE: terminal_location_retrieve()
13650             terminal_location_retrieve => <<'PERL',
13651             sub terminal_location_retrieve
13652             {
13653             my $self = shift( @_ );
13654             my $args = shift( @_ );
13655             my $okParams =
13656             {
13657             expandable => { allowed => $EXPANDABLES->{ 'terminal.location' }, data_prefix_is_ok => 1 },
13658             };
13659             $args = $self->_contract( 'terminal.location', $args ) || CORE::return( $self->pass_error );
13660             my $err = $self->_check_parameters( $okParams, $args );
13661             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
13662             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No terminal.location id (with parameter 'id') was provided to retrieve its information." ) );
13663             my $hash = $self->get( "terminal/locations/${id}", $args ) || CORE::return( $self->pass_error );
13664             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Terminal::Location', $hash ) );
13665             }
13666             PERL
13667             # NOTE: terminal_location_update()
13668             terminal_location_update => <<'PERL',
13669             sub terminal_location_update
13670             {
13671             my $self = shift( @_ );
13672             my $args = shift( @_ );
13673             my $okParams =
13674             {
13675             expandable => { allowed => $EXPANDABLES->{ 'terminal.location' } },
13676             address => { type => "hash" },
13677             configuration_overrides => { type => "string" },
13678             display_name => { type => "string" },
13679             metadata => { type => "hash" },
13680             };
13681             $args = $self->_contract( 'terminal.location', $args ) || CORE::return( $self->pass_error );
13682             my $err = $self->_check_parameters( $okParams, $args );
13683             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
13684             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No terminal.location id (with parameter 'id') was provided to update its information." ) );
13685             my $hash = $self->post( "terminal/locations/${id}", $args ) || CORE::return( $self->pass_error );
13686             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Terminal::Location', $hash ) );
13687             }
13688             PERL
13689             # NOTE: terminal_locations()
13690             terminal_locations => <<'PERL',
13691             # <https://stripe.com/docs/api/terminal/locations>
13692             sub terminal_locations
13693             {
13694             my $self = shift( @_ );
13695             my $allowed = [qw( create delete list retrieve update )];
13696             my $action = shift( @_ );
13697             my $meth = $self->_get_method( 'terminal_location', $action, $allowed ) || CORE::return( $self->pass_error );
13698             CORE::return( $self->$meth( @_ ) );
13699             }
13700             PERL
13701             # NOTE: terminal_reader()
13702             terminal_reader => <<'PERL',
13703             sub terminal_reader { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Terminal::Reader', @_ ) ); }
13704             PERL
13705             # NOTE: terminal_reader_cancel_action()
13706             terminal_reader_cancel_action => <<'PERL',
13707             sub terminal_reader_cancel_action
13708             {
13709             my $self = shift( @_ );
13710             my $args = shift( @_ );
13711             my $okParams =
13712             {
13713             expandable => { allowed => $EXPANDABLES->{ 'terminal.reader' } },
13714             };
13715             $args = $self->_contract( 'terminal.reader', $args ) || CORE::return( $self->pass_error );
13716             my $err = $self->_check_parameters( $okParams, $args );
13717             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
13718             my $hash = $self->post( "", $args ) || CORE::return( $self->pass_error );
13719             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Terminal::Reader', $hash ) );
13720             }
13721             PERL
13722             # NOTE: terminal_reader_create()
13723             terminal_reader_create => <<'PERL',
13724             sub terminal_reader_create
13725             {
13726             my $self = shift( @_ );
13727             my $args = shift( @_ );
13728             my $okParams =
13729             {
13730             expandable => { allowed => $EXPANDABLES->{ 'terminal.reader' } },
13731             label => { type => "string" },
13732             location => { type => "string" },
13733             metadata => { type => "hash" },
13734             registration_code => { type => "string", required => 1 },
13735             };
13736             $args = $self->_contract( 'terminal.reader', $args ) || CORE::return( $self->pass_error );
13737             my $err = $self->_check_parameters( $okParams, $args );
13738             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
13739             my $hash = $self->post( "", $args ) || CORE::return( $self->pass_error );
13740             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Terminal::Reader', $hash ) );
13741             }
13742             PERL
13743             # NOTE: terminal_reader_delete()
13744             terminal_reader_delete => <<'PERL',
13745             sub terminal_reader_delete
13746             {
13747             my $self = shift( @_ );
13748             my $args = shift( @_ );
13749             my $okParams =
13750             {
13751             expandable => { allowed => $EXPANDABLES->{ 'terminal.reader' } },
13752             };
13753             $args = $self->_contract( 'terminal.reader', $args ) || CORE::return( $self->pass_error );
13754             my $err = $self->_check_parameters( $okParams, $args );
13755             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
13756             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No terminal.reader id (with parameter 'id') was provided to delete its information." ) );
13757             my $hash = $self->delete( "terminal/readers/${id}", $args ) || CORE::return( $self->pass_error );
13758             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Terminal::Reader', $hash ) );
13759             }
13760             PERL
13761             # NOTE: terminal_reader_list()
13762             terminal_reader_list => <<'PERL',
13763             sub terminal_reader_list
13764             {
13765             my $self = shift( @_ );
13766             CORE::return( $self->error( "No parameters were provided to list terminal reader information." ) ) if( !scalar( @_ ) );
13767             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Terminal::Reader', @_ );
13768             my $okParams =
13769             {
13770             expandable => { allowed => $EXPANDABLES->{ 'terminal.reader' }, data_prefix_is_ok => 1 },
13771             device_type => { type => "string" },
13772             ending_before => { type => "string" },
13773             limit => { type => "string" },
13774             location => { type => "string" },
13775             serial_number => { type => "string" },
13776             starting_after => { type => "string" },
13777             status => { type => "string" },
13778             };
13779             my $err = $self->_check_parameters( $okParams, $args );
13780             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
13781             if( $args->{expand} )
13782             {
13783             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
13784             }
13785             my $hash = $self->get( "", $args ) || CORE::return( $self->pass_error );
13786             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Terminal::Reader', $hash ) );
13787             }
13788             PERL
13789             # NOTE: terminal_reader_present_payment_method()
13790             terminal_reader_present_payment_method => <<'PERL',
13791             sub terminal_reader_present_payment_method
13792             {
13793             my $self = shift( @_ );
13794             my $args = shift( @_ );
13795             my $okParams =
13796             {
13797             expandable => { allowed => $EXPANDABLES->{ 'terminal.reader' } },
13798             card_present => { type => "object" },
13799             type => { type => "string" },
13800             };
13801             $args = $self->_contract( 'terminal.reader', $args ) || CORE::return( $self->pass_error );
13802             my $err = $self->_check_parameters( $okParams, $args );
13803             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
13804             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No terminal.reader id (with parameter 'id') was provided to present_payment_method its information." ) );
13805             my $hash = $self->post( "test_helpers/terminal/readers/${id}", $args ) || CORE::return( $self->pass_error );
13806             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Terminal::Reader', $hash ) );
13807             }
13808             PERL
13809             # NOTE: terminal_reader_process_payment_intent()
13810             terminal_reader_process_payment_intent => <<'PERL',
13811             sub terminal_reader_process_payment_intent
13812             {
13813             my $self = shift( @_ );
13814             my $args = shift( @_ );
13815             my $okParams =
13816             {
13817             expandable => { allowed => $EXPANDABLES->{ 'terminal.reader' } },
13818             payment_intent => { type => "string", required => 1 },
13819             process_config => { type => "object" },
13820             };
13821             $args = $self->_contract( 'terminal.reader', $args ) || CORE::return( $self->pass_error );
13822             my $err = $self->_check_parameters( $okParams, $args );
13823             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
13824             my $hash = $self->post( "", $args ) || CORE::return( $self->pass_error );
13825             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Terminal::Reader', $hash ) );
13826             }
13827             PERL
13828             # NOTE: terminal_reader_process_setup_intent()
13829             terminal_reader_process_setup_intent => <<'PERL',
13830             sub terminal_reader_process_setup_intent
13831             {
13832             my $self = shift( @_ );
13833             my $args = shift( @_ );
13834             my $okParams =
13835             {
13836             expandable => { allowed => $EXPANDABLES->{ 'terminal.reader' } },
13837             customer_consent_collected => { type => "boolean", required => 1 },
13838             setup_intent => { type => "string", required => 1 },
13839             };
13840             $args = $self->_contract( 'terminal.reader', $args ) || CORE::return( $self->pass_error );
13841             my $err = $self->_check_parameters( $okParams, $args );
13842             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
13843             my $hash = $self->post( "", $args ) || CORE::return( $self->pass_error );
13844             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Terminal::Reader', $hash ) );
13845             }
13846             PERL
13847             # NOTE: terminal_reader_retrieve()
13848             terminal_reader_retrieve => <<'PERL',
13849             sub terminal_reader_retrieve
13850             {
13851             my $self = shift( @_ );
13852             my $args = shift( @_ );
13853             my $okParams =
13854             {
13855             expandable => { allowed => $EXPANDABLES->{ 'terminal.reader' }, data_prefix_is_ok => 1 },
13856             };
13857             $args = $self->_contract( 'terminal.reader', $args ) || CORE::return( $self->pass_error );
13858             my $err = $self->_check_parameters( $okParams, $args );
13859             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
13860             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No terminal.reader id (with parameter 'id') was provided to retrieve its information." ) );
13861             my $hash = $self->get( "terminal/readers/${id}", $args ) || CORE::return( $self->pass_error );
13862             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Terminal::Reader', $hash ) );
13863             }
13864             PERL
13865             # NOTE: terminal_reader_set_reader_display()
13866             terminal_reader_set_reader_display => <<'PERL',
13867             sub terminal_reader_set_reader_display
13868             {
13869             my $self = shift( @_ );
13870             my $args = shift( @_ );
13871             my $okParams =
13872             {
13873             expandable => { allowed => $EXPANDABLES->{ 'terminal.reader' } },
13874             cart => { type => "object" },
13875             type => { type => "string", required => 1 },
13876             };
13877             $args = $self->_contract( 'terminal.reader', $args ) || CORE::return( $self->pass_error );
13878             my $err = $self->_check_parameters( $okParams, $args );
13879             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
13880             my $hash = $self->post( "", $args ) || CORE::return( $self->pass_error );
13881             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Terminal::Reader', $hash ) );
13882             }
13883             PERL
13884             # NOTE: terminal_reader_update()
13885             terminal_reader_update => <<'PERL',
13886             sub terminal_reader_update
13887             {
13888             my $self = shift( @_ );
13889             my $args = shift( @_ );
13890             my $okParams =
13891             {
13892             expandable => { allowed => $EXPANDABLES->{ 'terminal.reader' } },
13893             label => { type => "string" },
13894             metadata => { type => "hash" },
13895             };
13896             $args = $self->_contract( 'terminal.reader', $args ) || CORE::return( $self->pass_error );
13897             my $err = $self->_check_parameters( $okParams, $args );
13898             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
13899             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No terminal.reader id (with parameter 'id') was provided to update its information." ) );
13900             my $hash = $self->post( "terminal/readers/${id}", $args ) || CORE::return( $self->pass_error );
13901             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Terminal::Reader', $hash ) );
13902             }
13903             PERL
13904             # NOTE: terminal_readers()
13905             terminal_readers => <<'PERL',
13906             # <https://stripe.com/docs/api/terminal/readers>
13907             sub terminal_readers
13908             {
13909             my $self = shift( @_ );
13910             my $allowed = [qw( cancel_action create delete list present_payment_method process_payment_intent process_setup_intent retrieve set_reader_display update )];
13911             my $action = shift( @_ );
13912             my $meth = $self->_get_method( 'terminal_reader', $action, $allowed ) || CORE::return( $self->pass_error );
13913             CORE::return( $self->$meth( @_ ) );
13914             }
13915             PERL
13916             # NOTE: test_helpers_test_clock()
13917             test_helpers_test_clock => <<'PERL',
13918             sub test_helpers_test_clock { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Billing::TestHelpersTestClock', @_ ) ); }
13919             PERL
13920             # NOTE: test_helpers_test_clock_advance()
13921             test_helpers_test_clock_advance => <<'PERL',
13922             sub test_helpers_test_clock_advance
13923             {
13924             my $self = shift( @_ );
13925             my $args = shift( @_ );
13926             my $okParams =
13927             {
13928             expandable => { allowed => $EXPANDABLES->{ 'test_helpers.test_clock' } },
13929             frozen_time => { type => "timestamp", required => 1 },
13930             };
13931             $args = $self->_contract( 'test_helpers.test_clock', $args ) || CORE::return( $self->pass_error );
13932             my $err = $self->_check_parameters( $okParams, $args );
13933             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
13934             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No test_helpers.test_clock id (with parameter 'id') was provided to advance its information." ) );
13935             my $hash = $self->post( "test_helpers/test_clocks/${id}", $args ) || CORE::return( $self->pass_error );
13936             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::TestHelpersTestClock', $hash ) );
13937             }
13938             PERL
13939             # NOTE: test_helpers_test_clock_create()
13940             test_helpers_test_clock_create => <<'PERL',
13941             sub test_helpers_test_clock_create
13942             {
13943             my $self = shift( @_ );
13944             my $args = shift( @_ );
13945             my $okParams =
13946             {
13947             expandable => { allowed => $EXPANDABLES->{ 'test_helpers.test_clock' } },
13948             frozen_time => { type => "timestamp", required => 1 },
13949             name => { type => "string" },
13950             };
13951             $args = $self->_contract( 'test_helpers.test_clock', $args ) || CORE::return( $self->pass_error );
13952             my $err = $self->_check_parameters( $okParams, $args );
13953             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
13954             my $hash = $self->post( "", $args ) || CORE::return( $self->pass_error );
13955             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::TestHelpersTestClock', $hash ) );
13956             }
13957             PERL
13958             # NOTE: test_helpers_test_clock_delete()
13959             test_helpers_test_clock_delete => <<'PERL',
13960             sub test_helpers_test_clock_delete
13961             {
13962             my $self = shift( @_ );
13963             my $args = shift( @_ );
13964             my $okParams =
13965             {
13966             expandable => { allowed => $EXPANDABLES->{ 'test_helpers.test_clock' } },
13967             };
13968             $args = $self->_contract( 'test_helpers.test_clock', $args ) || CORE::return( $self->pass_error );
13969             my $err = $self->_check_parameters( $okParams, $args );
13970             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
13971             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No test_helpers.test_clock id (with parameter 'id') was provided to delete its information." ) );
13972             my $hash = $self->delete( "test_helpers/test_clocks/${id}", $args ) || CORE::return( $self->pass_error );
13973             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::TestHelpersTestClock', $hash ) );
13974             }
13975             PERL
13976             # NOTE: test_helpers_test_clock_list()
13977             test_helpers_test_clock_list => <<'PERL',
13978             sub test_helpers_test_clock_list
13979             {
13980             my $self = shift( @_ );
13981             CORE::return( $self->error( "No parameters were provided to list test helpers test clock information." ) ) if( !scalar( @_ ) );
13982             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Billing::TestHelpersTestClock', @_ );
13983             my $okParams =
13984             {
13985             expandable => { allowed => $EXPANDABLES->{ 'test_helpers.test_clock' }, data_prefix_is_ok => 1 },
13986             ending_before => { type => "string" },
13987             limit => { type => "string" },
13988             starting_after => { type => "string" },
13989             };
13990             my $err = $self->_check_parameters( $okParams, $args );
13991             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
13992             if( $args->{expand} )
13993             {
13994             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
13995             }
13996             my $hash = $self->get( "", $args ) || CORE::return( $self->pass_error );
13997             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::TestHelpersTestClock', $hash ) );
13998             }
13999             PERL
14000             # NOTE: test_helpers_test_clock_retrieve()
14001             test_helpers_test_clock_retrieve => <<'PERL',
14002             sub test_helpers_test_clock_retrieve
14003             {
14004             my $self = shift( @_ );
14005             my $args = shift( @_ );
14006             my $okParams =
14007             {
14008             expandable => { allowed => $EXPANDABLES->{ 'test_helpers.test_clock' }, data_prefix_is_ok => 1 },
14009             };
14010             $args = $self->_contract( 'test_helpers.test_clock', $args ) || CORE::return( $self->pass_error );
14011             my $err = $self->_check_parameters( $okParams, $args );
14012             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
14013             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No test_helpers.test_clock id (with parameter 'id') was provided to retrieve its information." ) );
14014             my $hash = $self->get( "test_helpers/test_clocks/${id}", $args ) || CORE::return( $self->pass_error );
14015             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::TestHelpersTestClock', $hash ) );
14016             }
14017             PERL
14018             # NOTE: test_helpers_test_clocks()
14019             test_helpers_test_clocks => <<'PERL',
14020             # <https://stripe.com/docs/api/test_clocks>
14021             sub test_helpers_test_clocks
14022             {
14023             my $self = shift( @_ );
14024             my $allowed = [qw( advance create delete list retrieve )];
14025             my $action = shift( @_ );
14026             my $meth = $self->_get_method( 'test_helpers_test_clock', $action, $allowed ) || CORE::return( $self->pass_error );
14027             CORE::return( $self->$meth( @_ ) );
14028             }
14029             PERL
14030             # NOTE: token()
14031             token => <<'PERL',
14032             # sub terminal { CORE::return( shift->_instantiate( 'terminal', 'Net::API::Stripe::Terminal' ) ) }
14033             sub token { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Token', @_ ) ); }
14034             PERL
14035             # NOTE: token_create()
14036             token_create => <<'PERL',
14037             sub token_create
14038             {
14039             my $self = shift( @_ );
14040             CORE::return( $self->error( "No parameters were provided to create a token" ) ) if( !scalar( @_ ) );
14041             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Token', @_ );
14042             my $okParams =
14043             {
14044             expandable => { allowed => $EXPANDABLES->{token} },
14045             account => { fields => [qw( business_type company individual tos_shown_and_accepted )] },
14046             bank_account => { fields => [qw( country currency account_holder_name account_holder_type routing_number account_number )] },
14047             card => { fields => [qw( exp_month exp_year number currency cvc name address_line1 address_line2 address_city address_state address_zip address_country )] },
14048             customer => { re => qr/^\w+$/ },
14049             cvc_update => { fields => [qw( cvc )] },
14050             person => { re => [qw( address.city address.country address.line1 address.line2 address.postal_code address.state
14051             address_kana.city address_kanji.line1 address_kanji.line2 address_kanji.postal_code address_kanji.state address_kanji.town
14052             address_kanji.city address_kanji.line1 address_kanji.line2 address_kanji.postal_code address_kanji.state address_kanji.town
14053             dob.day dob.month dob.year
14054             documents.company_authorization.files documents.passport.files documents.visa.files
14055             email first_name first_name.kana first_name.kanji
14056             full_name_aliases gender id_number
14057             last_name last_name.kana last_name.kanji
14058             maiden_name metadata nationality phone political_exposure
14059             relationship.director relationship.executive relationship.owner relationship.percent_ownership relationship.representative relationship.title
14060             ssn_last_4 verification.additional_document.back verification.additional_document.front
14061             verification.document.back verification.document.front )] },
14062             pii => { fiekds => [qw( id_number )] },
14063             };
14064             $args = $self->_contract( 'token', $args ) || CORE::return( $self->pass_error );
14065             my $err = $self->_check_parameters( $okParams, $args );
14066             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
14067             my $hash = $self->post( 'tokens', $args ) || CORE::return( $self->pass_error );
14068             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Token', $hash ) );
14069             }
14070             PERL
14071             # NOTE: token_create_account()
14072             token_create_account => <<'PERL',
14073             sub token_create_account
14074             {
14075             my $self = shift( @_ );
14076             my $args = shift( @_ );
14077             my $okParams =
14078             {
14079             expandable => { allowed => $EXPANDABLES->{ 'token' } },
14080             account => { type => "object", required => 1 },
14081             };
14082             $args = $self->_contract( 'token', $args ) || CORE::return( $self->pass_error );
14083             my $err = $self->_check_parameters( $okParams, $args );
14084             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
14085             my $hash = $self->post( "tokens", $args ) || CORE::return( $self->pass_error );
14086             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Token', $hash ) );
14087             }
14088             PERL
14089             # NOTE: token_create_bank_account()
14090             token_create_bank_account => <<'PERL',
14091             sub token_create_bank_account
14092             {
14093             my $self = shift( @_ );
14094             my $args = shift( @_ );
14095             my $okParams =
14096             {
14097             expandable => { allowed => $EXPANDABLES->{ 'token' } },
14098             bank_account => { type => "hash" },
14099             customer => { type => "string" },
14100             };
14101             $args = $self->_contract( 'token', $args ) || CORE::return( $self->pass_error );
14102             my $err = $self->_check_parameters( $okParams, $args );
14103             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
14104             my $hash = $self->post( "tokens", $args ) || CORE::return( $self->pass_error );
14105             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Token', $hash ) );
14106             }
14107             PERL
14108             # NOTE: token_create_card()
14109             token_create_card => <<'PERL',
14110             sub token_create_card
14111             {
14112             my $self = shift( @_ );
14113             my $args = shift( @_ );
14114             my $okParams =
14115             {
14116             expandable => { allowed => $EXPANDABLES->{ 'token' } },
14117             card => { type => "hash" },
14118             customer => { type => "string" },
14119             };
14120             $args = $self->_contract( 'token', $args ) || CORE::return( $self->pass_error );
14121             my $err = $self->_check_parameters( $okParams, $args );
14122             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
14123             my $hash = $self->post( "tokens", $args ) || CORE::return( $self->pass_error );
14124             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Token', $hash ) );
14125             }
14126             PERL
14127             # NOTE: token_create_cvc_update()
14128             token_create_cvc_update => <<'PERL',
14129             sub token_create_cvc_update
14130             {
14131             my $self = shift( @_ );
14132             my $args = shift( @_ );
14133             my $okParams =
14134             {
14135             expandable => { allowed => $EXPANDABLES->{ 'token' } },
14136             cvc_update => { type => "object", required => 1 },
14137             };
14138             $args = $self->_contract( 'token', $args ) || CORE::return( $self->pass_error );
14139             my $err = $self->_check_parameters( $okParams, $args );
14140             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
14141             my $hash = $self->post( "tokens", $args ) || CORE::return( $self->pass_error );
14142             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Token', $hash ) );
14143             }
14144             PERL
14145             # NOTE: token_create_person()
14146             token_create_person => <<'PERL',
14147             sub token_create_person
14148             {
14149             my $self = shift( @_ );
14150             my $args = shift( @_ );
14151             my $okParams =
14152             {
14153             expandable => { allowed => $EXPANDABLES->{ 'token' } },
14154             person => { type => "object", required => 1 },
14155             };
14156             $args = $self->_contract( 'token', $args ) || CORE::return( $self->pass_error );
14157             my $err = $self->_check_parameters( $okParams, $args );
14158             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
14159             my $hash = $self->post( "tokens", $args ) || CORE::return( $self->pass_error );
14160             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Token', $hash ) );
14161             }
14162             PERL
14163             # NOTE: token_create_pii()
14164             token_create_pii => <<'PERL',
14165             sub token_create_pii
14166             {
14167             my $self = shift( @_ );
14168             my $args = shift( @_ );
14169             my $okParams =
14170             {
14171             expandable => { allowed => $EXPANDABLES->{ 'token' } },
14172             pii => { type => "object", required => 1 },
14173             };
14174             $args = $self->_contract( 'token', $args ) || CORE::return( $self->pass_error );
14175             my $err = $self->_check_parameters( $okParams, $args );
14176             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
14177             my $hash = $self->post( "tokens", $args ) || CORE::return( $self->pass_error );
14178             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Token', $hash ) );
14179             }
14180             PERL
14181             # NOTE: token_retrieve()
14182             token_retrieve => <<'PERL',
14183             sub token_retrieve
14184             {
14185             my $self = shift( @_ );
14186             CORE::return( $self->error( "No parameters were provided to retrieve token information." ) ) if( !scalar( @_ ) );
14187             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Token', @_ );
14188             my $okParams =
14189             {
14190             expandable => { allowed => $EXPANDABLES->{token} },
14191             id => { re => qr/^\w+$/, required => 1 }
14192             };
14193             my $err = $self->_check_parameters( $okParams, $args );
14194             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
14195             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No token id was provided to retrieve its information." ) );
14196             my $hash = $self->get( "tokens/${id}", $args ) || CORE::return( $self->pass_error );
14197             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Token', $hash ) );
14198             }
14199             PERL
14200             # NOTE: tokens()
14201             tokens => <<'PERL',
14202             # <https://stripe.com/docs/api/tokens>
14203             sub tokens
14204             {
14205             my $self = shift( @_ );
14206             my $allowed = [qw( create create_account create_bank_account create_card create_cvc_update create_person create_pii retrieve )];
14207             my $action = shift( @_ );
14208             my $meth = $self->_get_method( 'token', $action, $allowed ) || CORE::return( $self->pass_error );
14209             CORE::return( $self->$meth( @_ ) );
14210             }
14211             PERL
14212             # NOTE: topup()
14213             topup => <<'PERL',
14214             sub topup { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Connect::TopUp', @_ ) ); }
14215             PERL
14216             # NOTE: topup_cancel()
14217             topup_cancel => <<'PERL',
14218             sub topup_cancel
14219             {
14220             my $self = shift( @_ );
14221             my $args = shift( @_ );
14222             my $okParams =
14223             {
14224             expandable => { allowed => $EXPANDABLES->{ 'topup' } },
14225             };
14226             $args = $self->_contract( 'topup', $args ) || CORE::return( $self->pass_error );
14227             my $err = $self->_check_parameters( $okParams, $args );
14228             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
14229             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No topup id (with parameter 'id') was provided to cancel its information." ) );
14230             my $hash = $self->post( "topups/${id}", $args ) || CORE::return( $self->pass_error );
14231             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Connect::TopUp', $hash ) );
14232             }
14233             PERL
14234             # NOTE: topup_create()
14235             topup_create => <<'PERL',
14236             sub topup_create
14237             {
14238             my $self = shift( @_ );
14239             my $args = shift( @_ );
14240             my $okParams =
14241             {
14242             expandable => { allowed => $EXPANDABLES->{ 'topup' } },
14243             amount => { type => "integer", required => 1 },
14244             currency => { type => "string", required => 1 },
14245             description => { type => "string" },
14246             metadata => { type => "hash" },
14247             source => { type => "hash" },
14248             statement_descriptor => { type => "string" },
14249             transfer_group => { type => "string" },
14250             };
14251             $args = $self->_contract( 'topup', $args ) || CORE::return( $self->pass_error );
14252             my $err = $self->_check_parameters( $okParams, $args );
14253             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
14254             my $hash = $self->post( "topups", $args ) || CORE::return( $self->pass_error );
14255             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Connect::TopUp', $hash ) );
14256             }
14257             PERL
14258             # NOTE: topup_list()
14259             topup_list => <<'PERL',
14260             sub topup_list
14261             {
14262             my $self = shift( @_ );
14263             CORE::return( $self->error( "No parameters were provided to list topup information." ) ) if( !scalar( @_ ) );
14264             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Connect::TopUp', @_ );
14265             my $okParams =
14266             {
14267             expandable => { allowed => $EXPANDABLES->{ 'topup' }, data_prefix_is_ok => 1 },
14268             amount => { type => "integer" },
14269             created => { type => "timestamp" },
14270             ending_before => { type => "string" },
14271             limit => { type => "string" },
14272             starting_after => { type => "string" },
14273             status => { type => "string" },
14274             };
14275             my $err = $self->_check_parameters( $okParams, $args );
14276             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
14277             if( $args->{expand} )
14278             {
14279             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
14280             }
14281             my $hash = $self->get( "topups", $args ) || CORE::return( $self->pass_error );
14282             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Connect::TopUp', $hash ) );
14283             }
14284             PERL
14285             # NOTE: topup_retrieve()
14286             topup_retrieve => <<'PERL',
14287             sub topup_retrieve
14288             {
14289             my $self = shift( @_ );
14290             my $args = shift( @_ );
14291             my $okParams =
14292             {
14293             expandable => { allowed => $EXPANDABLES->{ 'topup' }, data_prefix_is_ok => 1 },
14294             };
14295             $args = $self->_contract( 'topup', $args ) || CORE::return( $self->pass_error );
14296             my $err = $self->_check_parameters( $okParams, $args );
14297             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
14298             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No topup id (with parameter 'id') was provided to retrieve its information." ) );
14299             my $hash = $self->get( "topups/${id}", $args ) || CORE::return( $self->pass_error );
14300             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Connect::TopUp', $hash ) );
14301             }
14302             PERL
14303             # NOTE: topup_update()
14304             topup_update => <<'PERL',
14305             sub topup_update
14306             {
14307             my $self = shift( @_ );
14308             my $args = shift( @_ );
14309             my $okParams =
14310             {
14311             expandable => { allowed => $EXPANDABLES->{ 'topup' } },
14312             description => { type => "string" },
14313             metadata => { type => "hash" },
14314             };
14315             $args = $self->_contract( 'topup', $args ) || CORE::return( $self->pass_error );
14316             my $err = $self->_check_parameters( $okParams, $args );
14317             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
14318             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No topup id (with parameter 'id') was provided to update its information." ) );
14319             my $hash = $self->post( "topups/${id}", $args ) || CORE::return( $self->pass_error );
14320             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Connect::TopUp', $hash ) );
14321             }
14322             PERL
14323             # NOTE: topups()
14324             topups => <<'PERL',
14325             # <https://stripe.com/docs/api/topups>
14326             sub topups
14327             {
14328             my $self = shift( @_ );
14329             my $allowed = [qw( cancel create list retrieve update )];
14330             my $action = shift( @_ );
14331             my $meth = $self->_get_method( 'topup', $action, $allowed ) || CORE::return( $self->pass_error );
14332             CORE::return( $self->$meth( @_ ) );
14333             }
14334             PERL
14335             # NOTE: tos_acceptance()
14336             tos_acceptance => <<'PERL',
14337             sub tos_acceptance { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Connect::Account::TosAcceptance', @_ ) ); }
14338             PERL
14339             # NOTE: transfer()
14340             transfer => <<'PERL',
14341             sub transfer { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Connect::Transfer', @_ ) ); }
14342             PERL
14343             # NOTE: transfer_create()
14344             transfer_create => <<'PERL',
14345             sub transfer_create
14346             {
14347             my $self = shift( @_ );
14348             my $args = shift( @_ );
14349             my $okParams =
14350             {
14351             expandable => { allowed => $EXPANDABLES->{ 'transfer' } },
14352             amount => { type => "integer" },
14353             currency => { type => "string", required => 1 },
14354             description => { type => "string" },
14355             destination => { type => "string", required => 1 },
14356             metadata => { type => "hash" },
14357             source_transaction => { type => "string" },
14358             source_type => { type => "string" },
14359             transfer_group => { type => "string" },
14360             };
14361             $args = $self->_contract( 'transfer', $args ) || CORE::return( $self->pass_error );
14362             my $err = $self->_check_parameters( $okParams, $args );
14363             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
14364             my $hash = $self->post( "transfers", $args ) || CORE::return( $self->pass_error );
14365             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Connect::Transfer', $hash ) );
14366             }
14367             PERL
14368             # NOTE: transfer_data()
14369             transfer_data => <<'PERL',
14370             sub transfer_data { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Payment::Intent::TransferData', @_ ) ); }
14371             PERL
14372             # NOTE: transfer_list()
14373             transfer_list => <<'PERL',
14374             sub transfer_list
14375             {
14376             my $self = shift( @_ );
14377             CORE::return( $self->error( "No parameters were provided to list transfer information." ) ) if( !scalar( @_ ) );
14378             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Connect::Transfer', @_ );
14379             my $okParams =
14380             {
14381             expandable => { allowed => $EXPANDABLES->{ 'transfer' }, data_prefix_is_ok => 1 },
14382             created => { type => "timestamp" },
14383             destination => { type => "string" },
14384             ending_before => { type => "string" },
14385             limit => { type => "string" },
14386             starting_after => { type => "string" },
14387             transfer_group => { type => "string" },
14388             };
14389             my $err = $self->_check_parameters( $okParams, $args );
14390             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
14391             if( $args->{expand} )
14392             {
14393             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
14394             }
14395             my $hash = $self->get( "transfers", $args ) || CORE::return( $self->pass_error );
14396             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Connect::Transfer', $hash ) );
14397             }
14398             PERL
14399             # NOTE: transfer_retrieve()
14400             transfer_retrieve => <<'PERL',
14401             sub transfer_retrieve
14402             {
14403             my $self = shift( @_ );
14404             my $args = shift( @_ );
14405             my $okParams =
14406             {
14407             expandable => { allowed => $EXPANDABLES->{ 'transfer' }, data_prefix_is_ok => 1 },
14408             };
14409             $args = $self->_contract( 'transfer', $args ) || CORE::return( $self->pass_error );
14410             my $err = $self->_check_parameters( $okParams, $args );
14411             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
14412             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No transfer id (with parameter 'id') was provided to retrieve its information." ) );
14413             my $hash = $self->get( "transfers/${id}", $args ) || CORE::return( $self->pass_error );
14414             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Connect::Transfer', $hash ) );
14415             }
14416             PERL
14417             # NOTE: transfer_reversal()
14418             transfer_reversal => <<'PERL',
14419             sub transfer_reversal { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Connect::Transfer::Reversal', @_ ) ); }
14420             PERL
14421             # NOTE: transfer_reversal_create()
14422             transfer_reversal_create => <<'PERL',
14423             sub transfer_reversal_create
14424             {
14425             my $self = shift( @_ );
14426             my $args = shift( @_ );
14427             my $okParams =
14428             {
14429             expandable => { allowed => $EXPANDABLES->{ 'transfer_reversal' } },
14430             amount => { type => "integer" },
14431             description => { type => "string" },
14432             metadata => { type => "hash" },
14433             refund_application_fee => { type => "boolean" },
14434             };
14435             $args = $self->_contract( 'transfer_reversal', $args ) || CORE::return( $self->pass_error );
14436             my $err = $self->_check_parameters( $okParams, $args );
14437             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
14438             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No transfer id (with parameter 'id') was provided to create its information." ) );
14439             my $hash = $self->post( "transfers/${id}/reversals", $args ) || CORE::return( $self->pass_error );
14440             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Connect::Transfer::Reversal', $hash ) );
14441             }
14442             PERL
14443             # NOTE: transfer_reversal_list()
14444             transfer_reversal_list => <<'PERL',
14445             sub transfer_reversal_list
14446             {
14447             my $self = shift( @_ );
14448             CORE::return( $self->error( "No parameters were provided to list transfer reversal information." ) ) if( !scalar( @_ ) );
14449             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Connect::Transfer::Reversal', @_ );
14450             my $okParams =
14451             {
14452             expandable => { allowed => $EXPANDABLES->{ 'transfer_reversal' }, data_prefix_is_ok => 1 },
14453             ending_before => { type => "string" },
14454             limit => { type => "string" },
14455             starting_after => { type => "string" },
14456             };
14457             my $err = $self->_check_parameters( $okParams, $args );
14458             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
14459             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No transfer id (with parameter 'id') was provided to list its information." ) );
14460             if( $args->{expand} )
14461             {
14462             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
14463             }
14464             my $hash = $self->get( "transfers/${id}/reversals", $args ) || CORE::return( $self->pass_error );
14465             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Connect::Transfer::Reversal', $hash ) );
14466             }
14467             PERL
14468             # NOTE: transfer_reversal_retrieve()
14469             transfer_reversal_retrieve => <<'PERL',
14470             sub transfer_reversal_retrieve
14471             {
14472             my $self = shift( @_ );
14473             my $args = shift( @_ );
14474             my $okParams =
14475             {
14476             expandable => { allowed => $EXPANDABLES->{ 'transfer_reversal' }, data_prefix_is_ok => 1 },
14477             };
14478             $args = $self->_contract( 'transfer_reversal', $args ) || CORE::return( $self->pass_error );
14479             my $err = $self->_check_parameters( $okParams, $args );
14480             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
14481             my $parent_id = CORE::delete( $args->{parent_id} ) || CORE::return( $self->error( "No transfer id (with parameter 'parent_id') was provided to retrieve its information." ) );
14482             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No transfer_reversal id (with parameter 'id') was provided to retrieve its information." ) );
14483             my $hash = $self->get( "transfers/${parent_id}/reversals/${id}", $args ) || CORE::return( $self->pass_error );
14484             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Connect::Transfer::Reversal', $hash ) );
14485             }
14486             PERL
14487             # NOTE: transfer_reversal_update()
14488             transfer_reversal_update => <<'PERL',
14489             sub transfer_reversal_update
14490             {
14491             my $self = shift( @_ );
14492             my $args = shift( @_ );
14493             my $okParams =
14494             {
14495             expandable => { allowed => $EXPANDABLES->{ 'transfer_reversal' } },
14496             metadata => { type => "hash" },
14497             };
14498             $args = $self->_contract( 'transfer_reversal', $args ) || CORE::return( $self->pass_error );
14499             my $err = $self->_check_parameters( $okParams, $args );
14500             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
14501             my $parent_id = CORE::delete( $args->{parent_id} ) || CORE::return( $self->error( "No transfer id (with parameter 'parent_id') was provided to update its information." ) );
14502             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No transfer_reversal id (with parameter 'id') was provided to update its information." ) );
14503             my $hash = $self->post( "transfers/${parent_id}/reversals/${id}", $args ) || CORE::return( $self->pass_error );
14504             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Connect::Transfer::Reversal', $hash ) );
14505             }
14506             PERL
14507             # NOTE: transfer_reversals()
14508             transfer_reversals => <<'PERL',
14509             # <https://stripe.com/docs/api/transfer_reversals>
14510             sub transfer_reversals
14511             {
14512             my $self = shift( @_ );
14513             my $allowed = [qw( create list retrieve update )];
14514             my $action = shift( @_ );
14515             my $meth = $self->_get_method( 'transfer_reversal', $action, $allowed ) || CORE::return( $self->pass_error );
14516             CORE::return( $self->$meth( @_ ) );
14517             }
14518             PERL
14519             # NOTE: transfer_update()
14520             transfer_update => <<'PERL',
14521             sub transfer_update
14522             {
14523             my $self = shift( @_ );
14524             my $args = shift( @_ );
14525             my $okParams =
14526             {
14527             expandable => { allowed => $EXPANDABLES->{ 'transfer' } },
14528             description => { type => "string" },
14529             metadata => { type => "hash" },
14530             };
14531             $args = $self->_contract( 'transfer', $args ) || CORE::return( $self->pass_error );
14532             my $err = $self->_check_parameters( $okParams, $args );
14533             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
14534             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No transfer id (with parameter 'id') was provided to update its information." ) );
14535             my $hash = $self->post( "transfers/${id}", $args ) || CORE::return( $self->pass_error );
14536             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Connect::Transfer', $hash ) );
14537             }
14538             PERL
14539             # NOTE: transfers()
14540             transfers => <<'PERL',
14541             # <https://stripe.com/docs/api/transfers>
14542             sub transfers
14543             {
14544             my $self = shift( @_ );
14545             my $allowed = [qw( create list retrieve update )];
14546             my $action = shift( @_ );
14547             my $meth = $self->_get_method( 'transfer', $action, $allowed ) || CORE::return( $self->pass_error );
14548             CORE::return( $self->$meth( @_ ) );
14549             }
14550             PERL
14551             # NOTE: transform_usage()
14552             transform_usage => <<'PERL',
14553             sub transform_usage { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Billing::Plan::TransformUsage', @_ ) ); }
14554             PERL
14555             # NOTE: treasury_credit_reversal()
14556             treasury_credit_reversal => <<'PERL',
14557             sub treasury_credit_reversal { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Treasury::CreditReversal', @_ ) ); }
14558             PERL
14559             # NOTE: treasury_credit_reversal_create()
14560             treasury_credit_reversal_create => <<'PERL',
14561             sub treasury_credit_reversal_create
14562             {
14563             my $self = shift( @_ );
14564             my $args = shift( @_ );
14565             my $okParams =
14566             {
14567             expandable => { allowed => $EXPANDABLES->{ 'treasury.credit_reversal' } },
14568             metadata => { type => "hash" },
14569             received_credit => { type => "string", required => 1 },
14570             };
14571             $args = $self->_contract( 'treasury.credit_reversal', $args ) || CORE::return( $self->pass_error );
14572             my $err = $self->_check_parameters( $okParams, $args );
14573             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
14574             my $hash = $self->post( "", $args ) || CORE::return( $self->pass_error );
14575             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Treasury::CreditReversal', $hash ) );
14576             }
14577             PERL
14578             # NOTE: treasury_credit_reversal_list()
14579             treasury_credit_reversal_list => <<'PERL',
14580             sub treasury_credit_reversal_list
14581             {
14582             my $self = shift( @_ );
14583             CORE::return( $self->error( "No parameters were provided to list treasury credit reversal information." ) ) if( !scalar( @_ ) );
14584             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Treasury::CreditReversal', @_ );
14585             my $okParams =
14586             {
14587             expandable => { allowed => $EXPANDABLES->{ 'treasury.credit_reversal' }, data_prefix_is_ok => 1 },
14588             ending_before => { type => "string" },
14589             financial_account => { type => "string", required => 1 },
14590             limit => { type => "string" },
14591             received_credit => { type => "string" },
14592             starting_after => { type => "string" },
14593             status => { type => "string" },
14594             };
14595             my $err = $self->_check_parameters( $okParams, $args );
14596             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
14597             if( $args->{expand} )
14598             {
14599             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
14600             }
14601             my $hash = $self->get( "", $args ) || CORE::return( $self->pass_error );
14602             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Treasury::CreditReversal', $hash ) );
14603             }
14604             PERL
14605             # NOTE: treasury_credit_reversal_retrieve()
14606             treasury_credit_reversal_retrieve => <<'PERL',
14607             sub treasury_credit_reversal_retrieve
14608             {
14609             my $self = shift( @_ );
14610             my $args = shift( @_ );
14611             my $okParams =
14612             {
14613             expandable => { allowed => $EXPANDABLES->{ 'treasury.credit_reversal' }, data_prefix_is_ok => 1 },
14614             };
14615             $args = $self->_contract( 'treasury.credit_reversal', $args ) || CORE::return( $self->pass_error );
14616             my $err = $self->_check_parameters( $okParams, $args );
14617             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
14618             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No treasury.credit_reversal id (with parameter 'id') was provided to retrieve its information." ) );
14619             my $hash = $self->get( "treasury/credit_reversals/${id}", $args ) || CORE::return( $self->pass_error );
14620             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Treasury::CreditReversal', $hash ) );
14621             }
14622             PERL
14623             # NOTE: treasury_credit_reversals()
14624             treasury_credit_reversals => <<'PERL',
14625             # <https://stripe.com/docs/api/treasury/credit_reversals>
14626             sub treasury_credit_reversals
14627             {
14628             my $self = shift( @_ );
14629             my $allowed = [qw( create list retrieve )];
14630             my $action = shift( @_ );
14631             my $meth = $self->_get_method( 'treasury_credit_reversal', $action, $allowed ) || CORE::return( $self->pass_error );
14632             CORE::return( $self->$meth( @_ ) );
14633             }
14634             PERL
14635             # NOTE: treasury_debit_reversal()
14636             treasury_debit_reversal => <<'PERL',
14637             sub treasury_debit_reversal { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Treasury::DebitReversal', @_ ) ); }
14638             PERL
14639             # NOTE: treasury_debit_reversal_create()
14640             treasury_debit_reversal_create => <<'PERL',
14641             sub treasury_debit_reversal_create
14642             {
14643             my $self = shift( @_ );
14644             my $args = shift( @_ );
14645             my $okParams =
14646             {
14647             expandable => { allowed => $EXPANDABLES->{ 'treasury.debit_reversal' } },
14648             metadata => { type => "hash" },
14649             received_debit => { type => "string", required => 1 },
14650             };
14651             $args = $self->_contract( 'treasury.debit_reversal', $args ) || CORE::return( $self->pass_error );
14652             my $err = $self->_check_parameters( $okParams, $args );
14653             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
14654             my $hash = $self->post( "", $args ) || CORE::return( $self->pass_error );
14655             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Treasury::DebitReversal', $hash ) );
14656             }
14657             PERL
14658             # NOTE: treasury_debit_reversal_list()
14659             treasury_debit_reversal_list => <<'PERL',
14660             sub treasury_debit_reversal_list
14661             {
14662             my $self = shift( @_ );
14663             CORE::return( $self->error( "No parameters were provided to list treasury debit reversal information." ) ) if( !scalar( @_ ) );
14664             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Treasury::DebitReversal', @_ );
14665             my $okParams =
14666             {
14667             expandable => { allowed => $EXPANDABLES->{ 'treasury.debit_reversal' }, data_prefix_is_ok => 1 },
14668             ending_before => { type => "string" },
14669             financial_account => { type => "string", required => 1 },
14670             limit => { type => "string" },
14671             received_debit => { type => "string" },
14672             resolution => { type => "string" },
14673             starting_after => { type => "string" },
14674             status => { type => "string" },
14675             };
14676             my $err = $self->_check_parameters( $okParams, $args );
14677             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
14678             if( $args->{expand} )
14679             {
14680             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
14681             }
14682             my $hash = $self->get( "", $args ) || CORE::return( $self->pass_error );
14683             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Treasury::DebitReversal', $hash ) );
14684             }
14685             PERL
14686             # NOTE: treasury_debit_reversal_retrieve()
14687             treasury_debit_reversal_retrieve => <<'PERL',
14688             sub treasury_debit_reversal_retrieve
14689             {
14690             my $self = shift( @_ );
14691             my $args = shift( @_ );
14692             my $okParams =
14693             {
14694             expandable => { allowed => $EXPANDABLES->{ 'treasury.debit_reversal' }, data_prefix_is_ok => 1 },
14695             };
14696             $args = $self->_contract( 'treasury.debit_reversal', $args ) || CORE::return( $self->pass_error );
14697             my $err = $self->_check_parameters( $okParams, $args );
14698             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
14699             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No treasury.debit_reversal id (with parameter 'id') was provided to retrieve its information." ) );
14700             my $hash = $self->get( "treasury/debit_reversals/${id}", $args ) || CORE::return( $self->pass_error );
14701             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Treasury::DebitReversal', $hash ) );
14702             }
14703             PERL
14704             # NOTE: treasury_debit_reversals()
14705             treasury_debit_reversals => <<'PERL',
14706             # <https://stripe.com/docs/api/treasury/debit_reversals>
14707             sub treasury_debit_reversals
14708             {
14709             my $self = shift( @_ );
14710             my $allowed = [qw( create list retrieve )];
14711             my $action = shift( @_ );
14712             my $meth = $self->_get_method( 'treasury_debit_reversal', $action, $allowed ) || CORE::return( $self->pass_error );
14713             CORE::return( $self->$meth( @_ ) );
14714             }
14715             PERL
14716             # NOTE: treasury_financial_account()
14717             treasury_financial_account => <<'PERL',
14718             sub treasury_financial_account { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Treasury::FinancialAccount', @_ ) ); }
14719             PERL
14720             # NOTE: treasury_financial_account_create()
14721             treasury_financial_account_create => <<'PERL',
14722             sub treasury_financial_account_create
14723             {
14724             my $self = shift( @_ );
14725             my $args = shift( @_ );
14726             my $okParams =
14727             {
14728             expandable => { allowed => $EXPANDABLES->{ 'treasury.financial_account' } },
14729             features => { type => "hash" },
14730             metadata => { type => "hash" },
14731             platform_restrictions => { type => "hash" },
14732             supported_currencies => { type => "array", required => 1 },
14733             };
14734             $args = $self->_contract( 'treasury.financial_account', $args ) || CORE::return( $self->pass_error );
14735             my $err = $self->_check_parameters( $okParams, $args );
14736             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
14737             my $hash = $self->post( "", $args ) || CORE::return( $self->pass_error );
14738             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Treasury::FinancialAccount', $hash ) );
14739             }
14740             PERL
14741             # NOTE: treasury_financial_account_features()
14742             treasury_financial_account_features => <<'PERL',
14743             sub treasury_financial_account_features { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Treasury::FinancialAccountFeatures', @_ ) ); }
14744             PERL
14745             # NOTE: treasury_financial_account_features_retrieve()
14746             treasury_financial_account_features_retrieve => <<'PERL',
14747             sub treasury_financial_account_features_retrieve
14748             {
14749             my $self = shift( @_ );
14750             my $args = shift( @_ );
14751             my $okParams =
14752             {
14753             expandable => { allowed => $EXPANDABLES->{ 'treasury.financial_account_features' }, data_prefix_is_ok => 1 },
14754             };
14755             $args = $self->_contract( 'treasury.financial_account_features', $args ) || CORE::return( $self->pass_error );
14756             my $err = $self->_check_parameters( $okParams, $args );
14757             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
14758             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No treasury.financial_account id (with parameter 'id') was provided to retrieve its information." ) );
14759             my $hash = $self->get( "treasury/financial_accounts/${id}/features", $args ) || CORE::return( $self->pass_error );
14760             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Treasury::FinancialAccountFeatures', $hash ) );
14761             }
14762             PERL
14763             # NOTE: treasury_financial_account_features_update()
14764             treasury_financial_account_features_update => <<'PERL',
14765             sub treasury_financial_account_features_update
14766             {
14767             my $self = shift( @_ );
14768             my $args = shift( @_ );
14769             my $okParams =
14770             {
14771             expandable => { allowed => $EXPANDABLES->{ 'treasury.financial_account_features' } },
14772             card_issuing => { type => "hash" },
14773             deposit_insurance => { type => "hash" },
14774             financial_addresses => { type => "hash" },
14775             inbound_transfers => { type => "hash" },
14776             intra_stripe_flows => { type => "hash" },
14777             outbound_payments => { type => "hash" },
14778             outbound_transfers => { type => "hash" },
14779             };
14780             $args = $self->_contract( 'treasury.financial_account_features', $args ) || CORE::return( $self->pass_error );
14781             my $err = $self->_check_parameters( $okParams, $args );
14782             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
14783             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No treasury.financial_account id (with parameter 'id') was provided to update its information." ) );
14784             my $hash = $self->post( "treasury/financial_accounts/${id}/features", $args ) || CORE::return( $self->pass_error );
14785             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Treasury::FinancialAccountFeatures', $hash ) );
14786             }
14787             PERL
14788             # NOTE: treasury_financial_account_featuress()
14789             treasury_financial_account_featuress => <<'PERL',
14790             # <https://stripe.com/docs/api/treasury/financial_account_features>
14791             sub treasury_financial_account_featuress
14792             {
14793             my $self = shift( @_ );
14794             my $allowed = [qw( retrieve update )];
14795             my $action = shift( @_ );
14796             my $meth = $self->_get_method( 'treasury_financial_account_features', $action, $allowed ) || CORE::return( $self->pass_error );
14797             CORE::return( $self->$meth( @_ ) );
14798             }
14799             PERL
14800             # NOTE: treasury_financial_account_list()
14801             treasury_financial_account_list => <<'PERL',
14802             sub treasury_financial_account_list
14803             {
14804             my $self = shift( @_ );
14805             CORE::return( $self->error( "No parameters were provided to list treasury financial account information." ) ) if( !scalar( @_ ) );
14806             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Treasury::FinancialAccount', @_ );
14807             my $okParams =
14808             {
14809             expandable => { allowed => $EXPANDABLES->{ 'treasury.financial_account' }, data_prefix_is_ok => 1 },
14810             created => { type => "timestamp" },
14811             ending_before => { type => "string" },
14812             limit => { type => "string" },
14813             starting_after => { type => "string" },
14814             };
14815             my $err = $self->_check_parameters( $okParams, $args );
14816             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
14817             if( $args->{expand} )
14818             {
14819             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
14820             }
14821             my $hash = $self->get( "", $args ) || CORE::return( $self->pass_error );
14822             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Treasury::FinancialAccount', $hash ) );
14823             }
14824             PERL
14825             # NOTE: treasury_financial_account_retrieve()
14826             treasury_financial_account_retrieve => <<'PERL',
14827             sub treasury_financial_account_retrieve
14828             {
14829             my $self = shift( @_ );
14830             my $args = shift( @_ );
14831             my $okParams =
14832             {
14833             expandable => { allowed => $EXPANDABLES->{ 'treasury.financial_account' }, data_prefix_is_ok => 1 },
14834             };
14835             $args = $self->_contract( 'treasury.financial_account', $args ) || CORE::return( $self->pass_error );
14836             my $err = $self->_check_parameters( $okParams, $args );
14837             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
14838             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No treasury.financial_account id (with parameter 'id') was provided to retrieve its information." ) );
14839             my $hash = $self->get( "treasury/financial_accounts/${id}", $args ) || CORE::return( $self->pass_error );
14840             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Treasury::FinancialAccount', $hash ) );
14841             }
14842             PERL
14843             # NOTE: treasury_financial_account_update()
14844             treasury_financial_account_update => <<'PERL',
14845             sub treasury_financial_account_update
14846             {
14847             my $self = shift( @_ );
14848             my $args = shift( @_ );
14849             my $okParams =
14850             {
14851             expandable => { allowed => $EXPANDABLES->{ 'treasury.financial_account' } },
14852             features => { type => "hash" },
14853             metadata => { type => "hash" },
14854             platform_restrictions => { type => "hash" },
14855             };
14856             $args = $self->_contract( 'treasury.financial_account', $args ) || CORE::return( $self->pass_error );
14857             my $err = $self->_check_parameters( $okParams, $args );
14858             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
14859             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No treasury.financial_account id (with parameter 'id') was provided to update its information." ) );
14860             my $hash = $self->post( "treasury/financial_accounts/${id}", $args ) || CORE::return( $self->pass_error );
14861             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Treasury::FinancialAccount', $hash ) );
14862             }
14863             PERL
14864             # NOTE: treasury_financial_accounts()
14865             treasury_financial_accounts => <<'PERL',
14866             # <https://stripe.com/docs/api/treasury/financial_accounts>
14867             sub treasury_financial_accounts
14868             {
14869             my $self = shift( @_ );
14870             my $allowed = [qw( create list retrieve update )];
14871             my $action = shift( @_ );
14872             my $meth = $self->_get_method( 'treasury_financial_account', $action, $allowed ) || CORE::return( $self->pass_error );
14873             CORE::return( $self->$meth( @_ ) );
14874             }
14875             PERL
14876             # NOTE: treasury_inbound_transfer()
14877             treasury_inbound_transfer => <<'PERL',
14878             sub treasury_inbound_transfer { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Treasury::InboundTransfer', @_ ) ); }
14879             PERL
14880             # NOTE: treasury_inbound_transfer_cancel()
14881             treasury_inbound_transfer_cancel => <<'PERL',
14882             sub treasury_inbound_transfer_cancel
14883             {
14884             my $self = shift( @_ );
14885             my $args = shift( @_ );
14886             my $okParams =
14887             {
14888             expandable => { allowed => $EXPANDABLES->{ 'treasury.inbound_transfer' } },
14889             };
14890             $args = $self->_contract( 'treasury.inbound_transfer', $args ) || CORE::return( $self->pass_error );
14891             my $err = $self->_check_parameters( $okParams, $args );
14892             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
14893             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No treasury.inbound_transfer id (with parameter 'id') was provided to cancel its information." ) );
14894             my $hash = $self->post( "treasury/inbound_transfers/${id}", $args ) || CORE::return( $self->pass_error );
14895             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Treasury::InboundTransfer', $hash ) );
14896             }
14897             PERL
14898             # NOTE: treasury_inbound_transfer_create()
14899             treasury_inbound_transfer_create => <<'PERL',
14900             sub treasury_inbound_transfer_create
14901             {
14902             my $self = shift( @_ );
14903             my $args = shift( @_ );
14904             my $okParams =
14905             {
14906             expandable => { allowed => $EXPANDABLES->{ 'treasury.inbound_transfer' } },
14907             amount => { type => "integer", required => 1 },
14908             currency => { type => "string", required => 1 },
14909             description => { type => "string" },
14910             financial_account => { type => "string", required => 1 },
14911             metadata => { type => "hash" },
14912             origin_payment_method => { type => "string", required => 1 },
14913             statement_descriptor => { type => "string" },
14914             };
14915             $args = $self->_contract( 'treasury.inbound_transfer', $args ) || CORE::return( $self->pass_error );
14916             my $err = $self->_check_parameters( $okParams, $args );
14917             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
14918             my $hash = $self->post( "", $args ) || CORE::return( $self->pass_error );
14919             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Treasury::InboundTransfer', $hash ) );
14920             }
14921             PERL
14922             # NOTE: treasury_inbound_transfer_fail()
14923             treasury_inbound_transfer_fail => <<'PERL',
14924             sub treasury_inbound_transfer_fail
14925             {
14926             my $self = shift( @_ );
14927             my $args = shift( @_ );
14928             my $okParams =
14929             {
14930             expandable => { allowed => $EXPANDABLES->{ 'treasury.inbound_transfer' } },
14931             failure_details => { type => "hash" },
14932             };
14933             $args = $self->_contract( 'treasury.inbound_transfer', $args ) || CORE::return( $self->pass_error );
14934             my $err = $self->_check_parameters( $okParams, $args );
14935             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
14936             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No treasury.inbound_transfer id (with parameter 'id') was provided to fail its information." ) );
14937             my $hash = $self->post( "test_helpers/treasury/inbound_transfers/${id}", $args ) || CORE::return( $self->pass_error );
14938             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Treasury::InboundTransfer', $hash ) );
14939             }
14940             PERL
14941             # NOTE: treasury_inbound_transfer_list()
14942             treasury_inbound_transfer_list => <<'PERL',
14943             sub treasury_inbound_transfer_list
14944             {
14945             my $self = shift( @_ );
14946             CORE::return( $self->error( "No parameters were provided to list treasury inbound transfer information." ) ) if( !scalar( @_ ) );
14947             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Treasury::InboundTransfer', @_ );
14948             my $okParams =
14949             {
14950             expandable => { allowed => $EXPANDABLES->{ 'treasury.inbound_transfer' }, data_prefix_is_ok => 1 },
14951             ending_before => { type => "string" },
14952             financial_account => { type => "string", required => 1 },
14953             limit => { type => "string" },
14954             starting_after => { type => "string" },
14955             status => { type => "string" },
14956             };
14957             my $err = $self->_check_parameters( $okParams, $args );
14958             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
14959             if( $args->{expand} )
14960             {
14961             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
14962             }
14963             my $hash = $self->get( "", $args ) || CORE::return( $self->pass_error );
14964             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Treasury::InboundTransfer', $hash ) );
14965             }
14966             PERL
14967             # NOTE: treasury_inbound_transfer_retrieve()
14968             treasury_inbound_transfer_retrieve => <<'PERL',
14969             sub treasury_inbound_transfer_retrieve
14970             {
14971             my $self = shift( @_ );
14972             my $args = shift( @_ );
14973             my $okParams =
14974             {
14975             expandable => { allowed => $EXPANDABLES->{ 'treasury.inbound_transfer' }, data_prefix_is_ok => 1 },
14976             };
14977             $args = $self->_contract( 'treasury.inbound_transfer', $args ) || CORE::return( $self->pass_error );
14978             my $err = $self->_check_parameters( $okParams, $args );
14979             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
14980             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No treasury.inbound_transfer id (with parameter 'id') was provided to retrieve its information." ) );
14981             my $hash = $self->get( "treasury/inbound_transfers/${id}", $args ) || CORE::return( $self->pass_error );
14982             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Treasury::InboundTransfer', $hash ) );
14983             }
14984             PERL
14985             # NOTE: treasury_inbound_transfer_return()
14986             treasury_inbound_transfer_return => <<'PERL',
14987             sub treasury_inbound_transfer_return
14988             {
14989             my $self = shift( @_ );
14990             my $args = shift( @_ );
14991             my $okParams =
14992             {
14993             expandable => { allowed => $EXPANDABLES->{ 'treasury.inbound_transfer' } },
14994             };
14995             $args = $self->_contract( 'treasury.inbound_transfer', $args ) || CORE::return( $self->pass_error );
14996             my $err = $self->_check_parameters( $okParams, $args );
14997             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
14998             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No treasury.inbound_transfer id (with parameter 'id') was provided to return its information." ) );
14999             my $hash = $self->post( "test_helpers/treasury/inbound_transfers/${id}", $args ) || CORE::return( $self->pass_error );
15000             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Treasury::InboundTransfer', $hash ) );
15001             }
15002             PERL
15003             # NOTE: treasury_inbound_transfer_succeed()
15004             treasury_inbound_transfer_succeed => <<'PERL',
15005             sub treasury_inbound_transfer_succeed
15006             {
15007             my $self = shift( @_ );
15008             my $args = shift( @_ );
15009             my $okParams =
15010             {
15011             expandable => { allowed => $EXPANDABLES->{ 'treasury.inbound_transfer' } },
15012             };
15013             $args = $self->_contract( 'treasury.inbound_transfer', $args ) || CORE::return( $self->pass_error );
15014             my $err = $self->_check_parameters( $okParams, $args );
15015             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
15016             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No treasury.inbound_transfer id (with parameter 'id') was provided to succeed its information." ) );
15017             my $hash = $self->post( "test_helpers/treasury/inbound_transfers/${id}", $args ) || CORE::return( $self->pass_error );
15018             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Treasury::InboundTransfer', $hash ) );
15019             }
15020             PERL
15021             # NOTE: treasury_inbound_transfers()
15022             treasury_inbound_transfers => <<'PERL',
15023             # <https://stripe.com/docs/api/treasury/inbound_transfers>
15024             sub treasury_inbound_transfers
15025             {
15026             my $self = shift( @_ );
15027             my $allowed = [qw( cancel create fail list retrieve return succeed )];
15028             my $action = shift( @_ );
15029             my $meth = $self->_get_method( 'treasury_inbound_transfer', $action, $allowed ) || CORE::return( $self->pass_error );
15030             CORE::return( $self->$meth( @_ ) );
15031             }
15032             PERL
15033             # NOTE: treasury_outbound_payment()
15034             treasury_outbound_payment => <<'PERL',
15035             sub treasury_outbound_payment { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Treasury::OutboundPayment', @_ ) ); }
15036             PERL
15037             # NOTE: treasury_outbound_payment_cancel()
15038             treasury_outbound_payment_cancel => <<'PERL',
15039             sub treasury_outbound_payment_cancel
15040             {
15041             my $self = shift( @_ );
15042             my $args = shift( @_ );
15043             my $okParams =
15044             {
15045             expandable => { allowed => $EXPANDABLES->{ 'treasury.outbound_payment' } },
15046             };
15047             $args = $self->_contract( 'treasury.outbound_payment', $args ) || CORE::return( $self->pass_error );
15048             my $err = $self->_check_parameters( $okParams, $args );
15049             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
15050             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No treasury.outbound_payment id (with parameter 'id') was provided to cancel its information." ) );
15051             my $hash = $self->post( "treasury/outbound_payments/${id}", $args ) || CORE::return( $self->pass_error );
15052             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Treasury::OutboundPayment', $hash ) );
15053             }
15054             PERL
15055             # NOTE: treasury_outbound_payment_create()
15056             treasury_outbound_payment_create => <<'PERL',
15057             sub treasury_outbound_payment_create
15058             {
15059             my $self = shift( @_ );
15060             my $args = shift( @_ );
15061             my $okParams =
15062             {
15063             expandable => { allowed => $EXPANDABLES->{ 'treasury.outbound_payment' } },
15064             amount => { type => "integer", required => 1 },
15065             currency => { type => "string", required => 1 },
15066             customer => { type => "string" },
15067             description => { type => "string" },
15068             destination_payment_method => { type => "string" },
15069             destination_payment_method_data => { type => "object" },
15070             destination_payment_method_options => { type => "object" },
15071             end_user_details => { type => "hash" },
15072             financial_account => { type => "string", required => 1 },
15073             metadata => { type => "hash" },
15074             statement_descriptor => { type => "string" },
15075             };
15076             $args = $self->_contract( 'treasury.outbound_payment', $args ) || CORE::return( $self->pass_error );
15077             my $err = $self->_check_parameters( $okParams, $args );
15078             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
15079             my $hash = $self->post( "", $args ) || CORE::return( $self->pass_error );
15080             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Treasury::OutboundPayment', $hash ) );
15081             }
15082             PERL
15083             # NOTE: treasury_outbound_payment_fail()
15084             treasury_outbound_payment_fail => <<'PERL',
15085             sub treasury_outbound_payment_fail
15086             {
15087             my $self = shift( @_ );
15088             my $args = shift( @_ );
15089             my $okParams =
15090             {
15091             expandable => { allowed => $EXPANDABLES->{ 'treasury.outbound_payment' } },
15092             };
15093             $args = $self->_contract( 'treasury.outbound_payment', $args ) || CORE::return( $self->pass_error );
15094             my $err = $self->_check_parameters( $okParams, $args );
15095             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
15096             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No treasury.outbound_payment id (with parameter 'id') was provided to fail its information." ) );
15097             my $hash = $self->post( "test_helpers/treasury/outbound_payments/${id}", $args ) || CORE::return( $self->pass_error );
15098             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Treasury::OutboundPayment', $hash ) );
15099             }
15100             PERL
15101             # NOTE: treasury_outbound_payment_list()
15102             treasury_outbound_payment_list => <<'PERL',
15103             sub treasury_outbound_payment_list
15104             {
15105             my $self = shift( @_ );
15106             CORE::return( $self->error( "No parameters were provided to list treasury outbound payment information." ) ) if( !scalar( @_ ) );
15107             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Treasury::OutboundPayment', @_ );
15108             my $okParams =
15109             {
15110             expandable => { allowed => $EXPANDABLES->{ 'treasury.outbound_payment' }, data_prefix_is_ok => 1 },
15111             customer => { type => "string" },
15112             ending_before => { type => "string" },
15113             financial_account => { type => "string", required => 1 },
15114             limit => { type => "string" },
15115             starting_after => { type => "string" },
15116             status => { type => "string" },
15117             };
15118             my $err = $self->_check_parameters( $okParams, $args );
15119             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
15120             if( $args->{expand} )
15121             {
15122             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
15123             }
15124             my $hash = $self->get( "", $args ) || CORE::return( $self->pass_error );
15125             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Treasury::OutboundPayment', $hash ) );
15126             }
15127             PERL
15128             # NOTE: treasury_outbound_payment_post()
15129             treasury_outbound_payment_post => <<'PERL',
15130             sub treasury_outbound_payment_post
15131             {
15132             my $self = shift( @_ );
15133             my $args = shift( @_ );
15134             my $okParams =
15135             {
15136             expandable => { allowed => $EXPANDABLES->{ 'treasury.outbound_payment' } },
15137             };
15138             $args = $self->_contract( 'treasury.outbound_payment', $args ) || CORE::return( $self->pass_error );
15139             my $err = $self->_check_parameters( $okParams, $args );
15140             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
15141             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No treasury.outbound_payment id (with parameter 'id') was provided to post its information." ) );
15142             my $hash = $self->post( "test_helpers/treasury/outbound_payments/${id}", $args ) || CORE::return( $self->pass_error );
15143             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Treasury::OutboundPayment', $hash ) );
15144             }
15145             PERL
15146             # NOTE: treasury_outbound_payment_retrieve()
15147             treasury_outbound_payment_retrieve => <<'PERL',
15148             sub treasury_outbound_payment_retrieve
15149             {
15150             my $self = shift( @_ );
15151             my $args = shift( @_ );
15152             my $okParams =
15153             {
15154             expandable => { allowed => $EXPANDABLES->{ 'treasury.outbound_payment' }, data_prefix_is_ok => 1 },
15155             };
15156             $args = $self->_contract( 'treasury.outbound_payment', $args ) || CORE::return( $self->pass_error );
15157             my $err = $self->_check_parameters( $okParams, $args );
15158             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
15159             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No treasury.outbound_payment id (with parameter 'id') was provided to retrieve its information." ) );
15160             my $hash = $self->get( "treasury/outbound_payments/${id}", $args ) || CORE::return( $self->pass_error );
15161             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Treasury::OutboundPayment', $hash ) );
15162             }
15163             PERL
15164             # NOTE: treasury_outbound_payment_return()
15165             treasury_outbound_payment_return => <<'PERL',
15166             sub treasury_outbound_payment_return
15167             {
15168             my $self = shift( @_ );
15169             my $args = shift( @_ );
15170             my $okParams =
15171             {
15172             expandable => { allowed => $EXPANDABLES->{ 'treasury.outbound_payment' } },
15173             returned_details => { type => "hash" },
15174             };
15175             $args = $self->_contract( 'treasury.outbound_payment', $args ) || CORE::return( $self->pass_error );
15176             my $err = $self->_check_parameters( $okParams, $args );
15177             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
15178             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No treasury.outbound_payment id (with parameter 'id') was provided to return its information." ) );
15179             my $hash = $self->post( "test_helpers/treasury/outbound_payments/${id}", $args ) || CORE::return( $self->pass_error );
15180             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Treasury::OutboundPayment', $hash ) );
15181             }
15182             PERL
15183             # NOTE: treasury_outbound_payments()
15184             treasury_outbound_payments => <<'PERL',
15185             # <https://stripe.com/docs/api/treasury/outbound_payments>
15186             sub treasury_outbound_payments
15187             {
15188             my $self = shift( @_ );
15189             my $allowed = [qw( cancel create fail list post retrieve return )];
15190             my $action = shift( @_ );
15191             my $meth = $self->_get_method( 'treasury_outbound_payment', $action, $allowed ) || CORE::return( $self->pass_error );
15192             CORE::return( $self->$meth( @_ ) );
15193             }
15194             PERL
15195             # NOTE: treasury_outbound_transfer()
15196             treasury_outbound_transfer => <<'PERL',
15197             sub treasury_outbound_transfer { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Treasury::OutboundTransfer', @_ ) ); }
15198             PERL
15199             # NOTE: treasury_outbound_transfer_cancel()
15200             treasury_outbound_transfer_cancel => <<'PERL',
15201             sub treasury_outbound_transfer_cancel
15202             {
15203             my $self = shift( @_ );
15204             my $args = shift( @_ );
15205             my $okParams =
15206             {
15207             expandable => { allowed => $EXPANDABLES->{ 'treasury.outbound_transfer' } },
15208             };
15209             $args = $self->_contract( 'treasury.outbound_transfer', $args ) || CORE::return( $self->pass_error );
15210             my $err = $self->_check_parameters( $okParams, $args );
15211             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
15212             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No treasury.outbound_transfer id (with parameter 'id') was provided to cancel its information." ) );
15213             my $hash = $self->post( "treasury/outbound_transfers/${id}", $args ) || CORE::return( $self->pass_error );
15214             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Treasury::OutboundTransfer', $hash ) );
15215             }
15216             PERL
15217             # NOTE: treasury_outbound_transfer_create()
15218             treasury_outbound_transfer_create => <<'PERL',
15219             sub treasury_outbound_transfer_create
15220             {
15221             my $self = shift( @_ );
15222             my $args = shift( @_ );
15223             my $okParams =
15224             {
15225             expandable => { allowed => $EXPANDABLES->{ 'treasury.outbound_transfer' } },
15226             amount => { type => "integer", required => 1 },
15227             currency => { type => "string", required => 1 },
15228             description => { type => "string" },
15229             destination_payment_method => { type => "string" },
15230             destination_payment_method_options => { type => "object" },
15231             financial_account => { type => "string", required => 1 },
15232             metadata => { type => "hash" },
15233             statement_descriptor => { type => "string" },
15234             };
15235             $args = $self->_contract( 'treasury.outbound_transfer', $args ) || CORE::return( $self->pass_error );
15236             my $err = $self->_check_parameters( $okParams, $args );
15237             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
15238             my $hash = $self->post( "", $args ) || CORE::return( $self->pass_error );
15239             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Treasury::OutboundTransfer', $hash ) );
15240             }
15241             PERL
15242             # NOTE: treasury_outbound_transfer_fail()
15243             treasury_outbound_transfer_fail => <<'PERL',
15244             sub treasury_outbound_transfer_fail
15245             {
15246             my $self = shift( @_ );
15247             my $args = shift( @_ );
15248             my $okParams =
15249             {
15250             expandable => { allowed => $EXPANDABLES->{ 'treasury.outbound_transfer' } },
15251             };
15252             $args = $self->_contract( 'treasury.outbound_transfer', $args ) || CORE::return( $self->pass_error );
15253             my $err = $self->_check_parameters( $okParams, $args );
15254             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
15255             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No treasury.outbound_transfer id (with parameter 'id') was provided to fail its information." ) );
15256             my $hash = $self->post( "test_helpers/treasury/outbound_transfers/${id}", $args ) || CORE::return( $self->pass_error );
15257             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Treasury::OutboundTransfer', $hash ) );
15258             }
15259             PERL
15260             # NOTE: treasury_outbound_transfer_list()
15261             treasury_outbound_transfer_list => <<'PERL',
15262             sub treasury_outbound_transfer_list
15263             {
15264             my $self = shift( @_ );
15265             CORE::return( $self->error( "No parameters were provided to list treasury outbound transfer information." ) ) if( !scalar( @_ ) );
15266             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Treasury::OutboundTransfer', @_ );
15267             my $okParams =
15268             {
15269             expandable => { allowed => $EXPANDABLES->{ 'treasury.outbound_transfer' }, data_prefix_is_ok => 1 },
15270             ending_before => { type => "string" },
15271             financial_account => { type => "string", required => 1 },
15272             limit => { type => "string" },
15273             starting_after => { type => "string" },
15274             status => { type => "string" },
15275             };
15276             my $err = $self->_check_parameters( $okParams, $args );
15277             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
15278             if( $args->{expand} )
15279             {
15280             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
15281             }
15282             my $hash = $self->get( "", $args ) || CORE::return( $self->pass_error );
15283             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Treasury::OutboundTransfer', $hash ) );
15284             }
15285             PERL
15286             # NOTE: treasury_outbound_transfer_post()
15287             treasury_outbound_transfer_post => <<'PERL',
15288             sub treasury_outbound_transfer_post
15289             {
15290             my $self = shift( @_ );
15291             my $args = shift( @_ );
15292             my $okParams =
15293             {
15294             expandable => { allowed => $EXPANDABLES->{ 'treasury.outbound_transfer' } },
15295             };
15296             $args = $self->_contract( 'treasury.outbound_transfer', $args ) || CORE::return( $self->pass_error );
15297             my $err = $self->_check_parameters( $okParams, $args );
15298             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
15299             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No treasury.outbound_transfer id (with parameter 'id') was provided to post its information." ) );
15300             my $hash = $self->post( "test_helpers/treasury/outbound_transfers/${id}", $args ) || CORE::return( $self->pass_error );
15301             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Treasury::OutboundTransfer', $hash ) );
15302             }
15303             PERL
15304             # NOTE: treasury_outbound_transfer_retrieve()
15305             treasury_outbound_transfer_retrieve => <<'PERL',
15306             sub treasury_outbound_transfer_retrieve
15307             {
15308             my $self = shift( @_ );
15309             my $args = shift( @_ );
15310             my $okParams =
15311             {
15312             expandable => { allowed => $EXPANDABLES->{ 'treasury.outbound_transfer' }, data_prefix_is_ok => 1 },
15313             };
15314             $args = $self->_contract( 'treasury.outbound_transfer', $args ) || CORE::return( $self->pass_error );
15315             my $err = $self->_check_parameters( $okParams, $args );
15316             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
15317             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No treasury.outbound_transfer id (with parameter 'id') was provided to retrieve its information." ) );
15318             my $hash = $self->get( "treasury/outbound_transfers/${id}", $args ) || CORE::return( $self->pass_error );
15319             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Treasury::OutboundTransfer', $hash ) );
15320             }
15321             PERL
15322             # NOTE: treasury_outbound_transfer_return()
15323             treasury_outbound_transfer_return => <<'PERL',
15324             sub treasury_outbound_transfer_return
15325             {
15326             my $self = shift( @_ );
15327             my $args = shift( @_ );
15328             my $okParams =
15329             {
15330             expandable => { allowed => $EXPANDABLES->{ 'treasury.outbound_transfer' } },
15331             returned_details => { type => "hash" },
15332             };
15333             $args = $self->_contract( 'treasury.outbound_transfer', $args ) || CORE::return( $self->pass_error );
15334             my $err = $self->_check_parameters( $okParams, $args );
15335             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
15336             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No treasury.outbound_transfer id (with parameter 'id') was provided to return its information." ) );
15337             my $hash = $self->post( "test_helpers/treasury/outbound_transfers/${id}", $args ) || CORE::return( $self->pass_error );
15338             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Treasury::OutboundTransfer', $hash ) );
15339             }
15340             PERL
15341             # NOTE: treasury_outbound_transfers()
15342             treasury_outbound_transfers => <<'PERL',
15343             # <https://stripe.com/docs/api/treasury/outbound_transfers>
15344             sub treasury_outbound_transfers
15345             {
15346             my $self = shift( @_ );
15347             my $allowed = [qw( cancel create fail list post retrieve return )];
15348             my $action = shift( @_ );
15349             my $meth = $self->_get_method( 'treasury_outbound_transfer', $action, $allowed ) || CORE::return( $self->pass_error );
15350             CORE::return( $self->$meth( @_ ) );
15351             }
15352             PERL
15353             # NOTE: treasury_received_credit()
15354             treasury_received_credit => <<'PERL',
15355             sub treasury_received_credit { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Treasury::ReceivedCredit', @_ ) ); }
15356             PERL
15357             # NOTE: treasury_received_credit_list()
15358             treasury_received_credit_list => <<'PERL',
15359             sub treasury_received_credit_list
15360             {
15361             my $self = shift( @_ );
15362             CORE::return( $self->error( "No parameters were provided to list treasury received credit information." ) ) if( !scalar( @_ ) );
15363             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Treasury::ReceivedCredit', @_ );
15364             my $okParams =
15365             {
15366             expandable => { allowed => $EXPANDABLES->{ 'treasury.received_credit' }, data_prefix_is_ok => 1 },
15367             ending_before => { type => "string" },
15368             financial_account => { type => "string", required => 1 },
15369             limit => { type => "string" },
15370             linked_flows => { type => "hash" },
15371             starting_after => { type => "string" },
15372             status => { type => "string" },
15373             };
15374             my $err = $self->_check_parameters( $okParams, $args );
15375             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
15376             if( $args->{expand} )
15377             {
15378             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
15379             }
15380             my $hash = $self->get( "", $args ) || CORE::return( $self->pass_error );
15381             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Treasury::ReceivedCredit', $hash ) );
15382             }
15383             PERL
15384             # NOTE: treasury_received_credit_received_credit()
15385             treasury_received_credit_received_credit => <<'PERL',
15386             sub treasury_received_credit_received_credit
15387             {
15388             my $self = shift( @_ );
15389             my $args = shift( @_ );
15390             my $okParams =
15391             {
15392             expandable => { allowed => $EXPANDABLES->{ 'treasury.received_credit' } },
15393             amount => { type => "integer", required => 1 },
15394             currency => { type => "string", required => 1 },
15395             description => { type => "string" },
15396             financial_account => { type => "string", required => 1 },
15397             initiating_payment_method_details => { type => "hash" },
15398             network => { type => "string", required => 1 },
15399             };
15400             $args = $self->_contract( 'treasury.received_credit', $args ) || CORE::return( $self->pass_error );
15401             my $err = $self->_check_parameters( $okParams, $args );
15402             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
15403             my $hash = $self->post( "test_helpers/treasury/received_credits", $args ) || CORE::return( $self->pass_error );
15404             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Treasury::ReceivedCredit', $hash ) );
15405             }
15406             PERL
15407             # NOTE: treasury_received_credit_retrieve()
15408             treasury_received_credit_retrieve => <<'PERL',
15409             sub treasury_received_credit_retrieve
15410             {
15411             my $self = shift( @_ );
15412             my $args = shift( @_ );
15413             my $okParams =
15414             {
15415             expandable => { allowed => $EXPANDABLES->{ 'treasury.received_credit' }, data_prefix_is_ok => 1 },
15416             };
15417             $args = $self->_contract( 'treasury.received_credit', $args ) || CORE::return( $self->pass_error );
15418             my $err = $self->_check_parameters( $okParams, $args );
15419             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
15420             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No treasury.received_credit id (with parameter 'id') was provided to retrieve its information." ) );
15421             my $hash = $self->get( "treasury/received_credits/${id}", $args ) || CORE::return( $self->pass_error );
15422             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Treasury::ReceivedCredit', $hash ) );
15423             }
15424             PERL
15425             # NOTE: treasury_received_credits()
15426             treasury_received_credits => <<'PERL',
15427             # <https://stripe.com/docs/api/treasury/received_credits>
15428             sub treasury_received_credits
15429             {
15430             my $self = shift( @_ );
15431             my $allowed = [qw( list received_credit retrieve )];
15432             my $action = shift( @_ );
15433             my $meth = $self->_get_method( 'treasury_received_credit', $action, $allowed ) || CORE::return( $self->pass_error );
15434             CORE::return( $self->$meth( @_ ) );
15435             }
15436             PERL
15437             # NOTE: treasury_received_debit()
15438             treasury_received_debit => <<'PERL',
15439             sub treasury_received_debit { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Treasury::ReceivedDebit', @_ ) ); }
15440             PERL
15441             # NOTE: treasury_received_debit_list()
15442             treasury_received_debit_list => <<'PERL',
15443             sub treasury_received_debit_list
15444             {
15445             my $self = shift( @_ );
15446             CORE::return( $self->error( "No parameters were provided to list treasury received debit information." ) ) if( !scalar( @_ ) );
15447             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Treasury::ReceivedDebit', @_ );
15448             my $okParams =
15449             {
15450             expandable => { allowed => $EXPANDABLES->{ 'treasury.received_debit' }, data_prefix_is_ok => 1 },
15451             ending_before => { type => "string" },
15452             financial_account => { type => "string", required => 1 },
15453             limit => { type => "string" },
15454             starting_after => { type => "string" },
15455             status => { type => "string" },
15456             };
15457             my $err = $self->_check_parameters( $okParams, $args );
15458             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
15459             if( $args->{expand} )
15460             {
15461             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
15462             }
15463             my $hash = $self->get( "", $args ) || CORE::return( $self->pass_error );
15464             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Treasury::ReceivedDebit', $hash ) );
15465             }
15466             PERL
15467             # NOTE: treasury_received_debit_received_debit()
15468             treasury_received_debit_received_debit => <<'PERL',
15469             sub treasury_received_debit_received_debit
15470             {
15471             my $self = shift( @_ );
15472             my $args = shift( @_ );
15473             my $okParams =
15474             {
15475             expandable => { allowed => $EXPANDABLES->{ 'treasury.received_debit' } },
15476             amount => { type => "integer", required => 1 },
15477             currency => { type => "string", required => 1 },
15478             description => { type => "string" },
15479             financial_account => { type => "string", required => 1 },
15480             initiating_payment_method_details => { type => "hash" },
15481             network => { type => "string", required => 1 },
15482             };
15483             $args = $self->_contract( 'treasury.received_debit', $args ) || CORE::return( $self->pass_error );
15484             my $err = $self->_check_parameters( $okParams, $args );
15485             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
15486             my $hash = $self->post( "test_helpers/treasury/received_debits", $args ) || CORE::return( $self->pass_error );
15487             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Treasury::ReceivedDebit', $hash ) );
15488             }
15489             PERL
15490             # NOTE: treasury_received_debit_retrieve()
15491             treasury_received_debit_retrieve => <<'PERL',
15492             sub treasury_received_debit_retrieve
15493             {
15494             my $self = shift( @_ );
15495             my $args = shift( @_ );
15496             my $okParams =
15497             {
15498             expandable => { allowed => $EXPANDABLES->{ 'treasury.received_debit' }, data_prefix_is_ok => 1 },
15499             };
15500             $args = $self->_contract( 'treasury.received_debit', $args ) || CORE::return( $self->pass_error );
15501             my $err = $self->_check_parameters( $okParams, $args );
15502             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
15503             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No treasury.received_debit id (with parameter 'id') was provided to retrieve its information." ) );
15504             my $hash = $self->get( "treasury/received_debits/${id}", $args ) || CORE::return( $self->pass_error );
15505             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Treasury::ReceivedDebit', $hash ) );
15506             }
15507             PERL
15508             # NOTE: treasury_received_debits()
15509             treasury_received_debits => <<'PERL',
15510             # <https://stripe.com/docs/api/treasury/received_debits>
15511             sub treasury_received_debits
15512             {
15513             my $self = shift( @_ );
15514             my $allowed = [qw( list received_debit retrieve )];
15515             my $action = shift( @_ );
15516             my $meth = $self->_get_method( 'treasury_received_debit', $action, $allowed ) || CORE::return( $self->pass_error );
15517             CORE::return( $self->$meth( @_ ) );
15518             }
15519             PERL
15520             # NOTE: treasury_transaction()
15521             treasury_transaction => <<'PERL',
15522             sub treasury_transaction { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Treasury::Transaction', @_ ) ); }
15523             PERL
15524             # NOTE: treasury_transaction_entry()
15525             treasury_transaction_entry => <<'PERL',
15526             sub treasury_transaction_entry { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Treasury::TransactionEntry', @_ ) ); }
15527             PERL
15528             # NOTE: treasury_transaction_entry_list()
15529             treasury_transaction_entry_list => <<'PERL',
15530             sub treasury_transaction_entry_list
15531             {
15532             my $self = shift( @_ );
15533             CORE::return( $self->error( "No parameters were provided to list treasury transaction entry information." ) ) if( !scalar( @_ ) );
15534             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Treasury::TransactionEntry', @_ );
15535             my $okParams =
15536             {
15537             expandable => { allowed => $EXPANDABLES->{ 'treasury.transaction_entry' }, data_prefix_is_ok => 1 },
15538             created => { type => "timestamp" },
15539             effective_at => { type => "timestamp" },
15540             ending_before => { type => "string" },
15541             financial_account => { type => "string", required => 1 },
15542             limit => { type => "string" },
15543             order_by => { type => "string" },
15544             starting_after => { type => "string" },
15545             transaction => { type => "string" },
15546             };
15547             my $err = $self->_check_parameters( $okParams, $args );
15548             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
15549             if( $args->{expand} )
15550             {
15551             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
15552             }
15553             my $hash = $self->get( "treasury/transaction_entries", $args ) || CORE::return( $self->pass_error );
15554             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Treasury::TransactionEntry', $hash ) );
15555             }
15556             PERL
15557             # NOTE: treasury_transaction_entry_retrieve()
15558             treasury_transaction_entry_retrieve => <<'PERL',
15559             sub treasury_transaction_entry_retrieve
15560             {
15561             my $self = shift( @_ );
15562             my $args = shift( @_ );
15563             my $okParams =
15564             {
15565             expandable => { allowed => $EXPANDABLES->{ 'treasury.transaction_entry' }, data_prefix_is_ok => 1 },
15566             };
15567             $args = $self->_contract( 'treasury.transaction_entry', $args ) || CORE::return( $self->pass_error );
15568             my $err = $self->_check_parameters( $okParams, $args );
15569             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
15570             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No treasury.transaction_entry id (with parameter 'id') was provided to retrieve its information." ) );
15571             my $hash = $self->get( "treasury/transaction_entries/${id}", $args ) || CORE::return( $self->pass_error );
15572             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Treasury::TransactionEntry', $hash ) );
15573             }
15574             PERL
15575             # NOTE: treasury_transaction_entrys()
15576             treasury_transaction_entrys => <<'PERL',
15577             # <https://stripe.com/docs/api/treasury/transaction_entries>
15578             sub treasury_transaction_entrys
15579             {
15580             my $self = shift( @_ );
15581             my $allowed = [qw( list retrieve )];
15582             my $action = shift( @_ );
15583             my $meth = $self->_get_method( 'treasury_transaction_entry', $action, $allowed ) || CORE::return( $self->pass_error );
15584             CORE::return( $self->$meth( @_ ) );
15585             }
15586             PERL
15587             # NOTE: treasury_transaction_list()
15588             treasury_transaction_list => <<'PERL',
15589             sub treasury_transaction_list
15590             {
15591             my $self = shift( @_ );
15592             CORE::return( $self->error( "No parameters were provided to list treasury transaction information." ) ) if( !scalar( @_ ) );
15593             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Treasury::Transaction', @_ );
15594             my $okParams =
15595             {
15596             expandable => { allowed => $EXPANDABLES->{ 'treasury.transaction' }, data_prefix_is_ok => 1 },
15597             created => { type => "timestamp" },
15598             ending_before => { type => "string" },
15599             financial_account => { type => "string", required => 1 },
15600             limit => { type => "string" },
15601             order_by => { type => "string" },
15602             starting_after => { type => "string" },
15603             status => { type => "string" },
15604             status_transitions => { type => "hash" },
15605             };
15606             my $err = $self->_check_parameters( $okParams, $args );
15607             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
15608             if( $args->{expand} )
15609             {
15610             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
15611             }
15612             my $hash = $self->get( "", $args ) || CORE::return( $self->pass_error );
15613             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Treasury::Transaction', $hash ) );
15614             }
15615             PERL
15616             # NOTE: treasury_transaction_retrieve()
15617             treasury_transaction_retrieve => <<'PERL',
15618             sub treasury_transaction_retrieve
15619             {
15620             my $self = shift( @_ );
15621             my $args = shift( @_ );
15622             my $okParams =
15623             {
15624             expandable => { allowed => $EXPANDABLES->{ 'treasury.transaction' }, data_prefix_is_ok => 1 },
15625             };
15626             $args = $self->_contract( 'treasury.transaction', $args ) || CORE::return( $self->pass_error );
15627             my $err = $self->_check_parameters( $okParams, $args );
15628             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
15629             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No treasury.transaction id (with parameter 'id') was provided to retrieve its information." ) );
15630             my $hash = $self->get( "treasury/transactions/${id}", $args ) || CORE::return( $self->pass_error );
15631             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Treasury::Transaction', $hash ) );
15632             }
15633             PERL
15634             # NOTE: treasury_transactions()
15635             treasury_transactions => <<'PERL',
15636             # <https://stripe.com/docs/api/treasury/transactions>
15637             sub treasury_transactions
15638             {
15639             my $self = shift( @_ );
15640             my $allowed = [qw( list retrieve )];
15641             my $action = shift( @_ );
15642             my $meth = $self->_get_method( 'treasury_transaction', $action, $allowed ) || CORE::return( $self->pass_error );
15643             CORE::return( $self->$meth( @_ ) );
15644             }
15645             PERL
15646             # NOTE: usage_record()
15647             usage_record => <<'PERL',
15648             sub usage_record { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Billing::UsageRecord', @_ ) ); }
15649             PERL
15650             # NOTE: usage_record_create()
15651             usage_record_create => <<'PERL',
15652             sub usage_record_create
15653             {
15654             my $self = shift( @_ );
15655             my $args = shift( @_ );
15656             my $okParams =
15657             {
15658             expandable => { allowed => $EXPANDABLES->{ 'usage_record' } },
15659             action => { type => "string" },
15660             quantity => { type => "integer", required => 1 },
15661             timestamp => { type => "timestamp" },
15662             };
15663             $args = $self->_contract( 'usage_record', $args ) || CORE::return( $self->pass_error );
15664             my $err = $self->_check_parameters( $okParams, $args );
15665             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
15666             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No subscription_item id (with parameter 'id') was provided to create its information." ) );
15667             my $hash = $self->post( "subscription_items/${id}/usage_records", $args ) || CORE::return( $self->pass_error );
15668             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::UsageRecord', $hash ) );
15669             }
15670             PERL
15671             # NOTE: usage_record_list()
15672             usage_record_list => <<'PERL',
15673             sub usage_record_list
15674             {
15675             my $self = shift( @_ );
15676             CORE::return( $self->error( "No parameters were provided to list usage record information." ) ) if( !scalar( @_ ) );
15677             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Billing::UsageRecord', @_ );
15678             my $okParams =
15679             {
15680             expandable => { allowed => $EXPANDABLES->{ 'usage_record' }, data_prefix_is_ok => 1 },
15681             ending_before => { type => "string" },
15682             limit => { type => "string" },
15683             starting_after => { type => "string" },
15684             };
15685             my $err = $self->_check_parameters( $okParams, $args );
15686             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
15687             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No subscription_item id (with parameter 'id') was provided to list its information." ) );
15688             if( $args->{expand} )
15689             {
15690             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
15691             }
15692             my $hash = $self->get( "subscription_items/${id}", $args ) || CORE::return( $self->pass_error );
15693             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::UsageRecord', $hash ) );
15694             }
15695             PERL
15696             # NOTE: usage_record_summary()
15697             usage_record_summary => <<'PERL',
15698             sub usage_record_summary { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Billing::UserRecord::Summary', @_ ) ); }
15699             PERL
15700             # NOTE: usage_records()
15701             usage_records => <<'PERL',
15702             # <https://stripe.com/docs/api/usage_records>
15703             sub usage_records
15704             {
15705             my $self = shift( @_ );
15706             my $allowed = [qw( create list )];
15707             my $action = shift( @_ );
15708             my $meth = $self->_get_method( 'usage_record', $action, $allowed ) || CORE::return( $self->pass_error );
15709             CORE::return( $self->$meth( @_ ) );
15710             }
15711             PERL
15712             # NOTE: value_list()
15713             value_list => <<'PERL',
15714             sub value_list { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Fraud::ValueList', @_ ) ); }
15715             PERL
15716             # NOTE: value_list_item()
15717             value_list_item => <<'PERL',
15718             sub value_list_item { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Fraud::ValueList::Item', @_ ) ); }
15719             PERL
15720             # NOTE: verification()
15721             verification => <<'PERL',
15722             sub verification { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Connect::Account::Verification', @_ ) ); }
15723             PERL
15724             # NOTE: verification_data()
15725             verification_data => <<'PERL',
15726             sub verification_data { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Issuing::Authorization::VerificationData', @_ ) ); }
15727             PERL
15728             # NOTE: verification_fields()
15729             verification_fields => <<'PERL',
15730             sub verification_fields { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Connect::CountrySpec::VerificationFields', @_ ) ); }
15731             PERL
15732             # NOTE: webhook()
15733             webhook => <<'PERL',
15734             sub webhook { CORE::return( shift->_response_to_object( 'Net::API::Stripe::WebHook::Object' ) ) }
15735             PERL
15736             # NOTE: webhook_endpoint()
15737             webhook_endpoint => <<'PERL',
15738             sub webhook_endpoint { CORE::return( shift->_response_to_object( 'Net::API::Stripe::WebHook::Object', @_ ) ); }
15739             PERL
15740             # NOTE: webhook_endpoint_create()
15741             webhook_endpoint_create => <<'PERL',
15742             sub webhook_endpoint_create
15743             {
15744             my $self = shift( @_ );
15745             my $args = shift( @_ );
15746             my $okParams =
15747             {
15748             expandable => { allowed => $EXPANDABLES->{ 'webhook_endpoint' } },
15749             api_version => { type => "string" },
15750             connect => { type => "boolean" },
15751             description => { type => "string" },
15752             enabled_events => { type => "array", required => 1 },
15753             metadata => { type => "hash" },
15754             url => { type => "string", required => 1 },
15755             };
15756             $args = $self->_contract( 'webhook_endpoint', $args ) || CORE::return( $self->pass_error );
15757             my $err = $self->_check_parameters( $okParams, $args );
15758             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
15759             my $hash = $self->post( "webhook_endpoints", $args ) || CORE::return( $self->pass_error );
15760             CORE::return( $self->_response_to_object( 'Net::API::Stripe::WebHook::Object', $hash ) );
15761             }
15762             PERL
15763             # NOTE: webhook_endpoint_delete()
15764             webhook_endpoint_delete => <<'PERL',
15765             sub webhook_endpoint_delete
15766             {
15767             my $self = shift( @_ );
15768             my $args = shift( @_ );
15769             my $okParams =
15770             {
15771             expandable => { allowed => $EXPANDABLES->{ 'webhook_endpoint' } },
15772             };
15773             $args = $self->_contract( 'webhook_endpoint', $args ) || CORE::return( $self->pass_error );
15774             my $err = $self->_check_parameters( $okParams, $args );
15775             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
15776             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No webhook_endpoint id (with parameter 'id') was provided to delete its information." ) );
15777             my $hash = $self->delete( "webhook_endpoints/${id}", $args ) || CORE::return( $self->pass_error );
15778             CORE::return( $self->_response_to_object( 'Net::API::Stripe::WebHook::Object', $hash ) );
15779             }
15780             PERL
15781             # NOTE: webhook_endpoint_list()
15782             webhook_endpoint_list => <<'PERL',
15783             sub webhook_endpoint_list
15784             {
15785             my $self = shift( @_ );
15786             CORE::return( $self->error( "No parameters were provided to list webhook endpoint information." ) ) if( !scalar( @_ ) );
15787             my $args = $self->_get_args_from_object( 'Net::API::Stripe::WebHook::Object', @_ );
15788             my $okParams =
15789             {
15790             expandable => { allowed => $EXPANDABLES->{ 'webhook_endpoint' }, data_prefix_is_ok => 1 },
15791             ending_before => { type => "string" },
15792             limit => { type => "string" },
15793             starting_after => { type => "string" },
15794             };
15795             my $err = $self->_check_parameters( $okParams, $args );
15796             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
15797             if( $args->{expand} )
15798             {
15799             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
15800             }
15801             my $hash = $self->get( "webhook_endpoints", $args ) || CORE::return( $self->pass_error );
15802             CORE::return( $self->_response_to_object( 'Net::API::Stripe::WebHook::Object', $hash ) );
15803             }
15804             PERL
15805             # NOTE: webhook_endpoint_retrieve()
15806             webhook_endpoint_retrieve => <<'PERL',
15807             sub webhook_endpoint_retrieve
15808             {
15809             my $self = shift( @_ );
15810             my $args = shift( @_ );
15811             my $okParams =
15812             {
15813             expandable => { allowed => $EXPANDABLES->{ 'webhook_endpoint' }, data_prefix_is_ok => 1 },
15814             };
15815             $args = $self->_contract( 'webhook_endpoint', $args ) || CORE::return( $self->pass_error );
15816             my $err = $self->_check_parameters( $okParams, $args );
15817             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
15818             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No webhook_endpoint id (with parameter 'id') was provided to retrieve its information." ) );
15819             my $hash = $self->get( "webhook_endpoints/${id}", $args ) || CORE::return( $self->pass_error );
15820             CORE::return( $self->_response_to_object( 'Net::API::Stripe::WebHook::Object', $hash ) );
15821             }
15822             PERL
15823             # NOTE: webhook_endpoint_update()
15824             webhook_endpoint_update => <<'PERL',
15825             sub webhook_endpoint_update
15826             {
15827             my $self = shift( @_ );
15828             my $args = shift( @_ );
15829             my $okParams =
15830             {
15831             expandable => { allowed => $EXPANDABLES->{ 'webhook_endpoint' } },
15832             description => { type => "string" },
15833             disabled => { type => "boolean" },
15834             enabled_events => { type => "array" },
15835             metadata => { type => "hash" },
15836             url => { type => "string" },
15837             };
15838             $args = $self->_contract( 'webhook_endpoint', $args ) || CORE::return( $self->pass_error );
15839             my $err = $self->_check_parameters( $okParams, $args );
15840             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
15841             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No webhook_endpoint id (with parameter 'id') was provided to update its information." ) );
15842             my $hash = $self->post( "webhook_endpoints/${id}", $args ) || CORE::return( $self->pass_error );
15843             CORE::return( $self->_response_to_object( 'Net::API::Stripe::WebHook::Object', $hash ) );
15844             }
15845             PERL
15846             # NOTE: webhook_endpoints()
15847             webhook_endpoints => <<'PERL',
15848             # <https://stripe.com/docs/api/webhook_endpoints>
15849             sub webhook_endpoints
15850             {
15851             my $self = shift( @_ );
15852             my $allowed = [qw( create delete list retrieve update )];
15853             my $action = shift( @_ );
15854             my $meth = $self->_get_method( 'webhook_endpoint', $action, $allowed ) || CORE::return( $self->pass_error );
15855             CORE::return( $self->$meth( @_ ) );
15856             }
15857             PERL
15858             };
15859             }
15860             # NOTE: End of auto-generated methods
15861              
15862              
15863             sub _adjust_list_expandables
15864             {
15865 0     0     my $self = shift( @_ );
15866 0           my $args = shift( @_ );
15867 0 0         CORE::return( $self->error( "User parameters list provided is '$args' and I was expecting a hash reference." ) ) if( ref( $args ) ne 'HASH' );
15868 0 0         if( ref( $args->{expand} ) eq 'ARRAY' )
15869             {
15870 0           my $new = [];
15871 0           for( my $i = 0; $i < scalar( @{$args->{expand}} ); $i++ )
  0            
15872             {
15873 0 0         substr( $args->{expand}->[$i], 0, 0 ) = 'data.' if( substr( $args->{expand}->[$i], 0, 5 ) ne 'data.' );
15874 0           my $path = [split( /\./, $args->{expand}->[$i] )];
15875             # Make sure that with the new 'data' prefix, this does not exceed 4 level of depth
15876 0 0         push( @$new, $args->{expand}->[$i] ) if( scalar( @$path ) <= $EXPAND_MAX_DEPTH );
15877             }
15878 0           $args->{expand} = $new;
15879             }
15880 0           CORE::return( $self );
15881             }
15882              
15883             sub _as_hash
15884             {
15885 0     0     my $self = shift( @_ );
15886 0           my $this = shift( @_ );
15887 0           my $opts = {};
15888 0 0 0       $opts = shift( @_ ) if( @_ && ref( $_[0] ) eq 'HASH' );
15889 0 0         $opts->{seen} = {} if( !$opts->{seen} );
15890 0           my $ref = {};
15891 0 0         if( $self->_is_object( $this ) )
    0          
15892             {
15893 0 0         $ref = $this->as_hash if( $this->can( 'as_hash' ) );
15894             }
15895             # Recursively transform into hash
15896             elsif( ref( $this ) eq 'HASH' )
15897             {
15898             # Prevent recursion
15899 0           my $ref_addr = Scalar::Util::refaddr( $this );
15900 0 0         CORE::return( $opts->{seen}->{ $ref_addr } ) if( $opts->{seen}->{ $ref_addr } );
15901 0           $opts->{seen}->{ $ref_addr } = $this;
15902             # $ref = $hash;
15903 0           foreach my $k ( keys( %$this ) )
15904             {
15905 0 0 0       if( ref( $this->{ $k } ) eq 'HASH' || $self->_is_object( $this->{ $k } ) )
    0          
    0          
15906             {
15907 0           my $rv = $self->_as_hash( $this->{ $k }, $opts );
15908 0 0         $ref->{ $k } = $rv if( scalar( keys( %$rv ) ) );
15909             }
15910             elsif( ref( $this->{ $k } ) eq 'ARRAY' )
15911             {
15912 0           my $new = [];
15913 0           foreach my $that ( @{$this->{ $k }} )
  0            
15914             {
15915 0 0 0       if( ref( $that ) eq 'HASH' || $self->_is_object( $that ) )
15916             {
15917 0           my $rv = $self->_as_hash( $that, $opts );
15918 0 0         push( @$new, $rv ) if( scalar( keys( %$rv ) ) );
15919             }
15920             }
15921 0 0         $ref->{ $k } = $new if( scalar( @$new ) );
15922             }
15923             # For stringification
15924             elsif( CORE::length( "$this->{$k}" ) )
15925             {
15926 0           $ref->{ $k } = $this->{ $k };
15927             }
15928             }
15929             }
15930             else
15931             {
15932 0           CORE::return( $self->error( "Unknown data type $this to be converted into hash for api call." ) );
15933             }
15934 0           CORE::return( $ref );
15935             }
15936              
15937             sub _check_parameters
15938             {
15939 0     0     my $self = shift( @_ );
15940 0           my $okParams = shift( @_ );
15941 0           my $args = shift( @_ );
15942             # $self->dumpto_dumper( $args, '/home/ai/legal/var/check_parameters.pl' );
15943 0           my $err = [];
15944            
15945 0           my $seen = {};
15946 0           my $check_fields_recursive;
15947             $check_fields_recursive = sub
15948             {
15949 0     0     my( $hash, $mirror, $field, $required ) = @_;
15950 0           my $errors = [];
15951             # push( @$err, "Unknown property $v for key $k." ) if( !scalar( grep( /^$v$/, @$this ) ) );
15952 0           foreach my $k ( sort( keys( %$hash ) ) )
15953             {
15954 0 0         if( !CORE::exists( $mirror->{ $k } ) )
15955             {
15956 0           push( @$errors, "Unknown property \"$k\" for key \"$field\"." );
15957 0           next;
15958             }
15959 0           my $addr;
15960 0 0         $addr = Scalar::Util::refaddr( $hash->{ $k } ) if( ref( $hash->{ $k } ) eq 'HASH' );
15961             # Found a hash, check recursively and avoid looping endlessly
15962 0 0 0       if( ref( $hash->{ $k } ) eq 'HASH' &&
      0        
15963             ref( $mirror->{ $k } ) eq 'HASH' &&
15964             # ++$hash->{ $k }->{__check_fields_recursive_looping} == 1 )
15965             ++$seen->{ $addr } == 1 )
15966             {
15967 0 0         my $deep_errors = $check_fields_recursive->( $hash->{ $k }, $mirror->{ $k }, $k, CORE::exists( $required->{ $k } ) ? $required->{ $k } : {} );
15968 0           CORE::push( @$errors, @$deep_errors );
15969             }
15970             }
15971            
15972             # Check required fields
15973             # if in the mirror structure, the field value is 1, the field is required, otherwise with 0 the field is not required
15974 0           foreach my $k ( sort( keys( %$mirror ) ) )
15975             {
15976 0 0         next if( $k eq '_required' );
15977             # If this property contains sub properties, we look at the sub hash entry _required to check if this property is required or not
15978 0 0         if( ref( $mirror->{ $k } ) eq 'HASH' )
15979             {
15980 0 0 0       if( !CORE::exists( $hash->{ $k } ) && $mirror->{ $k }->{_required} )
15981             {
15982 0           CORE::push( @$errors, "Hash property \"$k\" is required but missing in hash provided for parent field \"$field\"." );
15983             }
15984             }
15985             else
15986             {
15987 0 0 0       if( ( !CORE::exists( $hash->{ $k } ) || !CORE::length( $hash->{ $k } ) ) &&
      0        
15988             $mirror->{ $k } )
15989             {
15990 0           CORE::push( @$errors, "Field \"$k\" is required but missing in hash provided for parent field \"$field\"." );
15991             }
15992             }
15993             }
15994 0           CORE::return( $errors );
15995 0           };
15996            
15997 0           foreach my $k ( keys( %$args ) )
15998             {
15999             # Special case for expand and for private parameters starting with '_'
16000 0 0 0       next if( $k eq 'expand' || $k eq 'expandable' || substr( $k, 0, 1 ) eq '_' );
      0        
16001             # if( !CORE::exists( $okParams->{ $k } ) )
16002             # {
16003             # # This is handy when an object was passed to one of the api method and
16004             # # the object contains a bunch of data not all relevant to the api call
16005             # # It makes it easy to pass the object and let this interface take only what is relevant
16006             # if( $okParams->{_cleanup} || $args->{_cleanup} || $self->ignore_unknown_parameters )
16007             # {
16008             # CORE::delete( $args->{ $k } );
16009             # }
16010             # else
16011             # {
16012             # push( @$err, "Unknown parameter \"$k\"." );
16013             # }
16014             # next;
16015             # }
16016             # $dict is either a hash dictionary or a sub
16017 0           my $dict = $okParams->{ $k };
16018 0 0         if( ref( $dict ) eq 'HASH' )
    0          
16019             {
16020 0           my $pkg;
16021             # We stringify object that can be stringified
16022 0 0 0       if( defined( $args->{ $k } ) &&
      0        
16023             ref( $args->{ $k } ) &&
16024             overload::Method( $args->{ $k } => '""' ) )
16025             {
16026 0           $args->{ $k } = $args->{ $k } . '';
16027             }
16028            
16029 0 0 0       if( defined( $dict->{required} ) &&
    0 0        
    0 0        
    0 0        
    0 0        
    0 0        
    0 0        
    0 0        
    0 0        
      0        
      0        
      0        
      0        
      0        
      0        
      0        
      0        
      0        
16030             $dict->{required} &&
16031             !CORE::exists( $args->{ $k } ) )
16032             {
16033 0           push( @$err, "Parameter \"$k\" is required, but missing" );
16034             }
16035             elsif( !defined( $args->{ $k } ) ||
16036             !length( $args->{ $k } ) )
16037             {
16038 0           push( @$err, "Empty value provided for parameter \"$k\"." );
16039             }
16040             # _is_object is inherited from Module::Object
16041             elsif( ( $pkg = $self->_is_object( $args->{ $k } ) ) && $dict->{package} && $dict->{package} ne $pkg )
16042             {
16043 0           push( @$err, "Parameter \"$k\" value is a package \"$pkg\", but I was expecting \"$dict->{package}\"" );
16044             }
16045             elsif( $dict->{re} && ref( $dict->{re} ) eq 'Regexp' && $args->{ $k } !~ /$dict->{re}/ )
16046             {
16047 0           push( @$err, "Parameter \"$k\" with value \"$args->{$k}\" does not have a legitimate value." );
16048             }
16049             elsif( defined( $dict->{type} ) &&
16050             $dict->{type} eq 'boolean' &&
16051             defined( $args->{ $k } ) &&
16052             CORE::length( $args->{ $k } ) )
16053             {
16054 0 0 0       $args->{ $k } = ( $args->{ $k } eq 'true' || ( $args->{ $k } ne 'false' && $args->{ $k } ) ) ? 'true' : 'false';
16055             }
16056             elsif( defined( $dict->{type} ) &&
16057             $dict->{type} &&
16058             (
16059             ( $dict->{type} eq 'scalar' && ref( $args->{ $k } ) ) ||
16060             ( $dict->{type} ne 'scalar' && ref( $args->{ $k } ) && lc( ref( $args->{ $k } ) ) ne $dict->{type} )
16061             )
16062             )
16063             {
16064 0           push( @$err, "I was expecting a data of type $dict->{type}, but got " . lc( ref( $args->{ $k } ) ) );
16065             }
16066             elsif( defined( $dict->{type} ) &&
16067             $dict->{type} eq 'integer' )
16068             {
16069 0 0         push( @$err, "Parameter \"$k\" value \" $args->{$k}\" is not an integer." ) if( $args->{ $k } !~ /^[-+]?\d+$/ );
16070             }
16071             elsif( defined( $dict->{type} ) &&
16072             (
16073             $dict->{type} eq 'number' ||
16074             $dict->{type} eq 'decimal' ||
16075             $dict->{type} eq 'float' ||
16076             $dict->{type} eq 'double'
16077             ) )
16078             {
16079 0 0         push( @$err, "Parameter \"$k\" value \" $args->{$k}\" is not a $dict->{type}." ) if( $args->{ $k } !~ /^$RE{num}{real}$/ );
16080             }
16081             elsif( defined( $dict->{type} ) &&
16082             (
16083             $dict->{type} eq 'date' ||
16084             $dict->{type} eq 'datetime' ||
16085             $dict->{type} eq 'timestamp'
16086             ) )
16087             {
16088 0 0 0       unless( $self->_is_object( $args->{ $k } ) && $args->{ $k }->isa( 'DateTime' ) )
16089             {
16090 0 0         my $tz = $dict->{time_zone} ? $dict->{time_zone} : 'GMT';
16091 0           my $dt;
16092 0 0 0       if( $dict->{type} eq 'date' &&
    0 0        
    0          
16093             $args->{ $k } =~ /^(?<year>\d{4})[\.|\-](?<month>\d{1,2})[\.|\-](?<day>\d{1,2})$/ )
16094             {
16095 0 0 0       try
  0            
  0            
  0            
  0            
  0            
  0            
  0            
16096 0     0     {
16097             $dt = DateTime(
16098             year => int( $+{year} ),
16099             month => int( $+{month} ),
16100 0           day => int( $+{day} ),
16101             hour => 0,
16102             minute => 0,
16103             second => 0,
16104             time_zone => $tz
16105             );
16106 0           $args->{ $k } = $dt;
16107             }
16108 0 0 0       catch( $e )
  0 0 0        
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
16109 0     0     {
16110 0           push( @$err, "Invalid date (" . $args->{ $k } . ") provided for parameter \"$k\": $e" );
16111 1 0 0 1   8 }
  1 0 0     3  
  1 0 0     1019  
  0 0 0        
  0 0 0        
  0 0 0        
  0 0 0        
  0 0 0        
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
16112             }
16113             elsif( $dict->{type} eq 'datetime' &&
16114             $args->{ $k } =~ /^(?<year>\d{4})[\.|\-](?<month>\d{1,2})[\.|\-](?<day>\d{1,2})[T|[:blank:]]+(?<hour>\d{1,2}):(?<minute>\d{1,2}):(?<second>\d{1,2})$/ )
16115             {
16116 0 0 0       try
  0            
  0            
  0            
  0            
  0            
  0            
  0            
16117 0     0     {
16118             $dt = DateTime(
16119             year => int( $+{year} ),
16120             month => int( $+{month} ),
16121             day => int( $+{day} ),
16122             hour => int( $+{hour} ),
16123             minute => int( $+{minute} ),
16124 0           second => int( $+{second} ),
16125             time_zone => $tz
16126             );
16127 0           $args->{ $k } = $dt;
16128             }
16129 0 0 0       catch( $e )
  0 0 0        
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
16130 0     0     {
16131 0           push( @$err, "Invalid datetime (" . $args->{ $k } . ") provided for parameter \"$k\": $e" );
16132 1 0 0 1   9 }
  1 0 0     2  
  1 0 0     994  
  0 0 0        
  0 0 0        
  0 0 0        
  0 0 0        
  0 0 0        
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
16133             }
16134             elsif( $args->{ $k } =~ /^\d+$/ )
16135             {
16136 0 0 0       try
  0            
  0            
  0            
  0            
  0            
  0            
  0            
16137 0     0     {
16138             $dt = DateTime->from_epoch(
16139 0           epoch => $args->{ $k },
16140             time_zone => $tz,
16141             );
16142             }
16143 0 0 0       catch( $e )
  0 0 0        
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
16144 0     0     {
16145 0           push( @$err, "Invalid timestamp (" . $args->{ $k } . ") provided for parameter \"$k\": $e" );
16146 1 0 0 1   9 }
  1 0 0     1  
  1 0 0     4272  
  0 0 0        
  0 0 0        
  0 0 0        
  0 0 0        
  0 0 0        
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
16147             }
16148 0 0         if( $dt )
16149             {
16150 0 0         my $pattern = $dict->{pattern} ? $dict->{pattern} : '%s';
16151 0           my $strp = DateTime::Format::Strptime->new(
16152             pattern => $pattern,
16153             locale => 'en_GB',
16154             time_zone => $tz,
16155             );
16156 0           $dt->set_formatter( $strp );
16157 0           $args->{ $k } = $dt;
16158             }
16159             }
16160             }
16161             }
16162             elsif( ref( $dict ) eq 'CODE' )
16163             {
16164 0           my $res = $dict->( $args->{ $k } );
16165 0 0         push( @$err, "Invalid parameter \"$k\" with value \"$args->{$k}\": $res" ) if( $res );
16166             }
16167             }
16168            
16169 0 0         $args->{expand} = $self->expand if( !CORE::length( $args->{expand} ) );
16170 0 0         if( exists( $args->{expand} ) )
16171             {
16172 0           my $depth;
16173 0           my $no_need_to_check = 0;
16174 0 0 0       if( $args->{expand} eq 'all' || $args->{expand} =~ /^\d+$/ )
16175             {
16176 0           $no_need_to_check++;
16177 0 0         if( $args->{expand} =~ /^\d+$/ )
16178             {
16179 0           $depth = int( $args->{expand} );
16180             }
16181             else
16182             {
16183 0           $depth = $EXPAND_MAX_DEPTH;
16184             }
16185 0 0 0       if( exists( $okParams->{expandable} ) && exists( $okParams->{expandable}->{allowed} ) && ref( $okParams->{expandable}->{allowed} ) eq 'ARRAY' )
      0        
16186             {
16187             # We duplicate the array, so the original array does not get modified
16188             # This is important, because methods that list objects such as customer_list use the 'data' property
16189 0           $args->{expand} = [ @{$okParams->{expandable}->{allowed}} ];
  0            
16190             }
16191             # There is no allowed expandable properties, but it was called anyway, so we do this to avoid an error below
16192             else
16193             {
16194 0           $args->{expand} = [];
16195             }
16196             }
16197 0 0         push( @$err, sprintf( "expand property should be an array, but instead '%s' was provided", $args->{expand} ) ) if( ref( $args->{expand} ) ne 'ARRAY' );
16198 0 0 0       if( scalar( @{$args->{expand}} ) && exists( $okParams->{expandable} ) )
  0 0          
16199             {
16200 0 0         CORE::return( $self->error( "expandable parameter is not a hash (", ref( $okParams->{expandable} ), ")." ) ) if( ref( $okParams->{expandable} ) ne 'HASH' );
16201 0 0         CORE::return( $self->error( "No \"allowed\" attribute in the expandable parameter hash." ) ) if( !CORE::exists( $okParams->{expandable}->{allowed} ) );
16202 0           my $expandable = $okParams->{expandable}->{allowed};
16203 0           my $errExpandables = [];
16204 0 0         if( !$no_need_to_check )
    0          
16205             {
16206 0 0         if( scalar( @$expandable ) )
16207             {
16208 0 0         CORE::return( $self->error( "List of expandable attributes needs to be an array reference, but found instead a ", ref( $expandable ) ) ) if( ref( $expandable ) ne 'ARRAY' );
16209             # Return a list with the dot prefixed with backslash
16210 0           my $list = join( '|', map( quotemeta( $_ ), @$expandable ) );
16211 0 0         my $re = $okParams->{expandable}->{data_prefix_is_ok} ? qr/^(?:data\.)?($list)$/ : qr/^($list)$/;
16212 0           foreach my $k ( @{$args->{expand}} )
  0            
16213             {
16214 0 0         if( $k !~ /$re/ )
16215             {
16216 0           push( @$errExpandables, $k );
16217             }
16218             }
16219             }
16220             else
16221             {
16222 0           push( @$errExpandables, @{$args->{expand}} );
  0            
16223             }
16224             }
16225             elsif( $depth )
16226             {
16227 0 0         my $max_depth = CORE::length( $depth ) ? $depth : $EXPAND_MAX_DEPTH;
16228 0           for( my $i = 0; $i < scalar( @{$args->{expand}} ); $i++ )
  0            
16229             {
16230             # Count the number of dots. Make sure this does not exceed the $EXPAND_MAX_DEPTH which is 4 as of today (2020-02-23)
16231             # my $this_depth = scalar( () = $args->{expand}->[$i] =~ /\./g );
16232 0           my $path_parts = [split( /\./, $args->{expand}->[$i] )];
16233 0 0         if( scalar( @$path_parts ) > $max_depth )
16234             {
16235 0           my $old = [CORE::splice( @$path_parts, $max_depth - 1 )];
16236 0           $args->{expand}->[$i] = $path_parts;
16237             }
16238             }
16239             }
16240 0 0         push( @$err, sprintf( "The following properties are not allowed to expand: %s", join( ', ', @$errExpandables ) ) ) if( scalar( @$errExpandables ) );
16241             }
16242             elsif( !exists( $okParams->{expandable} ) )
16243             {
16244 0 0         push( @$err, sprintf( "Following elements were provided to be expanded, but no expansion is supported: '%s'.", CORE::join( "', '", @{$args->{expand}} ) ) ) if( scalar( @{$args->{expand}} ) );
  0            
  0            
16245             }
16246             }
16247             else
16248             {
16249             }
16250 0           my @private_params = grep( /^_/, keys( %$args ) );
16251 0           CORE::delete( @$args{ @private_params } );
16252 0           CORE::return( $err );
16253             }
16254              
16255             sub _check_required
16256             {
16257 0     0     my $self = shift( @_ );
16258 0           my $required = shift( @_ );
16259 0 0         CORE::return( $self->error( "I was expecting an array reference of required field." ) ) if( ref( $required ) ne 'ARRAY' );
16260 0           my $args = shift( @_ );
16261 0 0         CORE::return( $self->error( "I was expecting an hash reference of parameters." ) ) if( ref( $args ) ne 'HASH' );
16262 0           my $err = [];
16263 0           foreach my $f ( @$required )
16264             {
16265 0 0 0       push( @$err, "Parameter $f is missing, and is required." ) if( !CORE::exists( $args->{ $f } ) || !CORE::length( $args->{ $f } ) );
16266             }
16267 0           CORE::return( $args );
16268             }
16269              
16270             # As in opposite of expand
16271             # This is used for switching object to their id for Stripe api methods that post data.
16272             # Objects are expanded when retrieving data, but when posting data, objects should be represented to Stripe by their id
16273             sub _contract
16274             {
16275 0     0     my $self = shift( @_ );
16276 0   0       my $class = shift( @_ ) || CORE::return( $self->error( "No object class was provided to contract objects within." ) );
16277 0   0       my $args = shift( @_ ) || CORE::return( $self->error( "No data to process for class \"$class\" was provided." ) );
16278 0 0 0       CORE::return( $self->error( "Data provided to contract for class \"$class\" is not an hash reference nor an object. I received '$args'." ) ) if( ref( $args ) ne 'HASH' && ref( $args ) ne 'Module::Generic::Hash' && !$self->_is_object( $args ) );
      0        
16279 0 0         CORE::return( $self->error( "No class \"$class\" found to contract the possible objects contained." ) ) if( !exists( $EXPANDABLES_BY_CLASS->{ $class } ) );
16280 0           my $ref = $EXPANDABLES_BY_CLASS->{ $class };
16281 0 0         CORE::return( $self->error( "Definition hash found for class \"$class\" is not an hash! This should not happen." ) ) if( ref( $ref ) ne 'HASH' );
16282 0           PROPERTY: foreach my $p ( sort( keys( %$ref ) ) )
16283             {
16284 0 0         if( CORE::index( $p, '.' ) != -1 )
16285             {
16286 0           my @parts = split( /\./, $p );
16287             # Can be an object or just a hash
16288 0           my $obj = $args;
16289 0           PART: for( my $i = 0; $i < scalar( @parts ); $i++ )
16290             {
16291 0           my $prop = $parts[ $i ];
16292 0           my $this;
16293             my $type;
16294 0 0 0       if( $self->_is_object( $obj ) )
    0          
16295             {
16296 0           $type = 'object';
16297 0 0         if( !( defined( my $code = $obj->can( $prop ) ) ) )
16298             {
16299 0           CORE::return( $self->error( "Property \"$prop\" is part of the path to object to contract, but there is no such method in package \"", ref( $obj ), "\" as provided in property path \"$p\"." ) );
16300             }
16301 0           $this = $obj->$prop();
16302             }
16303             elsif( ref( $obj ) eq 'HASH' || ref( $obj ) eq 'Module::Generic::Hash' )
16304             {
16305 0           $type = 'hash';
16306 0           $this = $obj->{ $prop };
16307             }
16308 0 0         next PROPERTY if( !length( $this ) );
16309            
16310             # If this is an object, we convert it to its id string representation for Stripe, or
16311             # we continue to drill down if the path continues
16312 0 0 0       if( $self->_is_object( $this ) )
    0          
16313             {
16314             # If this is the last element of this property path
16315 0 0         if( $i == $#parts )
16316             {
16317 0 0         if( $type eq 'object' )
    0          
16318             {
16319 0           $obj->$prop( $this->id );
16320             }
16321             elsif( $type eq 'hash' )
16322             {
16323 0           $obj->{ $prop } = $this->id;
16324             }
16325             }
16326             # Continue to drill down the property path
16327 0           $obj = $this;
16328             }
16329             elsif( ref( $this ) eq 'HASH' || ref( $this ) eq 'Module::Generic::Hash' )
16330             {
16331 0 0         if( $i == $#parts )
16332             {
16333 0 0         if( $type eq 'object' )
    0          
16334             {
16335 0           $obj->$prop( $this->{id} );
16336             }
16337             elsif( $type eq 'hash' )
16338             {
16339 0           $obj->{ $prop } = $this->{id};
16340             }
16341             }
16342 0           $obj = $this;
16343             }
16344             }
16345             }
16346             else
16347             {
16348 0 0 0       if( $self->_is_object( $args ) )
    0          
16349             {
16350 0           my $this = $args->$p();
16351 0 0         next if( !length( $this ) );
16352 0 0 0       if( $self->_is_object( $this ) )
    0          
16353             {
16354 0           $args->$p( $this->id );
16355             }
16356             elsif( ref( $this ) eq 'HASH' || ref( $this ) eq 'Module::Generic::Hash' )
16357             {
16358 0           $args->$p( $this->{id} );
16359             }
16360             }
16361             elsif( ref( $args ) eq 'HASH' || ref( $args ) eq 'Module::Generic::Hash' )
16362             {
16363 0           my $this = $args->{ $p };
16364 0 0         next if( !length( $this ) );
16365 0 0 0       if( $self->_is_object( $this ) )
    0          
16366             {
16367 0           $args->{ $p } = $this->id;
16368             }
16369             elsif( ref( $this ) eq 'HASH' || ref( $this ) eq 'Module::Generic::Hash' )
16370             {
16371 0           $args->{ $p } = $this->{id};
16372             }
16373             }
16374             }
16375             }
16376 0           CORE::return( $args );
16377             }
16378              
16379             sub _convert_boolean_for_json
16380             {
16381 0     0     my $self = shift( @_ );
16382 0   0       my $hash = shift( @_ ) || CORE::return( $self->pass_error );
16383 0           my $seen = {};
16384 0           my $crawl;
16385             $crawl = sub
16386             {
16387 0     0     my $this = shift( @_ );
16388 0           foreach my $k ( keys( %$this ) )
16389             {
16390 0 0 0       if( ref( $this->{ $k } ) eq 'HASH' )
    0          
16391             {
16392 0           my $addr = Scalar::Util::refaddr( $this->{ $k } );
16393 0 0         next if( ++$seen->{ $addr } > 1 );
16394 0           $crawl->( $this->{ $k } );
16395             }
16396             elsif( $self->_is_object( $this->{ $k } ) && $this->{ $k }->isa( 'Module::Generic::Boolean' ) )
16397             {
16398 0 0         $this->{ $k } = $this->{ $k } ? 'true' : 'false';
16399             }
16400             }
16401 0           };
16402 0           $crawl->( $hash );
16403             }
16404              
16405             sub _encode_params
16406             {
16407 0     0     my $self = shift( @_ );
16408 0           my $args = shift( @_ );
16409 0 0         if( $self->{ '_encode_with_json' } )
16410             {
16411 0           CORE::return( $self->json->utf8->allow_blessed->encode( $args ) );
16412             }
16413 0           my $encode;
16414             $encode = sub
16415             {
16416 0     0     my( $pref, $data ) = @_;
16417 0           my $ref = ref( $data );
16418 0           my $type = lc( ref( $data ) );
16419 0           my $comp = [];
16420 0 0 0       if( $type eq 'hash' || $ref eq 'Module::Generic::Hash' )
    0 0        
    0 0        
    0 0        
    0 0        
    0 0        
    0          
16421             {
16422 0           foreach my $k ( sort( keys( %$data ) ) )
16423             {
16424 0           my $ke = URI::Escape::uri_escape( $k );
16425 0           my $pkg = Scalar::Util::blessed( $data->{ $k } );
16426 0 0 0       if( $pkg && $pkg =~ /^Net::API::Stripe/ &&
      0        
      0        
16427             $data->{ $k }->can( 'id' ) &&
16428             $data->{ $k }->id )
16429             {
16430 0           push( @$comp, "${pref}${ke}" . '=' . $data->{ $k }->id );
16431 0           next;
16432             }
16433 0 0         my $res = $encode->( ( $pref ? sprintf( '%s[%s]', $pref, $ke ) : $ke ), $data->{ $k } );
16434 0           push( @$comp, @$res );
16435             }
16436             }
16437             elsif( $type eq 'array' || $ref eq 'Module::Generic::Array' )
16438             {
16439             # According to Stripe's response to my mail inquiry of 2019-11-04 on how to structure array of hash in url encoded form data
16440 0           for( my $i = 0; $i < scalar( @$data ); $i++ )
16441             {
16442 0 0         my $res = $encode->( ( $pref ? sprintf( '%s[%d]', $pref, $i ) : sprintf( '[%d]', $i ) ), $data->[$i] );
16443 0           push( @$comp, @$res );
16444             }
16445             }
16446             elsif( ref( $data ) eq 'JSON::PP::Boolean' || ref( $data ) eq 'Module::Generic::Boolean' )
16447             {
16448 0 0         push( @$comp, sprintf( '%s=%s', $pref, $data ? 'true' : 'false' ) );
16449             }
16450             elsif( ref( $data ) eq 'SCALAR' && ( $$data == 1 || $$data == 0 ) )
16451             {
16452 0 0         push( @$comp, sprintf( '%s=%s', $pref, $$data ? 'true' : 'false' ) );
16453             }
16454             # Other type of scalar like Module::Generic
16455             elsif( $ref && Scalar::Util::reftype( $data ) eq 'SCALAR' )
16456             {
16457 0           push( @$comp, sprintf( '%s=%s', $pref, $$data ) );
16458             }
16459             elsif( $type eq 'datetime' )
16460             {
16461 0           push( @$comp, sprintf( '%s=%s', $pref, $data->epoch ) );
16462             }
16463             elsif( $type )
16464             {
16465 0           die( "Don't know what to do with data type $type\n" );
16466             }
16467             else
16468             {
16469 0           push( @$comp, sprintf( '%s=%s', $pref, URI::Escape::uri_escape_utf8( "$data" ) ) );
16470             }
16471 0           CORE::return( $comp );
16472 0           };
16473 0           my $res = $encode->( '', $args );
16474 0           CORE::return( join( '&', @$res ) );
16475             }
16476              
16477             sub _encode_params_multipart
16478             {
16479 0     0     my $self = shift( @_ );
16480 0           my $args = shift( @_ );
16481 0           my $opts = {};
16482 0 0 0       $opts = pop( @_ ) if( scalar( @_ ) && ref( $_[-1] ) eq 'HASH' );
16483             my $set_value = sub
16484             {
16485 0     0     my( $key, $val, $ref, $param ) = @_;
16486 0 0         $param = {} if( !CORE::length( $param ) );
16487 0 0         $param->{encoding} = $opts->{encoding} if( !CORE::length( $param->{encoding} ) );
16488 0 0         if( !CORE::exists( $ref->{ $key } ) )
16489             {
16490 0           $ref->{ $key } = [];
16491             }
16492 0           my $this = {};
16493 0 0         $this->{filename} = $param->{filename} if( CORE::length( $param->{filename} ) );
16494 0 0         $this->{type} = $param->{type} if( CORE::length( $param->{type} ) );
16495 0 0         $val = Encode::encode_utf8( $val ) if( substr( $this->{type}, 0, 4 ) eq 'text' );
16496 0 0         if( $param->{encoding} )
16497             {
16498 0 0 0       if( $param->{encoding} eq 'qp' || $param->{encoding} eq 'quoted-printable' )
    0          
16499             {
16500 0           $this->{value} = MIME::QuotedPrint::encode_qp( $val );
16501 0           $this->{encoding} = 'Quoted-Printable';
16502             }
16503             elsif( $param->{encoding} eq 'base64' )
16504             {
16505 0           $this->{value} = MIME::Base64::encode_base64( $val );
16506 0           $this->{encoding} = 'Base64';
16507             }
16508             else
16509             {
16510 0           die( "Unknown encoding method \"", $param->{encoding}, "\"\n" );
16511             }
16512             }
16513             else
16514             {
16515 0           $this->{value} = $val;
16516             }
16517 0           CORE::push( @{$ref->{ $key }}, $this );
  0            
16518 0           };
16519            
16520 0           my $encode;
16521             $encode = sub
16522             {
16523 0     0     my( $pref, $data, $hash ) = @_;
16524 0           my $type = lc( ref( $data ) );
16525 0 0 0       if( $type eq 'hash' )
    0 0        
    0 0        
    0          
    0          
16526             {
16527 0           foreach my $k ( sort( keys( %$data ) ) )
16528             {
16529             # my $ke = URI::Escape::uri_escape( $k );
16530 0           my $ke = $k;
16531 0           $ke =~ s/([\\\"])/\\$1/g;
16532 0           my $pkg = Scalar::Util::blessed( $data->{ $k } );
16533 0 0 0       if( $pkg && $pkg =~ /^Net::API::Stripe/ &&
    0 0        
      0        
      0        
16534             $data->{ $k }->can( 'id' ) &&
16535             $data->{ $k }->id )
16536             {
16537 0           $set_value->( "${pref}${ke}", $data->{ $k }->id, $hash, { type => 'text/plain' } );
16538 0           next;
16539             }
16540             # This is a file
16541             elsif( ref( $data->{ $k } ) eq 'HASH' &&
16542             CORE::exists( $data->{ $k }->{_filepath} ) )
16543             {
16544 0 0         CORE::return( $self->error( "File path argument is actually empty" ) ) if( !CORE::length( $data->{ $k }->{_filepath} ) );
16545 0           my $this_file = Module::Generic::File::file( $data->{ $k }->{_filepath} );
16546 0           my $fname = $this_file->basename;
16547 0 0         if( !$this_file->exists )
    0          
16548             {
16549 0           $self->error( "File \"$this_file\" does not exist." );
16550 0           next;
16551             }
16552             elsif( !$this_file->can_read )
16553             {
16554 0           $self->error( "File \"$this_file\" is not reaable by uid $>." );
16555 0           next;
16556             }
16557 0   0       my $binary = $this_file->load ||
16558             return( $self->pass_error( $this_file->error ) );
16559 0           my $mime_type = $this_file->finfo->mime_type;
16560 0           $fname =~ s/([\\\"])/\\$1/g;
16561 0           $set_value->( "${pref}${ke}", $binary, $hash, { encoding => 'base64', filename => $fname, type => $mime_type } );
16562 0           next;
16563             }
16564 0 0         $encode->( ( $pref ? sprintf( '%s[%s]', $pref, $ke ) : $ke ), $data->{ $k }, $hash );
16565             }
16566             }
16567             elsif( $type eq 'array' )
16568             {
16569             # According to Stripe's response to my mail inquiry of 2019-11-04 on how to structure array of hash in url encoded form data
16570 0           for( my $i = 0; $i < scalar( @$data ); $i++ )
16571             {
16572 0 0         $encode->( ( $pref ? sprintf( '%s[%d]', $pref, $i ) : sprintf( '[%d]', $i ) ), $data->[$i], $hash );
16573             }
16574             }
16575             elsif( ref( $data ) eq 'JSON::PP::Boolean' || ref( $data ) eq 'Module::Generic::Boolean' )
16576             {
16577 0 0         $set_value->( $pref, $data ? 'true' : 'false', $hash, { type => 'text/plain' } );
16578             }
16579             elsif( ref( $data ) eq 'SCALAR' && ( $$data == 1 || $$data == 0 ) )
16580             {
16581 0 0         $set_value->( $pref, $$data ? 'true' : 'false', $hash, { type => 'text/plain' } );
16582             }
16583             elsif( $type )
16584             {
16585 0           die( "Don't know what to do with data type $type\n" );
16586             }
16587             else
16588             {
16589 0           $set_value->( $pref, $data, $hash, { type => 'text/plain' } );
16590             }
16591 0           };
16592 0           my $result = {};
16593 0           $encode->( '', $args, $result );
16594 0           CORE::return( $result );
16595             }
16596              
16597             sub _get_args
16598             {
16599 0     0     my $self = shift( @_ );
16600 0 0 0       CORE::return( {} ) if( !scalar( @_ ) || ( scalar( @_ ) == 1 && !defined( $_[0] ) ) );
      0        
16601             # Arg is one of our unique object
16602 0 0         CORE::return( $_[0] ) if( $self->_is_a( $_[0] => 'Net::API::Stripe::Generic' ) );
16603 0 0         my $args = ref( $_[0] ) eq 'HASH' ? $_[0] : { @_ == 1 ? ( id => $_[0] ) : @_ };
    0          
16604 0           CORE::return( $args );
16605             }
16606              
16607             sub _get_args_from_object
16608             {
16609 0     0     my $self = shift( @_ );
16610 0   0       my $class = shift( @_ ) || CORE::return( $self->error( "No class was provided to get its information as parameters." ) );
16611 0           my $args = {};
16612 0 0 0       if( $self->_is_object( $_[0] ) && $_[0]->isa( $class ) )
16613             {
16614 0           my $obj = shift( @_ );
16615 0           $args = $obj->as_hash({ json => 1 });
16616 0           $args->{expand} = 'all';
16617 0           $args->{_cleanup} = 1;
16618 0           $args->{_object} = $obj;
16619             }
16620             else
16621             {
16622 0           $args = $self->_get_args( @_ );
16623             }
16624 0           CORE::return( $args );
16625             }
16626              
16627             sub _get_method
16628             {
16629 0     0     my $self = shift( @_ );
16630 0           my( $type, $action, $allowed ) = @_;
16631 0 0         CORE::return( $self->error( "No action was provided to get the associated method." ) ) if( !CORE::length( $action ) );
16632 0 0         CORE::return( $self->error( "Allowed method list provided is not an array reference." ) ) if( ref( $allowed ) ne 'ARRAY' );
16633 0 0         CORE::return( $self->error( "Allowed method list provided is empty." ) ) if( !scalar( @$allowed ) );
16634 0 0         if( $action eq 'remove' )
    0          
16635             {
16636 0           $action = 'delete';
16637             }
16638             elsif( $action eq 'add' )
16639             {
16640 0           $action = 'create';
16641             }
16642 0 0         if( !scalar( grep( /^$action$/, @$allowed ) ) )
16643             {
16644 0           CORE::return( $self->error( "Method $action is not authorised for $type" ) );
16645             }
16646 0           my $meth = $self->can( "${type}_${action}" );
16647 0 0         CORE::return( $self->error( "Method ${type}_${action} is not implemented in class '", ref( $self ), "'" ) ) if( !$meth );
16648 0           CORE::return( $meth );
16649             }
16650              
16651             sub _instantiate
16652             {
16653 0     0     my $self = shift( @_ );
16654 0           my $name = shift( @_ );
16655 0 0 0       CORE::return( $self->{ $name } ) if( exists( $self->{ $name } ) && Scalar::Util::blessed( $self->{ $name } ) );
16656 0           my $class = shift( @_ );
16657 0           my $this;
16658 0 0 0       try
  0            
  0            
  0            
  0            
  0            
  0            
  0            
16659 0     0     {
16660             # https://stackoverflow.com/questions/32608504/how-to-check-if-perl-module-is-available#comment53081298_32608860
16661             # require $class unless( defined( *{"${class}::"} ) );
16662 0           my $rc = eval{ $self->_load_class( $class ) };
  0            
16663 0 0         CORE::return( $self->error( "Unable to load class $class: $@" ) ) if( $@ );
16664 0   0       $this = $class->new(
16665             'debug' => $self->debug,
16666             'verbose' => $self->verbose,
16667             ) || CORE::return( $self->pass_error( $class->error ) );
16668 0           $this->{parent} = $self;
16669             }
16670 0 0 0       catch( $e )
  0 0 0        
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
16671 0     0     {
16672 0           CORE::return( $self->error({ code => 500, message => $e }) );
16673 1 0 0 1   9 }
  1 0 0     2  
  1 0 0     1762  
  0 0 0        
  0 0 0        
  0 0 0        
  0 0 0        
  0 0 0        
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
16674 0           CORE::return( $this );
16675             }
16676              
16677             sub _make_error
16678             {
16679 0     0     my $self = shift( @_ );
16680 0           my $args = shift( @_ );
16681 0 0 0       $args->{skip_frames} = 1 if( !exists( $args->{skip_frames} ) && !defined( $args->{skip_frames} ) );
16682 0           CORE::return( $self->error( $args ) );
16683             }
16684              
16685             sub _make_request
16686             {
16687 0     0     my $self = shift( @_ );
16688 0           my $req = shift( @_ );
16689 0           my( $e, $resp, $ret, $is_error );
16690             $ret = eval
16691 0           {
16692 0           $req->header( 'Authorization' => $self->{auth} );
16693 0           $req->header( 'Stripe_Version' => $self->{version} );
16694 0           $req->header( 'Content-Type' => 'application/x-www-form-urlencoded' );
16695 0 0         $req->header( 'Content-Type' => 'application/json' ) if( $self->encode_with_json );
16696 0           $req->header( 'Accept' => 'application/json' );
16697              
16698             # This commented out block below is used when we use HTTP::Promise while enabling the use of promise, but since we do not need
16699             # my $prom = $self->http_client->request( $req )->then(sub
16700             # {
16701             # my( $resolve, $reject ) = @$_;
16702             # $resolve->( @_ );
16703             # })->wait;
16704             # $resp = $prom->result;
16705             # We use this more straightforward approach:
16706 0           $resp = $self->http_client->request( $req );
16707 0 0         return( $self->pass_error( $self->http_client->error ) ) if( !defined( $resp ) );
16708 0           $self->{http_request} = $req;
16709 0           $self->{http_response} = $resp;
16710 0 0         if( $self->_is_a( $resp => 'HTTP::Promise::Exception' ) )
16711             {
16712 0           return( $self->pass_error( $resp ) );
16713             }
16714            
16715             # if( $resp->code == 200 )
16716 0 0 0       if( $resp->is_success || $resp->is_redirect )
16717             {
16718 0           my $content = $resp->decoded_content;
16719             # decoded_content returns a scalar object, which we force into regular string, otherwise JSON complains it cannot parse it.
16720 0           my $hash = $self->json->utf8->decode( "${content}" );
16721             # $ret = data_object( $hash );
16722 0           CORE::return( $hash );
16723             }
16724             else
16725             {
16726 0 0         if( $resp->header( 'Content_Type' ) =~ m{text/html} )
16727             {
16728 0           CORE::return( $self->error({
16729             code => $resp->code,
16730             type => $resp->status,
16731             message => $resp->status
16732             }) );
16733             }
16734             else
16735             {
16736 0           my $content = $resp->decoded_content;
16737             # decoded_content returns a scalar object, which we force into regular string, otherwise JSON complains it cannot parse it.
16738 0           my $hash = $self->json->utf8->decode( "${content}" );
16739             # For example:
16740             # {
16741             # "error" => {
16742             # "message" => "Search is not supported on api version 2020-03-02. Update your API version, or set the API Version of this request to 2020-08-27 or greater.",
16743             # "request_log_url" => "https://dashboard.stripe.com/test/logs/req_1Gy9CkPgC0eTw1?t=1666611614",
16744             # "type" => "invalid_request_error"
16745             # }
16746             # }
16747 0           my $ref = {};
16748 0 0 0       if( exists( $hash->{error} ) &&
16749             defined( $hash->{error} ) )
16750             {
16751 0 0 0       if( ref( $hash->{error} ) eq 'HASH' &&
16752             exists( $hash->{error}->{message} ) )
16753             {
16754 0           $ref->{message} = $hash->{error}->{message};
16755 0 0         $ref->{type} = $hash->{error}->{type} if( exists( $hash->{error}->{type} ) );
16756 0 0         $ref->{request_log_url} = $hash->{error}->{request_log_url} if( exists( $hash->{error}->{request_log_url} ) );
16757             }
16758             }
16759             else
16760             {
16761 0           $ref = $hash;
16762             }
16763 0           CORE::return( $self->error( $ref ) );
16764             }
16765             }
16766             };
16767 0 0         if( $@ )
16768             {
16769 0 0         CORE::return( $self->error({
16770             # type => "Could not decode HTTP response: $@",
16771             $resp
16772             ? ( message => ( "Could not decode HTTP response: $@\n" ) . $resp->status_line . ' - ' . $resp->content )
16773             : ( message => "Could not decode HTTP response: $@" ),
16774             }) );
16775             }
16776             # CORE::return( $ret ) if( $ret );
16777 0           CORE::return( $ret );
16778             }
16779              
16780             sub _object_class_to_type
16781             {
16782 0     0     my $self = shift( @_ );
16783 0   0       my $class = shift( @_ ) || CORE::return( $self->error( "No class was provided to find its associated type." ) );
16784 0 0         $class = ref( $class ) if( $self->_is_object( $class ) );
16785 0           my $ref = $Net::API::Stripe::TYPE2CLASS;
16786 0           foreach my $c ( keys( %$ref ) )
16787             {
16788 0 0         CORE::return( $c ) if( $ref->{ $c } eq $class );
16789             }
16790 0           CORE::return;
16791             }
16792              
16793             sub _object_type_to_class
16794             {
16795 0     0     my $self = shift( @_ );
16796 0   0       my $type = shift( @_ ) || CORE::return( $self->error( "No object type was provided" ) );
16797 0           my $ref = $Net::API::Stripe::TYPE2CLASS;
16798 0 0         CORE::return( $self->error( "No object type '$type' known to get its related class for field $self->{_field}" ) ) if( !exists( $ref->{ $type } ) );
16799 0           CORE::return( $ref->{ $type } );
16800             }
16801              
16802             sub _process_array_objects
16803             {
16804 0     0     my $self = shift( @_ );
16805 0           my $class = shift( @_ );
16806 0   0       my $ref = shift( @_ ) || CORE::return( $self->error( "No array reference provided" ) );
16807 0 0 0       CORE::return( $self->error( "Reference provided ($ref) is not an array reference." ) ) if( !ref( $ref ) || ref( $ref ) ne 'ARRAY' );
16808 0           for( my $i = 0; $i < scalar( @$ref ); $i++ )
16809             {
16810 0           my $hash = $ref->[$i];
16811 0 0         next if( ref( $hash ) ne 'HASH' );
16812 0           my $o = $class->new( %$hash );
16813 0           $ref->[$i] = $o;
16814             }
16815 0           CORE::return( $ref );
16816             }
16817              
16818             sub _response_to_object
16819             {
16820 0     0     my $self = shift( @_ );
16821 0           my $class = shift( @_ );
16822 0 0         CORE::return( $self->error( "No hash was provided" ) ) if( !scalar( @_ ) );
16823 0           my $hash = $self->_get_args( @_ );
16824             # my $callbacks = $CALLBACKS->{ $class };
16825 0           my $o;
16826 0 0 0       try
  0            
  0            
  0            
  0            
  0            
  0            
  0            
16827 0     0     {
16828             # https://stackoverflow.com/questions/32608504/how-to-check-if-perl-module-is-available#comment53081298_32608860
16829             # eval( "require $class;" ) unless( defined( *{"${class}::"} ) );
16830 0           my $rc = eval{ $self->_load_class( $class ) };
  0            
16831 0 0         CORE::return( $self->error( "An error occured while trying to load the module $class: $@" ) ) if( $@ );
16832             $o = $class->new({
16833             '_parent' => $self,
16834             '_debug' => $self->{debug},
16835             '_dbh' => $self->{_dbh},
16836 0   0       }, $hash ) || CORE::return( $self->pass_error( $class->error ) );
16837             }
16838 0 0 0       catch( $e )
  0 0 0        
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
16839 0     0     {
16840 0           CORE::return( $self->error( $e ) );
16841 1 0 0 1   8 }
  1 0 0     2  
  1 0 0     308  
  0 0 0        
  0 0 0        
  0 0 0        
  0 0 0        
  0 0 0        
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
16842 0 0         CORE::return( $self->pass_error( $class->error ) ) if( !defined( $o ) );
16843 0           CORE::return( $o );
16844             }
16845              
16846             # NOTE:: AUTOLOAD
16847             AUTOLOAD
16848             {
16849 0     0     my $self;
16850 0 0 0       $self = shift( @_ ) if( Scalar::Util::blessed( $_[0] ) && $_[0]->isa( 'Net::API::Stripe' ) );
16851 0           my( $class, $meth );
16852 0   0       $class = ref( $self ) || __PACKAGE__;
16853 0           $meth = $AUTOLOAD;
16854 0 0         if( CORE::index( $meth, '::' ) != -1 )
16855             {
16856 0           my $idx = rindex( $meth, '::' );
16857 0           $class = substr( $meth, 0, $idx );
16858 0           $meth = substr( $meth, $idx + 2 );
16859             }
16860            
16861             # printf( STDERR __PACKAGE__ . "::AUTOLOAD: %d autoload subs found.\n", scalar( keys( %$AUTOLOAD_SUBS ) ) ) if( $DEBUG >= 4 );
16862 0 0         unless( scalar( keys( %$AUTOLOAD_SUBS ) ) )
16863             {
16864 0           &Net::API::Stripe::_autoload_subs();
16865             # printf( STDERR __PACKAGE__ . "::AUTOLOAD: there are now %d autoload classes found: %s\n", scalar( keys( %$AUTOLOAD_SUBS ) ), join( ', ', sort( keys( %$AUTOLOAD_SUBS ) ) ) ) if( $DEBUG >= 4 );
16866             }
16867            
16868             # print( STDERR "Checking if sub '$meth' from class '$class' ($AUTOLOAD) is within the autoload subroutines\n" ) if( $DEBUG >= 4 );
16869 0           my $code;
16870 0 0         if( CORE::exists( $AUTOLOAD_SUBS->{ $meth } ) )
16871             {
16872 0           $code = $AUTOLOAD_SUBS->{ $meth };
16873             }
16874            
16875 0 0         if( CORE::defined( $code ) )
16876             {
16877 0 0         $code = Nice::Try->implement( $code ) if( CORE::index( $code, 'try' ) != -1 );
16878             # print( STDERR __PACKAGE__, "::AUTOLOAD: updated code for method \"$meth\" ($AUTOLOAD) and \$self '$self' is:\n$code\n" ) if( $DEBUG >= 4 );
16879 0           my $saved = $@;
16880             {
16881 1     1   7 no strict;
  1         2  
  1         102  
  0            
16882 0           eval( $code );
16883             }
16884 0 0         if( $@ )
16885             {
16886 0           $@ =~ s/ at .*\n//;
16887 0           die( $@ );
16888             }
16889 0           $@ = $saved;
16890             # defined( &$AUTOLOAD ) || die( "AUTOLOAD inconsistency error for dynamic sub \"$meth\"." );
16891 0   0       my $ref = $class->can( $meth ) || die( "AUTOLOAD inconsistency error for dynamic sub \"$meth\"." );
16892             # No need to keep it in the cache
16893             # delete( $AUTOLOAD_SUBS->{ $meth } );
16894             # goto( &$AUTOLOAD );
16895             # return( &$meth( $self, @_ ) ) if( $self );
16896 0 0         return( $ref->( $self, @_ ) ) if( $self );
16897 1     1   6 no strict 'refs';
  1         2  
  1         223  
16898 0           return( &$AUTOLOAD( @_ ) );
16899             }
16900 0           die( "Method \"${meth}\" is not defined in Net::API::Stripe" );
16901             };
16902              
16903             DESTROY
16904       0     {
16905             # Do nothing; just avoid calling AUTOLOAD
16906             };
16907              
16908             1;
16909              
16910             __END__