File Coverage

lib/Net/API/Stripe.pm
Criterion Covered Total %
statement 140 1661 8.4
branch 0 1602 0.0
condition 0 614 0.0
subroutine 47 118 39.8
pod 22 27 81.4
total 209 4022 5.2


line stmt bran cond sub pod time code
1             # -*- perl -*-
2             ##----------------------------------------------------------------------------
3             ## Stripe API - ~/lib/Net/API/Stripe.pm
4             ## Version v2.0.1
5             ## Copyright(c) 2022 DEGUEST Pte. Ltd.
6             ## Author: Jacques Deguest <jack@deguest.jp>
7             ## Created 2018/07/19
8             ## Modified 2022/10/29
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             BEGIN
16             {
17             use strict;
18 1     1   37953401 use warnings;
  1         4  
  1         52  
19 1     1   7 use warnings::register;
  1         6  
  1         59  
20 1     1   12 use common::sense;
  1         4  
  1         389  
21 1     1   8 use parent qw( Module::Generic );
  1         6  
  1         30  
22 1     1   134 use vars qw(
  1         2  
  1         20  
23 1         216 $VERSION $VERBOSE $DEBUG $BROWSER $ERROR_CODE_TO_STRING $TYPE2CLASS
24             $EXPANDABLES_BY_CLASS $EXPANDABLES $EXPAND_MAX_DEPTH $EXCEPTION_CLASS
25             $AUTOLOAD_SUBS $AUTOLOAD
26             );
27 1     1   136 use Cookie;
  1         2  
28 1     1   738 use Encode ();
  1         1557038  
  1         17  
29 1     1   559 use Data::UUID;
  1         2  
  1         36  
30 1     1   7 # use Net::OAuth;
  1         2  
  1         143  
31             # use Crypt::OpenSSL::RSA;
32             use Data::Random qw( rand_chars );
33 1     1   678 use DateTime;
  1         12258  
  1         96  
34 1     1   8 use DateTime::Format::Strptime;
  1         2  
  1         25  
35 1     1   5 use Devel::Confess;
  1         1  
  1         14  
36 1     1   696 use Digest::MD5 qw( md5_base64 );
  1         7981  
  1         4  
37 1     1   123 use Digest::SHA ();
  1         2  
  1         76  
38 1     1   519 use HTTP::Promise;
  1         2777  
  1         39  
39 1     1   912 use HTTP::Promise::Headers;
  1         42990157  
  1         14  
40 1     1   405 use HTTP::Promise::Message;
  1         2  
  1         26  
41 1     1   5 use HTTP::Promise::Request;
  1         2  
  1         10  
42 1     1   266 use JSON;
  1         2  
  1         8  
43 1     1   254 use MIME::QuotedPrint ();
  1         3  
  1         9  
44 1     1   754 use MIME::Base64 ();
  1         1410  
  1         28  
45 1     1   6 use Module::Generic::File qw( sys_tmpdir );
  1         3  
  1         25  
46 1     1   5 use Net::IP;
  1         2  
  1         12  
47 1     1   998 use Nice::Try;
  1         51355  
  1         187  
48 1     1   10 use Regexp::Common;
  1         2  
  1         11  
49 1     1   7020651 use Scalar::Util ();
  1         4  
  1         37  
50 1     1   1188 use URI::Escape;
  1         3  
  1         23  
51 1     1   7 use Want;
  1         3  
  1         88  
52 1     1   8 use constant API_BASE => 'https://api.stripe.com/v1';
  1         2  
  1         63  
53 1     1   7 use constant FILES_BASE => 'https://files.stripe.com/v1';
  1         2  
  1         93  
54 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         15  
  1         61  
55 1     1   5 our $VERSION = 'v2.0.1';
  1         2  
  1         92  
56 1     1   4 our $EXCEPTION_CLASS = 'Net::API::Stripe::Exception';
57 1         21 };
58              
59             use strict;
60 1     1   5 use warnings;
  1         2  
  1         26  
61 1     1   5  
  1         2  
  1         6180  
62             our $VERBOSE = 0;
63             our $DEBUG = 0;
64             our $BROWSER = 'Net::API::Stripe/' . $VERSION;
65              
66             our $ERROR_CODE_TO_STRING =
67             {
68             400 => "The request was unacceptable, due to a missing required parameter.",
69             401 => "No valid API key provided.",
70             402 => "The parameters were valid but the request failed.",
71             403 => "The API key doesn't have permissions to perform the request.",
72             404 => "The requested resource doesn't exist.",
73             409 => "The request conflicts with another request.",
74             429 => "Too many requests hit the API too quickly. We recommend an exponential backoff of your requests.",
75             500 => "Something went wrong on Stripe's end.",
76             502 => "Something went wrong on Stripe's end.",
77             503 => "Something went wrong on Stripe's end.",
78             504 => "Something went wrong on Stripe's end.",
79             # Payout: https://stripe.com/docs/api/payouts/failures
80             account_closed => "The bank account has been closed.",
81             # Payout
82             account_frozen => "The bank account has been frozen.",
83             amount_too_large => "The specified amount is greater than the maximum amount allowed. Use a lower amount and try again.",
84             amount_too_small => "The specified amount is less than the minimum amount allowed. Use a higher amount and try again.",
85             api_connection_error => "Failure to connect to Stripe's API.",
86             api_error => "Striipe API error",
87             api_key_expired => "The API key provided has expired",
88             authentication_error => "Failure to properly authenticate yourself in the request.",
89             balance_insufficient => "The transfer or payout could not be completed because the associated account does not have a sufficient balance available.",
90             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.",
91             # Payout: https://stripe.com/docs/api/payouts/failures
92             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.",
93             bank_account_unusable => "The bank account provided cannot be used for payouts. A different bank account must be used.",
94             bank_account_unverified => "Your Connect platform is attempting to share an unverified bank account with a connected account.",
95             # Payout
96             bank_ownership_changed => "The destination bank account is no longer valid because its branch has changed ownership.",
97             card_declined => "The card has been declined.",
98             card_error => "Card error",
99             charge_already_captured => "The charge you’re attempting to refund has already been refunded.",
100             # Payout
101             could_not_process => "The bank could not process this payout.",
102             # Payout
103             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.)",
104             # Payout
105             declined => "The bank has declined this transfer. Please contact the bank before retrying.",
106             email_invalid => "The email address is invalid.",
107             expired_card => "The card has expired. Check the expiration date or use a different card.",
108             idempotency_error => "Idempotency error",
109             # Payout
110             incorrect_account_holder_name => "Your bank notified us that the bank account holder name on file is incorrect.",
111             incorrect_cvc => "The card’s security code is incorrect. Check the card’s security code or use a different card.",
112             incorrect_number => "The card number is incorrect. Check the card’s number or use a different card.",
113             incorrect_zip => "The card’s postal code is incorrect. Check the card’s postal code or use a different card.",
114             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.",
115             # Payout
116             insufficient_funds => "Your Stripe account has insufficient funds to cover the payout.",
117             # Payout
118             invalid_account_number => "The routing number seems correct, but the account number is invalid.",
119             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.",
120             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.",
121             # Payout
122             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.",
123             invalid_cvc => "The card’s security code is invalid. Check the card’s security code or use a different card.",
124             invalid_expiry_month => "The card’s expiration month is incorrect. Check the expiration date or use a different card.",
125             invalid_expiry_year => "The card’s expiration year is incorrect. Check the expiration date or use a different card.",
126             invalid_number => "The card number is invalid. Check the card details or use a different card.",
127             invalid_request_error => "Invalid request error. Request has invalid parameters.",
128             livemode_mismatch => "Test and live mode API keys, requests, and objects are only available within the mode they are in.",
129             missing => "Both a customer and source ID have been provided, but the source has not been saved to the customer. ",
130             # Payout
131             no_account => "The bank account details on file are probably incorrect. No bank account could be located with those details.",
132             parameter_invalid_empty => "One or more required values were not provided. Make sure requests include all required parameters.",
133             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.",
134             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.",
135             parameter_invalid_string_empty => "One or more required string values is empty. Make sure that string values contain at least one character.",
136             parameter_missing => "One or more required values are missing.",
137             parameter_unknown => "The request contains one or more unexpected parameters. Remove these and try again.",
138             payment_method_unactivated => "The charge cannot be created as the payment method used has not been activated.",
139             payouts_not_allowed => "Payouts have been disabled on the connected account.",
140             platform_api_key_expired => "The API key provided by your Connect platform has expired.",
141             postal_code_invalid => "The postal code provided was incorrect.",
142             processing_error => "An error occurred while processing the card. Check the card details are correct or use a different card.",
143             rate_limit => "Too many requests hit the API too quickly. We recommend an exponential backoff of your requests.",
144             rate_limit_error => "Too many requests hit the API too quickly.",
145             testmode_charges_only => "This account has not been activated and can only make test charges.",
146             tls_version_unsupported => "Your integration is using an older version of TLS that is unsupported. You must be using TLS 1.2 or above.",
147             token_already_used => "The token provided has already been used. You must create a new token before you can retry this request.",
148             transfers_not_allowed => "The requested transfer cannot be created. Contact us if you are receiving this error.",
149             # Payout
150             unsupported_card => "The bank no longer supports payouts to this card.",
151             upstream_order_creation_failed => "The order could not be created. Check the order details and then try again.",
152             url_invalid => "The URL provided is invalid.",
153             validation_error => "Stripe client-side library error: improper field validation",
154             };
155              
156             our $TYPE2CLASS =
157             {
158             "account" => "Net::API::Stripe::Connect::Account",
159             "account_bank_account" => "Net::API::Stripe::Connect::ExternalAccount::Bank",
160             "account_card" => "Net::API::Stripe::Connect::ExternalAccount::Card",
161             "account_link" => "Net::API::Stripe::Connect::Account::Link",
162             "ach_credit_transfer" => "Net::API::Stripe::Payment::Source::ACHCreditTransfer",
163             "ach_debit" => "Net::API::Stripe::Payment::Source::ACHDebit",
164             "additional_document" => "Net::API::Stripe::Connect::Account::Document",
165             "address" => "Net::API::Stripe::Address",
166             "address_kana" => "Net::API::Stripe::AddressKana",
167             "address_kanji" => "Net::API::Stripe::AddressKanji",
168             "application" => "Net::API::Stripe::Connect::Account",
169             "application_fee" => "Net::API::Stripe::Connect::ApplicationFee",
170             "authorization_controls" => "Net::API::Stripe::Issuing::Card::AuthorizationsControl",
171             "balance" => "Net::API::Stripe::Balance",
172             "balance_transaction" => "Net::API::Stripe::Balance::Transaction",
173             # "bank_account" => "Net::API::Stripe::Connect::ExternalAccount::Bank",
174             # which inherits from Net::API::Stripe::Connect::ExternalAccount::Bank
175             "bank_account" => "Net::API::Stripe::Customer::BankAccount",
176             "billing" => "Net::API::Stripe::Billing::Details",
177             "billing_address" => "Net::API::Stripe::Address",
178             "billing_details" => "Net::API::Stripe::Billing::Details",
179             "billing_portal_configuration" => "Net::API::Stripe::Billing::PortalConfiguration",
180             "billing_portal.session" => "Net::API::Stripe::Billing::PortalSession",
181             "billing_thresholds" => "Net::API::Stripe::Billing::Thresholds",
182             "bitcoin_transaction" => "Net::API::Stripe::Bitcoin::Transaction",
183             "branding" => "Net::API::Stripe::Connect::Account::Branding",
184             "business_profile" => "Net::API::Stripe::Connect::Business::Profile",
185             "capability" => "Net::API::Stripe::Connect::Account::Capability",
186             # "card" => "Net::API::Stripe::Connect::ExternalAccount::Card",
187             # which inherits from Net::API::Stripe::Connect::ExternalAccount::Card
188             "card" => "Net::API::Stripe::Customer::Card",
189             "card_payments" => "Net::API::Stripe::Connect::Account::Settings::CardPayments",
190             "cardholder" => "Net::API::Stripe::Issuing::Card::Holder",
191             "cash_balance" => "Net::API::Stripe::Cash::Balance",
192             "charge" => "Net::API::Stripe::Charge",
193             "charges" => "Net::API::Stripe::List",
194             "checkout.session" => "Net::API::Stripe::Checkout::Session",
195             "checkout_session" => "Net::API::Stripe::Checkout::Session",
196             "code_verification" => "Net::API::Stripe::Payment::Source::CodeVerification",
197             "company" => "Net::API::Stripe::Connect::Account::Company",
198             "country_spec" => "Net::API::Stripe::Connect::CountrySpec",
199             "coupon" => "Net::API::Stripe::Billing::Coupon",
200             "credit_note" => "Net::API::Stripe::Billing::CreditNote",
201             "credit_note_line_item" => "Net::API::Stripe::Billing::CreditNote::LineItem",
202             "credit_noteline_item" => "Net::API::Stripe::Billing::CreditNote::LineItem",
203             "customer" => "Net::API::Stripe::Customer",
204             "customer_address" => "Net::API::Stripe::Address",
205             "customer_balance_transaction" => "Net::API::Stripe::Customer::BalanceTransaction",
206             "customer_bank_account" => "Net::API::Stripe::Connect::ExternalAccount::Bank",
207             "customer_cash_balance_transaction" => "Net::API::Stripe::Cash::Transaction",
208             "customer_shipping" => "Net::API::Stripe::Shipping",
209             "dashboard" => "Net::API::Stripe::Connect::Account::Settings::Dashboard",
210             "data" => "Net::API::Stripe::Event::Data",
211             "discount" => "Net::API::Stripe::Billing::Discount",
212             "dispute" => "Net::API::Stripe::Dispute",
213             "dispute_evidence" => "Net::API::Stripe::Dispute::Evidence",
214             "document" => "Net::API::Stripe::Connect::Account::Document",
215             "early_fraud_warning" => "Net::API::Stripe::Fraud",
216             "error" => "Net::API::Stripe::Error",
217             "event" => "Net::API::Stripe::Event",
218             "evidence" => "Net::API::Stripe::Issuing::Dispute::Evidence",
219             "evidence_details" => "Net::API::Stripe::Dispute::EvidenceDetails",
220             "external_accounts" => "Net::API::Stripe::List",
221             "fee_refund" => "Net::API::Stripe::Connect::ApplicationFee::Refund",
222             "file" => "Net::API::Stripe::File",
223             "file_link" => "Net::API::Stripe::File::Link",
224             "fraud_value_list" => "Net::API::Stripe::Fraud::ValueList",
225             "fraud_value_list_item" => "Net::API::Stripe::Fraud::ValueList::Item",
226             "fraud_warning" => "Net::API::Stripe::Fraud",
227             "fraudulent" => "Net::API::Stripe::Issuing::Dispute::Evidence::Fraudulent",
228             "generated_from" => "Net::API::Stripe::Payment::GeneratedFrom",
229             "identity_verification_report" => "Net::API::Stripe::Identity::VerificationReport",
230             "identity_verification_session" => "Net::API::Stripe::Identity::VerificationSession",
231             "individual" => "Net::API::Stripe::Connect::Person",
232             "inventory" => "Net::API::Stripe::Order::SKU::Inventory",
233             "invoice" => "Net::API::Stripe::Billing::Invoice",
234             "invoice_customer_balance_settings" => "Net::API::Stripe::Billing::Invoice::BalanceSettings",
235             "invoice_settings" => "Net::API::Stripe::Billing::Invoice::Settings",
236             "invoiceitem" => "Net::API::Stripe::Billing::Invoice::Item",
237             "invoice_item" => "Net::API::Stripe::Billing::Invoice::Item",
238             "ip_address_location" => "Net::API::Stripe::GeoLocation",
239             "issuing.authorization" => "Net::API::Stripe::Issuing::Authorization",
240             "issuing.card" => "Net::API::Stripe::Issuing::Card",
241             "issuing.cardholder" => "Net::API::Stripe::Issuing::Card::Holder",
242             "issuing.dispute" => "Net::API::Stripe::Issuing::Dispute",
243             "issuing.transaction" => "Net::API::Stripe::Issuing::Transaction",
244             "issuing_authorization" => "Net::API::Stripe::Issuing::Authorization",
245             "issuing_card" => "Net::API::Stripe::Issuing::Card",
246             "issuing_cardholder" => "Net::API::Stripe::Issuing::Card::Holder",
247             "issuing_dispute" => "Net::API::Stripe::Issuing::Dispute",
248             "issuing_transaction" => "Net::API::Stripe::Issuing::Transaction",
249             "item" => "Net::API::Stripe::List::Item",
250             "items" => "Net::API::Stripe::List",
251             "last_payment_error" => "Net::API::Stripe::Error",
252             "last_setup_error" => "Net::API::Stripe::Error",
253             "line_item" => "Net::API::Stripe::Billing::Invoice::LineItem",
254             "lines" => "Net::API::Stripe::List",
255             "links" => "Net::API::Stripe::List",
256             "list" => "Net::API::Stripe::List",
257             "list_items" => "Net::API::Stripe::List",
258             "login_link" => "Net::API::Stripe::Connect::Account::LoginLink",
259             "mandate" => "Net::API::Stripe::Mandate",
260             "merchant_data" => "Net::API::Stripe::Issuing::MerchantData",
261             "next_action" => "Net::API::Stripe::Payment::Intent::NextAction",
262             "order" => "Net::API::Stripe::Order",
263             "order_legacy" => "Net::API::Stripe::Order",
264             "order_item" => "Net::API::Stripe::Order::Item",
265             "order_return" => "Net::API::Stripe::Order::Return",
266             "other" => "Net::API::Stripe::Issuing::Dispute::Evidence::Other",
267             "outcome" => "Net::API::Stripe::Charge::Outcome",
268             "owner" => "Net::API::Stripe::Payment::Source::Owner",
269             "package_dimensions" => "Net::API::Stripe::Order::SKU::PackageDimensions",
270             "payment_intent" => "Net::API::Stripe::Payment::Intent",
271             "payment_method" => "Net::API::Stripe::Payment::Method",
272             "payment_method_details" => "Net::API::Stripe::Payment::Method::Details",
273             "payments" => "Net::API::Stripe::Connect::Account::Settings::Payments",
274             "payout" => "Net::API::Stripe::Payout",
275             "payouts" => "Net::API::Stripe::Connect::Account::Settings::Payouts",
276             "pending_invoice_item_interval" => "Net::API::Stripe::Billing::Plan",
277             "period" => "Net::API::Stripe::Billing::Invoice::Period",
278             "person" => "Net::API::Stripe::Connect::Person",
279             "plan" => "Net::API::Stripe::Billing::Plan",
280             "portal_configuration" => "Net::API::Stripe::Billing::PortalConfiguration",
281             "portal_session" => "Net::API::Stripe::Billing::PortalSession",
282             "price" => "Net::API::Stripe::Price",
283             "product" => "Net::API::Stripe::Product",
284             "promotion_code" => "Net::API::Stripe::Billing::PromotionCode",
285             "quote" => "Net::API::Stripe::Billing::Quote",
286             "radar.early_fraud_warning" => "Net::API::Stripe::Fraud",
287             "radar.value_list" => "Net::API::Stripe::Fraud::ValueList",
288             "radar.value_list_item" => "Net::API::Stripe::Fraud::ValueList::Item",
289             "radar_early_fraud_warning" => "Net::API::Stripe::Fraud",
290             "radar_value_list" => "Net::API::Stripe::Fraud::ValueList",
291             "radar_value_list_item" => "Net::API::Stripe::Fraud::ValueList::Item",
292             "receiver" => "Net::API::Stripe::Payment::Source::Receiver",
293             "redirect" => "Net::API::Stripe::Payment::Source::Redirect",
294             "refund" => "Net::API::Stripe::Refund",
295             "refunds" => "Net::API::Stripe::Charge::Refunds",
296             "relationship" => "Net::API::Stripe::Connect::Account::Relationship",
297             "report_run" => "Net::API::Stripe::Reporting::ReportRun",
298             "report_type" => "Net::API::Stripe::Reporting::ReportType",
299             "reporting.report_run" => "Net::API::Stripe::Reporting::ReportRun",
300             "reporting.report_type" => "Net::API::Stripe::Reporting::ReportType",
301             "reporting_report_run" => "Net::API::Stripe::Reporting::ReportRun",
302             "reporting_report_type" => "Net::API::Stripe::Reporting::ReportType",
303             "request" => "Net::API::Stripe::Event::Request",
304             "requirements" => "Net::API::Stripe::Connect::Account::Requirements",
305             "result" => "Net::API::Stripe::File",
306             "returns" => "Net::API::Stripe::Order::Returns",
307             "reversals" => "Net::API::Stripe::Connect::Transfer::Reversals",
308             "review" => "Net::API::Stripe::Fraud::Review",
309             "review_session" => "Net::API::Stripe::Fraud::Review::Session",
310             "scheduled_query_run" => "Net::API::Stripe::Sigma::ScheduledQueryRun",
311             "settings" => "Net::API::Stripe::Connect::Account::Settings",
312             "setup_attempt" => "Net::API::Stripe::SetupAttempt",
313             "setup_intent" => "Net::API::Stripe::Payment::Intent::Setup",
314             "shipping" => "Net::API::Stripe::Shipping",
315             "shipping_address" => "Net::API::Stripe::Address",
316             "shipping_rate" => "Net::API::Stripe::Shipping::Rate",
317             "sku" => "Net::API::Stripe::Order::SKU",
318             "source" => "Net::API::Stripe::Payment::Source",
319             "source_order" => "Net::API::Stripe::Order",
320             "sources" => "Net::API::Stripe::Customer::Sources",
321             "status_transitions" => "Net::API::Stripe::Billing::Invoice::StatusTransition",
322             "subscription" => "Net::API::Stripe::Billing::Subscription",
323             "subscription_item" => "Net::API::Stripe::Billing::Subscription::Item",
324             "subscription_schedule" => "Net::API::Stripe::Billing::Subscription::Schedule",
325             "subscriptions" => "Net::API::Stripe::List",
326             "support_address" => "Net::API::Stripe::Address",
327             "tax_code" => "Net::API::Stripe::Product::TaxCode",
328             "tax_id" => "Net::API::Stripe::Customer::TaxId",
329             "tax_ids" => "Net::API::Stripe::Customer::TaxIds",
330             "tax_info" => "Net::API::Stripe::Customer::TaxInfo",
331             "tax_info_verification" => "Net::API::Stripe::Customer::TaxInfoVerification",
332             "tax_rate" => "Net::API::Stripe::Tax::Rate",
333             "terminal.connection_token" => "Net::API::Stripe::Terminal::ConnectionToken",
334             "terminal.location" => "Net::API::Stripe::Terminal::Location",
335             "terminal.reader" => "Net::API::Stripe::Terminal::Reader",
336             "terminal_connection_token" => "Net::API::Stripe::Terminal::ConnectionToken",
337             "terminal_location" => "Net::API::Stripe::Terminal::Location",
338             "terminal_reader" => "Net::API::Stripe::Terminal::Reader",
339             "threshold_reason" => "Net::API::Stripe::Billing::Thresholds",
340             "token" => "Net::API::Stripe::Token",
341             "topup" => "Net::API::Stripe::Connect::TopUp",
342             "tos_acceptance" => "Net::API::Stripe::Connect::Account::TosAcceptance",
343             "transactions" => "Net::API::Stripe::List",
344             "transfer" => "Net::API::Stripe::Connect::Transfer",
345             "transfer_data" => "Net::API::Stripe::Payment::Intent::TransferData",
346             "transfer_reversal" => "Net::API::Stripe::Connect::Transfer::Reversal",
347             "transform_usage" => "Net::API::Stripe::Billing::Plan::TransformUsage",
348             "usage_record" => "Net::API::Stripe::Billing::UsageRecord",
349             "verification" => "Net::API::Stripe::Connect::Account::Verification",
350             "verification_data" => "Net::API::Stripe::Issuing::Authorization::VerificationData",
351             "verification_fields" => "Net::API::Stripe::Connect::CountrySpec::VerificationFields",
352             "verified_address" => "Net::API::Stripe::Address",
353             "webhook_endpoint" => "Net::API::Stripe::WebHook::Object",
354             };
355              
356             our $EXPANDABLES_BY_CLASS =
357             {
358             "account" => {},
359             "account_bank_account" => { account => ["account"], customer => ["customer"] },
360             "account_card" => { account => ["account"], customer => ["customer"] },
361             "account_link" => {},
362             "address" => {},
363             "address_kana" => {},
364             "address_kanji" => {},
365             "application_fee" => {
366             account => ["account"],
367             application => ["account"],
368             balance_transaction => ["balance_transaction"],
369             charge => ["charge"],
370             originating_transaction => ["charge"],
371             },
372             "apps.secret" => {},
373             "balance" => {},
374             "balance_transaction" => {
375             source => [
376             "charge",
377             "dispute",
378             "fee_refund",
379             "payout",
380             "application_fee",
381             "refund",
382             "topup",
383             "issuing_transaction",
384             "transfer",
385             "transfer_reversal",
386             ],
387             },
388             "bank_account" => { account => ["account"], customer => ["customer"] },
389             "billing_details" => {},
390             "billing_portal.configuration" => { application => ["account"] },
391             "billing_portal.session" => { configuration => ["billing_portal.configuration"] },
392             "billing_thresholds" => {},
393             "business_profile" => {},
394             "capability" => { account => ["account"] },
395             "card" => { account => ["account"], customer => ["customer"] },
396             "cash_balance" => {},
397             "charge" => {
398             application => ["account"],
399             application_fee => ["application_fee"],
400             balance_transaction => ["balance_transaction"],
401             customer => ["customer"],
402             failure_balance_transaction => ["balance_transaction", "balance_transaction"],
403             invoice => ["invoice"],
404             on_behalf_of => ["account"],
405             payment_intent => ["payment_intent"],
406             review => ["review"],
407             source_transfer => ["transfer"],
408             transfer => ["transfer"],
409             },
410             "checkout.session" => {
411             customer => ["customer"],
412             payment_intent => ["payment_intent"],
413             payment_link => ["payment_link"],
414             setup_intent => ["setup_intent"],
415             subscription => ["subscription"],
416             },
417             "code_verification" => {},
418             "company" => {},
419             "country_spec" => {},
420             "coupon" => {},
421             "credit_note" => {
422             customer => ["customer"],
423             customer_balance_transaction => ["customer_balance_transaction"],
424             invoice => ["invoice"],
425             refund => ["refund"],
426             },
427             "credit_note_line_item" => {},
428             "customer" => {
429             default_source => ["bank_account", "card", "source"],
430             test_clock => ["test_helpers.test_clock", "test_helpers.test_clock"],
431             },
432             "customer_balance_transaction" => {
433             credit_note => ["credit_note"],
434             customer => ["customer"],
435             invoice => ["invoice"],
436             },
437             "customer_cash_balance_transaction" => { customer => ["customer"] },
438             "data" => {},
439             "discount" => { customer => ["customer"], promotion_code => ["promotion_code"] },
440             "dispute" => { charge => ["charge"], payment_intent => ["payment_intent"] },
441             "dispute_evidence" => {
442             cancellation_policy => ["file"],
443             customer_communication => ["file"],
444             customer_signature => ["file"],
445             duplicate_charge_documentation => ["file"],
446             receipt => ["file"],
447             refund_policy => ["file"],
448             service_documentation => ["file"],
449             shipping_documentation => ["file"],
450             uncategorized_file => ["file"],
451             },
452             "document" => {},
453             "error" => {},
454             "event" => {},
455             "evidence" => {},
456             "evidence_details" => {},
457             "fee_refund" => {
458             balance_transaction => ["balance_transaction"],
459             fee => ["application_fee"],
460             },
461             "file" => {},
462             "file_link" => { file => ["file"] },
463             "financial_connections.account" => {
464             ownership => [
465             "financial_connections.account_ownership",
466             "financial_connections.account_ownership",
467             ],
468             },
469             "financial_connections.account_owner" => {},
470             "financial_connections.account_ownership" => {},
471             "financial_connections.session" => {},
472             "funding_instructions" => {},
473             "identity.verification_report" => {},
474             "identity.verification_session" => {
475             last_verification_report => [
476             "identity_verification_report",
477             "identity_verification_report",
478             ],
479             },
480             "invoice" => {
481             account_tax_ids => ["tax_id"],
482             application => ["account"],
483             charge => ["charge"],
484             customer => ["customer"],
485             default_payment_method => ["payment_method"],
486             default_source => ["bank_account", "card", "source"],
487             discounts => ["discount"],
488             on_behalf_of => ["account"],
489             payment_intent => ["payment_intent"],
490             quote => ["quote"],
491             subscription => ["subscription"],
492             test_clock => ["test_helpers.test_clock"],
493             },
494             "invoice_settings" => { default_payment_method => ["payment_method"] },
495             "invoiceitem" => {
496             customer => ["customer"],
497             discounts => ["discount"],
498             invoice => ["invoice"],
499             subscription => ["subscription"],
500             test_clock => ["test_helpers.test_clock"],
501             },
502             "ip_address_location" => {},
503             "issuing.authorization" => { cardholder => ["issuing_cardholder"] },
504             "issuing.card" => {
505             replaced_by => ["issuing_card"],
506             replacement_for => ["issuing_card"],
507             },
508             "issuing.cardholder" => {},
509             "issuing.dispute" => { transaction => ["issuing_transaction"] },
510             "issuing.transaction" => {
511             authorization => ["issuing_authorization"],
512             balance_transaction => ["balance_transaction"],
513             card => ["issuing_card"],
514             cardholder => ["issuing_cardholder"],
515             dispute => ["issuing_dispute"],
516             },
517             "item" => {},
518             "line_item" => { discounts => ["discount"] },
519             "login_link" => {},
520             "mandate" => { payment_method => ["payment_method"] },
521             "merchant_data" => {},
522             "next_action" => {},
523             "outcome" => {},
524             "owner" => {},
525             "package_dimensions" => {},
526             "payment_intent" => {
527             application => ["account"],
528             customer => ["customer"],
529             invoice => ["invoice"],
530             on_behalf_of => ["account"],
531             payment_method => ["payment_method"],
532             review => ["review"],
533             },
534             "payment_link" => { on_behalf_of => ["account"] },
535             "payment_method" => { customer => ["customer"] },
536             "payment_method_details" => {},
537             "payout" => {
538             balance_transaction => ["balance_transaction"],
539             destination => ["card", "bank_account"],
540             failure_balance_transaction => ["balance_transaction"],
541             original_payout => ["payout"],
542             reversed_by => ["payout"],
543             },
544             "period" => {},
545             "person" => {},
546             "plan" => { product => ["product"] },
547             "price" => { product => ["product"] },
548             "product" => {
549             default_price => ["price", "price"],
550             tax_code => ["tax_code", "tax_code"],
551             },
552             "promotion_code" => { customer => ["customer"] },
553             "quote" => {
554             application => ["account"],
555             customer => ["customer"],
556             default_tax_rates => ["tax_rate"],
557             discounts => ["discount"],
558             invoice => ["invoice"],
559             on_behalf_of => ["account"],
560             subscription => ["subscription"],
561             subscription_schedule => ["subscription_schedule"],
562             test_clock => ["test_helpers.test_clock"],
563             },
564             "radar.early_fraud_warning" => {
565             charge => ["charge"],
566             payment_intent => ["payment_intent", "payment_intent"],
567             },
568             "radar.value_list" => {},
569             "radar.value_list_item" => {},
570             "receiver" => {},
571             "redirect" => {},
572             "refund" => {
573             balance_transaction => ["balance_transaction"],
574             charge => ["charge"],
575             failure_balance_transaction => ["balance_transaction"],
576             payment_intent => ["payment_intent"],
577             source_transfer_reversal => ["transfer_reversal"],
578             transfer_reversal => ["transfer_reversal"],
579             },
580             "relationship" => {},
581             "reporting.report_run" => {},
582             "reporting.report_type" => {},
583             "request" => {},
584             "requirements" => {},
585             "review" => { charge => ["charge"], payment_intent => ["payment_intent"] },
586             "scheduled_query_run" => {},
587             "settings" => {},
588             "setup_attempt" => {
589             application => ["account"],
590             customer => ["customer"],
591             on_behalf_of => ["account"],
592             payment_method => ["payment_method"],
593             setup_intent => ["setup_intent"],
594             },
595             "setup_intent" => {
596             application => ["account"],
597             customer => ["customer"],
598             latest_attempt => ["setup_attempt"],
599             mandate => ["mandate"],
600             on_behalf_of => ["account"],
601             payment_method => ["payment_method"],
602             single_use_mandate => ["mandate"],
603             },
604             "shipping" => {},
605             "shipping_rate" => { tax_code => ["tax_code"] },
606             "source" => {},
607             "source_order" => {},
608             "status_transitions" => {},
609             "subscription" => {
610             application => ["account"],
611             customer => ["customer"],
612             default_payment_method => ["payment_method"],
613             default_source => ["bank_account", "card", "source"],
614             latest_invoice => ["invoice"],
615             pending_setup_intent => ["setup_intent"],
616             schedule => ["subscription_schedule"],
617             test_clock => ["test_helpers.test_clock"],
618             },
619             "subscription_item" => {},
620             "subscription_schedule" => {
621             application => ["account", "account"],
622             customer => ["customer"],
623             subscription => ["subscription"],
624             test_clock => ["test_helpers.test_clock", "test_helpers.test_clock"],
625             },
626             "tax_code" => {},
627             "tax_id" => { customer => ["customer"] },
628             "tax_rate" => {},
629             "terminal.configuration" => { splashscreen => ["file", "file"] },
630             "terminal.connection_token" => {},
631             "terminal.location" => {},
632             "terminal.reader" => { location => ["terminal_location"] },
633             "test_helpers.test_clock" => {},
634             "token" => {},
635             "topup" => { balance_transaction => ["balance_transaction"] },
636             "tos_acceptance" => {},
637             "transfer" => {
638             balance_transaction => ["balance_transaction"],
639             destination => ["account"],
640             destination_payment => ["charge"],
641             source_transaction => ["charge"],
642             },
643             "transfer_data" => { destination => ["account"] },
644             "transfer_reversal" => {
645             balance_transaction => ["balance_transaction"],
646             destination_payment_refund => ["refund"],
647             source_refund => ["refund"],
648             transfer => ["transfer"],
649             },
650             "transform_usage" => {},
651             "treasury.credit_reversal" => { transaction => ["treasury.transaction", "treasury.transaction"] },
652             "treasury.debit_reversal" => { transaction => ["treasury.transaction", "treasury.transaction"] },
653             "treasury.financial_account" => {},
654             "treasury.financial_account_features" => {},
655             "treasury.inbound_transfer" => { transaction => ["treasury.transaction", "treasury.transaction"] },
656             "treasury.outbound_payment" => {
657             transaction => [
658             "treasury.transaction",
659             "treasury.transaction",
660             "treasury.transaction",
661             ],
662             },
663             "treasury.outbound_transfer" => {
664             transaction => [
665             "treasury.transaction",
666             "treasury.transaction",
667             "treasury.transaction",
668             ],
669             },
670             "treasury.received_credit" => { transaction => ["treasury.transaction", "treasury.transaction"] },
671             "treasury.received_debit" => { transaction => ["treasury.transaction", "treasury.transaction"] },
672             "treasury.transaction" => {},
673             "treasury.transaction_entry" => { transaction => ["treasury.transaction", "treasury.transaction"] },
674             "usage_record" => {},
675             "usage_record_summary" => {},
676             "verification" => {},
677             "verification_data" => {},
678             "verification_fields" => {},
679             "webhook_endpoint" => {},
680             };
681              
682             # As per Stripe documentation: https://stripe.com/docs/api/expanding_objects
683             our $EXPANDABLES = {};
684             our $EXPAND_MAX_DEPTH = 4;
685              
686             {
687             my $get_expandables;
688             $get_expandables = sub
689             {
690             my $class = shift( @_ ) || CORE::return;
691             my $pref = shift( @_ );
692             my $depth = shift( @_ ) || 0;
693             # print( "." x $depth, "Checking class \"$class\" with prefix \"$pref\" and depth $depth\n" );
694             CORE::return if( $depth > $EXPAND_MAX_DEPTH );
695             CORE::return if( !CORE::exists( $EXPANDABLES_BY_CLASS->{ $class } ) );
696             my $ref = $EXPANDABLES_BY_CLASS->{ $class };
697             my $list = [];
698             CORE::push( @$list, $pref ) if( CORE::length( $pref ) );
699             foreach my $prop ( sort( keys( %$ref ) ) )
700             {
701             my $target_classes = ref( $ref->{ $prop } ) eq 'ARRAY' ? $ref->{ $prop } : [ $ref->{ $prop } ];
702             my $new_prefix = CORE::length( $pref ) ? "${pref}.${prop}" : $prop;
703             my $this_path = [split(/\./, $new_prefix)];
704             my $this_depth = scalar( @$this_path );
705             foreach my $target_class ( @$target_classes )
706             {
707             my $res = $get_expandables->( $target_class, $new_prefix, $this_depth );
708             CORE::push( @$list, @$res ) if( ref( $res ) && scalar( @$res ) );
709             }
710             }
711             CORE::return( $list );
712             };
713              
714             if( !scalar( keys( %$EXPANDABLES ) ) )
715             {
716             foreach my $prop ( sort( keys( %$EXPANDABLES_BY_CLASS ) ) )
717             {
718             if( !scalar( keys( %{$EXPANDABLES_BY_CLASS->{ $prop }} ) ) )
719             {
720             $EXPANDABLES->{ $prop } = [];
721             next;
722             }
723             my $res = $get_expandables->( $prop, '', 0 );
724             $EXPANDABLES->{ $prop } = $res if( ref( $res ) && scalar( @$res ) );
725             }
726             $EXPANDABLES->{invoice_item} = $EXPANDABLES->{invoiceitem};
727             }
728             }
729              
730             sub init;
731             sub api_uri;
732             sub auth;
733             sub browser;
734             sub code2error;
735             sub conf_file;
736             sub cookie_file;
737             sub currency;
738             sub delete;
739             sub encode_with_json;
740             sub expand;
741             sub fields;
742             sub file_api_uri;
743             sub generate_uuid;
744             sub get;
745             sub http_client;
746             sub http_request;
747             sub http_response;
748             sub ignore_unknown_parameters;
749             sub json;
750             sub key;
751             sub livemode;
752             sub post;
753             sub post_multipart;
754             sub version;
755             sub webhook_validate_signature;
756             sub webhook_validate_caller_ip;
757             sub account;
758             sub account_bank_account;
759             sub account_bank_account_create;
760             sub account_bank_account_delete;
761             sub account_bank_account_list;
762             sub account_bank_account_retrieve;
763             sub account_bank_account_update;
764             sub account_bank_accounts;
765             sub account_card;
766             sub account_card_create;
767             sub account_card_delete;
768             sub account_card_list;
769             sub account_card_retrieve;
770             sub account_card_update;
771             sub account_cards;
772             sub account_create;
773             sub account_delete;
774             sub account_link;
775             sub account_link_create;
776             sub account_links;
777             sub account_list;
778             sub account_reject;
779             sub account_retrieve;
780             sub account_token_create;
781             sub account_update;
782             sub accounts;
783             sub address;
784             sub address_kana;
785             sub address_kanji;
786             sub amount;
787             sub application_fee;
788             sub application_fee_list;
789             sub application_fee_refund;
790             sub application_fee_retrieve;
791             sub application_fees;
792             sub apps_secret;
793             sub apps_secret_delete;
794             sub apps_secret_find;
795             sub apps_secret_list;
796             sub apps_secret_set;
797             sub apps_secrets;
798             sub authorization;
799             sub balance;
800             sub balance_retrieve;
801             sub balance_transaction;
802             sub balance_transaction_list;
803             sub balance_transaction_retrieve;
804             sub balance_transactions;
805             sub balances;
806             sub bank_account;
807             sub bank_account_create;
808             sub bank_account_delete;
809             sub bank_account_list;
810             sub bank_account_retrieve;
811             sub bank_account_update;
812             sub bank_account_verify;
813             sub bank_accounts;
814             sub bank_token_create;
815             sub billing_details;
816             sub billing_portal_configuration;
817             sub billing_portal_configuration_create;
818             sub billing_portal_configuration_list;
819             sub billing_portal_configuration_retrieve;
820             sub billing_portal_configuration_update;
821             sub billing_portal_configurations;
822             sub billing_portal_session;
823             sub billing_portal_session_create;
824             sub billing_portal_sessions;
825             sub billing_thresholds;
826             sub business_profile;
827             sub capability;
828             sub capability_list;
829             sub capability_retrieve;
830             sub capability_update;
831             sub capabilitys;
832             sub card;
833             sub card_create;
834             sub card_delete;
835             sub card_holder;
836             sub card_list;
837             sub card_retrieve;
838             sub card_token_create;
839             sub card_update;
840             sub cards;
841             sub cash_balance;
842             sub cash_balance_retrieve;
843             sub cash_balance_update;
844             sub cash_balances;
845             sub cash_transction;
846             sub charge;
847             sub charge_capture;
848             sub charge_create;
849             sub charge_list;
850             sub charge_retrieve;
851             sub charge_search;
852             sub charge_update;
853             sub charges;
854             sub checkout_session;
855             sub checkout_session_create;
856             sub checkout_session_expire;
857             sub checkout_session_items;
858             sub checkout_session_list;
859             sub checkout_session_retrieve;
860             sub checkout_sessions;
861             sub code_verification;
862             sub company;
863             sub connection_token;
864             sub country_spec;
865             sub country_spec_list;
866             sub country_spec_retrieve;
867             sub country_specs;
868             sub coupon;
869             sub coupon_create;
870             sub coupon_delete;
871             sub coupon_list;
872             sub coupon_retrieve;
873             sub coupon_update;
874             sub coupons;
875             sub credit_note;
876             sub credit_note_create;
877             sub credit_note_line_item;
878             sub credit_note_line_item_list;
879             sub credit_note_line_items;
880             sub credit_note_lines;
881             sub credit_note_lines_preview;
882             sub credit_note_list;
883             sub credit_note_preview;
884             sub credit_note_retrieve;
885             sub credit_note_update;
886             sub credit_note_void;
887             sub credit_notes;
888             sub customer;
889             sub customer_balance_transaction;
890             sub customer_balance_transaction_create;
891             sub customer_balance_transaction_list;
892             sub customer_balance_transaction_retrieve;
893             sub customer_balance_transaction_update;
894             sub customer_balance_transactions;
895             sub customer_bank_account;
896             sub customer_bank_account_create;
897             sub customer_bank_account_delete;
898             sub customer_bank_account_list;
899             sub customer_bank_account_retrieve;
900             sub customer_bank_account_update;
901             sub customer_bank_account_verify;
902             sub customer_bank_accounts;
903             sub customer_cash_balance_transaction;
904             sub customer_cash_balance_transaction_fund_cash_balance;
905             sub customer_cash_balance_transaction_list;
906             sub customer_cash_balance_transaction_retrieve;
907             sub customer_cash_balance_transactions;
908             sub customer_create;
909             sub customer_delete;
910             sub customer_delete_discount;
911             sub customer_list;
912             sub customer_payment_method;
913             sub customer_payment_methods;
914             sub customer_retrieve;
915             sub customer_search;
916             sub customer_tax_id;
917             sub customer_update;
918             sub customers;
919             sub cvc_update_token_create;
920             sub data;
921             sub discount;
922             sub discount_delete;
923             sub discounts;
924             sub dispute;
925             sub dispute_close;
926             sub dispute_evidence;
927             sub dispute_list;
928             sub dispute_retrieve;
929             sub dispute_update;
930             sub disputes;
931             sub document;
932             sub event;
933             sub event_list;
934             sub event_retrieve;
935             sub events;
936             sub evidence;
937             sub evidence_details;
938             sub fee_refund;
939             sub fee_refund_create;
940             sub fee_refund_list;
941             sub fee_refund_retrieve;
942             sub fee_refund_update;
943             sub fee_refunds;
944             sub file;
945             sub file_create;
946             sub file_link;
947             sub file_link_create;
948             sub file_link_list;
949             sub file_link_retrieve;
950             sub file_link_update;
951             sub file_links;
952             sub file_list;
953             sub file_retrieve;
954             sub files;
955             sub financial_connections_account;
956             sub financial_connections_account_disconnect;
957             sub financial_connections_account_list;
958             sub financial_connections_account_owner;
959             sub financial_connections_account_owner_list;
960             sub financial_connections_account_owners;
961             sub financial_connections_account_ownership;
962             sub financial_connections_account_refresh;
963             sub financial_connections_account_retrieve;
964             sub financial_connections_accounts;
965             sub financial_connections_session;
966             sub financial_connections_session_create;
967             sub financial_connections_session_retrieve;
968             sub financial_connections_sessions;
969             sub fraud;
970             sub funding_instructions;
971             sub funding_instructions_create;
972             sub funding_instructions_fund;
973             sub funding_instructions_list;
974             sub funding_instructionss;
975             sub identity_verification_report;
976             sub identity_verification_report_list;
977             sub identity_verification_report_retrieve;
978             sub identity_verification_reports;
979             sub identity_verification_session;
980             sub identity_verification_session_cancel;
981             sub identity_verification_session_create;
982             sub identity_verification_session_list;
983             sub identity_verification_session_redact;
984             sub identity_verification_session_retrieve;
985             sub identity_verification_session_update;
986             sub identity_verification_sessions;
987             sub invoice;
988             sub invoice_create;
989             sub invoice_delete;
990             sub invoice_finalise;
991             sub invoice_finalize;
992             sub invoice_item;
993             sub invoice_item_create;
994             sub invoice_item_delete;
995             sub invoice_item_list;
996             sub invoice_item_retrieve;
997             sub invoice_item_update;
998             sub invoice_items;
999             sub invoice_line_item;
1000             sub invoice_lines;
1001             sub invoice_lines_upcoming;
1002             sub invoice_list;
1003             sub invoice_pay;
1004             sub invoice_retrieve;
1005             sub invoice_search;
1006             sub invoice_send;
1007             sub invoice_settings;
1008             sub invoice_uncollectible;
1009             sub invoice_upcoming;
1010             sub invoice_update;
1011             sub invoice_void;
1012             sub invoice_write_off;
1013             sub invoiceitem;
1014             sub invoiceitem_create;
1015             sub invoiceitem_delete;
1016             sub invoiceitem_list;
1017             sub invoiceitem_retrieve;
1018             sub invoiceitem_update;
1019             sub invoiceitems;
1020             sub invoices;
1021             sub ip_address_location;
1022             sub issuing_authorization;
1023             sub issuing_authorization_approve;
1024             sub issuing_authorization_decline;
1025             sub issuing_authorization_list;
1026             sub issuing_authorization_retrieve;
1027             sub issuing_authorization_update;
1028             sub issuing_authorizations;
1029             sub issuing_card;
1030             sub issuing_card_create;
1031             sub issuing_card_deliver;
1032             sub issuing_card_fail;
1033             sub issuing_card_list;
1034             sub issuing_card_retrieve;
1035             sub issuing_card_return;
1036             sub issuing_card_ship;
1037             sub issuing_card_update;
1038             sub issuing_cardholder;
1039             sub issuing_cardholder_create;
1040             sub issuing_cardholder_list;
1041             sub issuing_cardholder_retrieve;
1042             sub issuing_cardholder_update;
1043             sub issuing_cardholders;
1044             sub issuing_cards;
1045             sub issuing_dispute;
1046             sub issuing_dispute_create;
1047             sub issuing_dispute_list;
1048             sub issuing_dispute_retrieve;
1049             sub issuing_dispute_submit;
1050             sub issuing_dispute_update;
1051             sub issuing_disputes;
1052             sub issuing_transaction;
1053             sub issuing_transaction_list;
1054             sub issuing_transaction_retrieve;
1055             sub issuing_transaction_update;
1056             sub issuing_transactions;
1057             sub item;
1058             sub line_item;
1059             sub line_item_lines;
1060             sub line_items;
1061             sub location;
1062             sub login_link;
1063             sub login_link_create;
1064             sub login_links;
1065             sub mandate;
1066             sub mandate_retrieve;
1067             sub mandates;
1068             sub merchant_data;
1069             sub next_action;
1070             sub order;
1071             sub order_item;
1072             sub outcome;
1073             sub owner;
1074             sub package_dimensions;
1075             sub payment_intent;
1076             sub payment_intent_apply_customer_balance;
1077             sub payment_intent_cancel;
1078             sub payment_intent_capture;
1079             sub payment_intent_confirm;
1080             sub payment_intent_create;
1081             sub payment_intent_increment;
1082             sub payment_intent_increment_authorization;
1083             sub payment_intent_list;
1084             sub payment_intent_reconcile;
1085             sub payment_intent_retrieve;
1086             sub payment_intent_search;
1087             sub payment_intent_update;
1088             sub payment_intent_verify;
1089             sub payment_intent_verify_microdeposits;
1090             sub payment_intents;
1091             sub payment_link;
1092             sub payment_link_create;
1093             sub payment_link_items;
1094             sub payment_link_line_items;
1095             sub payment_link_list;
1096             sub payment_link_retrieve;
1097             sub payment_link_update;
1098             sub payment_links;
1099             sub payment_method;
1100             sub payment_method_attach;
1101             sub payment_method_create;
1102             sub payment_method_detach;
1103             sub payment_method_details;
1104             sub payment_method_list;
1105             sub payment_method_list_customer_payment_methods;
1106             sub payment_method_retrieve;
1107             sub payment_method_retrieve_customer_payment_method;
1108             sub payment_method_update;
1109             sub payment_methods;
1110             sub payout;
1111             sub payout_cancel;
1112             sub payout_create;
1113             sub payout_list;
1114             sub payout_retrieve;
1115             sub payout_reverse;
1116             sub payout_update;
1117             sub payouts;
1118             sub period;
1119             sub person;
1120             sub person_create;
1121             sub person_delete;
1122             sub person_list;
1123             sub person_retrieve;
1124             sub person_token_create;
1125             sub person_update;
1126             sub persons;
1127             sub pii_token_create;
1128             sub plan;
1129             sub plan_by_product;
1130             sub plan_create;
1131             sub plan_delete;
1132             sub plan_list;
1133             sub plan_retrieve;
1134             sub plan_update;
1135             sub plans;
1136             sub portal_configuration;
1137             sub portal_configuration_create;
1138             sub portal_configuration_list;
1139             sub portal_configuration_retrieve;
1140             sub portal_configuration_update;
1141             sub portal_configurations;
1142             sub portal_session;
1143             sub portal_session_create;
1144             sub portal_sessions;
1145             sub price;
1146             sub price_create;
1147             sub price_list;
1148             sub price_retrieve;
1149             sub price_search;
1150             sub price_update;
1151             sub prices;
1152             sub product;
1153             sub product_by_name;
1154             sub product_create;
1155             sub product_delete;
1156             sub product_list;
1157             sub product_retrieve;
1158             sub product_search;
1159             sub product_update;
1160             sub products;
1161             sub promotion_code;
1162             sub promotion_code_create;
1163             sub promotion_code_list;
1164             sub promotion_code_retrieve;
1165             sub promotion_code_update;
1166             sub promotion_codes;
1167             sub quote;
1168             sub quote_accept;
1169             sub quote_cancel;
1170             sub quote_create;
1171             sub quote_download;
1172             sub quote_finalize;
1173             sub quote_line_items;
1174             sub quote_lines;
1175             sub quote_list;
1176             sub quote_retrieve;
1177             sub quote_update;
1178             sub quote_upfront_line_items;
1179             sub quote_upfront_lines;
1180             sub quotes;
1181             sub radar_early_fraud_warning;
1182             sub radar_early_fraud_warning_list;
1183             sub radar_early_fraud_warning_retrieve;
1184             sub radar_early_fraud_warnings;
1185             sub radar_value_list;
1186             sub radar_value_list_create;
1187             sub radar_value_list_delete;
1188             sub radar_value_list_item;
1189             sub radar_value_list_item_create;
1190             sub radar_value_list_item_delete;
1191             sub radar_value_list_item_list;
1192             sub radar_value_list_item_retrieve;
1193             sub radar_value_list_items;
1194             sub radar_value_list_list;
1195             sub radar_value_list_retrieve;
1196             sub radar_value_list_update;
1197             sub radar_value_lists;
1198             sub reader;
1199             sub receiver;
1200             sub redirect;
1201             sub refund;
1202             sub refund_cancel;
1203             sub refund_create;
1204             sub refund_list;
1205             sub refund_retrieve;
1206             sub refund_update;
1207             sub refunds;
1208             sub relationship;
1209             sub reporting_report_run;
1210             sub reporting_report_run_create;
1211             sub reporting_report_run_list;
1212             sub reporting_report_run_retrieve;
1213             sub reporting_report_runs;
1214             sub reporting_report_type;
1215             sub reporting_report_type_list;
1216             sub reporting_report_type_retrieve;
1217             sub reporting_report_types;
1218             sub request;
1219             sub requirements;
1220             sub return;
1221             sub review;
1222             sub review_approve;
1223             sub review_list;
1224             sub review_retrieve;
1225             sub reviews;
1226             sub schedule;
1227             sub schedule_cancel;
1228             sub schedule_create;
1229             sub schedule_list;
1230             sub schedule_query;
1231             sub schedule_release;
1232             sub schedule_retrieve;
1233             sub schedule_update;
1234             sub scheduled_query_run;
1235             sub scheduled_query_run_list;
1236             sub scheduled_query_run_retrieve;
1237             sub scheduled_query_runs;
1238             sub schedules;
1239             sub session;
1240             sub session_create;
1241             sub session_expire;
1242             sub session_list;
1243             sub session_retrieve;
1244             sub session_retrieve_items;
1245             sub sessions;
1246             sub settings;
1247             sub setup_attempt;
1248             sub setup_attempt_list;
1249             sub setup_attempts;
1250             sub setup_intent;
1251             sub setup_intent_cancel;
1252             sub setup_intent_confirm;
1253             sub setup_intent_create;
1254             sub setup_intent_list;
1255             sub setup_intent_retrieve;
1256             sub setup_intent_update;
1257             sub setup_intent_verify;
1258             sub setup_intent_verify_microdeposits;
1259             sub setup_intents;
1260             sub shipping;
1261             sub shipping_rate;
1262             sub shipping_rate_create;
1263             sub shipping_rate_list;
1264             sub shipping_rate_retrieve;
1265             sub shipping_rate_update;
1266             sub shipping_rates;
1267             sub sku;
1268             sub source;
1269             sub source_attach;
1270             sub source_create;
1271             sub source_detach;
1272             sub source_order;
1273             sub source_retrieve;
1274             sub source_update;
1275             sub sources;
1276             sub status_transitions;
1277             sub subscription;
1278             sub subscription_cancel;
1279             sub subscription_create;
1280             sub subscription_delete;
1281             sub subscription_delete_discount;
1282             sub subscription_item;
1283             sub subscription_item_create;
1284             sub subscription_item_delete;
1285             sub subscription_item_list;
1286             sub subscription_item_retrieve;
1287             sub subscription_item_update;
1288             sub subscription_items;
1289             sub subscription_list;
1290             sub subscription_retrieve;
1291             sub subscription_schedule;
1292             sub subscription_schedule_cancel;
1293             sub subscription_schedule_create;
1294             sub subscription_schedule_list;
1295             sub subscription_schedule_release;
1296             sub subscription_schedule_retrieve;
1297             sub subscription_schedule_update;
1298             sub subscription_schedules;
1299             sub subscription_search;
1300             sub subscription_update;
1301             sub subscriptions;
1302             sub tax_code;
1303             sub tax_code_list;
1304             sub tax_code_retrieve;
1305             sub tax_codes;
1306             sub tax_id;
1307             sub tax_id_create;
1308             sub tax_id_delete;
1309             sub tax_id_list;
1310             sub tax_id_retrieve;
1311             sub tax_ids;
1312             sub tax_rate;
1313             sub tax_rate_create;
1314             sub tax_rate_list;
1315             sub tax_rate_retrieve;
1316             sub tax_rate_update;
1317             sub tax_rates;
1318             sub terminal_configuration;
1319             sub terminal_configuration_create;
1320             sub terminal_configuration_delete;
1321             sub terminal_configuration_list;
1322             sub terminal_configuration_retrieve;
1323             sub terminal_configuration_update;
1324             sub terminal_configurations;
1325             sub terminal_connection_token;
1326             sub terminal_connection_token_create;
1327             sub terminal_connection_tokens;
1328             sub terminal_location;
1329             sub terminal_location_create;
1330             sub terminal_location_delete;
1331             sub terminal_location_list;
1332             sub terminal_location_retrieve;
1333             sub terminal_location_update;
1334             sub terminal_locations;
1335             sub terminal_reader;
1336             sub terminal_reader_cancel_action;
1337             sub terminal_reader_create;
1338             sub terminal_reader_delete;
1339             sub terminal_reader_list;
1340             sub terminal_reader_present_payment_method;
1341             sub terminal_reader_process_payment_intent;
1342             sub terminal_reader_process_setup_intent;
1343             sub terminal_reader_retrieve;
1344             sub terminal_reader_set_reader_display;
1345             sub terminal_reader_update;
1346             sub terminal_readers;
1347             sub test_helpers_test_clock;
1348             sub test_helpers_test_clock_advance;
1349             sub test_helpers_test_clock_create;
1350             sub test_helpers_test_clock_delete;
1351             sub test_helpers_test_clock_list;
1352             sub test_helpers_test_clock_retrieve;
1353             sub test_helpers_test_clocks;
1354             sub token;
1355             sub token_create;
1356             sub token_create_account;
1357             sub token_create_bank_account;
1358             sub token_create_card;
1359             sub token_create_cvc_update;
1360             sub token_create_person;
1361             sub token_create_pii;
1362             sub token_retrieve;
1363             sub tokens;
1364             sub topup;
1365             sub topup_cancel;
1366             sub topup_create;
1367             sub topup_list;
1368             sub topup_retrieve;
1369             sub topup_update;
1370             sub topups;
1371             sub tos_acceptance;
1372             sub transfer;
1373             sub transfer_create;
1374             sub transfer_data;
1375             sub transfer_list;
1376             sub transfer_retrieve;
1377             sub transfer_reversal;
1378             sub transfer_reversal_create;
1379             sub transfer_reversal_list;
1380             sub transfer_reversal_retrieve;
1381             sub transfer_reversal_update;
1382             sub transfer_reversals;
1383             sub transfer_update;
1384             sub transfers;
1385             sub transform_usage;
1386             sub treasury_credit_reversal;
1387             sub treasury_credit_reversal_create;
1388             sub treasury_credit_reversal_list;
1389             sub treasury_credit_reversal_retrieve;
1390             sub treasury_credit_reversals;
1391             sub treasury_debit_reversal;
1392             sub treasury_debit_reversal_create;
1393             sub treasury_debit_reversal_list;
1394             sub treasury_debit_reversal_retrieve;
1395             sub treasury_debit_reversals;
1396             sub treasury_financial_account;
1397             sub treasury_financial_account_create;
1398             sub treasury_financial_account_features;
1399             sub treasury_financial_account_features_retrieve;
1400             sub treasury_financial_account_features_update;
1401             sub treasury_financial_account_featuress;
1402             sub treasury_financial_account_list;
1403             sub treasury_financial_account_retrieve;
1404             sub treasury_financial_account_update;
1405             sub treasury_financial_accounts;
1406             sub treasury_inbound_transfer;
1407             sub treasury_inbound_transfer_cancel;
1408             sub treasury_inbound_transfer_create;
1409             sub treasury_inbound_transfer_fail;
1410             sub treasury_inbound_transfer_list;
1411             sub treasury_inbound_transfer_retrieve;
1412             sub treasury_inbound_transfer_return;
1413             sub treasury_inbound_transfer_succeed;
1414             sub treasury_inbound_transfers;
1415             sub treasury_outbound_payment;
1416             sub treasury_outbound_payment_cancel;
1417             sub treasury_outbound_payment_create;
1418             sub treasury_outbound_payment_fail;
1419             sub treasury_outbound_payment_list;
1420             sub treasury_outbound_payment_post;
1421             sub treasury_outbound_payment_retrieve;
1422             sub treasury_outbound_payment_return;
1423             sub treasury_outbound_payments;
1424             sub treasury_outbound_transfer;
1425             sub treasury_outbound_transfer_cancel;
1426             sub treasury_outbound_transfer_create;
1427             sub treasury_outbound_transfer_fail;
1428             sub treasury_outbound_transfer_list;
1429             sub treasury_outbound_transfer_post;
1430             sub treasury_outbound_transfer_retrieve;
1431             sub treasury_outbound_transfer_return;
1432             sub treasury_outbound_transfers;
1433             sub treasury_received_credit;
1434             sub treasury_received_credit_list;
1435             sub treasury_received_credit_received_credit;
1436             sub treasury_received_credit_retrieve;
1437             sub treasury_received_credits;
1438             sub treasury_received_debit;
1439             sub treasury_received_debit_list;
1440             sub treasury_received_debit_received_debit;
1441             sub treasury_received_debit_retrieve;
1442             sub treasury_received_debits;
1443             sub treasury_transaction;
1444             sub treasury_transaction_entry;
1445             sub treasury_transaction_entry_list;
1446             sub treasury_transaction_entry_retrieve;
1447             sub treasury_transaction_entrys;
1448             sub treasury_transaction_list;
1449             sub treasury_transaction_retrieve;
1450             sub treasury_transactions;
1451             sub usage_record;
1452             sub usage_record_create;
1453             sub usage_record_list;
1454             sub usage_record_summary;
1455             sub usage_records;
1456             sub value_list;
1457             sub value_list_item;
1458             sub verification;
1459             sub verification_data;
1460             sub verification_fields;
1461             sub webhook;
1462             sub webhook_endpoint;
1463             sub webhook_endpoint_create;
1464             sub webhook_endpoint_delete;
1465             sub webhook_endpoint_list;
1466             sub webhook_endpoint_retrieve;
1467             sub webhook_endpoint_update;
1468             sub webhook_endpoints;
1469              
1470             {
1471             my $self = shift( @_ );
1472             # $self->{token} = '' unless( length( $self->{token} ) );
1473 0     0 1   $self->{amount} = '' unless( length( $self->{amount} ) );
1474             $self->{currency} ||= 'jpy';
1475 0 0         $self->{description} = '' unless( length( $self->{description} ) );
1476 0   0       $self->{card} = '' unless( length( $self->{card} ) );
1477 0 0         $self->{version} = '' unless( length( $self->{version} ) );
1478 0 0         $self->{key} = '' unless( length( $self->{key} ) );
1479 0 0         $self->{cookie_file} = '' unless( length( $self->{cookie_file} ) );
1480 0 0         $self->{browser} = $BROWSER unless( length( $self->{browser} ) );
1481 0 0         $self->{encode_with_json} = 0 unless( length( $self->{encode_with_json} ) );
1482 0 0         $self->{api_uri} = URI->new( API_BASE ) unless( length( $self->{api_uri} ) );
1483 0 0         $self->{file_api_uri} = URI->new( FILES_BASE ) unless( length( $self->{file_api_uri} ) );
1484 0 0         # Ask Module::Generic to check if corresponding method exists for each parameter submitted,
1485 0 0         # and if so, use it to set the value of the key in hash parameters
1486             $self->{_init_strict_use_sub} = 1;
1487             $self->{temp_dir} = sys_tmpdir() unless( length( $self->{temp_dir} ) );
1488 0           # 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.
1489 0 0         $self->{livemode} = '';
1490             $self->{ignore_unknown_parameters} = '' unless( length( $self->{ignore_unknown_parameters} ) );
1491 0           $self->{expand} = '' unless( length( $self->{expand} ) );
1492 0 0         # Json configuration file
1493 0 0         $self->{conf_file} = '';
1494             $self->{conf_data} = {};
1495 0           $self->{_exception_class} = $EXCEPTION_CLASS;
1496 0           $self->SUPER::init( @_ ) || return( $self->pass_error );
1497 0           if( $self->{conf_file} )
1498 0 0         {
1499 0 0         my $json = $self->{conf_data};
1500             $self->{livemode} = $json->{livemode} if( CORE::length( $json->{livemode} ) && !CORE::length( $self->{livemode} ) );
1501 0           if( !$self->{key} )
1502 0 0 0       {
1503 0 0         $self->{key} = $self->{livemode} ? $json->{live_secret_key} : $json->{test_secret_key};
1504             }
1505 0 0         for( qw( browser cookie_file temp_dir version ) )
1506             {
1507 0           $self->{ $_ } = $json->{ $_ } if( !$self->{ $_ } && length( $json->{ $_ } ) );
1508             }
1509 0 0 0       }
1510             $self->{stripe_error} = '';
1511             $self->{http_response} = '';
1512 0           $self->{http_request} = '';
1513 0           CORE::return( $self->error( "No Stripe API private key was provided!" ) ) if( !$self->{key} );
1514 0           CORE::return( $self->error( "No Stripe api version was specified. I was expecting something like ''." ) ) if( !$self->{version} );
1515 0 0         $self->key( $self->{key} );
1516 0 0         $self->livemode( $self->{key} =~ /_live/ ? 1 : 0 );
1517 0           CORE::return( $self );
1518 0 0         }
1519 0            
1520             # NOTE: core method
1521             {
1522             my $self = shift( @_ );
1523             if( @_ )
1524             {
1525 0     0 1   my $url = shift( @_ );
1526 0 0         try
1527             {
1528 0           $self->{api_uri} = URI->new( $url );
1529 0 0 0       }
  0            
  0            
  0            
  0            
  0            
  0            
  0            
1530 0     0     catch( $e )
1531 0           {
1532             CORE::return( $self->error( "Bad URI ($url) provided for base Stripe api: $e" ) );
1533 0 0 0       }
  0 0 0        
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  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->{api_uri}->clone ) if( Scalar::Util::blessed( $self->{api_uri} ) && $self->{api_uri}->isa( 'URI' ) );
1536 1 0 0 1   9 CORE::return( $self->{api_uri} );
  1 0 0     2  
  1 0 0     1231  
  0 0 0        
  0 0 0        
  0 0 0        
  0 0 0        
  0 0 0        
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 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        
1539 0           # NOTE: core method
1540              
1541             # NOTE: core method
1542              
1543 0     0 0   # NOTE: core method
1544             {
1545             my $self = shift( @_ );
1546 0     0 1   my $code = shift( @_ ) || CORE::return( $self->error( "No code was provided to get the related error" ) );
1547             CORE::return( $self->error( "No code found for $code" ) ) if( !exists( $ERROR_CODE_TO_STRING->{ $code } ) );
1548             CORE::return( $ERROR_CODE_TO_STRING->{ $code } );
1549             }
1550              
1551 0     0 1   # sub connect { CORE::return( shift->_instantiate( 'connect', 'Net::API::Stripe::Connect' ) ) }
1552 0   0       # NOTE: core method
1553 0 0         {
1554 0           my $self = shift( @_ );
1555             if( @_ )
1556             {
1557             my $file = shift( @_ );
1558             my $f = Module::Generic::File::file( $file );
1559             if( !$f->exists )
1560             {
1561 0     0 1   CORE::return( $self->error( "Configuration file $file does not exist." ) );
1562 0 0         }
1563             elsif( $f->is_empty )
1564 0           {
1565 0           CORE::return( $self->error( "Configuration file $file is empty." ) );
1566 0 0         }
    0          
1567             my $data = $f->load_utf8 ||
1568 0           CORE::return( $self->error( "Unable to open configuration file $file: ", $f->error ) );
1569             try
1570             {
1571             my $json = JSON->new->relaxed->decode( $data );
1572 0           $self->{conf_data} = $json;
1573             $self->{conf_file} = $file;
1574 0   0       }
1575             catch( $e )
1576 0 0 0       {
  0            
  0            
  0            
  0            
  0            
  0            
  0            
1577 0     0     CORE::return( $self->error( "An error occured while json decoding configuration file $file: $e" ) );
1578 0           }
1579 0           }
1580 0           CORE::return( $self->{conf_data} );
1581             }
1582 0 0 0        
  0 0 0        
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  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     # NOTE: core method
1584 0            
1585 1 0 0 1   8 # NOTE: core method
  1 0 0     2  
  1 0 0     444  
  0 0 0        
  0 0 0        
  0 0 0        
  0 0 0        
  0 0 0        
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 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           my $self = shift( @_ );
1588             if( @_ )
1589             {
1590             $self->_set_get( 'currency', lc( shift( @_ ) ) );
1591 0     0 0   }
1592             CORE::return( $self->{ 'currency' } );
1593             }
1594              
1595             # NOTE: core method
1596 0     0 1   {
1597 0 0         my $self = shift( @_ );
1598             my $path = shift( @_ ) || CORE::return( $self->error( "No api endpoint (path) was provided." ) );
1599 0           my $args = shift( @_ );
1600             CORE::return( $self->error( "http query parameters provided were not a hash reference." ) ) if( $args && ref( $args ) ne 'HASH' );
1601 0           my $api = $self->api_uri->clone;
1602             if( $self->_is_object( $path ) && $path->can( 'path' ) )
1603             {
1604             $api->path( undef() );
1605             $path = $path->path;
1606             }
1607 0     0 1   else
1608 0   0       {
1609 0           substr( $path, 0, 0 ) = '/' unless( substr( $path, 0, 1 ) eq '/' );
1610 0 0 0       }
1611 0           $path .= '?' . $self->_encode_params( $args ) if( $args && %$args );
1612 0 0 0       my $req = HTTP::Promise::Request->new( 'DELETE', $api . $path );
1613             CORE::return( $self->_make_request( $req ) );
1614 0           }
1615 0            
1616             # NOTE: core method
1617              
1618             # NOTE: core method
1619 0 0         # Can be 'all' or an integer representing a depth
1620              
1621 0 0 0       # NOTE: core method
1622 0           {
1623 0           my $self = shift( @_ );
1624             my $type = shift( @_ ) || CORE::return( $self->error( "No object type was provided to get its list of methods." ) );
1625             my $class;
1626             if( $class = $self->_is_object( $type ) )
1627 0     0 1   {
1628             }
1629             else
1630             {
1631 0     0 1   $class = $self->_object_type_to_class( $type );
1632             }
1633             no strict 'refs';
1634             if( !$self->_is_class_loaded( $class ) )
1635             {
1636 0     0 1   $self->_load_class( $class );
1637 0   0       }
1638 0           my @methods = grep{ defined &{"${class}::$_"} } keys( %{"${class}::"} );
1639 0 0         CORE::return( \@methods );
1640             }
1641              
1642             # NOTE: core method
1643             {
1644 0           my $self = shift( @_ );
1645             if( @_ )
1646 1     1   6 {
  1         2  
  1         1000  
1647 0 0         my $url = shift( @_ );
1648             try
1649 0           {
1650             $self->{file_api_uri} = URI->new( $url );
1651 0           }
  0            
  0            
  0            
1652 0           catch( $e )
1653             {
1654             CORE::return( $self->error( "Bad URI ($url) provided for base files Stripe api: $e" ) );
1655             }
1656             }
1657             CORE::return( $self->{file_api_uri}->clone ) if( Scalar::Util::blessed( $self->{file_api_uri} ) && $self->{file_api_uri}->isa( 'URI' ) );
1658 0     0 0   CORE::return( $self->{file_api_uri} );
1659 0 0         }
1660              
1661 0           # NOTE: core method
1662 0 0 0       {
  0            
  0            
  0            
  0            
  0            
  0            
  0            
1663 0     0     CORE::return( Data::UUID->new->create_str );
1664 0           }
1665              
1666 0 0 0       # NOTE: core method
  0 0 0        
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  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           my $self = shift( @_ );
1669 1 0 0 1   8 my $path = shift( @_ ) || CORE::return( $self->error( "No api endpoint (path) was provided." ) );
  1 0 0     1  
  1 0 0     2467  
  0 0 0        
  0 0 0        
  0 0 0        
  0 0 0        
  0 0 0        
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 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             my $args = shift( @_ );
1671 0 0 0       CORE::return( $self->error( "http query parameters provided were not a hash reference." ) ) if( $args && ref( $args ) ne 'HASH' );
1672 0           my $expand = $self->expand;
1673             if( ( !exists( $args->{expand} ) &&
1674             (
1675             $expand eq 'all' ||
1676             ( $expand =~ /^\d+$/ && $expand > 2 )
1677             )
1678 0     0 1   )
1679             ||
1680             (
1681             exists( $args->{expand} ) &&
1682             (
1683             $args->{expand} eq 'all' ||
1684 0     0 1   ( $args->{expand} =~ /^\d+$/ && $args->{expand} > 2 )
1685 0   0       )
1686 0           ) )
1687 0 0 0       {
1688 0           # Because anything more will likely trigger URI too long
1689 0 0 0       $args->{expand} = 2;
      0        
      0        
      0        
      0        
1690             }
1691             my $api = CORE::exists( $args->{_file_api} ) ? $self->file_api_uri->clone : $self->api_uri->clone;
1692             if( $self->_is_object( $path ) && $path->can( 'path' ) )
1693             {
1694             $api->path( undef() );
1695             $path = $path->path;
1696             }
1697             else
1698             {
1699             substr( $path, 0, 0 ) = '/' unless( substr( $path, 0, 1 ) eq '/' );
1700             }
1701             $path .= '?' . $self->_encode_params( $args ) if( $args && %$args );
1702             my $req = HTTP::Promise::Request->new( 'GET', $api . $path );
1703             CORE::return( $self->_make_request( $req ) );
1704             }
1705 0            
1706             # NOTE: core method
1707 0 0         {
1708 0 0 0       my $self = shift( @_ );
1709             CORE::return( $self->{ua} ) if( $self->{ua} );
1710 0           my $cookie_file = $self->cookie_file;
1711 0           my $browser = $self->browser;
1712             # To be safe and ensure this works everywhere, we use the 'file' medium as shared data space
1713             my $ua = HTTP::Promise->new(
1714             # medium => 'file',
1715 0 0         timeout => 5,
1716             use_promise => 0,
1717 0 0 0       ( $self->debug > 3 ? ( debug => $self->debug ) : () ),
1718 0           );
1719 0           if( defined( $browser ) &&
1720             length( $browser ) )
1721             {
1722             $ua->agent( $browser );
1723             }
1724             if( defined( $cookie_file ) &&
1725 0     0 1   length( $cookie_file ) )
1726 0 0         {
1727 0           my $jar = Cookie::Jar->new( file => $cookie_file );
1728 0           $ua->cookie_jar( $jar );
1729             }
1730 0 0         $self->{ua} = $ua;
1731             CORE::return( $ua );
1732             }
1733              
1734             # NOTE: core method
1735              
1736 0 0 0       # NOTE: core method
1737              
1738             # NOTE: core method
1739 0            
1740             # NOTE: core method
1741 0 0 0        
1742             # NOTE: core method
1743             {
1744 0           my $self = shift( @_ );
1745 0           if( @_ )
1746             {
1747 0           my $key = $self->{key} = shift( @_ );
1748 0           my $auth = 'Basic ' . MIME::Base64::encode_base64( $key . ':' );
1749             $self->auth( $auth );
1750             }
1751             CORE::return( $self->{key} );
1752 0     0 1   }
1753              
1754             # NOTE: core method
1755 0     0 1    
1756             # NOTE: core method
1757             {
1758 0     0 1   my $self = shift( @_ );
1759             my $path = shift( @_ ) || CORE::return( $self->error( "No api endpoint (path) was provided." ) );
1760             my $args = shift( @_ );
1761 0     0 1   CORE::return( $self->error( "http query parameters provided were not a hash reference." ) ) if( $args && ref( $args ) ne 'HASH' );
1762             my $api = $self->api_uri->clone;
1763             if( $self->_is_object( $path ) && $path->can( 'path' ) )
1764             {
1765             $api->path( undef() );
1766 0     0 1   $path = $path->path;
1767 0 0         }
1768             else
1769 0           {
1770 0           substr( $path, 0, 0 ) = '/' unless( substr( $path, 0, 1 ) eq '/' );
1771 0           }
1772             # my $ref = $self->_encode_params( $args );
1773 0           # $self->message( 3, $self->dump( $ref ) ); exit;
1774             my $h = [];
1775             if( exists( $args->{idempotency} ) )
1776             {
1777 0     0 1   $args->{idempotency} = $self->generate_uuid if( !length( $args->{idempotency} ) );
1778             push( @$h, 'Idempotency-Key', CORE::delete( $args->{idempotency} ) );
1779             }
1780             my $req = HTTP::Promise::Request->new(
1781             'POST', $api . $path,
1782 0     0 1   $h,
1783 0   0       ( $args ? $self->_encode_params( $args ) : undef() )
1784 0           );
1785 0 0 0       CORE::return( $self->_make_request( $req ) );
1786 0           }
1787 0 0 0        
1788             # NOTE: core method
1789 0           # Using rfc2388 rules
1790 0           # https://tools.ietf.org/html/rfc2388
1791             {
1792             my $self = shift( @_ );
1793             my $path = shift( @_ ) || CORE::return( $self->error( "No api endpoint (path) was provided." ) );
1794 0 0         my $args = shift( @_ );
1795             CORE::return( $self->error( "http query parameters provided were not a hash reference." ) ) if( $args && ref( $args ) ne 'HASH' );
1796             my $api = $self->api_uri->clone;
1797             if( $self->_is_object( $path ) && $path->can( 'path' ) )
1798 0           {
1799 0 0         $api->path( undef() );
1800             $path = $path->path;
1801 0 0         }
1802 0           else
1803             {
1804 0 0         substr( $path, 0, 0 ) = '/' unless( substr( $path, 0, 1 ) eq '/' );
1805             }
1806             my $h = HTTP::Promise::Headers->new(
1807             Content_Type => 'multipart/form-data',
1808             );
1809 0           if( exists( $args->{idempotency} ) )
1810             {
1811             $args->{idempotency} = $self->generate_uuid if( !length( $args->{idempotency} ) );
1812             $h->header( 'Idempotency-Key' => CORE::delete( $args->{idempotency} ) );
1813             }
1814             my $req = HTTP::Promise::Request->new( POST => $api . $path, $h );
1815             my $data = $self->_encode_params_multipart( $args, { encoding => 'quoted-printable' } );
1816             foreach my $f ( keys( %$data ) )
1817 0     0 1   {
1818 0   0       foreach my $ref ( @{$data->{ $f }} )
1819 0           {
1820 0 0 0       if( $ref->{filename} )
1821 0           {
1822 0 0 0       my $fname = $ref->{filename};
1823             $req->add_part( HTTP::Promise::Message->new(
1824 0           HTTP::Promise::Headers->new(
1825 0           Content_Disposition => "form-data; name=\"${f}\"; filename=\"${fname}\"",
1826             Content_Type => ( $ref->{type} ? $ref->{type} : 'application/octet-stream' ),
1827             ( $ref->{encoding} ? ( Content_Transfer_Encoding => $ref->{encoding} ) : undef() ),
1828             Content_Length => CORE::length( $ref->{value} ),
1829 0 0         ),
1830             $ref->{value}
1831 0           ));
1832             }
1833             else
1834 0 0         {
1835             $ref->{type} ||= 'text/plain';
1836 0 0         $req->add_part( HTTP::Promise::Message->new(
1837 0           HTTP::Promise::Headers->new(
1838             Content_Disposition => "form-data; name=\"${f}\"",
1839 0           Content_Type => ( $ref->{type} eq 'text/plain' ? 'text/plain;charset="utf-8"' : $ref->{type} ),
1840 0           Content_Length => CORE::length( $ref->{value} ),
1841 0           Content_Transfer_Encoding => ( $ref->{encoding} ? $ref->{encoding} : '8bit' ),
1842             ),
1843 0           $ref->{value}
  0            
1844             ));
1845 0 0         }
1846             }
1847 0           }
1848             CORE::return( $self->_make_request( $req ) );
1849             }
1850              
1851             # NOTE: core method
1852              
1853             # NOTE: core method
1854             {
1855             my $self = shift( @_ );
1856 0 0         my $opts = {};
    0          
1857             $opts = shift( @_ ) if( @_ && ref( $_[0] ) eq 'HASH' );
1858             CORE::return( $self->error( "No webhook secret was provided." ) ) if( !$opts->{secret} );
1859             CORE::return( $self->error( "No Stripe signature was provided." ) ) if( !$opts->{signature} );
1860 0   0       CORE::return( $self->error( "No payload was provided." ) ) if( !CORE::length( $opts->{payload} ) );
1861             # 5 minutes
1862             $opts->{time_tolerance} ||= ( 5 * 60 );
1863             my $sig = $opts->{signature};
1864             my $max_time_spread = $opts->{time_tolerance};
1865             my $signing_secret = $opts->{secret};
1866             my $payload = $opts->{payload};
1867             $payload = Encode::decode_utf8( $payload ) if( !Encode::is_utf8( $payload ) );
1868            
1869 0 0         # Example:
    0          
1870             # Stripe-Signature: t=1492774577,
1871             # v1=5257a869e7ecebeda32affa62cdca3fa51cad7e77a0e56ff536d0ce8e108d8bd,
1872             # v0=6ffbb59b2300aae63f272406069a9788598b792a944a07aba816edb039989a39
1873 0           CORE::return( $self->error({ code => 400, message => "Event data received from Stripe is empty" }) ) if( !CORE::length( $sig ) );
1874             my @parts = split( /\,[[:blank:]]*/, $sig );
1875             my $q = {};
1876             for( @parts )
1877 0     0 1   {
1878             my( $n, $v ) = split( /[[:blank:]]*\=[[:blank:]]*/, $_, 2 );
1879             $q->{ $n } = $v;
1880             }
1881             CORE::return( $self->error({ code => 400, message => "No timestamp found in Stripe event data" }) ) if( !CORE::exists( $q->{t} ) );
1882 0     0 0   CORE::return( $self->error({ code => 400, message => "Timestamp is empty in Stripe event data received." }) ) if( !CORE::length( $q->{t} ) );
1883 0           CORE::return( $self->error({ code => 400, message => "No signature found in Stripe event data" }) ) if( !CORE::exists( $q->{v1} ) );
1884 0 0 0       CORE::return( $self->error({ code => 400, message => "Signature is empty in Stripe event data received." }) ) if( !CORE::length( $q->{v1} ) );
1885 0 0         # Must be a unix timestamp
1886 0 0         CORE::return( $self->error({ code => 400, message => "Invalid timestamp received in Stripe event data" }) ) if( $q->{t} !~ /^\d+$/ );
1887 0 0         # Must be a hash hmac with sha256, e.g. 5257a869e7ecebeda32affa62cdca3fa51cad7e77a0e56ff536d0ce8e108d8bd
1888             CORE::return( $self->error({ code => 400, message => "Invalid signature received in Stripe event data" }) ) if( $q->{v1} !~ /^[a-z0-9]{64}$/ );
1889 0   0       my $dt;
1890 0           try
1891 0           {
1892 0           $dt = DateTime->from_epoch( epoch => $q->{t}, time_zone => 'local' );
1893 0           }
1894 0 0         catch( $e )
1895             {
1896             CORE::return( $self->error({ code => 400, message => "Invalid timestamp ($q->{t}): $e" }) );
1897             }
1898            
1899             # This needs to be in real utf8, ie NOT perl internal utf8
1900 0 0         my $signed_payload = Encode::encode_utf8( join( '.', $q->{t}, $payload ) );
1901 0           my $expect_sign = Digest::SHA::hmac_sha256_hex( $signed_payload, $signing_secret );
1902 0           CORE::return( $self->error({ code => 401, message => "Invalid signature." }) ) if( $expect_sign ne $q->{v1} );
1903 0           my $time_diff = time() - $q->{t};
1904             CORE::return( $self->error({ code => 400, message => "Bad timestamp ($q->{t}). It is set in the future: $dt" }) ) if( $time_diff < 0 );
1905 0           CORE::return( $self->error({ code => 406, message => "Timestamp is too old." }) ) if( $time_diff >= $max_time_spread );
1906 0           CORE::return( 1 );
1907             }
1908 0 0          
1909 0 0         # NOTE: core method
1910 0 0         # https://stripe.com/docs/ips
1911 0 0         {
1912             my $self = shift( @_ );
1913 0 0         my $opts = {};
1914             $opts = shift( @_ ) if( @_ && ref( $_[0] ) eq 'HASH' );
1915 0 0         CORE::return( $self->error({ code => 500, message => "No ip address was provided to check." }) ) if( !$opts->{ip} );
1916 0           my $err = [];
1917 0 0 0       my $ips = STRIPE_WEBHOOK_SOURCE_IP;
  0            
  0            
  0            
  0            
  0            
  0            
  0            
1918 0     0     my $ip = Net::IP->new( $opts->{ip} ) || do
1919 0           {
1920             warn( "Warning only: IP '", ( $opts->{ip} // '' ), "' is not valid: ", Net::IP->Error, "\n" );
1921 0 0 0       push( @$err, sprintf( "IP '%s' is not valid: %s", ( $opts->{ip} // '' ), Net::IP->Error ) );
  0 0 0        
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  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     CORE::return( '' );
1923 0           };
1924 1 0 0 1   8 foreach my $stripe_ip ( @$ips )
  1 0 0     2  
  1 0 0     8147  
  0 0 0        
  0 0 0        
  0 0 0        
  0 0 0        
  0 0 0        
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 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             my $stripe_ip_object = Net::IP->new( $stripe_ip );
1927 0           # We found an existing ip same as the one we are adding, so we skip
1928 0           # If we are given a block that has some overlapping elements, we go ahead and add it
1929 0 0         # because it would become complicated and risky to only take the ips that do not overalp in the given block
1930 0           if( !( $ip->overlaps( $stripe_ip_object ) == $Net::IP::IP_NO_OVERLAP ) )
1931 0 0         {
1932 0 0         CORE::return( $ip );
1933 0           }
1934             }
1935             if( $opts->{ignore_ip} )
1936             {
1937             CORE::return( $ip );
1938             }
1939             else
1940 0     0 0   {
1941 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." }) );
1942 0 0 0       }
1943 0 0         }
1944 0            
1945 0           # NOTE: All methods below are auto-generated.
1946             {
1947 0   0       $AUTOLOAD_SUBS =
1948             {
1949             # NOTE: account()
1950             account => <<'PERL',
1951             sub account { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Connect::Account', @_ ) ); }
1952 0           PERL
1953             # NOTE: account_bank_account()
1954 0           account_bank_account => <<'PERL',
1955             sub account_bank_account { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Connect::ExternalAccount::Bank', @_ ) ); }
1956             PERL
1957             # NOTE: account_bank_account_create()
1958 0 0         account_bank_account_create => <<'PERL',
1959             sub account_bank_account_create
1960 0           {
1961             my $self = shift( @_ );
1962             my $args = shift( @_ );
1963 0 0         my $okParams =
1964             {
1965 0           expandable => { allowed => $EXPANDABLES->{ 'account_bank_account' } },
1966             default_for_currency => { type => "boolean" },
1967             external_account => { type => "string", required => 1 },
1968             metadata => { type => "hash" },
1969 0           };
1970             $args = $self->_contract( 'account_bank_account', $args ) || CORE::return( $self->pass_error );
1971             my $err = $self->_check_parameters( $okParams, $args );
1972             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
1973             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No account id (with parameter 'id') was provided to create its information." ) );
1974             my $hash = $self->post( "accounts/${id}", $args ) || CORE::return( $self->pass_error );
1975             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Connect::ExternalAccount::Bank', $hash ) );
1976 0     0     }
1977             PERL
1978             # NOTE: account_bank_account_delete()
1979             account_bank_account_delete => <<'PERL',
1980             sub account_bank_account_delete
1981             {
1982             my $self = shift( @_ );
1983             my $args = shift( @_ );
1984             my $okParams =
1985             {
1986             expandable => { allowed => $EXPANDABLES->{ 'account_bank_account' } },
1987             };
1988             $args = $self->_contract( 'account_bank_account', $args ) || CORE::return( $self->pass_error );
1989             my $err = $self->_check_parameters( $okParams, $args );
1990             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
1991             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." ) );
1992             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No account_bank_account id (with parameter 'id') was provided to delete its information." ) );
1993             my $hash = $self->delete( "accounts/${parent_id}/external_accounts/${id}", $args ) || CORE::return( $self->pass_error );
1994             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Connect::ExternalAccount::Bank', $hash ) );
1995             }
1996             PERL
1997             # NOTE: account_bank_account_list()
1998             account_bank_account_list => <<'PERL',
1999             sub account_bank_account_list
2000             {
2001             my $self = shift( @_ );
2002             CORE::return( $self->error( "No parameters were provided to list account bank account information." ) ) if( !scalar( @_ ) );
2003             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Connect::ExternalAccount::Bank', @_ );
2004             my $okParams =
2005             {
2006             expandable => { allowed => $EXPANDABLES->{ 'account_bank_account' }, data_prefix_is_ok => 1 },
2007             ending_before => { type => "string" },
2008             limit => { type => "string" },
2009             starting_after => { type => "string" },
2010             };
2011             my $err = $self->_check_parameters( $okParams, $args );
2012             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
2013             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No account id (with parameter 'id') was provided to list its information." ) );
2014             if( $args->{expand} )
2015             {
2016             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
2017             }
2018             my $hash = $self->get( "accounts/${id}?object=bank_account", $args ) || CORE::return( $self->pass_error );
2019             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Connect::ExternalAccount::Bank', $hash ) );
2020             }
2021             PERL
2022             # NOTE: account_bank_account_retrieve()
2023             account_bank_account_retrieve => <<'PERL',
2024             sub account_bank_account_retrieve
2025             {
2026             my $self = shift( @_ );
2027             my $args = shift( @_ );
2028             my $okParams =
2029             {
2030             expandable => { allowed => $EXPANDABLES->{ 'account_bank_account' }, data_prefix_is_ok => 1 },
2031             };
2032             $args = $self->_contract( 'account_bank_account', $args ) || CORE::return( $self->pass_error );
2033             my $err = $self->_check_parameters( $okParams, $args );
2034             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
2035             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." ) );
2036             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No account_bank_account id (with parameter 'id') was provided to retrieve its information." ) );
2037             my $hash = $self->get( "accounts/${parent_id}/external_accounts/${id}", $args ) || CORE::return( $self->pass_error );
2038             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Connect::ExternalAccount::Bank', $hash ) );
2039             }
2040             PERL
2041             # NOTE: account_bank_account_update()
2042             account_bank_account_update => <<'PERL',
2043             sub account_bank_account_update
2044             {
2045             my $self = shift( @_ );
2046             my $args = shift( @_ );
2047             my $okParams =
2048             {
2049             expandable => { allowed => $EXPANDABLES->{ 'account_bank_account' } },
2050             account_holder_name => { type => "string" },
2051             account_holder_type => { type => "string" },
2052             account_type => { type => "string" },
2053             default_for_currency => { type => "boolean" },
2054             metadata => { type => "hash" },
2055             };
2056             $args = $self->_contract( 'account_bank_account', $args ) || CORE::return( $self->pass_error );
2057             my $err = $self->_check_parameters( $okParams, $args );
2058             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
2059             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." ) );
2060             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No account_bank_account id (with parameter 'id') was provided to update its information." ) );
2061             my $hash = $self->post( "accounts/${parent_id}/external_accounts/${id}", $args ) || CORE::return( $self->pass_error );
2062             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Connect::ExternalAccount::Bank', $hash ) );
2063             }
2064             PERL
2065             # NOTE: account_bank_accounts()
2066             account_bank_accounts => <<'PERL',
2067             # <https://stripe.com/docs/api/external_accounts>
2068             sub account_bank_accounts
2069             {
2070             my $self = shift( @_ );
2071             my $allowed = [qw( create delete list retrieve update )];
2072             my $action = shift( @_ );
2073             my $meth = $self->_get_method( 'account_bank_account', $action, $allowed ) || CORE::return( $self->pass_error );
2074             CORE::return( $self->$meth( @_ ) );
2075             }
2076             PERL
2077             # NOTE: account_card()
2078             account_card => <<'PERL',
2079             sub account_card { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Connect::ExternalAccount::Card', @_ ) ); }
2080             PERL
2081             # NOTE: account_card_create()
2082             account_card_create => <<'PERL',
2083             sub account_card_create
2084             {
2085             my $self = shift( @_ );
2086             my $args = shift( @_ );
2087             my $okParams =
2088             {
2089             expandable => { allowed => $EXPANDABLES->{ 'account_card' } },
2090             default_for_currency => { type => "boolean" },
2091             external_account => { type => "string", required => 1 },
2092             metadata => { type => "hash" },
2093             };
2094             $args = $self->_contract( 'account_card', $args ) || CORE::return( $self->pass_error );
2095             my $err = $self->_check_parameters( $okParams, $args );
2096             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
2097             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No account id (with parameter 'id') was provided to create its information." ) );
2098             my $hash = $self->post( "accounts/${id}", $args ) || CORE::return( $self->pass_error );
2099             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Connect::ExternalAccount::Card', $hash ) );
2100             }
2101             PERL
2102             # NOTE: account_card_delete()
2103             account_card_delete => <<'PERL',
2104             sub account_card_delete
2105             {
2106             my $self = shift( @_ );
2107             my $args = shift( @_ );
2108             my $okParams =
2109             {
2110             expandable => { allowed => $EXPANDABLES->{ 'account_card' } },
2111             };
2112             $args = $self->_contract( 'account_card', $args ) || CORE::return( $self->pass_error );
2113             my $err = $self->_check_parameters( $okParams, $args );
2114             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
2115             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." ) );
2116             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No account_card id (with parameter 'id') was provided to delete its information." ) );
2117             my $hash = $self->delete( "accounts/${parent_id}/external_accounts/${id}", $args ) || CORE::return( $self->pass_error );
2118             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Connect::ExternalAccount::Card', $hash ) );
2119             }
2120             PERL
2121             # NOTE: account_card_list()
2122             account_card_list => <<'PERL',
2123             sub account_card_list
2124             {
2125             my $self = shift( @_ );
2126             CORE::return( $self->error( "No parameters were provided to list account card information." ) ) if( !scalar( @_ ) );
2127             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Connect::ExternalAccount::Card', @_ );
2128             my $okParams =
2129             {
2130             expandable => { allowed => $EXPANDABLES->{ 'account_card' }, data_prefix_is_ok => 1 },
2131             ending_before => { type => "string" },
2132             limit => { type => "string" },
2133             starting_after => { type => "string" },
2134             };
2135             my $err = $self->_check_parameters( $okParams, $args );
2136             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
2137             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No account id (with parameter 'id') was provided to list its information." ) );
2138             if( $args->{expand} )
2139             {
2140             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
2141             }
2142             my $hash = $self->get( "accounts/${id}?object=card", $args ) || CORE::return( $self->pass_error );
2143             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Connect::ExternalAccount::Card', $hash ) );
2144             }
2145             PERL
2146             # NOTE: account_card_retrieve()
2147             account_card_retrieve => <<'PERL',
2148             sub account_card_retrieve
2149             {
2150             my $self = shift( @_ );
2151             my $args = shift( @_ );
2152             my $okParams =
2153             {
2154             expandable => { allowed => $EXPANDABLES->{ 'account_card' }, data_prefix_is_ok => 1 },
2155             };
2156             $args = $self->_contract( 'account_card', $args ) || CORE::return( $self->pass_error );
2157             my $err = $self->_check_parameters( $okParams, $args );
2158             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
2159             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." ) );
2160             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No account_card id (with parameter 'id') was provided to retrieve its information." ) );
2161             my $hash = $self->get( "accounts/${parent_id}/external_accounts/${id}", $args ) || CORE::return( $self->pass_error );
2162             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Connect::ExternalAccount::Card', $hash ) );
2163             }
2164             PERL
2165             # NOTE: account_card_update()
2166             account_card_update => <<'PERL',
2167             sub account_card_update
2168             {
2169             my $self = shift( @_ );
2170             my $args = shift( @_ );
2171             my $okParams =
2172             {
2173             expandable => { allowed => $EXPANDABLES->{ 'account_card' } },
2174             address_city => { type => "string" },
2175             address_country => { type => "string" },
2176             address_line1 => { type => "string" },
2177             address_line2 => { type => "string" },
2178             address_state => { type => "string" },
2179             address_zip => { type => "string" },
2180             default_for_currency => { type => "boolean" },
2181             exp_month => { type => "integer" },
2182             exp_year => { type => "integer" },
2183             metadata => { type => "hash" },
2184             name => { type => "string" },
2185             };
2186             $args = $self->_contract( 'account_card', $args ) || CORE::return( $self->pass_error );
2187             my $err = $self->_check_parameters( $okParams, $args );
2188             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
2189             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." ) );
2190             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No account_card id (with parameter 'id') was provided to update its information." ) );
2191             my $hash = $self->post( "accounts/${parent_id}/external_accounts/${id}", $args ) || CORE::return( $self->pass_error );
2192             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Connect::ExternalAccount::Card', $hash ) );
2193             }
2194             PERL
2195             # NOTE: account_cards()
2196             account_cards => <<'PERL',
2197             # <https://stripe.com/docs/api/external_accounts>
2198             sub account_cards
2199             {
2200             my $self = shift( @_ );
2201             my $allowed = [qw( create delete list retrieve update )];
2202             my $action = shift( @_ );
2203             my $meth = $self->_get_method( 'account_card', $action, $allowed ) || CORE::return( $self->pass_error );
2204             CORE::return( $self->$meth( @_ ) );
2205             }
2206             PERL
2207             # NOTE: account_create()
2208             account_create => <<'PERL',
2209             sub account_create
2210             {
2211             my $self = shift( @_ );
2212             my $args = shift( @_ );
2213             my $okParams =
2214             {
2215             expandable => { allowed => $EXPANDABLES->{ 'account' } },
2216             account_token => { type => "string" },
2217             business_profile => { type => "hash" },
2218             business_type => { type => "string" },
2219             capabilities => { type => "hash" },
2220             company => { type => "hash" },
2221             country => { type => "string" },
2222             default_currency => { type => "string" },
2223             documents => { type => "object" },
2224             email => { type => "string" },
2225             external_account => { type => "string" },
2226             individual => { type => "hash" },
2227             metadata => { type => "hash" },
2228             settings => { type => "hash" },
2229             tos_acceptance => { type => "hash" },
2230             type => { type => "string", required => 1 },
2231             };
2232             $args = $self->_contract( 'account', $args ) || CORE::return( $self->pass_error );
2233             my $err = $self->_check_parameters( $okParams, $args );
2234             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
2235             my $hash = $self->post( "accounts", $args ) || CORE::return( $self->pass_error );
2236             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Connect::Account', $hash ) );
2237             }
2238             PERL
2239             # NOTE: account_delete()
2240             account_delete => <<'PERL',
2241             sub account_delete
2242             {
2243             my $self = shift( @_ );
2244             my $args = shift( @_ );
2245             my $okParams =
2246             {
2247             expandable => { allowed => $EXPANDABLES->{ 'account' } },
2248             };
2249             $args = $self->_contract( 'account', $args ) || CORE::return( $self->pass_error );
2250             my $err = $self->_check_parameters( $okParams, $args );
2251             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
2252             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No account id (with parameter 'id') was provided to delete its information." ) );
2253             my $hash = $self->delete( "accounts/${id}", $args ) || CORE::return( $self->pass_error );
2254             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Connect::Account', $hash ) );
2255             }
2256             PERL
2257             # NOTE: account_link()
2258             account_link => <<'PERL',
2259             sub account_link { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Connect::Account::Link', @_ ) ); }
2260             PERL
2261             # NOTE: account_link_create()
2262             account_link_create => <<'PERL',
2263             sub account_link_create
2264             {
2265             my $self = shift( @_ );
2266             my $args = shift( @_ );
2267             my $okParams =
2268             {
2269             expandable => { allowed => $EXPANDABLES->{ 'account_link' } },
2270             account => { type => "string", required => 1 },
2271             collect => { type => "string" },
2272             refresh_url => { type => "string" },
2273             return_url => { type => "string" },
2274             type => { type => "string", required => 1 },
2275             };
2276             $args = $self->_contract( 'account_link', $args ) || CORE::return( $self->pass_error );
2277             my $err = $self->_check_parameters( $okParams, $args );
2278             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
2279             my $hash = $self->post( "account_links", $args ) || CORE::return( $self->pass_error );
2280             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Connect::Account::Link', $hash ) );
2281             }
2282             PERL
2283             # NOTE: account_links()
2284             account_links => <<'PERL',
2285             # <https://stripe.com/docs/api/account_links>
2286             sub account_links
2287             {
2288             my $self = shift( @_ );
2289             my $allowed = [qw( create )];
2290             my $action = shift( @_ );
2291             my $meth = $self->_get_method( 'account_link', $action, $allowed ) || CORE::return( $self->pass_error );
2292             CORE::return( $self->$meth( @_ ) );
2293             }
2294             PERL
2295             # NOTE: account_list()
2296             account_list => <<'PERL',
2297             sub account_list
2298             {
2299             my $self = shift( @_ );
2300             CORE::return( $self->error( "No parameters were provided to list account information." ) ) if( !scalar( @_ ) );
2301             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Connect::Account', @_ );
2302             my $okParams =
2303             {
2304             expandable => { allowed => $EXPANDABLES->{ 'account' }, data_prefix_is_ok => 1 },
2305             created => { type => "timestamp" },
2306             ending_before => { type => "string" },
2307             limit => { type => "string" },
2308             starting_after => { type => "string" },
2309             };
2310             my $err = $self->_check_parameters( $okParams, $args );
2311             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
2312             if( $args->{expand} )
2313             {
2314             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
2315             }
2316             my $hash = $self->get( "accounts", $args ) || CORE::return( $self->pass_error );
2317             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Connect::Account', $hash ) );
2318             }
2319             PERL
2320             # NOTE: account_reject()
2321             account_reject => <<'PERL',
2322             sub account_reject
2323             {
2324             my $self = shift( @_ );
2325             my $args = shift( @_ );
2326             my $okParams =
2327             {
2328             expandable => { allowed => $EXPANDABLES->{ 'account' } },
2329             reason => { type => "string", required => 1 },
2330             };
2331             $args = $self->_contract( 'account', $args ) || CORE::return( $self->pass_error );
2332             my $err = $self->_check_parameters( $okParams, $args );
2333             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
2334             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No account id (with parameter 'id') was provided to reject its information." ) );
2335             my $hash = $self->post( "accounts/${id}", $args ) || CORE::return( $self->pass_error );
2336             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Connect::Account', $hash ) );
2337             }
2338             PERL
2339             # NOTE: account_retrieve()
2340             account_retrieve => <<'PERL',
2341             sub account_retrieve
2342             {
2343             my $self = shift( @_ );
2344             my $args = shift( @_ );
2345             my $okParams =
2346             {
2347             expandable => { allowed => $EXPANDABLES->{ 'account' }, data_prefix_is_ok => 1 },
2348             };
2349             $args = $self->_contract( 'account', $args ) || CORE::return( $self->pass_error );
2350             my $err = $self->_check_parameters( $okParams, $args );
2351             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
2352             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No account id (with parameter 'id') was provided to retrieve its information." ) );
2353             my $hash = $self->get( "accounts/${id}", $args ) || CORE::return( $self->pass_error );
2354             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Connect::Account', $hash ) );
2355             }
2356             PERL
2357             # NOTE: account_token_create()
2358             account_token_create => <<'PERL',
2359             sub account_token_create { CORE::return( shift->token_create( @_ ) ); }
2360             PERL
2361             # NOTE: account_update()
2362             account_update => <<'PERL',
2363             sub account_update
2364             {
2365             my $self = shift( @_ );
2366             my $args = shift( @_ );
2367             my $okParams =
2368             {
2369             expandable => { allowed => $EXPANDABLES->{ 'account' } },
2370             account_token => { type => "string" },
2371             business_profile => { type => "hash" },
2372             business_type => { type => "string" },
2373             capabilities => { type => "hash" },
2374             company => { type => "hash" },
2375             default_currency => { type => "string" },
2376             documents => { type => "object" },
2377             email => { type => "string" },
2378             external_account => { type => "string" },
2379             individual => { type => "hash" },
2380             metadata => { type => "hash" },
2381             settings => { type => "hash" },
2382             tos_acceptance => { type => "hash" },
2383             };
2384             $args = $self->_contract( 'account', $args ) || CORE::return( $self->pass_error );
2385             my $err = $self->_check_parameters( $okParams, $args );
2386             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
2387             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No account id (with parameter 'id') was provided to update its information." ) );
2388             my $hash = $self->post( "accounts/${id}", $args ) || CORE::return( $self->pass_error );
2389             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Connect::Account', $hash ) );
2390             }
2391             PERL
2392             # NOTE: accounts()
2393             accounts => <<'PERL',
2394             # <https://stripe.com/docs/api/accounts>
2395             sub accounts
2396             {
2397             my $self = shift( @_ );
2398             my $allowed = [qw( create delete list reject retrieve update )];
2399             my $action = shift( @_ );
2400             my $meth = $self->_get_method( 'account', $action, $allowed ) || CORE::return( $self->pass_error );
2401             CORE::return( $self->$meth( @_ ) );
2402             }
2403             PERL
2404             # NOTE: address()
2405             address => <<'PERL',
2406             sub address { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Address', @_ ) ); }
2407             PERL
2408             # NOTE: address_kana()
2409             address_kana => <<'PERL',
2410             sub address_kana { CORE::return( shift->_response_to_object( 'Net::API::Stripe::AddressKana', @_ ) ); }
2411             PERL
2412             # NOTE: address_kanji()
2413             address_kanji => <<'PERL',
2414             sub address_kanji { CORE::return( shift->_response_to_object( 'Net::API::Stripe::AddressKanji', @_ ) ); }
2415             PERL
2416             # NOTE: amount()
2417             amount => <<'PERL',
2418             sub amount { CORE::return( shift->_set_get_number( 'amount', @_ ) ); }
2419             PERL
2420             # NOTE: application_fee()
2421             application_fee => <<'PERL',
2422             sub application_fee { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Connect::ApplicationFee', @_ ) ); }
2423             PERL
2424             # NOTE: application_fee_list()
2425             application_fee_list => <<'PERL',
2426             sub application_fee_list
2427             {
2428             my $self = shift( @_ );
2429             CORE::return( $self->error( "No parameters were provided to list application fee information." ) ) if( !scalar( @_ ) );
2430             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Connect::ApplicationFee', @_ );
2431             my $okParams =
2432             {
2433             expandable => { allowed => $EXPANDABLES->{ 'application_fee' }, data_prefix_is_ok => 1 },
2434             charge => { type => "string" },
2435             created => { type => "timestamp" },
2436             ending_before => { type => "string" },
2437             limit => { type => "string" },
2438             starting_after => { type => "string" },
2439             };
2440             my $err = $self->_check_parameters( $okParams, $args );
2441             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
2442             if( $args->{expand} )
2443             {
2444             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
2445             }
2446             my $hash = $self->get( "application_fees", $args ) || CORE::return( $self->pass_error );
2447             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Connect::ApplicationFee', $hash ) );
2448             }
2449             PERL
2450             # NOTE: application_fee_refund()
2451             application_fee_refund => <<'PERL',
2452             sub application_fee_refund { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Connect::ApplicationFee::Refund', @_ ) ); }
2453             PERL
2454             # NOTE: application_fee_retrieve()
2455             application_fee_retrieve => <<'PERL',
2456             sub application_fee_retrieve
2457             {
2458             my $self = shift( @_ );
2459             my $args = shift( @_ );
2460             my $okParams =
2461             {
2462             expandable => { allowed => $EXPANDABLES->{ 'application_fee' }, data_prefix_is_ok => 1 },
2463             };
2464             $args = $self->_contract( 'application_fee', $args ) || CORE::return( $self->pass_error );
2465             my $err = $self->_check_parameters( $okParams, $args );
2466             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
2467             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No application_fee id (with parameter 'id') was provided to retrieve its information." ) );
2468             my $hash = $self->get( "application_fees/${id}", $args ) || CORE::return( $self->pass_error );
2469             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Connect::ApplicationFee', $hash ) );
2470             }
2471             PERL
2472             # NOTE: application_fees()
2473             application_fees => <<'PERL',
2474             # <https://stripe.com/docs/api/application_fees>
2475             sub application_fees
2476             {
2477             my $self = shift( @_ );
2478             my $allowed = [qw( list retrieve )];
2479             my $action = shift( @_ );
2480             my $meth = $self->_get_method( 'application_fee', $action, $allowed ) || CORE::return( $self->pass_error );
2481             CORE::return( $self->$meth( @_ ) );
2482             }
2483             PERL
2484             # NOTE: apps_secret()
2485             apps_secret => <<'PERL',
2486             sub apps_secret { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Connect::AppsSecret', @_ ) ); }
2487             PERL
2488             # NOTE: apps_secret_delete()
2489             apps_secret_delete => <<'PERL',
2490             sub apps_secret_delete
2491             {
2492             my $self = shift( @_ );
2493             my $args = shift( @_ );
2494             my $okParams =
2495             {
2496             expandable => { allowed => $EXPANDABLES->{ 'apps.secret' } },
2497             name => { type => "string", required => 1 },
2498             scope => { type => "hash", required => 1 },
2499             };
2500             $args = $self->_contract( 'apps.secret', $args ) || CORE::return( $self->pass_error );
2501             my $err = $self->_check_parameters( $okParams, $args );
2502             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
2503             my $hash = $self->post( "apps/secrets", $args ) || CORE::return( $self->pass_error );
2504             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Connect::AppsSecret', $hash ) );
2505             }
2506             PERL
2507             # NOTE: apps_secret_find()
2508             apps_secret_find => <<'PERL',
2509             sub apps_secret_find
2510             {
2511             my $self = shift( @_ );
2512             my $args = shift( @_ );
2513             my $okParams =
2514             {
2515             expandable => { allowed => $EXPANDABLES->{ 'apps.secret' }, data_prefix_is_ok => 1 },
2516             name => { type => "string", required => 1 },
2517             scope => { type => "hash", required => 1 },
2518             };
2519             $args = $self->_contract( 'apps.secret', $args ) || CORE::return( $self->pass_error );
2520             my $err = $self->_check_parameters( $okParams, $args );
2521             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
2522             my $hash = $self->get( "apps/secrets", $args ) || CORE::return( $self->pass_error );
2523             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Connect::AppsSecret', $hash ) );
2524             }
2525             PERL
2526             # NOTE: apps_secret_list()
2527             apps_secret_list => <<'PERL',
2528             sub apps_secret_list
2529             {
2530             my $self = shift( @_ );
2531             CORE::return( $self->error( "No parameters were provided to list apps secret information." ) ) if( !scalar( @_ ) );
2532             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Connect::AppsSecret', @_ );
2533             my $okParams =
2534             {
2535             expandable => { allowed => $EXPANDABLES->{ 'apps.secret' }, data_prefix_is_ok => 1 },
2536             ending_before => { type => "string" },
2537             limit => { type => "string" },
2538             scope => { type => "hash", required => 1 },
2539             starting_after => { type => "string" },
2540             };
2541             my $err = $self->_check_parameters( $okParams, $args );
2542             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
2543             if( $args->{expand} )
2544             {
2545             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
2546             }
2547             my $hash = $self->get( "", $args ) || CORE::return( $self->pass_error );
2548             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Connect::AppsSecret', $hash ) );
2549             }
2550             PERL
2551             # NOTE: apps_secret_set()
2552             apps_secret_set => <<'PERL',
2553             sub apps_secret_set
2554             {
2555             my $self = shift( @_ );
2556             my $args = shift( @_ );
2557             my $okParams =
2558             {
2559             expandable => { allowed => $EXPANDABLES->{ 'apps.secret' } },
2560             expires_at => { type => "timestamp" },
2561             name => { type => "string", required => 1 },
2562             payload => { type => "string", required => 1 },
2563             scope => { type => "hash", required => 1 },
2564             };
2565             $args = $self->_contract( 'apps.secret', $args ) || CORE::return( $self->pass_error );
2566             my $err = $self->_check_parameters( $okParams, $args );
2567             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
2568             my $hash = $self->post( "", $args ) || CORE::return( $self->pass_error );
2569             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Connect::AppsSecret', $hash ) );
2570             }
2571             PERL
2572             # NOTE: apps_secrets()
2573             apps_secrets => <<'PERL',
2574             # <https://stripe.com/docs/api/secret_management>
2575             sub apps_secrets
2576             {
2577             my $self = shift( @_ );
2578             my $allowed = [qw( delete find list set )];
2579             my $action = shift( @_ );
2580             my $meth = $self->_get_method( 'apps_secret', $action, $allowed ) || CORE::return( $self->pass_error );
2581             CORE::return( $self->$meth( @_ ) );
2582             }
2583             PERL
2584             # NOTE: authorization()
2585             authorization => <<'PERL',
2586             sub authorization { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Issuing::Authorization', @_ ) ); }
2587             PERL
2588             # NOTE: balance()
2589             balance => <<'PERL',
2590             sub balance { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Balance', @_ ) ); }
2591             PERL
2592             # NOTE: balance_retrieve()
2593             balance_retrieve => <<'PERL',
2594             # Retrieves the current account balance, based on the authentication that was used to make the request.
2595             sub balance_retrieve
2596             {
2597             my $self = shift( @_ );
2598             # No argument
2599             # my $hash = $self->_get( 'balance' ) || CORE::return;
2600             my $hash = $self->get( 'balance' );
2601             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Balance', $hash ) );
2602             }
2603             PERL
2604             # NOTE: balance_transaction()
2605             balance_transaction => <<'PERL',
2606             sub balance_transaction { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Balance::Transaction', @_ ) ); }
2607             PERL
2608             # NOTE: balance_transaction_list()
2609             balance_transaction_list => <<'PERL',
2610             # https://stripe.com/docs/api/balance/balance_history?lang=curl
2611             sub balance_transaction_list
2612             {
2613             my $self = shift( @_ );
2614             my $args = shift( @_ );
2615             my $okParams =
2616             {
2617             expandable => { allowed => $EXPANDABLES->{balance_transaction}, data_prefix_is_ok => 1 },
2618             'available_on' => qr/^\d+$/,
2619             'available_on.gt' => qr/^\d+$/,
2620             'available_on.gte' => qr/^\d+$/,
2621             'available_on.lt' => qr/^\d+$/,
2622             'available_on.lte' => qr/^\d+$/,
2623             'created' => qr/^\d+$/,
2624             'created.gt' => qr/^\d+$/,
2625             'created.gte' => qr/^\d+$/,
2626             'created.lt' => qr/^\d+$/,
2627             'created.lte' => qr/^\d+$/,
2628             'currency' => qr/^[a-zA-Z]{3}$/,
2629             # "A cursor for use in pagination. ending_before is an object ID that defines your place in the list."
2630             'ending_before' => qr/^\w+$/,
2631             'limit' => qr/^\d+$/,
2632             # "For automatic Stripe payouts only, only returns transactions that were payed out on the specified payout ID."
2633             'payout' => qr/^\w+$/,
2634             'source' => qr/^\w+$/,
2635             'starting_after' => qr/^\w+$/,
2636             # "Only returns transactions of the given type"
2637             'type' => qr/^(?:charge|refund|adjustment|application_fee|application_fee_refund|transfer|payment|payout|payout_failure|stripe_fee|network_cost)$/,
2638             };
2639             my $err = $self->_check_parameters( $okParams, $args );
2640             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
2641             my $hash = $self->get( 'balance_transactions', $args ) || CORE::return( $self->pass_error );
2642             CORE::return( $self->_response_to_object( 'Net::API::Stripe::List', $hash ) );
2643             }
2644             PERL
2645             # NOTE: balance_transaction_retrieve()
2646             balance_transaction_retrieve => <<'PERL',
2647             sub balance_transaction_retrieve
2648             {
2649             my $self = shift( @_ );
2650             CORE::return( $self->error( "No parameters were provided to retrieve balance transaction information." ) ) if( !scalar( @_ ) );
2651             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Balance::Transaction', @_ );
2652             my $okParams =
2653             {
2654             expandable => { allowed => $EXPANDABLES->{balance_transaction}, data_prefix_is_ok => 1 },
2655             id => { re => qr/^\w+$/, required => 1 }
2656             };
2657             my $err = $self->_check_parameters( $okParams, $args );
2658             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
2659             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No balance transaction id was provided to retrieve its information." ) );
2660             my $hash = $self->get( "balance/history/${id}" ) || CORE::return( $self->pass_error );
2661             CORE::return( $self->error( "Cannot find property 'object' in response hash reference: ", sub{ $self->dumper( $hash ) } ) ) if( !CORE::exists( $hash->{object} ) );
2662             my $class = $self->_object_type_to_class( $hash->{object} ) || CORE::return( $self->pass_error );
2663             CORE::return( $self->_response_to_object( $class, $hash ) );
2664             }
2665             PERL
2666             # NOTE: balance_transactions()
2667             balance_transactions => <<'PERL',
2668             sub balance_transactions
2669             {
2670             my $self = shift( @_ );
2671             my $allowed = [qw( retrieve list )];
2672             my $action = shift( @_ );
2673             my $meth = $self->_get_method( 'balance_transaction', $action, $allowed ) || CORE::return( $self->pass_error );
2674             CORE::return( $self->$meth( @_ ) );
2675             }
2676             PERL
2677             # NOTE: balances()
2678             balances => <<'PERL',
2679             # Stripe access points in their order on the api documentation
2680             sub balances
2681             {
2682             my $self = shift( @_ );
2683             my $allowed = [qw( retrieve )];
2684             my $action = shift( @_ );
2685             my $meth = $self->_get_method( 'balance', $action, $allowed ) || CORE::return( $self->pass_error );
2686             CORE::return( $self->$meth( @_ ) );
2687             }
2688             PERL
2689             # NOTE: bank_account()
2690             bank_account => <<'PERL',
2691             sub bank_account { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Connect::ExternalAccount::Bank', @_ ) ); }
2692             PERL
2693             # NOTE: bank_account_create()
2694             bank_account_create => <<'PERL',
2695             sub bank_account_create
2696             {
2697             my $self = shift( @_ );
2698             CORE::return( $self->error( "No parameters were provided to create a bank account" ) ) if( !scalar( @_ ) );
2699             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Connect::ExternalAccount::Bank', @_ );
2700             my $okParams =
2701             {
2702             expandable => { allowed => $EXPANDABLES->{bank_account} },
2703             account => { re => qr/^\w+$/, required => 1 },
2704             default_for_currency => {},
2705             external_account => {},
2706             metadata => { type => "hash" },
2707             source => { type => "string" },
2708             };
2709              
2710             if( $self->_is_hash( $args->{external_account} ) )
2711             {
2712             $okParams->{external_account} =
2713             {
2714             type => 'hash',
2715             fields => [qw( object! country! currency! account_holder_name account_holder_type routing_number account_number! )],
2716             };
2717             }
2718             else
2719             {
2720             $okParams->{external_account} = { type => 'scalar', re => qr/^\w+$/ };
2721             }
2722             my $id = CORE::delete( $args->{account} );
2723             $args = $self->_contract( 'bank_account', $args ) || CORE::return( $self->pass_error );
2724             my $err = $self->_check_parameters( $okParams, $args );
2725             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
2726             my $hash = $self->post( "accounts/${id}/external_accounts", $args ) || CORE::return( $self->pass_error );
2727             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Connect::ExternalAccount::Bank', $hash ) );
2728             }
2729             PERL
2730             # NOTE: bank_account_delete()
2731             bank_account_delete => <<'PERL',
2732             sub bank_account_delete
2733             {
2734             my $self = shift( @_ );
2735             CORE::return( $self->error( "No parameters were provided to delete a bank account information." ) ) if( !scalar( @_ ) );
2736             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Connect::ExternalAccount::Bank', @_ );
2737             my $okParams =
2738             {
2739             expandable => { allowed => $EXPANDABLES->{bank_account} },
2740             id => { re => qr/^\w+$/, required => 1 },
2741             account => { re => qr/^\w+$/, required => 1 },
2742             };
2743             my $err = $self->_check_parameters( $okParams, $args );
2744             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
2745             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No bank account id was provided to delete its information." ) );
2746             my $acct = CORE::delete( $args->{account} );
2747             my $hash = $self->delete( "accounts/${acct}/external_accounts/${id}", $args ) || CORE::return( $self->pass_error );
2748             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Connect::ExternalAccount::Bank', $hash ) );
2749             }
2750             PERL
2751             # NOTE: bank_account_list()
2752             bank_account_list => <<'PERL',
2753             sub bank_account_list
2754             {
2755             my $self = shift( @_ );
2756             my $args = shift( @_ );
2757             my $okParams =
2758             {
2759             expandable => { allowed => $EXPANDABLES->{bank_account} },
2760             account => { re => qr/^\w+$/, required => 1 },
2761             # "A cursor for use in pagination. ending_before is an object ID that defines your place in the list."
2762             'ending_before' => qr/^\w+$/,
2763             'limit' => qr/^\d+$/,
2764             'starting_after' => qr/^\w+$/,
2765             };
2766             my $err = $self->_check_parameters( $okParams, $args );
2767             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
2768             my $id = CORE::delete( $args->{account} );
2769             if( $args->{expand} )
2770             {
2771             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
2772             }
2773             my $hash = $self->get( "accounts/$id/external_accounts", $args ) || CORE::return( $self->pass_error );
2774             CORE::return( $self->_response_to_object( 'Net::API::Stripe::List', $hash ) );
2775             }
2776             PERL
2777             # NOTE: bank_account_retrieve()
2778             bank_account_retrieve => <<'PERL',
2779             sub bank_account_retrieve
2780             {
2781             my $self = shift( @_ );
2782             CORE::return( $self->error( "No parameters were provided to retrieve a bank account information." ) ) if( !scalar( @_ ) );
2783             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Connect::ExternalAccount::Bank', @_ );
2784             my $okParams =
2785             {
2786             expandable => { allowed => $EXPANDABLES->{bank_account} },
2787             id => { re => qr/^\w+$/, required => 1 },
2788             account => { re => qr/^\w+$/, required => 1 },
2789             };
2790             my $err = $self->_check_parameters( $okParams, $args );
2791             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
2792             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No bank account id was provided to retrieve its information." ) );
2793             my $acct = CORE::delete( $args->{account} );
2794             my $hash = $self->get( "accounts/${acct}/external_accounts/${id}", $args ) || CORE::return( $self->pass_error );
2795             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Connect::ExternalAccount::Bank', $hash ) );
2796             }
2797             PERL
2798             # NOTE: bank_account_update()
2799             bank_account_update => <<'PERL',
2800             sub bank_account_update
2801             {
2802             my $self = shift( @_ );
2803             CORE::return( $self->error( "No parameters were provided to update a bank account" ) ) if( !scalar( @_ ) );
2804             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Connect::ExternalAccount::Bank', @_ );
2805             my $okParams =
2806             {
2807             expandable => { allowed => $EXPANDABLES->{bank_account} },
2808             account => { re => qr/^\w+$/, required => 1 },
2809             account_holder_name => { type => "string" },
2810             account_holder_type => { re => qr/^(company|individual)$/, type => "string" },
2811             default_for_currency => {},
2812             id => { re => qr/^\w+$/, required => 1 },
2813             metadata => { type => "hash" },
2814             };
2815              
2816             $args = $self->_contract( 'bank_account', $args ) || CORE::return( $self->pass_error );
2817             # We found some errors
2818             my $err = $self->_check_parameters( $okParams, $args );
2819             # $self->message( 3, "Data to be posted: ", $self->dumper( $args ) ); exit;
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 update coupon's details" ) );
2822             my $acct = CORE::delete( $args->{account} );
2823             my $hash = $self->post( "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_verify()
2828             bank_account_verify => <<'PERL',
2829             sub bank_account_verify
2830             {
2831             my $self = shift( @_ );
2832             my $args = shift( @_ );
2833             my $okParams =
2834             {
2835             expandable => { allowed => $EXPANDABLES->{ 'bank_account' } },
2836             amounts => { type => "array" },
2837             };
2838             $args = $self->_contract( 'bank_account', $args ) || CORE::return( $self->pass_error );
2839             my $err = $self->_check_parameters( $okParams, $args );
2840             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
2841             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." ) );
2842             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No source id (with parameter 'id') was provided to verify its information." ) );
2843             my $hash = $self->post( "customers/${parent_id}/sources/${id}", $args ) || CORE::return( $self->pass_error );
2844             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Customer::BankAccount', $hash ) );
2845             }
2846             PERL
2847             # NOTE: bank_accounts()
2848             bank_accounts => <<'PERL',
2849             # <https://stripe.com/docs/api/customer_bank_accounts>
2850             sub bank_accounts
2851             {
2852             my $self = shift( @_ );
2853             my $allowed = [qw( create delete list retrieve update verify )];
2854             my $action = shift( @_ );
2855             my $meth = $self->_get_method( 'bank_account', $action, $allowed ) || CORE::return( $self->pass_error );
2856             CORE::return( $self->$meth( @_ ) );
2857             }
2858             PERL
2859             # NOTE: bank_token_create()
2860             bank_token_create => <<'PERL',
2861             sub bank_token_create { CORE::return( shift->token_create( @_ ) ); }
2862             PERL
2863             # NOTE: billing_details()
2864             billing_details => <<'PERL',
2865             sub billing_details { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Billing::Details', @_ ) ); }
2866             PERL
2867             # NOTE: billing_portal_configuration()
2868             billing_portal_configuration => <<'PERL',
2869             sub billing_portal_configuration { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Billing::PortalConfiguration', @_ ) ); }
2870             PERL
2871             # NOTE: billing_portal_configuration_create()
2872             billing_portal_configuration_create => <<'PERL',
2873             sub billing_portal_configuration_create
2874             {
2875             my $self = shift( @_ );
2876             my $args = shift( @_ );
2877             my $okParams =
2878             {
2879             expandable => { allowed => $EXPANDABLES->{ 'billing_portal.configuration' } },
2880             business_profile => { type => "hash", required => 1 },
2881             default_return_url => { type => "string" },
2882             features => { type => "hash", required => 1 },
2883             login_page => { type => "hash" },
2884             metadata => { type => "hash" },
2885             };
2886             $args = $self->_contract( 'billing_portal.configuration', $args ) || CORE::return( $self->pass_error );
2887             my $err = $self->_check_parameters( $okParams, $args );
2888             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
2889             my $hash = $self->post( "", $args ) || CORE::return( $self->pass_error );
2890             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::PortalConfiguration', $hash ) );
2891             }
2892             PERL
2893             # NOTE: billing_portal_configuration_list()
2894             billing_portal_configuration_list => <<'PERL',
2895             sub billing_portal_configuration_list
2896             {
2897             my $self = shift( @_ );
2898             CORE::return( $self->error( "No parameters were provided to list billing portal configuration information." ) ) if( !scalar( @_ ) );
2899             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Billing::PortalConfiguration', @_ );
2900             my $okParams =
2901             {
2902             expandable => { allowed => $EXPANDABLES->{ 'billing_portal.configuration' }, data_prefix_is_ok => 1 },
2903             active => { type => "boolean" },
2904             ending_before => { type => "string" },
2905             is_default => { type => "boolean" },
2906             limit => { type => "string" },
2907             starting_after => { type => "string" },
2908             };
2909             my $err = $self->_check_parameters( $okParams, $args );
2910             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
2911             if( $args->{expand} )
2912             {
2913             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
2914             }
2915             my $hash = $self->get( "", $args ) || CORE::return( $self->pass_error );
2916             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::PortalConfiguration', $hash ) );
2917             }
2918             PERL
2919             # NOTE: billing_portal_configuration_retrieve()
2920             billing_portal_configuration_retrieve => <<'PERL',
2921             sub billing_portal_configuration_retrieve
2922             {
2923             my $self = shift( @_ );
2924             my $args = shift( @_ );
2925             my $okParams =
2926             {
2927             expandable => { allowed => $EXPANDABLES->{ 'billing_portal.configuration' }, data_prefix_is_ok => 1 },
2928             };
2929             $args = $self->_contract( 'billing_portal.configuration', $args ) || CORE::return( $self->pass_error );
2930             my $err = $self->_check_parameters( $okParams, $args );
2931             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
2932             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No billing_portal.configuration id (with parameter 'id') was provided to retrieve its information." ) );
2933             my $hash = $self->get( "billing_portal/configurations/${id}", $args ) || CORE::return( $self->pass_error );
2934             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::PortalConfiguration', $hash ) );
2935             }
2936             PERL
2937             # NOTE: billing_portal_configuration_update()
2938             billing_portal_configuration_update => <<'PERL',
2939             sub billing_portal_configuration_update
2940             {
2941             my $self = shift( @_ );
2942             my $args = shift( @_ );
2943             my $okParams =
2944             {
2945             expandable => { allowed => $EXPANDABLES->{ 'billing_portal.configuration' } },
2946             active => { type => "boolean" },
2947             business_profile => { type => "hash" },
2948             default_return_url => { type => "string" },
2949             features => { type => "hash" },
2950             login_page => { type => "hash" },
2951             metadata => { type => "hash" },
2952             };
2953             $args = $self->_contract( 'billing_portal.configuration', $args ) || CORE::return( $self->pass_error );
2954             my $err = $self->_check_parameters( $okParams, $args );
2955             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
2956             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No billing_portal.configuration id (with parameter 'id') was provided to update its information." ) );
2957             my $hash = $self->post( "billing_portal/configurations/${id}", $args ) || CORE::return( $self->pass_error );
2958             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::PortalConfiguration', $hash ) );
2959             }
2960             PERL
2961             # NOTE: billing_portal_configurations()
2962             billing_portal_configurations => <<'PERL',
2963             # <https://stripe.com/docs/api/customer_portal>
2964             sub billing_portal_configurations
2965             {
2966             my $self = shift( @_ );
2967             my $allowed = [qw( create list retrieve update )];
2968             my $action = shift( @_ );
2969             my $meth = $self->_get_method( 'billing_portal_configuration', $action, $allowed ) || CORE::return( $self->pass_error );
2970             CORE::return( $self->$meth( @_ ) );
2971             }
2972             PERL
2973             # NOTE: billing_portal_session()
2974             billing_portal_session => <<'PERL',
2975             sub billing_portal_session { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Billing::PortalSession', @_ ) ); }
2976             PERL
2977             # NOTE: billing_portal_session_create()
2978             billing_portal_session_create => <<'PERL',
2979             sub billing_portal_session_create
2980             {
2981             my $self = shift( @_ );
2982             my $args = shift( @_ );
2983             my $okParams =
2984             {
2985             expandable => { allowed => $EXPANDABLES->{ 'billing_portal.session' } },
2986             configuration => { type => "string" },
2987             customer => { type => "string", required => 1 },
2988             locale => { type => "string" },
2989             on_behalf_of => { type => "string" },
2990             return_url => { type => "string" },
2991             };
2992             $args = $self->_contract( 'billing_portal.session', $args ) || CORE::return( $self->pass_error );
2993             my $err = $self->_check_parameters( $okParams, $args );
2994             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
2995             my $hash = $self->post( "", $args ) || CORE::return( $self->pass_error );
2996             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::PortalSession', $hash ) );
2997             }
2998             PERL
2999             # NOTE: billing_portal_sessions()
3000             billing_portal_sessions => <<'PERL',
3001             # <https://stripe.com/docs/api/customer_portal>
3002             sub billing_portal_sessions
3003             {
3004             my $self = shift( @_ );
3005             my $allowed = [qw( create )];
3006             my $action = shift( @_ );
3007             my $meth = $self->_get_method( 'billing_portal_session', $action, $allowed ) || CORE::return( $self->pass_error );
3008             CORE::return( $self->$meth( @_ ) );
3009             }
3010             PERL
3011             # NOTE: billing_thresholds()
3012             billing_thresholds => <<'PERL',
3013             sub billing_thresholds { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Billing::Thresholds', @_ ) ); }
3014             PERL
3015             # NOTE: business_profile()
3016             business_profile => <<'PERL',
3017             sub business_profile { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Connect::Business::Profile', @_ ) ); }
3018             PERL
3019             # NOTE: capability()
3020             capability => <<'PERL',
3021             # sub billing { CORE::return( shift->_instantiate( 'billing', 'Net::API::Stripe::Billing' ) ) }
3022             sub capability { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Connect::Account::Capability', @_ ) ); }
3023             PERL
3024             # NOTE: capability_list()
3025             capability_list => <<'PERL',
3026             sub capability_list
3027             {
3028             my $self = shift( @_ );
3029             CORE::return( $self->error( "No parameters were provided to list capability information." ) ) if( !scalar( @_ ) );
3030             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Connect::Account::Capability', @_ );
3031             my $okParams =
3032             {
3033             expandable => { allowed => $EXPANDABLES->{ 'capability' }, data_prefix_is_ok => 1 },
3034             };
3035             my $err = $self->_check_parameters( $okParams, $args );
3036             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
3037             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No account id (with parameter 'id') was provided to list its information." ) );
3038             if( $args->{expand} )
3039             {
3040             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
3041             }
3042             my $hash = $self->get( "accounts/${id}/capabilities", $args ) || CORE::return( $self->pass_error );
3043             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Connect::Account::Capability', $hash ) );
3044             }
3045             PERL
3046             # NOTE: capability_retrieve()
3047             capability_retrieve => <<'PERL',
3048             sub capability_retrieve
3049             {
3050             my $self = shift( @_ );
3051             my $args = shift( @_ );
3052             my $okParams =
3053             {
3054             expandable => { allowed => $EXPANDABLES->{ 'capability' }, data_prefix_is_ok => 1 },
3055             };
3056             $args = $self->_contract( 'capability', $args ) || CORE::return( $self->pass_error );
3057             my $err = $self->_check_parameters( $okParams, $args );
3058             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
3059             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." ) );
3060             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No account.capability id (with parameter 'id') was provided to retrieve its information." ) );
3061             my $hash = $self->get( "accounts/${parent_id}/capabilities/${id}", $args ) || CORE::return( $self->pass_error );
3062             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Connect::Account::Capability', $hash ) );
3063             }
3064             PERL
3065             # NOTE: capability_update()
3066             capability_update => <<'PERL',
3067             sub capability_update
3068             {
3069             my $self = shift( @_ );
3070             my $args = shift( @_ );
3071             my $okParams =
3072             {
3073             expandable => { allowed => $EXPANDABLES->{ 'capability' } },
3074             requested => { type => "boolean" },
3075             };
3076             $args = $self->_contract( 'capability', $args ) || CORE::return( $self->pass_error );
3077             my $err = $self->_check_parameters( $okParams, $args );
3078             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
3079             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." ) );
3080             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No account.capability id (with parameter 'id') was provided to update its information." ) );
3081             my $hash = $self->post( "accounts/${parent_id}/capabilities/${id}", $args ) || CORE::return( $self->pass_error );
3082             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Connect::Account::Capability', $hash ) );
3083             }
3084             PERL
3085             # NOTE: capabilitys()
3086             capabilitys => <<'PERL',
3087             # <https://stripe.com/docs/api/capabilities>
3088             sub capabilitys
3089             {
3090             my $self = shift( @_ );
3091             my $allowed = [qw( list retrieve update )];
3092             my $action = shift( @_ );
3093             my $meth = $self->_get_method( 'capability', $action, $allowed ) || CORE::return( $self->pass_error );
3094             CORE::return( $self->$meth( @_ ) );
3095             }
3096             PERL
3097             # NOTE: card()
3098             card => <<'PERL',
3099             sub card { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Connect::ExternalAccount::Card', @_ ) ); }
3100             PERL
3101             # NOTE: card_create()
3102             card_create => <<'PERL',
3103             sub card_create
3104             {
3105             my $self = shift( @_ );
3106             CORE::return( $self->error( "No parameters were provided to create card" ) ) if( !scalar( @_ ) );
3107             my $args = {};
3108             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 )];
3109             my $okParams =
3110             {
3111             expandable => { allowed => $EXPANDABLES->{card} },
3112             id => { re => qr/^\w+$/, required => 1 },
3113             # Token
3114             source => { type => 'hash', required => 1 },
3115             metadata => { type => 'hash' },
3116             };
3117            
3118             if( $self->_is_object( $_[0] ) && $_[0]->isa( 'Net::API::Stripe::Customer' ) )
3119             {
3120             $args = $_[0]->as_hash({ json => 1 });
3121             $okParams->{_cleanup} = 1;
3122             }
3123             elsif( $self->_is_object( $_[0] ) && $_[0]->isa( 'Net::API::Stripe::Payment::Card' ) )
3124             {
3125             $args = $_[0]->as_hash({ json => 1 });
3126             $args->{id} = CORE::delete( $args->{customer} );
3127             my $ref = {};
3128             @$ref{ @$card_fields } = @$args{ @$card_fields };
3129             $args->{source} = $ref;
3130             $okParams->{_cleanup} = 1;
3131             }
3132             else
3133             {
3134             $args = $self->_get_args( @_ );
3135             }
3136            
3137             $args = $self->_contract( 'card', $args ) || CORE::return( $self->pass_error );
3138             my $err = $self->_check_parameters( $okParams, $args );
3139             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
3140             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No customer id was provided to create a card for the customer" ) );
3141             my $hash = $self->post( "customers/${id}/sources", $args ) || CORE::return( $self->pass_error );
3142             CORE::return( $self->error( "Cannot find property 'object' in response hash reference: ", sub{ $self->dumper( $hash ) } ) ) if( !CORE::exists( $hash->{object} ) );
3143             my $class = $self->_object_type_to_class( $hash->{object} ) || CORE::return( $self->pass_error );
3144             # CORE::return( $self->_response_to_object( 'Net::API::Stripe::Payment::Card', $hash ) );
3145             CORE::return( $self->_response_to_object( $class, $hash ) );
3146             }
3147             PERL
3148             # NOTE: card_delete()
3149             card_delete => <<'PERL',
3150             sub card_delete
3151             {
3152             my $self = shift( @_ );
3153             CORE::return( $self->error( "No parameters were provided to delete card" ) ) if( !scalar( @_ ) );
3154             my $args = {};
3155             if( $self->_is_object( $_[0] ) && $_[0]->isa( 'Net::API::Stripe::Customer' ) )
3156             {
3157             my $cust = shift( @_ );
3158             CORE::return( $self->error( "No customer id was found in this customer object." ) ) if( !$cust->id );
3159             CORE::return( $self->error( "No source is set for the credit card to delete for this customer." ) ) if( !$cust->source );
3160             CORE::return( $self->error( "No credit card id found for this customer source to delete." ) ) if( !$cust->source->id );
3161             $args->{id} = $cust->id;
3162             $args->{card_id} = $cust->source->id;
3163             $args->{expand} = 'all';
3164             }
3165             elsif( $self->_is_object( $_[0] ) && $_[0]->isa( 'Net::API::Stripe::Payment::Card' ) )
3166             {
3167             my $card = shift( @_ );
3168             CORE::return( $self->error( "No card id was found in this card object." ) ) if( !$card->id );
3169             CORE::return( $self->error( "No customer object is set for this card object." ) ) if( !$card->customer );
3170             CORE::return( $self->error( "No customer id found in the customer object in this card object." ) ) if( !$card->customer->id );
3171             $args->{card_id} = $card->id;
3172             $args->{id} = $card->customer->id;
3173             $args->{expand} = 'all';
3174             }
3175             else
3176             {
3177             $args = $self->_get_args( @_ );
3178             }
3179             my $okParams =
3180             {
3181             expandable => { allowed => $EXPANDABLES->{card} },
3182             id => { re => qr/^\w+$/, required => 1 },
3183             card_id => { re => qr/^\w+$/, required => 1 },
3184             };
3185             my $err = $self->_check_parameters( $okParams, $args );
3186             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
3187             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No customer id was provided to delete his/her card" ) );
3188             my $cardId = CORE::delete( $args->{card_id} ) || CORE::return( $self->error( "No card id was provided to delete customer's card" ) );
3189             my $hash = $self->delete( "customers/${id}/sources/${cardId}", $args ) || CORE::return( $self->pass_error );
3190             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Payment::Card', $hash ) );
3191             }
3192             PERL
3193             # NOTE: card_holder()
3194             card_holder => <<'PERL',
3195             sub card_holder { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Issuing::Card::Holder', @_ ) ); }
3196             PERL
3197             # NOTE: card_list()
3198             card_list => <<'PERL',
3199             sub card_list
3200             {
3201             my $self = shift( @_ );
3202             CORE::return( $self->error( "No parameters were provided to list customer's cards." ) ) if( !scalar( @_ ) );
3203             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Customer', @_ );
3204             my $okParams =
3205             {
3206             expandable => { allowed => $EXPANDABLES->{card}, data_prefix_is_ok => 1 },
3207             ending_before => qr/^\w+$/,
3208             id => { re => /^\w+$/, required => 1 },
3209             limit => qr/^\d+$/,
3210             starting_after => qr/^\w+$/,
3211             };
3212             my $err = $self->_check_parameters( $okParams, $args );
3213             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
3214             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No customer id was provided to list his/her cards" ) );
3215             if( $args->{expand} )
3216             {
3217             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
3218             }
3219             my $hash = $self->get( "customers/${id}/sources", $args ) || CORE::return( $self->pass_error );
3220             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Payment::Card::List', $hash ) );
3221             }
3222             PERL
3223             # NOTE: card_retrieve()
3224             card_retrieve => <<'PERL',
3225             sub card_retrieve
3226             {
3227             my $self = shift( @_ );
3228             CORE::return( $self->error( "No parameters were provided to retrieve card information." ) ) if( !scalar( @_ ) );
3229             # my $args = $self->_get_args_from_object( 'Net::API::Stripe::Payment::Card', @_ );
3230             my $args = {};
3231             my $okParams =
3232             {
3233             expandable => { allowed => $EXPANDABLES->{card} },
3234             id => { re => qr/^\w+$/, required => 1 },
3235             customer => { re => qr/^\w+$/, required => 1 },
3236             };
3237             if( $self->_is_object( $_[0] ) && $_[0]->isa( 'Net::API::Stripe::Customer' ) )
3238             {
3239             my $cust = shift( @_ );
3240             CORE::return( $self->error( "No customer id was found in this customer object." ) ) if( !$cust->id );
3241             CORE::return( $self->error( "No source is set for the credit card to delete for this customer." ) ) if( !$cust->source );
3242             CORE::return( $self->error( "No credit card id found for this customer source to delete." ) ) if( !$cust->source->id );
3243             $args->{customer} = $cust->id;
3244             $args->{id} = $cust->source->id;
3245             $args->{expand} = 'all';
3246             $okParams->{_cleanup} = 1;
3247             }
3248             elsif( $self->_is_object( $_[0] ) && $_[0]->isa( 'Net::API::Stripe::Payment::Card' ) )
3249             {
3250             my $card = shift( @_ );
3251             CORE::return( $self->error( "No card id was found in this card object." ) ) if( !$card->id );
3252             CORE::return( $self->error( "No customer object is set for this card object." ) ) if( !$card->customer );
3253             CORE::return( $self->error( "No customer id found in the customer object in this card object." ) ) if( !$card->customer->id );
3254             $args->{customer} = $card->customer->id;
3255             $args->{expand} = 'all';
3256             $okParams->{_cleanup} = 1;
3257             }
3258             else
3259             {
3260             $args = $self->_get_args( @_ );
3261             }
3262             my $err = $self->_check_parameters( $okParams, $args );
3263             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
3264             my $id = CORE::delete( $args->{customer} ) || CORE::return( $self->error( "No customer id was provided to retrieve his/her card" ) );
3265             my $cardId = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No card id was provided to retrieve customer's card" ) );
3266             my $hash = $self->get( "customers/${id}/sources/${cardId}", $args ) || CORE::return( $self->pass_error );
3267             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Payment::Card', $hash ) );
3268             }
3269             PERL
3270             # NOTE: card_token_create()
3271             card_token_create => <<'PERL',
3272             sub card_token_create { CORE::return( shift->token_create( @_ ) ); }
3273             PERL
3274             # NOTE: card_update()
3275             card_update => <<'PERL',
3276             sub card_update
3277             {
3278             my $self = shift( @_ );
3279             CORE::return( $self->error( "No parameters were provided to update card." ) ) if( !scalar( @_ ) );
3280             my $args = {};
3281             my $okParams =
3282             {
3283             expandable => { allowed => $EXPANDABLES->{card} },
3284             id => { re => qr/^\w+$/, required => 1 },
3285             customer => { re => qr/^\w+$/, required => 1 },
3286             address_city => qr/^.*?$/,
3287             address_country => qr/^[a-zA-Z]{2}$/,
3288             address_line1 => qr/^.*?$/,
3289             address_line2 => qr/^.*?$/,
3290             address_state => qr/^.*?$/,
3291             address_zip => qr/^.*?$/,
3292             exp_month => qr/^\d{1,2}$/,
3293             exp_year => qr/^\d{1,2}$/,
3294             metadata => sub{ CORE::return( ref( $_[0] ) eq 'HASH' ? undef() : sprintf( "A hash ref was expected, but instead received '%s'", $_[0] ) ) },
3295             name => qr/^.*?$/,
3296             };
3297             if( $self->_is_object( $_[0] ) && $_[0]->isa( 'Net::API::Stripe::Customer' ) )
3298             {
3299             my $cust = shift( @_ );
3300             CORE::return( $self->error( "No customer id was found in this customer object." ) ) if( !$cust->id );
3301             CORE::return( $self->error( "No source is set for the credit card to delete for this customer." ) ) if( !$cust->source );
3302             CORE::return( $self->error( "No credit card id found for this customer source to delete." ) ) if( !$cust->source->id );
3303             $args = $cust->source->as_hash({ json => 1 });
3304             $args->{customer} = $cust->id;
3305             $args->{expand} = 'all';
3306             $okParams->{_cleanup} = 1;
3307             }
3308             elsif( $self->_is_object( $_[0] ) && $_[0]->isa( 'Net::API::Stripe::Payment::Card' ) )
3309             {
3310             my $card = shift( @_ );
3311             CORE::return( $self->error( "No card id was found in this card object." ) ) if( !$card->id );
3312             CORE::return( $self->error( "No customer object is set for this card object." ) ) if( !$card->customer );
3313             CORE::return( $self->error( "No customer id found in the customer object in this card object." ) ) if( !$card->customer->id );
3314             $args = $card->as_hash({ json => 1 });
3315             $args->{customer} = $card->customer->id;
3316             $args->{expand} = 'all';
3317             $okParams->{_cleanup} = 1;
3318             }
3319             else
3320             {
3321             $args = $self->_get_args( @_ );
3322             }
3323             $args = $self->_contract( 'card', $args ) || CORE::return( $self->pass_error );
3324             my $err = $self->_check_parameters( $okParams, $args );
3325             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
3326             my $id = CORE::delete( $args->{customer} ) || CORE::return( $self->error( "No customer id was provided to update his/her card." ) );
3327             my $cardId = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No card id was provided to update customer's card" ) );
3328             my $hash = $self->post( "customers/${id}/sources/${cardId}", $args ) || CORE::return( $self->pass_error );
3329             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Payment::Card', $hash ) );
3330             }
3331             PERL
3332             # NOTE: cards()
3333             cards => <<'PERL',
3334             sub cards
3335             {
3336             my $self = shift( @_ );
3337             my $action = shift( @_ );
3338             my $allowed = [qw( create retrieve update delete list )];
3339             my $meth = $self->_get_method( 'card', $action, $allowed ) || CORE::return( $self->pass_error );
3340             CORE::return( $self->$meth( @_ ) );
3341             }
3342             PERL
3343             # NOTE: cash_balance()
3344             cash_balance => <<'PERL',
3345             sub cash_balance { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Cash::Balance', @_ ) ); }
3346             PERL
3347             # NOTE: cash_balance_retrieve()
3348             cash_balance_retrieve => <<'PERL',
3349             sub cash_balance_retrieve
3350             {
3351             my $self = shift( @_ );
3352             CORE::return( $self->error( "No parameters were provided to retrieve a customer cash balance" ) ) if( !scalar( @_ ) );
3353             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Cash::Balance', @_ );
3354             my $okParams =
3355             {
3356             expandable => { allowed => $EXPANDABLES->{cash_balance} },
3357             customer => { re => qr/^\w+$/, required => 1 }
3358             };
3359             my $err = $self->_check_parameters( $okParams, $args );
3360             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
3361             my $cust = CORE::delete( $args->{customer} ) || CORE::return( $self->error( "No customer id was provided to retrieve his/her cash balance details" ) );
3362             my $hash = $self->get( "customers/${cust}/cash_balance", $args ) || CORE::return( $self->pass_error );
3363             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Cash::Balance', $hash ) );
3364             }
3365             PERL
3366             # NOTE: cash_balance_update()
3367             cash_balance_update => <<'PERL',
3368             sub cash_balance_update
3369             {
3370             my $self = shift( @_ );
3371             CORE::return( $self->error( "No parameters were provided to update a customer cash balance" ) ) if( !scalar( @_ ) );
3372             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Cash::Balance', @_ );
3373             my $okParams =
3374             {
3375             expandable => { allowed => $EXPANDABLES->{cash_balance} },
3376             customer => { re => qr/^\w+$/, required => 1 },
3377             settings => { fields => ["reconciliation_mode"], type => "hash" },
3378             };
3379              
3380             $args = $self->_contract( 'cash_balance', $args ) || CORE::return( $self->pass_error );
3381             # We found some errors
3382             my $err = $self->_check_parameters( $okParams, $args );
3383             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
3384             my $cust = CORE::delete( $args->{customer} ) || CORE::return( $self->error( "No customer id was provided to update his/her cash balance details" ) );
3385             my $hash = $self->post( "customers/${cust}/cash_balance", $args ) || CORE::return( $self->pass_error );
3386             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Cash::Balance', $hash ) );
3387             }
3388             PERL
3389             # NOTE: cash_balances()
3390             cash_balances => <<'PERL',
3391             sub cash_balances
3392             {
3393             my $self = shift( @_ );
3394             my $allowed = [qw( retrieve update )];
3395             my $action = shift( @_ );
3396             my $args = $self->_get_args( @_ );
3397             my $cust = CORE::delete( $args->{customer} ) || CORE::return( $self->error( "No customer id was provided to retrieve or update its cash balance details" ) );
3398             my $meth = $self->_get_method( "customers/${cust}/cash_balance", $action, $allowed ) || CORE::return( $self->pass_error );
3399             CORE::return( $self->$meth( $args ) );
3400             }
3401             PERL
3402             # NOTE: cash_transction()
3403             cash_transction => <<'PERL',
3404             sub cash_transction { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Cash::Transaction', @_ ) ); }
3405             PERL
3406             # NOTE: charge()
3407             charge => <<'PERL',
3408             sub charge { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Charge', @_ ) ); }
3409             PERL
3410             # NOTE: charge_capture()
3411             charge_capture => <<'PERL',
3412             sub charge_capture
3413             {
3414             my $self = shift( @_ );
3415             CORE::return( $self->error( "No parameters were provided to update a charge." ) ) if( !scalar( @_ ) );
3416             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Charge', @_ );
3417             my $okParams =
3418             {
3419             id => { re => qr/^\w+$/, required => 1 },
3420             amount => qr/^\d+$/,
3421             application_fee_amount => qr/^\d+$/,
3422             destination => [qw( amount )],
3423             expandable => { allowed => $EXPANDABLES->{charge} },
3424             receipt_email => qr/.*?/,
3425             statement_descriptor => qr/^.*?$/,
3426             statement_descriptor_suffix => qr/^.*?$/,
3427             transfer_data => [qw( amount )],
3428             transfer_group => qr/^.*?$/,
3429             };
3430             my $err = $self->_check_parameters( $okParams, $args );
3431             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
3432             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No charge id was provided to update its charge details." ) );
3433             CORE::return( $self->error( "Destination specified, but not account property provided" ) ) if( exists( $args->{destination} ) && !scalar( grep( /^account$/, @{$args->{destination}} ) ) );
3434             my $hash = $self->post( "charges/${id}/capture", $args ) || CORE::return( $self->pass_error );
3435             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Charge', $hash ) );
3436             }
3437             PERL
3438             # NOTE: charge_create()
3439             charge_create => <<'PERL',
3440             # https://stripe.com/docs/api/charges/create
3441             sub charge_create
3442             {
3443             my $self = shift( @_ );
3444             CORE::return( $self->error( "No parameters were provided to create charge." ) ) if( !scalar( @_ ) );
3445             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Charge', @_ );
3446             CORE::return( $self->error( "No amount was provided" ) ) if( !exists( $args->{amount} ) || !length( $args->{amount} ) );
3447             $args->{currency} ||= $self->currency;
3448             my $okParams =
3449             {
3450             expandable => { allowed => $EXPANDABLES->{charge} },
3451             amount => { re => qr/^\d+$/, required => 1, type => "integer" },
3452             application_fee_amount => qr/^\d+$/,
3453             capture => { type => "boolean" },
3454             currency => { re => qr/^[a-zA-Z]{3}$/, required => 1 },
3455             customer => qr/^\w+$/,
3456             description => qr/^.*?$/,
3457             destination => ["account", "amount"],
3458             idempotency => qr/^.*?$/,
3459             metadata => { type => "hash" },
3460             on_behalf_of => qr/^\w+$/,
3461             radar_options => { type => "hash" },
3462             receipt_email => qr/.*?/,
3463             shipping => {
3464             fields => ["address", "name", "carrier", "phone", "tracking_number"],
3465             type => "hash",
3466             },
3467             source => qr/^\w+$/,
3468             statement_descriptor => qr/^.*?$/,
3469             statement_descriptor_suffix => qr/^.*?$/,
3470             transfer_data => { fields => ["destination", "amount"], type => "hash" },
3471             transfer_group => qr/^.*?$/,
3472             };
3473              
3474            
3475             $args = $self->_contract( 'charge', $args ) || CORE::return( $self->pass_error );
3476             # We found some errors
3477             my $err = $self->_check_parameters( $okParams, $args );
3478             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
3479            
3480             $args->{currency} = lc( $args->{currency} );
3481             CORE::return( $self->error( "Destination specified, but no account property provided" ) ) if( exists( $args->{destination} ) && !scalar( grep( /^account$/, @{$args->{destination}} ) ) );
3482             my $hash = $self->post( 'charges', $args ) || CORE::return( $self->pass_error );
3483             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Charge', $hash ) );
3484             }
3485             PERL
3486             # NOTE: charge_list()
3487             charge_list => <<'PERL',
3488             sub charge_list
3489             {
3490             my $self = shift( @_ );
3491             my $args = shift( @_ );
3492             my $okParams =
3493             {
3494             expandable => { allowed => $EXPANDABLES->{charge}, data_prefix_is_ok => 1 },
3495             'created' => qr/^\d+$/,
3496             'created.gt' => qr/^\d+$/,
3497             'created.gte' => qr/^\d+$/,
3498             'created.lt' => qr/^\d+$/,
3499             'created.lte' => qr/^\d+$/,
3500             'customer' => qr/^\w+$/,
3501             # "A cursor for use in pagination. ending_before is an object ID that defines your place in the list."
3502             'ending_before' => qr/^\w+$/,
3503             'limit' => qr/^\d+$/,
3504             'payment_intent' => qr/^\w+$/,
3505             'source' => [qw( object )],
3506             'starting_after' => qr/^\w+$/,
3507             'transfer_group' => qr/^.*?$/,
3508             };
3509             my $err = $self->_check_parameters( $okParams, $args );
3510             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
3511             if( $args->{source} )
3512             {
3513             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)$/ );
3514             }
3515             if( $args->{expand} )
3516             {
3517             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
3518             }
3519             my $hash = $self->get( 'charges', $args ) || CORE::return( $self->pass_error );
3520             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Charge::List', $hash ) );
3521             }
3522             PERL
3523             # NOTE: charge_retrieve()
3524             charge_retrieve => <<'PERL',
3525             sub charge_retrieve
3526             {
3527             my $self = shift( @_ );
3528             CORE::return( $self->error( "No parameters were provided to retrieve a charge" ) ) if( !scalar( @_ ) );
3529             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Charge', @_ );
3530             my $okParams =
3531             {
3532             expandable => { allowed => $EXPANDABLES->{charge} },
3533             id => { re => qr/^\w+$/, required => 1 }
3534             };
3535             my $err = $self->_check_parameters( $okParams, $args );
3536             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
3537             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No charge id was provided to retrieve its charge details" ) );
3538             my $hash = $self->get( "charges/${id}", $args ) || CORE::return( $self->pass_error );
3539             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Charge', $hash ) );
3540             }
3541             PERL
3542             # NOTE: charge_search()
3543             charge_search => <<'PERL',
3544             sub charge_search
3545             {
3546             my $self = shift( @_ );
3547             CORE::return( $self->error( "No parameters were provided to search charges." ) ) if( !scalar( @_ ) );
3548             my $args = shift( @_ );
3549             my $okParams =
3550             {
3551             expandable => { allowed => $EXPANDABLES->{charge}, data_prefix_is_ok => 1 },
3552             limit => qr/^\d+$/,
3553             page => qr/^\d+$/,
3554             query => { re => qr/^.*?$/, required => 1, type => "string" },
3555             };
3556              
3557             my $err = $self->_check_parameters( $okParams, $args );
3558             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
3559             if( $args->{expand} )
3560             {
3561             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
3562             }
3563             my $hash = $self->get( "charges/search", $args ) || CORE::return( $self->pass_error );
3564             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Charge::List', $hash ) );
3565             }
3566             PERL
3567             # NOTE: charge_update()
3568             charge_update => <<'PERL',
3569             sub charge_update
3570             {
3571             my $self = shift( @_ );
3572             CORE::return( $self->error( "No parameters were provided to update a charge" ) ) if( !scalar( @_ ) );
3573             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Charge', @_ );
3574             my $okParams =
3575             {
3576             expandable => { allowed => $EXPANDABLES->{charge} },
3577             customer => qr/^\w+$/,
3578             description => qr/^.*?$/,
3579             fraud_details => { fields => ["user_report"], type => "hash" },
3580             id => { re => qr/^\w+$/, required => 1 },
3581             metadata => { type => "hash" },
3582             receipt_email => qr/.*?/,
3583             shipping => {
3584             fields => ["address", "name", "carrier", "phone", "tracking_number"],
3585             type => "hash",
3586             },
3587             transfer_group => qr/^.*?$/,
3588             };
3589              
3590             $args = $self->_contract( 'charge', $args ) || CORE::return( $self->pass_error );
3591             # We found some errors
3592             my $err = $self->_check_parameters( $okParams, $args );
3593             if( $args->{fraud_details} )
3594             {
3595             my $this = $args->{fraud_details};
3596             if( $this->{user_report} !~ /^(?:fraudulent|safe)$/ )
3597             {
3598             CORE::return( $self->error( "Invalid value for fraud_details. It should be either fraudulent or safe" ) );
3599             }
3600             }
3601             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
3602             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No charge id was provided to update its charge details" ) );
3603             my $hash = $self->post( "charges/${id}", $args ) || CORE::return( $self->pass_error );
3604             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Charge', $hash ) );
3605             }
3606             PERL
3607             # NOTE: charges()
3608             charges => <<'PERL',
3609             sub charges
3610             {
3611             my $self = shift( @_ );
3612             my $allowed = [qw( create retrieve update capture list search )];
3613             my $action = shift( @_ );
3614             my $args = $self->_get_args( @_ );
3615             my $meth = $self->_get_method( 'charge', $action, $allowed ) || CORE::return( $self->pass_error );
3616             CORE::return( $self->$meth( $args ) );
3617             }
3618             PERL
3619             # NOTE: checkout_session()
3620             checkout_session => <<'PERL',
3621             sub checkout_session { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Checkout::Session', @_ ) ); }
3622             PERL
3623             # NOTE: checkout_session_create()
3624             checkout_session_create => <<'PERL',
3625             sub checkout_session_create
3626             {
3627             my $self = shift( @_ );
3628             my $args = shift( @_ );
3629             my $okParams =
3630             {
3631             expandable => { allowed => $EXPANDABLES->{ 'checkout.session' } },
3632             after_expiration => { type => "hash" },
3633             allow_promotion_codes => { type => "boolean" },
3634             automatic_tax => { type => "hash" },
3635             billing_address_collection => { type => "string" },
3636             cancel_url => { type => "string", required => 1 },
3637             client_reference_id => { type => "string" },
3638             consent_collection => { type => "hash" },
3639             currency => { type => "string" },
3640             customer => { type => "string" },
3641             customer_creation => { type => "string" },
3642             customer_email => { type => "string" },
3643             customer_update => { type => "object" },
3644             discounts => { type => "array" },
3645             expires_at => { type => "timestamp" },
3646             line_items => { type => "hash" },
3647             locale => { type => "string" },
3648             metadata => { type => "hash" },
3649             mode => { type => "string" },
3650             payment_intent_data => { type => "object" },
3651             payment_method_collection => { type => "string" },
3652             payment_method_options => { type => "hash" },
3653             payment_method_types => { type => "array" },
3654             phone_number_collection => { type => "hash" },
3655             setup_intent_data => { type => "object" },
3656             shipping_address_collection => { type => "hash" },
3657             shipping_options => { type => "array" },
3658             submit_type => { type => "string" },
3659             subscription_data => { type => "object" },
3660             success_url => { type => "string", required => 1 },
3661             tax_id_collection => { type => "hash" },
3662             };
3663             $args = $self->_contract( 'checkout.session', $args ) || CORE::return( $self->pass_error );
3664             my $err = $self->_check_parameters( $okParams, $args );
3665             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
3666             my $hash = $self->post( "", $args ) || CORE::return( $self->pass_error );
3667             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Checkout::Session', $hash ) );
3668             }
3669             PERL
3670             # NOTE: checkout_session_expire()
3671             checkout_session_expire => <<'PERL',
3672             sub checkout_session_expire
3673             {
3674             my $self = shift( @_ );
3675             my $args = shift( @_ );
3676             my $okParams =
3677             {
3678             expandable => { allowed => $EXPANDABLES->{ 'checkout.session' } },
3679             };
3680             $args = $self->_contract( 'checkout.session', $args ) || CORE::return( $self->pass_error );
3681             my $err = $self->_check_parameters( $okParams, $args );
3682             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
3683             my $hash = $self->post( "", $args ) || CORE::return( $self->pass_error );
3684             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Checkout::Session', $hash ) );
3685             }
3686             PERL
3687             # NOTE: checkout_session_items()
3688             checkout_session_items => <<'PERL',
3689             sub checkout_session_items
3690             {
3691             my $self = shift( @_ );
3692             CORE::return( $self->error( "No parameters were provided to items checkout session information." ) ) if( !scalar( @_ ) );
3693             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Checkout::Session', @_ );
3694             my $okParams =
3695             {
3696             expandable => { allowed => $EXPANDABLES->{ 'checkout.session' }, data_prefix_is_ok => 1 },
3697             ending_before => { type => "string" },
3698             limit => { type => "string" },
3699             starting_after => { type => "string" },
3700             };
3701             my $err = $self->_check_parameters( $okParams, $args );
3702             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
3703             my $hash = $self->get( "", $args ) || CORE::return( $self->pass_error );
3704             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Checkout::Session', $hash ) );
3705             }
3706             PERL
3707             # NOTE: checkout_session_list()
3708             checkout_session_list => <<'PERL',
3709             sub checkout_session_list
3710             {
3711             my $self = shift( @_ );
3712             CORE::return( $self->error( "No parameters were provided to list checkout session information." ) ) if( !scalar( @_ ) );
3713             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Checkout::Session', @_ );
3714             my $okParams =
3715             {
3716             expandable => { allowed => $EXPANDABLES->{ 'checkout.session' }, data_prefix_is_ok => 1 },
3717             customer => { type => "string" },
3718             customer_details => { type => "hash" },
3719             ending_before => { type => "string" },
3720             limit => { type => "string" },
3721             payment_intent => { type => "string" },
3722             starting_after => { type => "string" },
3723             subscription => { type => "string" },
3724             };
3725             my $err = $self->_check_parameters( $okParams, $args );
3726             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
3727             if( $args->{expand} )
3728             {
3729             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
3730             }
3731             my $hash = $self->get( "", $args ) || CORE::return( $self->pass_error );
3732             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Checkout::Session', $hash ) );
3733             }
3734             PERL
3735             # NOTE: checkout_session_retrieve()
3736             checkout_session_retrieve => <<'PERL',
3737             sub checkout_session_retrieve
3738             {
3739             my $self = shift( @_ );
3740             my $args = shift( @_ );
3741             my $okParams =
3742             {
3743             expandable => { allowed => $EXPANDABLES->{ 'checkout.session' }, data_prefix_is_ok => 1 },
3744             };
3745             $args = $self->_contract( 'checkout.session', $args ) || CORE::return( $self->pass_error );
3746             my $err = $self->_check_parameters( $okParams, $args );
3747             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
3748             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No checkout.session id (with parameter 'id') was provided to retrieve its information." ) );
3749             my $hash = $self->get( "checkout/sessions/${id}", $args ) || CORE::return( $self->pass_error );
3750             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Checkout::Session', $hash ) );
3751             }
3752             PERL
3753             # NOTE: checkout_sessions()
3754             checkout_sessions => <<'PERL',
3755             # <https://stripe.com/docs/api/checkout/sessions>
3756             sub checkout_sessions
3757             {
3758             my $self = shift( @_ );
3759             my $allowed = [qw( create expire items list retrieve )];
3760             my $action = shift( @_ );
3761             my $meth = $self->_get_method( 'checkout_session', $action, $allowed ) || CORE::return( $self->pass_error );
3762             CORE::return( $self->$meth( @_ ) );
3763             }
3764             PERL
3765             # NOTE: code_verification()
3766             code_verification => <<'PERL',
3767             sub code_verification { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Payment::Source::CodeVerification', @_ ) ); }
3768             PERL
3769             # NOTE: company()
3770             company => <<'PERL',
3771             sub company { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Connect::Account::Company', @_ ) ); }
3772             PERL
3773             # NOTE: connection_token()
3774             connection_token => <<'PERL',
3775             sub connection_token { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Terminal::ConnectionToken', @_ ) ); }
3776             PERL
3777             # NOTE: country_spec()
3778             country_spec => <<'PERL',
3779             sub country_spec { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Connect::CountrySpec', @_ ) ); }
3780             PERL
3781             # NOTE: country_spec_list()
3782             country_spec_list => <<'PERL',
3783             sub country_spec_list
3784             {
3785             my $self = shift( @_ );
3786             CORE::return( $self->error( "No parameters were provided to list country spec information." ) ) if( !scalar( @_ ) );
3787             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Connect::CountrySpec', @_ );
3788             my $okParams =
3789             {
3790             expandable => { allowed => $EXPANDABLES->{ 'country_spec' }, data_prefix_is_ok => 1 },
3791             ending_before => { type => "string" },
3792             limit => { type => "string" },
3793             starting_after => { type => "string" },
3794             };
3795             my $err = $self->_check_parameters( $okParams, $args );
3796             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
3797             if( $args->{expand} )
3798             {
3799             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
3800             }
3801             my $hash = $self->get( "country_specs", $args ) || CORE::return( $self->pass_error );
3802             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Connect::CountrySpec', $hash ) );
3803             }
3804             PERL
3805             # NOTE: country_spec_retrieve()
3806             country_spec_retrieve => <<'PERL',
3807             sub country_spec_retrieve
3808             {
3809             my $self = shift( @_ );
3810             my $args = shift( @_ );
3811             my $okParams =
3812             {
3813             expandable => { allowed => $EXPANDABLES->{ 'country_spec' }, data_prefix_is_ok => 1 },
3814             };
3815             $args = $self->_contract( 'country_spec', $args ) || CORE::return( $self->pass_error );
3816             my $err = $self->_check_parameters( $okParams, $args );
3817             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
3818             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No country_spec id (with parameter 'id') was provided to retrieve its information." ) );
3819             my $hash = $self->get( "country_specs/${id}", $args ) || CORE::return( $self->pass_error );
3820             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Connect::CountrySpec', $hash ) );
3821             }
3822             PERL
3823             # NOTE: country_specs()
3824             country_specs => <<'PERL',
3825             # <https://stripe.com/docs/api/country_specs>
3826             sub country_specs
3827             {
3828             my $self = shift( @_ );
3829             my $allowed = [qw( list retrieve )];
3830             my $action = shift( @_ );
3831             my $meth = $self->_get_method( 'country_spec', $action, $allowed ) || CORE::return( $self->pass_error );
3832             CORE::return( $self->$meth( @_ ) );
3833             }
3834             PERL
3835             # NOTE: coupon()
3836             coupon => <<'PERL',
3837             sub coupon { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Product::Coupon', @_ ) ); }
3838             PERL
3839             # NOTE: coupon_create()
3840             coupon_create => <<'PERL',
3841             sub coupon_create
3842             {
3843             my $self = shift( @_ );
3844             CORE::return( $self->error( "No parameters were provided to create a coupon" ) ) if( !scalar( @_ ) );
3845             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Product::Coupon', @_ );
3846             my $okParams =
3847             {
3848             expandable => { allowed => $EXPANDABLES->{coupon} },
3849             amount_off => { re => qr/^\d+$/, type => "integer" },
3850             applies_to => { type => "hash" },
3851             currency => { re => qr/^[a-zA-Z]{3}$/, type => "string" },
3852             currency_options => { type => "hash" },
3853             duration => { re => qr/^(forever|once|repeating)$/, type => "string" },
3854             duration_in_months => { re => qr/^\d+$/, type => "integer" },
3855             id => { type => "string" },
3856             max_redemptions => { re => qr/^\d+$/, type => "integer" },
3857             metadata => { type => "hash" },
3858             name => { type => "string" },
3859             percent_off => sub { ... },
3860             redeem_by => { type => "timestamp" },
3861             };
3862              
3863             $args = $self->_contract( 'coupon', $args ) || CORE::return( $self->pass_error );
3864             my $err = $self->_check_parameters( $okParams, $args );
3865             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
3866             my $hash = $self->post( 'coupons', $args ) || CORE::return( $self->pass_error );
3867             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Product::Coupon', $hash ) );
3868             }
3869             PERL
3870             # NOTE: coupon_delete()
3871             coupon_delete => <<'PERL',
3872             sub coupon_delete
3873             {
3874             my $self = shift( @_ );
3875             CORE::return( $self->error( "No parameters were provided to delete coupon information." ) ) if( !scalar( @_ ) );
3876             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Product::Coupon', @_ );
3877             my $okParams =
3878             {
3879             expandable => { allowed => $EXPANDABLES->{coupon} },
3880             id => { re => qr/^\S+$/, required => 1 }
3881             };
3882             my $err = $self->_check_parameters( $okParams, $args );
3883             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
3884             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No coupon id was provided to delete its information." ) );
3885             my $hash = $self->delete( "coupons/${id}", $args ) || CORE::return( $self->pass_error );
3886             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Product::Coupon', $hash ) );
3887             }
3888             PERL
3889             # NOTE: coupon_list()
3890             coupon_list => <<'PERL',
3891             sub coupon_list
3892             {
3893             my $self = shift( @_ );
3894             my $args = shift( @_ );
3895             my $okParams =
3896             {
3897             expandable => { allowed => $EXPANDABLES->{coupon} },
3898             'created' => qr/^\d+$/,
3899             'created.gt' => qr/^\d+$/,
3900             'created.gte' => qr/^\d+$/,
3901             'created.lt' => qr/^\d+$/,
3902             'created.lte' => qr/^\d+$/,
3903             # "A cursor for use in pagination. ending_before is an object ID that defines your place in the list."
3904             'ending_before' => qr/^\w+$/,
3905             'limit' => qr/^\d+$/,
3906             'starting_after' => qr/^\w+$/,
3907             };
3908             my $err = $self->_check_parameters( $okParams, $args );
3909             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
3910             if( $args->{expand} )
3911             {
3912             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
3913             }
3914             my $hash = $self->get( 'coupons', $args ) || CORE::return( $self->pass_error );
3915             CORE::return( $self->_response_to_object( 'Net::API::Stripe::List', $hash ) );
3916             }
3917             PERL
3918             # NOTE: coupon_retrieve()
3919             coupon_retrieve => <<'PERL',
3920             sub coupon_retrieve
3921             {
3922             my $self = shift( @_ );
3923             CORE::return( $self->error( "No parameters were provided to retrieve coupon information." ) ) if( !scalar( @_ ) );
3924             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Product::Coupon', @_ );
3925             my $okParams =
3926             {
3927             expandable => { allowed => $EXPANDABLES->{coupon} },
3928             id => { re => qr/^\S+$/, required => 1 }
3929             };
3930             my $err = $self->_check_parameters( $okParams, $args );
3931             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
3932             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No coupon id was provided to retrieve its information." ) );
3933             my $hash = $self->get( "coupons/${id}", $args ) || CORE::return( $self->pass_error );
3934             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Product::Coupon', $hash ) );
3935             }
3936             PERL
3937             # NOTE: coupon_update()
3938             coupon_update => <<'PERL',
3939             sub coupon_update
3940             {
3941             my $self = shift( @_ );
3942             CORE::return( $self->error( "No parameters were provided to update a coupon" ) ) if( !scalar( @_ ) );
3943             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Product::Coupon', @_ );
3944             my $okParams =
3945             {
3946             expandable => { allowed => $EXPANDABLES->{coupon} },
3947             currency_options => { type => "hash" },
3948             id => { re => qr/^\S+$/, required => 1 },
3949             metadata => { type => "hash" },
3950             name => { type => "string" },
3951             };
3952              
3953             $args = $self->_contract( 'coupon', $args ) || CORE::return( $self->pass_error );
3954             # We found some errors
3955             my $err = $self->_check_parameters( $okParams, $args );
3956             # $self->message( 3, "Data to be posted: ", $self->dumper( $args ) ); exit;
3957             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
3958             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No coupon id was provided to update coupon's details" ) );
3959             my $hash = $self->post( "coupons/${id}", $args ) || CORE::return( $self->pass_error );
3960             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Product::Coupon', $hash ) );
3961             }
3962             PERL
3963             # NOTE: coupons()
3964             coupons => <<'PERL',
3965             sub coupons
3966             {
3967             my $self = shift( @_ );
3968             my $action = shift( @_ );
3969             my $allowed = [qw( create retrieve update delete list )];
3970             my $meth = $self->_get_method( 'coupon', $action, $allowed ) || CORE::return( $self->pass_error );
3971             CORE::return( $self->$meth( @_ ) );
3972             }
3973             PERL
3974             # NOTE: credit_note()
3975             credit_note => <<'PERL',
3976             sub credit_note { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Billing::CreditNote', @_ ) ); }
3977             PERL
3978             # NOTE: credit_note_create()
3979             credit_note_create => <<'PERL',
3980             sub credit_note_create
3981             {
3982             my $self = shift( @_ );
3983             CORE::return( $self->error( "No parameters were provided to create a credit note" ) ) if( !scalar( @_ ) );
3984             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Billing::CreditNote', @_ );
3985             # If we are provided with an invoice object, we change our value for only its id
3986             if( $args->{_object} &&
3987             $self->_is_object( $args->{_object}->{invoice} ) &&
3988             $args->{_object}->invoice->isa( 'Net::API::Stripe::Billing::Invoice' ) )
3989             {
3990             my $cred = CORE::delete( $args->{_object} );
3991             $args->{invoice} = $cred->invoice->id || CORE::return( $self->error( "The Invoice object provided for this credit note has no id." ) );
3992             }
3993            
3994             my $okParams =
3995             {
3996             expandable => { allowed => $EXPANDABLES->{credit_note} },
3997             amount => { re => qr/^\d+$/, type => "integer" },
3998             credit_amount => { re => qr/^\d+$/, type => "integer" },
3999             invoice => { re => qr/^\w+$/, required => 1, type => "string" },
4000             lines => {
4001             fields => [
4002             "amount",
4003             "description",
4004             "invoice_line_item",
4005             "quantity",
4006             "tax_rates",
4007             "type",
4008             "unit_amount",
4009             "unit_amount_decimal",
4010             ],
4011             type => "array",
4012             },
4013             memo => { type => "string" },
4014             metadata => { type => "hash" },
4015             out_of_band_amount => { re => qr/^\d+$/, type => "integer" },
4016             reason => {
4017             re => qr/^(duplicate|fraudulent|order_change|product_unsatisfactory)$/,
4018             type => "string",
4019             },
4020             refund => { re => qr/^\w+$/, type => "string" },
4021             refund_amount => { re => qr/^\d+$/, type => "integer" },
4022             };
4023              
4024             $args = $self->_contract( 'credit_note', $args ) || CORE::return( $self->pass_error );
4025             my $err = $self->_check_parameters( $okParams, $args );
4026             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
4027             my $hash = $self->post( 'credit_notes', $args ) || CORE::return( $self->pass_error );
4028             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::CreditNote', $hash ) );
4029             }
4030             PERL
4031             # NOTE: credit_note_line_item()
4032             credit_note_line_item => <<'PERL',
4033             sub credit_note_line_item { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Billing::CreditNote::LineItem', @_ ) ); }
4034             PERL
4035             # NOTE: credit_note_line_item_list()
4036             credit_note_line_item_list => <<'PERL',
4037             sub credit_note_line_item_list
4038             {
4039             my $self = shift( @_ );
4040             CORE::return( $self->error( "No parameters were provided to list credit note line item information." ) ) if( !scalar( @_ ) );
4041             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Billing::CreditNote::LineItem', @_ );
4042             my $okParams =
4043             {
4044             expandable => { allowed => $EXPANDABLES->{ 'credit_note_line_item' }, data_prefix_is_ok => 1 },
4045             amount => { type => "integer" },
4046             credit_amount => { type => "string" },
4047             ending_before => { type => "string" },
4048             invoice => { type => "string", required => 1 },
4049             limit => { type => "string" },
4050             lines => { type => "string" },
4051             memo => { type => "string" },
4052             metadata => { type => "string" },
4053             out_of_band_amount => { type => "string" },
4054             reason => { type => "string" },
4055             refund => { type => "string" },
4056             refund_amount => { type => "string" },
4057             starting_after => { type => "string" },
4058             };
4059             my $err = $self->_check_parameters( $okParams, $args );
4060             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
4061             if( $args->{expand} )
4062             {
4063             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
4064             }
4065             my $hash = $self->get( "credit_notes/preview/lines", $args ) || CORE::return( $self->pass_error );
4066             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::CreditNote::LineItem', $hash ) );
4067             }
4068             PERL
4069             # NOTE: credit_note_line_items()
4070             credit_note_line_items => <<'PERL',
4071             # <https://stripe.com/docs/api/credit_notes>
4072             sub credit_note_line_items
4073             {
4074             my $self = shift( @_ );
4075             my $allowed = [qw( list )];
4076             my $action = shift( @_ );
4077             my $meth = $self->_get_method( 'credit_note_line_item', $action, $allowed ) || CORE::return( $self->pass_error );
4078             CORE::return( $self->$meth( @_ ) );
4079             }
4080             PERL
4081             # NOTE: credit_note_lines()
4082             credit_note_lines => <<'PERL',
4083             sub credit_note_lines
4084             {
4085             my $self = shift( @_ );
4086             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Billing::CreditNote', @_ );
4087             CORE::return( $self->error( "No credit note id was provided to retrieve its information." ) ) if( !CORE::length( $args->{id} ) );
4088             my $okParams =
4089             {
4090             id => { re => qr/^\w+$/, required => 1 },
4091             # "A cursor for use in pagination. ending_before is an object ID that defines your place in the list."
4092             ending_before => { re => qr/^\w+$/ },
4093             limit => { re => qr/^\d+$/ },
4094             starting_after => { re => qr/^\w+$/ },
4095             };
4096             my $err = $self->_check_parameters( $okParams, $args );
4097             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
4098             my $id = CORE::delete( $args->{id} );
4099             my $hash = $self->get( "credit_notes/${id}/lines", $args ) || CORE::return( $self->pass_error );
4100             CORE::return( $self->_response_to_object( 'Net::API::Stripe::List', $hash ) );
4101             }
4102             PERL
4103             # NOTE: credit_note_lines_preview()
4104             credit_note_lines_preview => <<'PERL',
4105             sub credit_note_lines_preview
4106             {
4107             my $self = shift( @_ );
4108             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Billing::CreditNote', @_ );
4109             # CORE::return( $self->error( "No credit note id was provided to retrieve its information." ) ) if( !CORE::length( $args->{id} ) );
4110             CORE::return( $self->error( "No invoice id or object was provided." ) ) if( !CORE::length( $args->{invoice} ) );
4111             if( $args->{_object} &&
4112             $self->_is_object( $args->{_object}->{invoice} ) &&
4113             $args->{_object}->invoice->isa( 'Net::API::Stripe::Billing::Invoice' ) )
4114             {
4115             my $cred = CORE::delete( $args->{_object} );
4116             $args->{invoice} = $cred->invoice->id || CORE::return( $self->error( "The Invoice object provided for this credit note has no id." ) );
4117             }
4118            
4119             my $okParams =
4120             {
4121             expandable => { allowed => $EXPANDABLES->{credit_note_lines} },
4122             # id => { re => qr/^\w+$/, required => 1 },
4123             invoice => { re => qr/^\w+$/, required => 1 },
4124             amount => { re => qr/^\d+$/ },
4125             credit_amount => { re => qr/^\d+$/ },
4126             ending_before => { re => qr/^\w+$/ },
4127             limit => { re => qr/^\d+$/ },
4128             lines => { type => 'array', fields => [qw( amount description invoice_line_item quantity tax_rates type unit_amount unit_amount_decimal )] },
4129             memo => {},
4130             metadata => { type => 'hash' },
4131             out_of_band_amount => { re => qr/^\d+$/ },
4132             reason => { re => qr/^(duplicate|fraudulent|order_change|product_unsatisfactory)$/ },
4133             refund => { re => qr/^\w+$/ },
4134             refund_amount => { re => qr/^\d+$/ },
4135             starting_after => { re => qr/^\w+$/ },
4136             };
4137             my $err = $self->_check_parameters( $okParams, $args );
4138             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
4139             my $id = CORE::delete( $args->{id} );
4140             my $hash = $self->get( "credit_notes/preview/${id}/lines", $args ) || CORE::return( $self->pass_error );
4141             CORE::return( $self->_response_to_object( 'Net::API::Stripe::List', $hash ) );
4142             }
4143             PERL
4144             # NOTE: credit_note_list()
4145             credit_note_list => <<'PERL',
4146             sub credit_note_list
4147             {
4148             my $self = shift( @_ );
4149             my $args = shift( @_ );
4150             my $okParams =
4151             {
4152             expandable => { allowed => $EXPANDABLES->{credit_note}, data_prefix_is_ok => 1 },
4153             created => qr/^\d+$/,
4154             'created.gt' => qr/^\d+$/,
4155             'created.gte' => qr/^\d+$/,
4156             'created.lt' => qr/^\d+$/,
4157             'created.lte' => qr/^\d+$/,
4158             customer => { type => "string" },
4159             ending_before => qr/^\w+$/,
4160             invoice => { type => "string" },
4161             limit => qr/^\d+$/,
4162             starting_after => qr/^\w+$/,
4163             };
4164              
4165             my $err = $self->_check_parameters( $okParams, $args );
4166             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
4167             if( $args->{expand} )
4168             {
4169             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
4170             }
4171             my $hash = $self->get( 'coupons', $args ) || CORE::return( $self->pass_error );
4172             CORE::return( $self->_response_to_object( 'Net::API::Stripe::List', $hash ) );
4173             }
4174             PERL
4175             # NOTE: credit_note_preview()
4176             credit_note_preview => <<'PERL',
4177             sub credit_note_preview
4178             {
4179             my $self = shift( @_ );
4180             CORE::return( $self->error( "No parameters were provided to preview a credit note" ) ) if( !scalar( @_ ) );
4181             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Billing::CreditNote', @_ );
4182            
4183             my $obj = $args->{_object};
4184             # If we are provided with an invoice object, we change our value for only its id
4185             if( $obj && $obj->invoice )
4186             {
4187             $args->{invoice} = $obj->invoice->id || CORE::return( $self->error( "The Invoice object provided for this credit note has no id." ) );
4188             }
4189            
4190             my $okParams =
4191             {
4192             expandable => { allowed => $EXPANDABLES->{credit_note}, data_prefix_is_ok => 1 },
4193             amount => { re => qr/^\d+$/, type => "integer" },
4194             credit_amount => { re => qr/^\d+$/, type => "string" },
4195             invoice => { required => 1, type => "string" },
4196             lines => {
4197             fields => [
4198             "amount",
4199             "description",
4200             "invoice_line_item",
4201             "quantity",
4202             "tax_rates",
4203             "type",
4204             "unit_amount",
4205             "unit_amount_decimal",
4206             ],
4207             type => "array",
4208             },
4209             memo => { type => "string" },
4210             metadata => { type => "hash" },
4211             out_of_band_amount => { re => qr/^\d+$/, type => "integer" },
4212             reason => {
4213             re => qr/^(duplicate|fraudulent|order_change|product_unsatisfactory)$/,
4214             type => "string",
4215             },
4216             refund => { re => qr/^\w+$/, type => "string" },
4217             refund_amount => { re => qr/^\d+$/, type => "string" },
4218             };
4219              
4220             my $err = $self->_check_parameters( $okParams, $args );
4221             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
4222             my $hash = $self->post( 'credit_notes/preview', $args ) || CORE::return( $self->pass_error );
4223             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::CreditNote', $hash ) );
4224             }
4225             PERL
4226             # NOTE: credit_note_retrieve()
4227             credit_note_retrieve => <<'PERL',
4228             sub credit_note_retrieve
4229             {
4230             my $self = shift( @_ );
4231             CORE::return( $self->error( "No parameters were provided to retrieve credit note information." ) ) if( !scalar( @_ ) );
4232             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Billing::CreditNote', @_ );
4233             my $okParams =
4234             {
4235             expandable => { allowed => $EXPANDABLES->{credit_note} },
4236             id => { re => qr/^\w+$/, required => 1 }
4237             };
4238             my $err = $self->_check_parameters( $okParams, $args );
4239             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
4240             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No credit note id was provided to retrieve its information." ) );
4241             my $hash = $self->get( "credit_notes/${id}", $args ) || CORE::return( $self->pass_error );
4242             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::CreditNote', $hash ) );
4243             }
4244             PERL
4245             # NOTE: credit_note_update()
4246             credit_note_update => <<'PERL',
4247             sub credit_note_update
4248             {
4249             my $self = shift( @_ );
4250             CORE::return( $self->error( "No parameters were provided to update a credit note" ) ) if( !scalar( @_ ) );
4251             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Billing::CreditNote', @_ );
4252             my $okParams =
4253             {
4254             expandable => { allowed => $EXPANDABLES->{credit_note} },
4255             id => { re => qr/^\w+$/, required => 1 },
4256             memo => { type => "string" },
4257             metadata => { type => "hash" },
4258             };
4259              
4260             $args = $self->_contract( 'credit_note', $args ) || CORE::return( $self->pass_error );
4261             # We found some errors
4262             my $err = $self->_check_parameters( $okParams, $args );
4263             # $self->message( 3, "Data to be posted: ", $self->dumper( $args ) ); exit;
4264             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
4265             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No credit note id was provided to update credit note's details" ) );
4266             my $hash = $self->post( "credit_notes/${id}", $args ) || CORE::return( $self->pass_error );
4267             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::CreditNote', $hash ) );
4268             }
4269             PERL
4270             # NOTE: credit_note_void()
4271             credit_note_void => <<'PERL',
4272             sub credit_note_void
4273             {
4274             my $self = shift( @_ );
4275             CORE::return( $self->error( "No parameters were provided to void credit note information." ) ) if( !scalar( @_ ) );
4276             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Billing::CreditNote', @_ );
4277             my $okParams =
4278             {
4279             expandable => { allowed => $EXPANDABLES->{credit_note} },
4280             id => { re => qr/^\w+$/, required => 1 }
4281             };
4282             my $err = $self->_check_parameters( $okParams, $args );
4283             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
4284             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No credit note id was provided to void it." ) );
4285             my $hash = $self->post( "credit_notes/${id}/void", $args ) || CORE::return( $self->pass_error );
4286             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::CreditNote', $hash ) );
4287             }
4288             PERL
4289             # NOTE: credit_notes()
4290             credit_notes => <<'PERL',
4291             sub credit_notes
4292             {
4293             my $self = shift( @_ );
4294             my $action = shift( @_ );
4295             # delete is an alias of void to make it more mnemotechnical to remember
4296             $action = 'void' if( $action eq 'delete' );
4297             my $allowed = [qw( preview create lines lines_preview retrieve update void list )];
4298             my $meth = $self->_get_method( 'coupons', $action, $allowed ) || CORE::return( $self->pass_error );
4299             CORE::return( $self->$meth( @_ ) );
4300             }
4301             PERL
4302             # NOTE: customer()
4303             customer => <<'PERL',
4304             sub customer { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Customer', @_ ) ); }
4305             PERL
4306             # NOTE: customer_balance_transaction()
4307             customer_balance_transaction => <<'PERL',
4308             sub customer_balance_transaction { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Customer::BalanceTransaction', @_ ) ); }
4309             PERL
4310             # NOTE: customer_balance_transaction_create()
4311             customer_balance_transaction_create => <<'PERL',
4312             sub customer_balance_transaction_create
4313             {
4314             my $self = shift( @_ );
4315             CORE::return( $self->error( "No parameters were provided to create a customer balance transaction" ) ) if( !scalar( @_ ) );
4316             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Customer::BalanceTransaction', @_ );
4317             my $okParams =
4318             {
4319             expandable => { allowed => $EXPANDABLES->{customer_balance_transaction} },
4320             amount => { re => qr/^\d+$/, required => 1, type => "integer" },
4321             currency => { re => qr/^[A-Z]{3}$/, required => 1, type => "string" },
4322             customer => { re => qr/^\w+$/, required => 1 },
4323             description => { type => "string" },
4324             metadata => { type => "hash" },
4325             };
4326              
4327             $args = $self->_contract( 'customer_balance_transaction', $args ) || CORE::return( $self->pass_error );
4328             my $err = $self->_check_parameters( $okParams, $args );
4329             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
4330             my $id = CORE::delete( $args->{customer} ) || CORE::return( $self->error( "No customer id was provided to create a balance transaction." ) );
4331             my $hash = $self->post( "customers/${id}/balance_transactions" ) || CORE::return( $self->pass_error );
4332             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Customer::BalanceTransaction', $hash ) );
4333             }
4334             PERL
4335             # NOTE: customer_balance_transaction_list()
4336             customer_balance_transaction_list => <<'PERL',
4337             sub customer_balance_transaction_list
4338             {
4339             my $self = shift( @_ );
4340             my $args = shift( @_ );
4341             my $okParams =
4342             {
4343             expandable => { allowed => $EXPANDABLES->{customer_balance_transaction}, data_prefix_is_ok => 1 },
4344             customer => { re => qr/^\w+$/, required => 1 },
4345             # "A cursor for use in pagination. ending_before is an object ID that defines your place in the list."
4346             'ending_before' => qr/^\w+$/,
4347             'limit' => qr/^\d+$/,
4348             'starting_after' => qr/^\w+$/,
4349             };
4350             my $err = $self->_check_parameters( $okParams, $args );
4351             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
4352             my $cust = CORE::delete( $args->{customer} ) || CORE::return( $self->error( "No customer id was provided to get a list of his/her balance transactions." ) );
4353             if( $args->{expand} )
4354             {
4355             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
4356             }
4357             my $hash = $self->get( "customers/${cust}/balance_transactions", $args ) || CORE::return( $self->pass_error );
4358             CORE::return( $self->_response_to_object( 'Net::API::Stripe::List', $hash ) );
4359             }
4360             PERL
4361             # NOTE: customer_balance_transaction_retrieve()
4362             customer_balance_transaction_retrieve => <<'PERL',
4363             sub customer_balance_transaction_retrieve
4364             {
4365             my $self = shift( @_ );
4366             CORE::return( $self->error( "No parameters were provided to retrieve customer balance transaction information." ) ) if( !scalar( @_ ) );
4367             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Customer::BalanceTransaction', @_ );
4368             my $okParams =
4369             {
4370             expandable => { allowed => $EXPANDABLES->{customer_balance_transaction} },
4371             id => { re => qr/^\w+$/, required => 1 },
4372             customer => { re => qr/^\w+$/, required => 1 },
4373             };
4374             my $err = $self->_check_parameters( $okParams, $args );
4375             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
4376             my $cust = CORE::delete( $args->{customer} ) || CORE::return( $self->error( "No customer id was provided to retrieve his/her bank account information." ) );
4377             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No customer balance transaction information id was provided to retrieve its information." ) );
4378             my $hash = $self->get( "customers/${cust}/balance_transactions/${id}", $args ) || CORE::return( $self->pass_error );
4379             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Customer::BalanceTransaction', $hash ) );
4380             }
4381             PERL
4382             # NOTE: customer_balance_transaction_update()
4383             customer_balance_transaction_update => <<'PERL',
4384             sub customer_balance_transaction_update
4385             {
4386             my $self = shift( @_ );
4387             CORE::return( $self->error( "No parameters were provided to update the customer balance transaction" ) ) if( !scalar( @_ ) );
4388             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Customer::BalanceTransaction', @_ );
4389             my $okParams =
4390             {
4391             expandable => { allowed => $EXPANDABLES->{customer_balance_transaction} },
4392             customer => { re => qr/^\w+$/, required => 1 },
4393             description => { type => "string" },
4394             id => { re => qr/^\w+$/, required => 1 },
4395             metadata => { type => "hash" },
4396             };
4397              
4398             $args = $self->_contract( 'customer_bank_account', $args ) || CORE::return( $self->pass_error );
4399             # We found some errors
4400             my $err = $self->_check_parameters( $okParams, $args );
4401             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
4402             my $cust = CORE::delete( $args->{customer} ) || CORE::return( $self->error( "No customer id was provided to update the customer's balance transaction details" ) );
4403             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No balance transaction id was provided to update its details" ) );
4404             my $hash = $self->post( "customers/${cust}/balance_transactions/${id}", $args ) || CORE::return( $self->pass_error );
4405             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Customer::BalanceTransaction', $hash ) );
4406             }
4407             PERL
4408             # NOTE: customer_balance_transactions()
4409             customer_balance_transactions => <<'PERL',
4410             sub customer_balance_transactions
4411             {
4412             my $self = shift( @_ );
4413             my $allowed = [qw( create retrieve update list )];
4414             my $action = shift( @_ );
4415             my $meth = $self->_get_method( 'customer_balance_transaction', $action, $allowed ) || CORE::return( $self->pass_error );
4416             CORE::return( $self->$meth( @_ ) );
4417             }
4418             PERL
4419             # NOTE: customer_bank_account()
4420             customer_bank_account => <<'PERL',
4421             sub customer_bank_account { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Customer::BankAccount', @_ ) ); }
4422             PERL
4423             # NOTE: customer_bank_account_create()
4424             customer_bank_account_create => <<'PERL',
4425             sub customer_bank_account_create
4426             {
4427             my $self = shift( @_ );
4428             CORE::return( $self->error( "No parameters were provided to create a customer bank account" ) ) if( !scalar( @_ ) );
4429             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Payment::Source', @_ );
4430             my $okParams =
4431             {
4432             expandable => { allowed => $EXPANDABLES->{customer_bank_account} },
4433             id => { re => qr/^\w+$/, required => 1 },
4434             object => { type => 'string', re => qr/^bank_account$/ },
4435             country => { re => qr/^[A-Z]{2}$/, required => 1 },
4436             currency => { re => qr/^[A-Z]{3}$/, required => 1 },
4437             account_holder_name => { re => qr/^.*?$/ },
4438             account_holder_type => { re => qr/^.*?$/ },
4439             routing_number => {},
4440             account_number => {},
4441             metadata => { type => 'hash' },
4442             };
4443             $args = $self->_contract( 'customer_bank_account', $args ) || CORE::return( $self->pass_error );
4444             my $err = $self->_check_parameters( $okParams, $args );
4445             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
4446             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No customer id was provided to create a bank account." ) );
4447             my $hash = $self->post( "customers/${id}/sources" ) || CORE::return( $self->pass_error );
4448             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Customer::BankAccount', $hash ) );
4449             }
4450             PERL
4451             # NOTE: customer_bank_account_delete()
4452             customer_bank_account_delete => <<'PERL',
4453             sub customer_bank_account_delete
4454             {
4455             my $self = shift( @_ );
4456             CORE::return( $self->error( "No parameters were provided to delete customer bank account." ) ) if( !scalar( @_ ) );
4457             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Customer::BankAccount', @_ );
4458             my $okParams =
4459             {
4460             expandable => { allowed => $EXPANDABLES->{customer_bank_account} },
4461             id => { re => qr/^\w+$/, required => 1 },
4462             customer => { re => qr/^\w+$/, required => 1 },
4463             };
4464             my $err = $self->_check_parameters( $okParams, $args );
4465             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
4466             my $cust = CORE::delete( $args->{customer} ) || CORE::return( $self->error( "No customer id was provided to delete his/her bank account." ) );
4467             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No customer bank accuont id was provided to delete." ) );
4468             my $hash = $self->delete( "customers/${cust}/sources/${id}" ) || CORE::return( $self->pass_error );
4469             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Customer::BankAccount', $hash ) );
4470             }
4471             PERL
4472             # NOTE: customer_bank_account_list()
4473             customer_bank_account_list => <<'PERL',
4474             sub customer_bank_account_list
4475             {
4476             my $self = shift( @_ );
4477             my $args = shift( @_ );
4478             my $okParams =
4479             {
4480             expandable => { allowed => $EXPANDABLES->{customer_bank_account}, data_prefix_is_ok => 1 },
4481             customer => { re => qr/^\w+$/, required => 1 },
4482             # "A cursor for use in pagination. ending_before is an object ID that defines your place in the list."
4483             'ending_before' => qr/^\w+$/,
4484             'limit' => qr/^\d+$/,
4485             'starting_after' => qr/^\w+$/,
4486             };
4487             my $err = $self->_check_parameters( $okParams, $args );
4488             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
4489             my $cust = CORE::delete( $args->{customer} ) || CORE::return( $self->error( "No customer id was provided to get a list of his/her bank accounts." ) );
4490             if( $args->{expand} )
4491             {
4492             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
4493             }
4494             my $hash = $self->get( "customers/${cust}/sources", $args ) || CORE::return( $self->pass_error );
4495             CORE::return( $self->_response_to_object( 'Net::API::Stripe::List', $hash ) );
4496             }
4497             PERL
4498             # NOTE: customer_bank_account_retrieve()
4499             customer_bank_account_retrieve => <<'PERL',
4500             sub customer_bank_account_retrieve
4501             {
4502             my $self = shift( @_ );
4503             CORE::return( $self->error( "No parameters were provided to retrieve customer bank account information." ) ) if( !scalar( @_ ) );
4504             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Customer::BankAccount', @_ );
4505             my $okParams =
4506             {
4507             expandable => { allowed => $EXPANDABLES->{customer_bank_account} },
4508             id => { re => qr/^\w+$/, required => 1 },
4509             customer => { re => qr/^\w+$/, required => 1 },
4510             };
4511             my $err = $self->_check_parameters( $okParams, $args );
4512             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
4513             my $cust = CORE::delete( $args->{customer} ) || CORE::return( $self->error( "No customer id was provided to retrieve his/her bank account information." ) );
4514             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No customer bank account id was provided to retrieve its information." ) );
4515             my $hash = $self->get( "customers/${cust}/sources/${id}", $args ) || CORE::return( $self->pass_error );
4516             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Customer::BankAccount', $hash ) );
4517             }
4518             PERL
4519             # NOTE: customer_bank_account_update()
4520             customer_bank_account_update => <<'PERL',
4521             sub customer_bank_account_update
4522             {
4523             my $self = shift( @_ );
4524             CORE::return( $self->error( "No parameters were provided to update the customer bank account" ) ) if( !scalar( @_ ) );
4525             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Customer::BankAccount', @_ );
4526             my $okParams =
4527             {
4528             expandable => { allowed => $EXPANDABLES->{customer_bank_account} },
4529             id => { re => qr/^\w+$/, required => 1 },
4530             customer => { re => qr/^\w+$/, required => 1 },
4531             account_holder_name => { re => qr/^.*?$/ },
4532             account_holder_type => {},
4533             metadata => { type => 'hash' },
4534             };
4535             $args = $self->_contract( 'customer_bank_account', $args ) || CORE::return( $self->pass_error );
4536             # We found some errors
4537             my $err = $self->_check_parameters( $okParams, $args );
4538             # $self->message( 3, "Data to be posted: ", $self->dumper( $args ) ); exit;
4539             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
4540             my $cust = CORE::delete( $args->{customer} ) || CORE::return( $self->error( "No customer id was provided to update the customer's bank account details" ) );
4541             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No bank account id was provided to update its details" ) );
4542             my $hash = $self->post( "customers/${cust}/sources/${id}", $args ) || CORE::return( $self->pass_error );
4543             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Customer::BankAccount', $hash ) );
4544             }
4545             PERL
4546             # NOTE: customer_bank_account_verify()
4547             customer_bank_account_verify => <<'PERL',
4548             sub customer_bank_account_verify
4549             {
4550             my $self = shift( @_ );
4551             CORE::return( $self->error( "No parameters were provided to verify customer bank account information." ) ) if( !scalar( @_ ) );
4552             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Customer::BankAccount', @_ );
4553             my $okParams =
4554             {
4555             expandable => { allowed => $EXPANDABLES->{customer_bank_account} },
4556             id => { re => qr/^\w+$/, required => 1 },
4557             customer => { re => qr/^\w+$/, required => 1 },
4558             amounts => { type => 'array', re => qr/^\d+$/ },
4559             };
4560             my $err = $self->_check_parameters( $okParams, $args );
4561             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
4562             my $cust = CORE::delete( $args->{customer} ) || CORE::return( $self->error( "No customer id was provided to verify his/her bank account." ) );
4563             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No customer bank account id was provided to verify." ) );
4564             my $hash = $self->post( "customers/${cust}/sources/${id}/verify", $args ) || CORE::return( $self->pass_error );
4565             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Customer::BankAccount', $hash ) );
4566             }
4567             PERL
4568             # NOTE: customer_bank_accounts()
4569             customer_bank_accounts => <<'PERL',
4570             sub customer_bank_accounts
4571             {
4572             my $self = shift( @_ );
4573             my $action = shift( @_ );
4574             my $allowed = [qw( create retrieve update verify delete list )];
4575             my $meth = $self->_get_method( 'customer', $action, $allowed ) || CORE::return( $self->pass_error );
4576             CORE::return( $self->$meth( @_ ) );
4577             }
4578             PERL
4579             # NOTE: customer_cash_balance_transaction()
4580             customer_cash_balance_transaction => <<'PERL',
4581             sub customer_cash_balance_transaction { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Cash::Transaction', @_ ) ); }
4582             PERL
4583             # NOTE: customer_cash_balance_transaction_fund_cash_balance()
4584             customer_cash_balance_transaction_fund_cash_balance => <<'PERL',
4585             sub customer_cash_balance_transaction_fund_cash_balance
4586             {
4587             my $self = shift( @_ );
4588             my $args = shift( @_ );
4589             my $okParams =
4590             {
4591             expandable => { allowed => $EXPANDABLES->{ 'customer_cash_balance_transaction' } },
4592             amount => { type => "integer", required => 1 },
4593             currency => { type => "string", required => 1 },
4594             reference => { type => "string" },
4595             };
4596             $args = $self->_contract( 'customer_cash_balance_transaction', $args ) || CORE::return( $self->pass_error );
4597             my $err = $self->_check_parameters( $okParams, $args );
4598             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
4599             my $customer = CORE::delete( $args->{customer} ) || CORE::return( $self->error( "No customer id (with parameter 'customer') was provided to fund_cash_balance its information." ) );
4600             my $hash = $self->post( "test_helpers/customers/${customer}/fund_cash_balance", $args ) || CORE::return( $self->pass_error );
4601             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Cash::Transaction', $hash ) );
4602             }
4603             PERL
4604             # NOTE: customer_cash_balance_transaction_list()
4605             customer_cash_balance_transaction_list => <<'PERL',
4606             sub customer_cash_balance_transaction_list
4607             {
4608             my $self = shift( @_ );
4609             CORE::return( $self->error( "No parameters were provided to list customer cash balance transaction information." ) ) if( !scalar( @_ ) );
4610             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Cash::Transaction', @_ );
4611             my $okParams =
4612             {
4613             expandable => { allowed => $EXPANDABLES->{ 'customer_cash_balance_transaction' }, data_prefix_is_ok => 1 },
4614             ending_before => { type => "string" },
4615             limit => { type => "string" },
4616             starting_after => { type => "string" },
4617             };
4618             my $err = $self->_check_parameters( $okParams, $args );
4619             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
4620             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No customer id (with parameter 'id') was provided to list its information." ) );
4621             if( $args->{expand} )
4622             {
4623             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
4624             }
4625             my $hash = $self->get( "customers/${id}/cash_balance_transactions", $args ) || CORE::return( $self->pass_error );
4626             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Cash::Transaction', $hash ) );
4627             }
4628             PERL
4629             # NOTE: customer_cash_balance_transaction_retrieve()
4630             customer_cash_balance_transaction_retrieve => <<'PERL',
4631             sub customer_cash_balance_transaction_retrieve
4632             {
4633             my $self = shift( @_ );
4634             my $args = shift( @_ );
4635             my $okParams =
4636             {
4637             expandable => { allowed => $EXPANDABLES->{ 'customer_cash_balance_transaction' }, data_prefix_is_ok => 1 },
4638             };
4639             $args = $self->_contract( 'customer_cash_balance_transaction', $args ) || CORE::return( $self->pass_error );
4640             my $err = $self->_check_parameters( $okParams, $args );
4641             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
4642             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." ) );
4643             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." ) );
4644             my $hash = $self->get( "customers/${parent_id}/cash_balance_transactions/${id}", $args ) || CORE::return( $self->pass_error );
4645             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Cash::Transaction', $hash ) );
4646             }
4647             PERL
4648             # NOTE: customer_cash_balance_transactions()
4649             customer_cash_balance_transactions => <<'PERL',
4650             # <https://stripe.com/docs/api/cash_balance>
4651             sub customer_cash_balance_transactions
4652             {
4653             my $self = shift( @_ );
4654             my $allowed = [qw( fund_cash_balance list retrieve )];
4655             my $action = shift( @_ );
4656             my $meth = $self->_get_method( 'customer_cash_balance_transaction', $action, $allowed ) || CORE::return( $self->pass_error );
4657             CORE::return( $self->$meth( @_ ) );
4658             }
4659             PERL
4660             # NOTE: customer_create()
4661             customer_create => <<'PERL',
4662             # https://stripe.com/docs/api/customers/create?lang=curl
4663             sub customer_create
4664             {
4665             my $self = shift( @_ );
4666             CORE::return( $self->error( "No parameters were provided to create customer" ) ) if( !scalar( @_ ) );
4667             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Customer', @_ );
4668             my $okParams =
4669             {
4670             expandable => { allowed => $EXPANDABLES->{customer} },
4671             account_balance => { re => qr/^\-?\d+$/ },
4672             address => {
4673             fields => ["line1", "city", "country", "line2", "postal_code", "state"],
4674             package => "Net::API::Stripe::Address",
4675             type => "hash",
4676             },
4677             balance => { re => qr/^\-?\d+$/, type => "integer" },
4678             cash_balance => { type => "hash" },
4679             coupon => { type => "string" },
4680             default_source => { re => qr/^\w+$/ },
4681             description => { type => "string" },
4682             email => { type => "string" },
4683             id => {},
4684             invoice_prefix => { re => qr/^[A-Z0-9]{3,12}$/, type => "string" },
4685             invoice_settings => {
4686             fields => ["custom_fields", "default_payment_method", "footer"],
4687             package => "Net::API::Stripe::Billing::Invoice::Settings",
4688             type => "hash",
4689             },
4690             metadata => { type => "hash" },
4691             name => { type => "string" },
4692             next_invoice_sequence => { type => "integer" },
4693             payment_method => { type => "string" },
4694             phone => { type => "string" },
4695             preferred_locales => { type => "array" },
4696             promotion_code => { type => "string" },
4697             shipping => {
4698             fields => ["address", "name", "carrier", "phone", "tracking_number"],
4699             package => "Net::API::Stripe::Shipping",
4700             type => "hash",
4701             },
4702             source => { re => qr/^\w+$/, type => "string" },
4703             tax => { type => "hash" },
4704             tax_exempt => { re => qr/^(none|exempt|reverse)$/, type => "string" },
4705             tax_id_data => { package => "Net::API::Stripe::Customer::TaxId", type => "array" },
4706             tax_info => {
4707             fields => ["tax_id", "type"],
4708             package => "Net::API::Stripe::Customer::TaxInfo",
4709             },
4710             test_clock => { type => "string" },
4711             };
4712              
4713             $args = $self->_contract( 'customer', $args ) || CORE::return( $self->pass_error );
4714             my $err = $self->_check_parameters( $okParams, $args );
4715             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
4716             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' );
4717             my $hash = $self->post( 'customers', $args ) || CORE::return( $self->pass_error );
4718             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Customer', $hash ) );
4719             }
4720             PERL
4721             # NOTE: customer_delete()
4722             customer_delete => <<'PERL',
4723             # https://stripe.com/docs/api/customers/delete?lang=curl
4724             # "Permanently deletes a customer. It cannot be undone. Also immediately cancels any active subscriptions on the customer."
4725             sub customer_delete
4726             {
4727             my $self = shift( @_ );
4728             CORE::return( $self->error( "No parameters were provided to delete customer information." ) ) if( !scalar( @_ ) );
4729             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Customer', @_ );
4730             my $okParams =
4731             {
4732             expandable => { allowed => $EXPANDABLES->{customer} },
4733             id => { re => qr/^\w+$/, required => 1 }
4734             };
4735             my $err = $self->_check_parameters( $okParams, $args );
4736             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
4737             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No customer id was provided to delete its information." ) );
4738             my $hash = $self->delete( "customers/${id}" ) || CORE::return( $self->pass_error );
4739             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Customer', $hash ) );
4740             }
4741             PERL
4742             # NOTE: customer_delete_discount()
4743             customer_delete_discount => <<'PERL',
4744             sub customer_delete_discount
4745             {
4746             my $self = shift( @_ );
4747             CORE::return( $self->error( "No parameters were provided to delete customer discount." ) ) if( !scalar( @_ ) );
4748             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Customer', @_ );
4749             my $okParams =
4750             {
4751             expandable => { allowed => $EXPANDABLES->{discount}},
4752             id => { re => qr/^\w+$/, required => 1 }
4753             };
4754             my $err = $self->_check_parameters( $okParams, $args );
4755             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
4756             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No customer id was provided to delete its coupon." ) );
4757             my $hash = $self->delete( "customers/${id}/discount", $args ) || CORE::return( $self->pass_error );
4758             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::Discount', $hash ) );
4759             }
4760             PERL
4761             # NOTE: customer_list()
4762             customer_list => <<'PERL',
4763             sub customer_list
4764             {
4765             my $self = shift( @_ );
4766             my $args = shift( @_ );
4767             my $okParams =
4768             {
4769             expandable => { allowed => $EXPANDABLES->{customer}, data_prefix_is_ok => 1 },
4770             created => qr/^\d+$/,
4771             'created.gt' => qr/^\d+$/,
4772             'created.gte' => qr/^\d+$/,
4773             'created.lt' => qr/^\d+$/,
4774             'created.lte' => qr/^\d+$/,
4775             email => qr/.*?/,
4776             ending_before => qr/^\w+$/,
4777             limit => qr/^\d+$/,
4778             starting_after => qr/^\w+$/,
4779             test_clock => { type => "string" },
4780             };
4781              
4782             my $err = $self->_check_parameters( $okParams, $args );
4783             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
4784             if( $args->{source} )
4785             {
4786             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)$/ );
4787             }
4788             if( $args->{expand} )
4789             {
4790             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
4791             }
4792             my $hash = $self->get( 'customers', $args ) || CORE::return( $self->pass_error );
4793             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Customer::List', $hash ) );
4794             }
4795             PERL
4796             # NOTE: customer_payment_method()
4797             customer_payment_method => <<'PERL',
4798             sub customer_payment_method
4799             {
4800             my $self = shift( @_ );
4801             CORE::return( $self->error( "No parameters were provided to retrieve customer payment method information." ) ) if( !scalar( @_ ) );
4802             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Payment::Method', @_ );
4803             my $okParams =
4804             {
4805             expandable => { allowed => $EXPANDABLES->{payment_method} },
4806             # Payment method id
4807             id => { re => qr/^\w+$/, required => 1 },
4808             # Customer id
4809             customer => { re => qr/^\w+$/, required => 1 },
4810             };
4811             my $err = $self->_check_parameters( $okParams, $args );
4812             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
4813             my $cust = CORE::delete( $args->{customer} ) || CORE::return( $self->error( "No customer id was provided to retrieve its payment method information." ) );
4814             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No payment method id was provided to retrieve its information." ) );
4815             my $hash = $self->get( "customers/${cust}/payment_methods/${id}", $args ) || CORE::return( $self->pass_error );
4816             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Payment::Method', $hash ) );
4817             }
4818             PERL
4819             # NOTE: customer_payment_methods()
4820             customer_payment_methods => <<'PERL',
4821             sub customer_payment_methods
4822             {
4823             my $self = shift( @_ );
4824             CORE::return( $self->error( "No parameters were provided to list a customer payment methods" ) ) if( !scalar( @_ ) );
4825             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Customer', @_ );
4826             my $okParams =
4827             {
4828             expandable => { allowed => $EXPANDABLES->{payment_method}, data_prefix_is_ok => 1 },
4829             id => { re => qr/^\w+$/, required => 1 },
4830             };
4831             my $err = $self->_check_parameters( $okParams, $args );
4832             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
4833             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No customer id was provided to get the list of his/her payment methods." ) );
4834             if( $args->{expand} )
4835             {
4836             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
4837             }
4838             my $hash = $self->get( "customers/${id}/payment_methods", $args ) || CORE::return( $self->pass_error );
4839             CORE::return( $self->_response_to_object( 'Net::API::Stripe::List', $hash ) );
4840             }
4841             PERL
4842             # NOTE: customer_retrieve()
4843             customer_retrieve => <<'PERL',
4844             sub customer_retrieve
4845             {
4846             my $self = shift( @_ );
4847             CORE::return( $self->error( "No parameters were provided to retrieve customer information." ) ) if( !scalar( @_ ) );
4848             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Customer', @_ );
4849             my $okParams =
4850             {
4851             expandable => { allowed => $EXPANDABLES->{customer} },
4852             id => { re => qr/^\w+$/, required => 1 },
4853             };
4854             my $err = $self->_check_parameters( $okParams, $args );
4855             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
4856             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No customer id was provided to retrieve its information." ) );
4857             my $hash = $self->get( "customers/${id}", $args ) || CORE::return( $self->pass_error );
4858             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Customer', $hash ) );
4859             }
4860             PERL
4861             # NOTE: customer_search()
4862             customer_search => <<'PERL',
4863             sub customer_search
4864             {
4865             my $self = shift( @_ );
4866             CORE::return( $self->error( "No parameters were provided to search customers." ) ) if( !scalar( @_ ) );
4867             my $args = shift( @_ );
4868             my $okParams =
4869             {
4870             expandable => { allowed => $EXPANDABLES->{customer}, data_prefix_is_ok => 1 },
4871             limit => qr/^\d+$/,
4872             page => qr/^\d+$/,
4873             query => { re => qr/^.*?$/, required => 1, type => "string" },
4874             };
4875              
4876             my $err = $self->_check_parameters( $okParams, $args );
4877             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
4878             if( $args->{expand} )
4879             {
4880             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
4881             }
4882             my $hash = $self->get( "customers/search", $args ) || CORE::return( $self->pass_error );
4883             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Customer::List', $hash ) );
4884             }
4885             PERL
4886             # NOTE: customer_tax_id()
4887             customer_tax_id => <<'PERL',
4888             sub customer_tax_id { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Customer::TaxId', @_ ) ); }
4889             PERL
4890             # NOTE: customer_update()
4891             customer_update => <<'PERL',
4892             # https://stripe.com/docs/api/customers/update?lang=curl
4893             sub customer_update
4894             {
4895             my $self = shift( @_ );
4896             CORE::return( $self->error( "No parameters were provided to update a customer" ) ) if( !scalar( @_ ) );
4897             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Customer', @_ );
4898             my $okParams =
4899             {
4900             expandable => { allowed => $EXPANDABLES->{customer} },
4901             account_balance => { re => qr/^\d+$/ },
4902             address => {
4903             fields => ["line1", "line2", "city", "postal_code", "state", "country"],
4904             type => "hash",
4905             },
4906             balance => { type => "integer" },
4907             cash_balance => { type => "hash" },
4908             coupon => { type => "string" },
4909             default_source => { re => qr/^\w+$/, type => "string" },
4910             description => { type => "string" },
4911             email => { type => "string" },
4912             id => { re => qr/^\w+$/, required => 1 },
4913             invoice_prefix => { re => qr/^[A-Z0-9]{3,12}$/, type => "string" },
4914             invoice_settings => {
4915             fields => ["custom_fields", "default_payment_method", "footer"],
4916             type => "hash",
4917             },
4918             metadata => { type => "hash" },
4919             name => { type => "string" },
4920             next_invoice_sequence => { type => "integer" },
4921             phone => { type => "string" },
4922             preferred_locales => { type => "array" },
4923             promotion_code => { type => "string" },
4924             shipping => {
4925             fields => ["address", "name", "carrier", "phone", "tracking_number"],
4926             type => "hash",
4927             },
4928             source => { re => qr/^\w+$/, type => "string" },
4929             tax => { type => "hash" },
4930             tax_exempt => { re => qr/^(none|exempt|reverse)$/, type => "string" },
4931             tax_info => { fields => ["tax_id", "type"] },
4932             };
4933              
4934             $args = $self->_contract( 'customer', $args ) || CORE::return( $self->pass_error );
4935             # We found some errors
4936             my $err = $self->_check_parameters( $okParams, $args );
4937             if( $args->{fraud_details} )
4938             {
4939             my $this = $args->{fraud_details};
4940             if( $this->{user_report} !~ /^(?:fraudulent|safe)$/ )
4941             {
4942             CORE::return( $self->error( "Invalid value for fraud_details. It should be either fraudulent or safe" ) );
4943             }
4944             }
4945             if( $self->_is_object( $args->{invoice_settings}->{default_payment_method} ) )
4946             {
4947             $args->{invoice_settings}->{default_payment_method} = $args->{invoice_settings}->{default_payment_method}->id;
4948             }
4949             # $self->message( 3, "Data to be posted: ", $self->dumper( $args ) ); exit;
4950             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
4951             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No customer id was provided to update customer's details" ) );
4952             my $hash = $self->post( "customers/${id}", $args ) || CORE::return( $self->pass_error );
4953             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Customer', $hash ) );
4954             }
4955             PERL
4956             # NOTE: customers()
4957             customers => <<'PERL',
4958             sub customers
4959             {
4960             my $self = shift( @_ );
4961             my $action = shift( @_ );
4962             my $allowed = [qw( create retrieve update delete delete_discount list search payment_methods )];
4963             my $meth = $self->_get_method( 'customer', $action, $allowed ) || CORE::return( $self->pass_error );
4964             CORE::return( $self->$meth( @_ ) );
4965             }
4966             PERL
4967             # NOTE: cvc_update_token_create()
4968             cvc_update_token_create => <<'PERL',
4969             sub cvc_update_token_create { CORE::return( shift->token_create( @_ ) ); }
4970             PERL
4971             # NOTE: data()
4972             data => <<'PERL',
4973             sub data { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Event::Data', @_ ) ); }
4974             PERL
4975             # NOTE: discount()
4976             discount => <<'PERL',
4977             sub discount { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Billing::Discount', @_ ) ); }
4978             PERL
4979             # NOTE: discount_delete()
4980             discount_delete => <<'PERL',
4981             sub discount_delete
4982             {
4983             my $self = shift( @_ );
4984             CORE::return( $self->error( "No parameters were provided to delete discount information." ) ) if( !scalar( @_ ) );
4985             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Billing::Discount', @_ );
4986             my $okParams =
4987             {
4988             expandable => { allowed => $EXPANDABLES->{ 'discount' } },
4989             };
4990             my $err = $self->_check_parameters( $okParams, $args );
4991             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
4992             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No subscription id (with parameter 'id') was provided to delete its information." ) );
4993             my $hash = $self->delete( "subscriptions/${id}/discount", $args ) || CORE::return( $self->pass_error );
4994             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::Discount', $hash ) );
4995             }
4996             PERL
4997             # NOTE: discounts()
4998             discounts => <<'PERL',
4999             # <https://stripe.com/docs/api/discounts>
5000             sub discounts
5001             {
5002             my $self = shift( @_ );
5003             my $allowed = [qw( delete delete_customer delete_subscription )];
5004             my $action = shift( @_ );
5005             my $meth = $self->_get_method( 'discount', $action, $allowed ) || CORE::return( $self->pass_error );
5006             CORE::return( $self->$meth( @_ ) );
5007             }
5008             PERL
5009             # NOTE: dispute()
5010             dispute => <<'PERL',
5011             sub dispute { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Dispute', @_ ) ); }
5012             PERL
5013             # NOTE: dispute_close()
5014             dispute_close => <<'PERL',
5015             sub dispute_close
5016             {
5017             my $self = shift( @_ );
5018             CORE::return( $self->error( "No parameters were provided to close dispute." ) ) if( !scalar( @_ ) );
5019             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Dispute', @_ );
5020             my $okParams =
5021             {
5022             expandable => { allowed => $EXPANDABLES->{dispute} },
5023             id => { re => qr/^\w+$/, required => 1 }
5024             };
5025             my $err = $self->_check_parameters( $okParams, $args );
5026             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
5027             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No dispute id was provided to close." ) );
5028             my $hash = $self->delete( "disputes/${id}/close", $args ) || CORE::return( $self->pass_error );
5029             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Dispute', $hash ) );
5030             }
5031             PERL
5032             # NOTE: dispute_evidence()
5033             dispute_evidence => <<'PERL',
5034             sub dispute_evidence { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Dispute', @_ ) ); }
5035             PERL
5036             # NOTE: dispute_list()
5037             dispute_list => <<'PERL',
5038             sub dispute_list
5039             {
5040             my $self = shift( @_ );
5041             my $args = shift( @_ );
5042             my $okParams =
5043             {
5044             expandable => { allowed => $EXPANDABLES->{dispute}, data_prefix_is_ok => 1 },
5045             charge => { re => qr/.*?/, type => "string" },
5046             created => { re => qr/^\d+$/, type => "timestamp" },
5047             'created.gt' => { re => qr/^\d+$/ },
5048             'created.gte' => { re => qr/^\d+$/ },
5049             'created.lt' => { re => qr/^\d+$/ },
5050             'created.lte' => { re => qr/^\d+$/ },
5051             ending_before => { re => qr/^\w+$/, type => "string" },
5052             limit => { re => qr/^\d+$/, type => "string" },
5053             payment_intent => { re => qr/^\w+$/, type => "string" },
5054             starting_after => { re => qr/^\w+$/, type => "string" },
5055             };
5056              
5057             my $err = $self->_check_parameters( $okParams, $args );
5058             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
5059             if( $args->{expand} )
5060             {
5061             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
5062             }
5063             my $hash = $self->get( 'disputes', $args ) || CORE::return( $self->pass_error );
5064             CORE::return( $self->_response_to_object( 'Net::API::Stripe::List', $hash ) );
5065             }
5066             PERL
5067             # NOTE: dispute_retrieve()
5068             dispute_retrieve => <<'PERL',
5069             sub dispute_retrieve
5070             {
5071             my $self = shift( @_ );
5072             CORE::return( $self->error( "No parameters were provided to retrieve dispute information." ) ) if( !scalar( @_ ) );
5073             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Dispute', @_ );
5074             my $okParams =
5075             {
5076             expandable => { allowed => $EXPANDABLES->{dispute} },
5077             id => { re => qr/^\w+$/, required => 1 }
5078             };
5079             my $err = $self->_check_parameters( $okParams, $args );
5080             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
5081             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No dispute id was provided to retrieve its information." ) );
5082             my $hash = $self->get( "disputes/${id}", $args ) || CORE::return( $self->pass_error );
5083             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Dispute', $hash ) );
5084             }
5085             PERL
5086             # NOTE: dispute_update()
5087             dispute_update => <<'PERL',
5088             sub dispute_update
5089             {
5090             my $self = shift( @_ );
5091             CORE::return( $self->error( "No parameters were provided to update a dispute" ) ) if( !scalar( @_ ) );
5092             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Dispute', @_ );
5093             my $okParams =
5094             {
5095             expandable => { allowed => $EXPANDABLES->{dispute} },
5096             evidence => {
5097             fields => [
5098             "access_activity_log",
5099             "billing_address",
5100             "cancellation_policy",
5101             "cancellation_policy_disclosure",
5102             "cancellation_rebuttal",
5103             "customer_communication",
5104             "customer_email_address",
5105             "customer_name",
5106             "customer_purchase_ip",
5107             "customer_signature",
5108             "duplicate_charge_documentation",
5109             "duplicate_charge_explanation",
5110             "duplicate_charge_id",
5111             "product_description",
5112             "receipt",
5113             "refund_policy",
5114             "refund_policy_disclosure",
5115             "refund_refusal_explanation",
5116             "service_date",
5117             "service_documentation",
5118             "shipping_address",
5119             "shipping_carrier",
5120             "shipping_date",
5121             "shipping_documentation",
5122             "shipping_tracking_number",
5123             "uncategorized_file",
5124             "uncategorized_text",
5125             ],
5126             type => "hash",
5127             },
5128             id => { re => qr/^\w+$/, required => 1 },
5129             metadata => { type => "hash" },
5130             submit => { type => "boolean" },
5131             };
5132              
5133             $args = $self->_contract( 'dispute', $args ) || CORE::return( $self->pass_error );
5134             # We found some errors
5135             my $err = $self->_check_parameters( $okParams, $args );
5136             # $self->message( 3, "Data to be posted: ", $self->dumper( $args ) ); exit;
5137             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
5138             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No dispute id was provided to update dispute's details" ) );
5139             my $hash = $self->post( "disputes/${id}", $args ) || CORE::return( $self->pass_error );
5140             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Dispute', $hash ) );
5141             }
5142             PERL
5143             # NOTE: disputes()
5144             disputes => <<'PERL',
5145             sub disputes
5146             {
5147             my $self = shift( @_ );
5148             my $action = shift( @_ );
5149             my $allowed = [qw( close retrieve update list )];
5150             my $meth = $self->_get_method( 'dispute', $action, $allowed ) || CORE::return( $self->pass_error );
5151             CORE::return( $self->$meth( @_ ) );
5152             }
5153             PERL
5154             # NOTE: document()
5155             document => <<'PERL',
5156             sub document { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Connect::Account::Document', @_ ) ); }
5157             PERL
5158             # NOTE: event()
5159             event => <<'PERL',
5160             sub event { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Event', @_ ) ); }
5161             PERL
5162             # NOTE: event_list()
5163             event_list => <<'PERL',
5164             sub event_list
5165             {
5166             my $self = shift( @_ );
5167             my $args = shift( @_ );
5168             my $okParams =
5169             {
5170             expandable => { allowed => $EXPANDABLES->{event}, data_prefix_is_ok => 1 },
5171             created => { re => qr/^\d+$/, type => "timestamp" },
5172             'created.gt' => { re => qr/^\d+$/ },
5173             'created.gte' => { re => qr/^\d+$/ },
5174             'created.lt' => { re => qr/^\d+$/ },
5175             'created.lte' => { re => qr/^\d+$/ },
5176             delivery_success => { re => qr/.*?/, type => "string" },
5177             ending_before => { re => qr/^\w+$/, type => "string" },
5178             limit => { re => qr/^\d+$/, type => "string" },
5179             starting_after => { re => qr/^\w+$/, type => "string" },
5180             type => { re => qr/^\w+$/, type => "string" },
5181             types => { type => "string" },
5182             };
5183              
5184             my $err = $self->_check_parameters( $okParams, $args );
5185             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
5186             if( $args->{expand} )
5187             {
5188             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
5189             }
5190             my $hash = $self->get( 'events', $args ) || CORE::return( $self->pass_error );
5191             CORE::return( $self->_response_to_object( 'Net::API::Stripe::List', $hash ) );
5192             }
5193             PERL
5194             # NOTE: event_retrieve()
5195             event_retrieve => <<'PERL',
5196             sub event_retrieve
5197             {
5198             my $self = shift( @_ );
5199             CORE::return( $self->error( "No parameters were provided to retrieve event information." ) ) if( !scalar( @_ ) );
5200             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Event', @_ );
5201             my $okParams =
5202             {
5203             expandable => { allowed => $EXPANDABLES->{event} },
5204             id => { re => qr/^\w+$/, required => 1 }
5205             };
5206             my $err = $self->_check_parameters( $okParams, $args );
5207             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
5208             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No event id was provided to retrieve its information." ) );
5209             my $hash = $self->get( "events/${id}", $args ) || CORE::return( $self->pass_error );
5210             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Event', $hash ) );
5211             }
5212             PERL
5213             # NOTE: events()
5214             events => <<'PERL',
5215             sub events
5216             {
5217             my $self = shift( @_ );
5218             my $action = shift( @_ );
5219             my $allowed = [qw( retrieve list )];
5220             my $meth = $self->_get_method( 'events', $action, $allowed ) || CORE::return( $self->pass_error );
5221             CORE::return( $self->$meth( @_ ) );
5222             }
5223             PERL
5224             # NOTE: evidence()
5225             evidence => <<'PERL',
5226             sub evidence { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Issuing::Dispute::Evidence', @_ ) ); }
5227             PERL
5228             # NOTE: evidence_details()
5229             evidence_details => <<'PERL',
5230             sub evidence_details { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Dispute::EvidenceDetails', @_ ) ); }
5231             PERL
5232             # NOTE: fee_refund()
5233             fee_refund => <<'PERL',
5234             sub fee_refund { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Connect::ApplicationFee::Refund', @_ ) ); }
5235             PERL
5236             # NOTE: fee_refund_create()
5237             fee_refund_create => <<'PERL',
5238             sub fee_refund_create
5239             {
5240             my $self = shift( @_ );
5241             my $args = shift( @_ );
5242             my $okParams =
5243             {
5244             expandable => { allowed => $EXPANDABLES->{ 'fee_refund' } },
5245             amount => { type => "integer" },
5246             metadata => { type => "hash" },
5247             };
5248             $args = $self->_contract( 'fee_refund', $args ) || CORE::return( $self->pass_error );
5249             my $err = $self->_check_parameters( $okParams, $args );
5250             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
5251             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No application_fee id (with parameter 'id') was provided to create its information." ) );
5252             my $hash = $self->post( "application_fees/${id}/refunds", $args ) || CORE::return( $self->pass_error );
5253             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Connect::ApplicationFee::Refund', $hash ) );
5254             }
5255             PERL
5256             # NOTE: fee_refund_list()
5257             fee_refund_list => <<'PERL',
5258             sub fee_refund_list
5259             {
5260             my $self = shift( @_ );
5261             CORE::return( $self->error( "No parameters were provided to list fee refund information." ) ) if( !scalar( @_ ) );
5262             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Connect::ApplicationFee::Refund', @_ );
5263             my $okParams =
5264             {
5265             expandable => { allowed => $EXPANDABLES->{ 'fee_refund' }, data_prefix_is_ok => 1 },
5266             ending_before => { type => "string" },
5267             limit => { type => "string" },
5268             starting_after => { type => "string" },
5269             };
5270             my $err = $self->_check_parameters( $okParams, $args );
5271             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
5272             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No application_fee id (with parameter 'id') was provided to list its information." ) );
5273             if( $args->{expand} )
5274             {
5275             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
5276             }
5277             my $hash = $self->get( "application_fees/${id}/refunds", $args ) || CORE::return( $self->pass_error );
5278             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Connect::ApplicationFee::Refund', $hash ) );
5279             }
5280             PERL
5281             # NOTE: fee_refund_retrieve()
5282             fee_refund_retrieve => <<'PERL',
5283             sub fee_refund_retrieve
5284             {
5285             my $self = shift( @_ );
5286             my $args = shift( @_ );
5287             my $okParams =
5288             {
5289             expandable => { allowed => $EXPANDABLES->{ 'fee_refund' }, data_prefix_is_ok => 1 },
5290             };
5291             $args = $self->_contract( 'fee_refund', $args ) || CORE::return( $self->pass_error );
5292             my $err = $self->_check_parameters( $okParams, $args );
5293             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
5294             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." ) );
5295             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No refund id (with parameter 'id') was provided to retrieve its information." ) );
5296             my $hash = $self->get( "application_fees/${parent_id}/refunds/${id}", $args ) || CORE::return( $self->pass_error );
5297             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Connect::ApplicationFee::Refund', $hash ) );
5298             }
5299             PERL
5300             # NOTE: fee_refund_update()
5301             fee_refund_update => <<'PERL',
5302             sub fee_refund_update
5303             {
5304             my $self = shift( @_ );
5305             my $args = shift( @_ );
5306             my $okParams =
5307             {
5308             expandable => { allowed => $EXPANDABLES->{ 'fee_refund' } },
5309             metadata => { type => "hash" },
5310             };
5311             $args = $self->_contract( 'fee_refund', $args ) || CORE::return( $self->pass_error );
5312             my $err = $self->_check_parameters( $okParams, $args );
5313             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
5314             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." ) );
5315             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No refund id (with parameter 'id') was provided to update its information." ) );
5316             my $hash = $self->post( "application_fees/${parent_id}/refunds/${id}", $args ) || CORE::return( $self->pass_error );
5317             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Connect::ApplicationFee::Refund', $hash ) );
5318             }
5319             PERL
5320             # NOTE: fee_refunds()
5321             fee_refunds => <<'PERL',
5322             # <https://stripe.com/docs/api/fee_refunds>
5323             sub fee_refunds
5324             {
5325             my $self = shift( @_ );
5326             my $allowed = [qw( create list retrieve update )];
5327             my $action = shift( @_ );
5328             my $meth = $self->_get_method( 'fee_refund', $action, $allowed ) || CORE::return( $self->pass_error );
5329             CORE::return( $self->$meth( @_ ) );
5330             }
5331             PERL
5332             # NOTE: file()
5333             file => <<'PERL',
5334             sub file { CORE::return( shift->_response_to_object( 'Net::API::Stripe::File', @_ ) ); }
5335             PERL
5336             # NOTE: file_create()
5337             file_create => <<'PERL',
5338             sub file_create
5339             {
5340             my $self = shift( @_ );
5341             CORE::return( $self->error( "No parameters were provided to create a file" ) ) if( !scalar( @_ ) );
5342             my $args = $self->_get_args_from_object( 'Net::API::Stripe::File', @_ );
5343             my $okParams =
5344             {
5345             expandable => { allowed => $EXPANDABLES->{file} },
5346             expand => { allowed => [] },
5347             file => { required => 1, type => "string" },
5348             file_link_data => { field => ["create", "expires_at", "metadata"], type => "hash" },
5349             purpose => {
5350             re => qr/^(business_icon|business_logo|customer_signature|dispute_evidence|identity_document|pci_document|tax_document_user_upload)$/,
5351             required => 1,
5352             type => "string",
5353             },
5354             };
5355              
5356             $args = $self->_contract( 'file', $args ) || CORE::return( $self->pass_error );
5357             my $err = $self->_check_parameters( $okParams, $args );
5358             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
5359             if( !CORE::length( $args->{file} ) )
5360             {
5361             CORE::return( $self->error( "No file was provided to upload." ) );
5362             }
5363             my $file = Module::Generic::File::file( $args->{file} );
5364             if( !$file->exists )
5365             {
5366             CORE::return( $self->error( "File \"$file\" does not exist." ) );
5367             }
5368             elsif( $file->is_empty )
5369             {
5370             CORE::return( $self->error( "File \"$file\" is empty." ) );
5371             }
5372             elsif( !$file->can_read )
5373             {
5374             CORE::return( $self->error( "File \"$file\" does not have read permission for us (uid = $>)." ) );
5375             }
5376             $args->{file} = { _filepath => $file };
5377             my $hash = $self->post_multipart( 'files', $args ) || CORE::return( $self->pass_error );
5378             CORE::return( $self->_response_to_object( 'Net::API::Stripe::File', $hash ) );
5379             }
5380             PERL
5381             # NOTE: file_link()
5382             file_link => <<'PERL',
5383             sub file_link { CORE::return( shift->_response_to_object( 'Net::API::Stripe::File::Link', @_ ) ); }
5384             PERL
5385             # NOTE: file_link_create()
5386             file_link_create => <<'PERL',
5387             sub file_link_create
5388             {
5389             my $self = shift( @_ );
5390             CORE::return( $self->error( "No parameters were provided to create a file link" ) ) if( !scalar( @_ ) );
5391             my $args = $self->_get_args_from_object( 'Net::API::Stripe::File::Link', @_ );
5392            
5393             my $okParams =
5394             {
5395             expandable => { allowed => $EXPANDABLES->{file_link} },
5396             expires_at => { type => "timestamp" },
5397             file => { package => "Net::API::Stripe::File", required => 1, type => "string" },
5398             metadata => { type => "hash" },
5399             };
5400              
5401             $args = $self->_contract( 'file_link', $args ) || CORE::return( $self->pass_error );
5402             my $err = $self->_check_parameters( $okParams, $args );
5403             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
5404             my $hash = $self->post( 'file_links', $args ) || CORE::return( $self->pass_error );
5405             CORE::return( $self->_response_to_object( 'Net::API::Stripe::File::Link', $hash ) );
5406             }
5407             PERL
5408             # NOTE: file_link_list()
5409             file_link_list => <<'PERL',
5410             sub file_link_list
5411             {
5412             my $self = shift( @_ );
5413             my $args = $self->_get_args( @_ );
5414             if( $self->_is_object( $args->{file} ) && $args->{file}->isa( 'Net::API::Stripe::File' ) )
5415             {
5416             $args->{file} = $args->{file}->id || CORE::return( $self->error( "No file id could be found in this file object." ) );
5417             }
5418             my $okParams =
5419             {
5420             expandable => { allowed => $EXPANDABLES->{file_link}, data_prefix_is_ok => 1 },
5421             created => qr/^\d+$/,
5422             'created.gt' => qr/^\d+$/,
5423             'created.gte' => qr/^\d+$/,
5424             'created.lt' => qr/^\d+$/,
5425             'created.lte' => qr/^\d+$/,
5426             ending_before => qr/^\w+$/,
5427             expand => { allowed => ["file"] },
5428             expired => { type => "boolean" },
5429             file => { type => "string" },
5430             limit => qr/^\d+$/,
5431             starting_after => qr/^\w+$/,
5432             };
5433              
5434             my $err = $self->_check_parameters( $okParams, $args );
5435             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
5436             if( $args->{expand} )
5437             {
5438             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
5439             }
5440             my $hash = $self->get( 'file_links', $args ) || CORE::return( $self->pass_error );
5441             CORE::return( $self->_response_to_object( 'Net::API::Stripe::List', $hash ) );
5442             }
5443             PERL
5444             # NOTE: file_link_retrieve()
5445             file_link_retrieve => <<'PERL',
5446             sub file_link_retrieve
5447             {
5448             my $self = shift( @_ );
5449             CORE::return( $self->error( "No parameters were provided to retrieve file link information." ) ) if( !scalar( @_ ) );
5450             my $args = $self->_get_args_from_object( 'Net::API::Stripe::File::Link', @_ );
5451             my $okParams =
5452             {
5453             expand => { allowed => $EXPANDABLES->{file_link} },
5454             id => { re => qr/^\w+$/, required => 1 }
5455             };
5456             my $err = $self->_check_parameters( $okParams, $args );
5457             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
5458             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No file link id was provided to retrieve its information." ) );
5459             my $hash = $self->get( "file_links/${id}", $args ) || CORE::return( $self->pass_error );
5460             CORE::return( $self->_response_to_object( 'Net::API::Stripe::File::Link', $hash ) );
5461             }
5462             PERL
5463             # NOTE: file_link_update()
5464             file_link_update => <<'PERL',
5465             sub file_link_update
5466             {
5467             my $self = shift( @_ );
5468             CORE::return( $self->error( "No parameters were provided to update a file link" ) ) if( !scalar( @_ ) );
5469             my $args = $self->_get_args_from_object( 'Net::API::Stripe::File::Link', @_ );
5470             my $okParams =
5471             {
5472             expandable => { allowed => $EXPANDABLES->{file_link} },
5473             expires_at => { type => "timestamp" },
5474             id => { re => qr/^\w+$/, required => 1 },
5475             metadata => { type => "hash" },
5476             };
5477              
5478             $args = $self->_contract( 'file_link', $args ) || CORE::return( $self->pass_error );
5479             # We found some errors
5480             my $err = $self->_check_parameters( $okParams, $args );
5481             # $self->message( 3, "Data to be posted: ", $self->dumper( $args ) ); exit;
5482             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
5483             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No file link id was provided to update its details" ) );
5484             my $hash = $self->post( "file_links/${id}", $args ) || CORE::return( $self->pass_error );
5485             CORE::return( $self->_response_to_object( 'Net::API::Stripe::File::Link', $hash ) );
5486             }
5487             PERL
5488             # NOTE: file_links()
5489             file_links => <<'PERL',
5490             sub file_links
5491             {
5492             my $self = shift( @_ );
5493             my $action = shift( @_ );
5494             my $allowed = [qw( create retrieve update list )];
5495             my $meth = $self->_get_method( 'file_links', $action, $allowed ) || CORE::return( $self->pass_error );
5496             CORE::return( $self->$meth( @_ ) );
5497             }
5498             PERL
5499             # NOTE: file_list()
5500             file_list => <<'PERL',
5501             sub file_list
5502             {
5503             my $self = shift( @_ );
5504             my $args = shift( @_ );
5505             my $okParams =
5506             {
5507             expandable => { allowed => $EXPANDABLES->{file}, data_prefix_is_ok => 1 },
5508             created => qr/^\d+$/,
5509             'created.gt' => qr/^\d+$/,
5510             'created.gte' => qr/^\d+$/,
5511             'created.lt' => qr/^\d+$/,
5512             'created.lte' => qr/^\d+$/,
5513             ending_before => qr/^\w+$/,
5514             expand => { allowed => [] },
5515             limit => qr/^\d+$/,
5516             purpose => { type => "string" },
5517             starting_after => qr/^\w+$/,
5518             };
5519              
5520             my $err = $self->_check_parameters( $okParams, $args );
5521             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
5522             if( $args->{expand} )
5523             {
5524             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
5525             }
5526             my $hash = $self->get( 'files', $args ) || CORE::return( $self->pass_error );
5527             CORE::return( $self->_response_to_object( 'Net::API::Stripe::List', $hash ) );
5528             }
5529             PERL
5530             # NOTE: file_retrieve()
5531             file_retrieve => <<'PERL',
5532             sub file_retrieve
5533             {
5534             my $self = shift( @_ );
5535             CORE::return( $self->error( "No parameters were provided to retrieve file information." ) ) if( !scalar( @_ ) );
5536             my $args = $self->_get_args_from_object( 'Net::API::Stripe::File', @_ );
5537             my $okParams =
5538             {
5539             expand => { allowed => $EXPANDABLES->{file} },
5540             id => { re => qr/^\w+$/, required => 1 }
5541             };
5542             my $err = $self->_check_parameters( $okParams, $args );
5543             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
5544             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No file id was provided to retrieve its information." ) );
5545             my $hash = $self->get( "files/${id}", $args ) || CORE::return( $self->pass_error );
5546             CORE::return( $self->_response_to_object( 'Net::API::Stripe::File', $hash ) );
5547             }
5548             PERL
5549             # NOTE: files()
5550             files => <<'PERL',
5551             # sub fraud { CORE::return( shift->_instantiate( 'fraud', 'Net::API::Stripe::Fraud' ) ) }
5552             sub files
5553             {
5554             my $self = shift( @_ );
5555             my $action = shift( @_ );
5556             my $allowed = [qw( create retrieve list )];
5557             my $meth = $self->_get_method( 'files', $action, $allowed ) || CORE::return( $self->pass_error );
5558             CORE::return( $self->$meth( @_ ) );
5559             }
5560             PERL
5561             # NOTE: financial_connections_account()
5562             financial_connections_account => <<'PERL',
5563             sub financial_connections_account { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Financial::Connections::Account', @_ ) ); }
5564             PERL
5565             # NOTE: financial_connections_account_disconnect()
5566             financial_connections_account_disconnect => <<'PERL',
5567             sub financial_connections_account_disconnect
5568             {
5569             my $self = shift( @_ );
5570             my $args = shift( @_ );
5571             my $okParams =
5572             {
5573             expandable => { allowed => $EXPANDABLES->{ 'financial_connections.account' } },
5574             };
5575             $args = $self->_contract( 'financial_connections.account', $args ) || CORE::return( $self->pass_error );
5576             my $err = $self->_check_parameters( $okParams, $args );
5577             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
5578             my $hash = $self->post( "", $args ) || CORE::return( $self->pass_error );
5579             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Financial::Connections::Account', $hash ) );
5580             }
5581             PERL
5582             # NOTE: financial_connections_account_list()
5583             financial_connections_account_list => <<'PERL',
5584             sub financial_connections_account_list
5585             {
5586             my $self = shift( @_ );
5587             CORE::return( $self->error( "No parameters were provided to list financial connections account information." ) ) if( !scalar( @_ ) );
5588             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Financial::Connections::Account', @_ );
5589             my $okParams =
5590             {
5591             expandable => { allowed => $EXPANDABLES->{ 'financial_connections.account' }, data_prefix_is_ok => 1 },
5592             account_holder => { type => "hash" },
5593             ending_before => { type => "string" },
5594             limit => { type => "string" },
5595             session => { type => "string" },
5596             starting_after => { type => "string" },
5597             };
5598             my $err = $self->_check_parameters( $okParams, $args );
5599             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
5600             if( $args->{expand} )
5601             {
5602             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
5603             }
5604             my $hash = $self->get( "financial_connections/accounts", $args ) || CORE::return( $self->pass_error );
5605             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Financial::Connections::Account', $hash ) );
5606             }
5607             PERL
5608             # NOTE: financial_connections_account_owner()
5609             financial_connections_account_owner => <<'PERL',
5610             sub financial_connections_account_owner { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Financial::Connections::AccountOwner', @_ ) ); }
5611             PERL
5612             # NOTE: financial_connections_account_owner_list()
5613             financial_connections_account_owner_list => <<'PERL',
5614             sub financial_connections_account_owner_list
5615             {
5616             my $self = shift( @_ );
5617             CORE::return( $self->error( "No parameters were provided to list financial connections account owner information." ) ) if( !scalar( @_ ) );
5618             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Financial::Connections::AccountOwner', @_ );
5619             my $okParams =
5620             {
5621             expandable => { allowed => $EXPANDABLES->{ 'financial_connections.account_owner' }, data_prefix_is_ok => 1 },
5622             ending_before => { type => "string" },
5623             limit => { type => "string" },
5624             ownership => { type => "string", required => 1 },
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( "?ownership=:ownership_id", $args ) || CORE::return( $self->pass_error );
5634             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Financial::Connections::AccountOwner', $hash ) );
5635             }
5636             PERL
5637             # NOTE: financial_connections_account_owners()
5638             financial_connections_account_owners => <<'PERL',
5639             # <https://stripe.com/docs/api/financial_connections/ownership>
5640             sub financial_connections_account_owners
5641             {
5642             my $self = shift( @_ );
5643             my $allowed = [qw( list )];
5644             my $action = shift( @_ );
5645             my $meth = $self->_get_method( 'financial_connections_account_owner', $action, $allowed ) || CORE::return( $self->pass_error );
5646             CORE::return( $self->$meth( @_ ) );
5647             }
5648             PERL
5649             # NOTE: financial_connections_account_ownership()
5650             financial_connections_account_ownership => <<'PERL',
5651             sub financial_connections_account_ownership { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Financial::Connections::AccountOwnership', @_ ) ); }
5652             PERL
5653             # NOTE: financial_connections_account_refresh()
5654             financial_connections_account_refresh => <<'PERL',
5655             sub financial_connections_account_refresh
5656             {
5657             my $self = shift( @_ );
5658             CORE::return( $self->error( "No parameters were provided to refresh financial connections account information." ) ) if( !scalar( @_ ) );
5659             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Financial::Connections::Account', @_ );
5660             my $okParams =
5661             {
5662             expandable => { allowed => $EXPANDABLES->{ 'financial_connections.account' } },
5663             features => { type => "array", required => 1 },
5664             };
5665             my $err = $self->_check_parameters( $okParams, $args );
5666             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
5667             my $hash = $self->post( "", $args ) || CORE::return( $self->pass_error );
5668             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Financial::Connections::Account', $hash ) );
5669             }
5670             PERL
5671             # NOTE: financial_connections_account_retrieve()
5672             financial_connections_account_retrieve => <<'PERL',
5673             sub financial_connections_account_retrieve
5674             {
5675             my $self = shift( @_ );
5676             my $args = shift( @_ );
5677             my $okParams =
5678             {
5679             expandable => { allowed => $EXPANDABLES->{ 'financial_connections.account' }, data_prefix_is_ok => 1 },
5680             };
5681             $args = $self->_contract( 'financial_connections.account', $args ) || CORE::return( $self->pass_error );
5682             my $err = $self->_check_parameters( $okParams, $args );
5683             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
5684             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No account id (with parameter 'id') was provided to retrieve its information." ) );
5685             my $hash = $self->get( "financial_connections/accounts/${id}", $args ) || CORE::return( $self->pass_error );
5686             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Financial::Connections::Account', $hash ) );
5687             }
5688             PERL
5689             # NOTE: financial_connections_accounts()
5690             financial_connections_accounts => <<'PERL',
5691             # <https://stripe.com/docs/api/financial_connections/accounts>
5692             sub financial_connections_accounts
5693             {
5694             my $self = shift( @_ );
5695             my $allowed = [qw( disconnect list refresh retrieve )];
5696             my $action = shift( @_ );
5697             my $meth = $self->_get_method( 'financial_connections_account', $action, $allowed ) || CORE::return( $self->pass_error );
5698             CORE::return( $self->$meth( @_ ) );
5699             }
5700             PERL
5701             # NOTE: financial_connections_session()
5702             financial_connections_session => <<'PERL',
5703             sub financial_connections_session { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Financial::Connections::Session', @_ ) ); }
5704             PERL
5705             # NOTE: financial_connections_session_create()
5706             financial_connections_session_create => <<'PERL',
5707             sub financial_connections_session_create
5708             {
5709             my $self = shift( @_ );
5710             my $args = shift( @_ );
5711             my $okParams =
5712             {
5713             expandable => { allowed => $EXPANDABLES->{ 'financial_connections.session' } },
5714             account_holder => { type => "hash", required => 1 },
5715             filters => { type => "hash" },
5716             permissions => { type => "array", required => 1 },
5717             };
5718             $args = $self->_contract( 'financial_connections.session', $args ) || CORE::return( $self->pass_error );
5719             my $err = $self->_check_parameters( $okParams, $args );
5720             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
5721             my $hash = $self->post( "financial_connections/sessions", $args ) || CORE::return( $self->pass_error );
5722             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Financial::Connections::Session', $hash ) );
5723             }
5724             PERL
5725             # NOTE: financial_connections_session_retrieve()
5726             financial_connections_session_retrieve => <<'PERL',
5727             sub financial_connections_session_retrieve
5728             {
5729             my $self = shift( @_ );
5730             my $args = shift( @_ );
5731             my $okParams =
5732             {
5733             expandable => { allowed => $EXPANDABLES->{ 'financial_connections.session' }, data_prefix_is_ok => 1 },
5734             };
5735             $args = $self->_contract( 'financial_connections.session', $args ) || CORE::return( $self->pass_error );
5736             my $err = $self->_check_parameters( $okParams, $args );
5737             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
5738             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No financial_connections.session id (with parameter 'id') was provided to retrieve its information." ) );
5739             my $hash = $self->get( "financial_connections/sessions/${id}", $args ) || CORE::return( $self->pass_error );
5740             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Financial::Connections::Session', $hash ) );
5741             }
5742             PERL
5743             # NOTE: financial_connections_sessions()
5744             financial_connections_sessions => <<'PERL',
5745             # <https://stripe.com/docs/api/financial_connections/session>
5746             sub financial_connections_sessions
5747             {
5748             my $self = shift( @_ );
5749             my $allowed = [qw( create retrieve )];
5750             my $action = shift( @_ );
5751             my $meth = $self->_get_method( 'financial_connections_session', $action, $allowed ) || CORE::return( $self->pass_error );
5752             CORE::return( $self->$meth( @_ ) );
5753             }
5754             PERL
5755             # NOTE: fraud()
5756             fraud => <<'PERL',
5757             sub fraud { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Fraud', @_ ) ); }
5758             PERL
5759             # NOTE: funding_instructions()
5760             funding_instructions => <<'PERL',
5761             sub funding_instructions { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Issuing::FundingInstructions', @_ ) ); }
5762             PERL
5763             # NOTE: funding_instructions_create()
5764             funding_instructions_create => <<'PERL',
5765             sub funding_instructions_create
5766             {
5767             my $self = shift( @_ );
5768             my $args = shift( @_ );
5769             my $okParams =
5770             {
5771             expandable => { allowed => $EXPANDABLES->{ 'funding_instructions' } },
5772             bank_transfer => { type => "hash", required => 1 },
5773             currency => { type => "string", required => 1 },
5774             funding_type => { type => "string", required => 1 },
5775             };
5776             $args = $self->_contract( 'funding_instructions', $args ) || CORE::return( $self->pass_error );
5777             my $err = $self->_check_parameters( $okParams, $args );
5778             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
5779             my $hash = $self->post( "issuing/funding_instructions", $args ) || CORE::return( $self->pass_error );
5780             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Issuing::FundingInstructions', $hash ) );
5781             }
5782             PERL
5783             # NOTE: funding_instructions_fund()
5784             funding_instructions_fund => <<'PERL',
5785             sub funding_instructions_fund
5786             {
5787             my $self = shift( @_ );
5788             my $args = shift( @_ );
5789             my $okParams =
5790             {
5791             expandable => { allowed => $EXPANDABLES->{ 'funding_instructions' } },
5792             amount => { type => "string", required => 1 },
5793             currency => { type => "string", required => 1 },
5794             };
5795             $args = $self->_contract( 'funding_instructions', $args ) || CORE::return( $self->pass_error );
5796             my $err = $self->_check_parameters( $okParams, $args );
5797             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
5798             my $hash = $self->post( "test_helpers/issuing/fund_balance", $args ) || CORE::return( $self->pass_error );
5799             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Issuing::FundingInstructions', $hash ) );
5800             }
5801             PERL
5802             # NOTE: funding_instructions_list()
5803             funding_instructions_list => <<'PERL',
5804             sub funding_instructions_list
5805             {
5806             my $self = shift( @_ );
5807             CORE::return( $self->error( "No parameters were provided to list funding instructions information." ) ) if( !scalar( @_ ) );
5808             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Issuing::FundingInstructions', @_ );
5809             my $okParams =
5810             {
5811             expandable => { allowed => $EXPANDABLES->{ 'funding_instructions' }, data_prefix_is_ok => 1 },
5812             ending_before => { type => "string" },
5813             limit => { type => "string" },
5814             starting_after => { type => "string" },
5815             };
5816             my $err = $self->_check_parameters( $okParams, $args );
5817             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
5818             if( $args->{expand} )
5819             {
5820             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
5821             }
5822             my $hash = $self->get( "issuing/funding_instructions", $args ) || CORE::return( $self->pass_error );
5823             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Issuing::FundingInstructions', $hash ) );
5824             }
5825             PERL
5826             # NOTE: funding_instructionss()
5827             funding_instructionss => <<'PERL',
5828             # <https://stripe.com/docs/api/issuing/funding_instructions>
5829             sub funding_instructionss
5830             {
5831             my $self = shift( @_ );
5832             my $allowed = [qw( create fund list )];
5833             my $action = shift( @_ );
5834             my $meth = $self->_get_method( 'funding_instructions', $action, $allowed ) || CORE::return( $self->pass_error );
5835             CORE::return( $self->$meth( @_ ) );
5836             }
5837             PERL
5838             # NOTE: identity_verification_report()
5839             identity_verification_report => <<'PERL',
5840             sub identity_verification_report { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Identity::VerificationReport', @_ ) ); }
5841             PERL
5842             # NOTE: identity_verification_report_list()
5843             identity_verification_report_list => <<'PERL',
5844             sub identity_verification_report_list
5845             {
5846             my $self = shift( @_ );
5847             CORE::return( $self->error( "No parameters were provided to list identity verification report information." ) ) if( !scalar( @_ ) );
5848             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Identity::VerificationReport', @_ );
5849             my $okParams =
5850             {
5851             expandable => { allowed => $EXPANDABLES->{ 'identity.verification_report' }, data_prefix_is_ok => 1 },
5852             created => { type => "timestamp" },
5853             ending_before => { type => "string" },
5854             limit => { type => "string" },
5855             starting_after => { type => "string" },
5856             type => { type => "string" },
5857             verification_session => { type => "string" },
5858             };
5859             my $err = $self->_check_parameters( $okParams, $args );
5860             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
5861             if( $args->{expand} )
5862             {
5863             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
5864             }
5865             my $hash = $self->get( "", $args ) || CORE::return( $self->pass_error );
5866             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Identity::VerificationReport', $hash ) );
5867             }
5868             PERL
5869             # NOTE: identity_verification_report_retrieve()
5870             identity_verification_report_retrieve => <<'PERL',
5871             sub identity_verification_report_retrieve
5872             {
5873             my $self = shift( @_ );
5874             my $args = shift( @_ );
5875             my $okParams =
5876             {
5877             expandable => { allowed => $EXPANDABLES->{ 'identity.verification_report' }, data_prefix_is_ok => 1 },
5878             };
5879             $args = $self->_contract( 'identity.verification_report', $args ) || CORE::return( $self->pass_error );
5880             my $err = $self->_check_parameters( $okParams, $args );
5881             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
5882             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No identity.verification_report id (with parameter 'id') was provided to retrieve its information." ) );
5883             my $hash = $self->get( "identity/verification_reports/${id}", $args ) || CORE::return( $self->pass_error );
5884             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Identity::VerificationReport', $hash ) );
5885             }
5886             PERL
5887             # NOTE: identity_verification_reports()
5888             identity_verification_reports => <<'PERL',
5889             # <https://stripe.com/docs/api/identity/verification_reports>
5890             sub identity_verification_reports
5891             {
5892             my $self = shift( @_ );
5893             my $allowed = [qw( list retrieve )];
5894             my $action = shift( @_ );
5895             my $meth = $self->_get_method( 'identity_verification_report', $action, $allowed ) || CORE::return( $self->pass_error );
5896             CORE::return( $self->$meth( @_ ) );
5897             }
5898             PERL
5899             # NOTE: identity_verification_session()
5900             identity_verification_session => <<'PERL',
5901             sub identity_verification_session { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Identity::VerificationSession', @_ ) ); }
5902             PERL
5903             # NOTE: identity_verification_session_cancel()
5904             identity_verification_session_cancel => <<'PERL',
5905             sub identity_verification_session_cancel
5906             {
5907             my $self = shift( @_ );
5908             my $args = shift( @_ );
5909             my $okParams =
5910             {
5911             expandable => { allowed => $EXPANDABLES->{ 'identity.verification_session' } },
5912             };
5913             $args = $self->_contract( 'identity.verification_session', $args ) || CORE::return( $self->pass_error );
5914             my $err = $self->_check_parameters( $okParams, $args );
5915             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
5916             my $hash = $self->post( "", $args ) || CORE::return( $self->pass_error );
5917             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Identity::VerificationSession', $hash ) );
5918             }
5919             PERL
5920             # NOTE: identity_verification_session_create()
5921             identity_verification_session_create => <<'PERL',
5922             sub identity_verification_session_create
5923             {
5924             my $self = shift( @_ );
5925             my $args = shift( @_ );
5926             my $okParams =
5927             {
5928             expandable => { allowed => $EXPANDABLES->{ 'identity.verification_session' } },
5929             metadata => { type => "hash" },
5930             options => { type => "hash" },
5931             return_url => { type => "string" },
5932             type => { type => "string", required => 1 },
5933             };
5934             $args = $self->_contract( 'identity.verification_session', $args ) || CORE::return( $self->pass_error );
5935             my $err = $self->_check_parameters( $okParams, $args );
5936             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
5937             my $hash = $self->post( "", $args ) || CORE::return( $self->pass_error );
5938             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Identity::VerificationSession', $hash ) );
5939             }
5940             PERL
5941             # NOTE: identity_verification_session_list()
5942             identity_verification_session_list => <<'PERL',
5943             sub identity_verification_session_list
5944             {
5945             my $self = shift( @_ );
5946             CORE::return( $self->error( "No parameters were provided to list identity verification session information." ) ) if( !scalar( @_ ) );
5947             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Identity::VerificationSession', @_ );
5948             my $okParams =
5949             {
5950             expandable => { allowed => $EXPANDABLES->{ 'identity.verification_session' }, data_prefix_is_ok => 1 },
5951             created => { type => "timestamp" },
5952             ending_before => { type => "string" },
5953             limit => { type => "string" },
5954             starting_after => { type => "string" },
5955             status => { type => "string" },
5956             };
5957             my $err = $self->_check_parameters( $okParams, $args );
5958             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
5959             if( $args->{expand} )
5960             {
5961             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
5962             }
5963             my $hash = $self->get( "", $args ) || CORE::return( $self->pass_error );
5964             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Identity::VerificationSession', $hash ) );
5965             }
5966             PERL
5967             # NOTE: identity_verification_session_redact()
5968             identity_verification_session_redact => <<'PERL',
5969             sub identity_verification_session_redact
5970             {
5971             my $self = shift( @_ );
5972             my $args = shift( @_ );
5973             my $okParams =
5974             {
5975             expandable => { allowed => $EXPANDABLES->{ 'identity.verification_session' } },
5976             };
5977             $args = $self->_contract( 'identity.verification_session', $args ) || CORE::return( $self->pass_error );
5978             my $err = $self->_check_parameters( $okParams, $args );
5979             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
5980             my $hash = $self->post( "", $args ) || CORE::return( $self->pass_error );
5981             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Identity::VerificationSession', $hash ) );
5982             }
5983             PERL
5984             # NOTE: identity_verification_session_retrieve()
5985             identity_verification_session_retrieve => <<'PERL',
5986             sub identity_verification_session_retrieve
5987             {
5988             my $self = shift( @_ );
5989             my $args = shift( @_ );
5990             my $okParams =
5991             {
5992             expandable => { allowed => $EXPANDABLES->{ 'identity.verification_session' }, data_prefix_is_ok => 1 },
5993             };
5994             $args = $self->_contract( 'identity.verification_session', $args ) || CORE::return( $self->pass_error );
5995             my $err = $self->_check_parameters( $okParams, $args );
5996             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
5997             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No identity.verification_session id (with parameter 'id') was provided to retrieve its information." ) );
5998             my $hash = $self->get( "identity/verification_sessions/${id}", $args ) || CORE::return( $self->pass_error );
5999             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Identity::VerificationSession', $hash ) );
6000             }
6001             PERL
6002             # NOTE: identity_verification_session_update()
6003             identity_verification_session_update => <<'PERL',
6004             sub identity_verification_session_update
6005             {
6006             my $self = shift( @_ );
6007             my $args = shift( @_ );
6008             my $okParams =
6009             {
6010             expandable => { allowed => $EXPANDABLES->{ 'identity.verification_session' } },
6011             metadata => { type => "hash" },
6012             options => { type => "hash" },
6013             type => { type => "string" },
6014             };
6015             $args = $self->_contract( 'identity.verification_session', $args ) || CORE::return( $self->pass_error );
6016             my $err = $self->_check_parameters( $okParams, $args );
6017             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
6018             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No identity.verification_session id (with parameter 'id') was provided to update its information." ) );
6019             my $hash = $self->post( "identity/verification_sessions/${id}", $args ) || CORE::return( $self->pass_error );
6020             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Identity::VerificationSession', $hash ) );
6021             }
6022             PERL
6023             # NOTE: identity_verification_sessions()
6024             identity_verification_sessions => <<'PERL',
6025             # <https://stripe.com/docs/api/identity/verification_sessions>
6026             sub identity_verification_sessions
6027             {
6028             my $self = shift( @_ );
6029             my $allowed = [qw( cancel create list redact retrieve update )];
6030             my $action = shift( @_ );
6031             my $meth = $self->_get_method( 'identity_verification_session', $action, $allowed ) || CORE::return( $self->pass_error );
6032             CORE::return( $self->$meth( @_ ) );
6033             }
6034             PERL
6035             # NOTE: invoice()
6036             invoice => <<'PERL',
6037             sub invoice { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Billing::Invoice', @_ ) ); }
6038             PERL
6039             # NOTE: invoice_create()
6040             invoice_create => <<'PERL',
6041             sub invoice_create
6042             {
6043             my $self = shift( @_ );
6044             CORE::return( $self->error( "No parameters were provided to create an invoice" ) ) if( !scalar( @_ ) );
6045             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Billing::Invoice', @_ );
6046             my $obj = $args->{_object};
6047             # If we are provided with an invoice object, we change our value for only its id
6048             if( ( $obj && $obj->customer ) ||
6049             ( $self->_is_object( $args->{customer} ) && $args->{customer}->isa( 'Net::API::Stripe::Customer' ) ) )
6050             {
6051             my $cust = $obj ? $obj->customer : $args->{customer};
6052             $args->{customer} = $cust->id || CORE::return( $self->error( "The Customer object provided for this invoice has no id." ) );
6053             }
6054            
6055             if( ( $obj && $obj->subscription ) ||
6056             ( $args->{subscription} && $self->_is_object( $args->{subscription} ) && $args->{subscription}->isa( 'Net::API::Stripe::Billing::Subscription' ) ) )
6057             {
6058             my $sub = $obj ? $obj->subscription : $args->{subscription};
6059             $args->{subscription} = $sub->id || CORE::return( $self->error( "The Subscription object provided for this invoice has no id." ) );
6060             }
6061            
6062             my $okParams =
6063             {
6064             expandable => { allowed => $EXPANDABLES->{invoice} },
6065             account_tax_ids => { type => "array" },
6066             application_fee_amount => { re => qr/^\d+$/, type => "integer" },
6067             auto_advance => { type => "boolean" },
6068             automatic_tax => { fields => ["enabled"], type => "hash" },
6069             collection_method => { re => qr/^(charge_automatically|send_invoice)$/, type => "string" },
6070             currency => { type => "currency" },
6071             custom_fields => { fields => ["name", "value"], type => "array" },
6072             customer => { re => qr/^\w+$/, type => "string" },
6073             days_until_due => { re => qr/^\d+$/, type => "integer" },
6074             default_payment_method => { re => qr/^\w+$/, type => "string" },
6075             default_source => { re => qr/^\w+$/, type => "string" },
6076             default_tax_rates => { re => qr/^\d+(?:\.\d+)?$/, type => "array" },
6077             description => { type => "string" },
6078             discounts => { fields => ["coupon", "discount"], type => "array" },
6079             due_date => { type => "timestamp" },
6080             footer => { type => "string" },
6081             metadata => { type => "hash" },
6082             on_behalf_of => { re => qr/^\w+$/, type => "string" },
6083             payment_settings => {
6084             fields => [
6085             "payment_method_options.acss_debit",
6086             "payment_method_options.acss_debit.mandate_options",
6087             "payment_method_options.acss_debit.mandate_options.transaction_type",
6088             "payment_method_options.acss_debit.verification_method",
6089             "payment_method_options.bancontact",
6090             "payment_method_options.bancontact.preferred_language",
6091             "payment_method_options.card",
6092             "payment_method_options.card.request_three_d_secure",
6093             "payment_method_options.customer_balance",
6094             "payment_method_options.customer_balance.bank_transfer",
6095             "payment_method_options.customer_balance.bank_transfer.eu_bank_transfer",
6096             "payment_method_options.customer_balance.bank_transfer.eu_bank_transfer.country",
6097             "payment_method_options.customer_balance.bank_transfer.type",
6098             "payment_method_options.customer_balance.funding_type",
6099             "payment_method_options.konbini",
6100             "payment_method_options.us_bank_account",
6101             "payment_method_options.us_bank_account.financial_connections",
6102             "payment_method_options.us_bank_account.financial_connections.permissions",
6103             "payment_method_options.us_bank_account.verification_method",
6104             "payment_method_types",
6105             ],
6106             type => "hash",
6107             },
6108             pending_invoice_items_behavior => { type => "string" },
6109             rendering_options => { fields => ["amount_tax_display"], type => "hash" },
6110             statement_descriptor => { type => "string" },
6111             subscription => { re => qr/^\w+$/, type => "string" },
6112             tax_percent => { re => qr/^\d+(?:\.\d+)?$/ },
6113             transfer_data => { fields => ["destination", "amount"], type => "hash" },
6114             };
6115              
6116             $args = $self->_contract( 'invoice', $args ) || CORE::return( $self->pass_error );
6117             my $err = $self->_check_parameters( $okParams, $args );
6118             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
6119             my $hash = $self->post( 'invoices', $args ) || CORE::return( $self->pass_error );
6120             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::Invoice', $hash ) );
6121             }
6122             PERL
6123             # NOTE: invoice_delete()
6124             invoice_delete => <<'PERL',
6125             # NOTE: Delete a draft invoice
6126             sub invoice_delete
6127             {
6128             my $self = shift( @_ );
6129             CORE::return( $self->error( "No parameters were provided to delete a draft invoice." ) ) if( !scalar( @_ ) );
6130             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Billing::Invoice', @_ );
6131             my $okParams =
6132             {
6133             expandable => { allowed => $EXPANDABLES->{invoice} },
6134             id => { re => qr/^\w+$/, required => 1 }
6135             };
6136             my $err = $self->_check_parameters( $okParams, $args );
6137             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
6138             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No draft invoice id was provided to delete its information." ) );
6139             my $hash = $self->delete( "invoices/${id}", $args ) || CORE::return( $self->pass_error );
6140             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::Invoice', $hash ) );
6141             }
6142             PERL
6143             # NOTE: invoice_finalise()
6144             invoice_finalise => <<'PERL',
6145             sub invoice_finalise
6146             {
6147             my $self = shift( @_ );
6148             CORE::return( $self->error( "No parameters were provided to pay invoice." ) ) if( !scalar( @_ ) );
6149             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Billing::Invoice', @_ );
6150             my $okParams =
6151             {
6152             expandable => { allowed => $EXPANDABLES->{invoice} },
6153             id => { re => qr/^\w+$/, required => 1 },
6154             auto_advance => {},
6155             };
6156             $args = $self->_contract( 'invoice', $args ) || CORE::return( $self->pass_error );
6157             my $err = $self->_check_parameters( $okParams, $args );
6158             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
6159             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No invoice id was provided to pay it." ) );
6160             my $hash = $self->post( "invoices/${id}/finalize", $args ) || CORE::return( $self->pass_error );
6161             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::Invoice', $hash ) );
6162             }
6163             PERL
6164             # NOTE: invoice_finalize()
6165             invoice_finalize => <<'PERL',
6166             sub invoice_finalize
6167             {
6168             my $self = shift( @_ );
6169             my $args = shift( @_ );
6170             my $okParams =
6171             {
6172             expandable => { allowed => $EXPANDABLES->{ 'invoice' } },
6173             auto_advance => { type => "boolean" },
6174             };
6175             $args = $self->_contract( 'invoice', $args ) || CORE::return( $self->pass_error );
6176             my $err = $self->_check_parameters( $okParams, $args );
6177             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
6178             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No invoice id (with parameter 'id') was provided to finalize its information." ) );
6179             my $hash = $self->post( "invoices/${id}", $args ) || CORE::return( $self->pass_error );
6180             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::Invoice', $hash ) );
6181             }
6182             PERL
6183             # NOTE: invoice_item()
6184             invoice_item => <<'PERL',
6185             # Make everyone happy, British English and American English
6186             sub invoice_item { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Billing::Invoice::Item', @_ ) ); }
6187             PERL
6188             # NOTE: invoice_item_create()
6189             invoice_item_create => <<'PERL',
6190             sub invoice_item_create
6191             {
6192             my $self = shift( @_ );
6193             CORE::return( $self->error( "No parameters were provided to create an invoice item" ) ) if( !scalar( @_ ) );
6194             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Billing::Invoice::Item', @_ );
6195             my $okParams =
6196             {
6197             expandable => { allowed => $EXPANDABLES->{invoiceitem} },
6198             customer => { re => qr/^\w+$/, required => 1 },
6199             amount => { type => 'integer' },
6200             currency => { type => 'string' },
6201             description => {},
6202             metadata => { type => 'hash' },
6203             period => { fields => [qw( end! start! )] },
6204             price => { re => qr/^\w+$/ },
6205             discountable => { type => 'boolean' },
6206             discounts => { type => 'array', fields => [qw( coupon discount )] },
6207             invoice => { re => qr/^\w+$/ },
6208             price_data => { fields => [qw(
6209             currency!
6210             product!
6211             unit_amount_decimal!
6212             tax_behavior
6213             unit_amount
6214             )] },
6215             quantity => { type => 'integer' },
6216             subscription => { re => qr/^\w+$/ },
6217             tax_rates => { type => 'array' },
6218             unit_amount => { type => 'integer' },
6219             unit_amount_decimal => { type => 'decimal' },
6220             };
6221             $args = $self->_contract( 'invoiceitem', $args ) || CORE::return( $self->pass_error );
6222             my $err = $self->_check_parameters( $okParams, $args );
6223             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
6224             my $hash = $self->post( 'invoiceitems', $args ) || CORE::return( $self->pass_error );
6225             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::Invoice::Item', $hash ) );
6226             }
6227             PERL
6228             # NOTE: invoice_item_delete()
6229             invoice_item_delete => <<'PERL',
6230             sub invoice_item_delete
6231             {
6232             my $self = shift( @_ );
6233             CORE::return( $self->error( "No parameters were provided to delete an invoice item information." ) ) if( !scalar( @_ ) );
6234             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Billing::Invoice::Item', @_ );
6235             my $okParams =
6236             {
6237             expandable => { allowed => $EXPANDABLES->{invoiceitem} },
6238             id => { re => qr/^\w+$/, required => 1 }
6239             };
6240             my $err = $self->_check_parameters( $okParams, $args );
6241             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
6242             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No invoice item id was provided to delete its information." ) );
6243             my $hash = $self->delete( "invoiceitems/${id}", $args ) || CORE::return( $self->pass_error );
6244             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::Invoice::Item', $hash ) );
6245             }
6246             PERL
6247             # NOTE: invoice_item_list()
6248             invoice_item_list => <<'PERL',
6249             sub invoice_item_list
6250             {
6251             my $self = shift( @_ );
6252             my $args = $self->_get_args( @_ );
6253             my $okParams =
6254             {
6255             expandable => { allowed => $EXPANDABLES->{invoiceitem} },
6256             created => { re => qr/^\d+$/ },
6257             'created.gt' => { re => qr/^\d+$/ },
6258             'created.gte' => { re => qr/^\d+$/ },
6259             'created.lt' => { re => qr/^\d+$/ },
6260             'created.lte' => { re => qr/^\d+$/ },
6261             invoice => { re => qr/^\w+$/ },
6262             ending_before => {},
6263             limit => { re => qr/^\d+$/ },
6264             pending => { type => 'boolean' },
6265             starting_after => {},
6266             };
6267             my $err = $self->_check_parameters( $okParams, $args );
6268             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
6269             if( $args->{expand} )
6270             {
6271             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
6272             }
6273             my $hash = $self->get( 'invoiceitems', $args ) || CORE::return( $self->pass_error );
6274             CORE::return( $self->_response_to_object( 'Net::API::Stripe::List', $hash ) );
6275             }
6276             PERL
6277             # NOTE: invoice_item_retrieve()
6278             invoice_item_retrieve => <<'PERL',
6279             sub invoice_item_retrieve
6280             {
6281             my $self = shift( @_ );
6282             CORE::return( $self->error( "No parameters were provided to retrieve invoice item information." ) ) if( !scalar( @_ ) );
6283             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Billing::Invoice::Item', @_ );
6284             my $okParams =
6285             {
6286             expandable => { allowed => $EXPANDABLES->{invoiceitem} },
6287             id => { re => qr/^\w+$/, required => 1 }
6288             };
6289             my $err = $self->_check_parameters( $okParams, $args );
6290             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
6291             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No invoice item id was provided to retrieve its information." ) );
6292             my $hash = $self->get( "invoiceitems/${id}", $args ) || CORE::return( $self->pass_error );
6293             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::Invoice::Item', $hash ) );
6294             }
6295             PERL
6296             # NOTE: invoice_item_update()
6297             invoice_item_update => <<'PERL',
6298             sub invoice_item_update
6299             {
6300             my $self = shift( @_ );
6301             CORE::return( $self->error( "No parameters were provided to update an invoice item." ) ) if( !scalar( @_ ) );
6302             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Billing::Invoice::Item', @_ );
6303             my $okParams =
6304             {
6305             expandable => { allowed => $EXPANDABLES->{invoiceitem} },
6306             id => { re => qr/^\w+$/, required => 1 },
6307             amount => { type => 'integer' },
6308             description => {},
6309             metadata => { type => 'hash' },
6310             period => { fields => [qw( end! start! )] },
6311             price => { re => qr/^\w+$/ },
6312             discountable => { type => 'boolean' },
6313             discounts => { type => 'array', fields => [qw( coupon discount )] },
6314             price_data => { fields => [qw(
6315             currency!
6316             product!
6317             unit_amount_decimal!
6318             tax_behavior
6319             unit_amount
6320             )] },
6321             quantity => { type => 'integer' },
6322             tax_rates => { type => 'array' },
6323             unit_amount => { type => 'integer' },
6324             unit_amount_decimal => { type => 'decimal' },
6325             };
6326             $args = $self->_contract( 'invoiceitem', $args ) || CORE::return( $self->pass_error );
6327             # We found some errors
6328             my $err = $self->_check_parameters( $okParams, $args );
6329             # $self->message( 3, "Data to be posted: ", $self->dumper( $args ) ); exit;
6330             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
6331             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No product id was provided to update product's details" ) );
6332             my $hash = $self->post( "invoiceitems/${id}", $args ) || CORE::return( $self->pass_error );
6333             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::Invoice::Item', $hash ) );
6334             }
6335             PERL
6336             # NOTE: invoice_items()
6337             invoice_items => <<'PERL',
6338             sub invoice_items
6339             {
6340             my $self = shift( @_ );
6341             my $action = shift( @_ );
6342             my $allowed = [qw( create retrieve update list delete )];
6343             my $meth = $self->_get_method( 'invoice_item', $action, $allowed ) || CORE::return( $self->pass_error );
6344             CORE::return( $self->$meth( @_ ) );
6345             }
6346             PERL
6347             # NOTE: invoice_line_item()
6348             invoice_line_item => <<'PERL',
6349             sub invoice_line_item { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Billing::Invoice::LineItem', @_ ) ); }
6350             PERL
6351             # NOTE: invoice_lines()
6352             invoice_lines => <<'PERL',
6353             sub invoice_lines
6354             {
6355             my $self = shift( @_ );
6356             CORE::return( $self->error( "No parameters were provided to get the invoice line items." ) ) if( !scalar( @_ ) );
6357             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Billing::Invoice', @_ );
6358             # There are no expandable properties as of 2020-02-14
6359             my $okParams =
6360             {
6361             id => { re => qr/^\w+$/, required => 1 },
6362             # "A cursor for use in pagination. ending_before is an object ID that defines your place in the list."
6363             ending_before => { re => qr/^\w+$/ },
6364             limit => { re => qr/^\d+$/ },
6365             starting_after => { re => qr/^\w+$/ },
6366             };
6367             my $err = $self->_check_parameters( $okParams, $args );
6368             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
6369             my $id = CORE::delete( $args->{id} );
6370             if( $args->{expand} )
6371             {
6372             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
6373             }
6374             my $hash = $self->get( "invoices/${id}/lines", $args ) || CORE::return( $self->pass_error );
6375             CORE::return( $self->_response_to_object( 'Net::API::Stripe::List', $hash ) );
6376             }
6377             PERL
6378             # NOTE: invoice_lines_upcoming()
6379             invoice_lines_upcoming => <<'PERL',
6380             # NOTE: Retrieve an upcoming invoice's line items
6381             sub invoice_lines_upcoming
6382             {
6383             my $self = shift( @_ );
6384             CORE::return( $self->error( "No parameters were provided to get the incoming invoice line items." ) ) if( !scalar( @_ ) );
6385             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Billing::Invoice', @_ );
6386             # If any
6387             my $obj = $args->{_object};
6388             if( ( $obj && $obj->customer ) ||
6389             ( $self->_is_object( $args->{customer} ) && $args->{customer}->isa( 'Net::API::Stripe::Customer' ) ) )
6390             {
6391             my $cust = $obj ? $obj-customer : $args->{customer};
6392             $args->{customer} = $cust->id || CORE::return( $self->error( "No customer id could be found in this customer object." ) );
6393             }
6394            
6395             if( ( $obj && $obj->schedule && $obj->schedule->id ) ||
6396             ( $args->{schedule} && $self->_is_object( $args->{schedule} ) && $args->{schedule}->isa( 'Net::API::Stripe::Billing::Subscription::Schedule' ) ) )
6397             {
6398             my $sched = $obj ? $obj->schedule : $args->{schedule};
6399             $args->{schedule} = $sched->id || CORE::return( $self->error( "No subscription schedule id could be found in this subscription schedule object." ) );
6400             }
6401            
6402             if( ( $obj && $obj->subscription && $obj->subscription->id ) ||
6403             ( $args->{subscription} && $self->_is_object( $args->{subscription} ) && $args->{subscription}->isa( 'Net::API::Stripe::Billing::Subscription' ) ) )
6404             {
6405             my $sub = $obj ? $obj->subscription : $args->{subscription};
6406             $args->{subscription} = $sub->id || CORE::return( $self->error( "No subscription id could be found in this subscription object." ) );
6407             }
6408            
6409             my $okParams =
6410             {
6411             customer => { re => qr/^\w+$/ },
6412             coupon => {},
6413             ending_before => { re => qr/^\w+$/ },
6414             invoice_items => { type => 'array', fields => [qw( amount currency description discountable invoiceitem metadata period.end period.start quantity tax_rates unit_amount unit_amount_decimal )] },
6415             limit => { re => qr/^\d+$/ },
6416             schedule => { re => qr/^\w+$/ },
6417             starting_after => { re => qr/^\w+$/ },
6418             subscription => { re => qr/^\w+$/ },
6419             # A timestamp
6420             subscription_billing_cycle_anchor => {},
6421             # A timestamp
6422             subscription_cancel_at => {},
6423             # Boolean
6424             subscription_cancel_at_period_end => {},
6425             # "This simulates the subscription being canceled or expired immediately."
6426             subscription_cancel_now => {},
6427             subscription_default_tax_rates => { type => 'array' },
6428             subscription_items => {},
6429             subscription_prorate => { re => qr/^(subscription_items|subscription|subscription_items|subscription_trial_end)$/ },
6430             subscription_proration_behavior => { re => qr/^(create_prorations|none|always_invoice)$/ },
6431             # Timestamp
6432             subscription_proration_date => {},
6433             # Timestamp
6434             subscription_start_date => {},
6435             subscription_tax_percent=> { re => qr/^\d+(\.\d+)?$/ },
6436             subscription_trial_end => {},
6437             subscription_trial_from_plan => {},
6438             };
6439             my $err = $self->_check_parameters( $okParams, $args );
6440             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
6441             if( $args->{expand} )
6442             {
6443             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
6444             }
6445             my $hash = $self->get( 'invoices/upcoming/lines', $args ) || CORE::return( $self->pass_error );
6446             CORE::return( $self->_response_to_object( 'Net::API::Stripe::List', $hash ) );
6447             }
6448             PERL
6449             # NOTE: invoice_list()
6450             invoice_list => <<'PERL',
6451             sub invoice_list
6452             {
6453             my $self = shift( @_ );
6454             my $args = $self->_get_args( @_ );
6455             if( $self->_is_object( $args->{customer} ) && $args->{customer}->isa( 'Net::API::Stripe::Customer' ) )
6456             {
6457             $args->{customer} = $args->{customer}->id || CORE::return( $self->error( "No customer id could be found in this customer object." ) );
6458             }
6459            
6460             if( $args->{subscription} && $self->_is_object( $args->{subscription} ) && $args->{subscription}->isa( 'Net::API::Stripe::Billing::Subscription' ) )
6461             {
6462             $args->{subscription} = $args->{subscription}->id || CORE::return( $self->error( "No subscription id could be found in this subscription object." ) );
6463             }
6464            
6465             my $okParams =
6466             {
6467             expandable => { allowed => $EXPANDABLES->{invoice}, data_prefix_is_ok => 1 },
6468             collection_method => { re => qr/^(charge_automatically|send_invoice)$/, type => "string" },
6469             created => { re => qr/^\d+$/, type => "timestamp" },
6470             'created.gt' => { re => qr/^\d+$/ },
6471             'created.gte' => { re => qr/^\d+$/ },
6472             'created.lt' => { re => qr/^\d+$/ },
6473             'created.lte' => { re => qr/^\d+$/ },
6474             customer => { re => qr/^\w+$/, type => "string" },
6475             due_date => { type => "timestamp" },
6476             'due_date.gt' => { re => qr/^\d+$/ },
6477             'due_date.gte' => { re => qr/^\d+$/ },
6478             'due_date.lt' => { re => qr/^\d+$/ },
6479             'due_date.lte' => { re => qr/^\d+$/ },
6480             ending_before => { re => qr/^\w+$/, type => "string" },
6481             limit => { re => qr/^\d+$/, type => "string" },
6482             starting_after => { re => qr/^\w+$/, type => "string" },
6483             status => { re => qr/^(draft|open|paid|uncollectible|void)$/, type => "string" },
6484             subscription => { re => qr/^\w+$/, type => "string" },
6485             };
6486              
6487             my $err = $self->_check_parameters( $okParams, $args );
6488             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
6489             if( $args->{expand} )
6490             {
6491             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
6492             }
6493             my $hash = $self->get( 'invoices', $args ) || CORE::return( $self->pass_error );
6494             CORE::return( $self->_response_to_object( 'Net::API::Stripe::List', $hash ) );
6495             }
6496             PERL
6497             # NOTE: invoice_pay()
6498             invoice_pay => <<'PERL',
6499             sub invoice_pay
6500             {
6501             my $self = shift( @_ );
6502             CORE::return( $self->error( "No parameters were provided to pay invoice." ) ) if( !scalar( @_ ) );
6503             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Billing::Invoice', @_ );
6504             my $obj = $args->{_object};
6505             if( ( $obj && $obj->payment_method ) ||
6506             ( $args->{payment_method} && $self->_is_object( $args->{payment_method} ) && $args->{payment_method}->isa( 'Net::API::Stripe::Payment::Method' ) ) )
6507             {
6508             my $pm = $obj ? $obj->payment_method : $args->{payment_method};
6509             $args->{payment_method} = $pm->id || CORE::return( $self->error( "No payment method id could be found in this payment method object." ) );
6510             }
6511            
6512             if( ( $obj && $obj->source ) ||
6513             ( $args->{source} && $self->_is_object( $args->{source} ) && $args->{source}->isa( 'Net::API::Stripe::Payment::Source' ) ) )
6514             {
6515             my $src = $obj ? $obj->source : $args->{source};
6516             $args->{source} = $src->id || CORE::return( $self->error( "No payment source id could be found in this payment source object." ) );
6517             }
6518             my $okParams =
6519             {
6520             expandable => { allowed => $EXPANDABLES->{invoice} },
6521             forgive => { type => "boolean" },
6522             id => { re => qr/^\w+$/, required => 1 },
6523             mandate => { type => "string" },
6524             off_session => { type => "boolean" },
6525             paid_out_of_band => { type => "boolean" },
6526             payment_method => { re => qr/^\w+$/, type => "string" },
6527             source => { re => qr/^\w+$/, type => "string" },
6528             };
6529              
6530             $args = $self->_contract( 'invoice', $args ) || CORE::return( $self->pass_error );
6531             my $err = $self->_check_parameters( $okParams, $args );
6532             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
6533             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No invoice id was provided to pay it." ) );
6534             my $hash = $self->post( "invoices/${id}/pay", $args ) || CORE::return( $self->pass_error );
6535             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::Invoice', $hash ) );
6536             }
6537             PERL
6538             # NOTE: invoice_retrieve()
6539             invoice_retrieve => <<'PERL',
6540             sub invoice_retrieve
6541             {
6542             my $self = shift( @_ );
6543             CORE::return( $self->error( "No parameters were provided to retrieve invoice information." ) ) if( !scalar( @_ ) );
6544             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Billing::Invoice', @_ );
6545             my $okParams =
6546             {
6547             expandable => { allowed => $EXPANDABLES->{invoice} },
6548             id => { re => qr/^\w+$/, required => 1 }
6549             };
6550             my $err = $self->_check_parameters( $okParams, $args );
6551             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
6552             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No invoice id was provided to retrieve its information." ) );
6553             my $hash = $self->get( "invoices/${id}", $args ) || CORE::return( $self->pass_error );
6554             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::Invoice', $hash ) );
6555             }
6556             PERL
6557             # NOTE: invoice_search()
6558             invoice_search => <<'PERL',
6559             sub invoice_search
6560             {
6561             my $self = shift( @_ );
6562             CORE::return( $self->error( "No parameters were provided to search for an invoice information." ) ) if( !scalar( @_ ) );
6563             my $args = shift( @_ );
6564             my $okParams =
6565             {
6566             expandable => { allowed => $EXPANDABLES->{invoice}, data_prefix_is_ok => 1 },
6567             limit => qr/^\d+$/,
6568             page => qr/^\d+$/,
6569             query => { re => qr/^.*?$/, required => 1, type => "string" },
6570             };
6571              
6572             my $err = $self->_check_parameters( $okParams, $args );
6573             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
6574             if( $args->{expand} )
6575             {
6576             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
6577             }
6578             my $hash = $self->get( "invoices/search", $args ) || CORE::return( $self->pass_error );
6579             CORE::return( $self->_response_to_object( 'Net::API::Stripe::List', $hash ) );
6580             }
6581             PERL
6582             # NOTE: invoice_send()
6583             invoice_send => <<'PERL',
6584             # NOTE: Send an invoice for manual payment
6585             sub invoice_send
6586             {
6587             my $self = shift( @_ );
6588             CORE::return( $self->error( "No parameters were provided to send invoice." ) ) if( !scalar( @_ ) );
6589             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Billing::Invoice', @_ );
6590             my $okParams =
6591             {
6592             expandable => { allowed => $EXPANDABLES->{invoice} },
6593             id => { re => qr/^\w+$/, required => 1 },
6594             };
6595             $args = $self->_contract( 'invoice', $args ) || CORE::return( $self->pass_error );
6596             my $err = $self->_check_parameters( $okParams, $args );
6597             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
6598             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No invoice id was provided to send it." ) );
6599             my $hash = $self->post( "invoices/${id}/send", $args ) || CORE::return( $self->pass_error );
6600             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::Invoice', $hash ) );
6601             }
6602             PERL
6603             # NOTE: invoice_settings()
6604             invoice_settings => <<'PERL',
6605             sub invoice_settings { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Billing::Invoice::Settings', @_ ) ); }
6606             PERL
6607             # NOTE: invoice_uncollectible()
6608             invoice_uncollectible => <<'PERL',
6609             sub invoice_uncollectible
6610             {
6611             my $self = shift( @_ );
6612             my $args = shift( @_ );
6613             my $okParams =
6614             {
6615             expandable => { allowed => $EXPANDABLES->{ 'invoice' } },
6616             };
6617             $args = $self->_contract( 'invoice', $args ) || CORE::return( $self->pass_error );
6618             my $err = $self->_check_parameters( $okParams, $args );
6619             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
6620             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No invoice id (with parameter 'id') was provided to uncollectible its information." ) );
6621             my $hash = $self->post( "invoices/${id}", $args ) || CORE::return( $self->pass_error );
6622             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::Invoice', $hash ) );
6623             }
6624             PERL
6625             # NOTE: invoice_upcoming()
6626             invoice_upcoming => <<'PERL',
6627             sub invoice_upcoming
6628             {
6629             my $self = shift( @_ );
6630             CORE::return( $self->error( "No parameters were provided to retrieve an upcoming invoice." ) ) if( !scalar( @_ ) );
6631             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Billing::Invoice', @_ );
6632            
6633             my $obj = $args->{_object};
6634             if( ( $obj && $obj->customer ) ||
6635             ( $self->_is_object( $args->{customer} ) && $args->{customer}->isa( 'Net::API::Stripe::Customer' ) ) )
6636             {
6637             my $cust = $obj ? $obj->customer : $args->{customer};
6638             $args->{customer} = $cust->id || CORE::return( $self->error( "No customer id could be found in this customer object." ) );
6639             }
6640            
6641             if( ( $obj && $obj->schedule ) ||
6642             ( $args->{schedule} && $self->_is_object( $args->{schedule} ) && $args->{schedule}->isa( 'Net::API::Stripe::Billing::Subscription::Schedule' ) ) )
6643             {
6644             my $sched = $obj ? $obj->schedule : $args->{schedule};
6645             $args->{schedule} = $sched->id || CORE::return( $self->error( "No subscription schedule id could be found in this subscription schedule object." ) );
6646             }
6647            
6648             if( ( $obj && $obj->subscription ) ||
6649             ( $args->{subscription} && $self->_is_object( $args->{subscription} ) && $args->{subscription}->isa( 'Net::API::Stripe::Billing::Subscription' ) ) )
6650             {
6651             my $sub = $obj ? $obj->subscription : $args->{subscription};
6652             $args->{subscription} = $sub->id || CORE::return( $self->error( "No subscription id could be found in this subscription object." ) );
6653             }
6654            
6655             my $okParams =
6656             {
6657             expandable => { allowed => $EXPANDABLES->{invoice}, data_prefix_is_ok => 1 },
6658             automatic_tax => { type => "boolean" },
6659             coupon => { type => "string" },
6660             currency => { type => "currency" },
6661             customer => { re => qr/^\w+$/, type => "string" },
6662             customer_details => {
6663             fields => [
6664             "address",
6665             "address.city",
6666             "address.country",
6667             "address.line1",
6668             "address.line2",
6669             "address.postal_code",
6670             "address.state",
6671             "shipping",
6672             "shipping.address",
6673             "shipping.address.city",
6674             "shipping.address.country",
6675             "shipping.address.line1",
6676             "shipping.address.line2",
6677             "shipping.address.postal_code",
6678             "shipping.address.state",
6679             "shipping.name",
6680             "shipping.phone",
6681             "tax",
6682             "tax.ip_address",
6683             "tax_exempt",
6684             "tax_ids",
6685             "tax_ids.type",
6686             "tax_ids.value",
6687             ],
6688             type => "hash",
6689             },
6690             discounts => { fields => ["coupon", "discount"], type => "array" },
6691             invoice_items => {
6692             fields => [
6693             "amount",
6694             "currency",
6695             "description",
6696             "discountable",
6697             "discounts",
6698             "discounts.coupon",
6699             "discounts.discount",
6700             "invoiceitem",
6701             "metadata",
6702             "period.end!",
6703             "period.start!",
6704             "quantity",
6705             "tax_rates",
6706             "unit_amount",
6707             "unit_amount_decimal",
6708             ],
6709             type => "array",
6710             },
6711             schedule => { re => qr/^\w+$/, type => "string" },
6712             subscription => { re => qr/^\w+$/, type => "string" },
6713             subscription_billing_cycle_anchor => { type => "string" },
6714             subscription_cancel_at => { type => "string" },
6715             subscription_cancel_at_period_end => { type => "string" },
6716             subscription_cancel_now => { type => "string" },
6717             subscription_default_tax_rates => { type => "array" },
6718             subscription_items => { type => "string" },
6719             subscription_prorate => {
6720             re => qr/^(subscription_items|subscription|subscription_items|subscription_trial_end)$/,
6721             },
6722             subscription_proration_behavior => {
6723             re => qr/^(create_prorations|none|always_invoice)$/,
6724             type => "string",
6725             },
6726             subscription_proration_date => { type => "integer" },
6727             subscription_start_date => { type => "string" },
6728             subscription_tax_percent => { re => qr/^\d+(\.\d+)?$/ },
6729             subscription_trial_end => { type => "string" },
6730             subscription_trial_from_plan => { type => "string" },
6731             };
6732              
6733             $args = $self->_contract( 'invoice', $args ) || CORE::return( $self->pass_error );
6734             my $err = $self->_check_parameters( $okParams, $args );
6735             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
6736             my $hash = $self->post( 'invoices/upcoming', $args ) || CORE::return( $self->pass_error );
6737             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::Invoice', $hash ) );
6738             }
6739             PERL
6740             # NOTE: invoice_update()
6741             invoice_update => <<'PERL',
6742             sub invoice_update
6743             {
6744             my $self = shift( @_ );
6745             CORE::return( $self->error( "No parameters were provided to update an invoice" ) ) if( !scalar( @_ ) );
6746             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Billing::Invoice', @_ );
6747            
6748             my $okParams =
6749             {
6750             expandable => { allowed => $EXPANDABLES->{invoice} },
6751             account_tax_ids => { type => "array" },
6752             application_fee_amount => { re => qr/^\d+$/, type => "integer" },
6753             auto_advance => { type => "boolean" },
6754             automatic_tax => { fields => ["enabled"], type => "hash" },
6755             collection_method => { re => qr/^(charge_automatically|send_invoice)$/, type => "string" },
6756             custom_fields => { fields => ["name", "value"], type => "array" },
6757             days_until_due => { re => qr/^\d+$/, type => "integer" },
6758             default_payment_method => { re => qr/^\w+$/, type => "string" },
6759             default_source => { re => qr/^\w+$/, type => "string" },
6760             default_tax_rates => { re => qr/^\d+(?:\.\d+)?$/, type => "array" },
6761             description => { type => "string" },
6762             discounts => { fields => ["coupon", "discount"], type => "array" },
6763             due_date => { type => "timestamp" },
6764             footer => { type => "string" },
6765             id => { re => qr/^\w+$/, required => 1 },
6766             metadata => { type => "hash" },
6767             on_behalf_of => { re => qr/^\w+$/, type => "string" },
6768             payment_settings => {
6769             fields => [
6770             "payment_method_options.acss_debit",
6771             "payment_method_options.acss_debit.mandate_options",
6772             "payment_method_options.acss_debit.mandate_options.transaction_type",
6773             "payment_method_options.acss_debit.verification_method",
6774             "payment_method_options.bancontact",
6775             "payment_method_options.bancontact.preferred_language",
6776             "payment_method_options.card",
6777             "payment_method_options.card.request_three_d_secure",
6778             "payment_method_options.customer_balance",
6779             "payment_method_options.customer_balance.bank_transfer",
6780             "payment_method_options.customer_balance.bank_transfer.eu_bank_transfer",
6781             "payment_method_options.customer_balance.bank_transfer.eu_bank_transfer.country",
6782             "payment_method_options.customer_balance.bank_transfer.type",
6783             "payment_method_options.customer_balance.funding_type",
6784             "payment_method_options.konbini",
6785             "payment_method_options.us_bank_account",
6786             "payment_method_options.us_bank_account.financial_connections",
6787             "payment_method_options.us_bank_account.financial_connections.permissions",
6788             "payment_method_options.us_bank_account.verification_method",
6789             "payment_method_types",
6790             ],
6791             type => "hash",
6792             },
6793             rendering_options => { fields => ["amount_tax_display"], type => "hash" },
6794             statement_descriptor => { type => "string" },
6795             transfer_data => { fields => ["destination", "amount"], type => "hash" },
6796             };
6797              
6798             $args = $self->_contract( 'invoice', $args ) || CORE::return( $self->pass_error );
6799             # We found some errors
6800             my $err = $self->_check_parameters( $okParams, $args );
6801             # $self->message( 3, "Data to be posted: ", $self->dumper( $args ) ); exit;
6802             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
6803             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No invoice id was provided to update invoice's details" ) );
6804             my $hash = $self->post( "invoices/${id}", $args ) || CORE::return( $self->pass_error );
6805             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::Invoice', $hash ) );
6806             }
6807             PERL
6808             # NOTE: invoice_void()
6809             invoice_void => <<'PERL',
6810             sub invoice_void
6811             {
6812             my $self = shift( @_ );
6813             CORE::return( $self->error( "No parameters were provided to void invoice information." ) ) if( !scalar( @_ ) );
6814             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Billing::Invoice', @_ );
6815             my $okParams =
6816             {
6817             expandable => { allowed => $EXPANDABLES->{invoice} },
6818             id => { re => qr/^\w+$/, required => 1 }
6819             };
6820             my $err = $self->_check_parameters( $okParams, $args );
6821             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
6822             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No invoice id was provided to void it." ) );
6823             my $hash = $self->post( "invoices/${id}/void", $args ) || CORE::return( $self->pass_error );
6824             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::Invoice', $hash ) );
6825             }
6826             PERL
6827             # NOTE: invoice_write_off()
6828             invoice_write_off => <<'PERL',
6829             # NOTE: Mark an invoice as uncollectible
6830             sub invoice_write_off
6831             {
6832             my $self = shift( @_ );
6833             CORE::return( $self->error( "No parameters were provided to make invoice uncollectible." ) ) if( !scalar( @_ ) );
6834             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Billing::Invoice', @_ );
6835             my $okParams =
6836             {
6837             expandable => { allowed => $EXPANDABLES->{invoice} },
6838             id => { re => qr/^\w+$/, required => 1 }
6839             };
6840             my $err = $self->_check_parameters( $okParams, $args );
6841             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
6842             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No invoice id was provided to make it uncollectible." ) );
6843             my $hash = $self->post( "invoices/${id}/mark_uncollectible", $args ) || CORE::return( $self->pass_error );
6844             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::Invoice', $hash ) );
6845             }
6846             PERL
6847             # NOTE: invoiceitem()
6848             invoiceitem => <<'PERL',
6849             sub invoiceitem { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Billing::Invoice::Item', @_ ) ); }
6850             PERL
6851             # NOTE: invoiceitem_create()
6852             invoiceitem_create => <<'PERL',
6853             sub invoiceitem_create
6854             {
6855             my $self = shift( @_ );
6856             my $args = shift( @_ );
6857             my $okParams =
6858             {
6859             expandable => { allowed => $EXPANDABLES->{ 'invoiceitem' } },
6860             amount => { type => "integer" },
6861             currency => { type => "string" },
6862             customer => { type => "string", required => 1 },
6863             description => { type => "string" },
6864             discountable => { type => "boolean" },
6865             discounts => { type => "array" },
6866             invoice => { type => "string" },
6867             metadata => { type => "hash" },
6868             period => { type => "hash" },
6869             price => { type => "hash" },
6870             price_data => { type => "object" },
6871             quantity => { type => "integer" },
6872             subscription => { type => "string" },
6873             tax_rates => { type => "array" },
6874             unit_amount => { type => "integer" },
6875             unit_amount_decimal => { type => "decimal" },
6876             };
6877             $args = $self->_contract( 'invoiceitem', $args ) || CORE::return( $self->pass_error );
6878             my $err = $self->_check_parameters( $okParams, $args );
6879             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
6880             my $hash = $self->post( "invoiceitems", $args ) || CORE::return( $self->pass_error );
6881             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::Invoice::Item', $hash ) );
6882             }
6883             PERL
6884             # NOTE: invoiceitem_delete()
6885             invoiceitem_delete => <<'PERL',
6886             sub invoiceitem_delete
6887             {
6888             my $self = shift( @_ );
6889             my $args = shift( @_ );
6890             my $okParams =
6891             {
6892             expandable => { allowed => $EXPANDABLES->{ 'invoiceitem' } },
6893             };
6894             $args = $self->_contract( 'invoiceitem', $args ) || CORE::return( $self->pass_error );
6895             my $err = $self->_check_parameters( $okParams, $args );
6896             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
6897             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No invoiceitem id (with parameter 'id') was provided to delete its information." ) );
6898             my $hash = $self->delete( "invoiceitems/${id}", $args ) || CORE::return( $self->pass_error );
6899             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::Invoice::Item', $hash ) );
6900             }
6901             PERL
6902             # NOTE: invoiceitem_list()
6903             invoiceitem_list => <<'PERL',
6904             sub invoiceitem_list
6905             {
6906             my $self = shift( @_ );
6907             CORE::return( $self->error( "No parameters were provided to list invoiceitem information." ) ) if( !scalar( @_ ) );
6908             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Billing::Invoice::Item', @_ );
6909             my $okParams =
6910             {
6911             expandable => { allowed => $EXPANDABLES->{ 'invoiceitem' }, data_prefix_is_ok => 1 },
6912             created => { type => "hash" },
6913             customer => { type => "string" },
6914             ending_before => { type => "string" },
6915             invoice => { type => "string" },
6916             limit => { type => "string" },
6917             pending => { type => "string" },
6918             starting_after => { type => "string" },
6919             };
6920             my $err = $self->_check_parameters( $okParams, $args );
6921             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
6922             if( $args->{expand} )
6923             {
6924             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
6925             }
6926             my $hash = $self->get( "invoiceitems", $args ) || CORE::return( $self->pass_error );
6927             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::Invoice::Item', $hash ) );
6928             }
6929             PERL
6930             # NOTE: invoiceitem_retrieve()
6931             invoiceitem_retrieve => <<'PERL',
6932             sub invoiceitem_retrieve
6933             {
6934             my $self = shift( @_ );
6935             my $args = shift( @_ );
6936             my $okParams =
6937             {
6938             expandable => { allowed => $EXPANDABLES->{ 'invoiceitem' }, data_prefix_is_ok => 1 },
6939             };
6940             $args = $self->_contract( 'invoiceitem', $args ) || CORE::return( $self->pass_error );
6941             my $err = $self->_check_parameters( $okParams, $args );
6942             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
6943             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No invoiceitem id (with parameter 'id') was provided to retrieve its information." ) );
6944             my $hash = $self->get( "invoiceitems/${id}", $args ) || CORE::return( $self->pass_error );
6945             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::Invoice::Item', $hash ) );
6946             }
6947             PERL
6948             # NOTE: invoiceitem_update()
6949             invoiceitem_update => <<'PERL',
6950             sub invoiceitem_update
6951             {
6952             my $self = shift( @_ );
6953             my $args = shift( @_ );
6954             my $okParams =
6955             {
6956             expandable => { allowed => $EXPANDABLES->{ 'invoiceitem' } },
6957             amount => { type => "integer" },
6958             description => { type => "string" },
6959             discountable => { type => "boolean" },
6960             discounts => { type => "array" },
6961             metadata => { type => "hash" },
6962             period => { type => "hash" },
6963             price => { type => "hash" },
6964             price_data => { type => "object" },
6965             quantity => { type => "integer" },
6966             tax_rates => { type => "array" },
6967             unit_amount => { type => "integer" },
6968             unit_amount_decimal => { type => "decimal" },
6969             };
6970             $args = $self->_contract( 'invoiceitem', $args ) || CORE::return( $self->pass_error );
6971             my $err = $self->_check_parameters( $okParams, $args );
6972             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
6973             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No invoiceitem id (with parameter 'id') was provided to update its information." ) );
6974             my $hash = $self->post( "invoiceitems/${id}", $args ) || CORE::return( $self->pass_error );
6975             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::Invoice::Item', $hash ) );
6976             }
6977             PERL
6978             # NOTE: invoiceitems()
6979             invoiceitems => <<'PERL',
6980             # <https://stripe.com/docs/api/invoiceitems>
6981             sub invoiceitems
6982             {
6983             my $self = shift( @_ );
6984             my $allowed = [qw( create delete list retrieve update )];
6985             my $action = shift( @_ );
6986             my $meth = $self->_get_method( 'invoiceitem', $action, $allowed ) || CORE::return( $self->pass_error );
6987             CORE::return( $self->$meth( @_ ) );
6988             }
6989             PERL
6990             # NOTE: invoices()
6991             invoices => <<'PERL',
6992             # <https://stripe.com/docs/api/invoices>
6993             sub invoices
6994             {
6995             my $self = shift( @_ );
6996             my $allowed = [qw( create delete finalise finalize invoice_write_off lines lines_upcoming list pay retrieve search send uncollectible upcoming update void )];
6997             my $action = shift( @_ );
6998             my $meth = $self->_get_method( 'invoice', $action, $allowed ) || CORE::return( $self->pass_error );
6999             CORE::return( $self->$meth( @_ ) );
7000             }
7001             PERL
7002             # NOTE: ip_address_location()
7003             ip_address_location => <<'PERL',
7004             sub ip_address_location { CORE::return( shift->_response_to_object( 'Net::API::Stripe::GeoLocation', @_ ) ); }
7005             PERL
7006             # NOTE: issuing_authorization()
7007             issuing_authorization => <<'PERL',
7008             sub issuing_authorization { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Issuing::Authorization', @_ ) ); }
7009             PERL
7010             # NOTE: issuing_authorization_approve()
7011             issuing_authorization_approve => <<'PERL',
7012             sub issuing_authorization_approve
7013             {
7014             my $self = shift( @_ );
7015             my $args = shift( @_ );
7016             my $okParams =
7017             {
7018             expandable => { allowed => $EXPANDABLES->{ 'issuing.authorization' } },
7019             amount => { type => "integer" },
7020             metadata => { type => "hash" },
7021             };
7022             $args = $self->_contract( 'issuing.authorization', $args ) || CORE::return( $self->pass_error );
7023             my $err = $self->_check_parameters( $okParams, $args );
7024             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
7025             my $hash = $self->post( "", $args ) || CORE::return( $self->pass_error );
7026             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Issuing::Authorization', $hash ) );
7027             }
7028             PERL
7029             # NOTE: issuing_authorization_decline()
7030             issuing_authorization_decline => <<'PERL',
7031             sub issuing_authorization_decline
7032             {
7033             my $self = shift( @_ );
7034             my $args = shift( @_ );
7035             my $okParams =
7036             {
7037             expandable => { allowed => $EXPANDABLES->{ 'issuing.authorization' } },
7038             metadata => { type => "hash" },
7039             };
7040             $args = $self->_contract( 'issuing.authorization', $args ) || CORE::return( $self->pass_error );
7041             my $err = $self->_check_parameters( $okParams, $args );
7042             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
7043             my $hash = $self->post( "", $args ) || CORE::return( $self->pass_error );
7044             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Issuing::Authorization', $hash ) );
7045             }
7046             PERL
7047             # NOTE: issuing_authorization_list()
7048             issuing_authorization_list => <<'PERL',
7049             sub issuing_authorization_list
7050             {
7051             my $self = shift( @_ );
7052             CORE::return( $self->error( "No parameters were provided to list issuing authorization information." ) ) if( !scalar( @_ ) );
7053             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Issuing::Authorization', @_ );
7054             my $okParams =
7055             {
7056             expandable => { allowed => $EXPANDABLES->{ 'issuing.authorization' }, data_prefix_is_ok => 1 },
7057             card => { type => "hash" },
7058             cardholder => { type => "string" },
7059             created => { type => "timestamp" },
7060             ending_before => { type => "string" },
7061             limit => { type => "string" },
7062             starting_after => { type => "string" },
7063             status => { type => "string" },
7064             };
7065             my $err = $self->_check_parameters( $okParams, $args );
7066             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
7067             if( $args->{expand} )
7068             {
7069             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
7070             }
7071             my $hash = $self->get( "", $args ) || CORE::return( $self->pass_error );
7072             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Issuing::Authorization', $hash ) );
7073             }
7074             PERL
7075             # NOTE: issuing_authorization_retrieve()
7076             issuing_authorization_retrieve => <<'PERL',
7077             sub issuing_authorization_retrieve
7078             {
7079             my $self = shift( @_ );
7080             my $args = shift( @_ );
7081             my $okParams =
7082             {
7083             expandable => { allowed => $EXPANDABLES->{ 'issuing.authorization' }, data_prefix_is_ok => 1 },
7084             };
7085             $args = $self->_contract( 'issuing.authorization', $args ) || CORE::return( $self->pass_error );
7086             my $err = $self->_check_parameters( $okParams, $args );
7087             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
7088             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No issuing.authorization id (with parameter 'id') was provided to retrieve its information." ) );
7089             my $hash = $self->get( "issuing/authorizations/${id}", $args ) || CORE::return( $self->pass_error );
7090             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Issuing::Authorization', $hash ) );
7091             }
7092             PERL
7093             # NOTE: issuing_authorization_update()
7094             issuing_authorization_update => <<'PERL',
7095             sub issuing_authorization_update
7096             {
7097             my $self = shift( @_ );
7098             my $args = shift( @_ );
7099             my $okParams =
7100             {
7101             expandable => { allowed => $EXPANDABLES->{ 'issuing.authorization' } },
7102             metadata => { type => "hash" },
7103             };
7104             $args = $self->_contract( 'issuing.authorization', $args ) || CORE::return( $self->pass_error );
7105             my $err = $self->_check_parameters( $okParams, $args );
7106             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
7107             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No issuing.authorization id (with parameter 'id') was provided to update its information." ) );
7108             my $hash = $self->post( "issuing/authorizations/${id}", $args ) || CORE::return( $self->pass_error );
7109             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Issuing::Authorization', $hash ) );
7110             }
7111             PERL
7112             # NOTE: issuing_authorizations()
7113             issuing_authorizations => <<'PERL',
7114             # <https://stripe.com/docs/api/issuing/authorizations>
7115             sub issuing_authorizations
7116             {
7117             my $self = shift( @_ );
7118             my $allowed = [qw( approve decline list retrieve update )];
7119             my $action = shift( @_ );
7120             my $meth = $self->_get_method( 'issuing_authorization', $action, $allowed ) || CORE::return( $self->pass_error );
7121             CORE::return( $self->$meth( @_ ) );
7122             }
7123             PERL
7124             # NOTE: issuing_card()
7125             issuing_card => <<'PERL',
7126             # sub issuing { CORE::return( shift->_instantiate( 'issuing', 'Net::API::Stripe::Issuing' ) ) }
7127             sub issuing_card { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Issuing::Card', @_ ) ); }
7128             PERL
7129             # NOTE: issuing_card_create()
7130             issuing_card_create => <<'PERL',
7131             sub issuing_card_create
7132             {
7133             my $self = shift( @_ );
7134             my $args = shift( @_ );
7135             my $okParams =
7136             {
7137             expandable => { allowed => $EXPANDABLES->{ 'issuing.card' } },
7138             cardholder => { type => "hash" },
7139             currency => { type => "string", required => 1 },
7140             metadata => { type => "hash" },
7141             replacement_for => { type => "string" },
7142             replacement_reason => { type => "string" },
7143             shipping => { type => "hash" },
7144             spending_controls => { type => "hash" },
7145             status => { type => "string" },
7146             type => { type => "string", required => 1 },
7147             };
7148             $args = $self->_contract( 'issuing.card', $args ) || CORE::return( $self->pass_error );
7149             my $err = $self->_check_parameters( $okParams, $args );
7150             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
7151             my $hash = $self->post( "", $args ) || CORE::return( $self->pass_error );
7152             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Issuing::Card', $hash ) );
7153             }
7154             PERL
7155             # NOTE: issuing_card_deliver()
7156             issuing_card_deliver => <<'PERL',
7157             sub issuing_card_deliver
7158             {
7159             my $self = shift( @_ );
7160             my $args = shift( @_ );
7161             my $okParams =
7162             {
7163             expandable => { allowed => $EXPANDABLES->{ 'issuing.card' } },
7164             };
7165             $args = $self->_contract( 'issuing.card', $args ) || CORE::return( $self->pass_error );
7166             my $err = $self->_check_parameters( $okParams, $args );
7167             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
7168             my $card = CORE::delete( $args->{card} ) || CORE::return( $self->error( "No issuing.card id (with parameter 'card') was provided to deliver its information." ) );
7169             my $hash = $self->post( "test_helpers/issuing/cards/${card}/shipping", $args ) || CORE::return( $self->pass_error );
7170             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Issuing::Card', $hash ) );
7171             }
7172             PERL
7173             # NOTE: issuing_card_fail()
7174             issuing_card_fail => <<'PERL',
7175             sub issuing_card_fail
7176             {
7177             my $self = shift( @_ );
7178             my $args = shift( @_ );
7179             my $okParams =
7180             {
7181             expandable => { allowed => $EXPANDABLES->{ 'issuing.card' } },
7182             };
7183             $args = $self->_contract( 'issuing.card', $args ) || CORE::return( $self->pass_error );
7184             my $err = $self->_check_parameters( $okParams, $args );
7185             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
7186             my $card = CORE::delete( $args->{card} ) || CORE::return( $self->error( "No issuing.card id (with parameter 'card') was provided to fail its information." ) );
7187             my $hash = $self->post( "test_helpers/issuing/cards/${card}/shipping", $args ) || CORE::return( $self->pass_error );
7188             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Issuing::Card', $hash ) );
7189             }
7190             PERL
7191             # NOTE: issuing_card_list()
7192             issuing_card_list => <<'PERL',
7193             sub issuing_card_list
7194             {
7195             my $self = shift( @_ );
7196             CORE::return( $self->error( "No parameters were provided to list issuing card information." ) ) if( !scalar( @_ ) );
7197             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Issuing::Card', @_ );
7198             my $okParams =
7199             {
7200             expandable => { allowed => $EXPANDABLES->{ 'issuing.card' }, data_prefix_is_ok => 1 },
7201             cardholder => { type => "hash" },
7202             created => { type => "timestamp" },
7203             ending_before => { type => "string" },
7204             exp_month => { type => "integer" },
7205             exp_year => { type => "integer" },
7206             last4 => { type => "string" },
7207             limit => { type => "string" },
7208             starting_after => { type => "string" },
7209             status => { type => "string" },
7210             type => { type => "string" },
7211             };
7212             my $err = $self->_check_parameters( $okParams, $args );
7213             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
7214             if( $args->{expand} )
7215             {
7216             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
7217             }
7218             my $hash = $self->get( "", $args ) || CORE::return( $self->pass_error );
7219             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Issuing::Card', $hash ) );
7220             }
7221             PERL
7222             # NOTE: issuing_card_retrieve()
7223             issuing_card_retrieve => <<'PERL',
7224             sub issuing_card_retrieve
7225             {
7226             my $self = shift( @_ );
7227             my $args = shift( @_ );
7228             my $okParams =
7229             {
7230             expandable => { allowed => $EXPANDABLES->{ 'issuing.card' }, data_prefix_is_ok => 1 },
7231             };
7232             $args = $self->_contract( 'issuing.card', $args ) || CORE::return( $self->pass_error );
7233             my $err = $self->_check_parameters( $okParams, $args );
7234             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
7235             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No issuing.card id (with parameter 'id') was provided to retrieve its information." ) );
7236             my $hash = $self->get( "issuing/cards/${id}", $args ) || CORE::return( $self->pass_error );
7237             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Issuing::Card', $hash ) );
7238             }
7239             PERL
7240             # NOTE: issuing_card_return()
7241             issuing_card_return => <<'PERL',
7242             sub issuing_card_return
7243             {
7244             my $self = shift( @_ );
7245             my $args = shift( @_ );
7246             my $okParams =
7247             {
7248             expandable => { allowed => $EXPANDABLES->{ 'issuing.card' } },
7249             };
7250             $args = $self->_contract( 'issuing.card', $args ) || CORE::return( $self->pass_error );
7251             my $err = $self->_check_parameters( $okParams, $args );
7252             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
7253             my $card = CORE::delete( $args->{card} ) || CORE::return( $self->error( "No issuing.card id (with parameter 'card') was provided to return its information." ) );
7254             my $hash = $self->post( "test_helpers/issuing/cards/${card}/shipping", $args ) || CORE::return( $self->pass_error );
7255             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Issuing::Card', $hash ) );
7256             }
7257             PERL
7258             # NOTE: issuing_card_ship()
7259             issuing_card_ship => <<'PERL',
7260             sub issuing_card_ship
7261             {
7262             my $self = shift( @_ );
7263             my $args = shift( @_ );
7264             my $okParams =
7265             {
7266             expandable => { allowed => $EXPANDABLES->{ 'issuing.card' } },
7267             };
7268             $args = $self->_contract( 'issuing.card', $args ) || CORE::return( $self->pass_error );
7269             my $err = $self->_check_parameters( $okParams, $args );
7270             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
7271             my $card = CORE::delete( $args->{card} ) || CORE::return( $self->error( "No issuing.card id (with parameter 'card') was provided to ship its information." ) );
7272             my $hash = $self->post( "test_helpers/issuing/cards/${card}/shipping", $args ) || CORE::return( $self->pass_error );
7273             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Issuing::Card', $hash ) );
7274             }
7275             PERL
7276             # NOTE: issuing_card_update()
7277             issuing_card_update => <<'PERL',
7278             sub issuing_card_update
7279             {
7280             my $self = shift( @_ );
7281             my $args = shift( @_ );
7282             my $okParams =
7283             {
7284             expandable => { allowed => $EXPANDABLES->{ 'issuing.card' } },
7285             cancellation_reason => { type => "string" },
7286             metadata => { type => "hash" },
7287             pin => { type => "object" },
7288             spending_controls => { type => "hash" },
7289             status => { type => "string" },
7290             };
7291             $args = $self->_contract( 'issuing.card', $args ) || CORE::return( $self->pass_error );
7292             my $err = $self->_check_parameters( $okParams, $args );
7293             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
7294             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No issuing.card id (with parameter 'id') was provided to update its information." ) );
7295             my $hash = $self->post( "issuing/cards/${id}", $args ) || CORE::return( $self->pass_error );
7296             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Issuing::Card', $hash ) );
7297             }
7298             PERL
7299             # NOTE: issuing_cardholder()
7300             issuing_cardholder => <<'PERL',
7301             sub issuing_cardholder { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Issuing::Card::Holder', @_ ) ); }
7302             PERL
7303             # NOTE: issuing_cardholder_create()
7304             issuing_cardholder_create => <<'PERL',
7305             sub issuing_cardholder_create
7306             {
7307             my $self = shift( @_ );
7308             my $args = shift( @_ );
7309             my $okParams =
7310             {
7311             expandable => { allowed => $EXPANDABLES->{ 'issuing.cardholder' } },
7312             billing => { type => "hash", required => 1 },
7313             company => { type => "hash" },
7314             email => { type => "string" },
7315             individual => { type => "hash" },
7316             metadata => { type => "hash" },
7317             name => { type => "string", required => 1 },
7318             phone_number => { type => "string" },
7319             spending_controls => { type => "hash" },
7320             status => { type => "string" },
7321             type => { type => "string", required => 1 },
7322             };
7323             $args = $self->_contract( 'issuing.cardholder', $args ) || CORE::return( $self->pass_error );
7324             my $err = $self->_check_parameters( $okParams, $args );
7325             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
7326             my $hash = $self->post( "", $args ) || CORE::return( $self->pass_error );
7327             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Issuing::Card::Holder', $hash ) );
7328             }
7329             PERL
7330             # NOTE: issuing_cardholder_list()
7331             issuing_cardholder_list => <<'PERL',
7332             sub issuing_cardholder_list
7333             {
7334             my $self = shift( @_ );
7335             CORE::return( $self->error( "No parameters were provided to list issuing cardholder information." ) ) if( !scalar( @_ ) );
7336             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Issuing::Card::Holder', @_ );
7337             my $okParams =
7338             {
7339             expandable => { allowed => $EXPANDABLES->{ 'issuing.cardholder' }, data_prefix_is_ok => 1 },
7340             created => { type => "timestamp" },
7341             email => { type => "string" },
7342             ending_before => { type => "string" },
7343             limit => { type => "string" },
7344             phone_number => { type => "string" },
7345             starting_after => { type => "string" },
7346             status => { type => "string" },
7347             type => { type => "string" },
7348             };
7349             my $err = $self->_check_parameters( $okParams, $args );
7350             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
7351             if( $args->{expand} )
7352             {
7353             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
7354             }
7355             my $hash = $self->get( "", $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_retrieve()
7360             issuing_cardholder_retrieve => <<'PERL',
7361             sub issuing_cardholder_retrieve
7362             {
7363             my $self = shift( @_ );
7364             my $args = shift( @_ );
7365             my $okParams =
7366             {
7367             expandable => { allowed => $EXPANDABLES->{ 'issuing.cardholder' }, data_prefix_is_ok => 1 },
7368             };
7369             $args = $self->_contract( 'issuing.cardholder', $args ) || CORE::return( $self->pass_error );
7370             my $err = $self->_check_parameters( $okParams, $args );
7371             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
7372             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No issuing.cardholder id (with parameter 'id') was provided to retrieve its information." ) );
7373             my $hash = $self->get( "issuing/cardholders/${id}", $args ) || CORE::return( $self->pass_error );
7374             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Issuing::Card::Holder', $hash ) );
7375             }
7376             PERL
7377             # NOTE: issuing_cardholder_update()
7378             issuing_cardholder_update => <<'PERL',
7379             sub issuing_cardholder_update
7380             {
7381             my $self = shift( @_ );
7382             my $args = shift( @_ );
7383             my $okParams =
7384             {
7385             expandable => { allowed => $EXPANDABLES->{ 'issuing.cardholder' } },
7386             billing => { type => "hash" },
7387             company => { type => "hash" },
7388             email => { type => "string" },
7389             individual => { type => "hash" },
7390             metadata => { type => "hash" },
7391             phone_number => { type => "string" },
7392             spending_controls => { type => "hash" },
7393             status => { type => "string" },
7394             };
7395             $args = $self->_contract( 'issuing.cardholder', $args ) || CORE::return( $self->pass_error );
7396             my $err = $self->_check_parameters( $okParams, $args );
7397             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
7398             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No issuing.cardholder id (with parameter 'id') was provided to update its information." ) );
7399             my $hash = $self->post( "issuing/cardholders/${id}", $args ) || CORE::return( $self->pass_error );
7400             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Issuing::Card::Holder', $hash ) );
7401             }
7402             PERL
7403             # NOTE: issuing_cardholders()
7404             issuing_cardholders => <<'PERL',
7405             # <https://stripe.com/docs/api/issuing/cardholders>
7406             sub issuing_cardholders
7407             {
7408             my $self = shift( @_ );
7409             my $allowed = [qw( create list retrieve update )];
7410             my $action = shift( @_ );
7411             my $meth = $self->_get_method( 'issuing_cardholder', $action, $allowed ) || CORE::return( $self->pass_error );
7412             CORE::return( $self->$meth( @_ ) );
7413             }
7414             PERL
7415             # NOTE: issuing_cards()
7416             issuing_cards => <<'PERL',
7417             # <https://stripe.com/docs/api/issuing/cards>
7418             sub issuing_cards
7419             {
7420             my $self = shift( @_ );
7421             my $allowed = [qw( create deliver fail list retrieve return ship update )];
7422             my $action = shift( @_ );
7423             my $meth = $self->_get_method( 'issuing_card', $action, $allowed ) || CORE::return( $self->pass_error );
7424             CORE::return( $self->$meth( @_ ) );
7425             }
7426             PERL
7427             # NOTE: issuing_dispute()
7428             issuing_dispute => <<'PERL',
7429             sub issuing_dispute { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Issuing::Dispute', @_ ) ); }
7430             PERL
7431             # NOTE: issuing_dispute_create()
7432             issuing_dispute_create => <<'PERL',
7433             sub issuing_dispute_create
7434             {
7435             my $self = shift( @_ );
7436             my $args = shift( @_ );
7437             my $okParams =
7438             {
7439             expandable => { allowed => $EXPANDABLES->{ 'issuing.dispute' } },
7440             evidence => { type => "hash" },
7441             metadata => { type => "hash" },
7442             transaction => { type => "string" },
7443             };
7444             $args = $self->_contract( 'issuing.dispute', $args ) || CORE::return( $self->pass_error );
7445             my $err = $self->_check_parameters( $okParams, $args );
7446             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
7447             my $hash = $self->post( "", $args ) || CORE::return( $self->pass_error );
7448             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Issuing::Dispute', $hash ) );
7449             }
7450             PERL
7451             # NOTE: issuing_dispute_list()
7452             issuing_dispute_list => <<'PERL',
7453             sub issuing_dispute_list
7454             {
7455             my $self = shift( @_ );
7456             CORE::return( $self->error( "No parameters were provided to list issuing dispute information." ) ) if( !scalar( @_ ) );
7457             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Issuing::Dispute', @_ );
7458             my $okParams =
7459             {
7460             expandable => { allowed => $EXPANDABLES->{ 'issuing.dispute' }, data_prefix_is_ok => 1 },
7461             created => { type => "timestamp" },
7462             ending_before => { type => "string" },
7463             limit => { type => "string" },
7464             starting_after => { type => "string" },
7465             status => { type => "string" },
7466             transaction => { type => "string" },
7467             };
7468             my $err = $self->_check_parameters( $okParams, $args );
7469             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
7470             if( $args->{expand} )
7471             {
7472             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
7473             }
7474             my $hash = $self->get( "", $args ) || CORE::return( $self->pass_error );
7475             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Issuing::Dispute', $hash ) );
7476             }
7477             PERL
7478             # NOTE: issuing_dispute_retrieve()
7479             issuing_dispute_retrieve => <<'PERL',
7480             sub issuing_dispute_retrieve
7481             {
7482             my $self = shift( @_ );
7483             my $args = shift( @_ );
7484             my $okParams =
7485             {
7486             expandable => { allowed => $EXPANDABLES->{ 'issuing.dispute' }, data_prefix_is_ok => 1 },
7487             };
7488             $args = $self->_contract( 'issuing.dispute', $args ) || CORE::return( $self->pass_error );
7489             my $err = $self->_check_parameters( $okParams, $args );
7490             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
7491             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No issuing.dispute id (with parameter 'id') was provided to retrieve its information." ) );
7492             my $hash = $self->get( "issuing/disputes/${id}", $args ) || CORE::return( $self->pass_error );
7493             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Issuing::Dispute', $hash ) );
7494             }
7495             PERL
7496             # NOTE: issuing_dispute_submit()
7497             issuing_dispute_submit => <<'PERL',
7498             sub issuing_dispute_submit
7499             {
7500             my $self = shift( @_ );
7501             my $args = shift( @_ );
7502             my $okParams =
7503             {
7504             expandable => { allowed => $EXPANDABLES->{ 'issuing.dispute' } },
7505             metadata => { type => "hash" },
7506             };
7507             $args = $self->_contract( 'issuing.dispute', $args ) || CORE::return( $self->pass_error );
7508             my $err = $self->_check_parameters( $okParams, $args );
7509             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
7510             my $hash = $self->post( "", $args ) || CORE::return( $self->pass_error );
7511             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Issuing::Dispute', $hash ) );
7512             }
7513             PERL
7514             # NOTE: issuing_dispute_update()
7515             issuing_dispute_update => <<'PERL',
7516             sub issuing_dispute_update
7517             {
7518             my $self = shift( @_ );
7519             my $args = shift( @_ );
7520             my $okParams =
7521             {
7522             expandable => { allowed => $EXPANDABLES->{ 'issuing.dispute' } },
7523             evidence => { type => "hash" },
7524             metadata => { type => "hash" },
7525             };
7526             $args = $self->_contract( 'issuing.dispute', $args ) || CORE::return( $self->pass_error );
7527             my $err = $self->_check_parameters( $okParams, $args );
7528             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
7529             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No issuing.dispute id (with parameter 'id') was provided to update its information." ) );
7530             my $hash = $self->post( "issuing/disputes/${id}", $args ) || CORE::return( $self->pass_error );
7531             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Issuing::Dispute', $hash ) );
7532             }
7533             PERL
7534             # NOTE: issuing_disputes()
7535             issuing_disputes => <<'PERL',
7536             # <https://stripe.com/docs/api/issuing/disputes>
7537             sub issuing_disputes
7538             {
7539             my $self = shift( @_ );
7540             my $allowed = [qw( create list retrieve submit update )];
7541             my $action = shift( @_ );
7542             my $meth = $self->_get_method( 'issuing_dispute', $action, $allowed ) || CORE::return( $self->pass_error );
7543             CORE::return( $self->$meth( @_ ) );
7544             }
7545             PERL
7546             # NOTE: issuing_transaction()
7547             issuing_transaction => <<'PERL',
7548             sub issuing_transaction { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Issuing::Transaction', @_ ) ); }
7549             PERL
7550             # NOTE: issuing_transaction_list()
7551             issuing_transaction_list => <<'PERL',
7552             sub issuing_transaction_list
7553             {
7554             my $self = shift( @_ );
7555             CORE::return( $self->error( "No parameters were provided to list issuing transaction information." ) ) if( !scalar( @_ ) );
7556             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Issuing::Transaction', @_ );
7557             my $okParams =
7558             {
7559             expandable => { allowed => $EXPANDABLES->{ 'issuing.transaction' }, data_prefix_is_ok => 1 },
7560             card => { type => "string" },
7561             cardholder => { type => "string" },
7562             created => { type => "timestamp" },
7563             ending_before => { type => "string" },
7564             limit => { type => "string" },
7565             starting_after => { type => "string" },
7566             type => { type => "string" },
7567             };
7568             my $err = $self->_check_parameters( $okParams, $args );
7569             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
7570             if( $args->{expand} )
7571             {
7572             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
7573             }
7574             my $hash = $self->get( "", $args ) || CORE::return( $self->pass_error );
7575             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Issuing::Transaction', $hash ) );
7576             }
7577             PERL
7578             # NOTE: issuing_transaction_retrieve()
7579             issuing_transaction_retrieve => <<'PERL',
7580             sub issuing_transaction_retrieve
7581             {
7582             my $self = shift( @_ );
7583             my $args = shift( @_ );
7584             my $okParams =
7585             {
7586             expandable => { allowed => $EXPANDABLES->{ 'issuing.transaction' }, data_prefix_is_ok => 1 },
7587             };
7588             $args = $self->_contract( 'issuing.transaction', $args ) || CORE::return( $self->pass_error );
7589             my $err = $self->_check_parameters( $okParams, $args );
7590             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
7591             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No issuing.transaction id (with parameter 'id') was provided to retrieve its information." ) );
7592             my $hash = $self->get( "issuing/transactions/${id}", $args ) || CORE::return( $self->pass_error );
7593             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Issuing::Transaction', $hash ) );
7594             }
7595             PERL
7596             # NOTE: issuing_transaction_update()
7597             issuing_transaction_update => <<'PERL',
7598             sub issuing_transaction_update
7599             {
7600             my $self = shift( @_ );
7601             my $args = shift( @_ );
7602             my $okParams =
7603             {
7604             expandable => { allowed => $EXPANDABLES->{ 'issuing.transaction' } },
7605             metadata => { type => "hash" },
7606             };
7607             $args = $self->_contract( 'issuing.transaction', $args ) || CORE::return( $self->pass_error );
7608             my $err = $self->_check_parameters( $okParams, $args );
7609             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
7610             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No issuing.transaction id (with parameter 'id') was provided to update its information." ) );
7611             my $hash = $self->post( "issuing/transactions/${id}", $args ) || CORE::return( $self->pass_error );
7612             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Issuing::Transaction', $hash ) );
7613             }
7614             PERL
7615             # NOTE: issuing_transactions()
7616             issuing_transactions => <<'PERL',
7617             # <https://stripe.com/docs/api/issuing/transactions>
7618             sub issuing_transactions
7619             {
7620             my $self = shift( @_ );
7621             my $allowed = [qw( list retrieve update )];
7622             my $action = shift( @_ );
7623             my $meth = $self->_get_method( 'issuing_transaction', $action, $allowed ) || CORE::return( $self->pass_error );
7624             CORE::return( $self->$meth( @_ ) );
7625             }
7626             PERL
7627             # NOTE: item()
7628             item => <<'PERL',
7629             sub item { CORE::return( shift->_response_to_object( 'Net::API::Stripe::List::Item', @_ ) ); }
7630             PERL
7631             # NOTE: line_item()
7632             line_item => <<'PERL',
7633             sub line_item { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Billing::Invoice::LineItem', @_ ) ); }
7634             PERL
7635             # NOTE: line_item_lines()
7636             line_item_lines => <<'PERL',
7637             sub line_item_lines
7638             {
7639             my $self = shift( @_ );
7640             CORE::return( $self->error( "No parameters were provided to lines line item information." ) ) if( !scalar( @_ ) );
7641             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Billing::Invoice::LineItem', @_ );
7642             my $okParams =
7643             {
7644             expandable => { allowed => $EXPANDABLES->{ 'line_item' }, data_prefix_is_ok => 1 },
7645             automatic_tax => { type => "hash" },
7646             coupon => { type => "string" },
7647             currency => { type => "string" },
7648             customer => { type => "string" },
7649             customer_details => { type => "hash" },
7650             discounts => { type => "array" },
7651             ending_before => { type => "string" },
7652             invoice_items => { type => "string" },
7653             limit => { type => "string" },
7654             schedule => { type => "string" },
7655             starting_after => { type => "string" },
7656             subscription => { type => "string" },
7657             subscription_billing_cycle_anchor => { type => "string" },
7658             subscription_cancel_at => { type => "string" },
7659             subscription_cancel_at_period_end => { type => "string" },
7660             subscription_cancel_now => { type => "string" },
7661             subscription_default_tax_rates => { type => "string" },
7662             subscription_items => { type => "string" },
7663             subscription_proration_behavior => { type => "string" },
7664             subscription_proration_date => { type => "string" },
7665             subscription_start_date => { type => "string" },
7666             subscription_trial_end => { type => "string" },
7667             subscription_trial_from_plan => { type => "string" },
7668             };
7669             my $err = $self->_check_parameters( $okParams, $args );
7670             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
7671             my $hash = $self->get( "invoices/upcoming", $args ) || CORE::return( $self->pass_error );
7672             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::Invoice::LineItem', $hash ) );
7673             }
7674             PERL
7675             # NOTE: line_items()
7676             line_items => <<'PERL',
7677             # <https://stripe.com/docs/api/invoices>
7678             sub line_items
7679             {
7680             my $self = shift( @_ );
7681             my $allowed = [qw( lines )];
7682             my $action = shift( @_ );
7683             my $meth = $self->_get_method( 'line_item', $action, $allowed ) || CORE::return( $self->pass_error );
7684             CORE::return( $self->$meth( @_ ) );
7685             }
7686             PERL
7687             # NOTE: location()
7688             location => <<'PERL',
7689             sub location { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Terminal::Location', @_ ) ); }
7690             PERL
7691             # NOTE: login_link()
7692             login_link => <<'PERL',
7693             sub login_link { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Connect::Account::LoginLink', @_ ) ); }
7694             PERL
7695             # NOTE: login_link_create()
7696             login_link_create => <<'PERL',
7697             sub login_link_create
7698             {
7699             my $self = shift( @_ );
7700             my $args = shift( @_ );
7701             my $okParams =
7702             {
7703             expandable => { allowed => $EXPANDABLES->{ 'login_link' } },
7704             };
7705             $args = $self->_contract( 'login_link', $args ) || CORE::return( $self->pass_error );
7706             my $err = $self->_check_parameters( $okParams, $args );
7707             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
7708             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No account id (with parameter 'id') was provided to create its information." ) );
7709             my $hash = $self->post( "accounts/${id}/login_links", $args ) || CORE::return( $self->pass_error );
7710             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Connect::Account::LoginLink', $hash ) );
7711             }
7712             PERL
7713             # NOTE: login_links()
7714             login_links => <<'PERL',
7715             # <https://stripe.com/docs/api/accounts>
7716             sub login_links
7717             {
7718             my $self = shift( @_ );
7719             my $allowed = [qw( create )];
7720             my $action = shift( @_ );
7721             my $meth = $self->_get_method( 'login_link', $action, $allowed ) || CORE::return( $self->pass_error );
7722             CORE::return( $self->$meth( @_ ) );
7723             }
7724             PERL
7725             # NOTE: mandate()
7726             mandate => <<'PERL',
7727             sub mandate { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Mandate' ) ) }
7728             PERL
7729             # NOTE: mandate_retrieve()
7730             mandate_retrieve => <<'PERL',
7731             sub mandate_retrieve
7732             {
7733             my $self = shift( @_ );
7734             CORE::return( $self->error( "No parameters were provided to retrieve a mandate" ) ) if( !scalar( @_ ) );
7735             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Mandate', @_ );
7736             my $okParams =
7737             {
7738             expandable => { allowed => $EXPANDABLES->{mandate} },
7739             id => { re => qr/^\w+$/, required => 1 },
7740             };
7741             my $err = $self->_check_parameters( $okParams, $args );
7742             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
7743             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No mandate id was provided to retrieve its information." ) );
7744             my $hash = $self->get( "mandates/${id}", $args ) || CORE::return( $self->pass_error );
7745             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Mandate', $hash ) );
7746             }
7747             PERL
7748             # NOTE: mandates()
7749             mandates => <<'PERL',
7750             sub mandates
7751             {
7752             my $self = shift( @_ );
7753             my $action = shift( @_ );
7754             my $allowed = [qw( retrieve )];
7755             my $meth = $self->_get_method( 'mandate', $action, $allowed ) || CORE::return( $self->pass_error );
7756             CORE::return( $self->$meth( @_ ) );
7757             }
7758             PERL
7759             # NOTE: merchant_data()
7760             merchant_data => <<'PERL',
7761             sub merchant_data { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Issuing::MerchantData', @_ ) ); }
7762             PERL
7763             # NOTE: next_action()
7764             next_action => <<'PERL',
7765             sub next_action { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Payment::Intent::NextAction', @_ ) ); }
7766             PERL
7767             # NOTE: order()
7768             order => <<'PERL',
7769             sub order { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Order' ) ) }
7770             PERL
7771             # NOTE: order_item()
7772             order_item => <<'PERL',
7773             sub order_item { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Order::Item' ) ) }
7774             PERL
7775             # NOTE: outcome()
7776             outcome => <<'PERL',
7777             sub outcome { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Charge::Outcome', @_ ) ); }
7778             PERL
7779             # NOTE: owner()
7780             owner => <<'PERL',
7781             sub owner { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Payment::Source::Owner', @_ ) ); }
7782             PERL
7783             # NOTE: package_dimensions()
7784             package_dimensions => <<'PERL',
7785             sub package_dimensions { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Order::SKU::PackageDimensions', @_ ) ); }
7786             PERL
7787             # NOTE: payment_intent()
7788             payment_intent => <<'PERL',
7789             # subs to access child packages
7790             sub payment_intent { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Payment::Intent', @_ ) ); }
7791             PERL
7792             # NOTE: payment_intent_apply_customer_balance()
7793             payment_intent_apply_customer_balance => <<'PERL',
7794             sub payment_intent_apply_customer_balance
7795             {
7796             my $self = shift( @_ );
7797             my $args = shift( @_ );
7798             my $okParams =
7799             {
7800             expandable => { allowed => $EXPANDABLES->{ 'payment_intent' } },
7801             amount => { type => "integer" },
7802             currency => { type => "string" },
7803             };
7804             $args = $self->_contract( 'payment_intent', $args ) || CORE::return( $self->pass_error );
7805             my $err = $self->_check_parameters( $okParams, $args );
7806             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
7807             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." ) );
7808             my $hash = $self->post( "payment_intents/${id}", $args ) || CORE::return( $self->pass_error );
7809             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Payment::Intent', $hash ) );
7810             }
7811             PERL
7812             # NOTE: payment_intent_cancel()
7813             payment_intent_cancel => <<'PERL',
7814             sub payment_intent_cancel
7815             {
7816             my $self = shift( @_ );
7817             CORE::return( $self->error( "No parameters were provided to cancel a payment intent" ) ) if( !scalar( @_ ) );
7818             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Payment::Intent', @_ );
7819             my $okParams =
7820             {
7821             expandable => { allowed => $EXPANDABLES->{payment_intent} },
7822             amount_to_capture => {},
7823             cancellation_reason => { type => "string" },
7824             id => { re => qr/^\w+$/, required => 1 },
7825             };
7826              
7827             $args = $self->_contract( 'payment_intent', $args ) || CORE::return( $self->pass_error );
7828             my $err = $self->_check_parameters( $okParams, $args );
7829             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
7830             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No payment intent id was provided to cancel it." ) );
7831             my $hash = $self->post( "payment_intents/${id}/cancel", $args ) || CORE::return( $self->pass_error );
7832             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Payment::Intent', $hash ) );
7833             }
7834             PERL
7835             # NOTE: payment_intent_capture()
7836             payment_intent_capture => <<'PERL',
7837             sub payment_intent_capture
7838             {
7839             my $self = shift( @_ );
7840             CORE::return( $self->error( "No parameters were provided to capture a payment intent" ) ) if( !scalar( @_ ) );
7841             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Payment::Intent', @_ );
7842             my $okParams =
7843             {
7844             expandable => { allowed => $EXPANDABLES->{payment_intent} },
7845             amount_to_capture => { type => "integer" },
7846             application_fee_amount => { type => "integer" },
7847             id => { re => qr/^\w+$/, required => 1 },
7848             statement_descriptor => { type => "string" },
7849             statement_descriptor_suffix => { type => "string" },
7850             transfer_data => { fields => ["amount"], type => "hash" },
7851             };
7852              
7853             $args = $self->_contract( 'payment_intent', $args ) || CORE::return( $self->pass_error );
7854             my $err = $self->_check_parameters( $okParams, $args );
7855             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
7856             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No payment intent id was provided to capture it." ) );
7857             my $hash = $self->post( "payment_intents/${id}/capture", $args ) || CORE::return( $self->pass_error );
7858             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Payment::Intent', $hash ) );
7859             }
7860             PERL
7861             # NOTE: payment_intent_confirm()
7862             payment_intent_confirm => <<'PERL',
7863             sub payment_intent_confirm
7864             {
7865             my $self = shift( @_ );
7866             CORE::return( $self->error( "No parameters were provided to confirm a payment intent" ) ) if( !scalar( @_ ) );
7867             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Payment::Intent', @_ );
7868             my $okParams =
7869             {
7870             expandable => { allowed => $EXPANDABLES->{payment_intent} },
7871             capture_method => { type => "string" },
7872             error_on_requires_action => { type => "boolean" },
7873             id => { re => qr/^\w+$/, required => 1 },
7874             mandate => { type => "string" },
7875             mandate_data => {
7876             fields => [
7877             "customer_acceptance.accepted_at",
7878             "customer_acceptance.offline",
7879             "customer_acceptance.online",
7880             "customer_acceptance.online.ip_address",
7881             "customer_acceptance.online.user_agent",
7882             "customer_acceptance.type",
7883             ],
7884             type => "hash",
7885             },
7886             off_session => { type => "string" },
7887             payment_method => { package => "Net::API::Stripe::Payment::Method", type => "string" },
7888             payment_method_data => {
7889             fields => [
7890             "alipay",
7891             "au_becs_debit",
7892             "au_becs_debit.account_number!",
7893             "au_becs_debit.bsb_number!",
7894             "bacs_debit",
7895             "bacs_debit.account_number",
7896             "bacs_debit.sort_code",
7897             "bancontact",
7898             "billing_details",
7899             "billing_details.address",
7900             "billing_details.address.city",
7901             "billing_details.address.country",
7902             "billing_details.address.line1",
7903             "billing_details.address.line2",
7904             "billing_details.address.postal_code",
7905             "billing_details.address.state",
7906             "billing_details.email",
7907             "billing_details.name",
7908             "billing_details.phone",
7909             "eps",
7910             "fpx",
7911             "fpx.bank!",
7912             "giropay",
7913             "grabpay",
7914             "ideal",
7915             "ideal.bank",
7916             "interac_present",
7917             "metadata",
7918             "oxxo",
7919             "p24",
7920             "p24.bank",
7921             "sepa_debit",
7922             "sepa_debit.iban!",
7923             "sofort",
7924             "sofort.country!",
7925             "type",
7926             ],
7927             type => "object",
7928             },
7929             payment_method_options => {
7930             fields => [
7931             "alipay",
7932             "bancontact",
7933             "bancontact.preferred_language",
7934             "card",
7935             "card.cvc_token",
7936             "card.installments",
7937             "card.installments.enabled",
7938             "card.installments.plan",
7939             "card.installments.plan.count!",
7940             "card.installments.plan.interval!",
7941             "card.installments.plan.type!",
7942             "card.network",
7943             "card.request_three_d_secure",
7944             "oxxo.expires_after_days",
7945             "p24",
7946             "sepa_debit",
7947             "sepa_debit.mandate_options",
7948             "sofort",
7949             "sofort.preferred_language",
7950             "type",
7951             ],
7952             type => "hash",
7953             },
7954             payment_method_types => { type => "array" },
7955             radar_options => { type => "object" },
7956             receipt_email => { type => "string" },
7957             return_url => { type => "string" },
7958             setup_future_usage => { type => "string" },
7959             shipping => { package => "Net::API::Stripe::Shipping", type => "hash" },
7960             use_stripe_sdk => { type => "boolean" },
7961             };
7962              
7963             $args = $self->_contract( 'payment_intent', $args ) || CORE::return( $self->pass_error );
7964             my $err = $self->_check_parameters( $okParams, $args );
7965             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
7966             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No payment intent id was provided to confirm it." ) );
7967             my $hash = $self->post( "payment_intents/${id}/confirm", $args ) || CORE::return( $self->pass_error );
7968             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Payment::Intent', $hash ) );
7969             }
7970             PERL
7971             # NOTE: payment_intent_create()
7972             payment_intent_create => <<'PERL',
7973             sub payment_intent_create
7974             {
7975             my $self = shift( @_ );
7976             CORE::return( $self->error( "No parameters were provided to create a payment intent" ) ) if( !scalar( @_ ) );
7977             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Payment::Intent', @_ );
7978             my $okParams =
7979             {
7980             expandable => { allowed => $EXPANDABLES->{payment_intent} },
7981             amount => { required => 1, type => "integer" },
7982             application_fee_amount => { type => "integer" },
7983             automatic_payment_methods => { type => "hash" },
7984             capture_method => { type => "string" },
7985             confirm => { required => 1, type => "boolean" },
7986             confirmation_method => { type => "string" },
7987             currency => { required => 1, type => "string" },
7988             customer => { re => qr/^\w+$/, type => "string" },
7989             description => { type => "string" },
7990             error_on_requires_action => { type => "boolean" },
7991             mandate => { re => qr/^\w+$/, type => "string" },
7992             mandate_data => {
7993             fields => [
7994             "customer_acceptance!",
7995             "customer_acceptance.type!",
7996             "customer_acceptance.accepted_at",
7997             "customer_acceptance.offline",
7998             "customer_acceptance.online",
7999             "customer_acceptance.online.ip_address!",
8000             "customer_acceptance.online.user_agent!",
8001             ],
8002             type => "object",
8003             },
8004             metadata => { type => "hash" },
8005             off_session => { type => "boolean" },
8006             on_behalf_of => { re => qr/^\w+$/, type => "string" },
8007             payment_method => { re => qr/^\w+$/, type => "string" },
8008             payment_method_data => {
8009             fields => [
8010             "alipay",
8011             "au_becs_debit",
8012             "au_becs_debit.account_number!",
8013             "au_becs_debit.bsb_number!",
8014             "bacs_debit",
8015             "bacs_debit.account_number",
8016             "bacs_debit.sort_code",
8017             "bancontact",
8018             "billing_details",
8019             "billing_details.address",
8020             "billing_details.address.city",
8021             "billing_details.address.country",
8022             "billing_details.address.line1",
8023             "billing_details.address.line2",
8024             "billing_details.address.postal_code",
8025             "billing_details.address.state",
8026             "billing_details.email",
8027             "billing_details.name",
8028             "billing_details.phone",
8029             "eps",
8030             "fpx",
8031             "fpx.bank!",
8032             "giropay",
8033             "grabpay",
8034             "ideal",
8035             "ideal.bank",
8036             "interac_present",
8037             "metadata",
8038             "oxxo",
8039             "p24",
8040             "p24.bank",
8041             "sepa_debit",
8042             "sepa_debit.iban!",
8043             "sofort",
8044             "sofort.country!",
8045             "type!",
8046             ],
8047             type => "object",
8048             },
8049             payment_method_options => {
8050             fields => [
8051             "alipay",
8052             "bancontact",
8053             "bancontact.preferred_language",
8054             "card",
8055             "card.cvc_token",
8056             "card.installments",
8057             "card.installments.enabled",
8058             "card.installments.plan",
8059             "card.installments.plan.count!",
8060             "card.installments.plan.interval!",
8061             "card.installments.plan.type!",
8062             "card.network",
8063             "card.request_three_d_secure",
8064             "oxxo.expires_after_days",
8065             "p24",
8066             "sepa_debit",
8067             "sepa_debit.mandate_options",
8068             "sofort",
8069             "sofort.preferred_language",
8070             "type",
8071             ],
8072             type => "hash",
8073             },
8074             payment_method_types => { type => "array" },
8075             radar_options => { type => "object" },
8076             receipt_email => { type => "string" },
8077             return_url => { type => "string" },
8078             setup_future_usage => { type => "string" },
8079             shipping => {
8080             fields => ["address!", "carrier", "name!", "phone", "tracking_number"],
8081             type => "hash",
8082             },
8083             statement_descriptor => { type => "string" },
8084             statement_descriptor_suffix => { type => "string" },
8085             transfer_data => { type => "hash" },
8086             transfer_group => { type => "string" },
8087             use_stripe_sdk => { type => "boolean" },
8088             };
8089              
8090             $args = $self->_contract( 'payment_intent', $args ) || CORE::return( $self->pass_error );
8091             my $err = $self->_check_parameters( $okParams, $args );
8092             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
8093             my $hash = $self->post( 'payment_intents', $args ) || CORE::return( $self->pass_error );
8094             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Payment::Intent', $hash ) );
8095             }
8096             PERL
8097             # NOTE: payment_intent_increment()
8098             payment_intent_increment => <<'PERL',
8099             sub payment_intent_increment
8100             {
8101             my $self = shift( @_ );
8102             CORE::return( $self->error( "No parameters were provided to increment a payment intent" ) ) if( !scalar( @_ ) );
8103             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Payment::Intent', @_ );
8104             my $okParams =
8105             {
8106             expandable => { allowed => $EXPANDABLES->{payment_intent} },
8107             id => { re => qr/^\w+$/, required => 1 },
8108             amount => { re => qr/^\d+$/, required => 1 },
8109             description => { re => qr/^.*?$/ },
8110             metadata => {},
8111             application_fee_amount => { re => qr/^\d+$/ },
8112             transfer_data => { fields => [qw( amount )] },
8113             };
8114             my $err = $self->_check_parameters( $okParams, $args );
8115             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
8116             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No payment intent id was provided to increment it." ) );
8117             my $hash = $self->post( "payment_intents/${id}/increment_authorization", $args ) || CORE::return( $self->pass_error );
8118             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Payment::Intent', $hash ) );
8119             }
8120             PERL
8121             # NOTE: payment_intent_increment_authorization()
8122             payment_intent_increment_authorization => <<'PERL',
8123             sub payment_intent_increment_authorization
8124             {
8125             my $self = shift( @_ );
8126             my $args = shift( @_ );
8127             my $okParams =
8128             {
8129             expandable => { allowed => $EXPANDABLES->{ 'payment_intent' } },
8130             amount => { type => "integer", required => 1 },
8131             application_fee_amount => { type => "integer" },
8132             description => { type => "string" },
8133             metadata => { type => "hash" },
8134             transfer_data => { type => "hash" },
8135             };
8136             $args = $self->_contract( 'payment_intent', $args ) || CORE::return( $self->pass_error );
8137             my $err = $self->_check_parameters( $okParams, $args );
8138             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
8139             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No payment_intent id (with parameter 'id') was provided to increment_authorization its information." ) );
8140             my $hash = $self->post( "payment_intents/${id}", $args ) || CORE::return( $self->pass_error );
8141             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Payment::Intent', $hash ) );
8142             }
8143             PERL
8144             # NOTE: payment_intent_list()
8145             payment_intent_list => <<'PERL',
8146             sub payment_intent_list
8147             {
8148             my $self = shift( @_ );
8149             my $args = $self->_get_args( @_ );
8150             my $okParams =
8151             {
8152             expandable => { allowed => $EXPANDABLES->{payment_intent}, data_prefix_is_ok => 1 },
8153             created => qr/^\d+$/,
8154             'created.gt' => qr/^\d+$/,
8155             'created.gte' => qr/^\d+$/,
8156             'created.lt' => qr/^\d+$/,
8157             'created.lte' => qr/^\d+$/,
8158             customer => { type => "string" },
8159             ending_before => qr/^\w+$/,
8160             limit => qr/^\d+$/,
8161             starting_after => qr/^\w+$/,
8162             };
8163              
8164             my $err = $self->_check_parameters( $okParams, $args );
8165             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
8166             if( $args->{expand} )
8167             {
8168             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
8169             }
8170             my $hash = $self->get( 'payment_methods', $args ) || CORE::return( $self->pass_error );
8171             CORE::return( $self->_response_to_object( 'Net::API::Stripe::List', $hash ) );
8172             }
8173             PERL
8174             # NOTE: payment_intent_reconcile()
8175             payment_intent_reconcile => <<'PERL',
8176             sub payment_intent_reconcile
8177             {
8178             my $self = shift( @_ );
8179             CORE::return( $self->error( "No parameters were provided to reconcile a customer balance payment intent" ) ) if( !scalar( @_ ) );
8180             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Payment::Intent', @_ );
8181             my $okParams =
8182             {
8183             expandable => { allowed => $EXPANDABLES->{payment_intent} },
8184             id => { re => qr/^\w+$/, required => 1 },
8185             amount => { re => qr/^\d+$/ },
8186             currency => { re => qr/^[a-zA-Z]{3}$/ },
8187             };
8188             my $err = $self->_check_parameters( $okParams, $args );
8189             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
8190             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No payment intent id was provided to reconcile its customer balance." ) );
8191             my $hash = $self->post( "payment_intents/${id}/apply_customer_balance", $args ) || CORE::return( $self->pass_error );
8192             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Payment::Intent', $hash ) );
8193             }
8194             PERL
8195             # NOTE: payment_intent_retrieve()
8196             payment_intent_retrieve => <<'PERL',
8197             sub payment_intent_retrieve
8198             {
8199             my $self = shift( @_ );
8200             CORE::return( $self->error( "No parameters were provided to retrieve a payment intent" ) ) if( !scalar( @_ ) );
8201             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Payment::Intent', @_ );
8202             my $okParams =
8203             {
8204             expandable => { allowed => $EXPANDABLES->{payment_intent}, data_prefix_is_ok => 1 },
8205             client_secret => { required => 1, type => "string" },
8206             id => { re => qr/^\w+$/, required => 1 },
8207             };
8208              
8209             my $err = $self->_check_parameters( $okParams, $args );
8210             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
8211             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No payment intent id was provided to retrieve it." ) );
8212             my $hash = $self->get( "payment_intents/${id}", $args ) || CORE::return( $self->pass_error );
8213             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Payment::Intent', $hash ) );
8214             }
8215             PERL
8216             # NOTE: payment_intent_search()
8217             payment_intent_search => <<'PERL',
8218             sub payment_intent_search
8219             {
8220             my $self = shift( @_ );
8221             CORE::return( $self->error( "No parameters were provided to search payment intents." ) ) if( !scalar( @_ ) );
8222             my $args = shift( @_ );
8223             my $okParams =
8224             {
8225             expandable => { allowed => $EXPANDABLES->{payment_intent}, data_prefix_is_ok => 1 },
8226             limit => qr/^\d+$/,
8227             page => qr/^\d+$/,
8228             query => { re => qr/^.*?$/, required => 1, type => "string" },
8229             };
8230              
8231             my $err = $self->_check_parameters( $okParams, $args );
8232             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
8233             if( $args->{expand} )
8234             {
8235             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
8236             }
8237             my $hash = $self->get( "payment_methods/search", $args ) || CORE::return( $self->pass_error );
8238             CORE::return( $self->_response_to_object( 'Net::API::Stripe::List', $hash ) );
8239             }
8240             PERL
8241             # NOTE: payment_intent_update()
8242             payment_intent_update => <<'PERL',
8243             sub payment_intent_update
8244             {
8245             my $self = shift( @_ );
8246             CORE::return( $self->error( "No parameters were provided to update a payment intent" ) ) if( !scalar( @_ ) );
8247             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Payment::Intent', @_ );
8248             my $okParams =
8249             {
8250             expandable => { allowed => $EXPANDABLES->{payment_intent} },
8251             amount => { required => 1, type => "integer" },
8252             application_fee_amount => { type => "integer" },
8253             capture_method => { type => "string" },
8254             currency => { type => "string" },
8255             customer => { re => qr/^\w+$/, type => "string" },
8256             description => { type => "string" },
8257             metadata => { type => "hash" },
8258             payment_method => { re => qr/^\w+$/, type => "string" },
8259             payment_method_data => {
8260             fields => [
8261             "alipay",
8262             "au_becs_debit",
8263             "au_becs_debit.account_number!",
8264             "au_becs_debit.bsb_number!",
8265             "bacs_debit",
8266             "bacs_debit.account_number",
8267             "bacs_debit.sort_code",
8268             "bancontact",
8269             "billing_details",
8270             "billing_details.address",
8271             "billing_details.address.city",
8272             "billing_details.address.country",
8273             "billing_details.address.line1",
8274             "billing_details.address.line2",
8275             "billing_details.address.postal_code",
8276             "billing_details.address.state",
8277             "billing_details.email",
8278             "billing_details.name",
8279             "billing_details.phone",
8280             "eps",
8281             "fpx",
8282             "fpx.bank!",
8283             "giropay",
8284             "grabpay",
8285             "ideal",
8286             "ideal.bank",
8287             "interac_present",
8288             "metadata",
8289             "oxxo",
8290             "p24",
8291             "p24.bank",
8292             "sepa_debit",
8293             "sepa_debit.iban!",
8294             "sofort",
8295             "sofort.country!",
8296             "type!",
8297             ],
8298             type => "object",
8299             },
8300             payment_method_options => {
8301             fields => [
8302             "alipay",
8303             "bancontact",
8304             "bancontact.preferred_language",
8305             "card",
8306             "card.cvc_token",
8307             "card.installments",
8308             "card.installments.enabled",
8309             "card.installments.plan",
8310             "card.installments.plan.count!",
8311             "card.installments.plan.interval!",
8312             "card.installments.plan.type!",
8313             "card.network",
8314             "card.request_three_d_secure",
8315             "oxxo.expires_after_days",
8316             "p24",
8317             "sepa_debit",
8318             "sepa_debit.mandate_options",
8319             "sofort",
8320             "sofort.preferred_language",
8321             "type",
8322             ],
8323             type => "hash",
8324             },
8325             payment_method_types => { type => "array" },
8326             receipt_email => { type => "string" },
8327             setup_future_usage => { type => "string" },
8328             shipping => {
8329             fields => ["address!", "carrier", "name!", "phone", "tracking_number"],
8330             type => "hash",
8331             },
8332             statement_descriptor => { type => "string" },
8333             statement_descriptor_suffix => { type => "string" },
8334             transfer_data => { type => "hash" },
8335             transfer_group => { type => "string" },
8336             };
8337              
8338             $args = $self->_contract( 'payment_intent', $args ) || CORE::return( $self->pass_error );
8339             my $err = $self->_check_parameters( $okParams, $args );
8340             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
8341             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No payment intent id was provided to capture it." ) );
8342             my $hash = $self->post( "payment_intents/${id}", $args ) || CORE::return( $self->pass_error );
8343             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Payment::Intent', $hash ) );
8344             }
8345             PERL
8346             # NOTE: payment_intent_verify()
8347             payment_intent_verify => <<'PERL',
8348             sub payment_intent_verify
8349             {
8350             my $self = shift( @_ );
8351             CORE::return( $self->error( "No parameters were provided to verify microdeposits on a payment intent" ) ) if( !scalar( @_ ) );
8352             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Payment::Intent', @_ );
8353             my $okParams =
8354             {
8355             expandable => { allowed => $EXPANDABLES->{payment_intent} },
8356             id => { re => qr/^\w+$/, required => 1 },
8357             client_secret => {},
8358             amounts => { type => 'array', re => qr/^\d+$/ },
8359             descriptor_code => { re => qr/^.*?$/ },
8360             };
8361             my $err = $self->_check_parameters( $okParams, $args );
8362             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
8363             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No payment intent id was provided to verify microdeposits on it." ) );
8364             my $hash = $self->post( "payment_intents/${id}/verify_microdeposits", $args ) || CORE::return( $self->pass_error );
8365             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Payment::Intent', $hash ) );
8366             }
8367             PERL
8368             # NOTE: payment_intent_verify_microdeposits()
8369             payment_intent_verify_microdeposits => <<'PERL',
8370             sub payment_intent_verify_microdeposits
8371             {
8372             my $self = shift( @_ );
8373             CORE::return( $self->error( "No parameters were provided to verify_microdeposits payment intent information." ) ) if( !scalar( @_ ) );
8374             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Payment::Intent', @_ );
8375             my $okParams =
8376             {
8377             expandable => { allowed => $EXPANDABLES->{ 'payment_intent' } },
8378             amounts => { type => "array" },
8379             client_secret => { type => "string", required => 1 },
8380             descriptor_code => { type => "string" },
8381             };
8382             my $err = $self->_check_parameters( $okParams, $args );
8383             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
8384             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No payment_intent id (with parameter 'id') was provided to verify_microdeposits its information." ) );
8385             my $hash = $self->post( "payment_intents/${id}", $args ) || CORE::return( $self->pass_error );
8386             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Payment::Intent', $hash ) );
8387             }
8388             PERL
8389             # NOTE: payment_intents()
8390             payment_intents => <<'PERL',
8391             # <https://stripe.com/docs/api/payment_intents>
8392             sub payment_intents
8393             {
8394             my $self = shift( @_ );
8395             my $allowed = [qw( apply_customer_balance cancel capture confirm create increment increment_authorization list reconcile retrieve search update verify verify_microdeposits )];
8396             my $action = shift( @_ );
8397             my $meth = $self->_get_method( 'payment_intent', $action, $allowed ) || CORE::return( $self->pass_error );
8398             CORE::return( $self->$meth( @_ ) );
8399             }
8400             PERL
8401             # NOTE: payment_link()
8402             payment_link => <<'PERL',
8403             sub payment_link { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Payment::Link', @_ ) ); }
8404             PERL
8405             # NOTE: payment_link_create()
8406             payment_link_create => <<'PERL',
8407             sub payment_link_create
8408             {
8409             my $self = shift( @_ );
8410             CORE::return( $self->error( "No parameters were provided to create a payment link." ) ) if( !scalar( @_ ) );
8411             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Payment::Link', @_ );
8412             my $okParams =
8413             {
8414             expandable => { allowed => $EXPANDABLES->{payment_link} },
8415             after_completion => {
8416             fields => [
8417             "type!",
8418             "hosted_confirmation",
8419             "hosted_confirmation.custom_message",
8420             "redirect",
8421             "redirect.url!",
8422             ],
8423             type => "hash",
8424             },
8425             allow_promotion_codes => { type => "boolean" },
8426             application_fee_amount => { type => "integer" },
8427             application_fee_percent => { type => "decimal" },
8428             automatic_tax => { fields => ["enabled!"], type => "hash" },
8429             billing_address_collection => { type => "string" },
8430             consent_collection => { fields => ["promotions"], type => "hash" },
8431             currency => { type => "currency" },
8432             customer_creation => { type => "string" },
8433             line_items => {
8434             fields => [
8435             "price!",
8436             "quantity!",
8437             "adjustable_quantity.enabled!",
8438             "adjustable_quantity.maximum",
8439             "adjustable_quantity.minimum",
8440             ],
8441             required => 1,
8442             type => "array",
8443             },
8444             metadata => { type => "hash" },
8445             on_behalf_of => { re => qr/^\w+$/, type => "string" },
8446             payment_intent_data => { fields => ["capture_method", "setup_future_usage"], type => "hash" },
8447             payment_method_collection => { type => "string" },
8448             payment_method_type => { type => "string" },
8449             payment_method_types => { type => "array" },
8450             phone_number_collection => { fields => ["enabled!"], type => "hash" },
8451             shipping_address_collection => { fields => ["allowed_countries"], type => "hash" },
8452             shipping_options => { fields => ["shipping_rate"], type => "array" },
8453             submit_type => { type => "string" },
8454             subscription_data => { fields => ["trial_period_days"], type => "hash" },
8455             tax_id_collection => { fields => ["enabled"], type => "hash" },
8456             transfer_data => { fields => ["destination!", "amount"], type => "hash" },
8457             };
8458              
8459             $args = $self->_contract( 'payment_link', $args ) || CORE::return( $self->pass_error );
8460             my $err = $self->_check_parameters( $okParams, $args );
8461             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
8462             my $hash = $self->post( 'payment_links', $args ) || CORE::return( $self->pass_error );
8463             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Payment::Link', $hash ) );
8464             }
8465             PERL
8466             # NOTE: payment_link_items()
8467             payment_link_items => <<'PERL',
8468             sub payment_link_items
8469             {
8470             my $self = shift( @_ );
8471             CORE::return( $self->error( "No parameters were provided to retrieve payment link information." ) ) if( !scalar( @_ ) );
8472             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Payment::Link', @_ );
8473             my $okParams =
8474             {
8475             expandable => { allowed => $EXPANDABLES->{payment_link} },
8476             id => { re => qr/^\w+$/, required => 1 },
8477             ending_before => { re => qr/^\w+$/ },
8478             limit => { re => qr/^\d+$/ },
8479             starting_after => { re => qr/^\w+$/ },
8480             };
8481             my $err = $self->_check_parameters( $okParams, $args );
8482             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
8483             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No product id was provided to retrieve its information." ) );
8484             my $hash = $self->get( "payment_links/${id}/line_items", $args ) || CORE::return( $self->pass_error );
8485             CORE::return( $self->_response_to_object( 'Net::API::Stripe::List', $hash ) );
8486             }
8487             PERL
8488             # NOTE: payment_link_line_items()
8489             payment_link_line_items => <<'PERL',
8490             sub payment_link_line_items
8491             {
8492             my $self = shift( @_ );
8493             CORE::return( $self->error( "No parameters were provided to line_items payment link information." ) ) if( !scalar( @_ ) );
8494             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Payment::Link', @_ );
8495             my $okParams =
8496             {
8497             expandable => { allowed => $EXPANDABLES->{ 'payment_link' }, data_prefix_is_ok => 1 },
8498             ending_before => { type => "string" },
8499             limit => { type => "string" },
8500             starting_after => { type => "string" },
8501             };
8502             my $err = $self->_check_parameters( $okParams, $args );
8503             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
8504             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No payment_link id (with parameter 'id') was provided to line_items its information." ) );
8505             my $hash = $self->get( "payment_links/${id}/line_items", $args ) || CORE::return( $self->pass_error );
8506             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Payment::Link', $hash ) );
8507             }
8508             PERL
8509             # NOTE: payment_link_list()
8510             payment_link_list => <<'PERL',
8511             sub payment_link_list
8512             {
8513             my $self = shift( @_ );
8514             my $args = $self->_get_args( @_ );
8515             my $okParams =
8516             {
8517             expandable => { allowed => $EXPANDABLES->{payment_link}, data_prefix_is_ok => 1 },
8518             active => { type => "boolean" },
8519             arrival_date => { re => qr/^\d+$/ },
8520             'arrival_date.gt' => { re => qr/^\d+$/ },
8521             'arrival_date.gte' => { re => qr/^\d+$/ },
8522             'arrival_date.lt' => { re => qr/^\d+$/ },
8523             'arrival_date.lte' => { re => qr/^\d+$/ },
8524             created => { re => qr/^\d+$/ },
8525             'created.gt' => { re => qr/^\d+$/ },
8526             'created.gte' => { re => qr/^\d+$/ },
8527             'created.lt' => { re => qr/^\d+$/ },
8528             'created.lte' => { re => qr/^\d+$/ },
8529             destination => { re => qr/^\w+$/ },
8530             ending_before => { re => qr/^\w+$/, type => "string" },
8531             limit => { re => qr/^\d+$/, type => "string" },
8532             starting_after => { re => qr/^\w+$/, type => "string" },
8533             status => { re => qr/^(pending|paid|failed|canceled)$/ },
8534             };
8535              
8536             my $err = $self->_check_parameters( $okParams, $args );
8537             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
8538             if( $args->{expand} )
8539             {
8540             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
8541             }
8542             my $hash = $self->get( 'payment_links', $args ) || CORE::return( $self->pass_error );
8543             CORE::return( $self->_response_to_object( 'Net::API::Stripe::List', $hash ) );
8544             }
8545             PERL
8546             # NOTE: payment_link_retrieve()
8547             payment_link_retrieve => <<'PERL',
8548             sub payment_link_retrieve
8549             {
8550             my $self = shift( @_ );
8551             CORE::return( $self->error( "No parameters were provided to retrieve payment link information." ) ) if( !scalar( @_ ) );
8552             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Payment::Link', @_ );
8553             my $okParams =
8554             {
8555             expandable => { allowed => $EXPANDABLES->{payment_link} },
8556             id => { re => qr/^\w+$/, required => 1 },
8557             };
8558             my $err = $self->_check_parameters( $okParams, $args );
8559             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
8560             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No payment link id was provided to retrieve its information." ) );
8561             my $hash = $self->get( "payment_links/${id}", $args ) || CORE::return( $self->pass_error );
8562             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Payment::Link', $hash ) );
8563             }
8564             PERL
8565             # NOTE: payment_link_update()
8566             payment_link_update => <<'PERL',
8567             sub payment_link_update
8568             {
8569             my $self = shift( @_ );
8570             CORE::return( $self->error( "No parameters were provided to update a payment link" ) ) if( !scalar( @_ ) );
8571             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Payout', @_ );
8572             my $okParams =
8573             {
8574             expandable => { allowed => $EXPANDABLES->{payment_link} },
8575             active => { type => "boolean" },
8576             after_completion => { type => "hash" },
8577             allow_promotion_codes => { type => "boolean" },
8578             automatic_tax => { type => "hash" },
8579             billing_address_collection => { type => "string" },
8580             customer_creation => { type => "string" },
8581             id => { re => qr/^\w+$/, required => 1 },
8582             line_items => { type => "hash" },
8583             metadata => { type => "hash" },
8584             payment_method_collection => { type => "string" },
8585             payment_method_types => { type => "array" },
8586             shipping_address_collection => { type => "hash" },
8587             };
8588              
8589             $args = $self->_contract( 'payment_link', $args ) || CORE::return( $self->pass_error );
8590             my $err = $self->_check_parameters( $okParams, $args );
8591             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
8592             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No payment id was provided to update its details" ) );
8593             my $hash = $self->post( "payment_links/${id}", $args ) || CORE::return( $self->pass_error );
8594             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Payout', $hash ) );
8595             }
8596             PERL
8597             # NOTE: payment_links()
8598             payment_links => <<'PERL',
8599             # <https://stripe.com/docs/api/payment_links/payment_links>
8600             sub payment_links
8601             {
8602             my $self = shift( @_ );
8603             my $allowed = [qw( create items line_items list retrieve update )];
8604             my $action = shift( @_ );
8605             my $meth = $self->_get_method( 'payment_link', $action, $allowed ) || CORE::return( $self->pass_error );
8606             CORE::return( $self->$meth( @_ ) );
8607             }
8608             PERL
8609             # NOTE: payment_method()
8610             payment_method => <<'PERL',
8611             sub payment_method { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Payment::Method', @_ ) ); }
8612             PERL
8613             # NOTE: payment_method_attach()
8614             payment_method_attach => <<'PERL',
8615             sub payment_method_attach
8616             {
8617             my $self = shift( @_ );
8618             CORE::return( $self->error( "No parameters were provided to attach a payment method" ) ) if( !scalar( @_ ) );
8619             my $args;
8620             if( $self->_is_object( $_[0] ) )
8621             {
8622             if( $_[0]->isa( 'Net::API::Stripe::Customer' ) )
8623             {
8624             $args = $self->_get_args_from_object( 'Net::API::Stripe::Customer', @_ );
8625             my $obj = $args->{_object};
8626             $args->{customer} = $obj->id;
8627             $args->{id} = $obj->payment_method->id if( $obj->payment_method );
8628             }
8629             elsif( $_[0]->isa( 'Net::API::Stripe::Payment::Method' ) )
8630             {
8631             $args = $self->_get_args_from_object( 'Net::API::Stripe::Payment::Method', @_ );
8632             }
8633             }
8634             else
8635             {
8636             $args = $self->_get_args( @_ );
8637             }
8638             my $okParams =
8639             {
8640             expandable => { allowed => $EXPANDABLES->{payment_method} },
8641             customer => { re => qr/^\w+$/, required => 1, type => "string" },
8642             id => { re => qr/^\w+$/, required => 1 },
8643             };
8644              
8645             $args = $self->_contract( 'payment_method', $args ) || CORE::return( $self->pass_error );
8646             my $err = $self->_check_parameters( $okParams, $args );
8647             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
8648             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}\"." ) );
8649             my $hash = $self->post( "payment_methods/${id}/attach", $args ) || CORE::return( $self->pass_error );
8650             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Payment::Method', $hash ) );
8651             }
8652             PERL
8653             # NOTE: payment_method_create()
8654             payment_method_create => <<'PERL',
8655             sub payment_method_create
8656             {
8657             my $self = shift( @_ );
8658             CORE::return( $self->error( "No parameters were provided to create a payment_method" ) ) if( !scalar( @_ ) );
8659             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Payment::Method', @_ );
8660             my $okParams =
8661             {
8662             expandable => { allowed => $EXPANDABLES->{payment_method} },
8663             acss_debit => { type => "hash" },
8664             affirm => { type => "hash" },
8665             afterpay_clearpay => { type => "hash" },
8666             alipay => { type => "hash" },
8667             au_becs_debit => { type => "hash" },
8668             bacs_debit => { type => "hash" },
8669             bancontact => { type => "hash" },
8670             billing_details => {
8671             fields => [
8672             "address.city",
8673             "address.country",
8674             "address.line1",
8675             "address.line2",
8676             "address.postal_code",
8677             "address.state",
8678             "email",
8679             "name",
8680             "phone",
8681             ],
8682             type => "hash",
8683             },
8684             blik => { type => "hash" },
8685             boleto => { type => "hash" },
8686             card => {
8687             fields => ["exp_month", "exp_year", "number", "cvc"],
8688             type => "hash",
8689             },
8690             customer_balance => { type => "hash" },
8691             eps => { type => "hash" },
8692             fpx => { fields => ["bank"], type => "hash" },
8693             giropay => { type => "hash" },
8694             grabpay => { type => "hash" },
8695             ideal => { fields => ["bank"], type => "hash" },
8696             interac_present => { type => "hash" },
8697             klarna => { type => "hash" },
8698             konbini => { type => "hash" },
8699             link => { type => "hash" },
8700             metadata => { type => "hash" },
8701             oxxo => { type => "hash" },
8702             p24 => { type => "hash" },
8703             paynow => { type => "hash" },
8704             promptpay => { type => "hash" },
8705             radar_options => { type => "hash" },
8706             sepa_debit => { fields => ["iban"], type => "hash" },
8707             sofort => { type => "hash" },
8708             type => {
8709             re => qr/^(?:card|fpx|ideal|sepa_debit)$/,
8710             required => 1,
8711             type => "string",
8712             },
8713             us_bank_account => { type => "hash" },
8714             wechat_pay => { type => "hash" },
8715             };
8716              
8717             $args = $self->_contract( 'payment_method', $args ) || CORE::return( $self->pass_error );
8718             my $err = $self->_check_parameters( $okParams, $args );
8719             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
8720             my $hash = $self->post( 'payment_methods', $args ) || CORE::return( $self->pass_error );
8721             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Payment::Method', $hash ) );
8722             }
8723             PERL
8724             # NOTE: payment_method_detach()
8725             payment_method_detach => <<'PERL',
8726             # https://stripe.com/docs/api/payment_methods/detach
8727             sub payment_method_detach
8728             {
8729             my $self = shift( @_ );
8730             CORE::return( $self->error( "No parameters were provided to detach a payment method." ) ) if( !scalar( @_ ) );
8731             my $args;
8732             if( $self->_is_object( $_[0] ) )
8733             {
8734             if( $_[0]->isa( 'Net::API::Stripe::Customer' ) )
8735             {
8736             $args = $self->_get_args_from_object( 'Net::API::Stripe::Customer', @_ );
8737             my $obj = $args->{_object};
8738             $args->{customer} = $obj->id;
8739             if( $obj->payment_method )
8740             {
8741             $args->{id} = $obj->payment_method->id;
8742             }
8743             elsif( $obj->invoice_settings->default_payment_method )
8744             {
8745             $args->{id} = $obj->invoice_settings->default_payment_method->id;
8746             }
8747             CORE::return( $self->error( "No payent method id could be found in this customer object." ) ) if( !$args->{id} );
8748             }
8749             elsif( $_[0]->isa( 'Net::API::Stripe::Payment::Method' ) )
8750             {
8751             $args = $self->_get_args_from_object( 'Net::API::Stripe::Payment::Method', @_ );
8752             }
8753             }
8754             else
8755             {
8756             $args = $self->_get_args( @_ );
8757             }
8758             my $okParams =
8759             {
8760             expandable => { allowed => $EXPANDABLES->{payment_method} },
8761             id => { re => qr/^\w+$/, required => 1 },
8762             };
8763             my $err = $self->_check_parameters( $okParams, $args );
8764             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
8765             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}\"." ) );
8766             my $hash = $self->post( "payment_methods/${id}/detach", $args ) || CORE::return( $self->pass_error );
8767             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Payment::Method', $hash ) );
8768             }
8769             PERL
8770             # NOTE: payment_method_details()
8771             payment_method_details => <<'PERL',
8772             sub payment_method_details { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Payment::Method::Details', @_ ) ); }
8773             PERL
8774             # NOTE: payment_method_list()
8775             payment_method_list => <<'PERL',
8776             sub payment_method_list
8777             {
8778             my $self = shift( @_ );
8779             my $args = $self->_get_args( @_ );
8780             my $okParams =
8781             {
8782             expandable => { allowed => $EXPANDABLES->{payment_method}, data_prefix_is_ok => 1 },
8783             customer => { required => 1, type => "string" },
8784             ending_before => { type => "string" },
8785             limit => { re => qr/^\d+$/, type => "string" },
8786             starting_after => { type => "string" },
8787             type => {
8788             re => qr/^(?:card|fpx|ideal|sepa_debit)$/,
8789             required => 1,
8790             type => "string",
8791             },
8792             };
8793              
8794             my $err = $self->_check_parameters( $okParams, $args );
8795             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
8796             if( $args->{expand} )
8797             {
8798             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
8799             }
8800             my $hash = $self->get( 'payment_methods', $args ) || CORE::return( $self->pass_error );
8801             CORE::return( $self->_response_to_object( 'Net::API::Stripe::List', $hash ) );
8802             }
8803             PERL
8804             # NOTE: payment_method_list_customer_payment_methods()
8805             payment_method_list_customer_payment_methods => <<'PERL',
8806             sub payment_method_list_customer_payment_methods
8807             {
8808             my $self = shift( @_ );
8809             CORE::return( $self->error( "No parameters were provided to list_customer_payment_methods payment method information." ) ) if( !scalar( @_ ) );
8810             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Payment::Method', @_ );
8811             my $okParams =
8812             {
8813             expandable => { allowed => $EXPANDABLES->{ 'payment_method' }, data_prefix_is_ok => 1 },
8814             ending_before => { type => "string" },
8815             limit => { type => "string" },
8816             starting_after => { type => "string" },
8817             type => { type => "string", required => 1 },
8818             };
8819             my $err = $self->_check_parameters( $okParams, $args );
8820             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
8821             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." ) );
8822             if( $args->{expand} )
8823             {
8824             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
8825             }
8826             my $hash = $self->get( "customers/${customer}/payment_methods", $args ) || CORE::return( $self->pass_error );
8827             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Payment::Method', $hash ) );
8828             }
8829             PERL
8830             # NOTE: payment_method_retrieve()
8831             payment_method_retrieve => <<'PERL',
8832             sub payment_method_retrieve
8833             {
8834             my $self = shift( @_ );
8835             CORE::return( $self->error( "No parameters were provided to retrieve payment method information." ) ) if( !scalar( @_ ) );
8836             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Payment::Method', @_ );
8837             my $okParams =
8838             {
8839             expandable => { allowed => $EXPANDABLES->{payment_method} },
8840             id => { re => qr/^\w+$/, required => 1 }
8841             };
8842             my $err = $self->_check_parameters( $okParams, $args );
8843             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
8844             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No payment method id was provided to retrieve its information." ) );
8845             my $hash = $self->get( "payment_methods/${id}", $args ) || CORE::return( $self->pass_error );
8846             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Payment::Method', $hash ) );
8847             }
8848             PERL
8849             # NOTE: payment_method_retrieve_customer_payment_method()
8850             payment_method_retrieve_customer_payment_method => <<'PERL',
8851             sub payment_method_retrieve_customer_payment_method
8852             {
8853             my $self = shift( @_ );
8854             CORE::return( $self->error( "No parameters were provided to retrieve_customer_payment_method payment method information." ) ) if( !scalar( @_ ) );
8855             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Payment::Method', @_ );
8856             my $okParams =
8857             {
8858             expandable => { allowed => $EXPANDABLES->{ 'payment_method' }, data_prefix_is_ok => 1 },
8859             };
8860             my $err = $self->_check_parameters( $okParams, $args );
8861             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
8862             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." ) );
8863             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." ) );
8864             if( $args->{expand} )
8865             {
8866             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
8867             }
8868             my $hash = $self->get( "customers/${customer}/payment_methods/${payment_method}", $args ) || CORE::return( $self->pass_error );
8869             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Payment::Method', $hash ) );
8870             }
8871             PERL
8872             # NOTE: payment_method_update()
8873             payment_method_update => <<'PERL',
8874             # https://stripe.com/docs/api/payment_methods/update
8875             sub payment_method_update
8876             {
8877             my $self = shift( @_ );
8878             CORE::return( $self->error( "No parameters were provided to update a payment method" ) ) if( !scalar( @_ ) );
8879             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Payment::Method', @_ );
8880             my $okParams =
8881             {
8882             expandable => { allowed => $EXPANDABLES->{payment_method} },
8883             billing_details => {
8884             fields => [
8885             "address.city",
8886             "address.country",
8887             "address.line1",
8888             "address.line2",
8889             "address.postal_code",
8890             "address.state",
8891             "email",
8892             "name",
8893             "phone",
8894             ],
8895             type => "hash",
8896             },
8897             card => { fields => ["exp_month", "exp_year"], type => "hash" },
8898             id => { re => qr/^\w+$/, required => 1 },
8899             link => { type => "hash" },
8900             metadata => { type => "hash" },
8901             sepa_debit => { fields => ["iban"] },
8902             us_bank_account => { type => "hash" },
8903             };
8904              
8905             $args = $self->_contract( 'payment_method', $args ) || CORE::return( $self->pass_error );
8906             # We found some errors
8907             my $err = $self->_check_parameters( $okParams, $args );
8908             # $self->message( 3, "Data to be posted: ", $self->dumper( $args ) ); exit;
8909             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
8910             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No payment method id was provided to update payment method's details" ) );
8911             my $hash = $self->post( "payment_methods/${id}", $args ) || CORE::return( $self->pass_error );
8912             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Payment::Method', $hash ) );
8913             }
8914             PERL
8915             # NOTE: payment_methods()
8916             payment_methods => <<'PERL',
8917             # <https://stripe.com/docs/api/payment_methods>
8918             sub payment_methods
8919             {
8920             my $self = shift( @_ );
8921             my $allowed = [qw( attach create detach list list_customer_payment_methods retrieve retrieve_customer_payment_method update )];
8922             my $action = shift( @_ );
8923             my $meth = $self->_get_method( 'payment_method', $action, $allowed ) || CORE::return( $self->pass_error );
8924             CORE::return( $self->$meth( @_ ) );
8925             }
8926             PERL
8927             # NOTE: payout()
8928             payout => <<'PERL',
8929             sub payout { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Payout', @_ ) ); }
8930             PERL
8931             # NOTE: payout_cancel()
8932             payout_cancel => <<'PERL',
8933             sub payout_cancel
8934             {
8935             my $self = shift( @_ );
8936             CORE::return( $self->error( "No parameters were provided to cancel a payout" ) ) if( !scalar( @_ ) );
8937             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Payout', @_ );
8938             my $okParams =
8939             {
8940             expandable => { allowed => $EXPANDABLES->{payout} },
8941             id => { re => qr/^\w+$/, required => 1 },
8942             };
8943             $args = $self->_contract( 'payout', $args ) || CORE::return( $self->pass_error );
8944             my $err = $self->_check_parameters( $okParams, $args );
8945             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
8946             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No payout id was provided to cancel it." ) );
8947             my $hash = $self->post( "payouts/${id}/cancel", $args ) || CORE::return( $self->pass_error );
8948             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Payout', $hash ) );
8949             }
8950             PERL
8951             # NOTE: payout_create()
8952             payout_create => <<'PERL',
8953             sub payout_create
8954             {
8955             my $self = shift( @_ );
8956             CORE::return( $self->error( "No parameters were provided to create a payout" ) ) if( !scalar( @_ ) );
8957             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Payout', @_ );
8958             my $okParams =
8959             {
8960             expandable => { allowed => $EXPANDABLES->{payout} },
8961             amount => { required => 1, type => "integer" },
8962             currency => { required => 1, type => "string" },
8963             description => { type => "string" },
8964             destination => { re => qr/^\w+$/, type => "string" },
8965             metadata => { type => "hash" },
8966             method => { re => qr/^(standard|instant)$/, type => "string" },
8967             source_type => { re => qr/^(bank_account|card|fpx)$/, type => "string" },
8968             statement_descriptor => { type => "string" },
8969             };
8970              
8971             $args = $self->_contract( 'payout', $args ) || CORE::return( $self->pass_error );
8972             my $err = $self->_check_parameters( $okParams, $args );
8973             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
8974             my $hash = $self->post( 'payouts', $args ) || CORE::return( $self->pass_error );
8975             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Payout', $hash ) );
8976             }
8977             PERL
8978             # NOTE: payout_list()
8979             payout_list => <<'PERL',
8980             sub payout_list
8981             {
8982             my $self = shift( @_ );
8983             my $args = $self->_get_args( @_ );
8984             my $okParams =
8985             {
8986             expandable => { allowed => $EXPANDABLES->{payout}, data_prefix_is_ok => 1 },
8987             arrival_date => { re => qr/^\d+$/, type => "timestamp" },
8988             'arrival_date.gt' => { re => qr/^\d+$/ },
8989             'arrival_date.gte' => { re => qr/^\d+$/ },
8990             'arrival_date.lt' => { re => qr/^\d+$/ },
8991             'arrival_date.lte' => { re => qr/^\d+$/ },
8992             created => { re => qr/^\d+$/, type => "timestamp" },
8993             'created.gt' => { re => qr/^\d+$/ },
8994             'created.gte' => { re => qr/^\d+$/ },
8995             'created.lt' => { re => qr/^\d+$/ },
8996             'created.lte' => { re => qr/^\d+$/ },
8997             destination => { re => qr/^\w+$/, type => "string" },
8998             ending_before => { re => qr/^\w+$/, type => "string" },
8999             limit => { re => qr/^\d+$/, type => "string" },
9000             starting_after => { re => qr/^\w+$/, type => "string" },
9001             status => { re => qr/^(pending|paid|failed|canceled)$/, type => "string" },
9002             };
9003              
9004             my $err = $self->_check_parameters( $okParams, $args );
9005             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
9006             if( $args->{expand} )
9007             {
9008             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
9009             }
9010             my $hash = $self->get( 'payment_methods', $args ) || CORE::return( $self->pass_error );
9011             CORE::return( $self->_response_to_object( 'Net::API::Stripe::List', $hash ) );
9012             }
9013             PERL
9014             # NOTE: payout_retrieve()
9015             payout_retrieve => <<'PERL',
9016             sub payout_retrieve
9017             {
9018             my $self = shift( @_ );
9019             CORE::return( $self->error( "No parameters were provided to retrieve payout information." ) ) if( !scalar( @_ ) );
9020             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Payout', @_ );
9021             my $okParams =
9022             {
9023             expandable => { allowed => $EXPANDABLES->{payout} },
9024             id => { re => qr/^\w+$/, required => 1 }
9025             };
9026             my $err = $self->_check_parameters( $okParams, $args );
9027             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
9028             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No payout id was provided to retrieve its information." ) );
9029             my $hash = $self->get( "payouts/${id}", $args ) || CORE::return( $self->pass_error );
9030             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Payout', $hash ) );
9031             }
9032             PERL
9033             # NOTE: payout_reverse()
9034             payout_reverse => <<'PERL',
9035             sub payout_reverse
9036             {
9037             my $self = shift( @_ );
9038             CORE::return( $self->error( "No parameters were provided to reverse payout information." ) ) if( !scalar( @_ ) );
9039             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Payout', @_ );
9040             my $okParams =
9041             {
9042             expandable => { allowed => $EXPANDABLES->{payout} },
9043             id => { re => qr/^\w+$/, required => 1 },
9044             metadata => { type => 'hash' },
9045             };
9046             my $err = $self->_check_parameters( $okParams, $args );
9047             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
9048             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No payout id was provided to reverse it." ) );
9049             my $hash = $self->get( "payouts/${id}", $args ) || CORE::return( $self->pass_error );
9050             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Payout', $hash ) );
9051             }
9052             PERL
9053             # NOTE: payout_update()
9054             payout_update => <<'PERL',
9055             sub payout_update
9056             {
9057             my $self = shift( @_ );
9058             CORE::return( $self->error( "No parameters were provided to update a payout" ) ) if( !scalar( @_ ) );
9059             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Payout', @_ );
9060             my $okParams =
9061             {
9062             expandable => { allowed => $EXPANDABLES->{payout} },
9063             id => { re => qr/^\w+$/, required => 1 },
9064             metadata => { type => 'hash' },
9065             };
9066             $args = $self->_contract( 'payout', $args ) || CORE::return( $self->pass_error );
9067             my $err = $self->_check_parameters( $okParams, $args );
9068             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
9069             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No payout id was provided to update its details" ) );
9070             my $hash = $self->post( "payouts/${id}", $args ) || CORE::return( $self->pass_error );
9071             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Payout', $hash ) );
9072             }
9073             PERL
9074             # NOTE: payouts()
9075             payouts => <<'PERL',
9076             sub payouts
9077             {
9078             my $self = shift( @_ );
9079             my $action = shift( @_ );
9080             my $allowed = [qw( create retrieve update list cancel reverse )];
9081             my $meth = $self->_get_method( 'payout', $action, $allowed ) || CORE::return( $self->pass_error );
9082             CORE::return( $self->$meth( @_ ) );
9083             }
9084             PERL
9085             # NOTE: period()
9086             period => <<'PERL',
9087             sub period { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Billing::Invoice::Period', @_ ) ); }
9088             PERL
9089             # NOTE: person()
9090             person => <<'PERL',
9091             sub person { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Connect::Person', @_ ) ); }
9092             PERL
9093             # NOTE: person_create()
9094             person_create => <<'PERL',
9095             sub person_create
9096             {
9097             my $self = shift( @_ );
9098             my $args = shift( @_ );
9099             my $okParams =
9100             {
9101             expandable => { allowed => $EXPANDABLES->{ 'person' } },
9102             address => { type => "hash" },
9103             address_kana => { type => "hash" },
9104             address_kanji => { type => "hash" },
9105             dob => { type => "hash" },
9106             documents => { type => "object" },
9107             email => { type => "string" },
9108             first_name => { type => "string" },
9109             first_name_kana => { type => "string" },
9110             first_name_kanji => { type => "string" },
9111             full_name_aliases => { type => "array" },
9112             gender => { type => "string" },
9113             id_number => { type => "string" },
9114             id_number_secondary => { type => "string" },
9115             last_name => { type => "string" },
9116             last_name_kana => { type => "string" },
9117             last_name_kanji => { type => "string" },
9118             maiden_name => { type => "string" },
9119             metadata => { type => "hash" },
9120             nationality => { type => "string" },
9121             person_token => { type => "string" },
9122             phone => { type => "string" },
9123             political_exposure => { type => "string" },
9124             registered_address => { type => "hash" },
9125             relationship => { type => "hash" },
9126             ssn_last_4 => { type => "string" },
9127             verification => { type => "hash" },
9128             };
9129             $args = $self->_contract( 'person', $args ) || CORE::return( $self->pass_error );
9130             my $err = $self->_check_parameters( $okParams, $args );
9131             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
9132             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No account id (with parameter 'id') was provided to create its information." ) );
9133             my $hash = $self->post( "accounts/${id}/persons", $args ) || CORE::return( $self->pass_error );
9134             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Connect::Person', $hash ) );
9135             }
9136             PERL
9137             # NOTE: person_delete()
9138             person_delete => <<'PERL',
9139             sub person_delete
9140             {
9141             my $self = shift( @_ );
9142             my $args = shift( @_ );
9143             my $okParams =
9144             {
9145             expandable => { allowed => $EXPANDABLES->{ 'person' } },
9146             };
9147             $args = $self->_contract( 'person', $args ) || CORE::return( $self->pass_error );
9148             my $err = $self->_check_parameters( $okParams, $args );
9149             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
9150             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." ) );
9151             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No person id (with parameter 'id') was provided to delete its information." ) );
9152             my $hash = $self->delete( "accounts/${parent_id}/persons/${id}", $args ) || CORE::return( $self->pass_error );
9153             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Connect::Person', $hash ) );
9154             }
9155             PERL
9156             # NOTE: person_list()
9157             person_list => <<'PERL',
9158             sub person_list
9159             {
9160             my $self = shift( @_ );
9161             CORE::return( $self->error( "No parameters were provided to list person information." ) ) if( !scalar( @_ ) );
9162             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Connect::Person', @_ );
9163             my $okParams =
9164             {
9165             expandable => { allowed => $EXPANDABLES->{ 'person' }, data_prefix_is_ok => 1 },
9166             ending_before => { type => "string" },
9167             limit => { type => "string" },
9168             relationship => { type => "hash" },
9169             starting_after => { type => "string" },
9170             };
9171             my $err = $self->_check_parameters( $okParams, $args );
9172             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
9173             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No account id (with parameter 'id') was provided to list its information." ) );
9174             if( $args->{expand} )
9175             {
9176             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
9177             }
9178             my $hash = $self->get( "accounts/${id}/persons", $args ) || CORE::return( $self->pass_error );
9179             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Connect::Person', $hash ) );
9180             }
9181             PERL
9182             # NOTE: person_retrieve()
9183             person_retrieve => <<'PERL',
9184             sub person_retrieve
9185             {
9186             my $self = shift( @_ );
9187             my $args = shift( @_ );
9188             my $okParams =
9189             {
9190             expandable => { allowed => $EXPANDABLES->{ 'person' }, data_prefix_is_ok => 1 },
9191             };
9192             $args = $self->_contract( 'person', $args ) || CORE::return( $self->pass_error );
9193             my $err = $self->_check_parameters( $okParams, $args );
9194             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
9195             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." ) );
9196             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No person id (with parameter 'id') was provided to retrieve its information." ) );
9197             my $hash = $self->get( "accounts/${parent_id}/persons/${id}", $args ) || CORE::return( $self->pass_error );
9198             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Connect::Person', $hash ) );
9199             }
9200             PERL
9201             # NOTE: person_token_create()
9202             person_token_create => <<'PERL',
9203             sub person_token_create { CORE::return( shift->token_create( @_ ) ); }
9204             PERL
9205             # NOTE: person_update()
9206             person_update => <<'PERL',
9207             sub person_update
9208             {
9209             my $self = shift( @_ );
9210             my $args = shift( @_ );
9211             my $okParams =
9212             {
9213             expandable => { allowed => $EXPANDABLES->{ 'person' } },
9214             address => { type => "hash" },
9215             address_kana => { type => "hash" },
9216             address_kanji => { type => "hash" },
9217             dob => { type => "hash" },
9218             documents => { type => "object" },
9219             email => { type => "string" },
9220             first_name => { type => "string" },
9221             first_name_kana => { type => "string" },
9222             first_name_kanji => { type => "string" },
9223             full_name_aliases => { type => "array" },
9224             gender => { type => "string" },
9225             id_number => { type => "string" },
9226             id_number_secondary => { type => "string" },
9227             last_name => { type => "string" },
9228             last_name_kana => { type => "string" },
9229             last_name_kanji => { type => "string" },
9230             maiden_name => { type => "string" },
9231             metadata => { type => "hash" },
9232             nationality => { type => "string" },
9233             person_token => { type => "string" },
9234             phone => { type => "string" },
9235             political_exposure => { type => "string" },
9236             registered_address => { type => "hash" },
9237             relationship => { type => "hash" },
9238             ssn_last_4 => { type => "string" },
9239             verification => { type => "hash" },
9240             };
9241             $args = $self->_contract( 'person', $args ) || CORE::return( $self->pass_error );
9242             my $err = $self->_check_parameters( $okParams, $args );
9243             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
9244             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." ) );
9245             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No person id (with parameter 'id') was provided to update its information." ) );
9246             my $hash = $self->post( "accounts/${parent_id}/persons/${id}", $args ) || CORE::return( $self->pass_error );
9247             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Connect::Person', $hash ) );
9248             }
9249             PERL
9250             # NOTE: persons()
9251             persons => <<'PERL',
9252             # <https://stripe.com/docs/api/persons>
9253             sub persons
9254             {
9255             my $self = shift( @_ );
9256             my $allowed = [qw( create delete list retrieve update )];
9257             my $action = shift( @_ );
9258             my $meth = $self->_get_method( 'person', $action, $allowed ) || CORE::return( $self->pass_error );
9259             CORE::return( $self->$meth( @_ ) );
9260             }
9261             PERL
9262             # NOTE: pii_token_create()
9263             pii_token_create => <<'PERL',
9264             sub pii_token_create { CORE::return( shift->token_create( @_ ) ); }
9265             PERL
9266             # NOTE: plan()
9267             plan => <<'PERL',
9268             sub plan { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Billing::Plan', @_ ) ); }
9269             PERL
9270             # NOTE: plan_by_product()
9271             plan_by_product => <<'PERL',
9272             # Find plan by product id or nickname
9273             sub plan_by_product
9274             {
9275             my $self = shift( @_ );
9276             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Product', @_ );
9277             my $id = CORE::delete( $args->{id} );
9278             my $nickname = CORE::delete( $args->{nickname} );
9279             CORE::return( $self->error( "No product id or plan name was provided to find its related product." ) ) if( !$id && !$nickname );
9280             $args->{product} = $id if( $id );
9281             my $check_both_active_and_inactive = 0;
9282             if( !CORE::length( $args->{active} ) )
9283             {
9284             $check_both_active_and_inactive++;
9285             $args->{active} = $self->true;
9286             }
9287             my $list = $self->plans( list => $args ) || CORE::return( $self->pass_error );
9288             my $objects = [];
9289             while( my $this = $list->next )
9290             {
9291             # If this was specified, this is a restrictive query
9292             if( $nickname && $this->nickname eq $nickname )
9293             {
9294             CORE::push( @$objects, $this );
9295             }
9296             # or at least we have this
9297             elsif( $id )
9298             {
9299             CORE::push( @$objects, $this );
9300             }
9301             }
9302             # Now, we also have to check for inactive plans, because Stripe requires the active parameter to be provided or else it defaults to inactive
9303             # How inefficient...
9304             if( $check_both_active_and_inactive )
9305             {
9306             $args->{active} = $self->false;
9307             my $list = $self->plans( list => $args ) || CORE::return( $self->pass_error );
9308             my $objects = [];
9309             while( my $this = $list->next )
9310             {
9311             if( $nickname && $this->nickname eq $nickname )
9312             {
9313             CORE::push( @$objects, $this );
9314             }
9315             elsif( $id )
9316             {
9317             CORE::push( @$objects, $this );
9318             }
9319             }
9320             }
9321             CORE::return( $objects );
9322             }
9323             PERL
9324             # NOTE: plan_create()
9325             plan_create => <<'PERL',
9326             sub plan_create
9327             {
9328             my $self = shift( @_ );
9329             CORE::return( $self->error( "No parameters were provided to create a plan" ) ) if( !scalar( @_ ) );
9330             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Billing::Plan', @_ );
9331             my $obj = $args->{_object};
9332             if( $self->_is_object( $args->{product} ) && $args->{product}->isa( 'Net::API::Stripe::Product' ) )
9333             {
9334             my $prod_hash = $args->{product}->as_hash({ json => 1 });
9335             $args->{product} = $prod_hash;
9336             }
9337             #exit;
9338             my $okParams =
9339             {
9340             expandable => { allowed => $EXPANDABLES->{plan} },
9341             active => { type => "boolean" },
9342             aggregate_usage => { type => "string" },
9343             amount => { required => 1, type => "integer" },
9344             amount_decimal => { type => "decimal" },
9345             billing_scheme => { type => "string" },
9346             currency => { required => 1, type => "string" },
9347             id => { type => "string" },
9348             interval => { re => qr/^(?:day|week|month|year)$/, required => 1, type => "string" },
9349             interval_count => { type => "integer" },
9350             metadata => { type => "hash" },
9351             nickname => { type => "string" },
9352             product => { required => 1, type => "string" },
9353             tiers => {
9354             fields => [
9355             "up_to",
9356             "flat_amount",
9357             "flat_amount_decimal",
9358             "unit_amount",
9359             "unit_amount_decimal",
9360             ],
9361             type => "array",
9362             },
9363             tiers_mode => { re => qr/^(graduated|volume)$/, type => "string" },
9364             transform_usage => { fields => ["divide_by", "round"], type => "hash" },
9365             trial_period_days => { type => "integer" },
9366             usage_type => { re => qr/^(?:metered|licensed)$/, type => "string" },
9367             };
9368              
9369             $args = $self->_contract( 'plan', $args ) || CORE::return( $self->pass_error );
9370             my $err = $self->_check_parameters( $okParams, $args );
9371             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
9372             my $hash = $self->post( 'plans', $args ) || CORE::return( $self->pass_error );
9373             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::Plan', $hash ) );
9374             }
9375             PERL
9376             # NOTE: plan_delete()
9377             plan_delete => <<'PERL',
9378             # https://stripe.com/docs/api/customers/delete?lang=curl
9379             # "Permanently deletes a customer. It cannot be undone. Also immediately cancels any active subscriptions on the customer."
9380             sub plan_delete
9381             {
9382             my $self = shift( @_ );
9383             CORE::return( $self->error( "No parameters were provided to delete plan information." ) ) if( !scalar( @_ ) );
9384             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Billing::Plan', @_ );
9385             my $okParams =
9386             {
9387             expandable => { allowed => $EXPANDABLES->{plan} },
9388             id => { re => qr/^\w+$/, required => 1 }
9389             };
9390             my $err = $self->_check_parameters( $okParams, $args );
9391             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
9392             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No plan id was provided to delete its information." ) );
9393             my $hash = $self->delete( "plans/${id}", $args ) || CORE::return( $self->pass_error );
9394             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::Plan', $hash ) );
9395             }
9396             PERL
9397             # NOTE: plan_list()
9398             plan_list => <<'PERL',
9399             sub plan_list
9400             {
9401             my $self = shift( @_ );
9402             my $args = $self->_get_args( @_ );
9403             if( $self->_is_object( $args->{product} ) && $args->{product}->isa( 'Net::API::Stripe::Product' ) )
9404             {
9405             my $prod_hash = $args->{product}->as_hash({ json => 1 });
9406             $args->{product} = $prod_hash->{id} ? $prod_hash->{id} : undef();
9407             }
9408             my $okParams =
9409             {
9410             expandable => { allowed => $EXPANDABLES->{plan}, data_prefix_is_ok => 1 },
9411             active => { type => "boolean" },
9412             created => { re => qr/^\d+$/, type => "timestamp" },
9413             'created.gt' => { re => qr/^\d+$/ },
9414             'created.gte' => { re => qr/^\d+$/ },
9415             'created.lt' => { re => qr/^\d+$/ },
9416             'created.lte' => { re => qr/^\d+$/ },
9417             ending_before => { type => "string" },
9418             limit => { re => qr/^\d+$/, type => "string" },
9419             product => { re => qr/^\w+$/, type => "string" },
9420             starting_after => { type => "string" },
9421             };
9422              
9423             foreach my $bool ( qw( active ) )
9424             {
9425             next if( !CORE::length( $args->{ $bool } ) );
9426             $args->{ $bool } = ( $args->{ $bool } eq 'true' || ( $args->{ $bool } ne 'false' && $args->{ $bool } ) ) ? 'true' : 'false';
9427             }
9428             my $err = $self->_check_parameters( $okParams, $args );
9429             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
9430             if( $args->{expand} )
9431             {
9432             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
9433             }
9434             my $hash = $self->get( 'plans', $args ) || CORE::return( $self->pass_error );
9435             CORE::return( $self->_response_to_object( 'Net::API::Stripe::List', $hash ) );
9436             }
9437             PERL
9438             # NOTE: plan_retrieve()
9439             plan_retrieve => <<'PERL',
9440             sub plan_retrieve
9441             {
9442             my $self = shift( @_ );
9443             CORE::return( $self->error( "No parameters were provided to retrieve plan information." ) ) if( !scalar( @_ ) );
9444             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Billing::Plan', @_ );
9445             my $okParams =
9446             {
9447             expandable => { allowed => $EXPANDABLES->{plan} },
9448             id => { re => qr/^\w+$/, required => 1 }
9449             };
9450             my $err = $self->_check_parameters( $okParams, $args );
9451             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
9452             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No plan id was provided to retrieve its information." ) );
9453             my $hash = $self->get( "plans/${id}", $args ) || CORE::return( $self->pass_error );
9454             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::Plan', $hash ) );
9455             }
9456             PERL
9457             # NOTE: plan_update()
9458             plan_update => <<'PERL',
9459             # https://stripe.com/docs/api/customers/update?lang=curl
9460             sub plan_update
9461             {
9462             my $self = shift( @_ );
9463             CORE::return( $self->error( "No parameters were provided to update a plan" ) ) if( !scalar( @_ ) );
9464             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Billing::Plan', @_ );
9465             if( $self->_is_object( $args->{product} ) && $args->{product}->isa( 'Net::API::Stripe::Product' ) )
9466             {
9467             $args->{product} = $args->{product}->id;
9468             }
9469             my $okParams =
9470             {
9471             expandable => { allowed => $EXPANDABLES->{plan} },
9472             active => { re => qr/^(?:true|False)$/, type => "boolean" },
9473             id => { required => 1 },
9474             metadata => { type => "hash" },
9475             nickname => { type => "string" },
9476             product => { re => qr/^\w+$/, type => "string" },
9477             trial_period_days => { type => "integer" },
9478             };
9479              
9480             $args = $self->_contract( 'plan', $args ) || CORE::return( $self->pass_error );
9481             # We found some errors
9482             my $err = $self->_check_parameters( $okParams, $args );
9483             # $self->message( 3, "Data to be posted: ", $self->dumper( $args ) ); exit;
9484             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
9485             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No plan id was provided to update plan's details" ) );
9486             my $hash = $self->post( "plans/${id}", $args ) || CORE::return( $self->pass_error );
9487             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::Plan', $hash ) );
9488             }
9489             PERL
9490             # NOTE: plans()
9491             plans => <<'PERL',
9492             sub plans
9493             {
9494             my $self = shift( @_ );
9495             my $action = shift( @_ );
9496             my $allowed = [qw( create retrieve update list delete )];
9497             my $meth = $self->_get_method( 'plan', $action, $allowed ) || CORE::return( $self->pass_error );
9498             CORE::return( $self->$meth( @_ ) );
9499             }
9500             PERL
9501             # NOTE: portal_configuration()
9502             portal_configuration => <<'PERL',
9503             sub portal_configuration { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Billing::Plan', @_ ) ); }
9504             PERL
9505             # NOTE: portal_configuration_create()
9506             portal_configuration_create => <<'PERL',
9507             sub portal_configuration_create
9508             {
9509             my $self = shift( @_ );
9510             CORE::return( $self->error( "No parameters were provided to create a portal configuration" ) ) if( !scalar( @_ ) );
9511             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Billing::PortalConfiguration', @_ );
9512             my $okParams =
9513             {
9514             expandable => { allowed => $EXPANDABLES->{portal_configuration} },
9515             business_profile => { fields => [qw( headline privacy_policy_url terms_of_service_url )], required => 1 },
9516             default_return_url => { type => 'utl' },
9517             features => { fields => [qw(
9518             customer_update.enabled!
9519             customer_update.allowed_updates
9520             invoice_history.enabled!
9521             payment_method_update.enabled!
9522             subscription_cancel.enabled!
9523             subscription_cancel.cancellation_reason.enabled!
9524             subscription_cancel.cancellation_reason.options!
9525             subscription_cancel.mode
9526             subscription_cancel.proration_behavior
9527             subscription_pause.enabled
9528             subscription_update.default_allowed_updates!
9529             subscription_update.enabled!
9530             subscription_update.products!
9531             subscription_update.proration_behavior
9532             )], required => 1 },
9533             metadata => { type => 'hash' },
9534             };
9535             $args = $self->_contract( 'portal_configuration', $args ) || CORE::return( $self->pass_error );
9536             my $err = $self->_check_parameters( $okParams, $args );
9537             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
9538             my $hash = $self->post( 'billing_portal/configurations', $args ) || CORE::return( $self->pass_error );
9539             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::PortalConfiguration', $hash ) );
9540             }
9541             PERL
9542             # NOTE: portal_configuration_list()
9543             portal_configuration_list => <<'PERL',
9544             sub portal_configuration_list
9545             {
9546             my $self = shift( @_ );
9547             my $args = $self->_get_args( @_ );
9548             my $okParams =
9549             {
9550             expandable => { allowed => $EXPANDABLES->{portal_configuration}, data_prefix_is_ok => 1 },
9551             active => { type => 'boolean' },
9552             is_default => { type => 'boolean' },
9553             # "A cursor for use in pagination. ending_before is an object ID that defines your place in the list."
9554             ending_before => {},
9555             limit => { re => qr/^\d+$/ },
9556             starting_after => {},
9557             };
9558             my $err = $self->_check_parameters( $okParams, $args );
9559             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
9560             if( $args->{expand} )
9561             {
9562             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
9563             }
9564             my $hash = $self->get( 'billing_portal/configurations', $args ) || CORE::return( $self->pass_error );
9565             CORE::return( $self->_response_to_object( 'Net::API::Stripe::List', $hash ) );
9566             }
9567             PERL
9568             # NOTE: portal_configuration_retrieve()
9569             portal_configuration_retrieve => <<'PERL',
9570             sub portal_configuration_retrieve
9571             {
9572             my $self = shift( @_ );
9573             CORE::return( $self->error( "No parameters were provided to retrieve the portal configuration." ) ) if( !scalar( @_ ) );
9574             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Billing::PortalConfiguration', @_ );
9575             my $okParams =
9576             {
9577             expandable => { allowed => $EXPANDABLES->{portal_configuration} },
9578             id => { re => qr/^\w+$/, required => 1 }
9579             };
9580             my $err = $self->_check_parameters( $okParams, $args );
9581             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
9582             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No portal configuration id was provided to retrieve its information." ) );
9583             my $hash = $self->get( "billing_portal/configurations/${id}", $args ) || CORE::return( $self->pass_error );
9584             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::PortalConfiguration', $hash ) );
9585             }
9586             PERL
9587             # NOTE: portal_configuration_update()
9588             portal_configuration_update => <<'PERL',
9589             # https://stripe.com/docs/api/customers/update?lang=curl
9590             sub portal_configuration_update
9591             {
9592             my $self = shift( @_ );
9593             CORE::return( $self->error( "No parameters were provided to update a portal configuration" ) ) if( !scalar( @_ ) );
9594             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Billing::PortalConfiguration', @_ );
9595             my $okParams =
9596             {
9597             expandable => { allowed => $EXPANDABLES->{portal_configuration} },
9598             id => { required => 1 },
9599             active => { type => 'boolean' },
9600             business_profile => { fields => [qw( headline privacy_policy_url terms_of_service_url )] },
9601             default_return_url => { type => 'utl' },
9602             features => { fields => [qw(
9603             customer_update.enabled customer_update.allowed_updates
9604             invoice_history.enabled!
9605             payment_method_update.enabled!
9606             subscription_cancel.enabled
9607             subscription_cancel.cancellation_reason.enabled!
9608             subscription_cancel.cancellation_reason.options
9609             subscription_cancel.mode
9610             subscription_cancel.proration_behavior
9611             subscription_pause.enabled
9612             subscription_update.default_allowed_updates
9613             subscription_update.enabled
9614             subscription_update.products
9615             subscription_update.proration_behavior
9616             )] },
9617             metadata => { type => 'hash' },
9618             };
9619             $args = $self->_contract( 'portal_configuration', $args ) || CORE::return( $self->pass_error );
9620             # We found some errors
9621             my $err = $self->_check_parameters( $okParams, $args );
9622             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
9623             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No portal configuration id was provided to update its information." ) );
9624             my $hash = $self->post( "billing_portal/configurations/${id}", $args ) || CORE::return( $self->pass_error );
9625             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::PortalConfiguration', $hash ) );
9626             }
9627             PERL
9628             # NOTE: portal_configurations()
9629             portal_configurations => <<'PERL',
9630             sub portal_configurations
9631             {
9632             my $self = shift( @_ );
9633             my $action = shift( @_ );
9634             my $allowed = [qw( create retrieve update list )];
9635             my $meth = $self->_get_method( 'plan', $action, $allowed ) || CORE::return( $self->pass_error );
9636             CORE::return( $self->$meth( @_ ) );
9637             }
9638             PERL
9639             # NOTE: portal_session()
9640             portal_session => <<'PERL',
9641             sub portal_session { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Billing::PortalSession', @_ ) ); }
9642             PERL
9643             # NOTE: portal_session_create()
9644             portal_session_create => <<'PERL',
9645             sub portal_session_create
9646             {
9647             my $self = shift( @_ );
9648             CORE::return( $self->error( "No parameters were provided to create a portal session" ) ) if( !scalar( @_ ) );
9649             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Billing::PortalSession', @_ );
9650             my $okParams =
9651             {
9652             expandable => { allowed => $EXPANDABLES->{portal_session} },
9653             customer => { re => qr/^\w+$/, required => 1 },
9654             configuration => { re => qr/^\w+$/ },
9655             locale => {},
9656             on_behalf_of => { re => qr/^\w+$/ },
9657             return_url => { type => 'url' },
9658             };
9659             $args = $self->_contract( 'portal_session', $args ) || CORE::return( $self->pass_error );
9660             my $err = $self->_check_parameters( $okParams, $args );
9661             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
9662             my $hash = $self->post( 'billing_portal/sessions', $args ) || CORE::return( $self->pass_error );
9663             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::PortalSession', $hash ) );
9664             }
9665             PERL
9666             # NOTE: portal_sessions()
9667             portal_sessions => <<'PERL',
9668             sub portal_sessions
9669             {
9670             my $self = shift( @_ );
9671             my $action = shift( @_ );
9672             my $allowed = [qw( create )];
9673             my $meth = $self->_get_method( 'plan', $action, $allowed ) || CORE::return( $self->pass_error );
9674             CORE::return( $self->$meth( @_ ) );
9675             }
9676             PERL
9677             # NOTE: price()
9678             price => <<'PERL',
9679             sub price { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Price', @_ ) ); }
9680             PERL
9681             # NOTE: price_create()
9682             price_create => <<'PERL',
9683             sub price_create
9684             {
9685             my $self = shift( @_ );
9686             CORE::return( $self->error( "No parameters were provided to create a price" ) ) if( !scalar( @_ ) );
9687             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Price', @_ );
9688             my $obj = $args->{_object};
9689             if( $self->_is_object( $args->{product} ) && $args->{product}->isa( 'Net::API::Stripe::Product' ) )
9690             {
9691             my $prod_hash = $args->{product}->as_hash({ json => 1 });
9692             $args->{product} = $prod_hash;
9693             }
9694             #exit;
9695             my $okParams =
9696             {
9697             expandable => { allowed => $EXPANDABLES->{price} },
9698             active => { type => "boolean" },
9699             billing_scheme => { type => "string" },
9700             currency => { required => 1, type => "string" },
9701             currency_options => { type => "hash" },
9702             custom_unit_amount => { type => "hash" },
9703             id => {},
9704             lookup_key => { type => "string" },
9705             metadata => { type => "hash" },
9706             nickname => { type => "string" },
9707             product => { required => 1, type => "string" },
9708             product_data => {
9709             fields => [
9710             "id",
9711             "name",
9712             "active",
9713             "metadata",
9714             "statement_descriptor",
9715             "unit_label",
9716             ],
9717             type => "object",
9718             },
9719             recurring => {
9720             fields => [
9721             "interval",
9722             "aggregate_usage",
9723             "interval_count",
9724             "trial_period_days",
9725             "usage_type",
9726             ],
9727             type => "hash",
9728             },
9729             tax_behavior => { type => "string" },
9730             tiers => {
9731             fields => [
9732             "up_to",
9733             "flat_amount",
9734             "flat_amount_decimal",
9735             "unit_amount",
9736             "unit_amount_decimal",
9737             ],
9738             type => "array",
9739             },
9740             tiers_mode => { re => qr/^(graduated|volume)$/, type => "string" },
9741             transfer_lookup_key => { type => "boolean" },
9742             transform_quantity => { fields => ["divide_by", "round"], type => "hash" },
9743             unit_amount => { required => 1, type => "integer" },
9744             unit_amount_decimal => { type => "decimal" },
9745             };
9746              
9747             $args = $self->_contract( 'price', $args ) || CORE::return( $self->pass_error );
9748             my $err = $self->_check_parameters( $okParams, $args );
9749             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
9750             my $hash = $self->post( 'prices', $args ) || CORE::return( $self->pass_error );
9751             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Price', $hash ) );
9752             }
9753             PERL
9754             # NOTE: price_list()
9755             price_list => <<'PERL',
9756             sub price_list
9757             {
9758             my $self = shift( @_ );
9759             my $args = $self->_get_args( @_ );
9760             if( $self->_is_object( $args->{product} ) && $args->{product}->isa( 'Net::API::Stripe::Product' ) )
9761             {
9762             my $prod_hash = $args->{product}->as_hash({ json => 1 });
9763             $args->{product} = $prod_hash->{id} ? $prod_hash->{id} : undef();
9764             }
9765             my $okParams =
9766             {
9767             expandable => { allowed => $EXPANDABLES->{price}, data_prefix_is_ok => 1 },
9768             active => { type => "boolean" },
9769             created => { re => qr/^\d+$/, type => "timestamp" },
9770             'created.gt' => { re => qr/^\d+$/ },
9771             'created.gte' => { re => qr/^\d+$/ },
9772             'created.lt' => { re => qr/^\d+$/ },
9773             'created.lte' => { re => qr/^\d+$/ },
9774             currency => { type => "string" },
9775             ending_before => { type => "string" },
9776             limit => { re => qr/^\d+$/, type => "string" },
9777             lookup_keys => { type => "string" },
9778             product => { re => qr/^\w+$/, type => "string" },
9779             recurring => { fields => ["interval", "usage_type"], type => "hash" },
9780             starting_after => { type => "string" },
9781             type => { type => "string" },
9782             };
9783              
9784             foreach my $bool ( qw( active ) )
9785             {
9786             next if( !CORE::length( $args->{ $bool } ) );
9787             $args->{ $bool } = ( $args->{ $bool } eq 'true' || ( $args->{ $bool } ne 'false' && $args->{ $bool } ) ) ? 'true' : 'false';
9788             }
9789             my $err = $self->_check_parameters( $okParams, $args );
9790             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
9791             if( $args->{expand} )
9792             {
9793             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
9794             }
9795             my $hash = $self->get( 'prices', $args ) || CORE::return( $self->pass_error );
9796             CORE::return( $self->_response_to_object( 'Net::API::Stripe::List', $hash ) );
9797             }
9798             PERL
9799             # NOTE: price_retrieve()
9800             price_retrieve => <<'PERL',
9801             sub price_retrieve
9802             {
9803             my $self = shift( @_ );
9804             CORE::return( $self->error( "No parameters were provided to retrieve price information." ) ) if( !scalar( @_ ) );
9805             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Price', @_ );
9806             my $okParams =
9807             {
9808             expandable => { allowed => $EXPANDABLES->{price} },
9809             id => { re => qr/^\w+$/, required => 1 }
9810             };
9811             my $err = $self->_check_parameters( $okParams, $args );
9812             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
9813             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No price id was provided to retrieve its information." ) );
9814             my $hash = $self->get( "prices/${id}", $args ) || CORE::return( $self->pass_error );
9815             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Price', $hash ) );
9816             }
9817             PERL
9818             # NOTE: price_search()
9819             price_search => <<'PERL',
9820             sub price_search
9821             {
9822             my $self = shift( @_ );
9823             CORE::return( $self->error( "No parameters were provided to search for a price information." ) ) if( !scalar( @_ ) );
9824             my $args = shift( @_ );
9825             my $okParams =
9826             {
9827             expandable => { allowed => $EXPANDABLES->{price}, data_prefix_is_ok => 1 },
9828             limit => qr/^\d+$/,
9829             page => qr/^\d+$/,
9830             query => { re => qr/^.*?$/, required => 1, type => "string" },
9831             };
9832              
9833             my $err = $self->_check_parameters( $okParams, $args );
9834             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
9835             if( $args->{expand} )
9836             {
9837             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
9838             }
9839             my $hash = $self->get( "prices/search", $args ) || CORE::return( $self->pass_error );
9840             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Product', $hash ) );
9841             }
9842             PERL
9843             # NOTE: price_update()
9844             price_update => <<'PERL',
9845             # https://stripe.com/docs/api/customers/update?lang=curl
9846             sub price_update
9847             {
9848             my $self = shift( @_ );
9849             CORE::return( $self->error( "No parameters were provided to update a price object" ) ) if( !scalar( @_ ) );
9850             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Price', @_ );
9851             if( $self->_is_object( $args->{product} ) && $args->{product}->isa( 'Net::API::Stripe::Product' ) )
9852             {
9853             $args->{product} = $args->{product}->id;
9854             }
9855             my $okParams =
9856             {
9857             expandable => { allowed => $EXPANDABLES->{price} },
9858             active => { re => qr/^(?:true|False)$/, type => "boolean" },
9859             currency_options => { type => "hash" },
9860             id => { required => 1 },
9861             lookup_key => { type => "string" },
9862             metadata => { type => "hash" },
9863             nickname => { type => "string" },
9864             recurring => {
9865             fields => [
9866             "interval",
9867             "aggregate_usage",
9868             "interval_count",
9869             "trial_period_days",
9870             "usage_type",
9871             ],
9872             },
9873             tax_behavior => { type => "string" },
9874             transfer_lookup_key => { type => "boolean" },
9875             };
9876              
9877             $args = $self->_contract( 'price', $args ) || CORE::return( $self->pass_error );
9878             # We found some errors
9879             my $err = $self->_check_parameters( $okParams, $args );
9880             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
9881             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No price id was provided to update price's details" ) );
9882             my $hash = $self->post( "prices/${id}", $args ) || CORE::return( $self->pass_error );
9883             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Price', $hash ) );
9884             }
9885             PERL
9886             # NOTE: prices()
9887             prices => <<'PERL',
9888             # <https://stripe.com/docs/api/prices>
9889             sub prices
9890             {
9891             my $self = shift( @_ );
9892             my $allowed = [qw( create list retrieve search update )];
9893             my $action = shift( @_ );
9894             my $meth = $self->_get_method( 'price', $action, $allowed ) || CORE::return( $self->pass_error );
9895             CORE::return( $self->$meth( @_ ) );
9896             }
9897             PERL
9898             # NOTE: product()
9899             product => <<'PERL',
9900             sub product { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Product', @_ ) ); }
9901             PERL
9902             # NOTE: product_by_name()
9903             product_by_name => <<'PERL',
9904             sub product_by_name
9905             {
9906             my $self = shift( @_ );
9907             my $args = $self->_get_args( @_ );
9908             my $name = CORE::delete( $args->{name} );
9909             my $nickname = CORE::delete( $args->{nickname} );
9910             my $list = $self->products( list => $args ) || CORE::return( $self->pass_error );
9911             my $objects = [];
9912             while( my $this = $list->next )
9913             {
9914             if( ( $name && $this->name eq $name ) ||
9915             ( $nickname && $this->nickname eq $nickname ) )
9916             {
9917             CORE::push( @$objects, $this );
9918             }
9919             }
9920             CORE::return( $objects );
9921             }
9922             PERL
9923             # NOTE: product_create()
9924             product_create => <<'PERL',
9925             sub product_create
9926             {
9927             my $self = shift( @_ );
9928             CORE::return( $self->error( "No parameters were provided to create a product" ) ) if( !scalar( @_ ) );
9929             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Product', @_ );
9930             my $okParams =
9931             {
9932             expandable => { allowed => $EXPANDABLES->{product} },
9933             active => { type => "boolean" },
9934             attributes => sub { ... },
9935             caption => {},
9936             deactivate_on => { type => "array" },
9937             default_price_data => { type => "object" },
9938             description => { type => "string" },
9939             id => { type => "string" },
9940             images => sub { ... },
9941             metadata => { type => "hash" },
9942             name => { required => 1, type => "string" },
9943             package_dimensions => { type => "hash" },
9944             shippable => { type => "boolean" },
9945             statement_descriptor => { type => "string" },
9946             tax_code => { type => "string" },
9947             type => { re => qr/^(good|service)$/, required => 1 },
9948             unit_label => { type => "string" },
9949             url => { type => "string" },
9950             };
9951              
9952             $args = $self->_contract( 'product', $args ) || CORE::return( $self->pass_error );
9953             my $err = $self->_check_parameters( $okParams, $args );
9954             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
9955             my $hash = $self->post( 'products', $args ) || CORE::return( $self->pass_error );
9956             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Product', $hash ) );
9957             }
9958             PERL
9959             # NOTE: product_delete()
9960             product_delete => <<'PERL',
9961             # https://stripe.com/docs/api/customers/delete?lang=curl
9962             # "Permanently deletes a customer. It cannot be undone. Also immediately cancels any active subscriptions on the customer."
9963             sub product_delete
9964             {
9965             my $self = shift( @_ );
9966             CORE::return( $self->error( "No parameters were provided to delete product information." ) ) if( !scalar( @_ ) );
9967             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Product', @_ );
9968             my $okParams =
9969             {
9970             expandable => { allowed => $EXPANDABLES->{product} },
9971             id => { re => qr/^\w+$/, required => 1 }
9972             };
9973             my $err = $self->_check_parameters( $okParams, $args );
9974             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
9975             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No product id was provided to delete its information." ) );
9976             my $hash = $self->delete( "products/${id}", $args ) || CORE::return( $self->pass_error );
9977             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Product', $hash ) );
9978             }
9979             PERL
9980             # NOTE: product_list()
9981             product_list => <<'PERL',
9982             sub product_list
9983             {
9984             my $self = shift( @_ );
9985             my $args = $self->_get_args( @_ );
9986             my $okParams =
9987             {
9988             expandable => { allowed => $EXPANDABLES->{product}, data_prefix_is_ok => 1 },
9989             active => { type => "boolean" },
9990             created => { re => qr/^\d+$/, type => "timestamp" },
9991             'created.gt' => { re => qr/^\d+$/ },
9992             'created.gte' => { re => qr/^\d+$/ },
9993             'created.lt' => { re => qr/^\d+$/ },
9994             'created.lte' => { re => qr/^\d+$/ },
9995             ending_before => { type => "string" },
9996             ids => { type => "array" },
9997             limit => { re => qr/^\d+$/, type => "string" },
9998             shippable => { type => "boolean" },
9999             starting_after => { type => "string" },
10000             type => {},
10001             url => { type => "string" },
10002             };
10003              
10004             my $err = $self->_check_parameters( $okParams, $args );
10005             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
10006             if( $args->{expand} )
10007             {
10008             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
10009             }
10010             my $hash = $self->get( 'products', $args ) || CORE::return( $self->pass_error );
10011             CORE::return( $self->_response_to_object( 'Net::API::Stripe::List', $hash ) );
10012             }
10013             PERL
10014             # NOTE: product_retrieve()
10015             product_retrieve => <<'PERL',
10016             sub product_retrieve
10017             {
10018             my $self = shift( @_ );
10019             CORE::return( $self->error( "No parameters were provided to retrieve product information." ) ) if( !scalar( @_ ) );
10020             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Product', @_ );
10021             my $okParams =
10022             {
10023             expandable => { allowed => $EXPANDABLES->{product} },
10024             id => { re => qr/^\w+$/, required => 1 }
10025             };
10026             my $err = $self->_check_parameters( $okParams, $args );
10027             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
10028             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No product id was provided to retrieve its information." ) );
10029             my $hash = $self->get( "products/${id}", $args ) || CORE::return( $self->pass_error );
10030             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Product', $hash ) );
10031             }
10032             PERL
10033             # NOTE: product_search()
10034             product_search => <<'PERL',
10035             sub product_search
10036             {
10037             my $self = shift( @_ );
10038             CORE::return( $self->error( "No parameters were provided to search for a product information." ) ) if( !scalar( @_ ) );
10039             my $args = shift( @_ );
10040             my $okParams =
10041             {
10042             expandable => { allowed => $EXPANDABLES->{product}, data_prefix_is_ok => 1 },
10043             limit => qr/^\d+$/,
10044             page => qr/^\d+$/,
10045             query => { re => qr/^.*?$/, required => 1, type => "string" },
10046             };
10047              
10048             my $err = $self->_check_parameters( $okParams, $args );
10049             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
10050             if( $args->{expand} )
10051             {
10052             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
10053             }
10054             my $hash = $self->get( "products/search", $args ) || CORE::return( $self->pass_error );
10055             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Product', $hash ) );
10056             }
10057             PERL
10058             # NOTE: product_update()
10059             product_update => <<'PERL',
10060             # https://stripe.com/docs/api/customers/update?lang=curl
10061             sub product_update
10062             {
10063             my $self = shift( @_ );
10064             CORE::return( $self->error( "No parameters were provided to update a product" ) ) if( !scalar( @_ ) );
10065             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Product', @_ );
10066             my $okParams =
10067             {
10068             expandable => { allowed => $EXPANDABLES->{product} },
10069             HASH(0x55bef17244e8) => "type",
10070             HASH(0x55bef172f668) => undef,
10071             HASH(0x55bef17416b8) => "unit_label",
10072             HASH(0x55bef174e1e8) => "statement_descriptor",
10073             HASH(0x55bef17598f0) => "url",
10074             HASH(0x55bef27d6400) => "shippable",
10075             active => { type => "boolean" },
10076             attributes => sub { ... },
10077             caption => {},
10078             deactivate_on => { type => "array" },
10079             default_price => { type => "string" },
10080             description => { type => "string" },
10081             id => { re => qr/^\w+$/, required => 1 },
10082             images => sub { ... },
10083             metadata => { type => "hash" },
10084             name => "HASH(0x55bef173a200)package_dimensions",
10085             package_dimensions => { type => "hash" },
10086             shippable => { type => "boolean" },
10087             statement_descriptor => { type => "string" },
10088             tax_code => { type => "string" },
10089             unit_label => { type => "string" },
10090             url => { type => "string" },
10091             };
10092              
10093             $args = $self->_contract( 'product', $args ) || CORE::return( $self->pass_error );
10094             # We found some errors
10095             my $err = $self->_check_parameters( $okParams, $args );
10096             # $self->message( 3, "Data to be posted: ", $self->dumper( $args ) ); exit;
10097             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
10098             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No product id was provided to update product's details" ) );
10099             my $hash = $self->post( "products/${id}", $args ) || CORE::return( $self->pass_error );
10100             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Product', $hash ) );
10101             }
10102             PERL
10103             # NOTE: products()
10104             products => <<'PERL',
10105             sub products
10106             {
10107             my $self = shift( @_ );
10108             my $action = shift( @_ );
10109             my $allowed = [qw( create retrieve update list delete search )];
10110             my $meth = $self->_get_method( 'product', $action, $allowed ) || CORE::return( $self->pass_error );
10111             CORE::return( $self->$meth( @_ ) );
10112             }
10113             PERL
10114             # NOTE: promotion_code()
10115             promotion_code => <<'PERL',
10116             sub promotion_code { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Product::PromotionCode', @_ ) ); }
10117             PERL
10118             # NOTE: promotion_code_create()
10119             promotion_code_create => <<'PERL',
10120             sub promotion_code_create
10121             {
10122             my $self = shift( @_ );
10123             CORE::return( $self->error( "No parameters were provided to create a promotion code" ) ) if( !scalar( @_ ) );
10124             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Product::PromotionCode', @_ );
10125             my $okParams =
10126             {
10127             expandable => { allowed => $EXPANDABLES->{promotion_code} },
10128             active => { type => "boolean" },
10129             code => { re => qr/^.*?$/, type => "string" },
10130             coupon => { re => qr/^\w+$/, required => 1, type => "hash" },
10131             customer => { re => qr/^\w+$/, type => "string" },
10132             expires_at => { type => "timestamp" },
10133             max_redemptions => { type => "integer" },
10134             metadata => { type => "hash" },
10135             restrictions => {
10136             fields => [
10137             "restrictions.first_time_transaction",
10138             "restrictions.minimum_amount",
10139             "restrictions.minimum_amount_currency",
10140             ],
10141             type => "hash",
10142             },
10143             };
10144              
10145             $args = $self->_contract( 'promotion_code', $args ) || CORE::return( $self->pass_error );
10146             my $err = $self->_check_parameters( $okParams, $args );
10147             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
10148             my $hash = $self->post( 'promotion_codes', $args ) || CORE::return( $self->pass_error );
10149             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Product::PromotionCode', $hash ) );
10150             }
10151             PERL
10152             # NOTE: promotion_code_list()
10153             promotion_code_list => <<'PERL',
10154             sub promotion_code_list
10155             {
10156             my $self = shift( @_ );
10157             my $args = shift( @_ );
10158             my $okParams =
10159             {
10160             expandable => { allowed => $EXPANDABLES->{promotion_code}, data_prefix_is_ok => 1 },
10161             active => { type => "boolean" },
10162             code => { re => qr/^.*?$/, type => "string" },
10163             coupon => { re => qr/^\w+$/, type => "hash" },
10164             created => qr/^\d+$/,
10165             'created.gt' => qr/^\d+$/,
10166             'created.gte' => qr/^\d+$/,
10167             'created.lt' => qr/^\d+$/,
10168             'created.lte' => qr/^\d+$/,
10169             customer => { re => qr/^\w+$/, type => "string" },
10170             ending_before => qr/^\w+$/,
10171             limit => qr/^\d+$/,
10172             starting_after => qr/^\w+$/,
10173             };
10174              
10175             my $err = $self->_check_parameters( $okParams, $args );
10176             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
10177             if( $args->{expand} )
10178             {
10179             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
10180             }
10181             my $hash = $self->get( 'promotion_codes', $args ) || CORE::return( $self->pass_error );
10182             CORE::return( $self->_response_to_object( 'Net::API::Stripe::List', $hash ) );
10183             }
10184             PERL
10185             # NOTE: promotion_code_retrieve()
10186             promotion_code_retrieve => <<'PERL',
10187             sub promotion_code_retrieve
10188             {
10189             my $self = shift( @_ );
10190             CORE::return( $self->error( "No parameters were provided to retrieve promotion code information." ) ) if( !scalar( @_ ) );
10191             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Product::PromotionCode', @_ );
10192             my $okParams =
10193             {
10194             expandable => { allowed => $EXPANDABLES->{promotion_code} },
10195             id => { re => qr/^\S+$/, required => 1 }
10196             };
10197             my $err = $self->_check_parameters( $okParams, $args );
10198             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
10199             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No promotion code id was provided to retrieve its information." ) );
10200             my $hash = $self->get( "promotion_codes/${id}", $args ) || CORE::return( $self->pass_error );
10201             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Product::PromotionCode', $hash ) );
10202             }
10203             PERL
10204             # NOTE: promotion_code_update()
10205             promotion_code_update => <<'PERL',
10206             sub promotion_code_update
10207             {
10208             my $self = shift( @_ );
10209             CORE::return( $self->error( "No parameters were provided to update a promotion code" ) ) if( !scalar( @_ ) );
10210             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Product::PromotionCode', @_ );
10211             my $okParams =
10212             {
10213             expandable => { allowed => $EXPANDABLES->{promotion_code} },
10214             active => { type => "boolean" },
10215             id => { re => qr/^\S+$/, required => 1 },
10216             metadata => { type => "hash" },
10217             restrictions => { type => "hash" },
10218             };
10219              
10220             $args = $self->_contract( 'promotion_code', $args ) || CORE::return( $self->pass_error );
10221             # We found some errors
10222             my $err = $self->_check_parameters( $okParams, $args );
10223             # $self->message( 3, "Data to be posted: ", $self->dumper( $args ) ); exit;
10224             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
10225             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No promotion code id was provided to update its details" ) );
10226             my $hash = $self->post( "promotion_codes/${id}", $args ) || CORE::return( $self->pass_error );
10227             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Product::PromotionCode', $hash ) );
10228             }
10229             PERL
10230             # NOTE: promotion_codes()
10231             promotion_codes => <<'PERL',
10232             sub promotion_codes
10233             {
10234             my $self = shift( @_ );
10235             my $action = shift( @_ );
10236             my $allowed = [qw( create retrieve update list )];
10237             my $meth = $self->_get_method( 'promotion_code', $action, $allowed ) || CORE::return( $self->pass_error );
10238             CORE::return( $self->$meth( @_ ) );
10239             }
10240             PERL
10241             # NOTE: quote()
10242             quote => <<'PERL',
10243             sub quote { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Billing::Quote', @_ ) ); }
10244             PERL
10245             # NOTE: quote_accept()
10246             quote_accept => <<'PERL',
10247             sub quote_accept
10248             {
10249             my $self = shift( @_ );
10250             CORE::return( $self->error( "No parameters were provided to accept a quote." ) ) if( !scalar( @_ ) );
10251             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Billing::Quote', @_ );
10252             my $okParams =
10253             {
10254             expandable => { allowed => $EXPANDABLES->{quote} },
10255             id => { re => qr/^\w+$/, required => 1 },
10256             };
10257             my $err = $self->_check_parameters( $okParams, $args );
10258             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
10259             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No quote id was provided to accept it." ) );
10260             my $hash = $self->post( "quotes/${id}/accept", $args ) || CORE::return( $self->pass_error );
10261             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::Quote', $hash ) );
10262             }
10263             PERL
10264             # NOTE: quote_cancel()
10265             quote_cancel => <<'PERL',
10266             sub quote_cancel
10267             {
10268             my $self = shift( @_ );
10269             CORE::return( $self->error( "No parameters were provided to cancel a quote." ) ) if( !scalar( @_ ) );
10270             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Billing::Quote', @_ );
10271             my $okParams =
10272             {
10273             expandable => { allowed => $EXPANDABLES->{quote} },
10274             id => { re => qr/^\w+$/, required => 1 },
10275             };
10276             my $err = $self->_check_parameters( $okParams, $args );
10277             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
10278             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No quote id was provided to cancel it." ) );
10279             my $hash = $self->post( "quotes/${id}/cancel", $args ) || CORE::return( $self->pass_error );
10280             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::Quote', $hash ) );
10281             }
10282             PERL
10283             # NOTE: quote_create()
10284             quote_create => <<'PERL',
10285             sub quote_create
10286             {
10287             my $self = shift( @_ );
10288             CORE::return( $self->error( "No parameters were provided to create a quote" ) ) if( !scalar( @_ ) );
10289             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Billing::Quote', @_ );
10290             my $obj = $args->{_object};
10291             if( $self->_is_object( $args->{customer} ) && $args->{customer}->isa( 'Net::API::Stripe::Customer' ) )
10292             {
10293             $args->{customer} = $args->{customer}->id;
10294             }
10295             my $okParams =
10296             {
10297             expandable => { allowed => $EXPANDABLES->{quote} },
10298             application_fee_amount => { type => "integer" },
10299             application_fee_percent => { type => "decomal" },
10300             automatic_tax => { fields => ["enabled!"], type => "hash" },
10301             collection_method => { type => "string" },
10302             customer => { re => qr/^\w+$/, type => "string" },
10303             default_tax_rates => { type => "array" },
10304             description => { type => "string" },
10305             discounts => { fields => ["coupon", "discount"], type => "array" },
10306             expires_at => { type => "datetime" },
10307             footer => { type => "string" },
10308             from_quote => { fields => ["qoute!", "is_revision"], type => "hash" },
10309             header => { type => "string" },
10310             invoice_settings => { fields => ["days_until_due"], type => "hash" },
10311             line_items => {
10312             fields => [
10313             "price",
10314             "price_data",
10315             "price_data.currency!",
10316             "price_data.product!",
10317             "price_data.unit_amount_decimal!",
10318             "price_data.recurring.interval!",
10319             "price_data.recurring.interval_count",
10320             "price_data.tax_behavior",
10321             "price_data.unit_amount",
10322             "quantity",
10323             "tax_rates",
10324             ],
10325             type => "hash",
10326             },
10327             metadata => { type => "hash" },
10328             on_behalf_of => { re => qr/^\w+$/, type => "string" },
10329             subscription_data => { fields => ["effective_date", "trial_period_days"], type => "hash" },
10330             test_clock => { re => qr/^\w+$/, type => "string" },
10331             transfer_data => {
10332             fields => ["destination!", "amount", "amount_percent"],
10333             type => "hash",
10334             },
10335             };
10336              
10337             $args = $self->_contract( 'quote', $args ) || CORE::return( $self->pass_error );
10338             my $err = $self->_check_parameters( $okParams, $args );
10339             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
10340             my $hash = $self->post( 'quotes', $args ) || CORE::return( $self->pass_error );
10341             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::Quote', $hash ) );
10342             }
10343             PERL
10344             # NOTE: quote_download()
10345             quote_download => <<'PERL',
10346             sub quote_download
10347             {
10348             my $self = shift( @_ );
10349             CORE::return( $self->error( "No parameters were provided to download quote as pdf." ) ) if( !scalar( @_ ) );
10350             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Billing::Quote', @_ );
10351             my $okParams =
10352             {
10353             expandable => { allowed => $EXPANDABLES->{quote} },
10354             id => { re => qr/^\w+$/, required => 1 }
10355             };
10356             my $err = $self->_check_parameters( $okParams, $args );
10357             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
10358             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No quote id was provided to download it as pdf." ) );
10359             $args->{_file_api} = 1;
10360             my $hash = $self->get( "quotes/${id}/pdf", $args ) || CORE::return( $self->pass_error );
10361             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::Quote', $hash ) );
10362             }
10363             PERL
10364             # NOTE: quote_finalize()
10365             quote_finalize => <<'PERL',
10366             sub quote_finalize
10367             {
10368             my $self = shift( @_ );
10369             CORE::return( $self->error( "No parameters were provided to finalize a quote." ) ) if( !scalar( @_ ) );
10370             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Billing::Quote', @_ );
10371             my $okParams =
10372             {
10373             expandable => { allowed => $EXPANDABLES->{quote} },
10374             id => { re => qr/^\w+$/, required => 1 },
10375             expires_at => { type => 'datetime' },
10376             };
10377             my $err = $self->_check_parameters( $okParams, $args );
10378             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
10379             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No quote id was provided to finalize it." ) );
10380             my $hash = $self->post( "quotes/${id}/finalize", $args ) || CORE::return( $self->pass_error );
10381             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::Quote', $hash ) );
10382             }
10383             PERL
10384             # NOTE: quote_line_items()
10385             quote_line_items => <<'PERL',
10386             sub quote_line_items
10387             {
10388             my $self = shift( @_ );
10389             CORE::return( $self->error( "No parameters were provided to line_items quote information." ) ) if( !scalar( @_ ) );
10390             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Billing::Quote', @_ );
10391             my $okParams =
10392             {
10393             expandable => { allowed => $EXPANDABLES->{ 'quote' }, data_prefix_is_ok => 1 },
10394             ending_before => { type => "string" },
10395             limit => { type => "string" },
10396             starting_after => { type => "string" },
10397             };
10398             my $err = $self->_check_parameters( $okParams, $args );
10399             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
10400             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No quote id (with parameter 'id') was provided to line_items its information." ) );
10401             my $hash = $self->get( "quotes/${id}/line_items", $args ) || CORE::return( $self->pass_error );
10402             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::Quote', $hash ) );
10403             }
10404             PERL
10405             # NOTE: quote_lines()
10406             quote_lines => <<'PERL',
10407             sub quote_lines
10408             {
10409             my $self = shift( @_ );
10410             CORE::return( $self->error( "No parameters were provided to retrieve a quote line items." ) ) if( !scalar( @_ ) );
10411             my $args = $self->_get_args_as_hash( @_ );
10412             if( $self->_is_object( $args->{quote} ) && $args->{quote}->isa( 'Net::API::Stripe::Billing::Quote' ) )
10413             {
10414             $args->{id} = $args->{quote}->id;
10415             }
10416             my $okParams =
10417             {
10418             expandable => { allowed => $EXPANDABLES->{quote} },
10419             id => { re => qr/^\w+$/, required => 1 },
10420             ending_before => {},
10421             limit => { re => qr/^\d+$/ },
10422             starting_after => {},
10423             };
10424             my $err = $self->_check_parameters( $okParams, $args );
10425             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
10426             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No quote id was provided to retrieve its line items." ) );
10427             my $hash = $self->get( "quotes/${id}/line_items", $args ) || CORE::return( $self->pass_error );
10428             CORE::return( $self->_response_to_object( 'Net::API::Stripe::List', $hash ) );
10429             }
10430             PERL
10431             # NOTE: quote_list()
10432             quote_list => <<'PERL',
10433             sub quote_list
10434             {
10435             my $self = shift( @_ );
10436             my $args = $self->_get_args( @_ );
10437             if( $self->_is_object( $args->{customer} ) && $args->{customer}->isa( 'Net::API::Stripe::Customer' ) )
10438             {
10439             $args->{customer} = $args->{customer}->id;
10440             }
10441             my $okParams =
10442             {
10443             expandable => { allowed => $EXPANDABLES->{quote}, data_prefix_is_ok => 1 },
10444             customer => { re => qr/^\w+$/, type => "string" },
10445             ending_before => { type => "string" },
10446             limit => { re => qr/^\d+$/, type => "string" },
10447             starting_after => { type => "string" },
10448             status => { type => "string" },
10449             test_clock => { type => "string" },
10450             };
10451              
10452             my $err = $self->_check_parameters( $okParams, $args );
10453             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
10454             if( $args->{expand} )
10455             {
10456             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
10457             }
10458             my $hash = $self->get( 'quotes', $args ) || CORE::return( $self->pass_error );
10459             CORE::return( $self->_response_to_object( 'Net::API::Stripe::List', $hash ) );
10460             }
10461             PERL
10462             # NOTE: quote_retrieve()
10463             quote_retrieve => <<'PERL',
10464             sub quote_retrieve
10465             {
10466             my $self = shift( @_ );
10467             CORE::return( $self->error( "No parameters were provided to retrieve quote information." ) ) if( !scalar( @_ ) );
10468             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Billing::Quote', @_ );
10469             my $okParams =
10470             {
10471             expandable => { allowed => $EXPANDABLES->{quote} },
10472             id => { re => qr/^\w+$/, required => 1 }
10473             };
10474             my $err = $self->_check_parameters( $okParams, $args );
10475             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
10476             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No quote id was provided to retrieve its information." ) );
10477             my $hash = $self->get( "quotes/${id}", $args ) || CORE::return( $self->pass_error );
10478             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::Quote', $hash ) );
10479             }
10480             PERL
10481             # NOTE: quote_update()
10482             quote_update => <<'PERL',
10483             # https://stripe.com/docs/api/quotes/update
10484             sub quote_update
10485             {
10486             my $self = shift( @_ );
10487             CORE::return( $self->error( "No parameters were provided to update a quote" ) ) if( !scalar( @_ ) );
10488             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Billing::Quote', @_ );
10489             if( $self->_is_object( $args->{customer} ) && $args->{customer}->isa( 'Net::API::Stripe::Customer' ) )
10490             {
10491             $args->{customer} = $args->{customer}->id;
10492             }
10493             my $okParams =
10494             {
10495             expandable => { allowed => $EXPANDABLES->{quote} },
10496             application_fee_amount => { type => "integer" },
10497             application_fee_percent => { type => "decomal" },
10498             automatic_tax => { fields => ["enabled!"], type => "hash" },
10499             collection_method => { type => "string" },
10500             customer => { re => qr/^\w+$/, type => "string" },
10501             default_tax_rates => { type => "array" },
10502             description => { type => "string" },
10503             discounts => { fields => ["coupon", "discount"], type => "array" },
10504             expires_at => { type => "datetime" },
10505             footer => { type => "string" },
10506             from_quote => { fields => ["qoute!", "is_revision"] },
10507             header => { type => "string" },
10508             id => { required => 1 },
10509             invoice_settings => { fields => ["days_until_due"], type => "hash" },
10510             line_items => {
10511             fields => [
10512             "id",
10513             "price",
10514             "price_data",
10515             "price_data.currency!",
10516             "price_data.product!",
10517             "price_data.unit_amount_decimal!",
10518             "price_data.recurring.interval!",
10519             "price_data.recurring.interval_count",
10520             "price_data.tax_behavior",
10521             "price_data.unit_amount",
10522             "quantity",
10523             "tax_rates",
10524             ],
10525             type => "hash",
10526             },
10527             metadata => { type => "hash" },
10528             on_behalf_of => { re => qr/^\w+$/, type => "string" },
10529             subscription_data => { fields => ["effective_date", "trial_period_days"], type => "hash" },
10530             test_clock => { re => qr/^\w+$/ },
10531             transfer_data => {
10532             fields => ["destination!", "amount", "amount_percent"],
10533             type => "hash",
10534             },
10535             };
10536              
10537             $args = $self->_contract( 'quote', $args ) || CORE::return( $self->pass_error );
10538             # We found some errors
10539             my $err = $self->_check_parameters( $okParams, $args );
10540             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
10541             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No quote id was provided to update quote's details" ) );
10542             my $hash = $self->post( "quotes/${id}", $args ) || CORE::return( $self->pass_error );
10543             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::Quote', $hash ) );
10544             }
10545             PERL
10546             # NOTE: quote_upfront_line_items()
10547             quote_upfront_line_items => <<'PERL',
10548             sub quote_upfront_line_items
10549             {
10550             my $self = shift( @_ );
10551             CORE::return( $self->error( "No parameters were provided to upfront_line_items quote information." ) ) if( !scalar( @_ ) );
10552             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Billing::Quote', @_ );
10553             my $okParams =
10554             {
10555             expandable => { allowed => $EXPANDABLES->{ 'quote' }, data_prefix_is_ok => 1 },
10556             ending_before => { type => "string" },
10557             limit => { type => "string" },
10558             starting_after => { type => "string" },
10559             };
10560             my $err = $self->_check_parameters( $okParams, $args );
10561             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
10562             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No quote id (with parameter 'id') was provided to upfront_line_items its information." ) );
10563             my $hash = $self->get( "quotes/${id}", $args ) || CORE::return( $self->pass_error );
10564             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::Quote', $hash ) );
10565             }
10566             PERL
10567             # NOTE: quote_upfront_lines()
10568             quote_upfront_lines => <<'PERL',
10569             sub quote_upfront_lines
10570             {
10571             my $self = shift( @_ );
10572             CORE::return( $self->error( "No parameters were provided to retrieve a quote upfront line items." ) ) if( !scalar( @_ ) );
10573             my $args = $self->_get_args_as_hash( @_ );
10574             if( $self->_is_object( $args->{quote} ) && $args->{quote}->isa( 'Net::API::Stripe::Billing::Quote' ) )
10575             {
10576             $args->{id} = $args->{quote}->id;
10577             }
10578             my $okParams =
10579             {
10580             expandable => { allowed => $EXPANDABLES->{quote} },
10581             id => { re => qr/^\w+$/, required => 1 },
10582             ending_before => {},
10583             limit => { re => qr/^\d+$/ },
10584             starting_after => {},
10585             };
10586             my $err = $self->_check_parameters( $okParams, $args );
10587             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
10588             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No quote id was provided to retrieve its upfront line items." ) );
10589             my $hash = $self->get( "quotes/${id}/computed_upfront_line_items", $args ) || CORE::return( $self->pass_error );
10590             CORE::return( $self->_response_to_object( 'Net::API::Stripe::List', $hash ) );
10591             }
10592             PERL
10593             # NOTE: quotes()
10594             quotes => <<'PERL',
10595             # <https://stripe.com/docs/api/quotes>
10596             sub quotes
10597             {
10598             my $self = shift( @_ );
10599             my $allowed = [qw( accept cancel create download finalize line_items lines list retrieve update upfront_line_items upfront_lines )];
10600             my $action = shift( @_ );
10601             my $meth = $self->_get_method( 'quote', $action, $allowed ) || CORE::return( $self->pass_error );
10602             CORE::return( $self->$meth( @_ ) );
10603             }
10604             PERL
10605             # NOTE: radar_early_fraud_warning()
10606             radar_early_fraud_warning => <<'PERL',
10607             sub radar_early_fraud_warning { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Fraud', @_ ) ); }
10608             PERL
10609             # NOTE: radar_early_fraud_warning_list()
10610             radar_early_fraud_warning_list => <<'PERL',
10611             sub radar_early_fraud_warning_list
10612             {
10613             my $self = shift( @_ );
10614             CORE::return( $self->error( "No parameters were provided to list radar early fraud warning information." ) ) if( !scalar( @_ ) );
10615             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Fraud', @_ );
10616             my $okParams =
10617             {
10618             expandable => { allowed => $EXPANDABLES->{ 'radar.early_fraud_warning' }, data_prefix_is_ok => 1 },
10619             charge => { type => "string" },
10620             ending_before => { type => "string" },
10621             limit => { type => "string" },
10622             payment_intent => { type => "string" },
10623             starting_after => { type => "string" },
10624             };
10625             my $err = $self->_check_parameters( $okParams, $args );
10626             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
10627             if( $args->{expand} )
10628             {
10629             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
10630             }
10631             my $hash = $self->get( "", $args ) || CORE::return( $self->pass_error );
10632             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Fraud', $hash ) );
10633             }
10634             PERL
10635             # NOTE: radar_early_fraud_warning_retrieve()
10636             radar_early_fraud_warning_retrieve => <<'PERL',
10637             sub radar_early_fraud_warning_retrieve
10638             {
10639             my $self = shift( @_ );
10640             my $args = shift( @_ );
10641             my $okParams =
10642             {
10643             expandable => { allowed => $EXPANDABLES->{ 'radar.early_fraud_warning' }, data_prefix_is_ok => 1 },
10644             };
10645             $args = $self->_contract( 'radar.early_fraud_warning', $args ) || CORE::return( $self->pass_error );
10646             my $err = $self->_check_parameters( $okParams, $args );
10647             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
10648             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." ) );
10649             my $hash = $self->get( "radar/early_fraud_warnings/${id}", $args ) || CORE::return( $self->pass_error );
10650             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Fraud', $hash ) );
10651             }
10652             PERL
10653             # NOTE: radar_early_fraud_warnings()
10654             radar_early_fraud_warnings => <<'PERL',
10655             # <https://stripe.com/docs/api/radar/early_fraud_warnings>
10656             sub radar_early_fraud_warnings
10657             {
10658             my $self = shift( @_ );
10659             my $allowed = [qw( list retrieve )];
10660             my $action = shift( @_ );
10661             my $meth = $self->_get_method( 'radar_early_fraud_warning', $action, $allowed ) || CORE::return( $self->pass_error );
10662             CORE::return( $self->$meth( @_ ) );
10663             }
10664             PERL
10665             # NOTE: radar_value_list()
10666             radar_value_list => <<'PERL',
10667             sub radar_value_list { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Fraud::ValueList', @_ ) ); }
10668             PERL
10669             # NOTE: radar_value_list_create()
10670             radar_value_list_create => <<'PERL',
10671             sub radar_value_list_create
10672             {
10673             my $self = shift( @_ );
10674             my $args = shift( @_ );
10675             my $okParams =
10676             {
10677             expandable => { allowed => $EXPANDABLES->{ 'radar.value_list' } },
10678             alias => { type => "string", required => 1 },
10679             item_type => { type => "string" },
10680             metadata => { type => "hash" },
10681             name => { type => "string", required => 1 },
10682             };
10683             $args = $self->_contract( 'radar.value_list', $args ) || CORE::return( $self->pass_error );
10684             my $err = $self->_check_parameters( $okParams, $args );
10685             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
10686             my $hash = $self->post( "", $args ) || CORE::return( $self->pass_error );
10687             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Fraud::ValueList', $hash ) );
10688             }
10689             PERL
10690             # NOTE: radar_value_list_delete()
10691             radar_value_list_delete => <<'PERL',
10692             sub radar_value_list_delete
10693             {
10694             my $self = shift( @_ );
10695             my $args = shift( @_ );
10696             my $okParams =
10697             {
10698             expandable => { allowed => $EXPANDABLES->{ 'radar.value_list' } },
10699             };
10700             $args = $self->_contract( 'radar.value_list', $args ) || CORE::return( $self->pass_error );
10701             my $err = $self->_check_parameters( $okParams, $args );
10702             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
10703             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No radar.value_list id (with parameter 'id') was provided to delete its information." ) );
10704             my $hash = $self->delete( "radar/value_lists/${id}", $args ) || CORE::return( $self->pass_error );
10705             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Fraud::ValueList', $hash ) );
10706             }
10707             PERL
10708             # NOTE: radar_value_list_item()
10709             radar_value_list_item => <<'PERL',
10710             sub radar_value_list_item { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Fraud::ValueList::Item', @_ ) ); }
10711             PERL
10712             # NOTE: radar_value_list_item_create()
10713             radar_value_list_item_create => <<'PERL',
10714             sub radar_value_list_item_create
10715             {
10716             my $self = shift( @_ );
10717             my $args = shift( @_ );
10718             my $okParams =
10719             {
10720             expandable => { allowed => $EXPANDABLES->{ 'radar.value_list_item' } },
10721             value => { type => "string", required => 1 },
10722             value_list => { type => "string", required => 1 },
10723             };
10724             $args = $self->_contract( 'radar.value_list_item', $args ) || CORE::return( $self->pass_error );
10725             my $err = $self->_check_parameters( $okParams, $args );
10726             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
10727             my $hash = $self->post( "", $args ) || CORE::return( $self->pass_error );
10728             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Fraud::ValueList::Item', $hash ) );
10729             }
10730             PERL
10731             # NOTE: radar_value_list_item_delete()
10732             radar_value_list_item_delete => <<'PERL',
10733             sub radar_value_list_item_delete
10734             {
10735             my $self = shift( @_ );
10736             my $args = shift( @_ );
10737             my $okParams =
10738             {
10739             expandable => { allowed => $EXPANDABLES->{ 'radar.value_list_item' } },
10740             };
10741             $args = $self->_contract( 'radar.value_list_item', $args ) || CORE::return( $self->pass_error );
10742             my $err = $self->_check_parameters( $okParams, $args );
10743             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
10744             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." ) );
10745             my $hash = $self->delete( "radar/value_list_items/${id}", $args ) || CORE::return( $self->pass_error );
10746             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Fraud::ValueList::Item', $hash ) );
10747             }
10748             PERL
10749             # NOTE: radar_value_list_item_list()
10750             radar_value_list_item_list => <<'PERL',
10751             sub radar_value_list_item_list
10752             {
10753             my $self = shift( @_ );
10754             CORE::return( $self->error( "No parameters were provided to list radar value list item information." ) ) if( !scalar( @_ ) );
10755             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Fraud::ValueList::Item', @_ );
10756             my $okParams =
10757             {
10758             expandable => { allowed => $EXPANDABLES->{ 'radar.value_list_item' }, data_prefix_is_ok => 1 },
10759             created => { type => "timestamp" },
10760             ending_before => { type => "string" },
10761             limit => { type => "string" },
10762             starting_after => { type => "string" },
10763             value => { type => "string" },
10764             value_list => { type => "string", required => 1 },
10765             };
10766             my $err = $self->_check_parameters( $okParams, $args );
10767             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
10768             if( $args->{expand} )
10769             {
10770             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
10771             }
10772             my $hash = $self->get( "", $args ) || CORE::return( $self->pass_error );
10773             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Fraud::ValueList::Item', $hash ) );
10774             }
10775             PERL
10776             # NOTE: radar_value_list_item_retrieve()
10777             radar_value_list_item_retrieve => <<'PERL',
10778             sub radar_value_list_item_retrieve
10779             {
10780             my $self = shift( @_ );
10781             my $args = shift( @_ );
10782             my $okParams =
10783             {
10784             expandable => { allowed => $EXPANDABLES->{ 'radar.value_list_item' }, data_prefix_is_ok => 1 },
10785             };
10786             $args = $self->_contract( 'radar.value_list_item', $args ) || CORE::return( $self->pass_error );
10787             my $err = $self->_check_parameters( $okParams, $args );
10788             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
10789             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." ) );
10790             my $hash = $self->get( "radar/value_list_items/${id}", $args ) || CORE::return( $self->pass_error );
10791             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Fraud::ValueList::Item', $hash ) );
10792             }
10793             PERL
10794             # NOTE: radar_value_list_items()
10795             radar_value_list_items => <<'PERL',
10796             # <https://stripe.com/docs/api/radar/value_list_items>
10797             sub radar_value_list_items
10798             {
10799             my $self = shift( @_ );
10800             my $allowed = [qw( create delete list retrieve )];
10801             my $action = shift( @_ );
10802             my $meth = $self->_get_method( 'radar_value_list_item', $action, $allowed ) || CORE::return( $self->pass_error );
10803             CORE::return( $self->$meth( @_ ) );
10804             }
10805             PERL
10806             # NOTE: radar_value_list_list()
10807             radar_value_list_list => <<'PERL',
10808             sub radar_value_list_list
10809             {
10810             my $self = shift( @_ );
10811             CORE::return( $self->error( "No parameters were provided to list radar value list information." ) ) if( !scalar( @_ ) );
10812             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Fraud::ValueList', @_ );
10813             my $okParams =
10814             {
10815             expandable => { allowed => $EXPANDABLES->{ 'radar.value_list' }, data_prefix_is_ok => 1 },
10816             alias => { type => "string" },
10817             contains => { type => "string" },
10818             created => { type => "timestamp" },
10819             ending_before => { type => "string" },
10820             limit => { type => "string" },
10821             starting_after => { type => "string" },
10822             };
10823             my $err = $self->_check_parameters( $okParams, $args );
10824             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
10825             if( $args->{expand} )
10826             {
10827             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
10828             }
10829             my $hash = $self->get( "", $args ) || CORE::return( $self->pass_error );
10830             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Fraud::ValueList', $hash ) );
10831             }
10832             PERL
10833             # NOTE: radar_value_list_retrieve()
10834             radar_value_list_retrieve => <<'PERL',
10835             sub radar_value_list_retrieve
10836             {
10837             my $self = shift( @_ );
10838             my $args = shift( @_ );
10839             my $okParams =
10840             {
10841             expandable => { allowed => $EXPANDABLES->{ 'radar.value_list' }, data_prefix_is_ok => 1 },
10842             };
10843             $args = $self->_contract( 'radar.value_list', $args ) || CORE::return( $self->pass_error );
10844             my $err = $self->_check_parameters( $okParams, $args );
10845             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
10846             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No radar.value_list id (with parameter 'id') was provided to retrieve its information." ) );
10847             my $hash = $self->get( "radar/value_lists/${id}", $args ) || CORE::return( $self->pass_error );
10848             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Fraud::ValueList', $hash ) );
10849             }
10850             PERL
10851             # NOTE: radar_value_list_update()
10852             radar_value_list_update => <<'PERL',
10853             sub radar_value_list_update
10854             {
10855             my $self = shift( @_ );
10856             my $args = shift( @_ );
10857             my $okParams =
10858             {
10859             expandable => { allowed => $EXPANDABLES->{ 'radar.value_list' } },
10860             alias => { type => "string" },
10861             metadata => { type => "hash" },
10862             name => { type => "string" },
10863             };
10864             $args = $self->_contract( 'radar.value_list', $args ) || CORE::return( $self->pass_error );
10865             my $err = $self->_check_parameters( $okParams, $args );
10866             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
10867             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No radar.value_list id (with parameter 'id') was provided to update its information." ) );
10868             my $hash = $self->post( "radar/value_lists/${id}", $args ) || CORE::return( $self->pass_error );
10869             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Fraud::ValueList', $hash ) );
10870             }
10871             PERL
10872             # NOTE: radar_value_lists()
10873             radar_value_lists => <<'PERL',
10874             # <https://stripe.com/docs/api/radar/value_lists>
10875             sub radar_value_lists
10876             {
10877             my $self = shift( @_ );
10878             my $allowed = [qw( create delete list retrieve update )];
10879             my $action = shift( @_ );
10880             my $meth = $self->_get_method( 'radar_value_list', $action, $allowed ) || CORE::return( $self->pass_error );
10881             CORE::return( $self->$meth( @_ ) );
10882             }
10883             PERL
10884             # NOTE: reader()
10885             reader => <<'PERL',
10886             sub reader { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Terminal::Reader' ) ) }
10887             PERL
10888             # NOTE: receiver()
10889             receiver => <<'PERL',
10890             sub receiver { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Payment::Source::Receiver', @_ ) ); }
10891             PERL
10892             # NOTE: redirect()
10893             redirect => <<'PERL',
10894             sub redirect { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Payment::Source::Redirect', @_ ) ); }
10895             PERL
10896             # NOTE: refund()
10897             refund => <<'PERL',
10898             sub refund { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Refund', @_ ) ); }
10899             PERL
10900             # NOTE: refund_cancel()
10901             refund_cancel => <<'PERL',
10902             sub refund_cancel
10903             {
10904             my $self = shift( @_ );
10905             CORE::return( $self->error( "No parameters were provided to cancel a refund." ) ) if( !scalar( @_ ) );
10906             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Refund', @_ );
10907             my $okParams =
10908             {
10909             expandable => { allowed => $EXPANDABLES->{refund} },
10910             id => { re => qr/^\w+$/, required => 1 }
10911             };
10912             my $err = $self->_check_parameters( $okParams, $args );
10913             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
10914             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No refund id was provided to cancel." ) );
10915             my $hash = $self->post( "refunds/${id}/cancel", $args ) || CORE::return( $self->pass_error );
10916             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Refund', $hash ) );
10917             }
10918             PERL
10919             # NOTE: refund_create()
10920             refund_create => <<'PERL',
10921             sub refund_create
10922             {
10923             my $self = shift( @_ );
10924             CORE::return( $self->error( "No parameters were provided to create a payout" ) ) if( !scalar( @_ ) );
10925             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Refund', @_ );
10926             my $okParams =
10927             {
10928             expandable => { allowed => $EXPANDABLES->{refund} },
10929             amount => { required => 1, type => "integer" },
10930             charge => { re => qr/^\w+$/, type => "string" },
10931             metadata => { type => "hash" },
10932             payment_intent => { re => qr/^\w+$/, type => "string" },
10933             reason => {
10934             re => qr/^(duplicate|fraudulent|requested_by_customer)$/,
10935             type => "string",
10936             },
10937             refund_application_fee => { type => "boolean" },
10938             reverse_transfer => { type => "boolean" },
10939             };
10940              
10941             $args = $self->_contract( 'refund', $args ) || CORE::return( $self->pass_error );
10942             my $err = $self->_check_parameters( $okParams, $args );
10943             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
10944             my $hash = $self->post( 'refunds', $args ) || CORE::return( $self->pass_error );
10945             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Refund', $hash ) );
10946             }
10947             PERL
10948             # NOTE: refund_list()
10949             refund_list => <<'PERL',
10950             sub refund_list
10951             {
10952             my $self = shift( @_ );
10953             my $args = $self->_get_args( @_ );
10954             my $okParams =
10955             {
10956             expandable => { allowed => $EXPANDABLES->{refund}, data_prefix_is_ok => 1 },
10957             charge => { re => qr/^\w+$/, type => "string" },
10958             created => { re => qr/^\d+$/, type => "timestamp" },
10959             'created.gt' => { re => qr/^\d+$/ },
10960             'created.gte' => { re => qr/^\d+$/ },
10961             'created.lt' => { re => qr/^\d+$/ },
10962             'created.lte' => { re => qr/^\d+$/ },
10963             ending_before => { re => qr/^\w+$/, type => "string" },
10964             limit => { re => qr/^\d+$/, type => "string" },
10965             payment_intent => { re => qr/^\w+$/, type => "string" },
10966             starting_after => { re => qr/^\w+$/, type => "string" },
10967             };
10968              
10969             my $err = $self->_check_parameters( $okParams, $args );
10970             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
10971             if( $args->{expand} )
10972             {
10973             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
10974             }
10975             my $hash = $self->get( 'refunds', $args ) || CORE::return( $self->pass_error );
10976             CORE::return( $self->_response_to_object( 'Net::API::Stripe::List', $hash ) );
10977             }
10978             PERL
10979             # NOTE: refund_retrieve()
10980             refund_retrieve => <<'PERL',
10981             sub refund_retrieve
10982             {
10983             my $self = shift( @_ );
10984             CORE::return( $self->error( "No parameters were provided to retrieve refund information." ) ) if( !scalar( @_ ) );
10985             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Refund', @_ );
10986             my $okParams =
10987             {
10988             expandable => { allowed => $EXPANDABLES->{refund} },
10989             id => { re => qr/^\w+$/, required => 1 }
10990             };
10991             my $err = $self->_check_parameters( $okParams, $args );
10992             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
10993             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No refund id was provided to retrieve its information." ) );
10994             my $hash = $self->get( "refunds/${id}", $args ) || CORE::return( $self->pass_error );
10995             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Refund', $hash ) );
10996             }
10997             PERL
10998             # NOTE: refund_update()
10999             refund_update => <<'PERL',
11000             sub refund_update
11001             {
11002             my $self = shift( @_ );
11003             CORE::return( $self->error( "No parameters were provided to update a refund" ) ) if( !scalar( @_ ) );
11004             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Refund', @_ );
11005             my $okParams =
11006             {
11007             expandable => { allowed => $EXPANDABLES->{refund} },
11008             id => { re => qr/^\w+$/, required => 1 },
11009             metadata => { type => 'hash' },
11010             };
11011             $args = $self->_contract( 'refund', $args ) || CORE::return( $self->pass_error );
11012             my $err = $self->_check_parameters( $okParams, $args );
11013             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
11014             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No refund id was provided to update its details" ) );
11015             my $hash = $self->post( "refunds/${id}", $args ) || CORE::return( $self->pass_error );
11016             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Refund', $hash ) );
11017             }
11018             PERL
11019             # NOTE: refunds()
11020             refunds => <<'PERL',
11021             sub refunds
11022             {
11023             my $self = shift( @_ );
11024             my $action = shift( @_ );
11025             my $allowed = [qw( create retrieve update cancel list )];
11026             my $meth = $self->_get_method( 'refund', $action, $allowed ) || CORE::return( $self->pass_error );
11027             CORE::return( $self->$meth( @_ ) );
11028             }
11029             PERL
11030             # NOTE: relationship()
11031             relationship => <<'PERL',
11032             sub relationship { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Connect::Account::Relationship', @_ ) ); }
11033             PERL
11034             # NOTE: reporting_report_run()
11035             reporting_report_run => <<'PERL',
11036             sub reporting_report_run { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Reporting::ReportRun', @_ ) ); }
11037             PERL
11038             # NOTE: reporting_report_run_create()
11039             reporting_report_run_create => <<'PERL',
11040             sub reporting_report_run_create
11041             {
11042             my $self = shift( @_ );
11043             my $args = shift( @_ );
11044             my $okParams =
11045             {
11046             expandable => { allowed => $EXPANDABLES->{ 'reporting.report_run' } },
11047             parameters => { type => "hash" },
11048             report_type => { type => "string", required => 1 },
11049             };
11050             $args = $self->_contract( 'reporting.report_run', $args ) || CORE::return( $self->pass_error );
11051             my $err = $self->_check_parameters( $okParams, $args );
11052             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
11053             my $hash = $self->post( "", $args ) || CORE::return( $self->pass_error );
11054             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Reporting::ReportRun', $hash ) );
11055             }
11056             PERL
11057             # NOTE: reporting_report_run_list()
11058             reporting_report_run_list => <<'PERL',
11059             sub reporting_report_run_list
11060             {
11061             my $self = shift( @_ );
11062             CORE::return( $self->error( "No parameters were provided to list reporting report run information." ) ) if( !scalar( @_ ) );
11063             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Reporting::ReportRun', @_ );
11064             my $okParams =
11065             {
11066             expandable => { allowed => $EXPANDABLES->{ 'reporting.report_run' }, data_prefix_is_ok => 1 },
11067             created => { type => "timestamp" },
11068             ending_before => { type => "string" },
11069             limit => { type => "string" },
11070             starting_after => { type => "string" },
11071             };
11072             my $err = $self->_check_parameters( $okParams, $args );
11073             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
11074             if( $args->{expand} )
11075             {
11076             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
11077             }
11078             my $hash = $self->get( "", $args ) || CORE::return( $self->pass_error );
11079             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Reporting::ReportRun', $hash ) );
11080             }
11081             PERL
11082             # NOTE: reporting_report_run_retrieve()
11083             reporting_report_run_retrieve => <<'PERL',
11084             sub reporting_report_run_retrieve
11085             {
11086             my $self = shift( @_ );
11087             my $args = shift( @_ );
11088             my $okParams =
11089             {
11090             expandable => { allowed => $EXPANDABLES->{ 'reporting.report_run' }, data_prefix_is_ok => 1 },
11091             };
11092             $args = $self->_contract( 'reporting.report_run', $args ) || CORE::return( $self->pass_error );
11093             my $err = $self->_check_parameters( $okParams, $args );
11094             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
11095             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No reporting.report_run id (with parameter 'id') was provided to retrieve its information." ) );
11096             my $hash = $self->get( "reporting/report_runs/${id}", $args ) || CORE::return( $self->pass_error );
11097             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Reporting::ReportRun', $hash ) );
11098             }
11099             PERL
11100             # NOTE: reporting_report_runs()
11101             reporting_report_runs => <<'PERL',
11102             # <https://stripe.com/docs/api/reporting/report_run>
11103             sub reporting_report_runs
11104             {
11105             my $self = shift( @_ );
11106             my $allowed = [qw( create list retrieve )];
11107             my $action = shift( @_ );
11108             my $meth = $self->_get_method( 'reporting_report_run', $action, $allowed ) || CORE::return( $self->pass_error );
11109             CORE::return( $self->$meth( @_ ) );
11110             }
11111             PERL
11112             # NOTE: reporting_report_type()
11113             reporting_report_type => <<'PERL',
11114             sub reporting_report_type { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Reporting::ReportType', @_ ) ); }
11115             PERL
11116             # NOTE: reporting_report_type_list()
11117             reporting_report_type_list => <<'PERL',
11118             sub reporting_report_type_list
11119             {
11120             my $self = shift( @_ );
11121             CORE::return( $self->error( "No parameters were provided to list reporting report type information." ) ) if( !scalar( @_ ) );
11122             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Reporting::ReportType', @_ );
11123             my $okParams =
11124             {
11125             expandable => { allowed => $EXPANDABLES->{ 'reporting.report_type' }, data_prefix_is_ok => 1 },
11126             };
11127             my $err = $self->_check_parameters( $okParams, $args );
11128             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
11129             if( $args->{expand} )
11130             {
11131             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
11132             }
11133             my $hash = $self->get( "", $args ) || CORE::return( $self->pass_error );
11134             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Reporting::ReportType', $hash ) );
11135             }
11136             PERL
11137             # NOTE: reporting_report_type_retrieve()
11138             reporting_report_type_retrieve => <<'PERL',
11139             sub reporting_report_type_retrieve
11140             {
11141             my $self = shift( @_ );
11142             my $args = shift( @_ );
11143             my $okParams =
11144             {
11145             expandable => { allowed => $EXPANDABLES->{ 'reporting.report_type' }, data_prefix_is_ok => 1 },
11146             };
11147             $args = $self->_contract( 'reporting.report_type', $args ) || CORE::return( $self->pass_error );
11148             my $err = $self->_check_parameters( $okParams, $args );
11149             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
11150             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No reporting.report_type id (with parameter 'id') was provided to retrieve its information." ) );
11151             my $hash = $self->get( "reporting/report_types/${id}", $args ) || CORE::return( $self->pass_error );
11152             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Reporting::ReportType', $hash ) );
11153             }
11154             PERL
11155             # NOTE: reporting_report_types()
11156             reporting_report_types => <<'PERL',
11157             # <https://stripe.com/docs/api/reporting/report_type>
11158             sub reporting_report_types
11159             {
11160             my $self = shift( @_ );
11161             my $allowed = [qw( list retrieve )];
11162             my $action = shift( @_ );
11163             my $meth = $self->_get_method( 'reporting_report_type', $action, $allowed ) || CORE::return( $self->pass_error );
11164             CORE::return( $self->$meth( @_ ) );
11165             }
11166             PERL
11167             # NOTE: request()
11168             request => <<'PERL',
11169             sub request { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Event::Request', @_ ) ); }
11170             PERL
11171             # NOTE: requirements()
11172             requirements => <<'PERL',
11173             sub requirements { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Connect::Account::Requirements', @_ ) ); }
11174             PERL
11175             # NOTE: return()
11176             return => <<'PERL',
11177             sub return { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Order::Return' ) ) }
11178             PERL
11179             # NOTE: review()
11180             review => <<'PERL',
11181             sub review { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Fraud::Review', @_ ) ); }
11182             PERL
11183             # NOTE: review_approve()
11184             review_approve => <<'PERL',
11185             sub review_approve
11186             {
11187             my $self = shift( @_ );
11188             my $args = shift( @_ );
11189             my $okParams =
11190             {
11191             expandable => { allowed => $EXPANDABLES->{ 'review' } },
11192             };
11193             $args = $self->_contract( 'review', $args ) || CORE::return( $self->pass_error );
11194             my $err = $self->_check_parameters( $okParams, $args );
11195             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
11196             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No review id (with parameter 'id') was provided to approve its information." ) );
11197             my $hash = $self->post( "reviews/${id}", $args ) || CORE::return( $self->pass_error );
11198             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Fraud::Review', $hash ) );
11199             }
11200             PERL
11201             # NOTE: review_list()
11202             review_list => <<'PERL',
11203             sub review_list
11204             {
11205             my $self = shift( @_ );
11206             CORE::return( $self->error( "No parameters were provided to list review information." ) ) if( !scalar( @_ ) );
11207             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Fraud::Review', @_ );
11208             my $okParams =
11209             {
11210             expandable => { allowed => $EXPANDABLES->{ 'review' }, data_prefix_is_ok => 1 },
11211             created => { type => "timestamp" },
11212             ending_before => { type => "string" },
11213             limit => { type => "string" },
11214             starting_after => { type => "string" },
11215             };
11216             my $err = $self->_check_parameters( $okParams, $args );
11217             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
11218             if( $args->{expand} )
11219             {
11220             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
11221             }
11222             my $hash = $self->get( "reviews", $args ) || CORE::return( $self->pass_error );
11223             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Fraud::Review', $hash ) );
11224             }
11225             PERL
11226             # NOTE: review_retrieve()
11227             review_retrieve => <<'PERL',
11228             sub review_retrieve
11229             {
11230             my $self = shift( @_ );
11231             my $args = shift( @_ );
11232             my $okParams =
11233             {
11234             expandable => { allowed => $EXPANDABLES->{ 'review' }, data_prefix_is_ok => 1 },
11235             };
11236             $args = $self->_contract( 'review', $args ) || CORE::return( $self->pass_error );
11237             my $err = $self->_check_parameters( $okParams, $args );
11238             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
11239             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No review id (with parameter 'id') was provided to retrieve its information." ) );
11240             my $hash = $self->get( "reviews/${id}", $args ) || CORE::return( $self->pass_error );
11241             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Fraud::Review', $hash ) );
11242             }
11243             PERL
11244             # NOTE: reviews()
11245             reviews => <<'PERL',
11246             # <https://stripe.com/docs/api/radar/reviews>
11247             sub reviews
11248             {
11249             my $self = shift( @_ );
11250             my $allowed = [qw( approve list retrieve )];
11251             my $action = shift( @_ );
11252             my $meth = $self->_get_method( 'review', $action, $allowed ) || CORE::return( $self->pass_error );
11253             CORE::return( $self->$meth( @_ ) );
11254             }
11255             PERL
11256             # NOTE: schedule()
11257             schedule => <<'PERL',
11258             sub schedule { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Billing::Subscription::Schedule', @_ ) ); }
11259             PERL
11260             # NOTE: schedule_cancel()
11261             schedule_cancel => <<'PERL',
11262             # https://stripe.com/docs/api/subscription_schedules/cancel?lang=curl
11263             # "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."
11264             sub schedule_cancel
11265             {
11266             my $self = shift( @_ );
11267             CORE::return( $self->error( "No parameters were provided to cancel subscription schedule information." ) ) if( !scalar( @_ ) );
11268             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Billing::Subscription::Schedule', @_ );
11269             my $okParams =
11270             {
11271             expandable => { allowed => $EXPANDABLES->{schedule} },
11272             id => { re => qr/^\w+$/, required => 1 },
11273             # "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."
11274             invoice_now => { type => 'boolean' },
11275             # "If the subscription schedule is active, indicates if the cancellation should be prorated. Defaults to true."
11276             prorate => { type => 'boolean' },
11277             };
11278             my $err = $self->_check_parameters( $okParams, $args );
11279             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
11280             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No subscription schedule id was provided to cancel." ) );
11281             my $hash = $self->post( "subscription_schedules/${id}/cancel", $args ) || CORE::return( $self->pass_error );
11282             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::Subscription::Schedule', $hash ) );
11283             }
11284             PERL
11285             # NOTE: schedule_create()
11286             schedule_create => <<'PERL',
11287             sub schedule_create
11288             {
11289             my $self = shift( @_ );
11290             CORE::return( $self->error( "No parameters were provided to create a subscription schedule" ) ) if( !scalar( @_ ) );
11291             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Billing::Subscription::Schedule', @_ );
11292             my $okParams =
11293             {
11294             expandable => { allowed => $EXPANDABLES->{schedule} },
11295             customer => {},
11296             default_settings => { fields => [qw( billing_thresholds.amount_gte billing_thresholds.reset_billing_cycle_anchor collection_method default_payment_method invoice_settings.days_until_due )] },
11297             end_behavior => { re => qr/^(release|cancel)$/ },
11298             from_subscription => {},
11299             metadata => {},
11300             phases => { type => 'array', fields => [qw(
11301             add_invoice_items.price
11302             add_invoice_items.price_data.currency!
11303             add_invoice_items.price_data.product!
11304             add_invoice_items.price_data.unit_amount_decimal
11305             add_invoice_items.price_data.unit_amount
11306             add_invoice_items.quantity
11307             add_invoice_items.tax_rates
11308            
11309             application_fee_percent
11310              
11311             billing_cycle_anchor
11312            
11313             billing_thresholds.amount_gte
11314             billing_thresholds.reset_billing_cycle_anchor
11315            
11316             collection_method
11317            
11318             coupon
11319            
11320             default_payment_method
11321            
11322             default_tax_rates
11323              
11324             end_date
11325            
11326             invoice_settings.days_until_due
11327            
11328             items!
11329             items.billing_thresholds.usage_gte!
11330             items.price
11331             items.price_data.currency!
11332             items.price_data.product!
11333             items.price_data.recurring!
11334             items.price_data.recurring.interval!
11335             items.price_data.recurring.interval_count
11336             items.price_data.unit_amount_decimal
11337             items.price_data.unit_amount
11338             items.quantity
11339             items.tax_rates
11340            
11341             iterations
11342            
11343             plans.plan
11344             plans.billing_thresholds.usage_gte
11345             plans.quantity
11346             plans.tax_rates
11347            
11348             proration_behavior
11349            
11350             tax_percent
11351            
11352             transfer_data.destination!
11353             transfer_data.amount_percent
11354            
11355             trial
11356             trial_end
11357             )]},
11358             start_date => { type => 'datetime' },
11359             };
11360            
11361             my $obj = $args->{_object};
11362             if( $obj && !length( $args->{start_date} ) && $obj->current_phase->start_date )
11363             {
11364             $args->{start_date} = $obj->current_phase->start_date->epoch;
11365             }
11366             $args = $self->_contract( 'schedule', $args ) || CORE::return( $self->pass_error );
11367             my $err = $self->_check_parameters( $okParams, $args );
11368             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
11369             my $hash = $self->post( 'subscription_schedules', $args ) || CORE::return( $self->pass_error );
11370             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::Subscription::Schedule', $hash ) );
11371             }
11372             PERL
11373             # NOTE: schedule_list()
11374             schedule_list => <<'PERL',
11375             sub schedule_list
11376             {
11377             my $self = shift( @_ );
11378             my $args = shift( @_ );
11379             my $okParams =
11380             {
11381             expandable => { allowed => $EXPANDABLES->{schedule}, data_prefix_is_ok => 1 },
11382             'canceled_at' => { re => qr/^\d+$/ },
11383             'canceled_at.gt' => { re => qr/^\d+$/ },
11384             'canceled_at.gte' => { re => qr/^\d+$/ },
11385             'canceled_at.lt' => { re => qr/^\d+$/ },
11386             'canceled_at.lte' => { re => qr/^\d+$/ },
11387             'completed_at' => { re => qr/^\d+$/ },
11388             'completed_at.gt' => { re => qr/^\d+$/ },
11389             'completed_at.gte' => { re => qr/^\d+$/ },
11390             'completed_at.lt' => { re => qr/^\d+$/ },
11391             'completed_at.lte' => { re => qr/^\d+$/ },
11392             'created' => { re => qr/^\d+$/ },
11393             'created.gt' => { re => qr/^\d+$/ },
11394             'created.gte' => { re => qr/^\d+$/ },
11395             'created.lt' => { re => qr/^\d+$/ },
11396             'created.lte' => { re => qr/^\d+$/ },
11397             'customer' => {},
11398             # "A cursor for use in pagination. ending_before is an object ID that defines your place in the list."
11399             'ending_before' => {},
11400             'limit' => { re => qr/^\d+$/ },
11401             'released_at' => { re => qr/^\d+$/ },
11402             'released_at.gt' => { re => qr/^\d+$/ },
11403             'released_at.gte' => { re => qr/^\d+$/ },
11404             'released_at.lt' => { re => qr/^\d+$/ },
11405             'released_at.lte' => { re => qr/^\d+$/ },
11406             'scheduled' => { type => 'boolean' },
11407             'starting_after' => {},
11408             };
11409             my $err = $self->_check_parameters( $okParams, $args );
11410             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
11411             if( $args->{expand} )
11412             {
11413             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
11414             }
11415             my $hash = $self->get( 'subscription_schedules', $args ) || CORE::return( $self->pass_error );
11416             CORE::return( $self->_response_to_object( 'Net::API::Stripe::List', $hash ) );
11417             }
11418             PERL
11419             # NOTE: schedule_query()
11420             schedule_query => <<'PERL',
11421             # sub session { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Session', @_ ) ); }
11422             sub schedule_query { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Sigma::ScheduledQueryRun' ) ) }
11423             PERL
11424             # NOTE: schedule_release()
11425             schedule_release => <<'PERL',
11426             # "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."
11427             # https://stripe.com/docs/api/subscription_schedules/release
11428             sub schedule_release
11429             {
11430             my $self = shift( @_ );
11431             CORE::return( $self->error( "No parameters were provided to retrieve subscription schedule information." ) ) if( !scalar( @_ ) );
11432             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Billing::Subscription::Schedule', @_ );
11433             my $okParams =
11434             {
11435             expandable => { allowed => $EXPANDABLES->{schedule} },
11436             id => { re => qr/^\w+$/, required => 1 },
11437             preserve_cancel_date => { type => 'boolean' },
11438             };
11439             my $err = $self->_check_parameters( $okParams, $args );
11440             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
11441             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No subscription schedule id was provided to retrieve its information." ) );
11442             my $hash = $self->post( "subscription_schedules/${id}/release", $args ) || CORE::return( $self->pass_error );
11443             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::Subscription::Schedule', $hash ) );
11444             }
11445             PERL
11446             # NOTE: schedule_retrieve()
11447             schedule_retrieve => <<'PERL',
11448             sub schedule_retrieve
11449             {
11450             my $self = shift( @_ );
11451             CORE::return( $self->error( "No parameters were provided to retrieve subscription schedule information." ) ) if( !scalar( @_ ) );
11452             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Billing::Subscription::Schedule', @_ );
11453             my $okParams =
11454             {
11455             expandable => { allowed => $EXPANDABLES->{schedule} },
11456             id => { re => qr/^\w+$/, required => 1 }
11457             };
11458             my $err = $self->_check_parameters( $okParams, $args );
11459             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
11460             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No subscription schedule id was provided to retrieve its information." ) );
11461             my $hash = $self->get( "subscription_schedules/${id}", $args ) || CORE::return( $self->pass_error );
11462             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::Subscription::Schedule', $hash ) );
11463             }
11464             PERL
11465             # NOTE: schedule_update()
11466             schedule_update => <<'PERL',
11467             # https://stripe.com/docs/api/customers/update?lang=curl
11468             sub schedule_update
11469             {
11470             my $self = shift( @_ );
11471             CORE::return( $self->error( "No parameters were provided to update a subscription schedule" ) ) if( !scalar( @_ ) );
11472             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Billing::Subscription::Schedule', @_ );
11473             my $okParams =
11474             {
11475             expandable => { allowed => $EXPANDABLES->{schedule} },
11476             id => { re => qr/^\w+$/, required => 1 },
11477             default_settings => { fields => [qw( billing_thresholds.amount_gte billing_thresholds.reset_billing_cycle_anchor collection_method default_payment_method invoice_settings.days_until_due )] },
11478             end_behavior => { re => qr/^(release|cancel)$/ },
11479             from_subscription => {},
11480             metadata => { type => 'hash' },
11481             phases => { type => 'array', fields => [qw(
11482             add_invoice_items.price
11483             add_invoice_items.price_data.currency!
11484             add_invoice_items.price_data.product!
11485             add_invoice_items.price_data.unit_amount_decimal
11486             add_invoice_items.price_data.unit_amount
11487             add_invoice_items.quantity
11488             add_invoice_items.tax_rates
11489            
11490             application_fee_percent
11491            
11492             billing_cycle_anchor
11493            
11494             billing_thresholds.amount_gte
11495             billing_thresholds.reset_billing_cycle_anchor
11496            
11497             collection_method
11498             coupon
11499              
11500             default_payment_method
11501             default_tax_rates
11502              
11503             end_date
11504            
11505             invoice_settings.days_until_due
11506            
11507             items!
11508             items.billing_thresholds
11509             items.billing_thresholds.usage_gte!
11510             items.price
11511             items.price_data.currency!
11512             items.price_data.product!
11513             items.price_data.recurring!
11514             items.price_data.recurring.interval!
11515             items.price_data.recurring.interval_count
11516             items.price_data.unit_amount_decimal
11517             items.price_data.unit_amount
11518             items.quantity
11519             items.tax_rates
11520            
11521             iterations
11522            
11523             plans.plan
11524             plans.billing_thresholds.usage_gte
11525             plans.quantity
11526             plans.tax_rates
11527            
11528             proration_behavior
11529            
11530             start_date
11531            
11532             tax_percent
11533            
11534             transfer_data.destination!
11535             transfer_data.amount_percent
11536            
11537             trial
11538             trial_end
11539             )]},
11540             prorate => { type => 'boolean' },
11541             proration_behavior => { type => 'scalar' },
11542             start_date => { type => 'datetime' },
11543             };
11544             $args = $self->_contract( 'schedule', $args ) || CORE::return( $self->pass_error );
11545             # We found some errors
11546             my $err = $self->_check_parameters( $okParams, $args );
11547             # $self->message( 3, "Data to be posted: ", $self->dumper( $args ) ); exit;
11548             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
11549             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No subscription schedule id was provided to update subscription schedule's details" ) );
11550             my $hash = $self->post( "subscription_schedules/${id}", $args ) || CORE::return( $self->pass_error );
11551             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::Subscription::Schedule', $hash ) );
11552             }
11553             PERL
11554             # NOTE: scheduled_query_run()
11555             scheduled_query_run => <<'PERL',
11556             sub scheduled_query_run { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Sigma::ScheduledQueryRun', @_ ) ); }
11557             PERL
11558             # NOTE: scheduled_query_run_list()
11559             scheduled_query_run_list => <<'PERL',
11560             sub scheduled_query_run_list
11561             {
11562             my $self = shift( @_ );
11563             CORE::return( $self->error( "No parameters were provided to list scheduled query run information." ) ) if( !scalar( @_ ) );
11564             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Sigma::ScheduledQueryRun', @_ );
11565             my $okParams =
11566             {
11567             expandable => { allowed => $EXPANDABLES->{ 'scheduled_query_run' }, data_prefix_is_ok => 1 },
11568             ending_before => { type => "string" },
11569             limit => { type => "string" },
11570             starting_after => { type => "string" },
11571             };
11572             my $err = $self->_check_parameters( $okParams, $args );
11573             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
11574             if( $args->{expand} )
11575             {
11576             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
11577             }
11578             my $hash = $self->get( "sigma/scheduled_query_runs", $args ) || CORE::return( $self->pass_error );
11579             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Sigma::ScheduledQueryRun', $hash ) );
11580             }
11581             PERL
11582             # NOTE: scheduled_query_run_retrieve()
11583             scheduled_query_run_retrieve => <<'PERL',
11584             sub scheduled_query_run_retrieve
11585             {
11586             my $self = shift( @_ );
11587             my $args = shift( @_ );
11588             my $okParams =
11589             {
11590             expandable => { allowed => $EXPANDABLES->{ 'scheduled_query_run' }, data_prefix_is_ok => 1 },
11591             };
11592             $args = $self->_contract( 'scheduled_query_run', $args ) || CORE::return( $self->pass_error );
11593             my $err = $self->_check_parameters( $okParams, $args );
11594             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
11595             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No scheduled_query_run id (with parameter 'id') was provided to retrieve its information." ) );
11596             my $hash = $self->get( "sigma/scheduled_query_runs/${id}", $args ) || CORE::return( $self->pass_error );
11597             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Sigma::ScheduledQueryRun', $hash ) );
11598             }
11599             PERL
11600             # NOTE: scheduled_query_runs()
11601             scheduled_query_runs => <<'PERL',
11602             # <https://stripe.com/docs/api/sigma/scheduled_queries>
11603             sub scheduled_query_runs
11604             {
11605             my $self = shift( @_ );
11606             my $allowed = [qw( list retrieve )];
11607             my $action = shift( @_ );
11608             my $meth = $self->_get_method( 'scheduled_query_run', $action, $allowed ) || CORE::return( $self->pass_error );
11609             CORE::return( $self->$meth( @_ ) );
11610             }
11611             PERL
11612             # NOTE: schedules()
11613             schedules => <<'PERL',
11614             sub schedules
11615             {
11616             my $self = shift( @_ );
11617             my $action = shift( @_ );
11618             my $allowed = [qw( create retrieve update list cancel release )];
11619             my $meth = $self->_get_method( 'schedule', $action, $allowed ) || CORE::return( $self->pass_error );
11620             CORE::return( $self->$meth( @_ ) );
11621             }
11622             PERL
11623             # NOTE: session()
11624             session => <<'PERL',
11625             sub session { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Checkout::Session', @_ ) ); }
11626             PERL
11627             # NOTE: session_create()
11628             session_create => <<'PERL',
11629             # https://stripe.com/docs/api/checkout/sessions/create
11630             # https://stripe.com/docs/payments/checkout/fulfillment#webhooks
11631             # See webhook event checkout.session.completed
11632             sub session_create
11633             {
11634             my $self = shift( @_ );
11635             CORE::return( $self->error( "No parameters were provided to create a checkout session" ) ) if( !scalar( @_ ) );
11636             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Checkout::Session', @_ );
11637             my $okParams =
11638             {
11639             expandable => { allowed => $EXPANDABLES->{session} },
11640             cancel_url => { required => 1 },
11641             payment_method_types => { required => 1, re => qr/^(card|ideal)$/ },
11642             success_url => { required => 1 },
11643             billing_address_collection => { re => qr/^(auto|required)$/ },
11644             client_reference_id => {},
11645             # ID of an existing customer, if one exists.
11646             customer => {},
11647             customer_email => {},
11648             # array of hash reference
11649             line_items => { type => 'array', fields => [qw( amount currency name quantity description images )] },
11650             locale => { re => qr/^(local|[a-z]{2})$/ },
11651             mode => { re => qr/^(setup|subscription)$/ },
11652             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 )] },
11653             setup_intent_data => { fields => [qw( description metadata on_behalf_of )] },
11654             submit_type => { re => qr/^(auto|book|donate|pay)$/ },
11655             subscription_data => { fields => [qw( items.plan items.quantity application_fee_percent metadata trial_end trial_from_plan trial_period_days )] },
11656             };
11657             $args = $self->_contract( 'session', $args ) || CORE::return( $self->pass_error );
11658             my $err = $self->_check_parameters( $okParams, $args );
11659             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
11660             my $hash = $self->post( 'checkout/sessions', $args ) || CORE::return( $self->pass_error );
11661             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Checkout::Session', $hash ) );
11662             }
11663             PERL
11664             # NOTE: session_expire()
11665             session_expire => <<'PERL',
11666             sub session_expire
11667             {
11668             my $self = shift( @_ );
11669             my $args = shift( @_ ) || CORE::return( $self->error( "No parameters were provided to expire a checkout session" ) );
11670             my $okParams =
11671             {
11672             expandable => { allowed => $EXPANDABLES->{session} },
11673             id => { re => qr/^\w+$/, required => 1 },
11674             };
11675             my $err = $self->_check_parameters( $okParams, $args );
11676             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
11677             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No tax id was provided to retrieve its details" ) );
11678             my $hash = $self->get( "checkout/sessions/${id}/expire", $args ) || CORE::return( $self->pass_error );
11679             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Checkout::Session', $hash ) );
11680             }
11681             PERL
11682             # NOTE: session_list()
11683             session_list => <<'PERL',
11684             sub session_list
11685             {
11686             my $self = shift( @_ );
11687             my $args = shift( @_ );
11688             my $okParams =
11689             {
11690             expandable => { allowed => $EXPANDABLES->{session}, data_prefix_is_ok => 1 },
11691             # "A cursor for use in pagination. ending_before is an object ID that defines your place in the list."
11692             'ending_before' => {},
11693             'limit' => { re => qr/^\d+$/ },
11694             'payment_intent' => { type => 'scalar' },
11695             'subscription' => { re => qr/^\w+$/ },
11696             'starting_after' => {},
11697             };
11698             my $err = $self->_check_parameters( $okParams, $args );
11699             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
11700             if( $args->{expand} )
11701             {
11702             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
11703             }
11704             my $hash = $self->get( 'checkout/sessions', $args ) || CORE::return( $self->pass_error );
11705             CORE::return( $self->_response_to_object( 'Net::API::Stripe::List', $hash ) );
11706             }
11707             PERL
11708             # NOTE: session_retrieve()
11709             session_retrieve => <<'PERL',
11710             sub session_retrieve
11711             {
11712             my $self = shift( @_ );
11713             my $args = shift( @_ ) || CORE::return( $self->error( "No parameters were provided to retrieve a checkout session" ) );
11714             my $okParams =
11715             {
11716             expandable => { allowed => $EXPANDABLES->{session} },
11717             id => { re => qr/^\w+$/, required => 1 },
11718             };
11719             my $err = $self->_check_parameters( $okParams, $args );
11720             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
11721             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No checkout session id was provided to retrieve its details" ) );
11722             my $hash = $self->get( "checkout/sessions/${id}", $args ) || CORE::return( $self->pass_error );
11723             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Checkout::Session', $hash ) );
11724             }
11725             PERL
11726             # NOTE: session_retrieve_items()
11727             session_retrieve_items => <<'PERL',
11728             sub session_retrieve_items
11729             {
11730             my $self = shift( @_ );
11731             my $args = shift( @_ ) || CORE::return( $self->error( "No parameters were provided to retrieve a checkout session items" ) );
11732             my $okParams =
11733             {
11734             expandable => { allowed => $EXPANDABLES->{item} },
11735             id => { re => qr/^\w+$/, required => 1 },
11736             ending_before => {},
11737             limit => { re => qr/^\d+$/ },
11738             starting_after => {},
11739             };
11740             my $err = $self->_check_parameters( $okParams, $args );
11741             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
11742             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No checkout session id was provided to retrieve its items details" ) );
11743             my $hash = $self->get( "checkout/sessions/${id}/line_items", $args ) || CORE::return( $self->pass_error );
11744             CORE::return( $self->_response_to_object( 'Net::API::Stripe::List', $hash ) );
11745             }
11746             PERL
11747             # NOTE: sessions()
11748             sessions => <<'PERL',
11749             sub sessions
11750             {
11751             my $self = shift( @_ );
11752             my $action = shift( @_ );
11753             my $allowed = [qw( create expire retrieve list retrieve_items )];
11754             my $meth = $self->_get_method( 'session', $action, $allowed ) || CORE::return( $self->pass_error );
11755             CORE::return( $self->$meth( @_ ) );
11756             }
11757             PERL
11758             # NOTE: settings()
11759             settings => <<'PERL',
11760             sub settings { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Connect::Account::Settings', @_ ) ); }
11761             PERL
11762             # NOTE: setup_attempt()
11763             setup_attempt => <<'PERL',
11764             sub setup_attempt { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Payment::Intent::Attempt', @_ ) ); }
11765             PERL
11766             # NOTE: setup_attempt_list()
11767             setup_attempt_list => <<'PERL',
11768             sub setup_attempt_list
11769             {
11770             my $self = shift( @_ );
11771             my $args = $self->_get_args( @_ );
11772             my $okParams =
11773             {
11774             expandable => { allowed => $EXPANDABLES->{setup_attempt}, data_prefix_is_ok => 1 },
11775             active => { type => "boolean" },
11776             created => { re => qr/^\d+$/, type => "timestamp" },
11777             'created.gt' => { re => qr/^\d+$/ },
11778             'created.gte' => { re => qr/^\d+$/ },
11779             'created.lt' => { re => qr/^\d+$/ },
11780             'created.lte' => { re => qr/^\d+$/ },
11781             ending_before => { type => "string" },
11782             limit => { re => qr/^\d+$/, type => "string" },
11783             setup_intent => { re => qr/^\w+$/, required => 1, type => "string" },
11784             starting_after => { type => "string" },
11785             };
11786              
11787             my $err = $self->_check_parameters( $okParams, $args );
11788             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
11789             if( $args->{expand} )
11790             {
11791             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
11792             }
11793             my $hash = $self->get( 'setup_attempts', $args ) || CORE::return( $self->pass_error );
11794             CORE::return( $self->_response_to_object( 'Net::API::Stripe::List', $hash ) );
11795             }
11796             PERL
11797             # NOTE: setup_attempts()
11798             setup_attempts => <<'PERL',
11799             sub setup_attempts
11800             {
11801             my $self = shift( @_ );
11802             my $action = shift( @_ );
11803             my $allowed = [qw( list )];
11804             my $meth = $self->_get_method( 'setup_attempts', $action, $allowed ) || CORE::return( $self->pass_error );
11805             CORE::return( $self->$meth( @_ ) );
11806             }
11807             PERL
11808             # NOTE: setup_intent()
11809             setup_intent => <<'PERL',
11810             sub setup_intent { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Payment::Intent::Attempt', @_ ) ); }
11811             PERL
11812             # NOTE: setup_intent_cancel()
11813             setup_intent_cancel => <<'PERL',
11814             sub setup_intent_cancel
11815             {
11816             my $self = shift( @_ );
11817             CORE::return( $self->error( "No parameters were provided to cancel the setup intent." ) ) if( !scalar( @_ ) );
11818             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Payment::Intent::Setup', @_ );
11819             my $okParams =
11820             {
11821             expandable => { allowed => $EXPANDABLES->{setup_intent} },
11822             cancellation_reason => {
11823             re => qr/^(?:abandoned|requested_by_customer|duplicate)$/,
11824             type => "string",
11825             },
11826             id => { re => qr/^\w+$/, required => 1 },
11827             };
11828              
11829             my $err = $self->_check_parameters( $okParams, $args );
11830             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
11831             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No setup intent id was provided to cancel." ) );
11832             my $hash = $self->post( "setup_intents/${id}/cancel", $args ) || CORE::return( $self->pass_error );
11833             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Payment::Intent::Setup', $hash ) );
11834             }
11835             PERL
11836             # NOTE: setup_intent_confirm()
11837             setup_intent_confirm => <<'PERL',
11838             sub setup_intent_confirm
11839             {
11840             my $self = shift( @_ );
11841             CORE::return( $self->error( "No parameters were provided to confirm the setup intent." ) ) if( !scalar( @_ ) );
11842             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Payment::Intent::Setup', @_ );
11843             my $okParams =
11844             {
11845             expandable => { allowed => $EXPANDABLES->{setup_intent} },
11846             id => { re => qr/^\w+$/, required => 1 },
11847             mandate_data => {
11848             fields => [
11849             "customer_acceptance.type",
11850             "customer_acceptance.accepted_at",
11851             "customer_acceptance.offline",
11852             "customer_acceptance.online.ip_address",
11853             "customer_acceptance.online.user_agent",
11854             ],
11855             type => "hash",
11856             },
11857             payment_method => { re => qr/^\w+$/, type => "string" },
11858             payment_method_data => { type => "object" },
11859             payment_method_options => {
11860             fields => [
11861             "acss_debit.currency",
11862             "acss_debit.mandate_options.custom_mandate_url",
11863             "acss_debit.mandate_options.default_for",
11864             "acss_debit.mandate_options.interval_description",
11865             "acss_debit.mandate_options.payment_schedule",
11866             "acss_debit.mandate_options.transaction_type",
11867             "acss_debit.verification_method",
11868             "card.request_three_d_secure",
11869             "sepa_debit.mandate_options",
11870             ],
11871             type => "hash",
11872             },
11873             return_url => { type => "string" },
11874             };
11875              
11876             my $err = $self->_check_parameters( $okParams, $args );
11877             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
11878             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No setup intent id was provided to confirm." ) );
11879             my $hash = $self->post( "setup_intents/${id}/confirm", $args ) || CORE::return( $self->pass_error );
11880             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Payment::Intent::Setup', $hash ) );
11881             }
11882             PERL
11883             # NOTE: setup_intent_create()
11884             setup_intent_create => <<'PERL',
11885             sub setup_intent_create
11886             {
11887             my $self = shift( @_ );
11888             CORE::return( $self->error( "No parameters were provided to create a the setup intent." ) ) if( !scalar( @_ ) );
11889             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Payment::Intent::Setup', @_ );
11890             my $okParams =
11891             {
11892             expandable => { allowed => $EXPANDABLES->{setup_intent} },
11893             attach_to_self => { type => "boolean" },
11894             confirm => { type => "boolean" },
11895             customer => { type => "string" },
11896             description => { type => "string" },
11897             flow_directions => { type => "array" },
11898             id => { re => qr/^\w+$/, required => 1 },
11899             mandate_data => {
11900             fields => [
11901             "customer_acceptance.type",
11902             "customer_acceptance.accepted_at",
11903             "customer_acceptance.offline",
11904             "customer_acceptance.online.ip_address",
11905             "customer_acceptance.online.user_agent",
11906             ],
11907             type => "object",
11908             },
11909             metadata => { type => "hash" },
11910             on_behalf_of => { type => "string" },
11911             payment_method => { re => qr/^\w+$/, type => "string" },
11912             payment_method_data => { type => "object" },
11913             payment_method_options => {
11914             fields => [
11915             "acss_debit.currency",
11916             "acss_debit.mandate_options.custom_mandate_url",
11917             "acss_debit.mandate_options.default_for",
11918             "acss_debit.mandate_options.interval_description",
11919             "acss_debit.mandate_options.payment_schedule",
11920             "acss_debit.mandate_options.transaction_type",
11921             "acss_debit.verification_method",
11922             "card.request_three_d_secure",
11923             "sepa_debit.mandate_options",
11924             ],
11925             type => "hash",
11926             },
11927             payment_method_types => { type => "array" },
11928             return_url => { type => "string" },
11929             single_use => { fields => ["amount", "currency"], type => "object" },
11930             usage => { type => "string" },
11931             };
11932              
11933             $args = $self->_contract( 'setup_intent', $args ) || CORE::return( $self->pass_error );
11934             my $err = $self->_check_parameters( $okParams, $args );
11935             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
11936             my $hash = $self->post( 'setup_intents', $args ) || CORE::return( $self->pass_error );
11937             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Payment::Intent::Setup', $hash ) );
11938             }
11939             PERL
11940             # NOTE: setup_intent_list()
11941             setup_intent_list => <<'PERL',
11942             sub setup_intent_list
11943             {
11944             my $self = shift( @_ );
11945             my $args = $self->_get_args( @_ );
11946             my $okParams =
11947             {
11948             expandable => { allowed => $EXPANDABLES->{setup_intent}, data_prefix_is_ok => 1 },
11949             active => { type => "boolean" },
11950             attach_to_self => { type => "boolean" },
11951             created => { re => qr/^\d+$/, type => "timestamp" },
11952             'created.gt' => { re => qr/^\d+$/ },
11953             'created.gte' => { re => qr/^\d+$/ },
11954             'created.lt' => { re => qr/^\d+$/ },
11955             'created.lte' => { re => qr/^\d+$/ },
11956             customer => { re => qr/^\w+$/, type => "string" },
11957             ending_before => { type => "string" },
11958             limit => { re => qr/^\d+$/, type => "string" },
11959             payment_method => { type => "string" },
11960             starting_after => { type => "string" },
11961             };
11962              
11963             my $err = $self->_check_parameters( $okParams, $args );
11964             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
11965             if( $args->{expand} )
11966             {
11967             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
11968             }
11969             my $hash = $self->get( 'setup_intents', $args ) || CORE::return( $self->pass_error );
11970             CORE::return( $self->_response_to_object( 'Net::API::Stripe::List', $hash ) );
11971             }
11972             PERL
11973             # NOTE: setup_intent_retrieve()
11974             setup_intent_retrieve => <<'PERL',
11975             sub setup_intent_retrieve
11976             {
11977             my $self = shift( @_ );
11978             CORE::return( $self->error( "No parameters were provided to retrieve setup intent information." ) ) if( !scalar( @_ ) );
11979             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Payment::Intent::Setup', @_ );
11980             my $okParams =
11981             {
11982             expandable => { allowed => $EXPANDABLES->{setup_intent}, data_prefix_is_ok => 1 },
11983             client_secret => { required => 1, type => "string" },
11984             id => { re => qr/^\w+$/, required => 1 },
11985             };
11986              
11987             my $err = $self->_check_parameters( $okParams, $args );
11988             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
11989             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No setup intent id was provided to retrieve its information." ) );
11990             my $hash = $self->get( "setup_intents/${id}", $args ) || CORE::return( $self->pass_error );
11991             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Payment::Intent::Setup', $hash ) );
11992             }
11993             PERL
11994             # NOTE: setup_intent_update()
11995             setup_intent_update => <<'PERL',
11996             sub setup_intent_update
11997             {
11998             my $self = shift( @_ );
11999             CORE::return( $self->error( "No parameters were provided to update the setup intent." ) ) if( !scalar( @_ ) );
12000             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Payment::Intent::Setup', @_ );
12001             my $okParams =
12002             {
12003             expandable => { allowed => $EXPANDABLES->{setup_intent} },
12004             attach_to_self => { type => "boolean" },
12005             customer => { type => "string" },
12006             description => { type => "string" },
12007             flow_directions => { type => "array" },
12008             id => { re => qr/^\w+$/, required => 1 },
12009             metadata => { type => "hash" },
12010             payment_method => { re => qr/^\w+$/, type => "string" },
12011             payment_method_data => { type => "object" },
12012             payment_method_options => {
12013             fields => [
12014             "acss_debit.currency",
12015             "acss_debit.mandate_options.custom_mandate_url",
12016             "acss_debit.mandate_options.default_for",
12017             "acss_debit.mandate_options.interval_description",
12018             "acss_debit.mandate_options.payment_schedule",
12019             "acss_debit.mandate_options.transaction_type",
12020             "acss_debit.verification_method",
12021             "card.request_three_d_secure",
12022             "sepa_debit.mandate_options",
12023             ],
12024             type => "hash",
12025             },
12026             payment_method_types => { type => "array" },
12027             };
12028              
12029             $args = $self->_contract( 'setup_intent', $args ) || CORE::return( $self->pass_error );
12030             # We found some errors
12031             my $err = $self->_check_parameters( $okParams, $args );
12032             # $self->message( 3, "Data to be posted: ", $self->dumper( $args ) ); exit;
12033             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
12034             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No setup intent id was provided to update its details" ) );
12035             my $hash = $self->post( "setup_intents/${id}", $args ) || CORE::return( $self->pass_error );
12036             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Payment::Intent::Setup', $hash ) );
12037             }
12038             PERL
12039             # NOTE: setup_intent_verify()
12040             setup_intent_verify => <<'PERL',
12041             sub setup_intent_verify
12042             {
12043             my $self = shift( @_ );
12044             CORE::return( $self->error( "No parameters were provided to verify microdeposits on the setup intent." ) ) if( !scalar( @_ ) );
12045             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Payment::Intent::Setup', @_ );
12046             my $okParams =
12047             {
12048             expandable => { allowed => $EXPANDABLES->{setup_intent} },
12049             id => { re => qr/^\w+$/, required => 1 },
12050             client_secret => {},
12051             amounts => { type => 'array', re => qr/^\d+$/ },
12052             descriptor_code => { re => qr/^.*?$/ },
12053             };
12054             my $err = $self->_check_parameters( $okParams, $args );
12055             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
12056             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No setup intent id was provided to verify microdeposits on it." ) );
12057             my $hash = $self->post( "setup_intents/${id}/verify_microdeposits", $args ) || CORE::return( $self->pass_error );
12058             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Payment::Intent::Setup', $hash ) );
12059             }
12060             PERL
12061             # NOTE: setup_intent_verify_microdeposits()
12062             setup_intent_verify_microdeposits => <<'PERL',
12063             sub setup_intent_verify_microdeposits
12064             {
12065             my $self = shift( @_ );
12066             CORE::return( $self->error( "No parameters were provided to verify_microdeposits setup intent information." ) ) if( !scalar( @_ ) );
12067             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Payment::Intent::Setup', @_ );
12068             my $okParams =
12069             {
12070             expandable => { allowed => $EXPANDABLES->{ 'setup_intent' } },
12071             amounts => { type => "array" },
12072             client_secret => { type => "string", required => 1 },
12073             descriptor_code => { type => "string" },
12074             };
12075             my $err = $self->_check_parameters( $okParams, $args );
12076             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
12077             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No setup_intent id (with parameter 'id') was provided to verify_microdeposits its information." ) );
12078             my $hash = $self->post( "setup_intents/${id}", $args ) || CORE::return( $self->pass_error );
12079             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Payment::Intent::Setup', $hash ) );
12080             }
12081             PERL
12082             # NOTE: setup_intents()
12083             setup_intents => <<'PERL',
12084             # <https://stripe.com/docs/api/setup_intents>
12085             sub setup_intents
12086             {
12087             my $self = shift( @_ );
12088             my $allowed = [qw( cancel confirm create list retrieve update verify verify_microdeposits )];
12089             my $action = shift( @_ );
12090             my $meth = $self->_get_method( 'setup_intent', $action, $allowed ) || CORE::return( $self->pass_error );
12091             CORE::return( $self->$meth( @_ ) );
12092             }
12093             PERL
12094             # NOTE: shipping()
12095             shipping => <<'PERL',
12096             # sub sigma { CORE::return( shift->_instantiate( 'sigma', 'Net::API::Stripe::Sigma' ) ) }
12097             sub shipping { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Shipping', @_ ) ); }
12098             PERL
12099             # NOTE: shipping_rate()
12100             shipping_rate => <<'PERL',
12101             sub shipping_rate { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Shipping::Rate', @_ ) ); }
12102             PERL
12103             # NOTE: shipping_rate_create()
12104             shipping_rate_create => <<'PERL',
12105             sub shipping_rate_create
12106             {
12107             my $self = shift( @_ );
12108             CORE::return( $self->error( "No parameters were provided to create a shipping rate" ) ) if( !scalar( @_ ) );
12109             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Shipping::Rate', @_ );
12110             my $okParams =
12111             {
12112             expandable => { allowed => $EXPANDABLES->{shipping_rate} },
12113             delivery_estimate => {
12114             fields => [
12115             "maximum.unit",
12116             "maximum.value",
12117             "minimum.unit",
12118             "minimum.value",
12119             ],
12120             type => "hash",
12121             },
12122             display_name => { re => qr/^.+$/, required => 1, type => "string" },
12123             fixed_amount => { fields => ["amount", "currency"], required => 1, type => "hash" },
12124             metadata => { type => "hash" },
12125             tax_behavior => { type => "string" },
12126             tax_code => { type => "string" },
12127             type => { re => qr/^\w+$/, required => 1, type => "string" },
12128             };
12129              
12130             $args = $self->_contract( 'shipping_rate', $args ) || CORE::return( $self->pass_error );
12131             my $err = $self->_check_parameters( $okParams, $args );
12132             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
12133             my $hash = $self->post( "shipping_rates", $args ) || CORE::return( $self->pass_error );
12134             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Shipping::Rate', $hash ) );
12135             }
12136             PERL
12137             # NOTE: shipping_rate_list()
12138             shipping_rate_list => <<'PERL',
12139             sub shipping_rate_list
12140             {
12141             my $self = shift( @_ );
12142             CORE::return( $self->error( "No parameters were provided to list shipping rates" ) ) if( !scalar( @_ ) );
12143             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Shipping::Rate', @_ );
12144             my $okParams =
12145             {
12146             expandable => { allowed => $EXPANDABLES->{shipping_rate}, data_prefix_is_ok => 1 },
12147             active => { type => "boolean" },
12148             created => { re => qr/^\d+$/, type => "timestamp" },
12149             'created.gt' => { re => qr/^\d+$/ },
12150             'created.gte' => { re => qr/^\d+$/ },
12151             'created.lt' => { re => qr/^\d+$/ },
12152             'created.lte' => { re => qr/^\d+$/ },
12153             currency => { re => qr/^[A-Z]+$/, type => "string" },
12154             ending_before => { re => qr/^\w+$/, type => "string" },
12155             id => { re => qr/^\w+$/, required => 1 },
12156             limit => { re => qr/^\d+$/, type => "string" },
12157             starting_after => { re => qr/^\w+$/, type => "string" },
12158             };
12159              
12160             my $err = $self->_check_parameters( $okParams, $args );
12161             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
12162             if( $args->{expand} )
12163             {
12164             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
12165             }
12166             my $hash = $self->get( "shipping_rates", $args ) || CORE::return( $self->pass_error );
12167             CORE::return( $self->_response_to_object( 'Net::API::Stripe::List', $hash ) );
12168             }
12169             PERL
12170             # NOTE: shipping_rate_retrieve()
12171             shipping_rate_retrieve => <<'PERL',
12172             sub shipping_rate_retrieve
12173             {
12174             my $self = shift( @_ );
12175             CORE::return( $self->error( "No parameters were provided to retrieve a shipping rate" ) ) if( !scalar( @_ ) );
12176             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Shipping::Rate', @_ );
12177             my $okParams =
12178             {
12179             expandable => { allowed => $EXPANDABLES->{shipping_rate} },
12180             id => { re => qr/^\w+$/, required => 1 },
12181             };
12182             my $err = $self->_check_parameters( $okParams, $args );
12183             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
12184             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No shipping rate id was provided to retrieve its information" ) );
12185             my $hash = $self->get( "shipping_rates/${id}", $args ) || CORE::return( $self->pass_error );
12186             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Shipping::Rate', $hash ) );
12187             }
12188             PERL
12189             # NOTE: shipping_rate_update()
12190             shipping_rate_update => <<'PERL',
12191             sub shipping_rate_update
12192             {
12193             my $self = shift( @_ );
12194             CORE::return( $self->error( "No parameters were provided to update a shipping rate" ) ) if( !scalar( @_ ) );
12195             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Shipping::Rate', @_ );
12196             my $okParams =
12197             {
12198             expandable => { allowed => $EXPANDABLES->{shipping_rate} },
12199             active => { type => "boolean" },
12200             fixed_amount => { type => "hash" },
12201             id => { re => qr/^\w+$/, required => 1 },
12202             metadata => { type => "hash" },
12203             tax_behavior => { type => "string" },
12204             };
12205              
12206             $args = $self->_contract( 'shipping_rate', $args ) || CORE::return( $self->pass_error );
12207             # We found some errors
12208             my $err = $self->_check_parameters( $okParams, $args );
12209             # $self->message( 3, "Data to be posted: ", $self->dumper( $args ) ); exit;
12210             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
12211             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No shipping rate id was provided to update its details" ) );
12212             my $hash = $self->post( "shipping_rates/${id}", $args ) || CORE::return( $self->pass_error );
12213             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Shipping::Rate', $hash ) );
12214             }
12215             PERL
12216             # NOTE: shipping_rates()
12217             shipping_rates => <<'PERL',
12218             sub shipping_rates
12219             {
12220             my $self = shift( @_ );
12221             my $action = shift( @_ );
12222             my $allowed = [qw( create retrieve update list )];
12223             my $meth = $self->_get_method( 'shipping_rate', $action, $allowed ) || CORE::return( $self->pass_error );
12224             CORE::return( $self->$meth( @_ ) );
12225             }
12226             PERL
12227             # NOTE: sku()
12228             sku => <<'PERL',
12229             sub sku { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Order::SKU' ) ) }
12230             PERL
12231             # NOTE: source()
12232             source => <<'PERL',
12233             sub source { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Payment::Source', @_ ) ); }
12234             PERL
12235             # NOTE: source_attach()
12236             source_attach => <<'PERL',
12237             sub source_attach
12238             {
12239             my $self = shift( @_ );
12240             CORE::return( $self->error( "No parameters were provided to attach a source." ) ) if( !scalar( @_ ) );
12241             my $args;
12242             if( $self->_is_object( $_[0] ) )
12243             {
12244             if( $_[0]->isa( 'Net::API::Stripe::Customer' ) )
12245             {
12246             $args = $self->_get_args_from_object( 'Net::API::Stripe::Customer', @_ );
12247             }
12248             elsif( $_[0]->isa( 'Net::API::Stripe::Payment::Source' ) )
12249             {
12250             $args = $self->_get_args_from_object( 'Net::API::Stripe::Payment::Source', @_ );
12251             my $obj = $args->{_object};
12252             $args->{source} = $obj->id;
12253             $args->{id} = $obj->customer->id if( $obj->customer );
12254             }
12255             }
12256             else
12257             {
12258             $args = $self->_get_args( @_ );
12259             }
12260             my $okParams =
12261             {
12262             expandable => { allowed => $EXPANDABLES->{source} },
12263             id => { re => qr/^\w+$/, required => 1 },
12264             source => { re => qr/^\w+$/, required => 1, type => "string" },
12265             };
12266              
12267             $args = $self->_contract( 'source', $args ) || CORE::return( $self->pass_error );
12268             my $err = $self->_check_parameters( $okParams, $args );
12269             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
12270             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No customer id was provided to attach the source to." ) );
12271             my $hash = $self->post( "customers/${id}/sources", $args ) || CORE::return( $self->pass_error );
12272             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Payment::Source', $hash ) );
12273             }
12274             PERL
12275             # NOTE: source_create()
12276             source_create => <<'PERL',
12277             sub source_create
12278             {
12279             my $self = shift( @_ );
12280             CORE::return( $self->error( "No parameters were provided to create a source" ) ) if( !scalar( @_ ) );
12281             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Payment::Source', @_ );
12282             my $okParams =
12283             {
12284             expandable => { allowed => $EXPANDABLES->{source} },
12285             amount => { type => "integer" },
12286             currency => { type => "string" },
12287             flow => { type => "string" },
12288             mandate => {
12289             fields => [
12290             "acceptance",
12291             "acceptance.status",
12292             "acceptance.date",
12293             "acceptance.ip",
12294             "acceptance.offline.contact_email",
12295             "acceptance.online",
12296             "acceptance.type",
12297             "acceptance.user_agent",
12298             "amount",
12299             "currency",
12300             "interval",
12301             "notification_method",
12302             ],
12303             type => "object",
12304             },
12305             metadata => { type => "hash" },
12306             owner => {
12307             fields => [
12308             "address.city",
12309             "address.country",
12310             "address.line1",
12311             "address.line2",
12312             "address.postal_code",
12313             "address.state",
12314             "email",
12315             "name",
12316             "phone",
12317             ],
12318             type => "hash",
12319             },
12320             receiver => { fields => ["refund_attributes_method"], type => "hash" },
12321             redirect => { fields => ["return_url"], type => "hash" },
12322             source_order => {
12323             fields => [
12324             "items.amount",
12325             "items.currency",
12326             "items.description",
12327             "items.parent",
12328             "items.quantity",
12329             "items.type",
12330             "shipping.address.city",
12331             "shipping.address.country",
12332             "shipping.address.line1",
12333             "shipping.address.line2",
12334             "shipping.address.postal_code",
12335             "shipping.address.state",
12336             "shipping.carrier",
12337             "shipping.name",
12338             "shipping.phone",
12339             "shipping.tracking_number",
12340             ],
12341             type => "hash",
12342             },
12343             statement_descriptor => { type => "string" },
12344             token => { type => "string" },
12345             type => { required => 1, type => "string" },
12346             usage => { type => "string" },
12347             };
12348              
12349             $args = $self->_contract( 'source', $args ) || CORE::return( $self->pass_error );
12350             my $err = $self->_check_parameters( $okParams, $args );
12351             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
12352             my $hash = $self->post( 'sources', $args ) || CORE::return( $self->pass_error );
12353             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Payment::Source', $hash ) );
12354             }
12355             PERL
12356             # NOTE: source_detach()
12357             source_detach => <<'PERL',
12358             # https://stripe.com/docs/api/customers/delete?lang=curl
12359             # "Permanently deletes a customer. It cannot be undone. Also immediately cancels any active subscriptions on the customer."
12360             sub source_detach
12361             {
12362             my $self = shift( @_ );
12363             CORE::return( $self->error( "No parameters were provided to detach a source." ) ) if( !scalar( @_ ) );
12364             my $args;
12365             if( $self->_is_object( $_[0] ) )
12366             {
12367             if( $_[0]->isa( 'Net::API::Stripe::Customer' ) )
12368             {
12369             $args = $self->_get_args_from_object( 'Net::API::Stripe::Customer', @_ );
12370             }
12371             elsif( $_[0]->isa( 'Net::API::Stripe::Payment::Source' ) )
12372             {
12373             $args = $self->_get_args_from_object( 'Net::API::Stripe::Payment::Source', @_ );
12374             my $obj = $args->{_object};
12375             $args->{source} = $obj->id;
12376             $args->{id} = $obj->customer->id if( $obj->customer );
12377             }
12378             }
12379             else
12380             {
12381             $args = $self->_get_args( @_ );
12382             }
12383             my $okParams =
12384             {
12385             expandable => { allowed => $EXPANDABLES->{source} },
12386             id => { re => qr/^\w+$/, required => 1 },
12387             source => { re => qr/^\w+$/, required => 1 },
12388             };
12389             $args = $self->_contract( 'source', $args ) || CORE::return( $self->pass_error );
12390             my $err = $self->_check_parameters( $okParams, $args );
12391             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
12392             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No customer id was provided to detach the source from it." ) );
12393             my $src_id = CORE::delete( $args->{source} ) || CORE::return( $self->error( "No source id was provided to detach." ) );
12394             my $hash = $self->delete( "customers/${id}/sources/${src_id}", $args ) || CORE::return( $self->pass_error );
12395             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Payment::Source', $hash ) );
12396             }
12397             PERL
12398             # NOTE: source_order()
12399             source_order => <<'PERL',
12400             sub source_order { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Order', @_ ) ); }
12401             PERL
12402             # NOTE: source_retrieve()
12403             source_retrieve => <<'PERL',
12404             sub source_retrieve
12405             {
12406             my $self = shift( @_ );
12407             CORE::return( $self->error( "No parameters were provided to retrieve source information." ) ) if( !scalar( @_ ) );
12408             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Payment::Source', @_ );
12409             my $okParams =
12410             {
12411             expandable => { allowed => $EXPANDABLES->{source}, data_prefix_is_ok => 1 },
12412             client_secret => { type => "string" },
12413             id => { re => qr/^\w+$/, required => 1 },
12414             };
12415              
12416             $args = $self->_contract( 'source', $args ) || CORE::return( $self->pass_error );
12417             my $err = $self->_check_parameters( $okParams, $args );
12418             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
12419             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No source id was provided to retrieve its information." ) );
12420             my $hash = $self->get( "sources/${id}", $args ) || CORE::return( $self->pass_error );
12421             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Payment::Source', $hash ) );
12422             }
12423             PERL
12424             # NOTE: source_update()
12425             source_update => <<'PERL',
12426             # https://stripe.com/docs/api/sources/update?lang=curl
12427             sub source_update
12428             {
12429             my $self = shift( @_ );
12430             CORE::return( $self->error( "No parameters were provided to update a source" ) ) if( !scalar( @_ ) );
12431             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Payment::Source', @_ );
12432             my $okParams =
12433             {
12434             expandable => { allowed => $EXPANDABLES->{source} },
12435             amount => { type => "integer" },
12436             id => { re => qr/^\w+$/, required => 1 },
12437             mandate => {
12438             fields => [
12439             "acceptance",
12440             "acceptance.status",
12441             "acceptance.date",
12442             "acceptance.ip",
12443             "acceptance.offline.contact_email",
12444             "acceptance.online",
12445             "acceptance.type",
12446             "acceptance.user_agent",
12447             "amount",
12448             "currency",
12449             "interval",
12450             "notification_method",
12451             ],
12452             type => "object",
12453             },
12454             metadata => { type => "hash" },
12455             owner => {
12456             fields => [
12457             "address.city",
12458             "address.country",
12459             "address.line1",
12460             "address.line2",
12461             "address.postal_code",
12462             "address.state",
12463             "email",
12464             "name",
12465             "phone",
12466             ],
12467             type => "hash",
12468             },
12469             source_order => {
12470             fields => [
12471             "items.amount",
12472             "items.currency",
12473             "items.description",
12474             "items.parent",
12475             "items.quantity",
12476             "items.type",
12477             "shipping.address.city",
12478             "shipping.address.country",
12479             "shipping.address.line1",
12480             "shipping.address.line2",
12481             "shipping.address.postal_code",
12482             "shipping.address.state",
12483             "shipping.carrier",
12484             "shipping.name",
12485             "shipping.phone",
12486             "shipping.tracking_number",
12487             ],
12488             type => "hash",
12489             },
12490             };
12491              
12492             $args = $self->_contract( 'source', $args ) || CORE::return( $self->pass_error );
12493             # We found some errors
12494             my $err = $self->_check_parameters( $okParams, $args );
12495             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
12496             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No source id was provided to update source's details" ) );
12497             my $hash = $self->post( "sources/${id}", $args ) || CORE::return( $self->pass_error );
12498             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Payment::Source', $hash ) );
12499             }
12500             PERL
12501             # NOTE: sources()
12502             sources => <<'PERL',
12503             sub sources
12504             {
12505             my $self = shift( @_ );
12506             my $action = shift( @_ );
12507             my $allowed = [qw( create retrieve update detach attach )];
12508             my $meth = $self->_get_method( 'source', $action, $allowed ) || CORE::return( $self->pass_error );
12509             CORE::return( $self->$meth( @_ ) );
12510             }
12511             PERL
12512             # NOTE: status_transitions()
12513             status_transitions => <<'PERL',
12514             sub status_transitions { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Billing::Invoice::StatusTransition', @_ ) ); }
12515             PERL
12516             # NOTE: subscription()
12517             subscription => <<'PERL',
12518             sub subscription { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Billing::Subscription', @_ ) ); }
12519             PERL
12520             # NOTE: subscription_cancel()
12521             subscription_cancel => <<'PERL',
12522             # https://stripe.com/docs/api/customers/delete?lang=curl
12523             # "Permanently deletes a customer. It cannot be undone. Also immediately cancels any active subscriptions on the customer."
12524             sub subscription_cancel
12525             {
12526             my $self = shift( @_ );
12527             CORE::return( $self->error( "No parameters were provided to cancel subscription information." ) ) if( !scalar( @_ ) );
12528             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Billing::Subscription', @_ );
12529             my $okParams =
12530             {
12531             expandable => { allowed => $EXPANDABLES->{subscription} },
12532             id => { re => qr/^\w+$/, required => 1 }
12533             };
12534             my $err = $self->_check_parameters( $okParams, $args );
12535             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
12536             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No subscription id was provided to cancel." ) );
12537             my $hash = $self->delete( "subscriptions/${id}", $args ) || CORE::return( $self->pass_error );
12538             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::Subscription', $hash ) );
12539             }
12540             PERL
12541             # NOTE: subscription_create()
12542             subscription_create => <<'PERL',
12543             sub subscription_create
12544             {
12545             my $self = shift( @_ );
12546             CORE::return( $self->error( "No parameters were provided to create a subscription" ) ) if( !scalar( @_ ) );
12547             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Billing::Subscription', @_ );
12548             my $okParams =
12549             {
12550             expandable => { allowed => $EXPANDABLES->{subscription} },
12551             add_invoice_items => {
12552             fields => ["price", "price_data", "quantity", "tax_rates"],
12553             type => "array",
12554             },
12555             application_fee_percent => { re => qr/^[0-100]$/, type => "decimal" },
12556             automatic_tax => { fields => ["enabled!"], type => "hash" },
12557             backdate_start_date => { type => "datetime" },
12558             billing_cycle_anchor => { type => "datetime" },
12559             billing_thresholds => {
12560             fields => ["amount_gte", "reset_billing_cycle_anchor"],
12561             type => "hash",
12562             },
12563             cancel_at => { type => "datetime" },
12564             cancel_at_period_end => { type => "boolean" },
12565             collection_method => { re => qr/^(?:charge_automatically|send_invoice)$/, type => "string" },
12566             coupon => { type => "string" },
12567             currency => { type => "currency" },
12568             customer => { required => 1, type => "string" },
12569             days_until_due => { type => "integer" },
12570             default_payment_method => { type => "string" },
12571             default_source => { type => "string" },
12572             default_tax_rates => { type => "array" },
12573             description => { type => "string" },
12574             items => {
12575             fields => [
12576             "billing_thresholds.usage_gte",
12577             "metadata",
12578             "plan",
12579             "price",
12580             "price_data.currency!",
12581             "price_data.product!",
12582             "price_data.recurring!",
12583             "price_data.recurring.interval!",
12584             "price_data.recurring.interval_count",
12585             "price_data.tax_behavior",
12586             "price_data.unit_amount_decimal!",
12587             "price_data.unit_amount",
12588             "quantity",
12589             "tax_rates",
12590             ],
12591             required => 1,
12592             type => "array",
12593             },
12594             metadata => { type => "hash" },
12595             off_session => { type => "boolean" },
12596             payment_behavior => {
12597             re => qr/^(?:allow_incomplete|error_if_incomplete)$/,
12598             type => "string",
12599             },
12600             payment_settings => { class => "Net::API::Stripe::Payment::Settings", type => "object" },
12601             pending_invoice_item_interval => { fields => ["interval", "interval_count"], type => "hash" },
12602             promotion_code => { type => "string" },
12603             prorate => {},
12604             proration_behavior => {
12605             re => qr/^(billing_cycle_anchor|create_prorations|none)$/,
12606             type => "string",
12607             },
12608             tax_percent => { re => qr/^[0-100]$/ },
12609             transfer_data => { fields => ["desination", "amount_percent"], type => "hash" },
12610             trial_end => { re => qr/^(?:\d+|now)$/, type => "timestamp" },
12611             trial_from_plan => { type => "boolean" },
12612             trial_period_days => { type => "integer" },
12613             };
12614              
12615             $args = $self->_contract( 'subscription', $args ) || CORE::return( $self->pass_error );
12616             my $err = $self->_check_parameters( $okParams, $args );
12617             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
12618             my $hash = $self->post( 'subscriptions', $args ) || CORE::return( $self->pass_error );
12619             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::Subscription', $hash ) );
12620             }
12621             PERL
12622             # NOTE: subscription_delete()
12623             subscription_delete => <<'PERL',
12624             sub subscription_delete
12625             {
12626             my $self = shift( @_ );
12627             my $args = shift( @_ );
12628             my $okParams =
12629             {
12630             expandable => { allowed => $EXPANDABLES->{ 'subscription' } },
12631             invoice_now => { type => "boolean" },
12632             prorate => { type => "boolean" },
12633             };
12634             $args = $self->_contract( 'subscription', $args ) || CORE::return( $self->pass_error );
12635             my $err = $self->_check_parameters( $okParams, $args );
12636             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
12637             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No subscription id (with parameter 'id') was provided to delete its information." ) );
12638             my $hash = $self->delete( "subscriptions/${id}", $args ) || CORE::return( $self->pass_error );
12639             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::Subscription', $hash ) );
12640             }
12641             PERL
12642             # NOTE: subscription_delete_discount()
12643             subscription_delete_discount => <<'PERL',
12644             sub subscription_delete_discount
12645             {
12646             my $self = shift( @_ );
12647             CORE::return( $self->error( "No parameters were provided to delete subscription discount." ) ) if( !scalar( @_ ) );
12648             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Billing::Subscription', @_ );
12649             my $okParams =
12650             {
12651             expandable => { allowed => $EXPANDABLES->{discount} },
12652             id => { re => qr/^\w+$/, required => 1 }
12653             };
12654             my $err = $self->_check_parameters( $okParams, $args );
12655             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
12656             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No subscription id was provided to delete its coupon." ) );
12657             my $hash = $self->delete( "subscriptions/${id}/discount", $args ) || CORE::return( $self->pass_error );
12658             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::Discount', $hash ) );
12659             }
12660             PERL
12661             # NOTE: subscription_item()
12662             subscription_item => <<'PERL',
12663             sub subscription_item { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Billing::Subscription::Item', @_ ) ); }
12664             PERL
12665             # NOTE: subscription_item_create()
12666             subscription_item_create => <<'PERL',
12667             sub subscription_item_create
12668             {
12669             my $self = shift( @_ );
12670             my $args = shift( @_ );
12671             my $okParams =
12672             {
12673             expandable => { allowed => $EXPANDABLES->{ 'subscription_item' } },
12674             billing_thresholds => { type => "hash" },
12675             metadata => { type => "hash" },
12676             payment_behavior => { type => "string" },
12677             price => { type => "hash" },
12678             price_data => { type => "object" },
12679             proration_behavior => { type => "string" },
12680             proration_date => { type => "integer" },
12681             quantity => { type => "integer" },
12682             subscription => { type => "string", required => 1 },
12683             tax_rates => { type => "array" },
12684             };
12685             $args = $self->_contract( 'subscription_item', $args ) || CORE::return( $self->pass_error );
12686             my $err = $self->_check_parameters( $okParams, $args );
12687             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
12688             my $hash = $self->post( "subscription_items", $args ) || CORE::return( $self->pass_error );
12689             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::Subscription::Item', $hash ) );
12690             }
12691             PERL
12692             # NOTE: subscription_item_delete()
12693             subscription_item_delete => <<'PERL',
12694             sub subscription_item_delete
12695             {
12696             my $self = shift( @_ );
12697             my $args = shift( @_ );
12698             my $okParams =
12699             {
12700             expandable => { allowed => $EXPANDABLES->{ 'subscription_item' } },
12701             clear_usage => { type => "boolean" },
12702             proration_behavior => { type => "string" },
12703             proration_date => { type => "integer" },
12704             };
12705             $args = $self->_contract( 'subscription_item', $args ) || CORE::return( $self->pass_error );
12706             my $err = $self->_check_parameters( $okParams, $args );
12707             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
12708             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No subscription_item id (with parameter 'id') was provided to delete its information." ) );
12709             my $hash = $self->delete( "subscription_items/${id}", $args ) || CORE::return( $self->pass_error );
12710             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::Subscription::Item', $hash ) );
12711             }
12712             PERL
12713             # NOTE: subscription_item_list()
12714             subscription_item_list => <<'PERL',
12715             sub subscription_item_list
12716             {
12717             my $self = shift( @_ );
12718             CORE::return( $self->error( "No parameters were provided to list subscription item information." ) ) if( !scalar( @_ ) );
12719             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Billing::Subscription::Item', @_ );
12720             my $okParams =
12721             {
12722             expandable => { allowed => $EXPANDABLES->{ 'subscription_item' }, data_prefix_is_ok => 1 },
12723             ending_before => { type => "string" },
12724             limit => { type => "string" },
12725             starting_after => { type => "string" },
12726             subscription => { type => "string", required => 1 },
12727             };
12728             my $err = $self->_check_parameters( $okParams, $args );
12729             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
12730             if( $args->{expand} )
12731             {
12732             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
12733             }
12734             my $hash = $self->get( "subscription_items", $args ) || CORE::return( $self->pass_error );
12735             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::Subscription::Item', $hash ) );
12736             }
12737             PERL
12738             # NOTE: subscription_item_retrieve()
12739             subscription_item_retrieve => <<'PERL',
12740             sub subscription_item_retrieve
12741             {
12742             my $self = shift( @_ );
12743             my $args = shift( @_ );
12744             my $okParams =
12745             {
12746             expandable => { allowed => $EXPANDABLES->{ 'subscription_item' }, data_prefix_is_ok => 1 },
12747             };
12748             $args = $self->_contract( 'subscription_item', $args ) || CORE::return( $self->pass_error );
12749             my $err = $self->_check_parameters( $okParams, $args );
12750             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
12751             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No subscription_item id (with parameter 'id') was provided to retrieve its information." ) );
12752             my $hash = $self->get( "subscription_items/${id}", $args ) || CORE::return( $self->pass_error );
12753             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::Subscription::Item', $hash ) );
12754             }
12755             PERL
12756             # NOTE: subscription_item_update()
12757             subscription_item_update => <<'PERL',
12758             sub subscription_item_update
12759             {
12760             my $self = shift( @_ );
12761             my $args = shift( @_ );
12762             my $okParams =
12763             {
12764             expandable => { allowed => $EXPANDABLES->{ 'subscription_item' } },
12765             billing_thresholds => { type => "hash" },
12766             metadata => { type => "hash" },
12767             off_session => { type => "boolean" },
12768             payment_behavior => { type => "string" },
12769             price => { type => "hash" },
12770             price_data => { type => "object" },
12771             proration_behavior => { type => "string" },
12772             proration_date => { type => "integer" },
12773             quantity => { type => "integer" },
12774             tax_rates => { type => "array" },
12775             };
12776             $args = $self->_contract( 'subscription_item', $args ) || CORE::return( $self->pass_error );
12777             my $err = $self->_check_parameters( $okParams, $args );
12778             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
12779             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No subscription_item id (with parameter 'id') was provided to update its information." ) );
12780             my $hash = $self->post( "subscription_items/${id}", $args ) || CORE::return( $self->pass_error );
12781             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::Subscription::Item', $hash ) );
12782             }
12783             PERL
12784             # NOTE: subscription_items()
12785             subscription_items => <<'PERL',
12786             # <https://stripe.com/docs/api/subscription_items>
12787             sub subscription_items
12788             {
12789             my $self = shift( @_ );
12790             my $allowed = [qw( create delete list retrieve update )];
12791             my $action = shift( @_ );
12792             my $meth = $self->_get_method( 'subscription_item', $action, $allowed ) || CORE::return( $self->pass_error );
12793             CORE::return( $self->$meth( @_ ) );
12794             }
12795             PERL
12796             # NOTE: subscription_list()
12797             subscription_list => <<'PERL',
12798             sub subscription_list
12799             {
12800             my $self = shift( @_ );
12801             my $args = $self->_get_args( @_ );
12802             my $okParams =
12803             {
12804             expandable => { allowed => $EXPANDABLES->{subscription}, data_prefix_is_ok => 1 },
12805             active => { type => "boolean" },
12806             collection_method => { type => "string" },
12807             created => { re => qr/^\d+$/, type => "timestamp" },
12808             'created.gt' => { re => qr/^\d+$/ },
12809             'created.gte' => { re => qr/^\d+$/ },
12810             'created.lt' => { re => qr/^\d+$/ },
12811             'created.lte' => { re => qr/^\d+$/ },
12812             current_period_end => { type => "timestamp" },
12813             current_period_start => { type => "timestamp" },
12814             customer => { type => "string" },
12815             ending_before => { type => "string" },
12816             ids => { type => "array" },
12817             limit => { re => qr/^\d+$/, type => "string" },
12818             price => { type => "string" },
12819             shippable => { type => "boolean" },
12820             starting_after => { type => "string" },
12821             status => { type => "string" },
12822             test_clock => { type => "string" },
12823             };
12824              
12825             my $err = $self->_check_parameters( $okParams, $args );
12826             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
12827             if( $args->{expand} )
12828             {
12829             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
12830             }
12831             my $hash = $self->get( 'subscriptions', $args ) || CORE::return( $self->pass_error );
12832             CORE::return( $self->_response_to_object( 'Net::API::Stripe::List', $hash ) );
12833             }
12834             PERL
12835             # NOTE: subscription_retrieve()
12836             subscription_retrieve => <<'PERL',
12837             sub subscription_retrieve
12838             {
12839             my $self = shift( @_ );
12840             CORE::return( $self->error( "No parameters were provided to retrieve subscription information." ) ) if( !scalar( @_ ) );
12841             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Billing::Subscription', @_ );
12842             my $okParams =
12843             {
12844             expandable => { allowed => $EXPANDABLES->{subscription} },
12845             id => { re => qr/^\w+$/, required => 1 }
12846             };
12847             my $err = $self->_check_parameters( $okParams, $args );
12848             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
12849             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No subscription id was provided to retrieve its information." ) );
12850             my $hash = $self->get( "subscriptions/${id}", $args ) || CORE::return( $self->pass_error );
12851             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::Subscription', $hash ) );
12852             }
12853             PERL
12854             # NOTE: subscription_schedule()
12855             subscription_schedule => <<'PERL',
12856             sub subscription_schedule { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Billing::Subscription::Schedule', @_ ) ); }
12857             PERL
12858             # NOTE: subscription_schedule_cancel()
12859             subscription_schedule_cancel => <<'PERL',
12860             sub subscription_schedule_cancel
12861             {
12862             my $self = shift( @_ );
12863             my $args = shift( @_ );
12864             my $okParams =
12865             {
12866             expandable => { allowed => $EXPANDABLES->{ 'subscription_schedule' } },
12867             invoice_now => { type => "boolean" },
12868             prorate => { type => "boolean" },
12869             };
12870             $args = $self->_contract( 'subscription_schedule', $args ) || CORE::return( $self->pass_error );
12871             my $err = $self->_check_parameters( $okParams, $args );
12872             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
12873             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No subscription_schedule id (with parameter 'id') was provided to cancel its information." ) );
12874             my $hash = $self->post( "subscription_schedules/${id}", $args ) || CORE::return( $self->pass_error );
12875             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::Subscription::Schedule', $hash ) );
12876             }
12877             PERL
12878             # NOTE: subscription_schedule_create()
12879             subscription_schedule_create => <<'PERL',
12880             sub subscription_schedule_create
12881             {
12882             my $self = shift( @_ );
12883             my $args = shift( @_ );
12884             my $okParams =
12885             {
12886             expandable => { allowed => $EXPANDABLES->{ 'subscription_schedule' } },
12887             customer => { type => "string" },
12888             default_settings => { type => "hash" },
12889             end_behavior => { type => "string" },
12890             from_subscription => { type => "string" },
12891             metadata => { type => "hash" },
12892             phases => { type => "array" },
12893             start_date => { type => "string" },
12894             };
12895             $args = $self->_contract( 'subscription_schedule', $args ) || CORE::return( $self->pass_error );
12896             my $err = $self->_check_parameters( $okParams, $args );
12897             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
12898             my $hash = $self->post( "subscription_schedules", $args ) || CORE::return( $self->pass_error );
12899             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::Subscription::Schedule', $hash ) );
12900             }
12901             PERL
12902             # NOTE: subscription_schedule_list()
12903             subscription_schedule_list => <<'PERL',
12904             sub subscription_schedule_list
12905             {
12906             my $self = shift( @_ );
12907             CORE::return( $self->error( "No parameters were provided to list subscription schedule information." ) ) if( !scalar( @_ ) );
12908             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Billing::Subscription::Schedule', @_ );
12909             my $okParams =
12910             {
12911             expandable => { allowed => $EXPANDABLES->{ 'subscription_schedule' }, data_prefix_is_ok => 1 },
12912             canceled_at => { type => "timestamp" },
12913             completed_at => { type => "timestamp" },
12914             created => { type => "timestamp" },
12915             customer => { type => "string" },
12916             ending_before => { type => "string" },
12917             limit => { type => "string" },
12918             released_at => { type => "timestamp" },
12919             scheduled => { type => "string" },
12920             starting_after => { type => "string" },
12921             };
12922             my $err = $self->_check_parameters( $okParams, $args );
12923             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
12924             if( $args->{expand} )
12925             {
12926             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
12927             }
12928             my $hash = $self->get( "subscription_schedules", $args ) || CORE::return( $self->pass_error );
12929             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::Subscription::Schedule', $hash ) );
12930             }
12931             PERL
12932             # NOTE: subscription_schedule_release()
12933             subscription_schedule_release => <<'PERL',
12934             sub subscription_schedule_release
12935             {
12936             my $self = shift( @_ );
12937             my $args = shift( @_ );
12938             my $okParams =
12939             {
12940             expandable => { allowed => $EXPANDABLES->{ 'subscription_schedule' } },
12941             preserve_cancel_date => { type => "boolean" },
12942             };
12943             $args = $self->_contract( 'subscription_schedule', $args ) || CORE::return( $self->pass_error );
12944             my $err = $self->_check_parameters( $okParams, $args );
12945             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
12946             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No subscription_schedule id (with parameter 'id') was provided to release its information." ) );
12947             my $hash = $self->post( "subscription_schedules/${id}", $args ) || CORE::return( $self->pass_error );
12948             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::Subscription::Schedule', $hash ) );
12949             }
12950             PERL
12951             # NOTE: subscription_schedule_retrieve()
12952             subscription_schedule_retrieve => <<'PERL',
12953             sub subscription_schedule_retrieve
12954             {
12955             my $self = shift( @_ );
12956             my $args = shift( @_ );
12957             my $okParams =
12958             {
12959             expandable => { allowed => $EXPANDABLES->{ 'subscription_schedule' }, data_prefix_is_ok => 1 },
12960             };
12961             $args = $self->_contract( 'subscription_schedule', $args ) || CORE::return( $self->pass_error );
12962             my $err = $self->_check_parameters( $okParams, $args );
12963             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
12964             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No subscription_schedule id (with parameter 'id') was provided to retrieve its information." ) );
12965             my $hash = $self->get( "subscription_schedules/${id}", $args ) || CORE::return( $self->pass_error );
12966             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::Subscription::Schedule', $hash ) );
12967             }
12968             PERL
12969             # NOTE: subscription_schedule_update()
12970             subscription_schedule_update => <<'PERL',
12971             sub subscription_schedule_update
12972             {
12973             my $self = shift( @_ );
12974             my $args = shift( @_ );
12975             my $okParams =
12976             {
12977             expandable => { allowed => $EXPANDABLES->{ 'subscription_schedule' } },
12978             default_settings => { type => "hash" },
12979             end_behavior => { type => "string" },
12980             metadata => { type => "hash" },
12981             phases => { type => "array" },
12982             proration_behavior => { type => "string" },
12983             };
12984             $args = $self->_contract( 'subscription_schedule', $args ) || CORE::return( $self->pass_error );
12985             my $err = $self->_check_parameters( $okParams, $args );
12986             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
12987             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No subscription_schedule id (with parameter 'id') was provided to update its information." ) );
12988             my $hash = $self->post( "subscription_schedules/${id}", $args ) || CORE::return( $self->pass_error );
12989             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::Subscription::Schedule', $hash ) );
12990             }
12991             PERL
12992             # NOTE: subscription_schedules()
12993             subscription_schedules => <<'PERL',
12994             # <https://stripe.com/docs/api/subscription_schedules>
12995             sub subscription_schedules
12996             {
12997             my $self = shift( @_ );
12998             my $allowed = [qw( cancel create list release retrieve update )];
12999             my $action = shift( @_ );
13000             my $meth = $self->_get_method( 'subscription_schedule', $action, $allowed ) || CORE::return( $self->pass_error );
13001             CORE::return( $self->$meth( @_ ) );
13002             }
13003             PERL
13004             # NOTE: subscription_search()
13005             subscription_search => <<'PERL',
13006             sub subscription_search
13007             {
13008             my $self = shift( @_ );
13009             my $args = shift( @_ );
13010             my $okParams =
13011             {
13012             expandable => { allowed => $EXPANDABLES->{ 'subscription' }, data_prefix_is_ok => 1 },
13013             limit => { type => "string" },
13014             page => { type => "string" },
13015             query => { type => "string", required => 1 },
13016             };
13017             $args = $self->_contract( 'subscription', $args ) || CORE::return( $self->pass_error );
13018             my $err = $self->_check_parameters( $okParams, $args );
13019             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
13020             my $hash = $self->get( "subscriptions", $args ) || CORE::return( $self->pass_error );
13021             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::Subscription', $hash ) );
13022             }
13023             PERL
13024             # NOTE: subscription_update()
13025             subscription_update => <<'PERL',
13026             # https://stripe.com/docs/api/customers/update?lang=curl
13027             sub subscription_update
13028             {
13029             my $self = shift( @_ );
13030             CORE::return( $self->error( "No parameters were provided to update a subscription" ) ) if( !scalar( @_ ) );
13031             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Billing::Subscription', @_ );
13032             my $okParams =
13033             {
13034             expandable => { allowed => $EXPANDABLES->{subscription} },
13035             add_invoice_items => { type => "array" },
13036             application_fee_percent => { re => qr/^[0-100]$/, type => "decimal" },
13037             automatic_tax => { type => "hash" },
13038             billing_cycle_anchor => { re => qr/^\d+$/, type => "timestamp" },
13039             billing_thresholds => {
13040             fields => ["amount_gte", "reset_billing_cycle_anchor"],
13041             type => "hash",
13042             },
13043             cancel_at => { type => "timestamp" },
13044             cancel_at_period_end => { type => "boolean" },
13045             collection_method => { re => qr/^(?:charge_automatically|send_invoice)$/, type => "string" },
13046             coupon => { type => "string" },
13047             days_until_due => { type => "integer" },
13048             default_payment_method => { re => qr/^[\w\_]+$/, type => "string" },
13049             default_source => { type => "string" },
13050             default_tax_rates => { type => "array" },
13051             description => { type => "string" },
13052             id => { re => qr/^\w+$/, required => 1 },
13053             items => {
13054             fields => [
13055             "id",
13056             "plan",
13057             "billing_thresholds.usage_gte",
13058             "clear_usage",
13059             "deleted",
13060             "metadata",
13061             "quantity",
13062             "tax_rates",
13063             ],
13064             type => "array",
13065             },
13066             metadata => { type => "hash" },
13067             off_session => { type => "boolean" },
13068             pause_collection => { fields => ["behavior", "resumes_at"], type => "string" },
13069             payment_behavior => {
13070             re => qr/^(?:allow_incomplete|error_if_incomplete)$/,
13071             type => "string",
13072             },
13073             payment_settings => { type => "hash" },
13074             pending_invoice_item_interval => { fields => ["interval", "interval_count"], type => "hash" },
13075             promotion_code => { type => "string" },
13076             prorate => {},
13077             proration_behavior => { type => "string" },
13078             proration_date => { type => "datetime" },
13079             tax_percent => { re => qr/^[0-100]$/ },
13080             transfer_data => { type => "hash" },
13081             trial_end => { re => qr/^(?:\d+|now)$/, type => "timestamp" },
13082             trial_from_plan => { type => "boolean" },
13083             };
13084              
13085             $args = $self->_contract( 'subscription', $args ) || CORE::return( $self->pass_error );
13086             # We found some errors
13087             my $err = $self->_check_parameters( $okParams, $args );
13088             # $self->message( 3, "Data to be posted: ", $self->dumper( $args ) ); exit;
13089             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
13090             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No subscription id was provided to update subscription's details" ) );
13091             my $hash = $self->post( "subscriptions/${id}", $args ) || CORE::return( $self->pass_error );
13092             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::Subscription', $hash ) );
13093             }
13094             PERL
13095             # NOTE: subscriptions()
13096             subscriptions => <<'PERL',
13097             # <https://stripe.com/docs/api/subscriptions>
13098             sub subscriptions
13099             {
13100             my $self = shift( @_ );
13101             my $allowed = [qw( cancel create delete delete_discount list retrieve search update )];
13102             my $action = shift( @_ );
13103             my $meth = $self->_get_method( 'subscription', $action, $allowed ) || CORE::return( $self->pass_error );
13104             CORE::return( $self->$meth( @_ ) );
13105             }
13106             PERL
13107             # NOTE: tax_code()
13108             tax_code => <<'PERL',
13109             sub tax_code { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Product::TaxCode', @_ ) ); }
13110             PERL
13111             # NOTE: tax_code_list()
13112             tax_code_list => <<'PERL',
13113             sub tax_code_list
13114             {
13115             my $self = shift( @_ );
13116             CORE::return( $self->error( "No parameters were provided to list tax codes" ) ) if( !scalar( @_ ) );
13117             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Product::TaxCode', @_ );
13118             my $okParams =
13119             {
13120             expandable => { allowed => $EXPANDABLES->{tax_code}, data_prefix_is_ok => 1 },
13121             ending_before => { re => qr/^\w+$/, type => "string" },
13122             limit => { re => qr/^\d+$/, type => "string" },
13123             starting_after => { re => qr/^\w+$/, type => "string" },
13124             };
13125              
13126             my $err = $self->_check_parameters( $okParams, $args );
13127             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
13128             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No tax code id was provided to list its information" ) );
13129             if( $args->{expand} )
13130             {
13131             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
13132             }
13133             my $hash = $self->get( "tax_codes", $args ) || CORE::return( $self->pass_error );
13134             CORE::return( $self->_response_to_object( 'Net::API::Stripe::List', $hash ) );
13135             }
13136             PERL
13137             # NOTE: tax_code_retrieve()
13138             tax_code_retrieve => <<'PERL',
13139             sub tax_code_retrieve
13140             {
13141             my $self = shift( @_ );
13142             CORE::return( $self->error( "No parameters were provided to retrieve tax code" ) ) if( !scalar( @_ ) );
13143             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Product::TaxCode', @_ );
13144             my $okParams =
13145             {
13146             expandable => { allowed => $EXPANDABLES->{tax_code} },
13147             id => { re => qr/^\w+$/, required => 1 },
13148             };
13149             my $err = $self->_check_parameters( $okParams, $args );
13150             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
13151             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No tax id was provided to retrieve tax code information" ) );
13152             my $hash = $self->get( "tax_codes/${id}", $args ) || CORE::return( $self->pass_error );
13153             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Product::TaxCode', $hash ) );
13154             }
13155             PERL
13156             # NOTE: tax_codes()
13157             tax_codes => <<'PERL',
13158             sub tax_codes
13159             {
13160             my $self = shift( @_ );
13161             my $action = shift( @_ );
13162             my $allowed = [qw( retrieve list )];
13163             my $meth = $self->_get_method( 'tax_code', $action, $allowed ) || CORE::return( $self->pass_error );
13164             CORE::return( $self->$meth( @_ ) );
13165             }
13166             PERL
13167             # NOTE: tax_id()
13168             tax_id => <<'PERL',
13169             sub tax_id { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Billing::TaxID', @_ ) ); }
13170             PERL
13171             # NOTE: tax_id_create()
13172             tax_id_create => <<'PERL',
13173             sub tax_id_create
13174             {
13175             my $self = shift( @_ );
13176             CORE::return( $self->error( "No parameters were provided to create a tax_id" ) ) if( !scalar( @_ ) );
13177             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Billing::TaxID', @_ );
13178             my $okParams =
13179             {
13180             expandable => { allowed => $EXPANDABLES->{tax_id} },
13181             customer => { re => qr/^\w+$/, required => 1 },
13182             type => { re => qr/^\w+$/, required => 1, type => "string" },
13183             value => { required => 1, type => "string" },
13184             };
13185              
13186             $args = $self->_contract( 'tax_id', $args ) || CORE::return( $self->pass_error );
13187             my $err = $self->_check_parameters( $okParams, $args );
13188             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
13189             my $id = CORE::delete( $args->{customer} ) || CORE::return( $self->error( "No customer id was provided to create a tax_id for the customer" ) );
13190             my $hash = $self->post( "customers/$id/tax_ids", $args ) || CORE::return( $self->pass_error );
13191             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::TaxID', $hash ) );
13192             }
13193             PERL
13194             # NOTE: tax_id_delete()
13195             tax_id_delete => <<'PERL',
13196             sub tax_id_delete
13197             {
13198             my $self = shift( @_ );
13199             CORE::return( $self->error( "No parameters were provided to delete a tax_id" ) ) if( !scalar( @_ ) );
13200             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Billing::TaxID', @_ );
13201             my $okParams =
13202             {
13203             expandable => { allowed => $EXPANDABLES->{tax_id} },
13204             id => { re => qr/^\w+$/, required => 1 },
13205             customer => { re => qr/^\w+$/, required => 1 },
13206             };
13207             my $err = $self->_check_parameters( $okParams, $args );
13208             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
13209             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No tax id was provided to delete." ) );
13210             my $cust_id = CORE::delete( $args->{customer} ) || CORE::return( $self->error( "No customer id was provided to delete his/her tax_id" ) );
13211             my $hash = $self->delete( "customers/${cust_id}/tax_ids/${id}", $args ) || CORE::return( $self->pass_error );
13212             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::TaxID', $hash ) );
13213             }
13214             PERL
13215             # NOTE: tax_id_list()
13216             tax_id_list => <<'PERL',
13217             sub tax_id_list
13218             {
13219             my $self = shift( @_ );
13220             CORE::return( $self->error( "No parameters were provided to list customer's tax ids" ) ) if( !scalar( @_ ) );
13221             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Customer', @_ );
13222             my $okParams =
13223             {
13224             expandable => { allowed => $EXPANDABLES->{tax_id}, data_prefix_is_ok => 1 },
13225             customer => { re => qr/^\w+$/, required => 1 },
13226             # "A cursor for use in pagination. ending_before is an object ID that defines your place in the list."
13227             ending_before => qr/^\w+$/,
13228             limit => qr/^\d+$/,
13229             starting_after => qr/^\w+$/,
13230             };
13231             my $err = $self->_check_parameters( $okParams, $args );
13232             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
13233             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" ) );
13234             if( $args->{expand} )
13235             {
13236             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
13237             }
13238             my $hash = $self->get( "customers/${id}/tax_ids", $args ) || CORE::return( $self->pass_error );
13239             CORE::return( $self->_response_to_object( 'Net::API::Stripe::List', $hash ) );
13240             }
13241             PERL
13242             # NOTE: tax_id_retrieve()
13243             tax_id_retrieve => <<'PERL',
13244             sub tax_id_retrieve
13245             {
13246             my $self = shift( @_ );
13247             CORE::return( $self->error( "No parameters were provided to retrieve tax_id" ) ) if( !scalar( @_ ) );
13248             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Billing::TaxID', @_ );
13249             my $okParams =
13250             {
13251             expandable => { allowed => $EXPANDABLES->{tax_id} },
13252             id => { re => qr/^\w+$/, required => 1 },
13253             customer => { re => qr/^\w+$/, required => 1 },
13254             };
13255             my $err = $self->_check_parameters( $okParams, $args );
13256             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
13257             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No tax id was provided to retrieve customer's tax_id" ) );
13258             my $cust_id = CORE::delete( $args->{customer} ) || CORE::return( $self->error( "No customer id was provided to retrieve his/her tax_id" ) );
13259             my $hash = $self->get( "customers/${cust_id}/tax_ids/${id}", $args ) || CORE::return( $self->pass_error );
13260             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::TaxID', $hash ) );
13261             }
13262             PERL
13263             # NOTE: tax_ids()
13264             tax_ids => <<'PERL',
13265             sub tax_ids
13266             {
13267             my $self = shift( @_ );
13268             my $action = shift( @_ );
13269             my $allowed = [qw( create retrieve delete list )];
13270             my $meth = $self->_get_method( 'tax_id', $action, $allowed ) || CORE::return( $self->pass_error );
13271             CORE::return( $self->$meth( @_ ) );
13272             }
13273             PERL
13274             # NOTE: tax_rate()
13275             tax_rate => <<'PERL',
13276             sub tax_rate { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Tax::Rate', @_ ) ); }
13277             PERL
13278             # NOTE: tax_rate_create()
13279             tax_rate_create => <<'PERL',
13280             sub tax_rate_create
13281             {
13282             my $self = shift( @_ );
13283             CORE::return( $self->error( "No parameters were provided to create a tax rate" ) ) if( !scalar( @_ ) );
13284             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Tax::Rate', @_ );
13285             my $okParams =
13286             {
13287             expandable => { allowed => $EXPANDABLES->{tax_rate} },
13288             active => { type => "boolean" },
13289             country => { re => qr/^[A-Z]+$/, type => "string" },
13290             description => { type => "string" },
13291             display_name => { re => qr/^.+$/, required => 1, type => "string" },
13292             inclusive => { required => 1, type => "boolean" },
13293             jurisdiction => { re => qr/^[A-Z]+$/, type => "string" },
13294             metadata => { type => "hash" },
13295             percentage => { required => 1, type => "integer" },
13296             state => { type => "string" },
13297             tax_type => { type => "string" },
13298             };
13299              
13300             $args = $self->_contract( 'tax_rate', $args ) || CORE::return( $self->pass_error );
13301             my $err = $self->_check_parameters( $okParams, $args );
13302             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
13303             my $hash = $self->post( "tax_rates", $args ) || CORE::return( $self->pass_error );
13304             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Tax::Rate', $hash ) );
13305             }
13306             PERL
13307             # NOTE: tax_rate_list()
13308             tax_rate_list => <<'PERL',
13309             sub tax_rate_list
13310             {
13311             my $self = shift( @_ );
13312             CORE::return( $self->error( "No parameters were provided to list tax rates" ) ) 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}, data_prefix_is_ok => 1 },
13317             active => { type => "boolean" },
13318             created => { re => qr/^\d+$/, type => "timestamp" },
13319             'created.gt' => { re => qr/^\d+$/ },
13320             'created.gte' => { re => qr/^\d+$/ },
13321             'created.lt' => { re => qr/^\d+$/ },
13322             'created.lte' => { re => qr/^\d+$/ },
13323             ending_before => { re => qr/^\w+$/, type => "string" },
13324             id => { re => qr/^\w+$/, required => 1 },
13325             inclusive => { type => "boolean" },
13326             limit => { re => qr/^\d+$/, type => "string" },
13327             starting_after => { re => qr/^\w+$/, type => "string" },
13328             };
13329              
13330             my $err = $self->_check_parameters( $okParams, $args );
13331             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
13332             if( $args->{expand} )
13333             {
13334             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
13335             }
13336             my $hash = $self->get( "tax_rates", $args ) || CORE::return( $self->pass_error );
13337             CORE::return( $self->_response_to_object( 'Net::API::Stripe::List', $hash ) );
13338             }
13339             PERL
13340             # NOTE: tax_rate_retrieve()
13341             tax_rate_retrieve => <<'PERL',
13342             sub tax_rate_retrieve
13343             {
13344             my $self = shift( @_ );
13345             CORE::return( $self->error( "No parameters were provided to retrieve a tax rate" ) ) if( !scalar( @_ ) );
13346             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Tax::Rate', @_ );
13347             my $okParams =
13348             {
13349             expandable => { allowed => $EXPANDABLES->{tax_rate} },
13350             id => { re => qr/^\w+$/, required => 1 },
13351             };
13352             my $err = $self->_check_parameters( $okParams, $args );
13353             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
13354             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No tax id was provided to retrieve a tax rate" ) );
13355             my $hash = $self->get( "tax_rates/${id}", $args ) || CORE::return( $self->pass_error );
13356             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Tax::Rate', $hash ) );
13357             }
13358             PERL
13359             # NOTE: tax_rate_update()
13360             tax_rate_update => <<'PERL',
13361             sub tax_rate_update
13362             {
13363             my $self = shift( @_ );
13364             CORE::return( $self->error( "No parameters were provided to update a tax rate" ) ) if( !scalar( @_ ) );
13365             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Tax::Rate', @_ );
13366             my $okParams =
13367             {
13368             expandable => { allowed => $EXPANDABLES->{tax_rate} },
13369             active => { type => "boolean" },
13370             country => { re => qr/^[A-Z]+$/, type => "string" },
13371             description => { type => "string" },
13372             display_name => { re => qr/^.+$/, required => 1, type => "string" },
13373             id => { re => qr/^\w+$/, required => 1 },
13374             jurisdiction => { re => qr/^[A-Z]+$/, type => "string" },
13375             metadata => { type => "hash" },
13376             state => { type => "string" },
13377             tax_type => { type => "string" },
13378             };
13379              
13380             $args = $self->_contract( 'tax_rate', $args ) || CORE::return( $self->pass_error );
13381             # We found some errors
13382             my $err = $self->_check_parameters( $okParams, $args );
13383             # $self->message( 3, "Data to be posted: ", $self->dumper( $args ) ); exit;
13384             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
13385             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No tax rate id was provided to update its details" ) );
13386             my $hash = $self->post( "tax_rates/${id}", $args ) || CORE::return( $self->pass_error );
13387             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Tax::Rate', $hash ) );
13388             }
13389             PERL
13390             # NOTE: tax_rates()
13391             tax_rates => <<'PERL',
13392             sub tax_rates
13393             {
13394             my $self = shift( @_ );
13395             my $action = shift( @_ );
13396             my $allowed = [qw( create retrieve update list )];
13397             my $meth = $self->_get_method( 'tax_rate', $action, $allowed ) || CORE::return( $self->pass_error );
13398             CORE::return( $self->$meth( @_ ) );
13399             }
13400             PERL
13401             # NOTE: terminal_configuration()
13402             terminal_configuration => <<'PERL',
13403             sub terminal_configuration { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Terminal::Configuration', @_ ) ); }
13404             PERL
13405             # NOTE: terminal_configuration_create()
13406             terminal_configuration_create => <<'PERL',
13407             sub terminal_configuration_create
13408             {
13409             my $self = shift( @_ );
13410             my $args = shift( @_ );
13411             my $okParams =
13412             {
13413             expandable => { allowed => $EXPANDABLES->{ 'terminal.configuration' } },
13414             bbpos_wisepos_e => { type => "hash" },
13415             tipping => { type => "hash" },
13416             verifone_p400 => { type => "hash" },
13417             };
13418             $args = $self->_contract( 'terminal.configuration', $args ) || CORE::return( $self->pass_error );
13419             my $err = $self->_check_parameters( $okParams, $args );
13420             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
13421             my $hash = $self->post( "", $args ) || CORE::return( $self->pass_error );
13422             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Terminal::Configuration', $hash ) );
13423             }
13424             PERL
13425             # NOTE: terminal_configuration_delete()
13426             terminal_configuration_delete => <<'PERL',
13427             sub terminal_configuration_delete
13428             {
13429             my $self = shift( @_ );
13430             my $args = shift( @_ );
13431             my $okParams =
13432             {
13433             expandable => { allowed => $EXPANDABLES->{ 'terminal.configuration' } },
13434             };
13435             $args = $self->_contract( 'terminal.configuration', $args ) || CORE::return( $self->pass_error );
13436             my $err = $self->_check_parameters( $okParams, $args );
13437             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
13438             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No terminal.configuration id (with parameter 'id') was provided to delete its information." ) );
13439             my $hash = $self->delete( "terminal/configurations/${id}", $args ) || CORE::return( $self->pass_error );
13440             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Terminal::Configuration', $hash ) );
13441             }
13442             PERL
13443             # NOTE: terminal_configuration_list()
13444             terminal_configuration_list => <<'PERL',
13445             sub terminal_configuration_list
13446             {
13447             my $self = shift( @_ );
13448             CORE::return( $self->error( "No parameters were provided to list terminal configuration information." ) ) if( !scalar( @_ ) );
13449             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Terminal::Configuration', @_ );
13450             my $okParams =
13451             {
13452             expandable => { allowed => $EXPANDABLES->{ 'terminal.configuration' }, data_prefix_is_ok => 1 },
13453             ending_before => { type => "string" },
13454             is_account_default => { type => "boolean" },
13455             limit => { type => "string" },
13456             starting_after => { type => "string" },
13457             };
13458             my $err = $self->_check_parameters( $okParams, $args );
13459             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
13460             if( $args->{expand} )
13461             {
13462             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
13463             }
13464             my $hash = $self->get( "", $args ) || CORE::return( $self->pass_error );
13465             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Terminal::Configuration', $hash ) );
13466             }
13467             PERL
13468             # NOTE: terminal_configuration_retrieve()
13469             terminal_configuration_retrieve => <<'PERL',
13470             sub terminal_configuration_retrieve
13471             {
13472             my $self = shift( @_ );
13473             my $args = shift( @_ );
13474             my $okParams =
13475             {
13476             expandable => { allowed => $EXPANDABLES->{ 'terminal.configuration' }, data_prefix_is_ok => 1 },
13477             };
13478             $args = $self->_contract( 'terminal.configuration', $args ) || CORE::return( $self->pass_error );
13479             my $err = $self->_check_parameters( $okParams, $args );
13480             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
13481             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No terminal.configuration id (with parameter 'id') was provided to retrieve its information." ) );
13482             my $hash = $self->get( "terminal/configurations/${id}", $args ) || CORE::return( $self->pass_error );
13483             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Terminal::Configuration', $hash ) );
13484             }
13485             PERL
13486             # NOTE: terminal_configuration_update()
13487             terminal_configuration_update => <<'PERL',
13488             sub terminal_configuration_update
13489             {
13490             my $self = shift( @_ );
13491             my $args = shift( @_ );
13492             my $okParams =
13493             {
13494             expandable => { allowed => $EXPANDABLES->{ 'terminal.configuration' } },
13495             bbpos_wisepos_e => { type => "hash" },
13496             tipping => { type => "hash" },
13497             verifone_p400 => { type => "hash" },
13498             };
13499             $args = $self->_contract( 'terminal.configuration', $args ) || CORE::return( $self->pass_error );
13500             my $err = $self->_check_parameters( $okParams, $args );
13501             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
13502             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No terminal.configuration id (with parameter 'id') was provided to update its information." ) );
13503             my $hash = $self->post( "terminal/configurations/${id}", $args ) || CORE::return( $self->pass_error );
13504             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Terminal::Configuration', $hash ) );
13505             }
13506             PERL
13507             # NOTE: terminal_configurations()
13508             terminal_configurations => <<'PERL',
13509             # <https://stripe.com/docs/api/terminal/configuration>
13510             sub terminal_configurations
13511             {
13512             my $self = shift( @_ );
13513             my $allowed = [qw( create delete list retrieve update )];
13514             my $action = shift( @_ );
13515             my $meth = $self->_get_method( 'terminal_configuration', $action, $allowed ) || CORE::return( $self->pass_error );
13516             CORE::return( $self->$meth( @_ ) );
13517             }
13518             PERL
13519             # NOTE: terminal_connection_token()
13520             terminal_connection_token => <<'PERL',
13521             sub terminal_connection_token { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Terminal::ConnectionToken', @_ ) ); }
13522             PERL
13523             # NOTE: terminal_connection_token_create()
13524             terminal_connection_token_create => <<'PERL',
13525             sub terminal_connection_token_create
13526             {
13527             my $self = shift( @_ );
13528             my $args = shift( @_ );
13529             my $okParams =
13530             {
13531             expandable => { allowed => $EXPANDABLES->{ 'terminal.connection_token' } },
13532             location => { type => "string" },
13533             };
13534             $args = $self->_contract( 'terminal.connection_token', $args ) || CORE::return( $self->pass_error );
13535             my $err = $self->_check_parameters( $okParams, $args );
13536             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
13537             my $hash = $self->post( "", $args ) || CORE::return( $self->pass_error );
13538             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Terminal::ConnectionToken', $hash ) );
13539             }
13540             PERL
13541             # NOTE: terminal_connection_tokens()
13542             terminal_connection_tokens => <<'PERL',
13543             # <https://stripe.com/docs/api/terminal/connection_tokens>
13544             sub terminal_connection_tokens
13545             {
13546             my $self = shift( @_ );
13547             my $allowed = [qw( create )];
13548             my $action = shift( @_ );
13549             my $meth = $self->_get_method( 'terminal_connection_token', $action, $allowed ) || CORE::return( $self->pass_error );
13550             CORE::return( $self->$meth( @_ ) );
13551             }
13552             PERL
13553             # NOTE: terminal_location()
13554             terminal_location => <<'PERL',
13555             sub terminal_location { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Terminal::Location', @_ ) ); }
13556             PERL
13557             # NOTE: terminal_location_create()
13558             terminal_location_create => <<'PERL',
13559             sub terminal_location_create
13560             {
13561             my $self = shift( @_ );
13562             my $args = shift( @_ );
13563             my $okParams =
13564             {
13565             expandable => { allowed => $EXPANDABLES->{ 'terminal.location' } },
13566             address => { type => "hash", required => 1 },
13567             configuration_overrides => { type => "string" },
13568             display_name => { type => "string", required => 1 },
13569             metadata => { type => "hash" },
13570             };
13571             $args = $self->_contract( 'terminal.location', $args ) || CORE::return( $self->pass_error );
13572             my $err = $self->_check_parameters( $okParams, $args );
13573             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
13574             my $hash = $self->post( "", $args ) || CORE::return( $self->pass_error );
13575             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Terminal::Location', $hash ) );
13576             }
13577             PERL
13578             # NOTE: terminal_location_delete()
13579             terminal_location_delete => <<'PERL',
13580             sub terminal_location_delete
13581             {
13582             my $self = shift( @_ );
13583             my $args = shift( @_ );
13584             my $okParams =
13585             {
13586             expandable => { allowed => $EXPANDABLES->{ 'terminal.location' } },
13587             };
13588             $args = $self->_contract( 'terminal.location', $args ) || CORE::return( $self->pass_error );
13589             my $err = $self->_check_parameters( $okParams, $args );
13590             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
13591             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No terminal.location id (with parameter 'id') was provided to delete its information." ) );
13592             my $hash = $self->delete( "terminal/locations/${id}", $args ) || CORE::return( $self->pass_error );
13593             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Terminal::Location', $hash ) );
13594             }
13595             PERL
13596             # NOTE: terminal_location_list()
13597             terminal_location_list => <<'PERL',
13598             sub terminal_location_list
13599             {
13600             my $self = shift( @_ );
13601             CORE::return( $self->error( "No parameters were provided to list terminal location information." ) ) if( !scalar( @_ ) );
13602             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Terminal::Location', @_ );
13603             my $okParams =
13604             {
13605             expandable => { allowed => $EXPANDABLES->{ 'terminal.location' }, data_prefix_is_ok => 1 },
13606             ending_before => { type => "string" },
13607             limit => { type => "string" },
13608             starting_after => { type => "string" },
13609             };
13610             my $err = $self->_check_parameters( $okParams, $args );
13611             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
13612             if( $args->{expand} )
13613             {
13614             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
13615             }
13616             my $hash = $self->get( "", $args ) || CORE::return( $self->pass_error );
13617             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Terminal::Location', $hash ) );
13618             }
13619             PERL
13620             # NOTE: terminal_location_retrieve()
13621             terminal_location_retrieve => <<'PERL',
13622             sub terminal_location_retrieve
13623             {
13624             my $self = shift( @_ );
13625             my $args = shift( @_ );
13626             my $okParams =
13627             {
13628             expandable => { allowed => $EXPANDABLES->{ 'terminal.location' }, data_prefix_is_ok => 1 },
13629             };
13630             $args = $self->_contract( 'terminal.location', $args ) || CORE::return( $self->pass_error );
13631             my $err = $self->_check_parameters( $okParams, $args );
13632             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
13633             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No terminal.location id (with parameter 'id') was provided to retrieve its information." ) );
13634             my $hash = $self->get( "terminal/locations/${id}", $args ) || CORE::return( $self->pass_error );
13635             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Terminal::Location', $hash ) );
13636             }
13637             PERL
13638             # NOTE: terminal_location_update()
13639             terminal_location_update => <<'PERL',
13640             sub terminal_location_update
13641             {
13642             my $self = shift( @_ );
13643             my $args = shift( @_ );
13644             my $okParams =
13645             {
13646             expandable => { allowed => $EXPANDABLES->{ 'terminal.location' } },
13647             address => { type => "hash" },
13648             configuration_overrides => { type => "string" },
13649             display_name => { type => "string" },
13650             metadata => { type => "hash" },
13651             };
13652             $args = $self->_contract( 'terminal.location', $args ) || CORE::return( $self->pass_error );
13653             my $err = $self->_check_parameters( $okParams, $args );
13654             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
13655             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No terminal.location id (with parameter 'id') was provided to update its information." ) );
13656             my $hash = $self->post( "terminal/locations/${id}", $args ) || CORE::return( $self->pass_error );
13657             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Terminal::Location', $hash ) );
13658             }
13659             PERL
13660             # NOTE: terminal_locations()
13661             terminal_locations => <<'PERL',
13662             # <https://stripe.com/docs/api/terminal/locations>
13663             sub terminal_locations
13664             {
13665             my $self = shift( @_ );
13666             my $allowed = [qw( create delete list retrieve update )];
13667             my $action = shift( @_ );
13668             my $meth = $self->_get_method( 'terminal_location', $action, $allowed ) || CORE::return( $self->pass_error );
13669             CORE::return( $self->$meth( @_ ) );
13670             }
13671             PERL
13672             # NOTE: terminal_reader()
13673             terminal_reader => <<'PERL',
13674             sub terminal_reader { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Terminal::Reader', @_ ) ); }
13675             PERL
13676             # NOTE: terminal_reader_cancel_action()
13677             terminal_reader_cancel_action => <<'PERL',
13678             sub terminal_reader_cancel_action
13679             {
13680             my $self = shift( @_ );
13681             my $args = shift( @_ );
13682             my $okParams =
13683             {
13684             expandable => { allowed => $EXPANDABLES->{ 'terminal.reader' } },
13685             };
13686             $args = $self->_contract( 'terminal.reader', $args ) || CORE::return( $self->pass_error );
13687             my $err = $self->_check_parameters( $okParams, $args );
13688             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
13689             my $hash = $self->post( "", $args ) || CORE::return( $self->pass_error );
13690             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Terminal::Reader', $hash ) );
13691             }
13692             PERL
13693             # NOTE: terminal_reader_create()
13694             terminal_reader_create => <<'PERL',
13695             sub terminal_reader_create
13696             {
13697             my $self = shift( @_ );
13698             my $args = shift( @_ );
13699             my $okParams =
13700             {
13701             expandable => { allowed => $EXPANDABLES->{ 'terminal.reader' } },
13702             label => { type => "string" },
13703             location => { type => "string" },
13704             metadata => { type => "hash" },
13705             registration_code => { type => "string", required => 1 },
13706             };
13707             $args = $self->_contract( 'terminal.reader', $args ) || CORE::return( $self->pass_error );
13708             my $err = $self->_check_parameters( $okParams, $args );
13709             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
13710             my $hash = $self->post( "", $args ) || CORE::return( $self->pass_error );
13711             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Terminal::Reader', $hash ) );
13712             }
13713             PERL
13714             # NOTE: terminal_reader_delete()
13715             terminal_reader_delete => <<'PERL',
13716             sub terminal_reader_delete
13717             {
13718             my $self = shift( @_ );
13719             my $args = shift( @_ );
13720             my $okParams =
13721             {
13722             expandable => { allowed => $EXPANDABLES->{ 'terminal.reader' } },
13723             };
13724             $args = $self->_contract( 'terminal.reader', $args ) || CORE::return( $self->pass_error );
13725             my $err = $self->_check_parameters( $okParams, $args );
13726             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
13727             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No terminal.reader id (with parameter 'id') was provided to delete its information." ) );
13728             my $hash = $self->delete( "terminal/readers/${id}", $args ) || CORE::return( $self->pass_error );
13729             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Terminal::Reader', $hash ) );
13730             }
13731             PERL
13732             # NOTE: terminal_reader_list()
13733             terminal_reader_list => <<'PERL',
13734             sub terminal_reader_list
13735             {
13736             my $self = shift( @_ );
13737             CORE::return( $self->error( "No parameters were provided to list terminal reader information." ) ) if( !scalar( @_ ) );
13738             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Terminal::Reader', @_ );
13739             my $okParams =
13740             {
13741             expandable => { allowed => $EXPANDABLES->{ 'terminal.reader' }, data_prefix_is_ok => 1 },
13742             device_type => { type => "string" },
13743             ending_before => { type => "string" },
13744             limit => { type => "string" },
13745             location => { type => "string" },
13746             serial_number => { type => "string" },
13747             starting_after => { type => "string" },
13748             status => { type => "string" },
13749             };
13750             my $err = $self->_check_parameters( $okParams, $args );
13751             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
13752             if( $args->{expand} )
13753             {
13754             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
13755             }
13756             my $hash = $self->get( "", $args ) || CORE::return( $self->pass_error );
13757             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Terminal::Reader', $hash ) );
13758             }
13759             PERL
13760             # NOTE: terminal_reader_present_payment_method()
13761             terminal_reader_present_payment_method => <<'PERL',
13762             sub terminal_reader_present_payment_method
13763             {
13764             my $self = shift( @_ );
13765             my $args = shift( @_ );
13766             my $okParams =
13767             {
13768             expandable => { allowed => $EXPANDABLES->{ 'terminal.reader' } },
13769             card_present => { type => "object" },
13770             type => { type => "string" },
13771             };
13772             $args = $self->_contract( 'terminal.reader', $args ) || CORE::return( $self->pass_error );
13773             my $err = $self->_check_parameters( $okParams, $args );
13774             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
13775             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." ) );
13776             my $hash = $self->post( "test_helpers/terminal/readers/${id}", $args ) || CORE::return( $self->pass_error );
13777             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Terminal::Reader', $hash ) );
13778             }
13779             PERL
13780             # NOTE: terminal_reader_process_payment_intent()
13781             terminal_reader_process_payment_intent => <<'PERL',
13782             sub terminal_reader_process_payment_intent
13783             {
13784             my $self = shift( @_ );
13785             my $args = shift( @_ );
13786             my $okParams =
13787             {
13788             expandable => { allowed => $EXPANDABLES->{ 'terminal.reader' } },
13789             payment_intent => { type => "string", required => 1 },
13790             process_config => { type => "object" },
13791             };
13792             $args = $self->_contract( 'terminal.reader', $args ) || CORE::return( $self->pass_error );
13793             my $err = $self->_check_parameters( $okParams, $args );
13794             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
13795             my $hash = $self->post( "", $args ) || CORE::return( $self->pass_error );
13796             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Terminal::Reader', $hash ) );
13797             }
13798             PERL
13799             # NOTE: terminal_reader_process_setup_intent()
13800             terminal_reader_process_setup_intent => <<'PERL',
13801             sub terminal_reader_process_setup_intent
13802             {
13803             my $self = shift( @_ );
13804             my $args = shift( @_ );
13805             my $okParams =
13806             {
13807             expandable => { allowed => $EXPANDABLES->{ 'terminal.reader' } },
13808             customer_consent_collected => { type => "boolean", required => 1 },
13809             setup_intent => { type => "string", required => 1 },
13810             };
13811             $args = $self->_contract( 'terminal.reader', $args ) || CORE::return( $self->pass_error );
13812             my $err = $self->_check_parameters( $okParams, $args );
13813             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
13814             my $hash = $self->post( "", $args ) || CORE::return( $self->pass_error );
13815             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Terminal::Reader', $hash ) );
13816             }
13817             PERL
13818             # NOTE: terminal_reader_retrieve()
13819             terminal_reader_retrieve => <<'PERL',
13820             sub terminal_reader_retrieve
13821             {
13822             my $self = shift( @_ );
13823             my $args = shift( @_ );
13824             my $okParams =
13825             {
13826             expandable => { allowed => $EXPANDABLES->{ 'terminal.reader' }, data_prefix_is_ok => 1 },
13827             };
13828             $args = $self->_contract( 'terminal.reader', $args ) || CORE::return( $self->pass_error );
13829             my $err = $self->_check_parameters( $okParams, $args );
13830             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
13831             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No terminal.reader id (with parameter 'id') was provided to retrieve its information." ) );
13832             my $hash = $self->get( "terminal/readers/${id}", $args ) || CORE::return( $self->pass_error );
13833             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Terminal::Reader', $hash ) );
13834             }
13835             PERL
13836             # NOTE: terminal_reader_set_reader_display()
13837             terminal_reader_set_reader_display => <<'PERL',
13838             sub terminal_reader_set_reader_display
13839             {
13840             my $self = shift( @_ );
13841             my $args = shift( @_ );
13842             my $okParams =
13843             {
13844             expandable => { allowed => $EXPANDABLES->{ 'terminal.reader' } },
13845             cart => { type => "object" },
13846             type => { type => "string", required => 1 },
13847             };
13848             $args = $self->_contract( 'terminal.reader', $args ) || CORE::return( $self->pass_error );
13849             my $err = $self->_check_parameters( $okParams, $args );
13850             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
13851             my $hash = $self->post( "", $args ) || CORE::return( $self->pass_error );
13852             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Terminal::Reader', $hash ) );
13853             }
13854             PERL
13855             # NOTE: terminal_reader_update()
13856             terminal_reader_update => <<'PERL',
13857             sub terminal_reader_update
13858             {
13859             my $self = shift( @_ );
13860             my $args = shift( @_ );
13861             my $okParams =
13862             {
13863             expandable => { allowed => $EXPANDABLES->{ 'terminal.reader' } },
13864             label => { type => "string" },
13865             metadata => { type => "hash" },
13866             };
13867             $args = $self->_contract( 'terminal.reader', $args ) || CORE::return( $self->pass_error );
13868             my $err = $self->_check_parameters( $okParams, $args );
13869             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
13870             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No terminal.reader id (with parameter 'id') was provided to update its information." ) );
13871             my $hash = $self->post( "terminal/readers/${id}", $args ) || CORE::return( $self->pass_error );
13872             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Terminal::Reader', $hash ) );
13873             }
13874             PERL
13875             # NOTE: terminal_readers()
13876             terminal_readers => <<'PERL',
13877             # <https://stripe.com/docs/api/terminal/readers>
13878             sub terminal_readers
13879             {
13880             my $self = shift( @_ );
13881             my $allowed = [qw( cancel_action create delete list present_payment_method process_payment_intent process_setup_intent retrieve set_reader_display update )];
13882             my $action = shift( @_ );
13883             my $meth = $self->_get_method( 'terminal_reader', $action, $allowed ) || CORE::return( $self->pass_error );
13884             CORE::return( $self->$meth( @_ ) );
13885             }
13886             PERL
13887             # NOTE: test_helpers_test_clock()
13888             test_helpers_test_clock => <<'PERL',
13889             sub test_helpers_test_clock { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Billing::TestHelpersTestClock', @_ ) ); }
13890             PERL
13891             # NOTE: test_helpers_test_clock_advance()
13892             test_helpers_test_clock_advance => <<'PERL',
13893             sub test_helpers_test_clock_advance
13894             {
13895             my $self = shift( @_ );
13896             my $args = shift( @_ );
13897             my $okParams =
13898             {
13899             expandable => { allowed => $EXPANDABLES->{ 'test_helpers.test_clock' } },
13900             frozen_time => { type => "timestamp", required => 1 },
13901             };
13902             $args = $self->_contract( 'test_helpers.test_clock', $args ) || CORE::return( $self->pass_error );
13903             my $err = $self->_check_parameters( $okParams, $args );
13904             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
13905             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." ) );
13906             my $hash = $self->post( "test_helpers/test_clocks/${id}", $args ) || CORE::return( $self->pass_error );
13907             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::TestHelpersTestClock', $hash ) );
13908             }
13909             PERL
13910             # NOTE: test_helpers_test_clock_create()
13911             test_helpers_test_clock_create => <<'PERL',
13912             sub test_helpers_test_clock_create
13913             {
13914             my $self = shift( @_ );
13915             my $args = shift( @_ );
13916             my $okParams =
13917             {
13918             expandable => { allowed => $EXPANDABLES->{ 'test_helpers.test_clock' } },
13919             frozen_time => { type => "timestamp", required => 1 },
13920             name => { type => "string" },
13921             };
13922             $args = $self->_contract( 'test_helpers.test_clock', $args ) || CORE::return( $self->pass_error );
13923             my $err = $self->_check_parameters( $okParams, $args );
13924             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
13925             my $hash = $self->post( "", $args ) || CORE::return( $self->pass_error );
13926             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::TestHelpersTestClock', $hash ) );
13927             }
13928             PERL
13929             # NOTE: test_helpers_test_clock_delete()
13930             test_helpers_test_clock_delete => <<'PERL',
13931             sub test_helpers_test_clock_delete
13932             {
13933             my $self = shift( @_ );
13934             my $args = shift( @_ );
13935             my $okParams =
13936             {
13937             expandable => { allowed => $EXPANDABLES->{ 'test_helpers.test_clock' } },
13938             };
13939             $args = $self->_contract( 'test_helpers.test_clock', $args ) || CORE::return( $self->pass_error );
13940             my $err = $self->_check_parameters( $okParams, $args );
13941             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
13942             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." ) );
13943             my $hash = $self->delete( "test_helpers/test_clocks/${id}", $args ) || CORE::return( $self->pass_error );
13944             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::TestHelpersTestClock', $hash ) );
13945             }
13946             PERL
13947             # NOTE: test_helpers_test_clock_list()
13948             test_helpers_test_clock_list => <<'PERL',
13949             sub test_helpers_test_clock_list
13950             {
13951             my $self = shift( @_ );
13952             CORE::return( $self->error( "No parameters were provided to list test helpers test clock information." ) ) if( !scalar( @_ ) );
13953             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Billing::TestHelpersTestClock', @_ );
13954             my $okParams =
13955             {
13956             expandable => { allowed => $EXPANDABLES->{ 'test_helpers.test_clock' }, data_prefix_is_ok => 1 },
13957             ending_before => { type => "string" },
13958             limit => { type => "string" },
13959             starting_after => { type => "string" },
13960             };
13961             my $err = $self->_check_parameters( $okParams, $args );
13962             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
13963             if( $args->{expand} )
13964             {
13965             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
13966             }
13967             my $hash = $self->get( "", $args ) || CORE::return( $self->pass_error );
13968             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::TestHelpersTestClock', $hash ) );
13969             }
13970             PERL
13971             # NOTE: test_helpers_test_clock_retrieve()
13972             test_helpers_test_clock_retrieve => <<'PERL',
13973             sub test_helpers_test_clock_retrieve
13974             {
13975             my $self = shift( @_ );
13976             my $args = shift( @_ );
13977             my $okParams =
13978             {
13979             expandable => { allowed => $EXPANDABLES->{ 'test_helpers.test_clock' }, data_prefix_is_ok => 1 },
13980             };
13981             $args = $self->_contract( 'test_helpers.test_clock', $args ) || CORE::return( $self->pass_error );
13982             my $err = $self->_check_parameters( $okParams, $args );
13983             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
13984             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." ) );
13985             my $hash = $self->get( "test_helpers/test_clocks/${id}", $args ) || CORE::return( $self->pass_error );
13986             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::TestHelpersTestClock', $hash ) );
13987             }
13988             PERL
13989             # NOTE: test_helpers_test_clocks()
13990             test_helpers_test_clocks => <<'PERL',
13991             # <https://stripe.com/docs/api/test_clocks>
13992             sub test_helpers_test_clocks
13993             {
13994             my $self = shift( @_ );
13995             my $allowed = [qw( advance create delete list retrieve )];
13996             my $action = shift( @_ );
13997             my $meth = $self->_get_method( 'test_helpers_test_clock', $action, $allowed ) || CORE::return( $self->pass_error );
13998             CORE::return( $self->$meth( @_ ) );
13999             }
14000             PERL
14001             # NOTE: token()
14002             token => <<'PERL',
14003             # sub terminal { CORE::return( shift->_instantiate( 'terminal', 'Net::API::Stripe::Terminal' ) ) }
14004             sub token { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Token', @_ ) ); }
14005             PERL
14006             # NOTE: token_create()
14007             token_create => <<'PERL',
14008             sub token_create
14009             {
14010             my $self = shift( @_ );
14011             CORE::return( $self->error( "No parameters were provided to create a token" ) ) if( !scalar( @_ ) );
14012             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Token', @_ );
14013             my $okParams =
14014             {
14015             expandable => { allowed => $EXPANDABLES->{token} },
14016             account => { fields => [qw( business_type company individual tos_shown_and_accepted )] },
14017             bank_account => { fields => [qw( country currency account_holder_name account_holder_type routing_number account_number )] },
14018             card => { fields => [qw( exp_month exp_year number currency cvc name address_line1 address_line2 address_city address_state address_zip address_country )] },
14019             customer => { re => qr/^\w+$/ },
14020             cvc_update => { fields => [qw( cvc )] },
14021             person => { re => [qw( address.city address.country address.line1 address.line2 address.postal_code address.state
14022             address_kana.city address_kanji.line1 address_kanji.line2 address_kanji.postal_code address_kanji.state address_kanji.town
14023             address_kanji.city address_kanji.line1 address_kanji.line2 address_kanji.postal_code address_kanji.state address_kanji.town
14024             dob.day dob.month dob.year
14025             documents.company_authorization.files documents.passport.files documents.visa.files
14026             email first_name first_name.kana first_name.kanji
14027             full_name_aliases gender id_number
14028             last_name last_name.kana last_name.kanji
14029             maiden_name metadata nationality phone political_exposure
14030             relationship.director relationship.executive relationship.owner relationship.percent_ownership relationship.representative relationship.title
14031             ssn_last_4 verification.additional_document.back verification.additional_document.front
14032             verification.document.back verification.document.front )] },
14033             pii => { fiekds => [qw( id_number )] },
14034             };
14035             $args = $self->_contract( 'token', $args ) || CORE::return( $self->pass_error );
14036             my $err = $self->_check_parameters( $okParams, $args );
14037             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
14038             my $hash = $self->post( 'tokens', $args ) || CORE::return( $self->pass_error );
14039             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Token', $hash ) );
14040             }
14041             PERL
14042             # NOTE: token_create_account()
14043             token_create_account => <<'PERL',
14044             sub token_create_account
14045             {
14046             my $self = shift( @_ );
14047             my $args = shift( @_ );
14048             my $okParams =
14049             {
14050             expandable => { allowed => $EXPANDABLES->{ 'token' } },
14051             account => { type => "object", required => 1 },
14052             };
14053             $args = $self->_contract( 'token', $args ) || CORE::return( $self->pass_error );
14054             my $err = $self->_check_parameters( $okParams, $args );
14055             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
14056             my $hash = $self->post( "tokens", $args ) || CORE::return( $self->pass_error );
14057             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Token', $hash ) );
14058             }
14059             PERL
14060             # NOTE: token_create_bank_account()
14061             token_create_bank_account => <<'PERL',
14062             sub token_create_bank_account
14063             {
14064             my $self = shift( @_ );
14065             my $args = shift( @_ );
14066             my $okParams =
14067             {
14068             expandable => { allowed => $EXPANDABLES->{ 'token' } },
14069             bank_account => { type => "hash" },
14070             customer => { type => "string" },
14071             };
14072             $args = $self->_contract( 'token', $args ) || CORE::return( $self->pass_error );
14073             my $err = $self->_check_parameters( $okParams, $args );
14074             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
14075             my $hash = $self->post( "tokens", $args ) || CORE::return( $self->pass_error );
14076             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Token', $hash ) );
14077             }
14078             PERL
14079             # NOTE: token_create_card()
14080             token_create_card => <<'PERL',
14081             sub token_create_card
14082             {
14083             my $self = shift( @_ );
14084             my $args = shift( @_ );
14085             my $okParams =
14086             {
14087             expandable => { allowed => $EXPANDABLES->{ 'token' } },
14088             card => { type => "hash" },
14089             customer => { type => "string" },
14090             };
14091             $args = $self->_contract( 'token', $args ) || CORE::return( $self->pass_error );
14092             my $err = $self->_check_parameters( $okParams, $args );
14093             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
14094             my $hash = $self->post( "tokens", $args ) || CORE::return( $self->pass_error );
14095             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Token', $hash ) );
14096             }
14097             PERL
14098             # NOTE: token_create_cvc_update()
14099             token_create_cvc_update => <<'PERL',
14100             sub token_create_cvc_update
14101             {
14102             my $self = shift( @_ );
14103             my $args = shift( @_ );
14104             my $okParams =
14105             {
14106             expandable => { allowed => $EXPANDABLES->{ 'token' } },
14107             cvc_update => { type => "object", required => 1 },
14108             };
14109             $args = $self->_contract( 'token', $args ) || CORE::return( $self->pass_error );
14110             my $err = $self->_check_parameters( $okParams, $args );
14111             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
14112             my $hash = $self->post( "tokens", $args ) || CORE::return( $self->pass_error );
14113             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Token', $hash ) );
14114             }
14115             PERL
14116             # NOTE: token_create_person()
14117             token_create_person => <<'PERL',
14118             sub token_create_person
14119             {
14120             my $self = shift( @_ );
14121             my $args = shift( @_ );
14122             my $okParams =
14123             {
14124             expandable => { allowed => $EXPANDABLES->{ 'token' } },
14125             person => { type => "object", required => 1 },
14126             };
14127             $args = $self->_contract( 'token', $args ) || CORE::return( $self->pass_error );
14128             my $err = $self->_check_parameters( $okParams, $args );
14129             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
14130             my $hash = $self->post( "tokens", $args ) || CORE::return( $self->pass_error );
14131             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Token', $hash ) );
14132             }
14133             PERL
14134             # NOTE: token_create_pii()
14135             token_create_pii => <<'PERL',
14136             sub token_create_pii
14137             {
14138             my $self = shift( @_ );
14139             my $args = shift( @_ );
14140             my $okParams =
14141             {
14142             expandable => { allowed => $EXPANDABLES->{ 'token' } },
14143             pii => { type => "object", required => 1 },
14144             };
14145             $args = $self->_contract( 'token', $args ) || CORE::return( $self->pass_error );
14146             my $err = $self->_check_parameters( $okParams, $args );
14147             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
14148             my $hash = $self->post( "tokens", $args ) || CORE::return( $self->pass_error );
14149             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Token', $hash ) );
14150             }
14151             PERL
14152             # NOTE: token_retrieve()
14153             token_retrieve => <<'PERL',
14154             sub token_retrieve
14155             {
14156             my $self = shift( @_ );
14157             CORE::return( $self->error( "No parameters were provided to retrieve token information." ) ) if( !scalar( @_ ) );
14158             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Token', @_ );
14159             my $okParams =
14160             {
14161             expandable => { allowed => $EXPANDABLES->{token} },
14162             id => { re => qr/^\w+$/, required => 1 }
14163             };
14164             my $err = $self->_check_parameters( $okParams, $args );
14165             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
14166             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No token id was provided to retrieve its information." ) );
14167             my $hash = $self->get( "tokens/${id}", $args ) || CORE::return( $self->pass_error );
14168             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Token', $hash ) );
14169             }
14170             PERL
14171             # NOTE: tokens()
14172             tokens => <<'PERL',
14173             # <https://stripe.com/docs/api/tokens>
14174             sub tokens
14175             {
14176             my $self = shift( @_ );
14177             my $allowed = [qw( create create_account create_bank_account create_card create_cvc_update create_person create_pii retrieve )];
14178             my $action = shift( @_ );
14179             my $meth = $self->_get_method( 'token', $action, $allowed ) || CORE::return( $self->pass_error );
14180             CORE::return( $self->$meth( @_ ) );
14181             }
14182             PERL
14183             # NOTE: topup()
14184             topup => <<'PERL',
14185             sub topup { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Connect::TopUp', @_ ) ); }
14186             PERL
14187             # NOTE: topup_cancel()
14188             topup_cancel => <<'PERL',
14189             sub topup_cancel
14190             {
14191             my $self = shift( @_ );
14192             my $args = shift( @_ );
14193             my $okParams =
14194             {
14195             expandable => { allowed => $EXPANDABLES->{ 'topup' } },
14196             };
14197             $args = $self->_contract( 'topup', $args ) || CORE::return( $self->pass_error );
14198             my $err = $self->_check_parameters( $okParams, $args );
14199             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
14200             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No topup id (with parameter 'id') was provided to cancel its information." ) );
14201             my $hash = $self->post( "topups/${id}", $args ) || CORE::return( $self->pass_error );
14202             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Connect::TopUp', $hash ) );
14203             }
14204             PERL
14205             # NOTE: topup_create()
14206             topup_create => <<'PERL',
14207             sub topup_create
14208             {
14209             my $self = shift( @_ );
14210             my $args = shift( @_ );
14211             my $okParams =
14212             {
14213             expandable => { allowed => $EXPANDABLES->{ 'topup' } },
14214             amount => { type => "integer", required => 1 },
14215             currency => { type => "string", required => 1 },
14216             description => { type => "string" },
14217             metadata => { type => "hash" },
14218             source => { type => "hash" },
14219             statement_descriptor => { type => "string" },
14220             transfer_group => { type => "string" },
14221             };
14222             $args = $self->_contract( 'topup', $args ) || CORE::return( $self->pass_error );
14223             my $err = $self->_check_parameters( $okParams, $args );
14224             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
14225             my $hash = $self->post( "topups", $args ) || CORE::return( $self->pass_error );
14226             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Connect::TopUp', $hash ) );
14227             }
14228             PERL
14229             # NOTE: topup_list()
14230             topup_list => <<'PERL',
14231             sub topup_list
14232             {
14233             my $self = shift( @_ );
14234             CORE::return( $self->error( "No parameters were provided to list topup information." ) ) if( !scalar( @_ ) );
14235             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Connect::TopUp', @_ );
14236             my $okParams =
14237             {
14238             expandable => { allowed => $EXPANDABLES->{ 'topup' }, data_prefix_is_ok => 1 },
14239             amount => { type => "integer" },
14240             created => { type => "timestamp" },
14241             ending_before => { type => "string" },
14242             limit => { type => "string" },
14243             starting_after => { type => "string" },
14244             status => { type => "string" },
14245             };
14246             my $err = $self->_check_parameters( $okParams, $args );
14247             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
14248             if( $args->{expand} )
14249             {
14250             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
14251             }
14252             my $hash = $self->get( "topups", $args ) || CORE::return( $self->pass_error );
14253             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Connect::TopUp', $hash ) );
14254             }
14255             PERL
14256             # NOTE: topup_retrieve()
14257             topup_retrieve => <<'PERL',
14258             sub topup_retrieve
14259             {
14260             my $self = shift( @_ );
14261             my $args = shift( @_ );
14262             my $okParams =
14263             {
14264             expandable => { allowed => $EXPANDABLES->{ 'topup' }, data_prefix_is_ok => 1 },
14265             };
14266             $args = $self->_contract( 'topup', $args ) || CORE::return( $self->pass_error );
14267             my $err = $self->_check_parameters( $okParams, $args );
14268             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
14269             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No topup id (with parameter 'id') was provided to retrieve its information." ) );
14270             my $hash = $self->get( "topups/${id}", $args ) || CORE::return( $self->pass_error );
14271             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Connect::TopUp', $hash ) );
14272             }
14273             PERL
14274             # NOTE: topup_update()
14275             topup_update => <<'PERL',
14276             sub topup_update
14277             {
14278             my $self = shift( @_ );
14279             my $args = shift( @_ );
14280             my $okParams =
14281             {
14282             expandable => { allowed => $EXPANDABLES->{ 'topup' } },
14283             description => { type => "string" },
14284             metadata => { type => "hash" },
14285             };
14286             $args = $self->_contract( 'topup', $args ) || CORE::return( $self->pass_error );
14287             my $err = $self->_check_parameters( $okParams, $args );
14288             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
14289             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No topup id (with parameter 'id') was provided to update its information." ) );
14290             my $hash = $self->post( "topups/${id}", $args ) || CORE::return( $self->pass_error );
14291             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Connect::TopUp', $hash ) );
14292             }
14293             PERL
14294             # NOTE: topups()
14295             topups => <<'PERL',
14296             # <https://stripe.com/docs/api/topups>
14297             sub topups
14298             {
14299             my $self = shift( @_ );
14300             my $allowed = [qw( cancel create list retrieve update )];
14301             my $action = shift( @_ );
14302             my $meth = $self->_get_method( 'topup', $action, $allowed ) || CORE::return( $self->pass_error );
14303             CORE::return( $self->$meth( @_ ) );
14304             }
14305             PERL
14306             # NOTE: tos_acceptance()
14307             tos_acceptance => <<'PERL',
14308             sub tos_acceptance { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Connect::Account::TosAcceptance', @_ ) ); }
14309             PERL
14310             # NOTE: transfer()
14311             transfer => <<'PERL',
14312             sub transfer { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Connect::Transfer', @_ ) ); }
14313             PERL
14314             # NOTE: transfer_create()
14315             transfer_create => <<'PERL',
14316             sub transfer_create
14317             {
14318             my $self = shift( @_ );
14319             my $args = shift( @_ );
14320             my $okParams =
14321             {
14322             expandable => { allowed => $EXPANDABLES->{ 'transfer' } },
14323             amount => { type => "integer" },
14324             currency => { type => "string", required => 1 },
14325             description => { type => "string" },
14326             destination => { type => "string", required => 1 },
14327             metadata => { type => "hash" },
14328             source_transaction => { type => "string" },
14329             source_type => { type => "string" },
14330             transfer_group => { type => "string" },
14331             };
14332             $args = $self->_contract( 'transfer', $args ) || CORE::return( $self->pass_error );
14333             my $err = $self->_check_parameters( $okParams, $args );
14334             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
14335             my $hash = $self->post( "transfers", $args ) || CORE::return( $self->pass_error );
14336             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Connect::Transfer', $hash ) );
14337             }
14338             PERL
14339             # NOTE: transfer_data()
14340             transfer_data => <<'PERL',
14341             sub transfer_data { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Payment::Intent::TransferData', @_ ) ); }
14342             PERL
14343             # NOTE: transfer_list()
14344             transfer_list => <<'PERL',
14345             sub transfer_list
14346             {
14347             my $self = shift( @_ );
14348             CORE::return( $self->error( "No parameters were provided to list transfer information." ) ) if( !scalar( @_ ) );
14349             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Connect::Transfer', @_ );
14350             my $okParams =
14351             {
14352             expandable => { allowed => $EXPANDABLES->{ 'transfer' }, data_prefix_is_ok => 1 },
14353             created => { type => "timestamp" },
14354             destination => { type => "string" },
14355             ending_before => { type => "string" },
14356             limit => { type => "string" },
14357             starting_after => { type => "string" },
14358             transfer_group => { type => "string" },
14359             };
14360             my $err = $self->_check_parameters( $okParams, $args );
14361             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
14362             if( $args->{expand} )
14363             {
14364             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
14365             }
14366             my $hash = $self->get( "transfers", $args ) || CORE::return( $self->pass_error );
14367             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Connect::Transfer', $hash ) );
14368             }
14369             PERL
14370             # NOTE: transfer_retrieve()
14371             transfer_retrieve => <<'PERL',
14372             sub transfer_retrieve
14373             {
14374             my $self = shift( @_ );
14375             my $args = shift( @_ );
14376             my $okParams =
14377             {
14378             expandable => { allowed => $EXPANDABLES->{ 'transfer' }, data_prefix_is_ok => 1 },
14379             };
14380             $args = $self->_contract( 'transfer', $args ) || CORE::return( $self->pass_error );
14381             my $err = $self->_check_parameters( $okParams, $args );
14382             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
14383             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No transfer id (with parameter 'id') was provided to retrieve its information." ) );
14384             my $hash = $self->get( "transfers/${id}", $args ) || CORE::return( $self->pass_error );
14385             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Connect::Transfer', $hash ) );
14386             }
14387             PERL
14388             # NOTE: transfer_reversal()
14389             transfer_reversal => <<'PERL',
14390             sub transfer_reversal { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Connect::Transfer::Reversal', @_ ) ); }
14391             PERL
14392             # NOTE: transfer_reversal_create()
14393             transfer_reversal_create => <<'PERL',
14394             sub transfer_reversal_create
14395             {
14396             my $self = shift( @_ );
14397             my $args = shift( @_ );
14398             my $okParams =
14399             {
14400             expandable => { allowed => $EXPANDABLES->{ 'transfer_reversal' } },
14401             amount => { type => "integer" },
14402             description => { type => "string" },
14403             metadata => { type => "hash" },
14404             refund_application_fee => { type => "boolean" },
14405             };
14406             $args = $self->_contract( 'transfer_reversal', $args ) || CORE::return( $self->pass_error );
14407             my $err = $self->_check_parameters( $okParams, $args );
14408             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
14409             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No transfer id (with parameter 'id') was provided to create its information." ) );
14410             my $hash = $self->post( "transfers/${id}/reversals", $args ) || CORE::return( $self->pass_error );
14411             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Connect::Transfer::Reversal', $hash ) );
14412             }
14413             PERL
14414             # NOTE: transfer_reversal_list()
14415             transfer_reversal_list => <<'PERL',
14416             sub transfer_reversal_list
14417             {
14418             my $self = shift( @_ );
14419             CORE::return( $self->error( "No parameters were provided to list transfer reversal information." ) ) if( !scalar( @_ ) );
14420             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Connect::Transfer::Reversal', @_ );
14421             my $okParams =
14422             {
14423             expandable => { allowed => $EXPANDABLES->{ 'transfer_reversal' }, data_prefix_is_ok => 1 },
14424             ending_before => { type => "string" },
14425             limit => { type => "string" },
14426             starting_after => { type => "string" },
14427             };
14428             my $err = $self->_check_parameters( $okParams, $args );
14429             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
14430             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No transfer id (with parameter 'id') was provided to list its information." ) );
14431             if( $args->{expand} )
14432             {
14433             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
14434             }
14435             my $hash = $self->get( "transfers/${id}/reversals", $args ) || CORE::return( $self->pass_error );
14436             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Connect::Transfer::Reversal', $hash ) );
14437             }
14438             PERL
14439             # NOTE: transfer_reversal_retrieve()
14440             transfer_reversal_retrieve => <<'PERL',
14441             sub transfer_reversal_retrieve
14442             {
14443             my $self = shift( @_ );
14444             my $args = shift( @_ );
14445             my $okParams =
14446             {
14447             expandable => { allowed => $EXPANDABLES->{ 'transfer_reversal' }, data_prefix_is_ok => 1 },
14448             };
14449             $args = $self->_contract( 'transfer_reversal', $args ) || CORE::return( $self->pass_error );
14450             my $err = $self->_check_parameters( $okParams, $args );
14451             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
14452             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." ) );
14453             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No transfer_reversal id (with parameter 'id') was provided to retrieve its information." ) );
14454             my $hash = $self->get( "transfers/${parent_id}/reversals/${id}", $args ) || CORE::return( $self->pass_error );
14455             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Connect::Transfer::Reversal', $hash ) );
14456             }
14457             PERL
14458             # NOTE: transfer_reversal_update()
14459             transfer_reversal_update => <<'PERL',
14460             sub transfer_reversal_update
14461             {
14462             my $self = shift( @_ );
14463             my $args = shift( @_ );
14464             my $okParams =
14465             {
14466             expandable => { allowed => $EXPANDABLES->{ 'transfer_reversal' } },
14467             metadata => { type => "hash" },
14468             };
14469             $args = $self->_contract( 'transfer_reversal', $args ) || CORE::return( $self->pass_error );
14470             my $err = $self->_check_parameters( $okParams, $args );
14471             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
14472             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." ) );
14473             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No transfer_reversal id (with parameter 'id') was provided to update its information." ) );
14474             my $hash = $self->post( "transfers/${parent_id}/reversals/${id}", $args ) || CORE::return( $self->pass_error );
14475             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Connect::Transfer::Reversal', $hash ) );
14476             }
14477             PERL
14478             # NOTE: transfer_reversals()
14479             transfer_reversals => <<'PERL',
14480             # <https://stripe.com/docs/api/transfer_reversals>
14481             sub transfer_reversals
14482             {
14483             my $self = shift( @_ );
14484             my $allowed = [qw( create list retrieve update )];
14485             my $action = shift( @_ );
14486             my $meth = $self->_get_method( 'transfer_reversal', $action, $allowed ) || CORE::return( $self->pass_error );
14487             CORE::return( $self->$meth( @_ ) );
14488             }
14489             PERL
14490             # NOTE: transfer_update()
14491             transfer_update => <<'PERL',
14492             sub transfer_update
14493             {
14494             my $self = shift( @_ );
14495             my $args = shift( @_ );
14496             my $okParams =
14497             {
14498             expandable => { allowed => $EXPANDABLES->{ 'transfer' } },
14499             description => { type => "string" },
14500             metadata => { type => "hash" },
14501             };
14502             $args = $self->_contract( 'transfer', $args ) || CORE::return( $self->pass_error );
14503             my $err = $self->_check_parameters( $okParams, $args );
14504             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
14505             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No transfer id (with parameter 'id') was provided to update its information." ) );
14506             my $hash = $self->post( "transfers/${id}", $args ) || CORE::return( $self->pass_error );
14507             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Connect::Transfer', $hash ) );
14508             }
14509             PERL
14510             # NOTE: transfers()
14511             transfers => <<'PERL',
14512             # <https://stripe.com/docs/api/transfers>
14513             sub transfers
14514             {
14515             my $self = shift( @_ );
14516             my $allowed = [qw( create list retrieve update )];
14517             my $action = shift( @_ );
14518             my $meth = $self->_get_method( 'transfer', $action, $allowed ) || CORE::return( $self->pass_error );
14519             CORE::return( $self->$meth( @_ ) );
14520             }
14521             PERL
14522             # NOTE: transform_usage()
14523             transform_usage => <<'PERL',
14524             sub transform_usage { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Billing::Plan::TransformUsage', @_ ) ); }
14525             PERL
14526             # NOTE: treasury_credit_reversal()
14527             treasury_credit_reversal => <<'PERL',
14528             sub treasury_credit_reversal { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Treasury::CreditReversal', @_ ) ); }
14529             PERL
14530             # NOTE: treasury_credit_reversal_create()
14531             treasury_credit_reversal_create => <<'PERL',
14532             sub treasury_credit_reversal_create
14533             {
14534             my $self = shift( @_ );
14535             my $args = shift( @_ );
14536             my $okParams =
14537             {
14538             expandable => { allowed => $EXPANDABLES->{ 'treasury.credit_reversal' } },
14539             metadata => { type => "hash" },
14540             received_credit => { type => "string", required => 1 },
14541             };
14542             $args = $self->_contract( 'treasury.credit_reversal', $args ) || CORE::return( $self->pass_error );
14543             my $err = $self->_check_parameters( $okParams, $args );
14544             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
14545             my $hash = $self->post( "", $args ) || CORE::return( $self->pass_error );
14546             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Treasury::CreditReversal', $hash ) );
14547             }
14548             PERL
14549             # NOTE: treasury_credit_reversal_list()
14550             treasury_credit_reversal_list => <<'PERL',
14551             sub treasury_credit_reversal_list
14552             {
14553             my $self = shift( @_ );
14554             CORE::return( $self->error( "No parameters were provided to list treasury credit reversal information." ) ) if( !scalar( @_ ) );
14555             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Treasury::CreditReversal', @_ );
14556             my $okParams =
14557             {
14558             expandable => { allowed => $EXPANDABLES->{ 'treasury.credit_reversal' }, data_prefix_is_ok => 1 },
14559             ending_before => { type => "string" },
14560             financial_account => { type => "string", required => 1 },
14561             limit => { type => "string" },
14562             received_credit => { type => "string" },
14563             starting_after => { type => "string" },
14564             status => { type => "string" },
14565             };
14566             my $err = $self->_check_parameters( $okParams, $args );
14567             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
14568             if( $args->{expand} )
14569             {
14570             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
14571             }
14572             my $hash = $self->get( "", $args ) || CORE::return( $self->pass_error );
14573             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Treasury::CreditReversal', $hash ) );
14574             }
14575             PERL
14576             # NOTE: treasury_credit_reversal_retrieve()
14577             treasury_credit_reversal_retrieve => <<'PERL',
14578             sub treasury_credit_reversal_retrieve
14579             {
14580             my $self = shift( @_ );
14581             my $args = shift( @_ );
14582             my $okParams =
14583             {
14584             expandable => { allowed => $EXPANDABLES->{ 'treasury.credit_reversal' }, data_prefix_is_ok => 1 },
14585             };
14586             $args = $self->_contract( 'treasury.credit_reversal', $args ) || CORE::return( $self->pass_error );
14587             my $err = $self->_check_parameters( $okParams, $args );
14588             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
14589             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No treasury.credit_reversal id (with parameter 'id') was provided to retrieve its information." ) );
14590             my $hash = $self->get( "treasury/credit_reversals/${id}", $args ) || CORE::return( $self->pass_error );
14591             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Treasury::CreditReversal', $hash ) );
14592             }
14593             PERL
14594             # NOTE: treasury_credit_reversals()
14595             treasury_credit_reversals => <<'PERL',
14596             # <https://stripe.com/docs/api/treasury/credit_reversals>
14597             sub treasury_credit_reversals
14598             {
14599             my $self = shift( @_ );
14600             my $allowed = [qw( create list retrieve )];
14601             my $action = shift( @_ );
14602             my $meth = $self->_get_method( 'treasury_credit_reversal', $action, $allowed ) || CORE::return( $self->pass_error );
14603             CORE::return( $self->$meth( @_ ) );
14604             }
14605             PERL
14606             # NOTE: treasury_debit_reversal()
14607             treasury_debit_reversal => <<'PERL',
14608             sub treasury_debit_reversal { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Treasury::DebitReversal', @_ ) ); }
14609             PERL
14610             # NOTE: treasury_debit_reversal_create()
14611             treasury_debit_reversal_create => <<'PERL',
14612             sub treasury_debit_reversal_create
14613             {
14614             my $self = shift( @_ );
14615             my $args = shift( @_ );
14616             my $okParams =
14617             {
14618             expandable => { allowed => $EXPANDABLES->{ 'treasury.debit_reversal' } },
14619             metadata => { type => "hash" },
14620             received_debit => { type => "string", required => 1 },
14621             };
14622             $args = $self->_contract( 'treasury.debit_reversal', $args ) || CORE::return( $self->pass_error );
14623             my $err = $self->_check_parameters( $okParams, $args );
14624             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
14625             my $hash = $self->post( "", $args ) || CORE::return( $self->pass_error );
14626             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Treasury::DebitReversal', $hash ) );
14627             }
14628             PERL
14629             # NOTE: treasury_debit_reversal_list()
14630             treasury_debit_reversal_list => <<'PERL',
14631             sub treasury_debit_reversal_list
14632             {
14633             my $self = shift( @_ );
14634             CORE::return( $self->error( "No parameters were provided to list treasury debit reversal information." ) ) if( !scalar( @_ ) );
14635             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Treasury::DebitReversal', @_ );
14636             my $okParams =
14637             {
14638             expandable => { allowed => $EXPANDABLES->{ 'treasury.debit_reversal' }, data_prefix_is_ok => 1 },
14639             ending_before => { type => "string" },
14640             financial_account => { type => "string", required => 1 },
14641             limit => { type => "string" },
14642             received_debit => { type => "string" },
14643             resolution => { type => "string" },
14644             starting_after => { type => "string" },
14645             status => { type => "string" },
14646             };
14647             my $err = $self->_check_parameters( $okParams, $args );
14648             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
14649             if( $args->{expand} )
14650             {
14651             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
14652             }
14653             my $hash = $self->get( "", $args ) || CORE::return( $self->pass_error );
14654             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Treasury::DebitReversal', $hash ) );
14655             }
14656             PERL
14657             # NOTE: treasury_debit_reversal_retrieve()
14658             treasury_debit_reversal_retrieve => <<'PERL',
14659             sub treasury_debit_reversal_retrieve
14660             {
14661             my $self = shift( @_ );
14662             my $args = shift( @_ );
14663             my $okParams =
14664             {
14665             expandable => { allowed => $EXPANDABLES->{ 'treasury.debit_reversal' }, data_prefix_is_ok => 1 },
14666             };
14667             $args = $self->_contract( 'treasury.debit_reversal', $args ) || CORE::return( $self->pass_error );
14668             my $err = $self->_check_parameters( $okParams, $args );
14669             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
14670             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No treasury.debit_reversal id (with parameter 'id') was provided to retrieve its information." ) );
14671             my $hash = $self->get( "treasury/debit_reversals/${id}", $args ) || CORE::return( $self->pass_error );
14672             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Treasury::DebitReversal', $hash ) );
14673             }
14674             PERL
14675             # NOTE: treasury_debit_reversals()
14676             treasury_debit_reversals => <<'PERL',
14677             # <https://stripe.com/docs/api/treasury/debit_reversals>
14678             sub treasury_debit_reversals
14679             {
14680             my $self = shift( @_ );
14681             my $allowed = [qw( create list retrieve )];
14682             my $action = shift( @_ );
14683             my $meth = $self->_get_method( 'treasury_debit_reversal', $action, $allowed ) || CORE::return( $self->pass_error );
14684             CORE::return( $self->$meth( @_ ) );
14685             }
14686             PERL
14687             # NOTE: treasury_financial_account()
14688             treasury_financial_account => <<'PERL',
14689             sub treasury_financial_account { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Treasury::FinancialAccount', @_ ) ); }
14690             PERL
14691             # NOTE: treasury_financial_account_create()
14692             treasury_financial_account_create => <<'PERL',
14693             sub treasury_financial_account_create
14694             {
14695             my $self = shift( @_ );
14696             my $args = shift( @_ );
14697             my $okParams =
14698             {
14699             expandable => { allowed => $EXPANDABLES->{ 'treasury.financial_account' } },
14700             features => { type => "hash" },
14701             metadata => { type => "hash" },
14702             platform_restrictions => { type => "hash" },
14703             supported_currencies => { type => "array", required => 1 },
14704             };
14705             $args = $self->_contract( 'treasury.financial_account', $args ) || CORE::return( $self->pass_error );
14706             my $err = $self->_check_parameters( $okParams, $args );
14707             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
14708             my $hash = $self->post( "", $args ) || CORE::return( $self->pass_error );
14709             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Treasury::FinancialAccount', $hash ) );
14710             }
14711             PERL
14712             # NOTE: treasury_financial_account_features()
14713             treasury_financial_account_features => <<'PERL',
14714             sub treasury_financial_account_features { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Treasury::FinancialAccountFeatures', @_ ) ); }
14715             PERL
14716             # NOTE: treasury_financial_account_features_retrieve()
14717             treasury_financial_account_features_retrieve => <<'PERL',
14718             sub treasury_financial_account_features_retrieve
14719             {
14720             my $self = shift( @_ );
14721             my $args = shift( @_ );
14722             my $okParams =
14723             {
14724             expandable => { allowed => $EXPANDABLES->{ 'treasury.financial_account_features' }, data_prefix_is_ok => 1 },
14725             };
14726             $args = $self->_contract( 'treasury.financial_account_features', $args ) || CORE::return( $self->pass_error );
14727             my $err = $self->_check_parameters( $okParams, $args );
14728             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
14729             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No treasury.financial_account id (with parameter 'id') was provided to retrieve its information." ) );
14730             my $hash = $self->get( "treasury/financial_accounts/${id}/features", $args ) || CORE::return( $self->pass_error );
14731             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Treasury::FinancialAccountFeatures', $hash ) );
14732             }
14733             PERL
14734             # NOTE: treasury_financial_account_features_update()
14735             treasury_financial_account_features_update => <<'PERL',
14736             sub treasury_financial_account_features_update
14737             {
14738             my $self = shift( @_ );
14739             my $args = shift( @_ );
14740             my $okParams =
14741             {
14742             expandable => { allowed => $EXPANDABLES->{ 'treasury.financial_account_features' } },
14743             card_issuing => { type => "hash" },
14744             deposit_insurance => { type => "hash" },
14745             financial_addresses => { type => "hash" },
14746             inbound_transfers => { type => "hash" },
14747             intra_stripe_flows => { type => "hash" },
14748             outbound_payments => { type => "hash" },
14749             outbound_transfers => { type => "hash" },
14750             };
14751             $args = $self->_contract( 'treasury.financial_account_features', $args ) || CORE::return( $self->pass_error );
14752             my $err = $self->_check_parameters( $okParams, $args );
14753             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
14754             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No treasury.financial_account id (with parameter 'id') was provided to update its information." ) );
14755             my $hash = $self->post( "treasury/financial_accounts/${id}/features", $args ) || CORE::return( $self->pass_error );
14756             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Treasury::FinancialAccountFeatures', $hash ) );
14757             }
14758             PERL
14759             # NOTE: treasury_financial_account_featuress()
14760             treasury_financial_account_featuress => <<'PERL',
14761             # <https://stripe.com/docs/api/treasury/financial_account_features>
14762             sub treasury_financial_account_featuress
14763             {
14764             my $self = shift( @_ );
14765             my $allowed = [qw( retrieve update )];
14766             my $action = shift( @_ );
14767             my $meth = $self->_get_method( 'treasury_financial_account_features', $action, $allowed ) || CORE::return( $self->pass_error );
14768             CORE::return( $self->$meth( @_ ) );
14769             }
14770             PERL
14771             # NOTE: treasury_financial_account_list()
14772             treasury_financial_account_list => <<'PERL',
14773             sub treasury_financial_account_list
14774             {
14775             my $self = shift( @_ );
14776             CORE::return( $self->error( "No parameters were provided to list treasury financial account information." ) ) if( !scalar( @_ ) );
14777             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Treasury::FinancialAccount', @_ );
14778             my $okParams =
14779             {
14780             expandable => { allowed => $EXPANDABLES->{ 'treasury.financial_account' }, data_prefix_is_ok => 1 },
14781             created => { type => "timestamp" },
14782             ending_before => { type => "string" },
14783             limit => { type => "string" },
14784             starting_after => { type => "string" },
14785             };
14786             my $err = $self->_check_parameters( $okParams, $args );
14787             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
14788             if( $args->{expand} )
14789             {
14790             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
14791             }
14792             my $hash = $self->get( "", $args ) || CORE::return( $self->pass_error );
14793             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Treasury::FinancialAccount', $hash ) );
14794             }
14795             PERL
14796             # NOTE: treasury_financial_account_retrieve()
14797             treasury_financial_account_retrieve => <<'PERL',
14798             sub treasury_financial_account_retrieve
14799             {
14800             my $self = shift( @_ );
14801             my $args = shift( @_ );
14802             my $okParams =
14803             {
14804             expandable => { allowed => $EXPANDABLES->{ 'treasury.financial_account' }, data_prefix_is_ok => 1 },
14805             };
14806             $args = $self->_contract( 'treasury.financial_account', $args ) || CORE::return( $self->pass_error );
14807             my $err = $self->_check_parameters( $okParams, $args );
14808             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
14809             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No treasury.financial_account id (with parameter 'id') was provided to retrieve its information." ) );
14810             my $hash = $self->get( "treasury/financial_accounts/${id}", $args ) || CORE::return( $self->pass_error );
14811             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Treasury::FinancialAccount', $hash ) );
14812             }
14813             PERL
14814             # NOTE: treasury_financial_account_update()
14815             treasury_financial_account_update => <<'PERL',
14816             sub treasury_financial_account_update
14817             {
14818             my $self = shift( @_ );
14819             my $args = shift( @_ );
14820             my $okParams =
14821             {
14822             expandable => { allowed => $EXPANDABLES->{ 'treasury.financial_account' } },
14823             features => { type => "hash" },
14824             metadata => { type => "hash" },
14825             platform_restrictions => { type => "hash" },
14826             };
14827             $args = $self->_contract( 'treasury.financial_account', $args ) || CORE::return( $self->pass_error );
14828             my $err = $self->_check_parameters( $okParams, $args );
14829             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
14830             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No treasury.financial_account id (with parameter 'id') was provided to update its information." ) );
14831             my $hash = $self->post( "treasury/financial_accounts/${id}", $args ) || CORE::return( $self->pass_error );
14832             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Treasury::FinancialAccount', $hash ) );
14833             }
14834             PERL
14835             # NOTE: treasury_financial_accounts()
14836             treasury_financial_accounts => <<'PERL',
14837             # <https://stripe.com/docs/api/treasury/financial_accounts>
14838             sub treasury_financial_accounts
14839             {
14840             my $self = shift( @_ );
14841             my $allowed = [qw( create list retrieve update )];
14842             my $action = shift( @_ );
14843             my $meth = $self->_get_method( 'treasury_financial_account', $action, $allowed ) || CORE::return( $self->pass_error );
14844             CORE::return( $self->$meth( @_ ) );
14845             }
14846             PERL
14847             # NOTE: treasury_inbound_transfer()
14848             treasury_inbound_transfer => <<'PERL',
14849             sub treasury_inbound_transfer { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Treasury::InboundTransfer', @_ ) ); }
14850             PERL
14851             # NOTE: treasury_inbound_transfer_cancel()
14852             treasury_inbound_transfer_cancel => <<'PERL',
14853             sub treasury_inbound_transfer_cancel
14854             {
14855             my $self = shift( @_ );
14856             my $args = shift( @_ );
14857             my $okParams =
14858             {
14859             expandable => { allowed => $EXPANDABLES->{ 'treasury.inbound_transfer' } },
14860             };
14861             $args = $self->_contract( 'treasury.inbound_transfer', $args ) || CORE::return( $self->pass_error );
14862             my $err = $self->_check_parameters( $okParams, $args );
14863             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
14864             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No treasury.inbound_transfer id (with parameter 'id') was provided to cancel its information." ) );
14865             my $hash = $self->post( "treasury/inbound_transfers/${id}", $args ) || CORE::return( $self->pass_error );
14866             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Treasury::InboundTransfer', $hash ) );
14867             }
14868             PERL
14869             # NOTE: treasury_inbound_transfer_create()
14870             treasury_inbound_transfer_create => <<'PERL',
14871             sub treasury_inbound_transfer_create
14872             {
14873             my $self = shift( @_ );
14874             my $args = shift( @_ );
14875             my $okParams =
14876             {
14877             expandable => { allowed => $EXPANDABLES->{ 'treasury.inbound_transfer' } },
14878             amount => { type => "integer", required => 1 },
14879             currency => { type => "string", required => 1 },
14880             description => { type => "string" },
14881             financial_account => { type => "string", required => 1 },
14882             metadata => { type => "hash" },
14883             origin_payment_method => { type => "string", required => 1 },
14884             statement_descriptor => { type => "string" },
14885             };
14886             $args = $self->_contract( 'treasury.inbound_transfer', $args ) || CORE::return( $self->pass_error );
14887             my $err = $self->_check_parameters( $okParams, $args );
14888             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
14889             my $hash = $self->post( "", $args ) || CORE::return( $self->pass_error );
14890             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Treasury::InboundTransfer', $hash ) );
14891             }
14892             PERL
14893             # NOTE: treasury_inbound_transfer_fail()
14894             treasury_inbound_transfer_fail => <<'PERL',
14895             sub treasury_inbound_transfer_fail
14896             {
14897             my $self = shift( @_ );
14898             my $args = shift( @_ );
14899             my $okParams =
14900             {
14901             expandable => { allowed => $EXPANDABLES->{ 'treasury.inbound_transfer' } },
14902             failure_details => { type => "hash" },
14903             };
14904             $args = $self->_contract( 'treasury.inbound_transfer', $args ) || CORE::return( $self->pass_error );
14905             my $err = $self->_check_parameters( $okParams, $args );
14906             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
14907             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No treasury.inbound_transfer id (with parameter 'id') was provided to fail its information." ) );
14908             my $hash = $self->post( "test_helpers/treasury/inbound_transfers/${id}", $args ) || CORE::return( $self->pass_error );
14909             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Treasury::InboundTransfer', $hash ) );
14910             }
14911             PERL
14912             # NOTE: treasury_inbound_transfer_list()
14913             treasury_inbound_transfer_list => <<'PERL',
14914             sub treasury_inbound_transfer_list
14915             {
14916             my $self = shift( @_ );
14917             CORE::return( $self->error( "No parameters were provided to list treasury inbound transfer information." ) ) if( !scalar( @_ ) );
14918             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Treasury::InboundTransfer', @_ );
14919             my $okParams =
14920             {
14921             expandable => { allowed => $EXPANDABLES->{ 'treasury.inbound_transfer' }, data_prefix_is_ok => 1 },
14922             ending_before => { type => "string" },
14923             financial_account => { type => "string", required => 1 },
14924             limit => { type => "string" },
14925             starting_after => { type => "string" },
14926             status => { type => "string" },
14927             };
14928             my $err = $self->_check_parameters( $okParams, $args );
14929             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
14930             if( $args->{expand} )
14931             {
14932             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
14933             }
14934             my $hash = $self->get( "", $args ) || CORE::return( $self->pass_error );
14935             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Treasury::InboundTransfer', $hash ) );
14936             }
14937             PERL
14938             # NOTE: treasury_inbound_transfer_retrieve()
14939             treasury_inbound_transfer_retrieve => <<'PERL',
14940             sub treasury_inbound_transfer_retrieve
14941             {
14942             my $self = shift( @_ );
14943             my $args = shift( @_ );
14944             my $okParams =
14945             {
14946             expandable => { allowed => $EXPANDABLES->{ 'treasury.inbound_transfer' }, data_prefix_is_ok => 1 },
14947             };
14948             $args = $self->_contract( 'treasury.inbound_transfer', $args ) || CORE::return( $self->pass_error );
14949             my $err = $self->_check_parameters( $okParams, $args );
14950             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
14951             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No treasury.inbound_transfer id (with parameter 'id') was provided to retrieve its information." ) );
14952             my $hash = $self->get( "treasury/inbound_transfers/${id}", $args ) || CORE::return( $self->pass_error );
14953             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Treasury::InboundTransfer', $hash ) );
14954             }
14955             PERL
14956             # NOTE: treasury_inbound_transfer_return()
14957             treasury_inbound_transfer_return => <<'PERL',
14958             sub treasury_inbound_transfer_return
14959             {
14960             my $self = shift( @_ );
14961             my $args = shift( @_ );
14962             my $okParams =
14963             {
14964             expandable => { allowed => $EXPANDABLES->{ 'treasury.inbound_transfer' } },
14965             };
14966             $args = $self->_contract( 'treasury.inbound_transfer', $args ) || CORE::return( $self->pass_error );
14967             my $err = $self->_check_parameters( $okParams, $args );
14968             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
14969             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No treasury.inbound_transfer id (with parameter 'id') was provided to return its information." ) );
14970             my $hash = $self->post( "test_helpers/treasury/inbound_transfers/${id}", $args ) || CORE::return( $self->pass_error );
14971             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Treasury::InboundTransfer', $hash ) );
14972             }
14973             PERL
14974             # NOTE: treasury_inbound_transfer_succeed()
14975             treasury_inbound_transfer_succeed => <<'PERL',
14976             sub treasury_inbound_transfer_succeed
14977             {
14978             my $self = shift( @_ );
14979             my $args = shift( @_ );
14980             my $okParams =
14981             {
14982             expandable => { allowed => $EXPANDABLES->{ 'treasury.inbound_transfer' } },
14983             };
14984             $args = $self->_contract( 'treasury.inbound_transfer', $args ) || CORE::return( $self->pass_error );
14985             my $err = $self->_check_parameters( $okParams, $args );
14986             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
14987             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No treasury.inbound_transfer id (with parameter 'id') was provided to succeed its information." ) );
14988             my $hash = $self->post( "test_helpers/treasury/inbound_transfers/${id}", $args ) || CORE::return( $self->pass_error );
14989             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Treasury::InboundTransfer', $hash ) );
14990             }
14991             PERL
14992             # NOTE: treasury_inbound_transfers()
14993             treasury_inbound_transfers => <<'PERL',
14994             # <https://stripe.com/docs/api/treasury/inbound_transfers>
14995             sub treasury_inbound_transfers
14996             {
14997             my $self = shift( @_ );
14998             my $allowed = [qw( cancel create fail list retrieve return succeed )];
14999             my $action = shift( @_ );
15000             my $meth = $self->_get_method( 'treasury_inbound_transfer', $action, $allowed ) || CORE::return( $self->pass_error );
15001             CORE::return( $self->$meth( @_ ) );
15002             }
15003             PERL
15004             # NOTE: treasury_outbound_payment()
15005             treasury_outbound_payment => <<'PERL',
15006             sub treasury_outbound_payment { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Treasury::OutboundPayment', @_ ) ); }
15007             PERL
15008             # NOTE: treasury_outbound_payment_cancel()
15009             treasury_outbound_payment_cancel => <<'PERL',
15010             sub treasury_outbound_payment_cancel
15011             {
15012             my $self = shift( @_ );
15013             my $args = shift( @_ );
15014             my $okParams =
15015             {
15016             expandable => { allowed => $EXPANDABLES->{ 'treasury.outbound_payment' } },
15017             };
15018             $args = $self->_contract( 'treasury.outbound_payment', $args ) || CORE::return( $self->pass_error );
15019             my $err = $self->_check_parameters( $okParams, $args );
15020             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
15021             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No treasury.outbound_payment id (with parameter 'id') was provided to cancel its information." ) );
15022             my $hash = $self->post( "treasury/outbound_payments/${id}", $args ) || CORE::return( $self->pass_error );
15023             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Treasury::OutboundPayment', $hash ) );
15024             }
15025             PERL
15026             # NOTE: treasury_outbound_payment_create()
15027             treasury_outbound_payment_create => <<'PERL',
15028             sub treasury_outbound_payment_create
15029             {
15030             my $self = shift( @_ );
15031             my $args = shift( @_ );
15032             my $okParams =
15033             {
15034             expandable => { allowed => $EXPANDABLES->{ 'treasury.outbound_payment' } },
15035             amount => { type => "integer", required => 1 },
15036             currency => { type => "string", required => 1 },
15037             customer => { type => "string" },
15038             description => { type => "string" },
15039             destination_payment_method => { type => "string" },
15040             destination_payment_method_data => { type => "object" },
15041             destination_payment_method_options => { type => "object" },
15042             end_user_details => { type => "hash" },
15043             financial_account => { type => "string", required => 1 },
15044             metadata => { type => "hash" },
15045             statement_descriptor => { type => "string" },
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 $hash = $self->post( "", $args ) || CORE::return( $self->pass_error );
15051             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Treasury::OutboundPayment', $hash ) );
15052             }
15053             PERL
15054             # NOTE: treasury_outbound_payment_fail()
15055             treasury_outbound_payment_fail => <<'PERL',
15056             sub treasury_outbound_payment_fail
15057             {
15058             my $self = shift( @_ );
15059             my $args = shift( @_ );
15060             my $okParams =
15061             {
15062             expandable => { allowed => $EXPANDABLES->{ 'treasury.outbound_payment' } },
15063             };
15064             $args = $self->_contract( 'treasury.outbound_payment', $args ) || CORE::return( $self->pass_error );
15065             my $err = $self->_check_parameters( $okParams, $args );
15066             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
15067             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No treasury.outbound_payment id (with parameter 'id') was provided to fail its information." ) );
15068             my $hash = $self->post( "test_helpers/treasury/outbound_payments/${id}", $args ) || CORE::return( $self->pass_error );
15069             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Treasury::OutboundPayment', $hash ) );
15070             }
15071             PERL
15072             # NOTE: treasury_outbound_payment_list()
15073             treasury_outbound_payment_list => <<'PERL',
15074             sub treasury_outbound_payment_list
15075             {
15076             my $self = shift( @_ );
15077             CORE::return( $self->error( "No parameters were provided to list treasury outbound payment information." ) ) if( !scalar( @_ ) );
15078             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Treasury::OutboundPayment', @_ );
15079             my $okParams =
15080             {
15081             expandable => { allowed => $EXPANDABLES->{ 'treasury.outbound_payment' }, data_prefix_is_ok => 1 },
15082             customer => { type => "string" },
15083             ending_before => { type => "string" },
15084             financial_account => { type => "string", required => 1 },
15085             limit => { type => "string" },
15086             starting_after => { type => "string" },
15087             status => { type => "string" },
15088             };
15089             my $err = $self->_check_parameters( $okParams, $args );
15090             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
15091             if( $args->{expand} )
15092             {
15093             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
15094             }
15095             my $hash = $self->get( "", $args ) || CORE::return( $self->pass_error );
15096             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Treasury::OutboundPayment', $hash ) );
15097             }
15098             PERL
15099             # NOTE: treasury_outbound_payment_post()
15100             treasury_outbound_payment_post => <<'PERL',
15101             sub treasury_outbound_payment_post
15102             {
15103             my $self = shift( @_ );
15104             my $args = shift( @_ );
15105             my $okParams =
15106             {
15107             expandable => { allowed => $EXPANDABLES->{ 'treasury.outbound_payment' } },
15108             };
15109             $args = $self->_contract( 'treasury.outbound_payment', $args ) || CORE::return( $self->pass_error );
15110             my $err = $self->_check_parameters( $okParams, $args );
15111             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
15112             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No treasury.outbound_payment id (with parameter 'id') was provided to post its information." ) );
15113             my $hash = $self->post( "test_helpers/treasury/outbound_payments/${id}", $args ) || CORE::return( $self->pass_error );
15114             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Treasury::OutboundPayment', $hash ) );
15115             }
15116             PERL
15117             # NOTE: treasury_outbound_payment_retrieve()
15118             treasury_outbound_payment_retrieve => <<'PERL',
15119             sub treasury_outbound_payment_retrieve
15120             {
15121             my $self = shift( @_ );
15122             my $args = shift( @_ );
15123             my $okParams =
15124             {
15125             expandable => { allowed => $EXPANDABLES->{ 'treasury.outbound_payment' }, data_prefix_is_ok => 1 },
15126             };
15127             $args = $self->_contract( 'treasury.outbound_payment', $args ) || CORE::return( $self->pass_error );
15128             my $err = $self->_check_parameters( $okParams, $args );
15129             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
15130             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No treasury.outbound_payment id (with parameter 'id') was provided to retrieve its information." ) );
15131             my $hash = $self->get( "treasury/outbound_payments/${id}", $args ) || CORE::return( $self->pass_error );
15132             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Treasury::OutboundPayment', $hash ) );
15133             }
15134             PERL
15135             # NOTE: treasury_outbound_payment_return()
15136             treasury_outbound_payment_return => <<'PERL',
15137             sub treasury_outbound_payment_return
15138             {
15139             my $self = shift( @_ );
15140             my $args = shift( @_ );
15141             my $okParams =
15142             {
15143             expandable => { allowed => $EXPANDABLES->{ 'treasury.outbound_payment' } },
15144             returned_details => { type => "hash" },
15145             };
15146             $args = $self->_contract( 'treasury.outbound_payment', $args ) || CORE::return( $self->pass_error );
15147             my $err = $self->_check_parameters( $okParams, $args );
15148             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
15149             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No treasury.outbound_payment id (with parameter 'id') was provided to return its information." ) );
15150             my $hash = $self->post( "test_helpers/treasury/outbound_payments/${id}", $args ) || CORE::return( $self->pass_error );
15151             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Treasury::OutboundPayment', $hash ) );
15152             }
15153             PERL
15154             # NOTE: treasury_outbound_payments()
15155             treasury_outbound_payments => <<'PERL',
15156             # <https://stripe.com/docs/api/treasury/outbound_payments>
15157             sub treasury_outbound_payments
15158             {
15159             my $self = shift( @_ );
15160             my $allowed = [qw( cancel create fail list post retrieve return )];
15161             my $action = shift( @_ );
15162             my $meth = $self->_get_method( 'treasury_outbound_payment', $action, $allowed ) || CORE::return( $self->pass_error );
15163             CORE::return( $self->$meth( @_ ) );
15164             }
15165             PERL
15166             # NOTE: treasury_outbound_transfer()
15167             treasury_outbound_transfer => <<'PERL',
15168             sub treasury_outbound_transfer { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Treasury::OutboundTransfer', @_ ) ); }
15169             PERL
15170             # NOTE: treasury_outbound_transfer_cancel()
15171             treasury_outbound_transfer_cancel => <<'PERL',
15172             sub treasury_outbound_transfer_cancel
15173             {
15174             my $self = shift( @_ );
15175             my $args = shift( @_ );
15176             my $okParams =
15177             {
15178             expandable => { allowed => $EXPANDABLES->{ 'treasury.outbound_transfer' } },
15179             };
15180             $args = $self->_contract( 'treasury.outbound_transfer', $args ) || CORE::return( $self->pass_error );
15181             my $err = $self->_check_parameters( $okParams, $args );
15182             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
15183             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No treasury.outbound_transfer id (with parameter 'id') was provided to cancel its information." ) );
15184             my $hash = $self->post( "treasury/outbound_transfers/${id}", $args ) || CORE::return( $self->pass_error );
15185             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Treasury::OutboundTransfer', $hash ) );
15186             }
15187             PERL
15188             # NOTE: treasury_outbound_transfer_create()
15189             treasury_outbound_transfer_create => <<'PERL',
15190             sub treasury_outbound_transfer_create
15191             {
15192             my $self = shift( @_ );
15193             my $args = shift( @_ );
15194             my $okParams =
15195             {
15196             expandable => { allowed => $EXPANDABLES->{ 'treasury.outbound_transfer' } },
15197             amount => { type => "integer", required => 1 },
15198             currency => { type => "string", required => 1 },
15199             description => { type => "string" },
15200             destination_payment_method => { type => "string" },
15201             destination_payment_method_options => { type => "object" },
15202             financial_account => { type => "string", required => 1 },
15203             metadata => { type => "hash" },
15204             statement_descriptor => { type => "string" },
15205             };
15206             $args = $self->_contract( 'treasury.outbound_transfer', $args ) || CORE::return( $self->pass_error );
15207             my $err = $self->_check_parameters( $okParams, $args );
15208             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
15209             my $hash = $self->post( "", $args ) || CORE::return( $self->pass_error );
15210             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Treasury::OutboundTransfer', $hash ) );
15211             }
15212             PERL
15213             # NOTE: treasury_outbound_transfer_fail()
15214             treasury_outbound_transfer_fail => <<'PERL',
15215             sub treasury_outbound_transfer_fail
15216             {
15217             my $self = shift( @_ );
15218             my $args = shift( @_ );
15219             my $okParams =
15220             {
15221             expandable => { allowed => $EXPANDABLES->{ 'treasury.outbound_transfer' } },
15222             };
15223             $args = $self->_contract( 'treasury.outbound_transfer', $args ) || CORE::return( $self->pass_error );
15224             my $err = $self->_check_parameters( $okParams, $args );
15225             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
15226             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No treasury.outbound_transfer id (with parameter 'id') was provided to fail its information." ) );
15227             my $hash = $self->post( "test_helpers/treasury/outbound_transfers/${id}", $args ) || CORE::return( $self->pass_error );
15228             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Treasury::OutboundTransfer', $hash ) );
15229             }
15230             PERL
15231             # NOTE: treasury_outbound_transfer_list()
15232             treasury_outbound_transfer_list => <<'PERL',
15233             sub treasury_outbound_transfer_list
15234             {
15235             my $self = shift( @_ );
15236             CORE::return( $self->error( "No parameters were provided to list treasury outbound transfer information." ) ) if( !scalar( @_ ) );
15237             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Treasury::OutboundTransfer', @_ );
15238             my $okParams =
15239             {
15240             expandable => { allowed => $EXPANDABLES->{ 'treasury.outbound_transfer' }, data_prefix_is_ok => 1 },
15241             ending_before => { type => "string" },
15242             financial_account => { type => "string", required => 1 },
15243             limit => { type => "string" },
15244             starting_after => { type => "string" },
15245             status => { type => "string" },
15246             };
15247             my $err = $self->_check_parameters( $okParams, $args );
15248             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
15249             if( $args->{expand} )
15250             {
15251             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
15252             }
15253             my $hash = $self->get( "", $args ) || CORE::return( $self->pass_error );
15254             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Treasury::OutboundTransfer', $hash ) );
15255             }
15256             PERL
15257             # NOTE: treasury_outbound_transfer_post()
15258             treasury_outbound_transfer_post => <<'PERL',
15259             sub treasury_outbound_transfer_post
15260             {
15261             my $self = shift( @_ );
15262             my $args = shift( @_ );
15263             my $okParams =
15264             {
15265             expandable => { allowed => $EXPANDABLES->{ 'treasury.outbound_transfer' } },
15266             };
15267             $args = $self->_contract( 'treasury.outbound_transfer', $args ) || CORE::return( $self->pass_error );
15268             my $err = $self->_check_parameters( $okParams, $args );
15269             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
15270             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No treasury.outbound_transfer id (with parameter 'id') was provided to post its information." ) );
15271             my $hash = $self->post( "test_helpers/treasury/outbound_transfers/${id}", $args ) || CORE::return( $self->pass_error );
15272             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Treasury::OutboundTransfer', $hash ) );
15273             }
15274             PERL
15275             # NOTE: treasury_outbound_transfer_retrieve()
15276             treasury_outbound_transfer_retrieve => <<'PERL',
15277             sub treasury_outbound_transfer_retrieve
15278             {
15279             my $self = shift( @_ );
15280             my $args = shift( @_ );
15281             my $okParams =
15282             {
15283             expandable => { allowed => $EXPANDABLES->{ 'treasury.outbound_transfer' }, data_prefix_is_ok => 1 },
15284             };
15285             $args = $self->_contract( 'treasury.outbound_transfer', $args ) || CORE::return( $self->pass_error );
15286             my $err = $self->_check_parameters( $okParams, $args );
15287             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
15288             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No treasury.outbound_transfer id (with parameter 'id') was provided to retrieve its information." ) );
15289             my $hash = $self->get( "treasury/outbound_transfers/${id}", $args ) || CORE::return( $self->pass_error );
15290             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Treasury::OutboundTransfer', $hash ) );
15291             }
15292             PERL
15293             # NOTE: treasury_outbound_transfer_return()
15294             treasury_outbound_transfer_return => <<'PERL',
15295             sub treasury_outbound_transfer_return
15296             {
15297             my $self = shift( @_ );
15298             my $args = shift( @_ );
15299             my $okParams =
15300             {
15301             expandable => { allowed => $EXPANDABLES->{ 'treasury.outbound_transfer' } },
15302             returned_details => { type => "hash" },
15303             };
15304             $args = $self->_contract( 'treasury.outbound_transfer', $args ) || CORE::return( $self->pass_error );
15305             my $err = $self->_check_parameters( $okParams, $args );
15306             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
15307             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No treasury.outbound_transfer id (with parameter 'id') was provided to return its information." ) );
15308             my $hash = $self->post( "test_helpers/treasury/outbound_transfers/${id}", $args ) || CORE::return( $self->pass_error );
15309             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Treasury::OutboundTransfer', $hash ) );
15310             }
15311             PERL
15312             # NOTE: treasury_outbound_transfers()
15313             treasury_outbound_transfers => <<'PERL',
15314             # <https://stripe.com/docs/api/treasury/outbound_transfers>
15315             sub treasury_outbound_transfers
15316             {
15317             my $self = shift( @_ );
15318             my $allowed = [qw( cancel create fail list post retrieve return )];
15319             my $action = shift( @_ );
15320             my $meth = $self->_get_method( 'treasury_outbound_transfer', $action, $allowed ) || CORE::return( $self->pass_error );
15321             CORE::return( $self->$meth( @_ ) );
15322             }
15323             PERL
15324             # NOTE: treasury_received_credit()
15325             treasury_received_credit => <<'PERL',
15326             sub treasury_received_credit { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Treasury::ReceivedCredit', @_ ) ); }
15327             PERL
15328             # NOTE: treasury_received_credit_list()
15329             treasury_received_credit_list => <<'PERL',
15330             sub treasury_received_credit_list
15331             {
15332             my $self = shift( @_ );
15333             CORE::return( $self->error( "No parameters were provided to list treasury received credit information." ) ) if( !scalar( @_ ) );
15334             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Treasury::ReceivedCredit', @_ );
15335             my $okParams =
15336             {
15337             expandable => { allowed => $EXPANDABLES->{ 'treasury.received_credit' }, data_prefix_is_ok => 1 },
15338             ending_before => { type => "string" },
15339             financial_account => { type => "string", required => 1 },
15340             limit => { type => "string" },
15341             linked_flows => { type => "hash" },
15342             starting_after => { type => "string" },
15343             status => { type => "string" },
15344             };
15345             my $err = $self->_check_parameters( $okParams, $args );
15346             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
15347             if( $args->{expand} )
15348             {
15349             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
15350             }
15351             my $hash = $self->get( "", $args ) || CORE::return( $self->pass_error );
15352             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Treasury::ReceivedCredit', $hash ) );
15353             }
15354             PERL
15355             # NOTE: treasury_received_credit_received_credit()
15356             treasury_received_credit_received_credit => <<'PERL',
15357             sub treasury_received_credit_received_credit
15358             {
15359             my $self = shift( @_ );
15360             my $args = shift( @_ );
15361             my $okParams =
15362             {
15363             expandable => { allowed => $EXPANDABLES->{ 'treasury.received_credit' } },
15364             amount => { type => "integer", required => 1 },
15365             currency => { type => "string", required => 1 },
15366             description => { type => "string" },
15367             financial_account => { type => "string", required => 1 },
15368             initiating_payment_method_details => { type => "hash" },
15369             network => { type => "string", required => 1 },
15370             };
15371             $args = $self->_contract( 'treasury.received_credit', $args ) || CORE::return( $self->pass_error );
15372             my $err = $self->_check_parameters( $okParams, $args );
15373             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
15374             my $hash = $self->post( "test_helpers/treasury/received_credits", $args ) || CORE::return( $self->pass_error );
15375             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Treasury::ReceivedCredit', $hash ) );
15376             }
15377             PERL
15378             # NOTE: treasury_received_credit_retrieve()
15379             treasury_received_credit_retrieve => <<'PERL',
15380             sub treasury_received_credit_retrieve
15381             {
15382             my $self = shift( @_ );
15383             my $args = shift( @_ );
15384             my $okParams =
15385             {
15386             expandable => { allowed => $EXPANDABLES->{ 'treasury.received_credit' }, data_prefix_is_ok => 1 },
15387             };
15388             $args = $self->_contract( 'treasury.received_credit', $args ) || CORE::return( $self->pass_error );
15389             my $err = $self->_check_parameters( $okParams, $args );
15390             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
15391             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No treasury.received_credit id (with parameter 'id') was provided to retrieve its information." ) );
15392             my $hash = $self->get( "treasury/received_credits/${id}", $args ) || CORE::return( $self->pass_error );
15393             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Treasury::ReceivedCredit', $hash ) );
15394             }
15395             PERL
15396             # NOTE: treasury_received_credits()
15397             treasury_received_credits => <<'PERL',
15398             # <https://stripe.com/docs/api/treasury/received_credits>
15399             sub treasury_received_credits
15400             {
15401             my $self = shift( @_ );
15402             my $allowed = [qw( list received_credit retrieve )];
15403             my $action = shift( @_ );
15404             my $meth = $self->_get_method( 'treasury_received_credit', $action, $allowed ) || CORE::return( $self->pass_error );
15405             CORE::return( $self->$meth( @_ ) );
15406             }
15407             PERL
15408             # NOTE: treasury_received_debit()
15409             treasury_received_debit => <<'PERL',
15410             sub treasury_received_debit { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Treasury::ReceivedDebit', @_ ) ); }
15411             PERL
15412             # NOTE: treasury_received_debit_list()
15413             treasury_received_debit_list => <<'PERL',
15414             sub treasury_received_debit_list
15415             {
15416             my $self = shift( @_ );
15417             CORE::return( $self->error( "No parameters were provided to list treasury received debit information." ) ) if( !scalar( @_ ) );
15418             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Treasury::ReceivedDebit', @_ );
15419             my $okParams =
15420             {
15421             expandable => { allowed => $EXPANDABLES->{ 'treasury.received_debit' }, data_prefix_is_ok => 1 },
15422             ending_before => { type => "string" },
15423             financial_account => { type => "string", required => 1 },
15424             limit => { type => "string" },
15425             starting_after => { type => "string" },
15426             status => { type => "string" },
15427             };
15428             my $err = $self->_check_parameters( $okParams, $args );
15429             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
15430             if( $args->{expand} )
15431             {
15432             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
15433             }
15434             my $hash = $self->get( "", $args ) || CORE::return( $self->pass_error );
15435             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Treasury::ReceivedDebit', $hash ) );
15436             }
15437             PERL
15438             # NOTE: treasury_received_debit_received_debit()
15439             treasury_received_debit_received_debit => <<'PERL',
15440             sub treasury_received_debit_received_debit
15441             {
15442             my $self = shift( @_ );
15443             my $args = shift( @_ );
15444             my $okParams =
15445             {
15446             expandable => { allowed => $EXPANDABLES->{ 'treasury.received_debit' } },
15447             amount => { type => "integer", required => 1 },
15448             currency => { type => "string", required => 1 },
15449             description => { type => "string" },
15450             financial_account => { type => "string", required => 1 },
15451             initiating_payment_method_details => { type => "hash" },
15452             network => { type => "string", required => 1 },
15453             };
15454             $args = $self->_contract( 'treasury.received_debit', $args ) || CORE::return( $self->pass_error );
15455             my $err = $self->_check_parameters( $okParams, $args );
15456             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
15457             my $hash = $self->post( "test_helpers/treasury/received_debits", $args ) || CORE::return( $self->pass_error );
15458             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Treasury::ReceivedDebit', $hash ) );
15459             }
15460             PERL
15461             # NOTE: treasury_received_debit_retrieve()
15462             treasury_received_debit_retrieve => <<'PERL',
15463             sub treasury_received_debit_retrieve
15464             {
15465             my $self = shift( @_ );
15466             my $args = shift( @_ );
15467             my $okParams =
15468             {
15469             expandable => { allowed => $EXPANDABLES->{ 'treasury.received_debit' }, data_prefix_is_ok => 1 },
15470             };
15471             $args = $self->_contract( 'treasury.received_debit', $args ) || CORE::return( $self->pass_error );
15472             my $err = $self->_check_parameters( $okParams, $args );
15473             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
15474             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No treasury.received_debit id (with parameter 'id') was provided to retrieve its information." ) );
15475             my $hash = $self->get( "treasury/received_debits/${id}", $args ) || CORE::return( $self->pass_error );
15476             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Treasury::ReceivedDebit', $hash ) );
15477             }
15478             PERL
15479             # NOTE: treasury_received_debits()
15480             treasury_received_debits => <<'PERL',
15481             # <https://stripe.com/docs/api/treasury/received_debits>
15482             sub treasury_received_debits
15483             {
15484             my $self = shift( @_ );
15485             my $allowed = [qw( list received_debit retrieve )];
15486             my $action = shift( @_ );
15487             my $meth = $self->_get_method( 'treasury_received_debit', $action, $allowed ) || CORE::return( $self->pass_error );
15488             CORE::return( $self->$meth( @_ ) );
15489             }
15490             PERL
15491             # NOTE: treasury_transaction()
15492             treasury_transaction => <<'PERL',
15493             sub treasury_transaction { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Treasury::Transaction', @_ ) ); }
15494             PERL
15495             # NOTE: treasury_transaction_entry()
15496             treasury_transaction_entry => <<'PERL',
15497             sub treasury_transaction_entry { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Treasury::TransactionEntry', @_ ) ); }
15498             PERL
15499             # NOTE: treasury_transaction_entry_list()
15500             treasury_transaction_entry_list => <<'PERL',
15501             sub treasury_transaction_entry_list
15502             {
15503             my $self = shift( @_ );
15504             CORE::return( $self->error( "No parameters were provided to list treasury transaction entry information." ) ) if( !scalar( @_ ) );
15505             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Treasury::TransactionEntry', @_ );
15506             my $okParams =
15507             {
15508             expandable => { allowed => $EXPANDABLES->{ 'treasury.transaction_entry' }, data_prefix_is_ok => 1 },
15509             created => { type => "timestamp" },
15510             effective_at => { type => "timestamp" },
15511             ending_before => { type => "string" },
15512             financial_account => { type => "string", required => 1 },
15513             limit => { type => "string" },
15514             order_by => { type => "string" },
15515             starting_after => { type => "string" },
15516             transaction => { type => "string" },
15517             };
15518             my $err = $self->_check_parameters( $okParams, $args );
15519             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
15520             if( $args->{expand} )
15521             {
15522             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
15523             }
15524             my $hash = $self->get( "treasury/transaction_entries", $args ) || CORE::return( $self->pass_error );
15525             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Treasury::TransactionEntry', $hash ) );
15526             }
15527             PERL
15528             # NOTE: treasury_transaction_entry_retrieve()
15529             treasury_transaction_entry_retrieve => <<'PERL',
15530             sub treasury_transaction_entry_retrieve
15531             {
15532             my $self = shift( @_ );
15533             my $args = shift( @_ );
15534             my $okParams =
15535             {
15536             expandable => { allowed => $EXPANDABLES->{ 'treasury.transaction_entry' }, data_prefix_is_ok => 1 },
15537             };
15538             $args = $self->_contract( 'treasury.transaction_entry', $args ) || CORE::return( $self->pass_error );
15539             my $err = $self->_check_parameters( $okParams, $args );
15540             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
15541             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No treasury.transaction_entry id (with parameter 'id') was provided to retrieve its information." ) );
15542             my $hash = $self->get( "treasury/transaction_entries/${id}", $args ) || CORE::return( $self->pass_error );
15543             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Treasury::TransactionEntry', $hash ) );
15544             }
15545             PERL
15546             # NOTE: treasury_transaction_entrys()
15547             treasury_transaction_entrys => <<'PERL',
15548             # <https://stripe.com/docs/api/treasury/transaction_entries>
15549             sub treasury_transaction_entrys
15550             {
15551             my $self = shift( @_ );
15552             my $allowed = [qw( list retrieve )];
15553             my $action = shift( @_ );
15554             my $meth = $self->_get_method( 'treasury_transaction_entry', $action, $allowed ) || CORE::return( $self->pass_error );
15555             CORE::return( $self->$meth( @_ ) );
15556             }
15557             PERL
15558             # NOTE: treasury_transaction_list()
15559             treasury_transaction_list => <<'PERL',
15560             sub treasury_transaction_list
15561             {
15562             my $self = shift( @_ );
15563             CORE::return( $self->error( "No parameters were provided to list treasury transaction information." ) ) if( !scalar( @_ ) );
15564             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Treasury::Transaction', @_ );
15565             my $okParams =
15566             {
15567             expandable => { allowed => $EXPANDABLES->{ 'treasury.transaction' }, data_prefix_is_ok => 1 },
15568             created => { type => "timestamp" },
15569             ending_before => { type => "string" },
15570             financial_account => { type => "string", required => 1 },
15571             limit => { type => "string" },
15572             order_by => { type => "string" },
15573             starting_after => { type => "string" },
15574             status => { type => "string" },
15575             status_transitions => { type => "hash" },
15576             };
15577             my $err = $self->_check_parameters( $okParams, $args );
15578             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
15579             if( $args->{expand} )
15580             {
15581             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
15582             }
15583             my $hash = $self->get( "", $args ) || CORE::return( $self->pass_error );
15584             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Treasury::Transaction', $hash ) );
15585             }
15586             PERL
15587             # NOTE: treasury_transaction_retrieve()
15588             treasury_transaction_retrieve => <<'PERL',
15589             sub treasury_transaction_retrieve
15590             {
15591             my $self = shift( @_ );
15592             my $args = shift( @_ );
15593             my $okParams =
15594             {
15595             expandable => { allowed => $EXPANDABLES->{ 'treasury.transaction' }, data_prefix_is_ok => 1 },
15596             };
15597             $args = $self->_contract( 'treasury.transaction', $args ) || CORE::return( $self->pass_error );
15598             my $err = $self->_check_parameters( $okParams, $args );
15599             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
15600             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No treasury.transaction id (with parameter 'id') was provided to retrieve its information." ) );
15601             my $hash = $self->get( "treasury/transactions/${id}", $args ) || CORE::return( $self->pass_error );
15602             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Treasury::Transaction', $hash ) );
15603             }
15604             PERL
15605             # NOTE: treasury_transactions()
15606             treasury_transactions => <<'PERL',
15607             # <https://stripe.com/docs/api/treasury/transactions>
15608             sub treasury_transactions
15609             {
15610             my $self = shift( @_ );
15611             my $allowed = [qw( list retrieve )];
15612             my $action = shift( @_ );
15613             my $meth = $self->_get_method( 'treasury_transaction', $action, $allowed ) || CORE::return( $self->pass_error );
15614             CORE::return( $self->$meth( @_ ) );
15615             }
15616             PERL
15617             # NOTE: usage_record()
15618             usage_record => <<'PERL',
15619             sub usage_record { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Billing::UsageRecord', @_ ) ); }
15620             PERL
15621             # NOTE: usage_record_create()
15622             usage_record_create => <<'PERL',
15623             sub usage_record_create
15624             {
15625             my $self = shift( @_ );
15626             my $args = shift( @_ );
15627             my $okParams =
15628             {
15629             expandable => { allowed => $EXPANDABLES->{ 'usage_record' } },
15630             action => { type => "string" },
15631             quantity => { type => "integer", required => 1 },
15632             timestamp => { type => "timestamp" },
15633             };
15634             $args = $self->_contract( 'usage_record', $args ) || CORE::return( $self->pass_error );
15635             my $err = $self->_check_parameters( $okParams, $args );
15636             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
15637             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No subscription_item id (with parameter 'id') was provided to create its information." ) );
15638             my $hash = $self->post( "subscription_items/${id}/usage_records", $args ) || CORE::return( $self->pass_error );
15639             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::UsageRecord', $hash ) );
15640             }
15641             PERL
15642             # NOTE: usage_record_list()
15643             usage_record_list => <<'PERL',
15644             sub usage_record_list
15645             {
15646             my $self = shift( @_ );
15647             CORE::return( $self->error( "No parameters were provided to list usage record information." ) ) if( !scalar( @_ ) );
15648             my $args = $self->_get_args_from_object( 'Net::API::Stripe::Billing::UsageRecord', @_ );
15649             my $okParams =
15650             {
15651             expandable => { allowed => $EXPANDABLES->{ 'usage_record' }, data_prefix_is_ok => 1 },
15652             ending_before => { type => "string" },
15653             limit => { type => "string" },
15654             starting_after => { type => "string" },
15655             };
15656             my $err = $self->_check_parameters( $okParams, $args );
15657             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
15658             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No subscription_item id (with parameter 'id') was provided to list its information." ) );
15659             if( $args->{expand} )
15660             {
15661             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
15662             }
15663             my $hash = $self->get( "subscription_items/${id}", $args ) || CORE::return( $self->pass_error );
15664             CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::UsageRecord', $hash ) );
15665             }
15666             PERL
15667             # NOTE: usage_record_summary()
15668             usage_record_summary => <<'PERL',
15669             sub usage_record_summary { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Billing::UserRecord::Summary', @_ ) ); }
15670             PERL
15671             # NOTE: usage_records()
15672             usage_records => <<'PERL',
15673             # <https://stripe.com/docs/api/usage_records>
15674             sub usage_records
15675             {
15676             my $self = shift( @_ );
15677             my $allowed = [qw( create list )];
15678             my $action = shift( @_ );
15679             my $meth = $self->_get_method( 'usage_record', $action, $allowed ) || CORE::return( $self->pass_error );
15680             CORE::return( $self->$meth( @_ ) );
15681             }
15682             PERL
15683             # NOTE: value_list()
15684             value_list => <<'PERL',
15685             sub value_list { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Fraud::ValueList', @_ ) ); }
15686             PERL
15687             # NOTE: value_list_item()
15688             value_list_item => <<'PERL',
15689             sub value_list_item { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Fraud::ValueList::Item', @_ ) ); }
15690             PERL
15691             # NOTE: verification()
15692             verification => <<'PERL',
15693             sub verification { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Connect::Account::Verification', @_ ) ); }
15694             PERL
15695             # NOTE: verification_data()
15696             verification_data => <<'PERL',
15697             sub verification_data { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Issuing::Authorization::VerificationData', @_ ) ); }
15698             PERL
15699             # NOTE: verification_fields()
15700             verification_fields => <<'PERL',
15701             sub verification_fields { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Connect::CountrySpec::VerificationFields', @_ ) ); }
15702             PERL
15703             # NOTE: webhook()
15704             webhook => <<'PERL',
15705             sub webhook { CORE::return( shift->_response_to_object( 'Net::API::Stripe::WebHook::Object' ) ) }
15706             PERL
15707             # NOTE: webhook_endpoint()
15708             webhook_endpoint => <<'PERL',
15709             sub webhook_endpoint { CORE::return( shift->_response_to_object( 'Net::API::Stripe::WebHook::Object', @_ ) ); }
15710             PERL
15711             # NOTE: webhook_endpoint_create()
15712             webhook_endpoint_create => <<'PERL',
15713             sub webhook_endpoint_create
15714             {
15715             my $self = shift( @_ );
15716             my $args = shift( @_ );
15717             my $okParams =
15718             {
15719             expandable => { allowed => $EXPANDABLES->{ 'webhook_endpoint' } },
15720             api_version => { type => "string" },
15721             connect => { type => "boolean" },
15722             description => { type => "string" },
15723             enabled_events => { type => "array", required => 1 },
15724             metadata => { type => "hash" },
15725             url => { type => "string", required => 1 },
15726             };
15727             $args = $self->_contract( 'webhook_endpoint', $args ) || CORE::return( $self->pass_error );
15728             my $err = $self->_check_parameters( $okParams, $args );
15729             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
15730             my $hash = $self->post( "webhook_endpoints", $args ) || CORE::return( $self->pass_error );
15731             CORE::return( $self->_response_to_object( 'Net::API::Stripe::WebHook::Object', $hash ) );
15732             }
15733             PERL
15734             # NOTE: webhook_endpoint_delete()
15735             webhook_endpoint_delete => <<'PERL',
15736             sub webhook_endpoint_delete
15737             {
15738             my $self = shift( @_ );
15739             my $args = shift( @_ );
15740             my $okParams =
15741             {
15742             expandable => { allowed => $EXPANDABLES->{ 'webhook_endpoint' } },
15743             };
15744             $args = $self->_contract( 'webhook_endpoint', $args ) || CORE::return( $self->pass_error );
15745             my $err = $self->_check_parameters( $okParams, $args );
15746             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
15747             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No webhook_endpoint id (with parameter 'id') was provided to delete its information." ) );
15748             my $hash = $self->delete( "webhook_endpoints/${id}", $args ) || CORE::return( $self->pass_error );
15749             CORE::return( $self->_response_to_object( 'Net::API::Stripe::WebHook::Object', $hash ) );
15750             }
15751             PERL
15752             # NOTE: webhook_endpoint_list()
15753             webhook_endpoint_list => <<'PERL',
15754             sub webhook_endpoint_list
15755             {
15756             my $self = shift( @_ );
15757             CORE::return( $self->error( "No parameters were provided to list webhook endpoint information." ) ) if( !scalar( @_ ) );
15758             my $args = $self->_get_args_from_object( 'Net::API::Stripe::WebHook::Object', @_ );
15759             my $okParams =
15760             {
15761             expandable => { allowed => $EXPANDABLES->{ 'webhook_endpoint' }, data_prefix_is_ok => 1 },
15762             ending_before => { type => "string" },
15763             limit => { type => "string" },
15764             starting_after => { type => "string" },
15765             };
15766             my $err = $self->_check_parameters( $okParams, $args );
15767             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
15768             if( $args->{expand} )
15769             {
15770             $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
15771             }
15772             my $hash = $self->get( "webhook_endpoints", $args ) || CORE::return( $self->pass_error );
15773             CORE::return( $self->_response_to_object( 'Net::API::Stripe::WebHook::Object', $hash ) );
15774             }
15775             PERL
15776             # NOTE: webhook_endpoint_retrieve()
15777             webhook_endpoint_retrieve => <<'PERL',
15778             sub webhook_endpoint_retrieve
15779             {
15780             my $self = shift( @_ );
15781             my $args = shift( @_ );
15782             my $okParams =
15783             {
15784             expandable => { allowed => $EXPANDABLES->{ 'webhook_endpoint' }, data_prefix_is_ok => 1 },
15785             };
15786             $args = $self->_contract( 'webhook_endpoint', $args ) || CORE::return( $self->pass_error );
15787             my $err = $self->_check_parameters( $okParams, $args );
15788             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
15789             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No webhook_endpoint id (with parameter 'id') was provided to retrieve its information." ) );
15790             my $hash = $self->get( "webhook_endpoints/${id}", $args ) || CORE::return( $self->pass_error );
15791             CORE::return( $self->_response_to_object( 'Net::API::Stripe::WebHook::Object', $hash ) );
15792             }
15793             PERL
15794             # NOTE: webhook_endpoint_update()
15795             webhook_endpoint_update => <<'PERL',
15796             sub webhook_endpoint_update
15797             {
15798             my $self = shift( @_ );
15799             my $args = shift( @_ );
15800             my $okParams =
15801             {
15802             expandable => { allowed => $EXPANDABLES->{ 'webhook_endpoint' } },
15803             description => { type => "string" },
15804             disabled => { type => "boolean" },
15805             enabled_events => { type => "array" },
15806             metadata => { type => "hash" },
15807             url => { type => "string" },
15808             };
15809             $args = $self->_contract( 'webhook_endpoint', $args ) || CORE::return( $self->pass_error );
15810             my $err = $self->_check_parameters( $okParams, $args );
15811             CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
15812             my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No webhook_endpoint id (with parameter 'id') was provided to update its information." ) );
15813             my $hash = $self->post( "webhook_endpoints/${id}", $args ) || CORE::return( $self->pass_error );
15814             CORE::return( $self->_response_to_object( 'Net::API::Stripe::WebHook::Object', $hash ) );
15815             }
15816             PERL
15817             # NOTE: webhook_endpoints()
15818             webhook_endpoints => <<'PERL',
15819             # <https://stripe.com/docs/api/webhook_endpoints>
15820             sub webhook_endpoints
15821             {
15822             my $self = shift( @_ );
15823             my $allowed = [qw( create delete list retrieve update )];
15824             my $action = shift( @_ );
15825             my $meth = $self->_get_method( 'webhook_endpoint', $action, $allowed ) || CORE::return( $self->pass_error );
15826             CORE::return( $self->$meth( @_ ) );
15827             }
15828             PERL
15829             };
15830             }
15831             # NOTE: End of auto-generated methods
15832              
15833              
15834             {
15835             my $self = shift( @_ );
15836             my $args = shift( @_ );
15837             CORE::return( $self->error( "User parameters list provided is '$args' and I was expecting a hash reference." ) ) if( ref( $args ) ne 'HASH' );
15838             if( ref( $args->{expand} ) eq 'ARRAY' )
15839             {
15840             my $new = [];
15841             for( my $i = 0; $i < scalar( @{$args->{expand}} ); $i++ )
15842             {
15843             substr( $args->{expand}->[$i], 0, 0 ) = 'data.' if( substr( $args->{expand}->[$i], 0, 5 ) ne 'data.' );
15844             my $path = [split( /\./, $args->{expand}->[$i] )];
15845             # Make sure that with the new 'data' prefix, this does not exceed 4 level of depth
15846             push( @$new, $args->{expand}->[$i] ) if( scalar( @$path ) <= $EXPAND_MAX_DEPTH );
15847             }
15848             $args->{expand} = $new;
15849             }
15850             CORE::return( $self );
15851             }
15852              
15853             {
15854             my $self = shift( @_ );
15855             my $this = shift( @_ );
15856             my $opts = {};
15857             $opts = shift( @_ ) if( @_ && ref( $_[0] ) eq 'HASH' );
15858             $opts->{seen} = {} if( !$opts->{seen} );
15859             my $ref = {};
15860             if( $self->_is_object( $this ) )
15861             {
15862             $ref = $this->as_hash if( $this->can( 'as_hash' ) );
15863             }
15864             # Recursively transform into hash
15865 0     0     elsif( ref( $this ) eq 'HASH' )
15866 0           {
15867 0 0         # Prevent recursion
15868 0 0         my $ref_addr = Scalar::Util::refaddr( $this );
15869             CORE::return( $opts->{seen}->{ $ref_addr } ) if( $opts->{seen}->{ $ref_addr } );
15870 0           $opts->{seen}->{ $ref_addr } = $this;
15871 0           # $ref = $hash;
  0            
15872             foreach my $k ( keys( %$this ) )
15873 0 0         {
15874 0           if( ref( $this->{ $k } ) eq 'HASH' || $self->_is_object( $this->{ $k } ) )
15875             {
15876 0 0         my $rv = $self->_as_hash( $this->{ $k }, $opts );
15877             $ref->{ $k } = $rv if( scalar( keys( %$rv ) ) );
15878 0           }
15879             elsif( ref( $this->{ $k } ) eq 'ARRAY' )
15880 0           {
15881             my $new = [];
15882             foreach my $that ( @{$this->{ $k }} )
15883             {
15884             if( ref( $that ) eq 'HASH' || $self->_is_object( $that ) )
15885 0     0     {
15886 0           my $rv = $self->_as_hash( $that, $opts );
15887 0           push( @$new, $rv ) if( scalar( keys( %$rv ) ) );
15888 0 0 0       }
15889 0 0         }
15890 0           $ref->{ $k } = $new if( scalar( @$new ) );
15891 0 0         }
    0          
15892             # For stringification
15893 0 0         elsif( CORE::length( "$this->{$k}" ) )
15894             {
15895             $ref->{ $k } = $this->{ $k };
15896             }
15897             }
15898             }
15899 0           else
15900 0 0         {
15901 0           CORE::return( $self->error( "Unknown data type $this to be converted into hash for api call." ) );
15902             }
15903 0           CORE::return( $ref );
15904             }
15905 0 0 0        
    0          
    0          
15906             {
15907 0           my $self = shift( @_ );
15908 0 0         my $okParams = shift( @_ );
15909             my $args = shift( @_ );
15910             # $self->dumpto_dumper( $args, '/home/ai/legal/var/check_parameters.pl' );
15911             my $err = [];
15912 0          
15913 0           my $seen = {};
  0            
15914             my $check_fields_recursive;
15915 0 0 0       $check_fields_recursive = sub
15916             {
15917 0           my( $hash, $mirror, $field, $required ) = @_;
15918 0 0         my $errors = [];
15919             # push( @$err, "Unknown property $v for key $k." ) if( !scalar( grep( /^$v$/, @$this ) ) );
15920             foreach my $k ( sort( keys( %$hash ) ) )
15921 0 0         {
15922             if( !CORE::exists( $mirror->{ $k } ) )
15923             {
15924             push( @$errors, "Unknown property \"$k\" for key \"$field\"." );
15925             next;
15926 0           }
15927             my $addr;
15928             $addr = Scalar::Util::refaddr( $hash->{ $k } ) if( ref( $hash->{ $k } ) eq 'HASH' );
15929             # Found a hash, check recursively and avoid looping endlessly
15930             if( ref( $hash->{ $k } ) eq 'HASH' &&
15931             ref( $mirror->{ $k } ) eq 'HASH' &&
15932 0           # ++$hash->{ $k }->{__check_fields_recursive_looping} == 1 )
15933             ++$seen->{ $addr } == 1 )
15934 0           {
15935             my $deep_errors = $check_fields_recursive->( $hash->{ $k }, $mirror->{ $k }, $k, CORE::exists( $required->{ $k } ) ? $required->{ $k } : {} );
15936             CORE::push( @$errors, @$deep_errors );
15937             }
15938             }
15939 0     0    
15940 0           # Check required fields
15941 0           # if in the mirror structure, the field value is 1, the field is required, otherwise with 0 the field is not required
15942             foreach my $k ( sort( keys( %$mirror ) ) )
15943 0           {
15944             next if( $k eq '_required' );
15945 0           # If this property contains sub properties, we look at the sub hash entry _required to check if this property is required or not
15946 0           if( ref( $mirror->{ $k } ) eq 'HASH' )
15947             {
15948             if( !CORE::exists( $hash->{ $k } ) && $mirror->{ $k }->{_required} )
15949 0     0     {
15950 0           CORE::push( @$errors, "Hash property \"$k\" is required but missing in hash provided for parent field \"$field\"." );
15951             }
15952 0           }
15953             else
15954 0 0         {
15955             if( ( !CORE::exists( $hash->{ $k } ) || !CORE::length( $hash->{ $k } ) ) &&
15956 0           $mirror->{ $k } )
15957 0           {
15958             CORE::push( @$errors, "Field \"$k\" is required but missing in hash provided for parent field \"$field\"." );
15959 0           }
15960 0 0         }
15961             }
15962 0 0 0       CORE::return( $errors );
      0        
15963             };
15964            
15965             foreach my $k ( keys( %$args ) )
15966             {
15967 0 0         # Special case for expand and for private parameters starting with '_'
15968 0           next if( $k eq 'expand' || $k eq 'expandable' || substr( $k, 0, 1 ) eq '_' );
15969             # if( !CORE::exists( $okParams->{ $k } ) )
15970             # {
15971             # # This is handy when an object was passed to one of the api method and
15972             # # the object contains a bunch of data not all relevant to the api call
15973             # # It makes it easy to pass the object and let this interface take only what is relevant
15974 0           # if( $okParams->{_cleanup} || $args->{_cleanup} || $self->ignore_unknown_parameters )
15975             # {
15976 0 0         # CORE::delete( $args->{ $k } );
15977             # }
15978 0 0         # else
15979             # {
15980 0 0 0       # push( @$err, "Unknown parameter \"$k\"." );
15981             # }
15982 0           # next;
15983             # }
15984             # $dict is either a hash dictionary or a sub
15985             my $dict = $okParams->{ $k };
15986             if( ref( $dict ) eq 'HASH' )
15987 0 0 0       {
      0        
15988             my $pkg;
15989             # if( $dict->{fields} && ref( $dict->{fields} ) eq 'ARRAY' )
15990 0           # {
15991             # my $this = $dict->{fields};
15992             # if( ref( $args->{ $k } ) eq 'ARRAY' && $dict->{type} eq 'array' )
15993             # {
15994 0           # # Just saying it's ok
15995 0           # }
15996             # elsif( ref( $args->{ $k } ) ne 'HASH' )
15997 0           # {
15998             # push( @$err, sprintf( "Parameter \"$k\" must be a dictionary definition with following possible hash keys: \"%s\". Did you forget type => 'array' ?", join( ', ', @$this ) ) );
15999             # next;
16000 0 0 0       # }
      0        
16001             #
16002             # # We build a test mirror hash structure against which we will check if actual data fields exist or not
16003             # my $mirror = {};
16004             # # $self->messagef( 7, "Building mirror check data structure fpr '$k' with %d fields.", scalar( @$this ) );
16005             # foreach my $f ( @$this )
16006             # {
16007             # my @path = CORE::split( /\./, $f );
16008             # # $self->message( 7, "\tProcessing '$f'." );
16009             # my $parent_hash = $mirror;
16010             # for( my $i = 0; $i < scalar( @path ); $i++ )
16011             # {
16012             # my $p = $path[$i];
16013             # my $is_required = 0;
16014             # if( substr( $p, -1, 1 ) eq '!' )
16015             # {
16016             # $p = substr( $p, 0, CORE::length( $p ) - 1 );
16017 0           # $is_required = 1;
16018 0 0         # }
    0          
16019             # # $self->message( 7, "\t\t$p is ", ( $is_required ? '' : 'not ' ), "required." );
16020 0           #
16021             # if( $i == $#path )
16022             # {
16023             # $parent_hash->{ $p } = $is_required;
16024             # }
16025             # else
16026             # {
16027             # my $prev_val = $parent_hash->{ $p };
16028             # $parent_hash->{ $p } = {} unless( CORE::exists( $parent_hash->{ $p } ) && ref( $parent_hash->{ $p } ) eq 'HASH' );
16029             # $parent_hash = $parent_hash->{ $p };
16030             # unless( exists( $parent_hash->{_required} ) )
16031             # {
16032             # $parent_hash->{_required} = $is_required ? $is_required : ref( $prev_val ) ne 'HASH' ? $prev_val : $is_required;
16033             # }
16034             # }
16035             # }
16036             # }
16037             #
16038             # # $self->message( 7, "Mirror is: ", sub{ $self->dump( $mirror ); } );
16039             #
16040             # # Do we have dots in field names? If so, this is a multi dimensional hash we are potentially looking at
16041             # if( ref( $args->{ $k } ) eq 'HASH' )
16042             # {
16043             # my $res = $check_fields_recursive->( $args->{ $k }, $mirror, $k, ( exists( $dict->{required} ) ? $dict->{required} : {} ) );
16044             # push( @$err, @$res ) if( scalar( @$res ) );
16045             # }
16046             # elsif( ref( $args->{ $k } ) eq 'ARRAY' && $dict->{type} eq 'array' )
16047             # {
16048             # my $arr = $args->{ $k };
16049             # for( my $i = 0; $i < scalar( @$arr ); $i++ )
16050             # {
16051             # if( ref( $arr->[ $i ] ) ne 'HASH' )
16052             # {
16053             # push( @$err, sprintf( "Invalid data type at offset $i. Parameter \"$k\" must be a dictionary definition with following possible hash keys: \"%s\"", join( ', ', @$this ) ) );
16054             # next;
16055             # }
16056             # my $res = $check_fields_recursive->( $arr->[ $i ], $mirror, $k, ( exists( $dict->{required} ) ? $dict->{required} : {} ) );
16057             # push( @$err, @$res ) if( scalar( @$res ) );
16058             # }
16059             # }
16060             # # $clean_up_check_fields_recursive->( $args->{ $k } );
16061             # }
16062            
16063             if( defined( $dict->{required} ) &&
16064             $dict->{required} &&
16065             !CORE::exists( $args->{ $k } ) )
16066             {
16067             push( @$err, "Parameter \"$k\" is required, but missing" );
16068             }
16069             elsif( !defined( $args->{ $k } ) ||
16070             !length( $args->{ $k } ) )
16071             {
16072             push( @$err, "Empty value provided for parameter \"$k\"." );
16073             }
16074             # _is_object is inherited from Module::Object
16075             elsif( ( $pkg = $self->_is_object( $args->{ $k } ) ) && $dict->{package} && $dict->{package} ne $pkg )
16076             {
16077             push( @$err, "Parameter \"$k\" value is a package \"$pkg\", but I was expecting \"$dict->{package}\"" );
16078             }
16079             elsif( $dict->{re} && ref( $dict->{re} ) eq 'Regexp' && $args->{ $k } !~ /$dict->{re}/ )
16080             {
16081             push( @$err, "Parameter \"$k\" with value \"$args->{$k}\" does not have a legitimate value." );
16082             }
16083             elsif( defined( $dict->{type} ) &&
16084             $dict->{type} &&
16085             (
16086             ( $dict->{type} eq 'scalar' && ref( $args->{ $k } ) ) ||
16087             ( $dict->{type} ne 'scalar' && ref( $args->{ $k } ) && lc( ref( $args->{ $k } ) ) ne $dict->{type} )
16088             )
16089             )
16090             {
16091             push( @$err, "I was expecting a data of type $dict->{type}, but got " . lc( ref( $args->{ $k } ) ) );
16092             }
16093             elsif( defined( $dict->{type} ) &&
16094             $dict->{type} eq 'boolean' &&
16095 0 0 0       defined( $args->{ $k } ) &&
    0 0        
    0 0        
    0 0        
    0 0        
    0 0        
    0 0        
    0 0        
    0 0        
      0        
      0        
      0        
      0        
      0        
      0        
      0        
      0        
      0        
16096             CORE::length( $args->{ $k } ) )
16097             {
16098             $args->{ $k } = ( $args->{ $k } eq 'true' || ( $args->{ $k } ne 'false' && $args->{ $k } ) ) ? 'true' : 'false';
16099 0           }
16100             elsif( defined( $dict->{type} ) &&
16101             $dict->{type} eq 'integer' )
16102             {
16103             push( @$err, "Parameter \"$k\" value \" $args->{$k}\" is not an integer." ) if( $args->{ $k } !~ /^[-+]?\d+$/ );
16104 0           }
16105             elsif( defined( $dict->{type} ) &&
16106             (
16107             $dict->{type} eq 'number' ||
16108             $dict->{type} eq 'decimal' ||
16109 0           $dict->{type} eq 'float' ||
16110             $dict->{type} eq 'double'
16111             ) )
16112             {
16113 0           push( @$err, "Parameter \"$k\" value \" $args->{$k}\" is not a $dict->{type}." ) if( $args->{ $k } !~ /^$RE{num}{real}$/ );
16114             }
16115             elsif( defined( $dict->{type} ) &&
16116             (
16117             $dict->{type} eq 'date' ||
16118             $dict->{type} eq 'datetime' ||
16119             $dict->{type} eq 'timestamp'
16120             ) )
16121             {
16122             unless( $self->_is_object( $args->{ $k } ) && $args->{ $k }->isa( 'DateTime' ) )
16123 0           {
16124             my $tz = $dict->{time_zone} ? $dict->{time_zone} : 'GMT';
16125             my $dt;
16126             if( $dict->{type} eq 'date' &&
16127             $args->{ $k } =~ /^(?<year>\d{4})[\.|\-](?<month>\d{1,2})[\.|\-](?<day>\d{1,2})$/ )
16128             {
16129             try
16130 0 0 0       {
16131             $dt = DateTime(
16132             year => int( $+{year} ),
16133             month => int( $+{month} ),
16134             day => int( $+{day} ),
16135 0 0         hour => 0,
16136             minute => 0,
16137             second => 0,
16138             time_zone => $tz
16139             );
16140             $args->{ $k } = $dt;
16141             }
16142             catch( $e )
16143             {
16144             push( @$err, "Invalid date (" . $args->{ $k } . ") provided for parameter \"$k\": $e" );
16145 0 0         }
16146             }
16147             elsif( $dict->{type} eq 'datetime' &&
16148             $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})$/ )
16149             {
16150             try
16151             {
16152             $dt = DateTime(
16153             year => int( $+{year} ),
16154 0 0 0       month => int( $+{month} ),
16155             day => int( $+{day} ),
16156 0 0         hour => int( $+{hour} ),
16157 0           minute => int( $+{minute} ),
16158 0 0 0       second => int( $+{second} ),
    0 0        
    0          
16159             time_zone => $tz
16160             );
16161 0 0 0       $args->{ $k } = $dt;
  0            
  0            
  0            
  0            
  0            
  0            
  0            
16162 0     0     }
16163             catch( $e )
16164             {
16165             push( @$err, "Invalid datetime (" . $args->{ $k } . ") provided for parameter \"$k\": $e" );
16166 0           }
16167             }
16168             elsif( $args->{ $k } =~ /^\d+$/ )
16169             {
16170             try
16171             {
16172 0           $dt = DateTime->from_epoch(
16173             epoch => $args->{ $k },
16174 0 0 0       time_zone => $tz,
  0 0 0        
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
16175 0     0     );
16176 0           }
16177 1 0 0 1   10 catch( $e )
  1 0 0     2  
  1 0 0     1120  
  0 0 0        
  0 0 0        
  0 0 0        
  0 0 0        
  0 0 0        
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
16178             {
16179             push( @$err, "Invalid timestamp (" . $args->{ $k } . ") provided for parameter \"$k\": $e" );
16180             }
16181             }
16182 0 0 0       if( $dt )
  0            
  0            
  0            
  0            
  0            
  0            
  0            
16183 0     0     {
16184             my $pattern = $dict->{pattern} ? $dict->{pattern} : '%s';
16185             my $strp = DateTime::Format::Strptime->new(
16186             pattern => $pattern,
16187             locale => 'en_GB',
16188             time_zone => $tz,
16189             );
16190 0           $dt->set_formatter( $strp );
16191             $args->{ $k } = $dt;
16192             }
16193 0           }
16194             }
16195 0 0 0       }
  0 0 0        
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
16196 0     0     elsif( ref( $dict ) eq 'CODE' )
16197 0           {
16198 1 0 0 1   9 my $res = $dict->( $args->{ $k } );
  1 0 0     2  
  1 0 0     992  
  0 0 0        
  0 0 0        
  0 0 0        
  0 0 0        
  0 0 0        
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
16199             push( @$err, "Invalid parameter \"$k\" with value \"$args->{$k}\": $res" ) if( $res );
16200             }
16201             }
16202 0 0 0      
  0            
  0            
  0            
  0            
  0            
  0            
  0            
16203 0     0     $args->{expand} = $self->expand if( !CORE::length( $args->{expand} ) );
16204             if( exists( $args->{expand} ) )
16205 0           {
16206             my $depth;
16207             my $no_need_to_check = 0;
16208             if( $args->{expand} eq 'all' || $args->{expand} =~ /^\d+$/ )
16209 0 0 0       {
  0 0 0        
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
16210 0     0     $no_need_to_check++;
16211 0           if( $args->{expand} =~ /^\d+$/ )
16212 1 0 0 1   8 {
  1 0 0     3  
  1 0 0     4831  
  0 0 0        
  0 0 0        
  0 0 0        
  0 0 0        
  0 0 0        
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
16213             $depth = int( $args->{expand} );
16214 0 0         }
16215             else
16216 0 0         {
16217 0           $depth = $EXPAND_MAX_DEPTH;
16218             }
16219             if( exists( $okParams->{expandable} ) && exists( $okParams->{expandable}->{allowed} ) && ref( $okParams->{expandable}->{allowed} ) eq 'ARRAY' )
16220             {
16221             # We duplicate the array, so the original array does not get modified
16222 0           # This is important, because methods that list objects such as customer_list use the 'data' property
16223 0           $args->{expand} = [ @{$okParams->{expandable}->{allowed}} ];
16224             }
16225             # There is no allowed expandable properties, but it was called anyway, so we do this to avoid an error below
16226             else
16227             {
16228             $args->{expand} = [];
16229             }
16230 0           }
16231 0 0         push( @$err, sprintf( "expand property should be an array, but instead '%s' was provided", $args->{expand} ) ) if( ref( $args->{expand} ) ne 'ARRAY' );
16232             if( scalar( @{$args->{expand}} ) && exists( $okParams->{expandable} ) )
16233             {
16234             CORE::return( $self->error( "expandable parameter is not a hash (", ref( $okParams->{expandable} ), ")." ) ) if( ref( $okParams->{expandable} ) ne 'HASH' );
16235 0 0         CORE::return( $self->error( "No \"allowed\" attribute in the expandable parameter hash." ) ) if( !CORE::exists( $okParams->{expandable}->{allowed} ) );
16236 0 0         my $expandable = $okParams->{expandable}->{allowed};
16237             my $errExpandables = [];
16238 0           if( !$no_need_to_check )
16239 0           {
16240 0 0 0       if( scalar( @$expandable ) )
16241             {
16242 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' );
16243 0 0         # Return a list with the dot prefixed with backslash
16244             my $list = join( '|', map( quotemeta( $_ ), @$expandable ) );
16245 0           my $re = $okParams->{expandable}->{data_prefix_is_ok} ? qr/^(?:data\.)?($list)$/ : qr/^($list)$/;
16246             foreach my $k ( @{$args->{expand}} )
16247             {
16248             if( $k !~ /$re/ )
16249 0           {
16250             push( @$errExpandables, $k );
16251 0 0 0       }
      0        
16252             }
16253             }
16254             else
16255 0           {
  0            
16256             push( @$errExpandables, @{$args->{expand}} );
16257             }
16258             }
16259             elsif( $depth )
16260 0           {
16261             my $max_depth = CORE::length( $depth ) ? $depth : $EXPAND_MAX_DEPTH;
16262             for( my $i = 0; $i < scalar( @{$args->{expand}} ); $i++ )
16263 0 0         {
16264 0 0 0       # Count the number of dots. Make sure this does not exceed the $EXPAND_MAX_DEPTH which is 4 as of today (2020-02-23)
  0 0          
16265             # my $this_depth = scalar( () = $args->{expand}->[$i] =~ /\./g );
16266 0 0         my $path_parts = [split( /\./, $args->{expand}->[$i] )];
16267 0 0         if( scalar( @$path_parts ) > $max_depth )
16268 0           {
16269 0           my $old = [CORE::splice( @$path_parts, $max_depth - 1 )];
16270 0 0         $args->{expand}->[$i] = $path_parts;
    0          
16271             }
16272 0 0         }
16273             }
16274 0 0         push( @$err, sprintf( "The following properties are not allowed to expand: %s", join( ', ', @$errExpandables ) ) ) if( scalar( @$errExpandables ) );
16275             }
16276 0           elsif( !exists( $okParams->{expandable} ) )
16277 0 0         {
16278 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            
16279             }
16280 0 0         }
16281             else
16282 0           {
16283             }
16284             my @private_params = grep( /^_/, keys( %$args ) );
16285             CORE::delete( @$args{ @private_params } );
16286             CORE::return( $err );
16287             }
16288 0            
  0            
16289             {
16290             my $self = shift( @_ );
16291             my $required = shift( @_ );
16292             CORE::return( $self->error( "I was expecting an array reference of required field." ) ) if( ref( $required ) ne 'ARRAY' );
16293 0 0         my $args = shift( @_ );
16294 0           CORE::return( $self->error( "I was expecting an hash reference of parameters." ) ) if( ref( $args ) ne 'HASH' );
  0            
16295             my $err = [];
16296             foreach my $f ( @$required )
16297             {
16298 0           push( @$err, "Parameter $f is missing, and is required." ) if( !CORE::exists( $args->{ $f } ) || !CORE::length( $args->{ $f } ) );
16299 0 0         }
16300             CORE::return( $args );
16301 0           }
16302 0            
16303             # As in opposite of expand
16304             # This is used for switching object to their id for Stripe api methods that post data.
16305             # Objects are expanded when retrieving data, but when posting data, objects should be represented to Stripe by their id
16306 0 0         {
16307             my $self = shift( @_ );
16308             my $class = shift( @_ ) || CORE::return( $self->error( "No object class was provided to contract objects within." ) );
16309             my $args = shift( @_ ) || CORE::return( $self->error( "No data to process for class \"$class\" was provided." ) );
16310 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            
  0            
16311             CORE::return( $self->error( "No class \"$class\" found to contract the possible objects contained." ) ) if( !exists( $EXPANDABLES_BY_CLASS->{ $class } ) );
16312             my $ref = $EXPANDABLES_BY_CLASS->{ $class };
16313             CORE::return( $self->error( "Definition hash found for class \"$class\" is not an hash! This should not happen." ) ) if( ref( $ref ) ne 'HASH' );
16314             PROPERTY: foreach my $p ( sort( keys( %$ref ) ) )
16315             {
16316 0           if( CORE::index( $p, '.' ) != -1 )
16317 0           {
16318 0           my @parts = split( /\./, $p );
16319             # Can be an object or just a hash
16320             my $obj = $args;
16321             PART: for( my $i = 0; $i < scalar( @parts ); $i++ )
16322             {
16323 0     0     my $prop = $parts[ $i ];
16324 0           my $this;
16325 0 0         my $type;
16326 0           if( $self->_is_object( $obj ) )
16327 0 0         {
16328 0           $type = 'object';
16329 0           if( !( defined( my $code = $obj->can( $prop ) ) ) )
16330             {
16331 0 0 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\"." ) );
16332             }
16333 0           $this = $obj->$prop();
16334             }
16335             elsif( ref( $obj ) eq 'HASH' || ref( $obj ) eq 'Module::Generic::Hash' )
16336             {
16337             $type = 'hash';
16338             $this = $obj->{ $prop };
16339             }
16340             next PROPERTY if( !length( $this ) );
16341 0     0    
16342 0   0       # If this is an object, we convert it to its id string representation for Stripe, or
16343 0   0       # we continue to drill down if the path continues
16344 0 0 0       if( $self->_is_object( $this ) )
      0        
16345 0 0         {
16346 0           # If this is the last element of this property path
16347 0 0         if( $i == $#parts )
16348 0           {
16349             if( $type eq 'object' )
16350 0 0         {
16351             $obj->$prop( $this->id );
16352 0           }
16353             elsif( $type eq 'hash' )
16354 0           {
16355 0           $obj->{ $prop } = $this->id;
16356             }
16357 0           }
16358 0           # Continue to drill down the property path
16359             $obj = $this;
16360 0 0 0       }
    0          
16361             elsif( ref( $this ) eq 'HASH' || ref( $this ) eq 'Module::Generic::Hash' )
16362 0           {
16363 0 0         if( $i == $#parts )
16364             {
16365 0           if( $type eq 'object' )
16366             {
16367 0           $obj->$prop( $this->{id} );
16368             }
16369             elsif( $type eq 'hash' )
16370             {
16371 0           $obj->{ $prop } = $this->{id};
16372 0           }
16373             }
16374 0 0         $obj = $this;
16375             }
16376             }
16377             }
16378 0 0 0       else
    0          
16379             {
16380             if( $self->_is_object( $args ) )
16381 0 0         {
16382             my $this = $args->$p();
16383 0 0         next if( !length( $this ) );
    0          
16384             if( $self->_is_object( $this ) )
16385 0           {
16386             $args->$p( $this->id );
16387             }
16388             elsif( ref( $this ) eq 'HASH' || ref( $this ) eq 'Module::Generic::Hash' )
16389 0           {
16390             $args->$p( $this->{id} );
16391             }
16392             }
16393 0           elsif( ref( $args ) eq 'HASH' || ref( $args ) eq 'Module::Generic::Hash' )
16394             {
16395             my $this = $args->{ $p };
16396             next if( !length( $this ) );
16397 0 0         if( $self->_is_object( $this ) )
16398             {
16399 0 0         $args->{ $p } = $this->id;
    0          
16400             }
16401 0           elsif( ref( $this ) eq 'HASH' || ref( $this ) eq 'Module::Generic::Hash' )
16402             {
16403             $args->{ $p } = $this->{id};
16404             }
16405 0           }
16406             }
16407             }
16408 0           CORE::return( $args );
16409             }
16410              
16411             {
16412             my $self = shift( @_ );
16413             my $hash = shift( @_ ) || CORE::return( $self->pass_error );
16414 0 0 0       my $seen = {};
    0          
16415             my $crawl;
16416 0           $crawl = sub
16417 0 0         {
16418 0 0 0       my $this = shift( @_ );
    0          
16419             foreach my $k ( keys( %$this ) )
16420 0           {
16421             if( ref( $this->{ $k } ) eq 'HASH' )
16422             {
16423             my $addr = Scalar::Util::refaddr( $this->{ $k } );
16424 0           next if( ++$seen->{ $addr } > 1 );
16425             $crawl->( $this->{ $k } );
16426             }
16427             elsif( $self->_is_object( $this->{ $k } ) && $this->{ $k }->isa( 'Module::Generic::Boolean' ) )
16428             {
16429 0           $this->{ $k } = $this->{ $k } ? 'true' : 'false';
16430 0 0         }
16431 0 0 0       }
    0          
16432             };
16433 0           $crawl->( $hash );
16434             }
16435              
16436             {
16437 0           my $self = shift( @_ );
16438             my $args = shift( @_ );
16439             if( $self->{ '_encode_with_json' } )
16440             {
16441             CORE::return( $self->json->utf8->allow_blessed->encode( $args ) );
16442 0           }
16443             my $encode;
16444             $encode = sub
16445             {
16446             my( $pref, $data ) = @_;
16447 0     0     my $ref = ref( $data );
16448 0   0       my $type = lc( ref( $data ) );
16449 0           my $comp = [];
16450 0           if( $type eq 'hash' || $ref eq 'Module::Generic::Hash' )
16451             {
16452             foreach my $k ( sort( keys( %$data ) ) )
16453 0     0     {
16454 0           my $ke = URI::Escape::uri_escape( $k );
16455             my $pkg = Scalar::Util::blessed( $data->{ $k } );
16456 0 0 0       if( $pkg && $pkg =~ /^Net::API::Stripe/ &&
    0          
16457             $data->{ $k }->can( 'id' ) &&
16458 0           $data->{ $k }->id )
16459 0 0         {
16460 0           push( @$comp, "${pref}${ke}" . '=' . $data->{ $k }->id );
16461             next;
16462             }
16463             my $res = $encode->( ( $pref ? sprintf( '%s[%s]', $pref, $ke ) : $ke ), $data->{ $k } );
16464 0 0         push( @$comp, @$res );
16465             }
16466             }
16467 0           elsif( $type eq 'array' || $ref eq 'Module::Generic::Array' )
16468 0           {
16469             # 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
16470             for( my $i = 0; $i < scalar( @$data ); $i++ )
16471             {
16472             my $res = $encode->( ( $pref ? sprintf( '%s[%d]', $pref, $i ) : sprintf( '[%d]', $i ) ), $data->[$i] );
16473 0     0     push( @$comp, @$res );
16474 0           }
16475 0 0         }
16476             elsif( ref( $data ) eq 'JSON::PP::Boolean' || ref( $data ) eq 'Module::Generic::Boolean' )
16477 0           {
16478             push( @$comp, sprintf( '%s=%s', $pref, $data ? 'true' : 'false' ) );
16479 0           }
16480             elsif( ref( $data ) eq 'SCALAR' && ( $$data == 1 || $$data == 0 ) )
16481             {
16482 0     0     push( @$comp, sprintf( '%s=%s', $pref, $$data ? 'true' : 'false' ) );
16483 0           }
16484 0           # Other type of scalar like Module::Generic
16485 0           elsif( $ref && Scalar::Util::reftype( $data ) eq 'SCALAR' )
16486 0 0 0       {
    0 0        
    0 0        
    0 0        
    0 0        
    0 0        
    0          
16487             push( @$comp, sprintf( '%s=%s', $pref, $$data ) );
16488 0           }
16489             elsif( $type eq 'datetime' )
16490 0           {
16491 0           push( @$comp, sprintf( '%s=%s', $pref, $data->epoch ) );
16492 0 0 0       }
      0        
      0        
16493             elsif( $type )
16494             {
16495             die( "Don't know what to do with data type $type\n" );
16496 0           }
16497 0           else
16498             {
16499 0 0         push( @$comp, sprintf( '%s=%s', $pref, URI::Escape::uri_escape_utf8( "$data" ) ) );
16500 0           }
16501             CORE::return( $comp );
16502             };
16503             my $res = $encode->( '', $args );
16504             CORE::return( join( '&', @$res ) );
16505             }
16506 0            
16507             {
16508 0 0         my $self = shift( @_ );
16509 0           my $args = shift( @_ );
16510             my $opts = {};
16511             $opts = pop( @_ ) if( scalar( @_ ) && ref( $_[-1] ) eq 'HASH' );
16512             my $set_value = sub
16513             {
16514 0 0         my( $key, $val, $ref, $param ) = @_;
16515             $param = {} if( !CORE::length( $param ) );
16516             $param->{encoding} = $opts->{encoding} if( !CORE::length( $param->{encoding} ) );
16517             if( !CORE::exists( $ref->{ $key } ) )
16518 0 0         {
16519             $ref->{ $key } = [];
16520             }
16521             my $this = {};
16522             $this->{filename} = $param->{filename} if( CORE::length( $param->{filename} ) );
16523 0           $this->{type} = $param->{type} if( CORE::length( $param->{type} ) );
16524             $val = Encode::encode_utf8( $val ) if( substr( $this->{type}, 0, 4 ) eq 'text' );
16525             if( $param->{encoding} )
16526             {
16527 0           if( $param->{encoding} eq 'qp' || $param->{encoding} eq 'quoted-printable' )
16528             {
16529             $this->{value} = MIME::QuotedPrint::encode_qp( $val );
16530             $this->{encoding} = 'Quoted-Printable';
16531 0           }
16532             elsif( $param->{encoding} eq 'base64' )
16533             {
16534             $this->{value} = MIME::Base64::encode_base64( $val );
16535 0           $this->{encoding} = 'Base64';
16536             }
16537 0           else
16538 0           {
16539 0           die( "Unknown encoding method \"", $param->{encoding}, "\"\n" );
16540 0           }
16541             }
16542             else
16543             {
16544             $this->{value} = $val;
16545 0     0     }
16546 0           CORE::push( @{$ref->{ $key }}, $this );
16547 0           };
16548 0 0 0      
16549             my $encode;
16550             $encode = sub
16551 0     0     {
16552 0 0         my( $pref, $data, $hash ) = @_;
16553 0 0         my $type = lc( ref( $data ) );
16554 0 0         if( $type eq 'hash' )
16555             {
16556 0           foreach my $k ( sort( keys( %$data ) ) )
16557             {
16558 0           # my $ke = URI::Escape::uri_escape( $k );
16559 0 0         my $ke = $k;
16560 0 0         $ke =~ s/([\\\"])/\\$1/g;
16561 0 0         my $pkg = Scalar::Util::blessed( $data->{ $k } );
16562 0 0         if( $pkg && $pkg =~ /^Net::API::Stripe/ &&
16563             $data->{ $k }->can( 'id' ) &&
16564 0 0 0       $data->{ $k }->id )
    0          
16565             {
16566 0           $set_value->( "${pref}${ke}", $data->{ $k }->id, $hash, { type => 'text/plain' } );
16567 0           next;
16568             }
16569             # This is a file
16570             elsif( ref( $data->{ $k } ) eq 'HASH' &&
16571 0           CORE::exists( $data->{ $k }->{_filepath} ) )
16572 0           {
16573             CORE::return( $self->error( "File path argument is actually empty" ) ) if( !CORE::length( $data->{ $k }->{_filepath} ) );
16574             my $this_file = Module::Generic::File::file( $data->{ $k }->{_filepath} );
16575             my $fname = $this_file->basename;
16576 0           if( !$this_file->exists )
16577             {
16578             $self->error( "File \"$this_file\" does not exist." );
16579             next;
16580             }
16581 0           elsif( !$this_file->can_read )
16582             {
16583 0           $self->error( "File \"$this_file\" is not reaable by uid $>." );
  0            
16584 0           next;
16585             }
16586 0           my $binary = $this_file->load ||
16587             return( $self->pass_error( $this_file->error ) );
16588             my $mime_type = $this_file->finfo->mime_type;
16589 0     0     $fname =~ s/([\\\"])/\\$1/g;
16590 0           $set_value->( "${pref}${ke}", $binary, $hash, { encoding => 'base64', filename => $fname, type => $mime_type } );
16591 0 0 0       next;
    0 0        
    0 0        
    0          
    0          
16592             }
16593 0           $encode->( ( $pref ? sprintf( '%s[%s]', $pref, $ke ) : $ke ), $data->{ $k }, $hash );
16594             }
16595             }
16596 0           elsif( $type eq 'array' )
16597 0           {
16598 0           # 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
16599 0 0 0       for( my $i = 0; $i < scalar( @$data ); $i++ )
    0 0        
      0        
      0        
16600             {
16601             $encode->( ( $pref ? sprintf( '%s[%d]', $pref, $i ) : sprintf( '[%d]', $i ) ), $data->[$i], $hash );
16602             }
16603 0           }
16604 0           elsif( ref( $data ) eq 'JSON::PP::Boolean' || ref( $data ) eq 'Module::Generic::Boolean' )
16605             {
16606             $set_value->( $pref, $data ? 'true' : 'false', $hash, { type => 'text/plain' } );
16607             }
16608             elsif( ref( $data ) eq 'SCALAR' && ( $$data == 1 || $$data == 0 ) )
16609             {
16610 0 0         $set_value->( $pref, $$data ? 'true' : 'false', $hash, { type => 'text/plain' } );
16611 0           }
16612 0           elsif( $type )
16613 0 0         {
    0          
16614             die( "Don't know what to do with data type $type\n" );
16615 0           }
16616 0           else
16617             {
16618             $set_value->( $pref, $data, $hash, { type => 'text/plain' } );
16619             }
16620 0           };
16621 0           my $result = {};
16622             $encode->( '', $args, $result );
16623 0   0       CORE::return( $result );
16624             }
16625 0            
16626 0           {
16627 0           my $self = shift( @_ );
16628 0           CORE::return( {} ) if( !scalar( @_ ) || ( scalar( @_ ) == 1 && !defined( $_[0] ) ) );
16629             # Arg is one unique object
16630 0 0         CORE::return( $_[0] ) if( $self->_is_object( $_[0] ) );
16631             my $args = ref( $_[0] ) eq 'HASH' ? $_[0] : { @_ == 1 ? ( id => $_[0] ) : @_ };
16632             CORE::return( $args );
16633             }
16634              
16635             {
16636 0           my $self = shift( @_ );
16637             my $class = shift( @_ ) || CORE::return( $self->error( "No class was provided to get its information as parameters." ) );
16638 0 0         my $args = {};
16639             if( $self->_is_object( $_[0] ) && $_[0]->isa( $class ) )
16640             {
16641             my $obj = shift( @_ );
16642             $args = $obj->as_hash({ json => 1 });
16643 0 0         $args->{expand} = 'all';
16644             $args->{_cleanup} = 1;
16645             $args->{_object} = $obj;
16646             }
16647 0 0         else
16648             {
16649             $args = $self->_get_args( @_ );
16650             }
16651 0           CORE::return( $args );
16652             }
16653              
16654             {
16655 0           my $self = shift( @_ );
16656             my( $type, $action, $allowed ) = @_;
16657 0           CORE::return( $self->error( "No action was provided to get the associated method." ) ) if( !CORE::length( $action ) );
16658 0           CORE::return( $self->error( "Allowed method list provided is not an array reference." ) ) if( ref( $allowed ) ne 'ARRAY' );
16659 0           CORE::return( $self->error( "Allowed method list provided is empty." ) ) if( !scalar( @$allowed ) );
16660 0           if( $action eq 'remove' )
16661             {
16662             $action = 'delete';
16663             }
16664             elsif( $action eq 'add' )
16665 0     0     {
16666 0 0 0       $action = 'create';
      0        
16667             }
16668 0 0         if( !scalar( grep( /^$action$/, @$allowed ) ) )
16669 0 0         {
    0          
16670 0           CORE::return( $self->error( "Method $action is not authorised for $type" ) );
16671             }
16672             my $meth = $self->can( "${type}_${action}" );
16673             CORE::return( $self->error( "Method ${type}_${action} is not implemented in class '", ref( $self ), "'" ) ) if( !$meth );
16674             CORE::return( $meth );
16675 0     0     }
16676 0   0        
16677 0           {
16678 0 0 0       my $self = shift( @_ );
16679             my $name = shift( @_ );
16680 0           CORE::return( $self->{ $name } ) if( exists( $self->{ $name } ) && Scalar::Util::blessed( $self->{ $name } ) );
16681 0           my $class = shift( @_ );
16682 0           my $this;
16683 0           try
16684 0           {
16685             # https://stackoverflow.com/questions/32608504/how-to-check-if-perl-module-is-available#comment53081298_32608860
16686             # require $class unless( defined( *{"${class}::"} ) );
16687             my $rc = eval{ $self->_load_class( $class ) };
16688 0           CORE::return( $self->error( "Unable to load class $class: $@" ) ) if( $@ );
16689             $this = $class->new(
16690 0           'debug' => $self->debug,
16691             'verbose' => $self->verbose,
16692             ) || CORE::return( $self->pass_error( $class->error ) );
16693             $this->{parent} = $self;
16694             }
16695 0     0     catch( $e )
16696 0           {
16697 0 0         CORE::return( $self->error({ code => 500, message => $e }) );
16698 0 0         }
16699 0 0         CORE::return( $this );
16700 0 0         }
    0          
16701              
16702 0           {
16703             my $self = shift( @_ );
16704             my $args = shift( @_ );
16705             $args->{skip_frames} = 1 if( !exists( $args->{skip_frames} ) && !defined( $args->{skip_frames} ) );
16706 0           CORE::return( $self->error( $args ) );
16707             }
16708 0 0          
16709             {
16710 0           my $self = shift( @_ );
16711             my $req = shift( @_ );
16712 0           my( $e, $resp, $ret, $is_error );
16713 0 0         $ret = eval
16714 0           {
16715             $req->header( 'Authorization' => $self->{auth} );
16716             $req->header( 'Stripe_Version' => $self->{version} );
16717             $req->header( 'Content-Type' => 'application/x-www-form-urlencoded' );
16718             $req->header( 'Content-Type' => 'application/json' ) if( $self->encode_with_json );
16719 0     0     $req->header( 'Accept' => 'application/json' );
16720 0            
16721 0 0 0       # This commented out block below is used when we use HTTP::Promise while enabling the use of promise, but since we do not need
16722 0           # my $prom = $self->http_client->request( $req )->then(sub
16723 0           # {
16724 0 0 0       # my( $resolve, $reject ) = @$_;
  0            
  0            
  0            
  0            
  0            
  0            
  0            
16725 0     0     # $resolve->( @_ );
16726             # })->wait;
16727             # $resp = $prom->result;
16728 0           # We use this more straightforward approach:
  0            
16729 0 0         $resp = $self->http_client->request( $req );
16730 0   0       return( $self->pass_error( $self->http_client->error ) ) if( !defined( $resp ) );
16731             $self->{http_request} = $req;
16732             $self->{http_response} = $resp;
16733             if( $self->_is_a( $resp => 'HTTP::Promise::Exception' ) )
16734 0           {
16735             return( $self->pass_error( $resp ) );
16736 0 0 0       }
  0 0 0        
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
16737 0     0    
16738 0           # if( $resp->code == 200 )
16739 1 0 0 1   9 if( $resp->is_success || $resp->is_redirect )
  1 0 0     2  
  1 0 0     1816  
  0 0 0        
  0 0 0        
  0 0 0        
  0 0 0        
  0 0 0        
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
16740 0           {
16741             my $content = $resp->decoded_content;
16742             # decoded_content returns a scalar object, which we force into regular string, otherwise JSON complains it cannot parse it.
16743             my $hash = $self->json->utf8->decode( "${content}" );
16744             # $ret = data_object( $hash );
16745 0     0     CORE::return( $hash );
16746 0           }
16747 0 0 0       else
16748 0           {
16749             if( $resp->header( 'Content_Type' ) =~ m{text/html} )
16750             {
16751             CORE::return( $self->error({
16752             code => $resp->code,
16753 0     0     type => $resp->status,
16754 0           message => $resp->status
16755 0           }) );
16756             }
16757 0           else
16758 0           {
16759 0           my $content = $resp->decoded_content;
16760 0           # decoded_content returns a scalar object, which we force into regular string, otherwise JSON complains it cannot parse it.
16761 0 0         my $hash = $self->json->utf8->decode( "${content}" );
16762 0           # For example:
16763             # {
16764             # "error" => {
16765             # "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.",
16766             # "request_log_url" => "https://dashboard.stripe.com/test/logs/req_1Gy9CkPgC0eTw1?t=1666611614",
16767             # "type" => "invalid_request_error"
16768             # }
16769             # }
16770             my $ref = {};
16771             if( exists( $hash->{error} ) &&
16772 0           defined( $hash->{error} ) )
16773 0 0         {
16774 0           if( ref( $hash->{error} ) eq 'HASH' &&
16775 0           exists( $hash->{error}->{message} ) )
16776 0 0         {
16777             $ref->{message} = $hash->{error}->{message};
16778 0           $ref->{type} = $hash->{error}->{type} if( exists( $hash->{error}->{type} ) );
16779             $ref->{request_log_url} = $hash->{error}->{request_log_url} if( exists( $hash->{error}->{request_log_url} ) );
16780             }
16781             }
16782 0 0 0       else
16783             {
16784 0           $ref = $hash;
16785             }
16786 0           CORE::return( $self->error( $ref ) );
16787             }
16788 0           }
16789             };
16790             if( $@ )
16791             {
16792 0 0         CORE::return( $self->error({
16793             # type => "Could not decode HTTP response: $@",
16794 0           $resp
16795             ? ( message => ( "Could not decode HTTP response: $@\n" ) . $resp->status_line . ' - ' . $resp->content )
16796             : ( message => "Could not decode HTTP response: $@" ),
16797             }) );
16798             }
16799             # CORE::return( $ret ) if( $ret );
16800             CORE::return( $ret );
16801             }
16802 0            
16803             {
16804 0           my $self = shift( @_ );
16805             my $class = shift( @_ ) || CORE::return( $self->error( "No class was provided to find its associated type." ) );
16806             $class = ref( $class ) if( $self->_is_object( $class ) );
16807             my $ref = $Net::API::Stripe::TYPE2CLASS;
16808             foreach my $c ( keys( %$ref ) )
16809             {
16810             CORE::return( $c ) if( $ref->{ $c } eq $class );
16811             }
16812             CORE::return;
16813 0           }
16814 0 0 0        
16815             {
16816             my $self = shift( @_ );
16817 0 0 0       my $type = shift( @_ ) || CORE::return( $self->error( "No object type was provided" ) );
16818             my $ref = $Net::API::Stripe::TYPE2CLASS;
16819             CORE::return( $self->error( "No object type '$type' known to get its related class for field $self->{_field}" ) ) if( !exists( $ref->{ $type } ) );
16820 0           CORE::return( $ref->{ $type } );
16821 0 0         }
16822 0 0          
16823             {
16824             my $self = shift( @_ );
16825             my $class = shift( @_ );
16826             my $ref = shift( @_ ) || CORE::return( $self->error( "No array reference provided" ) );
16827 0           CORE::return( $self->error( "Reference provided ($ref) is not an array reference." ) ) if( !ref( $ref ) || ref( $ref ) ne 'ARRAY' );
16828             for( my $i = 0; $i < scalar( @$ref ); $i++ )
16829 0           {
16830             my $hash = $ref->[$i];
16831             next if( ref( $hash ) ne 'HASH' );
16832             my $o = $class->new( %$hash );
16833 0 0         $ref->[$i] = $o;
16834             }
16835 0 0         CORE::return( $ref );
16836             }
16837              
16838             {
16839             my $self = shift( @_ );
16840             my $class = shift( @_ );
16841             CORE::return( $self->error( "No hash was provided" ) ) if( !scalar( @_ ) );
16842             my $hash = $self->_get_args( @_ );
16843 0           # my $callbacks = $CALLBACKS->{ $class };
16844             my $o;
16845             try
16846             {
16847             # https://stackoverflow.com/questions/32608504/how-to-check-if-perl-module-is-available#comment53081298_32608860
16848 0     0     # eval( "require $class;" ) unless( defined( *{"${class}::"} ) );
16849 0   0       my $rc = eval{ $self->_load_class( $class ) };
16850 0 0         CORE::return( $self->error( "An error occured while trying to load the module $class: $@" ) ) if( $@ );
16851 0           $o = $class->new({
16852 0           '_parent' => $self,
16853             '_debug' => $self->{debug},
16854 0 0         '_dbh' => $self->{_dbh},
16855             }, $hash ) || CORE::return( $self->pass_error( $class->error ) );
16856 0           }
16857             catch( $e )
16858             {
16859             CORE::return( $self->error( $e ) );
16860             }
16861 0     0     CORE::return( $self->pass_error( $class->error ) ) if( !defined( $o ) );
16862 0   0       CORE::return( $o );
16863 0           }
16864 0 0          
16865 0           # NOTE:: AUTOLOAD
16866             AUTOLOAD
16867             {
16868             my $self;
16869             $self = shift( @_ ) if( Scalar::Util::blessed( $_[0] ) && $_[0]->isa( 'Net::API::Stripe' ) );
16870 0     0     my( $class, $meth );
16871 0           $class = ref( $self ) || __PACKAGE__;
16872 0   0       $meth = $AUTOLOAD;
16873 0 0 0       if( CORE::index( $meth, '::' ) != -1 )
16874 0           {
16875             my $idx = rindex( $meth, '::' );
16876 0           $class = substr( $meth, 0, $idx );
16877 0 0         $meth = substr( $meth, $idx + 2 );
16878 0           }
16879 0          
16880             # printf( STDERR __PACKAGE__ . "::AUTOLOAD: %d autoload subs found.\n", scalar( keys( %$AUTOLOAD_SUBS ) ) ) if( $DEBUG >= 4 );
16881 0           unless( scalar( keys( %$AUTOLOAD_SUBS ) ) )
16882             {
16883             &Net::API::Stripe::_autoload_subs();
16884             # 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 );
16885             }
16886 0     0    
16887 0           # print( STDERR "Checking if sub '$meth' from class '$class' ($AUTOLOAD) is within the autoload subroutines\n" ) if( $DEBUG >= 4 );
16888 0 0         my $code;
16889 0           if( CORE::exists( $AUTOLOAD_SUBS->{ $meth } ) )
16890             {
16891 0           $code = $AUTOLOAD_SUBS->{ $meth };
16892 0 0 0       }
  0            
  0            
  0            
  0            
  0            
  0            
  0            
16893 0     0    
16894             if( CORE::defined( $code ) )
16895             {
16896 0           $code = Nice::Try->implement( $code ) if( CORE::index( $code, 'try' ) != -1 );
  0            
16897 0 0         # print( STDERR __PACKAGE__, "::AUTOLOAD: updated code for method \"$meth\" ($AUTOLOAD) and \$self '$self' is:\n$code\n" ) if( $DEBUG >= 4 );
16898             my $saved = $@;
16899             {
16900             no strict;
16901             eval( $code );
16902 0   0       }
16903             if( $@ )
16904 0 0 0       {
  0 0 0        
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
16905 0     0     $@ =~ s/ at .*\n//;
16906 0           die( $@ );
16907 1 0 0 1   8 }
  1 0 0     7  
  1 0 0     366  
  0 0 0        
  0 0 0        
  0 0 0        
  0 0 0        
  0 0 0        
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0 0          
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
  0            
16908 0 0         $@ = $saved;
16909 0           # defined( &$AUTOLOAD ) || die( "AUTOLOAD inconsistency error for dynamic sub \"$meth\"." );
16910             my $ref = $class->can( $meth ) || die( "AUTOLOAD inconsistency error for dynamic sub \"$meth\"." );
16911             # No need to keep it in the cache
16912             # delete( $AUTOLOAD_SUBS->{ $meth } );
16913             # goto( &$AUTOLOAD );
16914             # return( &$meth( $self, @_ ) ) if( $self );
16915 0     0     return( $ref->( $self, @_ ) ) if( $self );
16916 0 0 0       no strict 'refs';
16917 0           return( &$AUTOLOAD( @_ ) );
16918 0   0       }
16919 0           die( "Method \"${meth}\" is not defined in Net::API::Stripe" );
16920 0 0         };
16921              
16922 0           DESTROY
16923 0           {
16924 0           # Do nothing; just avoid calling AUTOLOAD
16925             };
16926              
16927             1;
16928 0 0