Stripe.pm

filter: Statementstmt 16.8% 142 / 841 Branchbran 2.8% 16 / 568 Conditioncond 1.5% 6 / 380 MC/DCmcdc 0.9% 2 / 209 Subroutinesub 40.4% 36 / 89 Podpod 81.4% 22 / 27 totaltotal 10.6% 224 / 2114 CC 437 SCAR 73.7
CC
437
Cov
9%
_check_parameters
7832.0
_contract
1332.0
init
756.0
CRAP 1586.5
↑ Summary Stripe/List.pm »
1 # -*- perl -*-
2 ##----------------------------------------------------------------------------
3 ## Stripe API - ~/lib/Net/API/Stripe.pm
4 ## Version v2.0.6
5 ## Copyright(c) 2024 DEGUEST Pte. Ltd.
6 ## Author: Jacques Deguest <jack@deguest.jp>
7 ## Created 2018/07/19
8 ## Modified 2024/12/04
9 ## All rights reserved.
10 ##
11 ##
12 ## This program is free software; you can redistribute it and/or modify it
13 ## under the same terms as Perl itself.
14 ##----------------------------------------------------------------------------
15 package Net::API::Stripe;
16 BEGIN
17 1 ▶{
Subroutine BEGIN: called CC=1 SCAR=0.0
18 1 ▶ use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
19 1 ▶ use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
20 1 ▶ use warnings::register;
Subroutine BEGIN: called CC=1 SCAR=0.0
21 1 ▶ use common::sense;
Subroutine BEGIN: called CC=1 SCAR=0.0
22 1 ▶ use parent qw( Module::Generic );
Subroutine BEGIN: called CC=1 SCAR=0.0
23 1 ▶ use vars qw(
Subroutine BEGIN: called CC=1 SCAR=0.0
24 $VERSION $VERBOSE $DEBUG $BROWSER $ERROR_CODE_TO_STRING $TYPE2CLASS
25 $EXPANDABLES_BY_CLASS $EXPANDABLES $EXPAND_MAX_DEPTH $EXCEPTION_CLASS
26 $AUTOLOAD_SUBS $AUTOLOAD
27 1 );
28 1 ▶ use Cookie;
Subroutine BEGIN: called CC=1 SCAR=0.0
29 1 ▶ use Encode ();
Subroutine BEGIN: called CC=1 SCAR=0.0
30 1 ▶ use Data::UUID;
Subroutine BEGIN: called CC=1 SCAR=0.0
31 1 ▶ use DateTime;
Subroutine BEGIN: called CC=1 SCAR=0.0
32 1 ▶ use DateTime::Format::Strptime;
Subroutine BEGIN: called CC=1 SCAR=0.0
33 1 ▶ use Digest::MD5 qw( md5_base64 );
Subroutine BEGIN: called CC=1 SCAR=0.0
34 1 ▶ use Digest::SHA ();
Subroutine BEGIN: called CC=1 SCAR=0.0
35 1 ▶ use HTTP::Promise;
Subroutine BEGIN: called CC=1 SCAR=0.0
36 1 ▶ use HTTP::Promise::Headers;
Subroutine BEGIN: called CC=1 SCAR=0.0
37 1 ▶ use HTTP::Promise::Message;
Subroutine BEGIN: called CC=1 SCAR=0.0
38 1 ▶ use HTTP::Promise::Request;
Subroutine BEGIN: called CC=1 SCAR=0.0
39 1 ▶ use JSON;
Subroutine BEGIN: called CC=1 SCAR=0.0
40 1 ▶ use MIME::QuotedPrint ();
Subroutine BEGIN: called CC=1 SCAR=0.0
41 1 ▶ use MIME::Base64 ();
Subroutine BEGIN: called CC=1 SCAR=0.0
42 1 ▶ use Module::Generic::File qw( sys_tmpdir );
Subroutine BEGIN: called CC=1 SCAR=0.0
43 1 ▶ use Net::IP;
Subroutine BEGIN: called CC=1 SCAR=0.0
44 1 ▶ use Regexp::Common;
Subroutine BEGIN: called CC=1 SCAR=0.0
45 1 ▶ use Scalar::Util ();
Subroutine BEGIN: called CC=1 SCAR=0.0
46 1 ▶ use URI::Escape;
Subroutine BEGIN: called CC=1 SCAR=0.0
47 1 ▶ use Want;
Subroutine BEGIN: called CC=1 SCAR=0.0
48 1 ▶ use constant API_BASE => 'https://api.stripe.com/v1';
Subroutine BEGIN: called CC=1 SCAR=0.0
49 1 ▶ use constant FILES_BASE => 'https://files.stripe.com/v1';
Subroutine BEGIN: called CC=1 SCAR=0.0
50 1 ▶ 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 )];
Subroutine BEGIN: called CC=1 SCAR=0.0
51 1 our $VERSION = 'v2.0.6';
52 1 our $EXCEPTION_CLASS = 'Net::API::Stripe::Exception';
53 };
54  
55 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
56 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
57  
58 1 our $VERBOSE = 0;
59 1 our $DEBUG = 0;
60 1 our $BROWSER = 'Net::API::Stripe/' . $VERSION;
61  
62 1 our $ERROR_CODE_TO_STRING =
63 {
64 400 => "The request was unacceptable, due to a missing required parameter.",
65 401 => "No valid API key provided.",
66 402 => "The parameters were valid but the request failed.",
67 403 => "The API key doesn't have permissions to perform the request.",
68 404 => "The requested resource doesn't exist.",
69 409 => "The request conflicts with another request.",
70 429 => "Too many requests hit the API too quickly. We recommend an exponential backoff of your requests.",
71 500 => "Something went wrong on Stripe's end.",
72 502 => "Something went wrong on Stripe's end.",
73 503 => "Something went wrong on Stripe's end.",
74 504 => "Something went wrong on Stripe's end.",
75 # Payout: https://stripe.com/docs/api/payouts/failures
76 account_closed => "The bank account has been closed.",
77 # Payout
78 account_frozen => "The bank account has been frozen.",
79 amount_too_large => "The specified amount is greater than the maximum amount allowed. Use a lower amount and try again.",
80 amount_too_small => "The specified amount is less than the minimum amount allowed. Use a higher amount and try again.",
81 api_connection_error => "Failure to connect to Stripe's API.",
82 api_error => "Striipe API error",
83 api_key_expired => "The API key provided has expired",
84 authentication_error => "Failure to properly authenticate yourself in the request.",
85 balance_insufficient => "The transfer or payout could not be completed because the associated account does not have a sufficient balance available.",
86 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.",
87 # Payout: https://stripe.com/docs/api/payouts/failures
88 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.",
89 bank_account_unusable => "The bank account provided cannot be used for payouts. A different bank account must be used.",
90 bank_account_unverified => "Your Connect platform is attempting to share an unverified bank account with a connected account.",
91 # Payout
92 bank_ownership_changed => "The destination bank account is no longer valid because its branch has changed ownership.",
93 card_declined => "The card has been declined.",
94 card_error => "Card error",
95 charge_already_captured => "The charge you’re attempting to refund has already been refunded.",
96 # Payout
97 could_not_process => "The bank could not process this payout.",
98 # Payout
99 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.)",
100 # Payout
101 declined => "The bank has declined this transfer. Please contact the bank before retrying.",
102 email_invalid => "The email address is invalid.",
103 expired_card => "The card has expired. Check the expiration date or use a different card.",
104 idempotency_error => "Idempotency error",
105 # Payout
106 incorrect_account_holder_name => "Your bank notified us that the bank account holder name on file is incorrect.",
107 incorrect_cvc => "The card’s security code is incorrect. Check the card’s security code or use a different card.",
108 incorrect_number => "The card number is incorrect. Check the card’s number or use a different card.",
109 incorrect_zip => "The card’s postal code is incorrect. Check the card’s postal code or use a different card.",
110 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.",
111 # Payout
112 insufficient_funds => "Your Stripe account has insufficient funds to cover the payout.",
113 # Payout
114 invalid_account_number => "The routing number seems correct, but the account number is invalid.",
115 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.",
116 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.",
117 # Payout
118 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.",
119 invalid_cvc => "The card’s security code is invalid. Check the card’s security code or use a different card.",
120 invalid_expiry_month => "The card’s expiration month is incorrect. Check the expiration date or use a different card.",
121 invalid_expiry_year => "The card’s expiration year is incorrect. Check the expiration date or use a different card.",
122 invalid_number => "The card number is invalid. Check the card details or use a different card.",
123 invalid_request_error => "Invalid request error. Request has invalid parameters.",
124 livemode_mismatch => "Test and live mode API keys, requests, and objects are only available within the mode they are in.",
125 missing => "Both a customer and source ID have been provided, but the source has not been saved to the customer. ",
126 # Payout
127 no_account => "The bank account details on file are probably incorrect. No bank account could be located with those details.",
128 parameter_invalid_empty => "One or more required values were not provided. Make sure requests include all required parameters.",
129 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.",
130 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.",
131 parameter_invalid_string_empty => "One or more required string values is empty. Make sure that string values contain at least one character.",
132 parameter_missing => "One or more required values are missing.",
133 parameter_unknown => "The request contains one or more unexpected parameters. Remove these and try again.",
134 payment_method_unactivated => "The charge cannot be created as the payment method used has not been activated.",
135 payouts_not_allowed => "Payouts have been disabled on the connected account.",
136 platform_api_key_expired => "The API key provided by your Connect platform has expired.",
137 postal_code_invalid => "The postal code provided was incorrect.",
138 processing_error => "An error occurred while processing the card. Check the card details are correct or use a different card.",
139 rate_limit => "Too many requests hit the API too quickly. We recommend an exponential backoff of your requests.",
140 rate_limit_error => "Too many requests hit the API too quickly.",
141 testmode_charges_only => "This account has not been activated and can only make test charges.",
142 tls_version_unsupported => "Your integration is using an older version of TLS that is unsupported. You must be using TLS 1.2 or above.",
143 token_already_used => "The token provided has already been used. You must create a new token before you can retry this request.",
144 transfers_not_allowed => "The requested transfer cannot be created. Contact us if you are receiving this error.",
145 # Payout
146 unsupported_card => "The bank no longer supports payouts to this card.",
147 upstream_order_creation_failed => "The order could not be created. Check the order details and then try again.",
148 url_invalid => "The URL provided is invalid.",
149 validation_error => "Stripe client-side library error: improper field validation",
150 };
151  
152 1 our $TYPE2CLASS =
153 {
154 "account" => "Net::API::Stripe::Connect::Account",
155 "account_bank_account" => "Net::API::Stripe::Connect::ExternalAccount::Bank",
156 "account_card" => "Net::API::Stripe::Connect::ExternalAccount::Card",
157 "account_link" => "Net::API::Stripe::Connect::Account::Link",
158 "ach_credit_transfer" => "Net::API::Stripe::Payment::Source::ACHCreditTransfer",
159 "ach_debit" => "Net::API::Stripe::Payment::Source::ACHDebit",
160 "additional_document" => "Net::API::Stripe::Connect::Account::Document",
161 "address" => "Net::API::Stripe::Address",
162 "address_kana" => "Net::API::Stripe::AddressKana",
163 "address_kanji" => "Net::API::Stripe::AddressKanji",
164 "application" => "Net::API::Stripe::Connect::Account",
165 "application_fee" => "Net::API::Stripe::Connect::ApplicationFee",
166 "authorization_controls" => "Net::API::Stripe::Issuing::Card::AuthorizationsControl",
167 "balance" => "Net::API::Stripe::Balance",
168 "balance_transaction" => "Net::API::Stripe::Balance::Transaction",
169 # "bank_account" => "Net::API::Stripe::Connect::ExternalAccount::Bank",
170 # which inherits from Net::API::Stripe::Connect::ExternalAccount::Bank
171 "bank_account" => "Net::API::Stripe::Customer::BankAccount",
172 "billing" => "Net::API::Stripe::Billing::Details",
173 "billing_address" => "Net::API::Stripe::Address",
174 "billing_details" => "Net::API::Stripe::Billing::Details",
175 "billing_portal_configuration" => "Net::API::Stripe::Billing::PortalConfiguration",
176 "billing_portal.session" => "Net::API::Stripe::Billing::PortalSession",
177 "billing_thresholds" => "Net::API::Stripe::Billing::Thresholds",
178 "bitcoin_transaction" => "Net::API::Stripe::Bitcoin::Transaction",
179 "branding" => "Net::API::Stripe::Connect::Account::Branding",
180 "business_profile" => "Net::API::Stripe::Connect::Business::Profile",
181 "capability" => "Net::API::Stripe::Connect::Account::Capability",
182 # "card" => "Net::API::Stripe::Connect::ExternalAccount::Card",
183 # which inherits from Net::API::Stripe::Connect::ExternalAccount::Card
184 "card" => "Net::API::Stripe::Customer::Card",
185 "card_payments" => "Net::API::Stripe::Connect::Account::Settings::CardPayments",
186 "cardholder" => "Net::API::Stripe::Issuing::Card::Holder",
187 "cash_balance" => "Net::API::Stripe::Cash::Balance",
188 "charge" => "Net::API::Stripe::Charge",
189 "charges" => "Net::API::Stripe::List",
190 "checkout.session" => "Net::API::Stripe::Checkout::Session",
191 "checkout_session" => "Net::API::Stripe::Checkout::Session",
192 "code_verification" => "Net::API::Stripe::Payment::Source::CodeVerification",
193 "company" => "Net::API::Stripe::Connect::Account::Company",
194 "country_spec" => "Net::API::Stripe::Connect::CountrySpec",
195 "coupon" => "Net::API::Stripe::Billing::Coupon",
196 "credit_note" => "Net::API::Stripe::Billing::CreditNote",
197 "credit_note_line_item" => "Net::API::Stripe::Billing::CreditNote::LineItem",
198 "credit_noteline_item" => "Net::API::Stripe::Billing::CreditNote::LineItem",
199 "customer" => "Net::API::Stripe::Customer",
200 "customer_address" => "Net::API::Stripe::Address",
201 "customer_balance_transaction" => "Net::API::Stripe::Customer::BalanceTransaction",
202 "customer_bank_account" => "Net::API::Stripe::Connect::ExternalAccount::Bank",
203 "customer_cash_balance_transaction" => "Net::API::Stripe::Cash::Transaction",
204 "customer_shipping" => "Net::API::Stripe::Shipping",
205 "dashboard" => "Net::API::Stripe::Connect::Account::Settings::Dashboard",
206 "data" => "Net::API::Stripe::Event::Data",
207 "discount" => "Net::API::Stripe::Billing::Discount",
208 "dispute" => "Net::API::Stripe::Dispute",
209 "dispute_evidence" => "Net::API::Stripe::Dispute::Evidence",
210 "document" => "Net::API::Stripe::Connect::Account::Document",
211 "early_fraud_warning" => "Net::API::Stripe::Fraud",
212 "error" => "Net::API::Stripe::Error",
213 "event" => "Net::API::Stripe::Event",
214 "evidence" => "Net::API::Stripe::Issuing::Dispute::Evidence",
215 "evidence_details" => "Net::API::Stripe::Dispute::EvidenceDetails",
216 "external_accounts" => "Net::API::Stripe::List",
217 "fee_refund" => "Net::API::Stripe::Connect::ApplicationFee::Refund",
218 "file" => "Net::API::Stripe::File",
219 "file_link" => "Net::API::Stripe::File::Link",
220 "fraud_value_list" => "Net::API::Stripe::Fraud::ValueList",
221 "fraud_value_list_item" => "Net::API::Stripe::Fraud::ValueList::Item",
222 "fraud_warning" => "Net::API::Stripe::Fraud",
223 "fraudulent" => "Net::API::Stripe::Issuing::Dispute::Evidence::Fraudulent",
224 "generated_from" => "Net::API::Stripe::Payment::GeneratedFrom",
225 "identity_verification_report" => "Net::API::Stripe::Identity::VerificationReport",
226 "identity_verification_session" => "Net::API::Stripe::Identity::VerificationSession",
227 "individual" => "Net::API::Stripe::Connect::Person",
228 "inventory" => "Net::API::Stripe::Order::SKU::Inventory",
229 "invoice" => "Net::API::Stripe::Billing::Invoice",
230 "invoice_customer_balance_settings" => "Net::API::Stripe::Billing::Invoice::BalanceSettings",
231 "invoice_settings" => "Net::API::Stripe::Billing::Invoice::Settings",
232 "invoiceitem" => "Net::API::Stripe::Billing::Invoice::Item",
233 "invoice_item" => "Net::API::Stripe::Billing::Invoice::Item",
234 "ip_address_location" => "Net::API::Stripe::GeoLocation",
235 "issuing.authorization" => "Net::API::Stripe::Issuing::Authorization",
236 "issuing.card" => "Net::API::Stripe::Issuing::Card",
237 "issuing.cardholder" => "Net::API::Stripe::Issuing::Card::Holder",
238 "issuing.dispute" => "Net::API::Stripe::Issuing::Dispute",
239 "issuing.transaction" => "Net::API::Stripe::Issuing::Transaction",
240 "issuing_authorization" => "Net::API::Stripe::Issuing::Authorization",
241 "issuing_card" => "Net::API::Stripe::Issuing::Card",
242 "issuing_cardholder" => "Net::API::Stripe::Issuing::Card::Holder",
243 "issuing_dispute" => "Net::API::Stripe::Issuing::Dispute",
244 "issuing_transaction" => "Net::API::Stripe::Issuing::Transaction",
245 "item" => "Net::API::Stripe::List::Item",
246 "items" => "Net::API::Stripe::List",
247 "last_payment_error" => "Net::API::Stripe::Error",
248 "last_setup_error" => "Net::API::Stripe::Error",
249 "line_item" => "Net::API::Stripe::Billing::Invoice::LineItem",
250 "lines" => "Net::API::Stripe::List",
251 "links" => "Net::API::Stripe::List",
252 "list" => "Net::API::Stripe::List",
253 "list_items" => "Net::API::Stripe::List",
254 "login_link" => "Net::API::Stripe::Connect::Account::LoginLink",
255 "mandate" => "Net::API::Stripe::Mandate",
256 "merchant_data" => "Net::API::Stripe::Issuing::MerchantData",
257 "next_action" => "Net::API::Stripe::Payment::Intent::NextAction",
258 "order" => "Net::API::Stripe::Order",
259 "order_legacy" => "Net::API::Stripe::Order",
260 "order_item" => "Net::API::Stripe::Order::Item",
261 "order_return" => "Net::API::Stripe::Order::Return",
262 "other" => "Net::API::Stripe::Issuing::Dispute::Evidence::Other",
263 "outcome" => "Net::API::Stripe::Charge::Outcome",
264 "owner" => "Net::API::Stripe::Payment::Source::Owner",
265 "package_dimensions" => "Net::API::Stripe::Order::SKU::PackageDimensions",
266 "payment_intent" => "Net::API::Stripe::Payment::Intent",
267 "payment_method" => "Net::API::Stripe::Payment::Method",
268 "payment_method_details" => "Net::API::Stripe::Payment::Method::Details",
269 "payments" => "Net::API::Stripe::Connect::Account::Settings::Payments",
270 "payout" => "Net::API::Stripe::Payout",
271 "payouts" => "Net::API::Stripe::Connect::Account::Settings::Payouts",
272 "pending_invoice_item_interval" => "Net::API::Stripe::Billing::Plan",
273 "period" => "Net::API::Stripe::Billing::Invoice::Period",
274 "person" => "Net::API::Stripe::Connect::Person",
275 "plan" => "Net::API::Stripe::Billing::Plan",
276 "portal_configuration" => "Net::API::Stripe::Billing::PortalConfiguration",
277 "portal_session" => "Net::API::Stripe::Billing::PortalSession",
278 "price" => "Net::API::Stripe::Price",
279 "product" => "Net::API::Stripe::Product",
280 "promotion_code" => "Net::API::Stripe::Billing::PromotionCode",
281 "quote" => "Net::API::Stripe::Billing::Quote",
282 "radar.early_fraud_warning" => "Net::API::Stripe::Fraud",
283 "radar.value_list" => "Net::API::Stripe::Fraud::ValueList",
284 "radar.value_list_item" => "Net::API::Stripe::Fraud::ValueList::Item",
285 "radar_early_fraud_warning" => "Net::API::Stripe::Fraud",
286 "radar_value_list" => "Net::API::Stripe::Fraud::ValueList",
287 "radar_value_list_item" => "Net::API::Stripe::Fraud::ValueList::Item",
288 "receiver" => "Net::API::Stripe::Payment::Source::Receiver",
289 "redirect" => "Net::API::Stripe::Payment::Source::Redirect",
290 "refund" => "Net::API::Stripe::Refund",
291 "refunds" => "Net::API::Stripe::Charge::Refunds",
292 "relationship" => "Net::API::Stripe::Connect::Account::Relationship",
293 "report_run" => "Net::API::Stripe::Reporting::ReportRun",
294 "report_type" => "Net::API::Stripe::Reporting::ReportType",
295 "reporting.report_run" => "Net::API::Stripe::Reporting::ReportRun",
296 "reporting.report_type" => "Net::API::Stripe::Reporting::ReportType",
297 "reporting_report_run" => "Net::API::Stripe::Reporting::ReportRun",
298 "reporting_report_type" => "Net::API::Stripe::Reporting::ReportType",
299 "request" => "Net::API::Stripe::Event::Request",
300 "requirements" => "Net::API::Stripe::Connect::Account::Requirements",
301 "result" => "Net::API::Stripe::File",
302 "returns" => "Net::API::Stripe::Order::Returns",
303 "reversals" => "Net::API::Stripe::Connect::Transfer::Reversals",
304 "review" => "Net::API::Stripe::Fraud::Review",
305 "review_session" => "Net::API::Stripe::Fraud::Review::Session",
306 "scheduled_query_run" => "Net::API::Stripe::Sigma::ScheduledQueryRun",
307 "settings" => "Net::API::Stripe::Connect::Account::Settings",
308 "setup_attempt" => "Net::API::Stripe::SetupAttempt",
309 "setup_intent" => "Net::API::Stripe::Payment::Intent::Setup",
310 "shipping" => "Net::API::Stripe::Shipping",
311 "shipping_address" => "Net::API::Stripe::Address",
312 "shipping_rate" => "Net::API::Stripe::Shipping::Rate",
313 "sku" => "Net::API::Stripe::Order::SKU",
314 "source" => "Net::API::Stripe::Payment::Source",
315 "source_order" => "Net::API::Stripe::Order",
316 "sources" => "Net::API::Stripe::Customer::Sources",
317 "status_transitions" => "Net::API::Stripe::Billing::Invoice::StatusTransition",
318 "subscription" => "Net::API::Stripe::Billing::Subscription",
319 "subscription_item" => "Net::API::Stripe::Billing::Subscription::Item",
320 "subscription_schedule" => "Net::API::Stripe::Billing::Subscription::Schedule",
321 "subscriptions" => "Net::API::Stripe::List",
322 "support_address" => "Net::API::Stripe::Address",
323 "tax_code" => "Net::API::Stripe::Product::TaxCode",
324 "tax_id" => "Net::API::Stripe::Customer::TaxId",
325 "tax_ids" => "Net::API::Stripe::Customer::TaxIds",
326 "tax_info" => "Net::API::Stripe::Customer::TaxInfo",
327 "tax_info_verification" => "Net::API::Stripe::Customer::TaxInfoVerification",
328 "tax_rate" => "Net::API::Stripe::Tax::Rate",
329 "terminal.connection_token" => "Net::API::Stripe::Terminal::ConnectionToken",
330 "terminal.location" => "Net::API::Stripe::Terminal::Location",
331 "terminal.reader" => "Net::API::Stripe::Terminal::Reader",
332 "terminal_connection_token" => "Net::API::Stripe::Terminal::ConnectionToken",
333 "terminal_location" => "Net::API::Stripe::Terminal::Location",
334 "terminal_reader" => "Net::API::Stripe::Terminal::Reader",
335 "threshold_reason" => "Net::API::Stripe::Billing::Thresholds",
336 "token" => "Net::API::Stripe::Token",
337 "topup" => "Net::API::Stripe::Connect::TopUp",
338 "tos_acceptance" => "Net::API::Stripe::Connect::Account::TosAcceptance",
339 "transactions" => "Net::API::Stripe::List",
340 "transfer" => "Net::API::Stripe::Connect::Transfer",
341 "transfer_data" => "Net::API::Stripe::Payment::Intent::TransferData",
342 "transfer_reversal" => "Net::API::Stripe::Connect::Transfer::Reversal",
343 "transform_usage" => "Net::API::Stripe::Billing::Plan::TransformUsage",
344 "usage_record" => "Net::API::Stripe::Billing::UsageRecord",
345 "verification" => "Net::API::Stripe::Connect::Account::Verification",
346 "verification_data" => "Net::API::Stripe::Issuing::Authorization::VerificationData",
347 "verification_fields" => "Net::API::Stripe::Connect::CountrySpec::VerificationFields",
348 "verified_address" => "Net::API::Stripe::Address",
349 "webhook_endpoint" => "Net::API::Stripe::WebHook::Object",
350 };
351  
352 1 our $EXPANDABLES_BY_CLASS =
353 {
354 "account" => {},
355 "account_bank_account" => { account => ["account"], customer => ["customer"] },
356 "account_card" => { account => ["account"], customer => ["customer"] },
357 "account_link" => {},
358 "address" => {},
359 "address_kana" => {},
360 "address_kanji" => {},
361 "application_fee" => {
362 account => ["account"],
363 application => ["account"],
364 balance_transaction => ["balance_transaction"],
365 charge => ["charge"],
366 originating_transaction => ["charge"],
367 },
368 "apps.secret" => {},
369 "balance" => {},
370 "balance_transaction" => {
371 source => [
372 "charge",
373 "dispute",
374 "fee_refund",
375 "payout",
376 "application_fee",
377 "refund",
378 "topup",
379 "issuing_transaction",
380 "transfer",
381 "transfer_reversal",
382 ],
383 },
384 "bank_account" => { account => ["account"], customer => ["customer"] },
385 "billing_details" => {},
386 "billing_portal.configuration" => { application => ["account"] },
387 "billing_portal.session" => { configuration => ["billing_portal.configuration"] },
388 "billing_thresholds" => {},
389 "business_profile" => {},
390 "capability" => { account => ["account"] },
391 "card" => { account => ["account"], customer => ["customer"] },
392 "cash_balance" => {},
393 "charge" => {
394 application => ["account"],
395 application_fee => ["application_fee"],
396 balance_transaction => ["balance_transaction"],
397 customer => ["customer"],
398 failure_balance_transaction => ["balance_transaction", "balance_transaction"],
399 invoice => ["invoice"],
400 on_behalf_of => ["account"],
401 payment_intent => ["payment_intent"],
402 review => ["review"],
403 source_transfer => ["transfer"],
404 transfer => ["transfer"],
405 },
406 "checkout.session" => {
407 customer => ["customer"],
408 payment_intent => ["payment_intent"],
409 payment_link => ["payment_link"],
410 setup_intent => ["setup_intent"],
411 subscription => ["subscription"],
412 },
413 "code_verification" => {},
414 "company" => {},
415 "country_spec" => {},
416 "coupon" => {},
417 "credit_note" => {
418 customer => ["customer"],
419 customer_balance_transaction => ["customer_balance_transaction"],
420 invoice => ["invoice"],
421 refund => ["refund"],
422 },
423 "credit_note_line_item" => {},
424 "customer" => {
425 default_source => ["bank_account", "card", "source"],
426 test_clock => ["test_helpers.test_clock", "test_helpers.test_clock"],
427 },
428 "customer_balance_transaction" => {
429 credit_note => ["credit_note"],
430 customer => ["customer"],
431 invoice => ["invoice"],
432 },
433 "customer_cash_balance_transaction" => { customer => ["customer"] },
434 "data" => {},
435 "discount" => { customer => ["customer"], promotion_code => ["promotion_code"] },
436 "dispute" => { charge => ["charge"], payment_intent => ["payment_intent"] },
437 "dispute_evidence" => {
438 cancellation_policy => ["file"],
439 customer_communication => ["file"],
440 customer_signature => ["file"],
441 duplicate_charge_documentation => ["file"],
442 receipt => ["file"],
443 refund_policy => ["file"],
444 service_documentation => ["file"],
445 shipping_documentation => ["file"],
446 uncategorized_file => ["file"],
447 },
448 "document" => {},
449 "error" => {},
450 "event" => {},
451 "evidence" => {},
452 "evidence_details" => {},
453 "fee_refund" => {
454 balance_transaction => ["balance_transaction"],
455 fee => ["application_fee"],
456 },
457 "file" => {},
458 "file_link" => { file => ["file"] },
459 "financial_connections.account" => {
460 ownership => [
461 "financial_connections.account_ownership",
462 "financial_connections.account_ownership",
463 ],
464 },
465 "financial_connections.account_owner" => {},
466 "financial_connections.account_ownership" => {},
467 "financial_connections.session" => {},
468 "funding_instructions" => {},
469 "identity.verification_report" => {},
470 "identity.verification_session" => {
471 last_verification_report => [
472 "identity_verification_report",
473 "identity_verification_report",
474 ],
475 },
476 "invoice" => {
477 account_tax_ids => ["tax_id"],
478 application => ["account"],
479 charge => ["charge"],
480 customer => ["customer"],
481 default_payment_method => ["payment_method"],
482 default_source => ["bank_account", "card", "source"],
483 discounts => ["discount"],
484 on_behalf_of => ["account"],
485 payment_intent => ["payment_intent"],
486 quote => ["quote"],
487 subscription => ["subscription"],
488 test_clock => ["test_helpers.test_clock"],
489 },
490 "invoice_settings" => { default_payment_method => ["payment_method"] },
491 "invoiceitem" => {
492 customer => ["customer"],
493 discounts => ["discount"],
494 invoice => ["invoice"],
495 subscription => ["subscription"],
496 test_clock => ["test_helpers.test_clock"],
497 },
498 "ip_address_location" => {},
499 "issuing.authorization" => { cardholder => ["issuing_cardholder"] },
500 "issuing.card" => {
501 replaced_by => ["issuing_card"],
502 replacement_for => ["issuing_card"],
503 },
504 "issuing.cardholder" => {},
505 "issuing.dispute" => { transaction => ["issuing_transaction"] },
506 "issuing.transaction" => {
507 authorization => ["issuing_authorization"],
508 balance_transaction => ["balance_transaction"],
509 card => ["issuing_card"],
510 cardholder => ["issuing_cardholder"],
511 dispute => ["issuing_dispute"],
512 },
513 "item" => {},
514 "line_item" => { discounts => ["discount"] },
515 "login_link" => {},
516 "mandate" => { payment_method => ["payment_method"] },
517 "merchant_data" => {},
518 "next_action" => {},
519 "outcome" => {},
520 "owner" => {},
521 "package_dimensions" => {},
522 "payment_intent" => {
523 application => ["account"],
524 customer => ["customer"],
525 invoice => ["invoice"],
526 on_behalf_of => ["account"],
527 payment_method => ["payment_method"],
528 review => ["review"],
529 },
530 "payment_link" => { on_behalf_of => ["account"] },
531 "payment_method" => { customer => ["customer"] },
532 "payment_method_details" => {},
533 "payout" => {
534 balance_transaction => ["balance_transaction"],
535 destination => ["card", "bank_account"],
536 failure_balance_transaction => ["balance_transaction"],
537 original_payout => ["payout"],
538 reversed_by => ["payout"],
539 },
540 "period" => {},
541 "person" => {},
542 "plan" => { product => ["product"] },
543 "price" => { product => ["product"] },
544 "product" => {
545 default_price => ["price", "price"],
546 tax_code => ["tax_code", "tax_code"],
547 },
548 "promotion_code" => { customer => ["customer"] },
549 "quote" => {
550 application => ["account"],
551 customer => ["customer"],
552 default_tax_rates => ["tax_rate"],
553 discounts => ["discount"],
554 invoice => ["invoice"],
555 on_behalf_of => ["account"],
556 subscription => ["subscription"],
557 subscription_schedule => ["subscription_schedule"],
558 test_clock => ["test_helpers.test_clock"],
559 },
560 "radar.early_fraud_warning" => {
561 charge => ["charge"],
562 payment_intent => ["payment_intent", "payment_intent"],
563 },
564 "radar.value_list" => {},
565 "radar.value_list_item" => {},
566 "receiver" => {},
567 "redirect" => {},
568 "refund" => {
569 balance_transaction => ["balance_transaction"],
570 charge => ["charge"],
571 failure_balance_transaction => ["balance_transaction"],
572 payment_intent => ["payment_intent"],
573 source_transfer_reversal => ["transfer_reversal"],
574 transfer_reversal => ["transfer_reversal"],
575 },
576 "relationship" => {},
577 "reporting.report_run" => {},
578 "reporting.report_type" => {},
579 "request" => {},
580 "requirements" => {},
581 "review" => { charge => ["charge"], payment_intent => ["payment_intent"] },
582 "scheduled_query_run" => {},
583 "settings" => {},
584 "setup_attempt" => {
585 application => ["account"],
586 customer => ["customer"],
587 on_behalf_of => ["account"],
588 payment_method => ["payment_method"],
589 setup_intent => ["setup_intent"],
590 },
591 "setup_intent" => {
592 application => ["account"],
593 customer => ["customer"],
594 latest_attempt => ["setup_attempt"],
595 mandate => ["mandate"],
596 on_behalf_of => ["account"],
597 payment_method => ["payment_method"],
598 single_use_mandate => ["mandate"],
599 },
600 "shipping" => {},
601 "shipping_rate" => { tax_code => ["tax_code"] },
602 "source" => {},
603 "source_order" => {},
604 "status_transitions" => {},
605 "subscription" => {
606 application => ["account"],
607 customer => ["customer"],
608 default_payment_method => ["payment_method"],
609 default_source => ["bank_account", "card", "source"],
610 latest_invoice => ["invoice"],
611 pending_setup_intent => ["setup_intent"],
612 schedule => ["subscription_schedule"],
613 test_clock => ["test_helpers.test_clock"],
614 },
615 "subscription_item" => {},
616 "subscription_schedule" => {
617 application => ["account", "account"],
618 customer => ["customer"],
619 subscription => ["subscription"],
620 test_clock => ["test_helpers.test_clock", "test_helpers.test_clock"],
621 },
622 "tax_code" => {},
623 "tax_id" => { customer => ["customer"] },
624 "tax_rate" => {},
625 "terminal.configuration" => { splashscreen => ["file", "file"] },
626 "terminal.connection_token" => {},
627 "terminal.location" => {},
628 "terminal.reader" => { location => ["terminal_location"] },
629 "test_helpers.test_clock" => {},
630 "token" => {},
631 "topup" => { balance_transaction => ["balance_transaction"] },
632 "tos_acceptance" => {},
633 "transfer" => {
634 balance_transaction => ["balance_transaction"],
635 destination => ["account"],
636 destination_payment => ["charge"],
637 source_transaction => ["charge"],
638 },
639 "transfer_data" => { destination => ["account"] },
640 "transfer_reversal" => {
641 balance_transaction => ["balance_transaction"],
642 destination_payment_refund => ["refund"],
643 source_refund => ["refund"],
644 transfer => ["transfer"],
645 },
646 "transform_usage" => {},
647 "treasury.credit_reversal" => { transaction => ["treasury.transaction", "treasury.transaction"] },
648 "treasury.debit_reversal" => { transaction => ["treasury.transaction", "treasury.transaction"] },
649 "treasury.financial_account" => {},
650 "treasury.financial_account_features" => {},
651 "treasury.inbound_transfer" => { transaction => ["treasury.transaction", "treasury.transaction"] },
652 "treasury.outbound_payment" => {
653 transaction => [
654 "treasury.transaction",
655 "treasury.transaction",
656 "treasury.transaction",
657 ],
658 },
659 "treasury.outbound_transfer" => {
660 transaction => [
661 "treasury.transaction",
662 "treasury.transaction",
663 "treasury.transaction",
664 ],
665 },
666 "treasury.received_credit" => { transaction => ["treasury.transaction", "treasury.transaction"] },
667 "treasury.received_debit" => { transaction => ["treasury.transaction", "treasury.transaction"] },
668 "treasury.transaction" => {},
669 "treasury.transaction_entry" => { transaction => ["treasury.transaction", "treasury.transaction"] },
670 "usage_record" => {},
671 "usage_record_summary" => {},
672 "verification" => {},
673 "verification_data" => {},
674 "verification_fields" => {},
675 "webhook_endpoint" => {},
676 };
677  
678 # As per Stripe documentation: https://stripe.com/docs/api/expanding_objects
679 1 our $EXPANDABLES = {};
680 1 our $EXPAND_MAX_DEPTH = 4;
681  
682 {
683 1 my $get_expandables;
684 $get_expandables = sub
685 84363 ▶ {
Subroutine __ANON__: called CC=12 SCAR=24.9
686 84363 ▶ my $class = shift( @_ ) || CORE::return;
Condition50%1/2
shift @_ || (return)
l!l
843630
MC/DC0%0/1
shift @_ || (return)
shift @_
Truth table50%1/2
A
A= shift @_
Aresult
11
00
687 84363 my $pref = shift( @_ );
688 84363 ▶ my $depth = shift( @_ ) || 0;
Condition100%2/2
shift @_ || 0
l!l
8430063
MC/DC100%1/1
shift @_ || 0
shift @_
Truth table100%2/2
A
A= shift @_
Aresult
11
00
689 # print( "." x $depth, "Checking class \"$class\" with prefix \"$pref\" and depth $depth\n" );
690 84363 ▶ CORE::return if( $depth > $EXPAND_MAX_DEPTH );
Branch: 1 branch
BranchTrueFalseTotal
if $depth > $Net::API::Stripe::EXPAND_MAX_DEPTH 66455 17908 84363
691 17908 ▶ CORE::return if( !CORE::exists( $EXPANDABLES_BY_CLASS->{ $class } ) );
Branch: 1 branch
BranchTrueFalseTotal
unless exists $Net::API::Stripe::EXPANDABLES_BY_CLASS->{$class} 389 17519 17908
692 17519 my $ref = $EXPANDABLES_BY_CLASS->{ $class };
693 17519 my $list = [];
694 17519 ▶ CORE::push( @$list, $pref ) if( CORE::length( $pref ) );
Branch: 1 branch
BranchTrueFalseTotal
if length $pref 17456 63 17519
695 17519 foreach my $prop ( sort( keys( %$ref ) ) )
696 {
697 58772 ▶ my $target_classes = ref( $ref->{ $prop } ) eq 'ARRAY' ? $ref->{ $prop } : [ $ref->{ $prop } ];
Branch: 1 branch
BranchTrueFalseTotal
ref $ref->{$prop} eq 'ARRAY' ? : 58772 0 58772
698 58772 ▶ my $new_prefix = CORE::length( $pref ) ? "${pref}.${prop}" : $prop;
Branch: 1 branch
BranchTrueFalseTotal
length $pref ? : 58599 173 58772
699 58772 my $this_path = [split(/\./, $new_prefix)];
700 58772 my $this_depth = scalar( @$this_path );
701 58772 foreach my $target_class ( @$target_classes )
702 {
703 84300 my $res = $get_expandables->( $target_class, $new_prefix, $this_depth );
704 84300 ▶ CORE::push( @$list, @$res ) if( ref( $res ) && scalar( @$res ) );
Branch: 1 branch
BranchTrueFalseTotal
if ref $res and scalar @$res 17456 66844 84300
Condition100%2/2
ref $res and scalar @$res
!ll
6684417456
MC/DC100%1/1
ref $res and scalar @$res
ref $res
Truth table100%2/2
A
A= ref $res
Aresult
00
11
705 }
706 }
707 17519 CORE::return( $list );
708 1 };
709  
710 1 ▶ if( !scalar( keys( %$EXPANDABLES ) ) )
Branch: 1 branch
BranchTrueFalseTotal
unless (scalar keys %$Net::API::Stripe::EXPANDABLES) 1 0 1
711 {
712 1 foreach my $prop ( sort( keys( %$EXPANDABLES_BY_CLASS ) ) )
713 {
714 136 ▶ if( !scalar( keys( %{$EXPANDABLES_BY_CLASS->{ $prop }} ) ) )
Branch: 1 branch
BranchTrueFalseTotal
unless (scalar keys %{$$Net::API::Stripe::EXPANDABLES_BY_CLASS{$prop};}) 73 63 136
715 {
716 73 $EXPANDABLES->{ $prop } = [];
717 73 next;
718 }
719 63 my $res = $get_expandables->( $prop, '', 0 );
720 63 ▶ $EXPANDABLES->{ $prop } = $res if( ref( $res ) && scalar( @$res ) );
Branch: 1 branch
BranchTrueFalseTotal
if ref $res and scalar @$res 58 5 63
Condition50%1/2
ref $res and scalar @$res
!ll
063
MC/DC0%0/1
ref $res and scalar @$res
ref $res
Truth table50%1/2
A
A= ref $res
Aresult
00
11
721 }
722 1 $EXPANDABLES->{invoice_item} = $EXPANDABLES->{invoiceitem};
723 }
724 }
725  
726 sub init;
727 sub api_uri;
728 sub auth;
729 sub browser;
730 sub code2error;
731 sub conf_file;
732 sub cookie_file;
733 sub currency;
734 sub delete;
735 sub encode_with_json;
736 sub expand;
737 sub fields;
738 sub file_api_uri;
739 sub generate_uuid;
740 sub get;
741 sub http_client;
742 sub http_request;
743 sub http_response;
744 sub ignore_unknown_parameters;
745 sub json;
746 sub key;
747 sub livemode;
748 sub post;
749 sub post_multipart;
750 sub version;
751 sub webhook_validate_signature;
752 sub webhook_validate_caller_ip;
753 sub account;
754 sub account_bank_account;
755 sub account_bank_account_create;
756 sub account_bank_account_delete;
757 sub account_bank_account_list;
758 sub account_bank_account_retrieve;
759 sub account_bank_account_update;
760 sub account_bank_accounts;
761 sub account_card;
762 sub account_card_create;
763 sub account_card_delete;
764 sub account_card_list;
765 sub account_card_retrieve;
766 sub account_card_update;
767 sub account_cards;
768 sub account_create;
769 sub account_delete;
770 sub account_link;
771 sub account_link_create;
772 sub account_links;
773 sub account_list;
774 sub account_reject;
775 sub account_retrieve;
776 sub account_token_create;
777 sub account_update;
778 sub accounts;
779 sub address;
780 sub address_kana;
781 sub address_kanji;
782 sub amount;
783 sub application_fee;
784 sub application_fee_list;
785 sub application_fee_refund;
786 sub application_fee_retrieve;
787 sub application_fees;
788 sub apps_secret;
789 sub apps_secret_delete;
790 sub apps_secret_find;
791 sub apps_secret_list;
792 sub apps_secret_set;
793 sub apps_secrets;
794 sub authorization;
795 sub balance;
796 sub balance_retrieve;
797 sub balance_transaction;
798 sub balance_transaction_list;
799 sub balance_transaction_retrieve;
800 sub balance_transactions;
801 sub balances;
802 sub bank_account;
803 sub bank_account_create;
804 sub bank_account_delete;
805 sub bank_account_list;
806 sub bank_account_retrieve;
807 sub bank_account_update;
808 sub bank_account_verify;
809 sub bank_accounts;
810 sub bank_token_create;
811 sub billing_details;
812 sub billing_portal_configuration;
813 sub billing_portal_configuration_create;
814 sub billing_portal_configuration_list;
815 sub billing_portal_configuration_retrieve;
816 sub billing_portal_configuration_update;
817 sub billing_portal_configurations;
818 sub billing_portal_session;
819 sub billing_portal_session_create;
820 sub billing_portal_sessions;
821 sub billing_thresholds;
822 sub business_profile;
823 sub capability;
824 sub capability_list;
825 sub capability_retrieve;
826 sub capability_update;
827 sub capabilitys;
828 sub card;
829 sub card_create;
830 sub card_delete;
831 sub card_holder;
832 sub card_list;
833 sub card_retrieve;
834 sub card_token_create;
835 sub card_update;
836 sub cards;
837 sub cash_balance;
838 sub cash_balance_retrieve;
839 sub cash_balance_update;
840 sub cash_balances;
841 sub cash_transction;
842 sub charge;
843 sub charge_capture;
844 sub charge_create;
845 sub charge_list;
846 sub charge_retrieve;
847 sub charge_search;
848 sub charge_update;
849 sub charges;
850 sub checkout_session;
851 sub checkout_session_create;
852 sub checkout_session_expire;
853 sub checkout_session_items;
854 sub checkout_session_list;
855 sub checkout_session_retrieve;
856 sub checkout_sessions;
857 sub code_verification;
858 sub company;
859 sub connection_token;
860 sub country_spec;
861 sub country_spec_list;
862 sub country_spec_retrieve;
863 sub country_specs;
864 sub coupon;
865 sub coupon_create;
866 sub coupon_delete;
867 sub coupon_list;
868 sub coupon_retrieve;
869 sub coupon_update;
870 sub coupons;
871 sub credit_note;
872 sub credit_note_create;
873 sub credit_note_line_item;
874 sub credit_note_line_item_list;
875 sub credit_note_line_items;
876 sub credit_note_lines;
877 sub credit_note_lines_preview;
878 sub credit_note_list;
879 sub credit_note_preview;
880 sub credit_note_retrieve;
881 sub credit_note_update;
882 sub credit_note_void;
883 sub credit_notes;
884 sub customer;
885 sub customer_balance_transaction;
886 sub customer_balance_transaction_create;
887 sub customer_balance_transaction_list;
888 sub customer_balance_transaction_retrieve;
889 sub customer_balance_transaction_update;
890 sub customer_balance_transactions;
891 sub customer_bank_account;
892 sub customer_bank_account_create;
893 sub customer_bank_account_delete;
894 sub customer_bank_account_list;
895 sub customer_bank_account_retrieve;
896 sub customer_bank_account_update;
897 sub customer_bank_account_verify;
898 sub customer_bank_accounts;
899 sub customer_cash_balance_transaction;
900 sub customer_cash_balance_transaction_fund_cash_balance;
901 sub customer_cash_balance_transaction_list;
902 sub customer_cash_balance_transaction_retrieve;
903 sub customer_cash_balance_transactions;
904 sub customer_create;
905 sub customer_delete;
906 sub customer_delete_discount;
907 sub customer_list;
908 sub customer_payment_method;
909 sub customer_payment_methods;
910 sub customer_retrieve;
911 sub customer_search;
912 sub customer_tax_id;
913 sub customer_update;
914 sub customers;
915 sub cvc_update_token_create;
916 sub data;
917 sub discount;
918 sub discount_delete;
919 sub discounts;
920 sub dispute;
921 sub dispute_close;
922 sub dispute_evidence;
923 sub dispute_list;
924 sub dispute_retrieve;
925 sub dispute_update;
926 sub disputes;
927 sub document;
928 sub event;
929 sub event_list;
930 sub event_retrieve;
931 sub events;
932 sub evidence;
933 sub evidence_details;
934 sub fee_refund;
935 sub fee_refund_create;
936 sub fee_refund_list;
937 sub fee_refund_retrieve;
938 sub fee_refund_update;
939 sub fee_refunds;
940 sub file;
941 sub file_create;
942 sub file_link;
943 sub file_link_create;
944 sub file_link_list;
945 sub file_link_retrieve;
946 sub file_link_update;
947 sub file_links;
948 sub file_list;
949 sub file_retrieve;
950 sub files;
951 sub financial_connections_account;
952 sub financial_connections_account_disconnect;
953 sub financial_connections_account_list;
954 sub financial_connections_account_owner;
955 sub financial_connections_account_owner_list;
956 sub financial_connections_account_owners;
957 sub financial_connections_account_ownership;
958 sub financial_connections_account_refresh;
959 sub financial_connections_account_retrieve;
960 sub financial_connections_accounts;
961 sub financial_connections_session;
962 sub financial_connections_session_create;
963 sub financial_connections_session_retrieve;
964 sub financial_connections_sessions;
965 sub fraud;
966 sub funding_instructions;
967 sub funding_instructions_create;
968 sub funding_instructions_fund;
969 sub funding_instructions_list;
970 sub funding_instructionss;
971 sub identity_verification_report;
972 sub identity_verification_report_list;
973 sub identity_verification_report_retrieve;
974 sub identity_verification_reports;
975 sub identity_verification_session;
976 sub identity_verification_session_cancel;
977 sub identity_verification_session_create;
978 sub identity_verification_session_list;
979 sub identity_verification_session_redact;
980 sub identity_verification_session_retrieve;
981 sub identity_verification_session_update;
982 sub identity_verification_sessions;
983 sub invoice;
984 sub invoice_create;
985 sub invoice_delete;
986 sub invoice_finalise;
987 sub invoice_finalize;
988 sub invoice_item;
989 sub invoice_item_create;
990 sub invoice_item_delete;
991 sub invoice_item_list;
992 sub invoice_item_retrieve;
993 sub invoice_item_update;
994 sub invoice_items;
995 sub invoice_line_item;
996 sub invoice_lines;
997 sub invoice_lines_upcoming;
998 sub invoice_list;
999 sub invoice_pay;
1000 sub invoice_retrieve;
1001 sub invoice_search;
1002 sub invoice_send;
1003 sub invoice_settings;
1004 sub invoice_uncollectible;
1005 sub invoice_upcoming;
1006 sub invoice_update;
1007 sub invoice_void;
1008 sub invoice_write_off;
1009 sub invoiceitem;
1010 sub invoiceitem_create;
1011 sub invoiceitem_delete;
1012 sub invoiceitem_list;
1013 sub invoiceitem_retrieve;
1014 sub invoiceitem_update;
1015 sub invoiceitems;
1016 sub invoices;
1017 sub ip_address_location;
1018 sub issuing_authorization;
1019 sub issuing_authorization_approve;
1020 sub issuing_authorization_decline;
1021 sub issuing_authorization_list;
1022 sub issuing_authorization_retrieve;
1023 sub issuing_authorization_update;
1024 sub issuing_authorizations;
1025 sub issuing_card;
1026 sub issuing_card_create;
1027 sub issuing_card_deliver;
1028 sub issuing_card_fail;
1029 sub issuing_card_list;
1030 sub issuing_card_retrieve;
1031 sub issuing_card_return;
1032 sub issuing_card_ship;
1033 sub issuing_card_update;
1034 sub issuing_cardholder;
1035 sub issuing_cardholder_create;
1036 sub issuing_cardholder_list;
1037 sub issuing_cardholder_retrieve;
1038 sub issuing_cardholder_update;
1039 sub issuing_cardholders;
1040 sub issuing_cards;
1041 sub issuing_dispute;
1042 sub issuing_dispute_create;
1043 sub issuing_dispute_list;
1044 sub issuing_dispute_retrieve;
1045 sub issuing_dispute_submit;
1046 sub issuing_dispute_update;
1047 sub issuing_disputes;
1048 sub issuing_transaction;
1049 sub issuing_transaction_list;
1050 sub issuing_transaction_retrieve;
1051 sub issuing_transaction_update;
1052 sub issuing_transactions;
1053 sub item;
1054 sub line_item;
1055 sub line_item_lines;
1056 sub line_items;
1057 sub location;
1058 sub login_link;
1059 sub login_link_create;
1060 sub login_links;
1061 sub mandate;
1062 sub mandate_retrieve;
1063 sub mandates;
1064 sub merchant_data;
1065 sub next_action;
1066 sub order;
1067 sub order_item;
1068 sub outcome;
1069 sub owner;
1070 sub package_dimensions;
1071 sub payment_intent;
1072 sub payment_intent_apply_customer_balance;
1073 sub payment_intent_cancel;
1074 sub payment_intent_capture;
1075 sub payment_intent_confirm;
1076 sub payment_intent_create;
1077 sub payment_intent_increment;
1078 sub payment_intent_increment_authorization;
1079 sub payment_intent_list;
1080 sub payment_intent_reconcile;
1081 sub payment_intent_retrieve;
1082 sub payment_intent_search;
1083 sub payment_intent_update;
1084 sub payment_intent_verify;
1085 sub payment_intent_verify_microdeposits;
1086 sub payment_intents;
1087 sub payment_link;
1088 sub payment_link_create;
1089 sub payment_link_items;
1090 sub payment_link_line_items;
1091 sub payment_link_list;
1092 sub payment_link_retrieve;
1093 sub payment_link_update;
1094 sub payment_links;
1095 sub payment_method;
1096 sub payment_method_attach;
1097 sub payment_method_create;
1098 sub payment_method_detach;
1099 sub payment_method_details;
1100 sub payment_method_list;
1101 sub payment_method_list_customer_payment_methods;
1102 sub payment_method_retrieve;
1103 sub payment_method_retrieve_customer_payment_method;
1104 sub payment_method_update;
1105 sub payment_methods;
1106 sub payout;
1107 sub payout_cancel;
1108 sub payout_create;
1109 sub payout_list;
1110 sub payout_retrieve;
1111 sub payout_reverse;
1112 sub payout_update;
1113 sub payouts;
1114 sub period;
1115 sub person;
1116 sub person_create;
1117 sub person_delete;
1118 sub person_list;
1119 sub person_retrieve;
1120 sub person_token_create;
1121 sub person_update;
1122 sub persons;
1123 sub pii_token_create;
1124 sub plan;
1125 sub plan_by_product;
1126 sub plan_create;
1127 sub plan_delete;
1128 sub plan_list;
1129 sub plan_retrieve;
1130 sub plan_update;
1131 sub plans;
1132 sub portal_configuration;
1133 sub portal_configuration_create;
1134 sub portal_configuration_list;
1135 sub portal_configuration_retrieve;
1136 sub portal_configuration_update;
1137 sub portal_configurations;
1138 sub portal_session;
1139 sub portal_session_create;
1140 sub portal_sessions;
1141 sub price;
1142 sub price_create;
1143 sub price_list;
1144 sub price_retrieve;
1145 sub price_search;
1146 sub price_update;
1147 sub prices;
1148 sub product;
1149 sub product_by_name;
1150 sub product_create;
1151 sub product_delete;
1152 sub product_list;
1153 sub product_retrieve;
1154 sub product_search;
1155 sub product_update;
1156 sub products;
1157 sub promotion_code;
1158 sub promotion_code_create;
1159 sub promotion_code_list;
1160 sub promotion_code_retrieve;
1161 sub promotion_code_update;
1162 sub promotion_codes;
1163 sub quote;
1164 sub quote_accept;
1165 sub quote_cancel;
1166 sub quote_create;
1167 sub quote_download;
1168 sub quote_finalize;
1169 sub quote_line_items;
1170 sub quote_lines;
1171 sub quote_list;
1172 sub quote_retrieve;
1173 sub quote_update;
1174 sub quote_upfront_line_items;
1175 sub quote_upfront_lines;
1176 sub quotes;
1177 sub radar_early_fraud_warning;
1178 sub radar_early_fraud_warning_list;
1179 sub radar_early_fraud_warning_retrieve;
1180 sub radar_early_fraud_warnings;
1181 sub radar_value_list;
1182 sub radar_value_list_create;
1183 sub radar_value_list_delete;
1184 sub radar_value_list_item;
1185 sub radar_value_list_item_create;
1186 sub radar_value_list_item_delete;
1187 sub radar_value_list_item_list;
1188 sub radar_value_list_item_retrieve;
1189 sub radar_value_list_items;
1190 sub radar_value_list_list;
1191 sub radar_value_list_retrieve;
1192 sub radar_value_list_update;
1193 sub radar_value_lists;
1194 sub reader;
1195 sub receiver;
1196 sub redirect;
1197 sub refund;
1198 sub refund_cancel;
1199 sub refund_create;
1200 sub refund_list;
1201 sub refund_retrieve;
1202 sub refund_update;
1203 sub refunds;
1204 sub relationship;
1205 sub reporting_report_run;
1206 sub reporting_report_run_create;
1207 sub reporting_report_run_list;
1208 sub reporting_report_run_retrieve;
1209 sub reporting_report_runs;
1210 sub reporting_report_type;
1211 sub reporting_report_type_list;
1212 sub reporting_report_type_retrieve;
1213 sub reporting_report_types;
1214 sub request;
1215 sub requirements;
1216 sub return;
1217 sub review;
1218 sub review_approve;
1219 sub review_list;
1220 sub review_retrieve;
1221 sub reviews;
1222 sub schedule;
1223 sub schedule_cancel;
1224 sub schedule_create;
1225 sub schedule_list;
1226 sub schedule_query;
1227 sub schedule_release;
1228 sub schedule_retrieve;
1229 sub schedule_update;
1230 sub scheduled_query_run;
1231 sub scheduled_query_run_list;
1232 sub scheduled_query_run_retrieve;
1233 sub scheduled_query_runs;
1234 sub schedules;
1235 sub session;
1236 sub session_create;
1237 sub session_expire;
1238 sub session_list;
1239 sub session_retrieve;
1240 sub session_retrieve_items;
1241 sub sessions;
1242 sub settings;
1243 sub setup_attempt;
1244 sub setup_attempt_list;
1245 sub setup_attempts;
1246 sub setup_intent;
1247 sub setup_intent_cancel;
1248 sub setup_intent_confirm;
1249 sub setup_intent_create;
1250 sub setup_intent_list;
1251 sub setup_intent_retrieve;
1252 sub setup_intent_update;
1253 sub setup_intent_verify;
1254 sub setup_intent_verify_microdeposits;
1255 sub setup_intents;
1256 sub shipping;
1257 sub shipping_rate;
1258 sub shipping_rate_create;
1259 sub shipping_rate_list;
1260 sub shipping_rate_retrieve;
1261 sub shipping_rate_update;
1262 sub shipping_rates;
1263 sub sku;
1264 sub source;
1265 sub source_attach;
1266 sub source_create;
1267 sub source_detach;
1268 sub source_order;
1269 sub source_retrieve;
1270 sub source_update;
1271 sub sources;
1272 sub status_transitions;
1273 sub subscription;
1274 sub subscription_cancel;
1275 sub subscription_create;
1276 sub subscription_delete;
1277 sub subscription_delete_discount;
1278 sub subscription_item;
1279 sub subscription_item_create;
1280 sub subscription_item_delete;
1281 sub subscription_item_list;
1282 sub subscription_item_retrieve;
1283 sub subscription_item_update;
1284 sub subscription_items;
1285 sub subscription_list;
1286 sub subscription_retrieve;
1287 sub subscription_schedule;
1288 sub subscription_schedule_cancel;
1289 sub subscription_schedule_create;
1290 sub subscription_schedule_list;
1291 sub subscription_schedule_release;
1292 sub subscription_schedule_retrieve;
1293 sub subscription_schedule_update;
1294 sub subscription_schedules;
1295 sub subscription_search;
1296 sub subscription_update;
1297 sub subscriptions;
1298 sub tax_code;
1299 sub tax_code_list;
1300 sub tax_code_retrieve;
1301 sub tax_codes;
1302 sub tax_id;
1303 sub tax_id_create;
1304 sub tax_id_delete;
1305 sub tax_id_list;
1306 sub tax_id_retrieve;
1307 sub tax_ids;
1308 sub tax_rate;
1309 sub tax_rate_create;
1310 sub tax_rate_list;
1311 sub tax_rate_retrieve;
1312 sub tax_rate_update;
1313 sub tax_rates;
1314 sub terminal_configuration;
1315 sub terminal_configuration_create;
1316 sub terminal_configuration_delete;
1317 sub terminal_configuration_list;
1318 sub terminal_configuration_retrieve;
1319 sub terminal_configuration_update;
1320 sub terminal_configurations;
1321 sub terminal_connection_token;
1322 sub terminal_connection_token_create;
1323 sub terminal_connection_tokens;
1324 sub terminal_location;
1325 sub terminal_location_create;
1326 sub terminal_location_delete;
1327 sub terminal_location_list;
1328 sub terminal_location_retrieve;
1329 sub terminal_location_update;
1330 sub terminal_locations;
1331 sub terminal_reader;
1332 sub terminal_reader_cancel_action;
1333 sub terminal_reader_create;
1334 sub terminal_reader_delete;
1335 sub terminal_reader_list;
1336 sub terminal_reader_present_payment_method;
1337 sub terminal_reader_process_payment_intent;
1338 sub terminal_reader_process_setup_intent;
1339 sub terminal_reader_retrieve;
1340 sub terminal_reader_set_reader_display;
1341 sub terminal_reader_update;
1342 sub terminal_readers;
1343 sub test_helpers_test_clock;
1344 sub test_helpers_test_clock_advance;
1345 sub test_helpers_test_clock_create;
1346 sub test_helpers_test_clock_delete;
1347 sub test_helpers_test_clock_list;
1348 sub test_helpers_test_clock_retrieve;
1349 sub test_helpers_test_clocks;
1350 sub token;
1351 sub token_create;
1352 sub token_create_account;
1353 sub token_create_bank_account;
1354 sub token_create_card;
1355 sub token_create_cvc_update;
1356 sub token_create_person;
1357 sub token_create_pii;
1358 sub token_retrieve;
1359 sub tokens;
1360 sub topup;
1361 sub topup_cancel;
1362 sub topup_create;
1363 sub topup_list;
1364 sub topup_retrieve;
1365 sub topup_update;
1366 sub topups;
1367 sub tos_acceptance;
1368 sub transfer;
1369 sub transfer_create;
1370 sub transfer_data;
1371 sub transfer_list;
1372 sub transfer_retrieve;
1373 sub transfer_reversal;
1374 sub transfer_reversal_create;
1375 sub transfer_reversal_list;
1376 sub transfer_reversal_retrieve;
1377 sub transfer_reversal_update;
1378 sub transfer_reversals;
1379 sub transfer_update;
1380 sub transfers;
1381 sub transform_usage;
1382 sub treasury_credit_reversal;
1383 sub treasury_credit_reversal_create;
1384 sub treasury_credit_reversal_list;
1385 sub treasury_credit_reversal_retrieve;
1386 sub treasury_credit_reversals;
1387 sub treasury_debit_reversal;
1388 sub treasury_debit_reversal_create;
1389 sub treasury_debit_reversal_list;
1390 sub treasury_debit_reversal_retrieve;
1391 sub treasury_debit_reversals;
1392 sub treasury_financial_account;
1393 sub treasury_financial_account_create;
1394 sub treasury_financial_account_features;
1395 sub treasury_financial_account_features_retrieve;
1396 sub treasury_financial_account_features_update;
1397 sub treasury_financial_account_featuress;
1398 sub treasury_financial_account_list;
1399 sub treasury_financial_account_retrieve;
1400 sub treasury_financial_account_update;
1401 sub treasury_financial_accounts;
1402 sub treasury_inbound_transfer;
1403 sub treasury_inbound_transfer_cancel;
1404 sub treasury_inbound_transfer_create;
1405 sub treasury_inbound_transfer_fail;
1406 sub treasury_inbound_transfer_list;
1407 sub treasury_inbound_transfer_retrieve;
1408 sub treasury_inbound_transfer_return;
1409 sub treasury_inbound_transfer_succeed;
1410 sub treasury_inbound_transfers;
1411 sub treasury_outbound_payment;
1412 sub treasury_outbound_payment_cancel;
1413 sub treasury_outbound_payment_create;
1414 sub treasury_outbound_payment_fail;
1415 sub treasury_outbound_payment_list;
1416 sub treasury_outbound_payment_post;
1417 sub treasury_outbound_payment_retrieve;
1418 sub treasury_outbound_payment_return;
1419 sub treasury_outbound_payments;
1420 sub treasury_outbound_transfer;
1421 sub treasury_outbound_transfer_cancel;
1422 sub treasury_outbound_transfer_create;
1423 sub treasury_outbound_transfer_fail;
1424 sub treasury_outbound_transfer_list;
1425 sub treasury_outbound_transfer_post;
1426 sub treasury_outbound_transfer_retrieve;
1427 sub treasury_outbound_transfer_return;
1428 sub treasury_outbound_transfers;
1429 sub treasury_received_credit;
1430 sub treasury_received_credit_list;
1431 sub treasury_received_credit_received_credit;
1432 sub treasury_received_credit_retrieve;
1433 sub treasury_received_credits;
1434 sub treasury_received_debit;
1435 sub treasury_received_debit_list;
1436 sub treasury_received_debit_received_debit;
1437 sub treasury_received_debit_retrieve;
1438 sub treasury_received_debits;
1439 sub treasury_transaction;
1440 sub treasury_transaction_entry;
1441 sub treasury_transaction_entry_list;
1442 sub treasury_transaction_entry_retrieve;
1443 sub treasury_transaction_entrys;
1444 sub treasury_transaction_list;
1445 sub treasury_transaction_retrieve;
1446 sub treasury_transactions;
1447 sub usage_record;
1448 sub usage_record_create;
1449 sub usage_record_list;
1450 sub usage_record_summary;
1451 sub usage_records;
1452 sub value_list;
1453 sub value_list_item;
1454 sub verification;
1455 sub verification_data;
1456 sub verification_fields;
1457 sub webhook;
1458 sub webhook_endpoint;
1459 sub webhook_endpoint_create;
1460 sub webhook_endpoint_delete;
1461 sub webhook_endpoint_list;
1462 sub webhook_endpoint_retrieve;
1463 sub webhook_endpoint_update;
1464 sub webhook_endpoints;
1465  
1466 sub init
1467 0 ▶{
Subroutine init: not called CC=27 SCAR=66.3
Pod documented
1468 0 my $self = shift( @_ );
1469 # $self->{token} = '' unless( length( $self->{token} ) );
1470 0 ▶ $self->{amount} = '' unless( length( $self->{amount} ) );
Branch: 1 branch
BranchTrueFalseTotal
unless length $self->{"amount"} 0 0 0
1471 0 ▶ $self->{currency} ||= 'jpy';
Condition0%0/2
$self->{"currency"} ||= "jpy"
l!l
00
MC/DC0%0/1
$self->{"currency"} ||= "jpy"
$self->{"currency"}
Truth table0%0/2
A
A= $self->{"currency"}
Aresult
11
00
1472 0 ▶ $self->{description} = '' unless( length( $self->{description} ) );
Branch: 1 branch
BranchTrueFalseTotal
unless length $self->{"description"} 0 0 0
1473 0 ▶ $self->{card} = '' unless( length( $self->{card} ) );
Branch: 1 branch
BranchTrueFalseTotal
unless length $self->{"card"} 0 0 0
1474 0 ▶ $self->{version} = '' unless( length( $self->{version} ) );
Branch: 1 branch
BranchTrueFalseTotal
unless length $self->{"version"} 0 0 0
1475 0 ▶ $self->{key} = '' unless( length( $self->{key} ) );
Branch: 1 branch
BranchTrueFalseTotal
unless length $self->{"key"} 0 0 0
1476 0 ▶ $self->{cookie_file} = '' unless( length( $self->{cookie_file} ) );
Branch: 1 branch
BranchTrueFalseTotal
unless length $self->{"cookie_file"} 0 0 0
1477 0 ▶ $self->{browser} = $BROWSER unless( length( $self->{browser} ) );
Branch: 1 branch
BranchTrueFalseTotal
unless length $self->{"browser"} 0 0 0
1478 0 ▶ $self->{encode_with_json} = 0 unless( length( $self->{encode_with_json} ) );
Branch: 1 branch
BranchTrueFalseTotal
unless length $self->{"encode_with_json"} 0 0 0
1479 0 ▶ $self->{api_uri} = URI->new( API_BASE ) unless( length( $self->{api_uri} ) );
Branch: 1 branch
BranchTrueFalseTotal
unless length $self->{"api_uri"} 0 0 0
1480 0 ▶ $self->{file_api_uri} = URI->new( FILES_BASE ) unless( length( $self->{file_api_uri} ) );
Branch: 1 branch
BranchTrueFalseTotal
unless length $self->{"file_api_uri"} 0 0 0
1481 # Ask Module::Generic to check if corresponding method exists for each parameter submitted,
1482 # and if so, use it to set the value of the key in hash parameters
1483 0 $self->{_init_strict_use_sub} = 1;
1484 0 ▶ $self->{temp_dir} = sys_tmpdir() unless( length( $self->{temp_dir} ) );
Branch: 1 branch
BranchTrueFalseTotal
unless length $self->{"temp_dir"} 0 0 0
1485 # 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.
1486 0 $self->{livemode} = '';
1487 0 ▶ $self->{ignore_unknown_parameters} = '' unless( length( $self->{ignore_unknown_parameters} ) );
Branch: 1 branch
BranchTrueFalseTotal
unless length $self->{"ignore_unknown_parameters"} 0 0 0
1488 0 ▶ $self->{expand} = '' unless( length( $self->{expand} ) );
Branch: 1 branch
BranchTrueFalseTotal
unless length $self->{"expand"} 0 0 0
1489 # Json configuration file
1490 0 $self->{conf_file} = '';
1491 0 $self->{conf_data} = {};
1492 0 $self->{_exception_class} = $EXCEPTION_CLASS;
1493 0 ▶ $self->SUPER::init( @_ ) || return( $self->pass_error );
Branch: 1 branch
BranchTrueFalseTotal
$self->SUPER::init(@_) or return $self->pass_error 0 0 0
1494 0 ▶ if( $self->{conf_file} )
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"conf_file"}) 0 0 0
1495 {
1496 0 my $json = $self->{conf_data};
1497 0 ▶ $self->{livemode} = $json->{livemode} if( CORE::length( $json->{livemode} ) && !CORE::length( $self->{livemode} ) );
Branch: 1 branch
BranchTrueFalseTotal
if length $json->{"livemode"} and not length $self->{"livemode"} 0 0 0
Condition0%0/3
length $json->{"livemode"} and not length $self->{"livemode"}
!ll&&!rl&&r
000
MC/DC0%0/2
length $json->{"livemode"} and not length $self->{"livemode"}
length $json->{"livemode"} not length $self->{"livemode"}
Truth table0%0/3
A and not(B)
A= length $json->{"livemode"}B= not length $self->{"livemode"}
ABresult
0X0
100
111
1498 0 ▶ if( !$self->{key} )
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->{"key"}) 0 0 0
1499 {
1500 0 ▶ $self->{key} = $self->{livemode} ? $json->{live_secret_key} : $json->{test_secret_key};
Branch: 1 branch
BranchTrueFalseTotal
$self->{'livemode'} ? : 0 0 0
1501 }
1502 0 for( qw( browser cookie_file temp_dir version ) )
1503 {
1504 0 ▶ $self->{ $_ } = $json->{ $_ } if( !$self->{ $_ } && length( $json->{ $_ } ) );
Branch: 1 branch
BranchTrueFalseTotal
if not $self->{$_} and length $json->{$_} 0 0 0
Condition0%0/3
not $self->{$_} and length $json->{$_}
!ll&&!rl&&r
000
MC/DC0%0/2
not $self->{$_} and length $json->{$_}
not $self->{$_} length $json->{$_}
Truth table0%0/3
not(A) and B
A= not $self->{$_}B= length $json->{$_}
ABresult
0X0
100
111
1505 }
1506 }
1507 0 $self->{stripe_error} = '';
1508 0 $self->{http_response} = '';
1509 0 $self->{http_request} = '';
1510 0 ▶ CORE::return( $self->error( "No Stripe API private key was provided!" ) ) if( !$self->{key} );
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"key"} 0 0 0
1511 0 ▶ CORE::return( $self->error( "No Stripe api version was specified. I was expecting something like ''." ) ) if( !$self->{version} );
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"version"} 0 0 0
1512 0 $self->key( $self->{key} );
1513 0 ▶ $self->livemode( $self->{key} =~ /_live/ ? 1 : 0 );
Branch: 1 branch
BranchTrueFalseTotal
$self->{'key'} =~ /_live/ ? : 0 0 0
1514 0 CORE::return( $self );
1515 }
1516  
1517 # NOTE: core method
1518 sub api_uri
1519 0 ▶{
Subroutine api_uri: not called CC=5 SCAR=34.0
Pod documented
1520 0 my $self = shift( @_ );
1521 0 ▶ if( @_ )
Branch: 1 branch
BranchTrueFalseTotal
if (@_) 0 0 0
1522 {
1523 0 my $url = shift( @_ );
1524 0 local $@;
1525 # try-catch
1526 eval
1527 0 {
1528 0 $self->{api_uri} = URI->new( $url );
1529 };
1530 0 ▶ if( $@ )
Branch: 1 branch
BranchTrueFalseTotal
if ($@) 0 0 0
1531 {
1532 0 CORE::return( $self->error( "Bad URI ($url) provided for base Stripe api: $@" ) );
1533 }
1534 }
1535 0 ▶ CORE::return( $self->{api_uri}->clone ) if( Scalar::Util::blessed( $self->{api_uri} ) && $self->{api_uri}->isa( 'URI' ) );
Branch: 1 branch
BranchTrueFalseTotal
if builtin::blessed($self->{"api_uri"}) and $self->{"api_uri"}->isa("URI") 0 0 0
Condition0%0/3
builtin::blessed($self->{"api_uri"}) and $self->{"api_uri"}->isa("URI")
!ll&&!rl&&r
000
MC/DC0%0/2
builtin::blessed($self->{"api_uri"}) and $self->{"api_uri"}->isa("URI")
builtin::blessed($self->{"api_uri"}) $self->{"api_uri"}->isa("URI")
Truth table0%0/3
A and B
A= builtin::blessed($self->{"api_uri"})B= $self->{"api_uri"}->isa("URI")
ABresult
0X0
100
111
1536 0 CORE::return( $self->{api_uri} );
1537 }
1538  
1539 # NOTE: core method
1540 0 ▶sub auth { CORE::return( shift->_set_get_scalar( 'auth', @_ ) ); }
Subroutine auth: not called CC=1 SCAR=6.9
Pod undocumented
1541  
1542 # NOTE: core method
1543 0 ▶sub browser { CORE::return( shift->_set_get_scalar( 'browser', @_ ) ); }
Subroutine browser: not called CC=1 SCAR=6.9
Pod documented
1544  
1545 # NOTE: core method
1546 sub code2error
1547 0 ▶{
Subroutine code2error: not called CC=3 SCAR=24.8
Pod documented
1548 0 my $self = shift( @_ );
1549 0 ▶ my $code = shift( @_ ) || CORE::return( $self->error( "No code was provided to get the related error" ) );
Condition0%0/2
shift @_ || (return $self->error('No code was provided to get the related error'))
l!l
00
MC/DC0%0/1
shift @_ || (return $self->error('No code was provided to get the related error'))
shift @_
Truth table0%0/2
A
A= shift @_
Aresult
11
00
1550 0 ▶ CORE::return( $self->error( "No code found for $code" ) ) if( !exists( $ERROR_CODE_TO_STRING->{ $code } ) );
Branch: 1 branch
BranchTrueFalseTotal
unless exists $Net::API::Stripe::ERROR_CODE_TO_STRING->{$code} 0 0 0
1551 0 CORE::return( $ERROR_CODE_TO_STRING->{ $code } );
1552 }
1553  
1554 # sub connect { CORE::return( shift->_instantiate( 'connect', 'Net::API::Stripe::Connect' ) ) }
1555 # NOTE: core method
1556 sub conf_file
1557 0 ▶{
Subroutine conf_file: not called CC=6 SCAR=37.4
Pod documented
1558 0 my $self = shift( @_ );
1559 0 ▶ if( @_ )
Branch: 1 branch
BranchTrueFalseTotal
if (@_) 0 0 0
1560 {
1561 0 my $file = shift( @_ );
1562 0 my $f = Module::Generic::File::file( $file );
1563 0 ▶ if( !$f->exists )
Branch: 2 branches
BranchTrueFalseTotal
if (not $f->exists) { } 0 0 0
elsif ($f->is_empty) { } 0 0 0
1564 {
1565 0 CORE::return( $self->error( "Configuration file $file does not exist." ) );
1566 }
1567 elsif( $f->is_empty )
1568 {
1569 0 CORE::return( $self->error( "Configuration file $file is empty." ) );
1570 }
1571 0 ▶ my $data = $f->load_utf8 ||
Condition0%0/2
$f->load_utf8 || (return $self->error("Unable to open configuration file ${file}: ", $f->error))
l!l
00
MC/DC0%0/1
$f->load_utf8 || (return $self->error("Unable to open configuration file ${file}: ", $f->error))
$f->load_utf8
Truth table0%0/2
A
A= $f->load_utf8
Aresult
11
00
1572 CORE::return( $self->error( "Unable to open configuration file $file: ", $f->error ) );
1573 0 local $@;
1574 # try-catch
1575 eval
1576 0 {
1577 0 my $json = JSON->new->relaxed->decode( $data );
1578 0 $self->{conf_data} = $json;
1579 0 $self->{conf_file} = $file;
1580 };
1581 0 ▶ if( $@ )
Branch: 1 branch
BranchTrueFalseTotal
if ($@) 0 0 0
1582 {
1583 0 CORE::return( $self->error( "An error occured while json decoding configuration file $file: $@" ) );
1584 }
1585 }
1586 0 CORE::return( $self->{conf_data} );
1587 }
1588  
1589 # NOTE: core method
1590 0 ▶sub cookie_file { CORE::return( shift->_set_get_file( 'cookie_file', @_ ) ); }
Subroutine cookie_file: not called CC=1 SCAR=6.9
Pod undocumented
1591  
1592 # NOTE: core method
1593 sub currency
1594 0 ▶{
Subroutine currency: not called CC=2 SCAR=17.9
Pod documented
1595 0 my $self = shift( @_ );
1596 0 ▶ if( @_ )
Branch: 1 branch
BranchTrueFalseTotal
if (@_) 0 0 0
1597 {
1598 0 $self->_set_get( 'currency', lc( shift( @_ ) ) );
1599 }
1600 0 CORE::return( $self->{ 'currency' } );
1601 }
1602  
1603 # NOTE: core method
1604 sub delete
1605 0 ▶{
Subroutine delete: not called CC=9 SCAR=45.0
Pod documented
1606 0 my $self = shift( @_ );
1607 0 ▶ my $path = shift( @_ ) || CORE::return( $self->error( "No api endpoint (path) was provided." ) );
Condition0%0/2
shift @_ || (return $self->error('No api endpoint (path) was provided.'))
l!l
00
MC/DC0%0/1
shift @_ || (return $self->error('No api endpoint (path) was provided.'))
shift @_
Truth table0%0/2
A
A= shift @_
Aresult
11
00
1608 0 my $args = shift( @_ );
1609 0 ▶ CORE::return( $self->error( "http query parameters provided were not a hash reference." ) ) if( $args && ref( $args ) ne 'HASH' );
Branch: 1 branch
BranchTrueFalseTotal
if $args and ref $args ne "HASH" 0 0 0
Condition0%0/3
$args and ref $args ne "HASH"
!ll&&!rl&&r
000
MC/DC0%0/2
$args and ref $args ne "HASH"
$args ref $args ne "HASH"
Truth table0%0/3
A and B
A= $argsB= ref $args ne "HASH"
ABresult
0X0
100
111
1610 0 my $api = $self->api_uri->clone;
1611 0 ▶ if( $self->_is_object( $path ) && $path->can( 'path' ) )
Branch: 1 branch
BranchTrueFalseTotal
if ($self->_is_object($path) and $path->can('path')) { } 0 0 0
Condition0%0/3
$self->_is_object($path) and $path->can("path")
!ll&&!rl&&r
000
MC/DC0%0/2
$self->_is_object($path) and $path->can("path")
$self->_is_object($path) $path->can("path")
Truth table0%0/3
A and B
A= $self->_is_object($path)B= $path->can("path")
ABresult
0X0
100
111
1612 {
1613 0 $api->path( undef() );
1614 0 $path = $path->path;
1615 }
1616 else
1617 {
1618 0 ▶ substr( $path, 0, 0 ) = '/' unless( substr( $path, 0, 1 ) eq '/' );
Branch: 1 branch
BranchTrueFalseTotal
unless substr($path, 0, 1) eq "/" 0 0 0
1619 }
1620 0 ▶ $path .= '?' . $self->_encode_params( $args ) if( $args && %$args );
Branch: 1 branch
BranchTrueFalseTotal
if $args and %$args 0 0 0
Condition0%0/3
$args and %$args
!ll&&!rl&&r
000
MC/DC0%0/2
$args and %$args
$args %$args
Truth table0%0/3
A and B
A= $argsB= %$args
ABresult
0X0
100
111
1621 0 my $req = HTTP::Promise::Request->new( 'DELETE', $api . $path );
1622 0 CORE::return( $self->_make_request( $req ) );
1623 }
1624  
1625 # NOTE: core method
1626 0 ▶sub encode_with_json { CORE::return( shift->_set_get( 'encode_with_json', @_ ) ); }
Subroutine encode_with_json: not called CC=1 SCAR=6.9
Pod documented
1627  
1628 # NOTE: core method
1629 # Can be 'all' or an integer representing a depth
1630 0 ▶sub expand { CORE::return( shift->_set_get_scalar( 'expand', @_ ) ); }
Subroutine expand: not called CC=1 SCAR=6.9
Pod documented
1631  
1632 # NOTE: core method
1633 sub fields
1634 0 ▶{
Subroutine fields: not called CC=4 SCAR=26.4
Pod documented
1635 0 my $self = shift( @_ );
1636 0 ▶ my $type = shift( @_ ) || CORE::return( $self->error( "No object type was provided to get its list of methods." ) );
Condition0%0/2
shift @_ || (return $self->error('No object type was provided to get its list of methods.'))
l!l
00
MC/DC0%0/1
shift @_ || (return $self->error('No object type was provided to get its list of methods.'))
shift @_
Truth table0%0/2
A
A= shift @_
Aresult
11
00
1637 0 my $class;
1638 0 ▶ if( $class = $self->_is_object( $type ) )
Branch: 1 branch
BranchTrueFalseTotal
if ($class = $self->_is_object($type)) { } 0 0 0
1639 {
1640 }
1641 else
1642 {
1643 0 $class = $self->_object_type_to_class( $type );
1644 }
1645 1 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
1646 0 ▶ if( !$self->_is_class_loaded( $class ) )
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->_is_class_loaded($class)) 0 0 0
1647 {
1648 0 $self->_load_class( $class );
1649 }
1650 0 my @methods = grep{ defined &{"${class}::$_"} } keys( %{"${class}::"} );
1651 0 CORE::return( \@methods );
1652 }
1653  
1654 # NOTE: core method
1655 sub file_api_uri
1656 0 ▶{
Subroutine file_api_uri: not called CC=5 SCAR=34.0
Pod undocumented
1657 0 my $self = shift( @_ );
1658 0 ▶ if( @_ )
Branch: 1 branch
BranchTrueFalseTotal
if (@_) 0 0 0
1659 {
1660 0 my $url = shift( @_ );
1661 0 local $@;
1662 # try-catch
1663 eval
1664 0 {
1665 0 $self->{file_api_uri} = URI->new( $url );
1666 };
1667 0 ▶ if( $@ )
Branch: 1 branch
BranchTrueFalseTotal
if ($@) 0 0 0
1668 {
1669 0 CORE::return( $self->error( "Bad URI ($url) provided for base files Stripe api: $@" ) );
1670 }
1671 }
1672 0 ▶ CORE::return( $self->{file_api_uri}->clone ) if( Scalar::Util::blessed( $self->{file_api_uri} ) && $self->{file_api_uri}->isa( 'URI' ) );
Branch: 1 branch
BranchTrueFalseTotal
if builtin::blessed($self->{"file_api_uri"}) and $self->{"file_api_uri"}->isa("URI") 0 0 0
Condition0%0/3
builtin::blessed($self->{"file_api_uri"}) and $self->{"file_api_uri"}->isa("URI")
!ll&&!rl&&r
000
MC/DC0%0/2
builtin::blessed($self->{"file_api_uri"}) and $self->{"file_api_uri"}->isa("URI")
builtin::blessed($self->{"file_api_uri"}) $self->{"file_api_uri"}->isa("URI")
Truth table0%0/3
A and B
A= builtin::blessed($self->{"file_api_uri"})B= $self->{"file_api_uri"}->isa("URI")
ABresult
0X0
100
111
1673 0 CORE::return( $self->{file_api_uri} );
1674 }
1675  
1676 # NOTE: core method
1677 sub generate_uuid
1678 0 ▶{
Subroutine generate_uuid: not called CC=1 SCAR=6.9
Pod documented
1679 0 CORE::return( Data::UUID->new->create_str );
1680 }
1681  
1682 # NOTE: core method
1683 sub get
1684 0 ▶{
Subroutine get: not called CC=18 SCAR=58.3
Pod documented
1685 0 my $self = shift( @_ );
1686 0 ▶ my $path = shift( @_ ) || CORE::return( $self->error( "No api endpoint (path) was provided." ) );
Condition0%0/2
shift @_ || (return $self->error('No api endpoint (path) was provided.'))
l!l
00
MC/DC0%0/1
shift @_ || (return $self->error('No api endpoint (path) was provided.'))
shift @_
Truth table0%0/2
A
A= shift @_
Aresult
11
00
1687 0 my $args = shift( @_ );
1688 0 ▶ CORE::return( $self->error( "http query parameters provided were not a hash reference." ) ) if( $args && ref( $args ) ne 'HASH' );
Branch: 1 branch
BranchTrueFalseTotal
if $args and ref $args ne "HASH" 0 0 0
Condition0%0/3
$args and ref $args ne "HASH"
!ll&&!rl&&r
000
MC/DC0%0/2
$args and ref $args ne "HASH"
$args ref $args ne "HASH"
Truth table0%0/3
A and B
A= $argsB= ref $args ne "HASH"
ABresult
0X0
100
111
1689 0 my $expand = $self->expand;
1690 0 ▶ if( ( !exists( $args->{expand} ) &&
Branch: 1 branch
BranchTrueFalseTotal
if (not exists $args->{"expand"} and $expand eq "all" || $expand =~ /^\d+$/ && $expand > 2 or exists $args->{"expand"} and $args->{"expand"} eq "all" || $args->{"expand"} =~ /^\d+$/ && $args->{"expand"} > 2) 0 0 0
Condition0%0/21
not exists $args->{"expand"} and $expand eq "all" || $expand =~ /^\d+$/ && $expand > 2 or exists $args->{"expand"} and $args->{"expand"} eq "all" || $args->{"expand"} =~ /^\d+$/ && $args->{"expand"} > 2
l!l&&r!l&&!r
000
not exists $args->{"expand"} and $expand eq "all" || $expand =~ /^\d+$/ && $expand > 2
!ll&&!rl&&r
000
$expand eq "all" or $expand =~ /^\d+$/ and $expand > 2
l!l&&r!l&&!r
000
$expand =~ /^\d+$/ and $expand > 2
!ll&&!rl&&r
000
exists $args->{"expand"} and $args->{"expand"} eq "all" || $args->{"expand"} =~ /^\d+$/ && $args->{"expand"} > 2
!ll&&!rl&&r
000
$args->{"expand"} eq "all" or $args->{"expand"} =~ /^\d+$/ and $args->{"expand"} > 2
l!l&&r!l&&!r
000
$args->{"expand"} =~ /^\d+$/ and $args->{"expand"} > 2
!ll&&!rl&&r
000
MC/DC0%0/8
not exists $args->{"expand"} and $expand eq "all" || $expand =~ /^\d+$/ && $expand > 2 or exists $args->{"expand"} and $args->{"expand"} eq "all" || $args->{"expand"} =~ /^\d+$/ && $args->{"expand"} > 2
not exists $args->{"expand"} $expand eq "all" $expand =~ /^\d+$/ $expand > 2 exists $args->{"expand"} $args->{"expand"} eq "all" $args->{"expand"} =~ /^\d+$/ $args->{"expand"} > 2
Truth table0%0/17
not(A) and B or C and D or E and F or G and H
A= not exists $args->{"expand"}B= $expand eq "all"C= $expand =~ /^\d+$/D= $expand > 2E= exists $args->{"expand"}F= $args->{"expand"} eq "all"G= $args->{"expand"} =~ /^\d+$/H= $args->{"expand"} > 2
ABCDEFGHresult
11XXXXXX1
1011XXXX1
0XXX11XX1
0XXX10111
100X11XX1
100X10111
101011XX1
101010111
0XXX0XXX0
0XXX100X0
0XXX10100
100X0XXX0
100X100X0
100X10100
10100XXX0
1010100X0
101010100
1691 (
1692 $expand eq 'all' ||
1693 ( $expand =~ /^\d+$/ && $expand > 2 )
1694 )
1695 )
1696 ||
1697 (
1698 exists( $args->{expand} ) &&
1699 (
1700 $args->{expand} eq 'all' ||
1701 ( $args->{expand} =~ /^\d+$/ && $args->{expand} > 2 )
1702 )
1703 ) )
1704 {
1705 # Because anything more will likely trigger URI too long
1706 0 $args->{expand} = 2;
1707 }
1708 0 ▶ my $api = CORE::exists( $args->{_file_api} ) ? $self->file_api_uri->clone : $self->api_uri->clone;
Branch: 1 branch
BranchTrueFalseTotal
exists $args->{'_file_api'} ? : 0 0 0
1709 0 ▶ if( $self->_is_object( $path ) && $path->can( 'path' ) )
Branch: 1 branch
BranchTrueFalseTotal
if ($self->_is_object($path) and $path->can('path')) { } 0 0 0
Condition0%0/3
$self->_is_object($path) and $path->can("path")
!ll&&!rl&&r
000
MC/DC0%0/2
$self->_is_object($path) and $path->can("path")
$self->_is_object($path) $path->can("path")
Truth table0%0/3
A and B
A= $self->_is_object($path)B= $path->can("path")
ABresult
0X0
100
111
1710 {
1711 0 $api->path( undef() );
1712 0 $path = $path->path;
1713 }
1714 else
1715 {
1716 0 ▶ substr( $path, 0, 0 ) = '/' unless( substr( $path, 0, 1 ) eq '/' );
Branch: 1 branch
BranchTrueFalseTotal
unless substr($path, 0, 1) eq "/" 0 0 0
1717 }
1718 0 ▶ $path .= '?' . $self->_encode_params( $args ) if( $args && %$args );
Branch: 1 branch
BranchTrueFalseTotal
if $args and %$args 0 0 0
Condition0%0/3
$args and %$args
!ll&&!rl&&r
000
MC/DC0%0/2
$args and %$args
$args %$args
Truth table0%0/3
A and B
A= $argsB= %$args
ABresult
0X0
100
111
1719 0 my $req = HTTP::Promise::Request->new( 'GET', $api . $path );
1720 0 CORE::return( $self->_make_request( $req ) );
1721 }
1722  
1723 # NOTE: core method
1724 sub http_client
1725 0 ▶{
Subroutine http_client: not called CC=7 SCAR=40.3
Pod documented
1726 0 my $self = shift( @_ );
1727 0 ▶ CORE::return( $self->{ua} ) if( $self->{ua} );
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"ua"} 0 0 0
1728 0 my $cookie_file = $self->cookie_file;
1729 0 my $browser = $self->browser;
1730 # To be safe and ensure this works everywhere, we use the 'file' medium as shared data space
1731 0 ▶ my $ua = HTTP::Promise->new(
Branch: 1 branch
BranchTrueFalseTotal
$self->debug > 3 ? : 0 0 0
1732 # medium => 'file',
1733 timeout => 5,
1734 use_promise => 0,
1735 ( $self->debug > 3 ? ( debug => $self->debug ) : () ),
1736 );
1737 0 ▶ if( defined( $browser ) &&
Branch: 1 branch
BranchTrueFalseTotal
if (defined $browser and length $browser) 0 0 0
Condition0%0/3
defined $browser and length $browser
!ll&&!rl&&r
000
MC/DC0%0/2
defined $browser and length $browser
defined $browser length $browser
Truth table0%0/3
A and B
A= defined $browserB= length $browser
ABresult
0X0
100
111
1738 length( $browser ) )
1739 {
1740 0 $ua->agent( $browser );
1741 }
1742 0 ▶ if( defined( $cookie_file ) &&
Branch: 1 branch
BranchTrueFalseTotal
if (defined $cookie_file and length $cookie_file) 0 0 0
Condition0%0/3
defined $cookie_file and length $cookie_file
!ll&&!rl&&r
000
MC/DC0%0/2
defined $cookie_file and length $cookie_file
defined $cookie_file length $cookie_file
Truth table0%0/3
A and B
A= defined $cookie_fileB= length $cookie_file
ABresult
0X0
100
111
1743 length( $cookie_file ) )
1744 {
1745 0 my $jar = Cookie::Jar->new( file => $cookie_file );
1746 0 $ua->cookie_jar( $jar );
1747 }
1748 0 $self->{ua} = $ua;
1749 0 CORE::return( $ua );
1750 }
1751  
1752 # NOTE: core method
1753 0 ▶sub http_request { CORE::return( shift->_set_get_object( 'http_request', 'HTTP::Promise::Request', @_ ) ); }
Subroutine http_request: not called CC=1 SCAR=6.9
Pod documented
1754  
1755 # NOTE: core method
1756 0 ▶sub http_response { CORE::return( shift->_set_get_object( 'http_response', 'HTTP::Promise::Response', @_ ) ); }
Subroutine http_response: not called CC=1 SCAR=6.9
Pod documented
1757  
1758 # NOTE: core method
1759 0 ▶sub ignore_unknown_parameters { CORE::return( shift->_set_get_boolean( 'ignore_unknown_parameters', @_ ) ); }
Subroutine ignore_unknown_parameters: not called CC=1 SCAR=6.9
Pod documented
1760  
1761 # NOTE: core method
1762 0 ▶sub json { CORE::return( JSON->new->allow_nonref->allow_blessed->convert_blessed->relaxed ); }
Subroutine json: not called CC=1 SCAR=6.9
Pod documented
1763  
1764 # NOTE: core method
1765 sub key
1766 0 ▶{
Subroutine key: not called CC=2 SCAR=17.9
Pod documented
1767 0 my $self = shift( @_ );
1768 0 ▶ if( @_ )
Branch: 1 branch
BranchTrueFalseTotal
if (@_) 0 0 0
1769 {
1770 0 my $key = $self->{key} = shift( @_ );
1771 0 my $auth = 'Basic ' . MIME::Base64::encode_base64( $key . ':' );
1772 0 $self->auth( $auth );
1773 }
1774 0 CORE::return( $self->{key} );
1775 }
1776  
1777 # NOTE: core method
1778 0 ▶sub livemode { CORE::return( shift->_set_get_boolean( 'livemode', @_ ) ); }
Subroutine livemode: not called CC=1 SCAR=6.9
Pod documented
1779  
1780 # NOTE: core method
1781 sub post
1782 0 ▶{
Subroutine post: not called CC=10 SCAR=47.0
Pod documented
1783 0 my $self = shift( @_ );
1784 0 ▶ my $path = shift( @_ ) || CORE::return( $self->error( "No api endpoint (path) was provided." ) );
Condition0%0/2
shift @_ || (return $self->error('No api endpoint (path) was provided.'))
l!l
00
MC/DC0%0/1
shift @_ || (return $self->error('No api endpoint (path) was provided.'))
shift @_
Truth table0%0/2
A
A= shift @_
Aresult
11
00
1785 0 my $args = shift( @_ );
1786 0 ▶ CORE::return( $self->error( "http query parameters provided were not a hash reference." ) ) if( $args && ref( $args ) ne 'HASH' );
Branch: 1 branch
BranchTrueFalseTotal
if $args and ref $args ne "HASH" 0 0 0
Condition0%0/3
$args and ref $args ne "HASH"
!ll&&!rl&&r
000
MC/DC0%0/2
$args and ref $args ne "HASH"
$args ref $args ne "HASH"
Truth table0%0/3
A and B
A= $argsB= ref $args ne "HASH"
ABresult
0X0
100
111
1787 0 my $api = $self->api_uri->clone;
1788 0 ▶ if( $self->_is_object( $path ) && $path->can( 'path' ) )
Branch: 1 branch
BranchTrueFalseTotal
if ($self->_is_object($path) and $path->can('path')) { } 0 0 0
Condition0%0/3
$self->_is_object($path) and $path->can("path")
!ll&&!rl&&r
000
MC/DC0%0/2
$self->_is_object($path) and $path->can("path")
$self->_is_object($path) $path->can("path")
Truth table0%0/3
A and B
A= $self->_is_object($path)B= $path->can("path")
ABresult
0X0
100
111
1789 {
1790 0 $api->path( undef() );
1791 0 $path = $path->path;
1792 }
1793 else
1794 {
1795 0 ▶ substr( $path, 0, 0 ) = '/' unless( substr( $path, 0, 1 ) eq '/' );
Branch: 1 branch
BranchTrueFalseTotal
unless substr($path, 0, 1) eq "/" 0 0 0
1796 }
1797 # my $ref = $self->_encode_params( $args );
1798 # $self->message( 3, $self->dump( $ref ) ); exit;
1799 0 my $h = [];
1800 0 ▶ if( exists( $args->{idempotency} ) )
Branch: 1 branch
BranchTrueFalseTotal
if (exists $args->{"idempotency"}) 0 0 0
1801 {
1802 0 ▶ $args->{idempotency} = $self->generate_uuid if( !length( $args->{idempotency} ) );
Branch: 1 branch
BranchTrueFalseTotal
unless length $args->{"idempotency"} 0 0 0
1803 0 push( @$h, 'Idempotency-Key', CORE::delete( $args->{idempotency} ) );
1804 }
1805 0 ▶ my $req = HTTP::Promise::Request->new(
Branch: 1 branch
BranchTrueFalseTotal
$args ? : 0 0 0
1806 'POST', $api . $path,
1807 $h,
1808 ( $args ? $self->_encode_params( $args ) : undef() )
1809 );
1810 0 CORE::return( $self->_make_request( $req ) );
1811 }
1812  
1813 # NOTE: core method
1814 # Using rfc2388 rules
1815 # https://tools.ietf.org/html/rfc2388
1816 sub post_multipart
1817 0 ▶{
Subroutine post_multipart: not called CC=17 SCAR=57.2
Pod documented
1818 0 my $self = shift( @_ );
1819 0 ▶ my $path = shift( @_ ) || CORE::return( $self->error( "No api endpoint (path) was provided." ) );
Condition0%0/2
shift @_ || (return $self->error('No api endpoint (path) was provided.'))
l!l
00
MC/DC0%0/1
shift @_ || (return $self->error('No api endpoint (path) was provided.'))
shift @_
Truth table0%0/2
A
A= shift @_
Aresult
11
00
1820 0 my $args = shift( @_ );
1821 0 ▶ CORE::return( $self->error( "http query parameters provided were not a hash reference." ) ) if( $args && ref( $args ) ne 'HASH' );
Branch: 1 branch
BranchTrueFalseTotal
if $args and ref $args ne "HASH" 0 0 0
Condition0%0/3
$args and ref $args ne "HASH"
!ll&&!rl&&r
000
MC/DC0%0/2
$args and ref $args ne "HASH"
$args ref $args ne "HASH"
Truth table0%0/3
A and B
A= $argsB= ref $args ne "HASH"
ABresult
0X0
100
111
1822 0 my $api = $self->api_uri->clone;
1823 0 ▶ if( $self->_is_object( $path ) && $path->can( 'path' ) )
Branch: 1 branch
BranchTrueFalseTotal
if ($self->_is_object($path) and $path->can('path')) { } 0 0 0
Condition0%0/3
$self->_is_object($path) and $path->can("path")
!ll&&!rl&&r
000
MC/DC0%0/2
$self->_is_object($path) and $path->can("path")
$self->_is_object($path) $path->can("path")
Truth table0%0/3
A and B
A= $self->_is_object($path)B= $path->can("path")
ABresult
0X0
100
111
1824 {
1825 0 $api->path( undef() );
1826 0 $path = $path->path;
1827 }
1828 else
1829 {
1830 0 ▶ substr( $path, 0, 0 ) = '/' unless( substr( $path, 0, 1 ) eq '/' );
Branch: 1 branch
BranchTrueFalseTotal
unless substr($path, 0, 1) eq "/" 0 0 0
1831 }
1832 0 my $h = HTTP::Promise::Headers->new(
1833 Content_Type => 'multipart/form-data',
1834 );
1835 0 ▶ if( exists( $args->{idempotency} ) )
Branch: 1 branch
BranchTrueFalseTotal
if (exists $args->{"idempotency"}) 0 0 0
1836 {
1837 0 ▶ $args->{idempotency} = $self->generate_uuid if( !length( $args->{idempotency} ) );
Branch: 1 branch
BranchTrueFalseTotal
unless length $args->{"idempotency"} 0 0 0
1838 0 $h->header( 'Idempotency-Key' => CORE::delete( $args->{idempotency} ) );
1839 }
1840 0 my $req = HTTP::Promise::Request->new( POST => $api . $path, $h );
1841 0 my $data = $self->_encode_params_multipart( $args, { encoding => 'quoted-printable' } );
1842 0 foreach my $f ( keys( %$data ) )
1843 {
1844 0 foreach my $ref ( @{$data->{ $f }} )
1845 {
1846 0 ▶ if( $ref->{filename} )
Branch: 1 branch
BranchTrueFalseTotal
if ($ref->{'filename'}) { } 0 0 0
1847 {
1848 0 my $fname = $ref->{filename};
1849 $req->add_part( HTTP::Promise::Message->new(
1850 HTTP::Promise::Headers->new(
1851 Content_Disposition => "form-data; name=\"${f}\"; filename=\"${fname}\"",
1852 Content_Type => ( $ref->{type} ? $ref->{type} : 'application/octet-stream' ),
1853 ( $ref->{encoding} ? ( Content_Transfer_Encoding => $ref->{encoding} ) : undef() ),
1854 Content_Length => CORE::length( $ref->{value} ),
1855 ),
1856 $ref->{value}
1857 0 ▶ ));
Branch: 2 branches
BranchTrueFalseTotal
$ref->{'type'} ? : 0 0 0
$ref->{'encoding'} ? : 0 0 0
1858 }
1859 else
1860 {
1861 0 ▶ $ref->{type} ||= 'text/plain';
Condition0%0/2
$ref->{"type"} ||= "text/plain"
l!l
00
MC/DC0%0/1
$ref->{"type"} ||= "text/plain"
$ref->{"type"}
Truth table0%0/2
A
A= $ref->{"type"}
Aresult
11
00
1862 $req->add_part( HTTP::Promise::Message->new(
1863 HTTP::Promise::Headers->new(
1864 Content_Disposition => "form-data; name=\"${f}\"",
1865 Content_Type => ( $ref->{type} eq 'text/plain' ? 'text/plain;charset="utf-8"' : $ref->{type} ),
1866 Content_Length => CORE::length( $ref->{value} ),
1867 Content_Transfer_Encoding => ( $ref->{encoding} ? $ref->{encoding} : '8bit' ),
1868 ),
1869 $ref->{value}
1870 0 ▶ ));
Branch: 2 branches
BranchTrueFalseTotal
$ref->{'type'} eq 'text/plain' ? : 0 0 0
$ref->{'encoding'} ? : 0 0 0
1871 }
1872 }
1873 }
1874 0 CORE::return( $self->_make_request( $req ) );
1875 }
1876  
1877 # NOTE: core method
1878 0 ▶sub version { CORE::return( shift->_set_get_scalar( 'version', @_ ) ); }
Subroutine version: not called CC=1 SCAR=6.9
Pod documented
1879  
1880 # NOTE: core method
1881 sub webhook_validate_signature
1882 0 ▶{
Subroutine webhook_validate_signature: not called CC=20 SCAR=60.4
Pod undocumented
1883 0 my $self = shift( @_ );
1884 0 my $opts = {};
1885 0 ▶ $opts = shift( @_ ) if( @_ && ref( $_[0] ) eq 'HASH' );
Branch: 1 branch
BranchTrueFalseTotal
if @_ and ref $_[0] eq "HASH" 0 0 0
Condition0%0/3
@_ and ref $_[0] eq "HASH"
!ll&&!rl&&r
000
MC/DC0%0/2
@_ and ref $_[0] eq "HASH"
@_ ref $_[0] eq "HASH"
Truth table0%0/3
A and B
A= @_B= ref $_[0] eq "HASH"
ABresult
0X0
100
111
1886 0 ▶ CORE::return( $self->error( "No webhook secret was provided." ) ) if( !$opts->{secret} );
Branch: 1 branch
BranchTrueFalseTotal
unless $opts->{"secret"} 0 0 0
1887 0 ▶ CORE::return( $self->error( "No Stripe signature was provided." ) ) if( !$opts->{signature} );
Branch: 1 branch
BranchTrueFalseTotal
unless $opts->{"signature"} 0 0 0
1888 0 ▶ CORE::return( $self->error( "No payload was provided." ) ) if( !CORE::length( $opts->{payload} ) );
Branch: 1 branch
BranchTrueFalseTotal
unless length $opts->{"payload"} 0 0 0
1889 # 5 minutes
1890 0 ▶ $opts->{time_tolerance} ||= ( 5 * 60 );
Condition0%0/2
$opts->{"time_tolerance"} ||= 300
l!l
00
MC/DC0%0/1
$opts->{"time_tolerance"} ||= 300
$opts->{"time_tolerance"}
Truth table0%0/2
A
A= $opts->{"time_tolerance"}
Aresult
11
00
1891 0 my $sig = $opts->{signature};
1892 0 my $max_time_spread = $opts->{time_tolerance};
1893 0 my $signing_secret = $opts->{secret};
1894 0 my $payload = $opts->{payload};
1895 0 ▶ $payload = Encode::decode_utf8( $payload ) if( !Encode::is_utf8( $payload ) );
Branch: 1 branch
BranchTrueFalseTotal
unless &Encode::is_utf8($payload) 0 0 0
1896
1897 # Example:
1898 # Stripe-Signature: t=1492774577,
1899 # v1=5257a869e7ecebeda32affa62cdca3fa51cad7e77a0e56ff536d0ce8e108d8bd,
1900 # v0=6ffbb59b2300aae63f272406069a9788598b792a944a07aba816edb039989a39
1901 0 ▶ CORE::return( $self->error({ code => 400, message => "Event data received from Stripe is empty" }) ) if( !CORE::length( $sig ) );
Branch: 1 branch
BranchTrueFalseTotal
unless length $sig 0 0 0
1902 0 my @parts = split( /\,[[:blank:]]*/, $sig );
1903 0 my $q = {};
1904 0 for( @parts )
1905 {
1906 0 my( $n, $v ) = split( /[[:blank:]]*\=[[:blank:]]*/, $_, 2 );
1907 0 $q->{ $n } = $v;
1908 }
1909 0 ▶ CORE::return( $self->error({ code => 400, message => "No timestamp found in Stripe event data" }) ) if( !CORE::exists( $q->{t} ) );
Branch: 1 branch
BranchTrueFalseTotal
unless exists $q->{"t"} 0 0 0
1910 0 ▶ CORE::return( $self->error({ code => 400, message => "Timestamp is empty in Stripe event data received." }) ) if( !CORE::length( $q->{t} ) );
Branch: 1 branch
BranchTrueFalseTotal
unless length $q->{"t"} 0 0 0
1911 0 ▶ CORE::return( $self->error({ code => 400, message => "No signature found in Stripe event data" }) ) if( !CORE::exists( $q->{v1} ) );
Branch: 1 branch
BranchTrueFalseTotal
unless exists $q->{"v1"} 0 0 0
1912 0 ▶ CORE::return( $self->error({ code => 400, message => "Signature is empty in Stripe event data received." }) ) if( !CORE::length( $q->{v1} ) );
Branch: 1 branch
BranchTrueFalseTotal
unless length $q->{"v1"} 0 0 0
1913 # Must be a unix timestamp
1914 0 ▶ CORE::return( $self->error({ code => 400, message => "Invalid timestamp received in Stripe event data" }) ) if( $q->{t} !~ /^\d+$/ );
Branch: 1 branch
BranchTrueFalseTotal
unless $q->{"t"} =~ /^\d+$/ 0 0 0
1915 # Must be a hash hmac with sha256, e.g. 5257a869e7ecebeda32affa62cdca3fa51cad7e77a0e56ff536d0ce8e108d8bd
1916 0 ▶ CORE::return( $self->error({ code => 400, message => "Invalid signature received in Stripe event data" }) ) if( $q->{v1} !~ /^[a-z0-9]{64}$/ );
Branch: 1 branch
BranchTrueFalseTotal
unless $q->{"v1"} =~ /^[a-z0-9]{64}$/ 0 0 0
1917 0 my $dt;
1918 0 local $@;
1919 # try-catch
1920 eval
1921 0 {
1922 0 $dt = DateTime->from_epoch( epoch => $q->{t}, time_zone => 'local' );
1923 };
1924 0 ▶ if( $@ )
Branch: 1 branch
BranchTrueFalseTotal
if ($@) 0 0 0
1925 {
1926 0 CORE::return( $self->error({ code => 400, message => "Invalid timestamp ($q->{t}): $@" }) );
1927 }
1928
1929 # This needs to be in real utf8, ie NOT perl internal utf8
1930 0 my $signed_payload = Encode::encode_utf8( join( '.', $q->{t}, $payload ) );
1931 0 my $expect_sign = Digest::SHA::hmac_sha256_hex( $signed_payload, $signing_secret );
1932 0 ▶ CORE::return( $self->error({ code => 401, message => "Invalid signature." }) ) if( $expect_sign ne $q->{v1} );
Branch: 1 branch
BranchTrueFalseTotal
if $expect_sign ne $q->{"v1"} 0 0 0
1933 0 my $time_diff = time() - $q->{t};
1934 0 ▶ CORE::return( $self->error({ code => 400, message => "Bad timestamp ($q->{t}). It is set in the future: $dt" }) ) if( $time_diff < 0 );
Branch: 1 branch
BranchTrueFalseTotal
if $time_diff < 0 0 0 0
1935 0 ▶ CORE::return( $self->error({ code => 406, message => "Timestamp is too old." }) ) if( $time_diff >= $max_time_spread );
Branch: 1 branch
BranchTrueFalseTotal
if $time_diff >= $max_time_spread 0 0 0
1936 0 CORE::return( 1 );
1937 }
1938  
1939 # NOTE: core method
1940 # https://stripe.com/docs/ips
1941 sub webhook_validate_caller_ip
1942 0 ▶{
Subroutine webhook_validate_caller_ip: not called CC=10 SCAR=47.0
Pod undocumented
1943 0 my $self = shift( @_ );
1944 0 my $opts = {};
1945 0 ▶ $opts = shift( @_ ) if( @_ && ref( $_[0] ) eq 'HASH' );
Branch: 1 branch
BranchTrueFalseTotal
if @_ and ref $_[0] eq "HASH" 0 0 0
Condition0%0/3
@_ and ref $_[0] eq "HASH"
!ll&&!rl&&r
000
MC/DC0%0/2
@_ and ref $_[0] eq "HASH"
@_ ref $_[0] eq "HASH"
Truth table0%0/3
A and B
A= @_B= ref $_[0] eq "HASH"
ABresult
0X0
100
111
1946 0 ▶ CORE::return( $self->error({ code => 500, message => "No ip address was provided to check." }) ) if( !$opts->{ip} );
Branch: 1 branch
BranchTrueFalseTotal
unless $opts->{"ip"} 0 0 0
1947 0 my $err = [];
1948 0 my $ips = STRIPE_WEBHOOK_SOURCE_IP;
1949 my $ip = Net::IP->new( $opts->{ip} ) || do
1950 0 ▶ {
Condition0%0/3
'Net::IP'->new($opts->{'ip'}) || do { warn q[Warning only: IP '], $opts->{'ip'} // '', q[' is not valid: ], 'Net::IP'->Error, "\n"; push @$err, sprintf(q[IP '%s' is not valid: %s], $opts->{'ip'} // '', 'Net::IP'->Error); return '' }
l!l&&r!l&&!r
000
MC/DC0%0/2
'Net::IP'->new($opts->{'ip'}) || do { warn q[Warning only: IP '], $opts->{'ip'} // '', q[' is not valid: ], 'Net::IP'->Error, "\n"; push @$err, sprintf(q[IP '%s' is not valid: %s], $opts->{'ip'} // '', 'Net::IP'->Error); return '' }
'Net::IP'->new($opts->{'ip'}) do { warn q[Warning only: IP '], $opts->{'ip'} // '', q[' is not valid: ], 'Net::IP'->Error, "\n"; push @$err, sprintf(q[IP '%s' is not valid: %s], $opts->{'ip'} // '', 'Net::IP'->Error); return '' }
Truth table0%0/3
A || B
A= 'Net::IP'->new($opts->{'ip'})B= do { warn q[Warning only: IP '], $opts->{'ip'} // '', q[' is not valid: ], 'Net::IP'->Error, "\n"; push @$err, sprintf(q[IP '%s' is not valid: %s], $opts->{'ip'} // '', 'Net::IP'->Error); return '' }
ABresult
1X1
011
000
1951 0 ▶ warn( "Warning only: IP '", ( $opts->{ip} // '' ), "' is not valid: ", Net::IP->Error, "\n" );
Condition0%0/2
$opts->{"ip"} // ""
l!l
00
MC/DC0%0/1
$opts->{"ip"} // ""
$opts->{"ip"}
Truth table0%0/2
A
A= $opts->{"ip"}
Aresult
11
00
1952 0 ▶ push( @$err, sprintf( "IP '%s' is not valid: %s", ( $opts->{ip} // '' ), Net::IP->Error ) );
Condition0%0/2
$opts->{"ip"} // ""
l!l
00
MC/DC0%0/1
$opts->{"ip"} // ""
$opts->{"ip"}
Truth table0%0/2
A
A= $opts->{"ip"}
Aresult
11
00
1953 0 CORE::return( '' );
1954 };
1955 0 foreach my $stripe_ip ( @$ips )
1956 {
1957 0 my $stripe_ip_object = Net::IP->new( $stripe_ip );
1958 # We found an existing ip same as the one we are adding, so we skip
1959 # If we are given a block that has some overlapping elements, we go ahead and add it
1960 # because it would become complicated and risky to only take the ips that do not overalp in the given block
1961 0 ▶ if( !( $ip->overlaps( $stripe_ip_object ) == $Net::IP::IP_NO_OVERLAP ) )
Branch: 1 branch
BranchTrueFalseTotal
unless ($ip->overlaps($stripe_ip_object) == $Net::IP::IP_NO_OVERLAP) 0 0 0
1962 {
1963 0 CORE::return( $ip );
1964 }
1965 }
1966 0 ▶ if( $opts->{ignore_ip} )
Branch: 1 branch
BranchTrueFalseTotal
if ($opts->{'ignore_ip'}) { } 0 0 0
1967 {
1968 0 CORE::return( $ip );
1969 }
1970 else
1971 {
1972 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." }) );
1973 }
1974 }
1975  
1976 # NOTE: All methods below are auto-generated.
1977 sub _autoload_subs
1978 0 ▶{
Subroutine _autoload_subs: not called CC=1 SCAR=6.9
1979 0 $AUTOLOAD_SUBS =
1980 {
1981 # NOTE: account()
1982 account => <<'PERL',
1983 sub account { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Connect::Account', @_ ) ); }
1984 PERL
1985 # NOTE: account_bank_account()
1986 account_bank_account => <<'PERL',
1987 sub account_bank_account { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Connect::ExternalAccount::Bank', @_ ) ); }
1988 PERL
1989 # NOTE: account_bank_account_create()
1990 account_bank_account_create => <<'PERL',
1991 sub account_bank_account_create
1992 {
1993 my $self = shift( @_ );
1994 my $args = shift( @_ );
1995 my $okParams =
1996 {
1997 expandable => { allowed => $EXPANDABLES->{ 'account_bank_account' } },
1998 default_for_currency => { type => "boolean" },
1999 external_account => { type => "string", required => 1 },
2000 metadata => { type => "hash" },
2001 };
2002 $args = $self->_contract( 'account_bank_account', $args ) || CORE::return( $self->pass_error );
2003 my $err = $self->_check_parameters( $okParams, $args );
2004 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
2005 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No account id (with parameter 'id') was provided to create its information." ) );
2006 my $hash = $self->post( "accounts/${id}", $args ) || CORE::return( $self->pass_error );
2007 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Connect::ExternalAccount::Bank', $hash ) );
2008 }
2009 PERL
2010 # NOTE: account_bank_account_delete()
2011 account_bank_account_delete => <<'PERL',
2012 sub account_bank_account_delete
2013 {
2014 my $self = shift( @_ );
2015 my $args = shift( @_ );
2016 my $okParams =
2017 {
2018 expandable => { allowed => $EXPANDABLES->{ 'account_bank_account' } },
2019 };
2020 $args = $self->_contract( 'account_bank_account', $args ) || CORE::return( $self->pass_error );
2021 my $err = $self->_check_parameters( $okParams, $args );
2022 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
2023 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." ) );
2024 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No account_bank_account id (with parameter 'id') was provided to delete its information." ) );
2025 my $hash = $self->delete( "accounts/${parent_id}/external_accounts/${id}", $args ) || CORE::return( $self->pass_error );
2026 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Connect::ExternalAccount::Bank', $hash ) );
2027 }
2028 PERL
2029 # NOTE: account_bank_account_list()
2030 account_bank_account_list => <<'PERL',
2031 sub account_bank_account_list
2032 {
2033 my $self = shift( @_ );
2034 CORE::return( $self->error( "No parameters were provided to list account bank account information." ) ) if( !scalar( @_ ) );
2035 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Connect::ExternalAccount::Bank', @_ );
2036 my $okParams =
2037 {
2038 expandable => { allowed => $EXPANDABLES->{ 'account_bank_account' }, data_prefix_is_ok => 1 },
2039 ending_before => { type => "string" },
2040 limit => { type => "string" },
2041 starting_after => { type => "string" },
2042 };
2043 my $err = $self->_check_parameters( $okParams, $args );
2044 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
2045 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No account id (with parameter 'id') was provided to list its information." ) );
2046 if( $args->{expand} )
2047 {
2048 $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
2049 }
2050 my $hash = $self->get( "accounts/${id}?object=bank_account", $args ) || CORE::return( $self->pass_error );
2051 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Connect::ExternalAccount::Bank', $hash ) );
2052 }
2053 PERL
2054 # NOTE: account_bank_account_retrieve()
2055 account_bank_account_retrieve => <<'PERL',
2056 sub account_bank_account_retrieve
2057 {
2058 my $self = shift( @_ );
2059 my $args = shift( @_ );
2060 my $okParams =
2061 {
2062 expandable => { allowed => $EXPANDABLES->{ 'account_bank_account' }, data_prefix_is_ok => 1 },
2063 };
2064 $args = $self->_contract( 'account_bank_account', $args ) || CORE::return( $self->pass_error );
2065 my $err = $self->_check_parameters( $okParams, $args );
2066 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
2067 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." ) );
2068 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No account_bank_account id (with parameter 'id') was provided to retrieve its information." ) );
2069 my $hash = $self->get( "accounts/${parent_id}/external_accounts/${id}", $args ) || CORE::return( $self->pass_error );
2070 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Connect::ExternalAccount::Bank', $hash ) );
2071 }
2072 PERL
2073 # NOTE: account_bank_account_update()
2074 account_bank_account_update => <<'PERL',
2075 sub account_bank_account_update
2076 {
2077 my $self = shift( @_ );
2078 my $args = shift( @_ );
2079 my $okParams =
2080 {
2081 expandable => { allowed => $EXPANDABLES->{ 'account_bank_account' } },
2082 account_holder_name => { type => "string" },
2083 account_holder_type => { type => "string" },
2084 account_type => { type => "string" },
2085 default_for_currency => { type => "boolean" },
2086 metadata => { type => "hash" },
2087 };
2088 $args = $self->_contract( 'account_bank_account', $args ) || CORE::return( $self->pass_error );
2089 my $err = $self->_check_parameters( $okParams, $args );
2090 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
2091 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." ) );
2092 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No account_bank_account id (with parameter 'id') was provided to update its information." ) );
2093 my $hash = $self->post( "accounts/${parent_id}/external_accounts/${id}", $args ) || CORE::return( $self->pass_error );
2094 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Connect::ExternalAccount::Bank', $hash ) );
2095 }
2096 PERL
2097 # NOTE: account_bank_accounts()
2098 account_bank_accounts => <<'PERL',
2099 # <https://stripe.com/docs/api/external_accounts>
2100 sub account_bank_accounts
2101 {
2102 my $self = shift( @_ );
2103 my $allowed = [qw( create delete list retrieve update )];
2104 my $action = shift( @_ );
2105 my $meth = $self->_get_method( 'account_bank_account', $action, $allowed ) || CORE::return( $self->pass_error );
2106 CORE::return( $self->$meth( @_ ) );
2107 }
2108 PERL
2109 # NOTE: account_card()
2110 account_card => <<'PERL',
2111 sub account_card { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Connect::ExternalAccount::Card', @_ ) ); }
2112 PERL
2113 # NOTE: account_card_create()
2114 account_card_create => <<'PERL',
2115 sub account_card_create
2116 {
2117 my $self = shift( @_ );
2118 my $args = shift( @_ );
2119 my $okParams =
2120 {
2121 expandable => { allowed => $EXPANDABLES->{ 'account_card' } },
2122 default_for_currency => { type => "boolean" },
2123 external_account => { type => "string", required => 1 },
2124 metadata => { type => "hash" },
2125 };
2126 $args = $self->_contract( 'account_card', $args ) || CORE::return( $self->pass_error );
2127 my $err = $self->_check_parameters( $okParams, $args );
2128 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
2129 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No account id (with parameter 'id') was provided to create its information." ) );
2130 my $hash = $self->post( "accounts/${id}", $args ) || CORE::return( $self->pass_error );
2131 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Connect::ExternalAccount::Card', $hash ) );
2132 }
2133 PERL
2134 # NOTE: account_card_delete()
2135 account_card_delete => <<'PERL',
2136 sub account_card_delete
2137 {
2138 my $self = shift( @_ );
2139 my $args = shift( @_ );
2140 my $okParams =
2141 {
2142 expandable => { allowed => $EXPANDABLES->{ 'account_card' } },
2143 };
2144 $args = $self->_contract( 'account_card', $args ) || CORE::return( $self->pass_error );
2145 my $err = $self->_check_parameters( $okParams, $args );
2146 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
2147 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." ) );
2148 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No account_card id (with parameter 'id') was provided to delete its information." ) );
2149 my $hash = $self->delete( "accounts/${parent_id}/external_accounts/${id}", $args ) || CORE::return( $self->pass_error );
2150 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Connect::ExternalAccount::Card', $hash ) );
2151 }
2152 PERL
2153 # NOTE: account_card_list()
2154 account_card_list => <<'PERL',
2155 sub account_card_list
2156 {
2157 my $self = shift( @_ );
2158 CORE::return( $self->error( "No parameters were provided to list account card information." ) ) if( !scalar( @_ ) );
2159 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Connect::ExternalAccount::Card', @_ );
2160 my $okParams =
2161 {
2162 expandable => { allowed => $EXPANDABLES->{ 'account_card' }, data_prefix_is_ok => 1 },
2163 ending_before => { type => "string" },
2164 limit => { type => "string" },
2165 starting_after => { type => "string" },
2166 };
2167 my $err = $self->_check_parameters( $okParams, $args );
2168 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
2169 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No account id (with parameter 'id') was provided to list its information." ) );
2170 if( $args->{expand} )
2171 {
2172 $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
2173 }
2174 my $hash = $self->get( "accounts/${id}?object=card", $args ) || CORE::return( $self->pass_error );
2175 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Connect::ExternalAccount::Card', $hash ) );
2176 }
2177 PERL
2178 # NOTE: account_card_retrieve()
2179 account_card_retrieve => <<'PERL',
2180 sub account_card_retrieve
2181 {
2182 my $self = shift( @_ );
2183 my $args = shift( @_ );
2184 my $okParams =
2185 {
2186 expandable => { allowed => $EXPANDABLES->{ 'account_card' }, data_prefix_is_ok => 1 },
2187 };
2188 $args = $self->_contract( 'account_card', $args ) || CORE::return( $self->pass_error );
2189 my $err = $self->_check_parameters( $okParams, $args );
2190 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
2191 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." ) );
2192 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No account_card id (with parameter 'id') was provided to retrieve its information." ) );
2193 my $hash = $self->get( "accounts/${parent_id}/external_accounts/${id}", $args ) || CORE::return( $self->pass_error );
2194 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Connect::ExternalAccount::Card', $hash ) );
2195 }
2196 PERL
2197 # NOTE: account_card_update()
2198 account_card_update => <<'PERL',
2199 sub account_card_update
2200 {
2201 my $self = shift( @_ );
2202 my $args = shift( @_ );
2203 my $okParams =
2204 {
2205 expandable => { allowed => $EXPANDABLES->{ 'account_card' } },
2206 address_city => { type => "string" },
2207 address_country => { type => "string" },
2208 address_line1 => { type => "string" },
2209 address_line2 => { type => "string" },
2210 address_state => { type => "string" },
2211 address_zip => { type => "string" },
2212 default_for_currency => { type => "boolean" },
2213 exp_month => { type => "integer" },
2214 exp_year => { type => "integer" },
2215 metadata => { type => "hash" },
2216 name => { type => "string" },
2217 };
2218 $args = $self->_contract( 'account_card', $args ) || CORE::return( $self->pass_error );
2219 my $err = $self->_check_parameters( $okParams, $args );
2220 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
2221 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." ) );
2222 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No account_card id (with parameter 'id') was provided to update its information." ) );
2223 my $hash = $self->post( "accounts/${parent_id}/external_accounts/${id}", $args ) || CORE::return( $self->pass_error );
2224 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Connect::ExternalAccount::Card', $hash ) );
2225 }
2226 PERL
2227 # NOTE: account_cards()
2228 account_cards => <<'PERL',
2229 # <https://stripe.com/docs/api/external_accounts>
2230 sub account_cards
2231 {
2232 my $self = shift( @_ );
2233 my $allowed = [qw( create delete list retrieve update )];
2234 my $action = shift( @_ );
2235 my $meth = $self->_get_method( 'account_card', $action, $allowed ) || CORE::return( $self->pass_error );
2236 CORE::return( $self->$meth( @_ ) );
2237 }
2238 PERL
2239 # NOTE: account_create()
2240 account_create => <<'PERL',
2241 sub account_create
2242 {
2243 my $self = shift( @_ );
2244 my $args = shift( @_ );
2245 my $okParams =
2246 {
2247 expandable => { allowed => $EXPANDABLES->{ 'account' } },
2248 account_token => { type => "string" },
2249 business_profile => { type => "hash" },
2250 business_type => { type => "string" },
2251 capabilities => { type => "hash" },
2252 company => { type => "hash" },
2253 country => { type => "string" },
2254 default_currency => { type => "string" },
2255 documents => { type => "object" },
2256 email => { type => "string" },
2257 external_account => { type => "string" },
2258 individual => { type => "hash" },
2259 metadata => { type => "hash" },
2260 settings => { type => "hash" },
2261 tos_acceptance => { type => "hash" },
2262 type => { type => "string", required => 1 },
2263 };
2264 $args = $self->_contract( 'account', $args ) || CORE::return( $self->pass_error );
2265 my $err = $self->_check_parameters( $okParams, $args );
2266 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
2267 my $hash = $self->post( "accounts", $args ) || CORE::return( $self->pass_error );
2268 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Connect::Account', $hash ) );
2269 }
2270 PERL
2271 # NOTE: account_delete()
2272 account_delete => <<'PERL',
2273 sub account_delete
2274 {
2275 my $self = shift( @_ );
2276 my $args = shift( @_ );
2277 my $okParams =
2278 {
2279 expandable => { allowed => $EXPANDABLES->{ 'account' } },
2280 };
2281 $args = $self->_contract( 'account', $args ) || CORE::return( $self->pass_error );
2282 my $err = $self->_check_parameters( $okParams, $args );
2283 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
2284 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No account id (with parameter 'id') was provided to delete its information." ) );
2285 my $hash = $self->delete( "accounts/${id}", $args ) || CORE::return( $self->pass_error );
2286 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Connect::Account', $hash ) );
2287 }
2288 PERL
2289 # NOTE: account_link()
2290 account_link => <<'PERL',
2291 sub account_link { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Connect::Account::Link', @_ ) ); }
2292 PERL
2293 # NOTE: account_link_create()
2294 account_link_create => <<'PERL',
2295 sub account_link_create
2296 {
2297 my $self = shift( @_ );
2298 my $args = shift( @_ );
2299 my $okParams =
2300 {
2301 expandable => { allowed => $EXPANDABLES->{ 'account_link' } },
2302 account => { type => "string", required => 1 },
2303 collect => { type => "string" },
2304 refresh_url => { type => "string" },
2305 return_url => { type => "string" },
2306 type => { type => "string", required => 1 },
2307 };
2308 $args = $self->_contract( 'account_link', $args ) || CORE::return( $self->pass_error );
2309 my $err = $self->_check_parameters( $okParams, $args );
2310 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
2311 my $hash = $self->post( "account_links", $args ) || CORE::return( $self->pass_error );
2312 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Connect::Account::Link', $hash ) );
2313 }
2314 PERL
2315 # NOTE: account_links()
2316 account_links => <<'PERL',
2317 # <https://stripe.com/docs/api/account_links>
2318 sub account_links
2319 {
2320 my $self = shift( @_ );
2321 my $allowed = [qw( create )];
2322 my $action = shift( @_ );
2323 my $meth = $self->_get_method( 'account_link', $action, $allowed ) || CORE::return( $self->pass_error );
2324 CORE::return( $self->$meth( @_ ) );
2325 }
2326 PERL
2327 # NOTE: account_list()
2328 account_list => <<'PERL',
2329 sub account_list
2330 {
2331 my $self = shift( @_ );
2332 CORE::return( $self->error( "No parameters were provided to list account information." ) ) if( !scalar( @_ ) );
2333 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Connect::Account', @_ );
2334 my $okParams =
2335 {
2336 expandable => { allowed => $EXPANDABLES->{ 'account' }, data_prefix_is_ok => 1 },
2337 created => { type => "timestamp" },
2338 ending_before => { type => "string" },
2339 limit => { type => "string" },
2340 starting_after => { type => "string" },
2341 };
2342 my $err = $self->_check_parameters( $okParams, $args );
2343 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
2344 if( $args->{expand} )
2345 {
2346 $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
2347 }
2348 my $hash = $self->get( "accounts", $args ) || CORE::return( $self->pass_error );
2349 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Connect::Account', $hash ) );
2350 }
2351 PERL
2352 # NOTE: account_reject()
2353 account_reject => <<'PERL',
2354 sub account_reject
2355 {
2356 my $self = shift( @_ );
2357 my $args = shift( @_ );
2358 my $okParams =
2359 {
2360 expandable => { allowed => $EXPANDABLES->{ 'account' } },
2361 reason => { type => "string", required => 1 },
2362 };
2363 $args = $self->_contract( 'account', $args ) || CORE::return( $self->pass_error );
2364 my $err = $self->_check_parameters( $okParams, $args );
2365 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
2366 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No account id (with parameter 'id') was provided to reject its information." ) );
2367 my $hash = $self->post( "accounts/${id}", $args ) || CORE::return( $self->pass_error );
2368 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Connect::Account', $hash ) );
2369 }
2370 PERL
2371 # NOTE: account_retrieve()
2372 account_retrieve => <<'PERL',
2373 sub account_retrieve
2374 {
2375 my $self = shift( @_ );
2376 my $args = shift( @_ );
2377 my $okParams =
2378 {
2379 expandable => { allowed => $EXPANDABLES->{ 'account' }, data_prefix_is_ok => 1 },
2380 };
2381 $args = $self->_contract( 'account', $args ) || CORE::return( $self->pass_error );
2382 my $err = $self->_check_parameters( $okParams, $args );
2383 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
2384 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No account id (with parameter 'id') was provided to retrieve its information." ) );
2385 my $hash = $self->get( "accounts/${id}", $args ) || CORE::return( $self->pass_error );
2386 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Connect::Account', $hash ) );
2387 }
2388 PERL
2389 # NOTE: account_token_create()
2390 account_token_create => <<'PERL',
2391 sub account_token_create { CORE::return( shift->token_create( @_ ) ); }
2392 PERL
2393 # NOTE: account_update()
2394 account_update => <<'PERL',
2395 sub account_update
2396 {
2397 my $self = shift( @_ );
2398 my $args = shift( @_ );
2399 my $okParams =
2400 {
2401 expandable => { allowed => $EXPANDABLES->{ 'account' } },
2402 account_token => { type => "string" },
2403 business_profile => { type => "hash" },
2404 business_type => { type => "string" },
2405 capabilities => { type => "hash" },
2406 company => { type => "hash" },
2407 default_currency => { type => "string" },
2408 documents => { type => "object" },
2409 email => { type => "string" },
2410 external_account => { type => "string" },
2411 individual => { type => "hash" },
2412 metadata => { type => "hash" },
2413 settings => { type => "hash" },
2414 tos_acceptance => { type => "hash" },
2415 };
2416 $args = $self->_contract( 'account', $args ) || CORE::return( $self->pass_error );
2417 my $err = $self->_check_parameters( $okParams, $args );
2418 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
2419 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No account id (with parameter 'id') was provided to update its information." ) );
2420 my $hash = $self->post( "accounts/${id}", $args ) || CORE::return( $self->pass_error );
2421 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Connect::Account', $hash ) );
2422 }
2423 PERL
2424 # NOTE: accounts()
2425 accounts => <<'PERL',
2426 # <https://stripe.com/docs/api/accounts>
2427 sub accounts
2428 {
2429 my $self = shift( @_ );
2430 my $allowed = [qw( create delete list reject retrieve update )];
2431 my $action = shift( @_ );
2432 my $meth = $self->_get_method( 'account', $action, $allowed ) || CORE::return( $self->pass_error );
2433 CORE::return( $self->$meth( @_ ) );
2434 }
2435 PERL
2436 # NOTE: address()
2437 address => <<'PERL',
2438 sub address { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Address', @_ ) ); }
2439 PERL
2440 # NOTE: address_kana()
2441 address_kana => <<'PERL',
2442 sub address_kana { CORE::return( shift->_response_to_object( 'Net::API::Stripe::AddressKana', @_ ) ); }
2443 PERL
2444 # NOTE: address_kanji()
2445 address_kanji => <<'PERL',
2446 sub address_kanji { CORE::return( shift->_response_to_object( 'Net::API::Stripe::AddressKanji', @_ ) ); }
2447 PERL
2448 # NOTE: amount()
2449 amount => <<'PERL',
2450 sub amount { CORE::return( shift->_set_get_number( 'amount', @_ ) ); }
2451 PERL
2452 # NOTE: application_fee()
2453 application_fee => <<'PERL',
2454 sub application_fee { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Connect::ApplicationFee', @_ ) ); }
2455 PERL
2456 # NOTE: application_fee_list()
2457 application_fee_list => <<'PERL',
2458 sub application_fee_list
2459 {
2460 my $self = shift( @_ );
2461 CORE::return( $self->error( "No parameters were provided to list application fee information." ) ) if( !scalar( @_ ) );
2462 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Connect::ApplicationFee', @_ );
2463 my $okParams =
2464 {
2465 expandable => { allowed => $EXPANDABLES->{ 'application_fee' }, data_prefix_is_ok => 1 },
2466 charge => { type => "string" },
2467 created => { type => "timestamp" },
2468 ending_before => { type => "string" },
2469 limit => { type => "string" },
2470 starting_after => { type => "string" },
2471 };
2472 my $err = $self->_check_parameters( $okParams, $args );
2473 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
2474 if( $args->{expand} )
2475 {
2476 $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
2477 }
2478 my $hash = $self->get( "application_fees", $args ) || CORE::return( $self->pass_error );
2479 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Connect::ApplicationFee', $hash ) );
2480 }
2481 PERL
2482 # NOTE: application_fee_refund()
2483 application_fee_refund => <<'PERL',
2484 sub application_fee_refund { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Connect::ApplicationFee::Refund', @_ ) ); }
2485 PERL
2486 # NOTE: application_fee_retrieve()
2487 application_fee_retrieve => <<'PERL',
2488 sub application_fee_retrieve
2489 {
2490 my $self = shift( @_ );
2491 my $args = shift( @_ );
2492 my $okParams =
2493 {
2494 expandable => { allowed => $EXPANDABLES->{ 'application_fee' }, data_prefix_is_ok => 1 },
2495 };
2496 $args = $self->_contract( 'application_fee', $args ) || CORE::return( $self->pass_error );
2497 my $err = $self->_check_parameters( $okParams, $args );
2498 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
2499 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No application_fee id (with parameter 'id') was provided to retrieve its information." ) );
2500 my $hash = $self->get( "application_fees/${id}", $args ) || CORE::return( $self->pass_error );
2501 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Connect::ApplicationFee', $hash ) );
2502 }
2503 PERL
2504 # NOTE: application_fees()
2505 application_fees => <<'PERL',
2506 # <https://stripe.com/docs/api/application_fees>
2507 sub application_fees
2508 {
2509 my $self = shift( @_ );
2510 my $allowed = [qw( list retrieve )];
2511 my $action = shift( @_ );
2512 my $meth = $self->_get_method( 'application_fee', $action, $allowed ) || CORE::return( $self->pass_error );
2513 CORE::return( $self->$meth( @_ ) );
2514 }
2515 PERL
2516 # NOTE: apps_secret()
2517 apps_secret => <<'PERL',
2518 sub apps_secret { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Connect::AppsSecret', @_ ) ); }
2519 PERL
2520 # NOTE: apps_secret_delete()
2521 apps_secret_delete => <<'PERL',
2522 sub apps_secret_delete
2523 {
2524 my $self = shift( @_ );
2525 my $args = shift( @_ );
2526 my $okParams =
2527 {
2528 expandable => { allowed => $EXPANDABLES->{ 'apps.secret' } },
2529 name => { type => "string", required => 1 },
2530 scope => { type => "hash", required => 1 },
2531 };
2532 $args = $self->_contract( 'apps.secret', $args ) || CORE::return( $self->pass_error );
2533 my $err = $self->_check_parameters( $okParams, $args );
2534 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
2535 my $hash = $self->post( "apps/secrets", $args ) || CORE::return( $self->pass_error );
2536 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Connect::AppsSecret', $hash ) );
2537 }
2538 PERL
2539 # NOTE: apps_secret_find()
2540 apps_secret_find => <<'PERL',
2541 sub apps_secret_find
2542 {
2543 my $self = shift( @_ );
2544 my $args = shift( @_ );
2545 my $okParams =
2546 {
2547 expandable => { allowed => $EXPANDABLES->{ 'apps.secret' }, data_prefix_is_ok => 1 },
2548 name => { type => "string", required => 1 },
2549 scope => { type => "hash", required => 1 },
2550 };
2551 $args = $self->_contract( 'apps.secret', $args ) || CORE::return( $self->pass_error );
2552 my $err = $self->_check_parameters( $okParams, $args );
2553 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
2554 my $hash = $self->get( "apps/secrets", $args ) || CORE::return( $self->pass_error );
2555 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Connect::AppsSecret', $hash ) );
2556 }
2557 PERL
2558 # NOTE: apps_secret_list()
2559 apps_secret_list => <<'PERL',
2560 sub apps_secret_list
2561 {
2562 my $self = shift( @_ );
2563 CORE::return( $self->error( "No parameters were provided to list apps secret information." ) ) if( !scalar( @_ ) );
2564 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Connect::AppsSecret', @_ );
2565 my $okParams =
2566 {
2567 expandable => { allowed => $EXPANDABLES->{ 'apps.secret' }, data_prefix_is_ok => 1 },
2568 ending_before => { type => "string" },
2569 limit => { type => "string" },
2570 scope => { type => "hash", required => 1 },
2571 starting_after => { type => "string" },
2572 };
2573 my $err = $self->_check_parameters( $okParams, $args );
2574 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
2575 if( $args->{expand} )
2576 {
2577 $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
2578 }
2579 my $hash = $self->get( "", $args ) || CORE::return( $self->pass_error );
2580 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Connect::AppsSecret', $hash ) );
2581 }
2582 PERL
2583 # NOTE: apps_secret_set()
2584 apps_secret_set => <<'PERL',
2585 sub apps_secret_set
2586 {
2587 my $self = shift( @_ );
2588 my $args = shift( @_ );
2589 my $okParams =
2590 {
2591 expandable => { allowed => $EXPANDABLES->{ 'apps.secret' } },
2592 expires_at => { type => "timestamp" },
2593 name => { type => "string", required => 1 },
2594 payload => { type => "string", required => 1 },
2595 scope => { type => "hash", required => 1 },
2596 };
2597 $args = $self->_contract( 'apps.secret', $args ) || CORE::return( $self->pass_error );
2598 my $err = $self->_check_parameters( $okParams, $args );
2599 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
2600 my $hash = $self->post( "", $args ) || CORE::return( $self->pass_error );
2601 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Connect::AppsSecret', $hash ) );
2602 }
2603 PERL
2604 # NOTE: apps_secrets()
2605 apps_secrets => <<'PERL',
2606 # <https://stripe.com/docs/api/secret_management>
2607 sub apps_secrets
2608 {
2609 my $self = shift( @_ );
2610 my $allowed = [qw( delete find list set )];
2611 my $action = shift( @_ );
2612 my $meth = $self->_get_method( 'apps_secret', $action, $allowed ) || CORE::return( $self->pass_error );
2613 CORE::return( $self->$meth( @_ ) );
2614 }
2615 PERL
2616 # NOTE: authorization()
2617 authorization => <<'PERL',
2618 sub authorization { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Issuing::Authorization', @_ ) ); }
2619 PERL
2620 # NOTE: balance()
2621 balance => <<'PERL',
2622 sub balance { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Balance', @_ ) ); }
2623 PERL
2624 # NOTE: balance_retrieve()
2625 balance_retrieve => <<'PERL',
2626 # Retrieves the current account balance, based on the authentication that was used to make the request.
2627 sub balance_retrieve
2628 {
2629 my $self = shift( @_ );
2630 # No argument
2631 # my $hash = $self->_get( 'balance' ) || CORE::return;
2632 my $hash = $self->get( 'balance' );
2633 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Balance', $hash ) );
2634 }
2635 PERL
2636 # NOTE: balance_transaction()
2637 balance_transaction => <<'PERL',
2638 sub balance_transaction { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Balance::Transaction', @_ ) ); }
2639 PERL
2640 # NOTE: balance_transaction_list()
2641 balance_transaction_list => <<'PERL',
2642 # https://stripe.com/docs/api/balance/balance_history?lang=curl
2643 sub balance_transaction_list
2644 {
2645 my $self = shift( @_ );
2646 my $args = shift( @_ );
2647 my $okParams =
2648 {
2649 expandable => { allowed => $EXPANDABLES->{balance_transaction}, data_prefix_is_ok => 1 },
2650 'available_on' => qr/^\d+$/,
2651 'available_on.gt' => qr/^\d+$/,
2652 'available_on.gte' => qr/^\d+$/,
2653 'available_on.lt' => qr/^\d+$/,
2654 'available_on.lte' => qr/^\d+$/,
2655 'created' => qr/^\d+$/,
2656 'created.gt' => qr/^\d+$/,
2657 'created.gte' => qr/^\d+$/,
2658 'created.lt' => qr/^\d+$/,
2659 'created.lte' => qr/^\d+$/,
2660 'currency' => qr/^[a-zA-Z]{3}$/,
2661 # "A cursor for use in pagination. ending_before is an object ID that defines your place in the list."
2662 'ending_before' => qr/^\w+$/,
2663 'limit' => qr/^\d+$/,
2664 # "For automatic Stripe payouts only, only returns transactions that were payed out on the specified payout ID."
2665 'payout' => qr/^\w+$/,
2666 'source' => qr/^\w+$/,
2667 'starting_after' => qr/^\w+$/,
2668 # "Only returns transactions of the given type"
2669 'type' => qr/^(?:charge|refund|adjustment|application_fee|application_fee_refund|transfer|payment|payout|payout_failure|stripe_fee|network_cost)$/,
2670 };
2671 my $err = $self->_check_parameters( $okParams, $args );
2672 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
2673 my $hash = $self->get( 'balance_transactions', $args ) || CORE::return( $self->pass_error );
2674 CORE::return( $self->_response_to_object( 'Net::API::Stripe::List', $hash ) );
2675 }
2676 PERL
2677 # NOTE: balance_transaction_retrieve()
2678 balance_transaction_retrieve => <<'PERL',
2679 sub balance_transaction_retrieve
2680 {
2681 my $self = shift( @_ );
2682 CORE::return( $self->error( "No parameters were provided to retrieve balance transaction information." ) ) if( !scalar( @_ ) );
2683 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Balance::Transaction', @_ );
2684 my $okParams =
2685 {
2686 expandable => { allowed => $EXPANDABLES->{balance_transaction}, data_prefix_is_ok => 1 },
2687 id => { re => qr/^\w+$/, required => 1 }
2688 };
2689 my $err = $self->_check_parameters( $okParams, $args );
2690 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
2691 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No balance transaction id was provided to retrieve its information." ) );
2692 my $hash = $self->get( "balance/history/${id}" ) || CORE::return( $self->pass_error );
2693 CORE::return( $self->error( "Cannot find property 'object' in response hash reference: ", sub{ $self->dumper( $hash ) } ) ) if( !CORE::exists( $hash->{object} ) );
2694 my $class = $self->_object_type_to_class( $hash->{object} ) || CORE::return( $self->pass_error );
2695 CORE::return( $self->_response_to_object( $class, $hash ) );
2696 }
2697 PERL
2698 # NOTE: balance_transactions()
2699 balance_transactions => <<'PERL',
2700 sub balance_transactions
2701 {
2702 my $self = shift( @_ );
2703 my $allowed = [qw( retrieve list )];
2704 my $action = shift( @_ );
2705 my $meth = $self->_get_method( 'balance_transaction', $action, $allowed ) || CORE::return( $self->pass_error );
2706 CORE::return( $self->$meth( @_ ) );
2707 }
2708 PERL
2709 # NOTE: balances()
2710 balances => <<'PERL',
2711 # Stripe access points in their order on the api documentation
2712 sub balances
2713 {
2714 my $self = shift( @_ );
2715 my $allowed = [qw( retrieve )];
2716 my $action = shift( @_ );
2717 my $meth = $self->_get_method( 'balance', $action, $allowed ) || CORE::return( $self->pass_error );
2718 CORE::return( $self->$meth( @_ ) );
2719 }
2720 PERL
2721 # NOTE: bank_account()
2722 bank_account => <<'PERL',
2723 sub bank_account { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Connect::ExternalAccount::Bank', @_ ) ); }
2724 PERL
2725 # NOTE: bank_account_create()
2726 bank_account_create => <<'PERL',
2727 sub bank_account_create
2728 {
2729 my $self = shift( @_ );
2730 CORE::return( $self->error( "No parameters were provided to create a bank account" ) ) if( !scalar( @_ ) );
2731 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Connect::ExternalAccount::Bank', @_ );
2732 my $okParams =
2733 {
2734 expandable => { allowed => $EXPANDABLES->{bank_account} },
2735 account => { re => qr/^\w+$/, required => 1 },
2736 default_for_currency => {},
2737 external_account => {},
2738 metadata => { type => "hash" },
2739 source => { type => "string" },
2740 };
2741  
2742 if( $self->_is_hash( $args->{external_account} ) )
2743 {
2744 $okParams->{external_account} =
2745 {
2746 type => 'hash',
2747 fields => [qw( object! country! currency! account_holder_name account_holder_type routing_number account_number! )],
2748 };
2749 }
2750 else
2751 {
2752 $okParams->{external_account} = { type => 'scalar', re => qr/^\w+$/ };
2753 }
2754 my $id = CORE::delete( $args->{account} );
2755 $args = $self->_contract( 'bank_account', $args ) || CORE::return( $self->pass_error );
2756 my $err = $self->_check_parameters( $okParams, $args );
2757 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
2758 my $hash = $self->post( "accounts/${id}/external_accounts", $args ) || CORE::return( $self->pass_error );
2759 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Connect::ExternalAccount::Bank', $hash ) );
2760 }
2761 PERL
2762 # NOTE: bank_account_delete()
2763 bank_account_delete => <<'PERL',
2764 sub bank_account_delete
2765 {
2766 my $self = shift( @_ );
2767 CORE::return( $self->error( "No parameters were provided to delete a bank account information." ) ) if( !scalar( @_ ) );
2768 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Connect::ExternalAccount::Bank', @_ );
2769 my $okParams =
2770 {
2771 expandable => { allowed => $EXPANDABLES->{bank_account} },
2772 id => { re => qr/^\w+$/, required => 1 },
2773 account => { re => qr/^\w+$/, required => 1 },
2774 };
2775 my $err = $self->_check_parameters( $okParams, $args );
2776 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
2777 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No bank account id was provided to delete its information." ) );
2778 my $acct = CORE::delete( $args->{account} );
2779 my $hash = $self->delete( "accounts/${acct}/external_accounts/${id}", $args ) || CORE::return( $self->pass_error );
2780 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Connect::ExternalAccount::Bank', $hash ) );
2781 }
2782 PERL
2783 # NOTE: bank_account_list()
2784 bank_account_list => <<'PERL',
2785 sub bank_account_list
2786 {
2787 my $self = shift( @_ );
2788 my $args = shift( @_ );
2789 my $okParams =
2790 {
2791 expandable => { allowed => $EXPANDABLES->{bank_account} },
2792 account => { re => qr/^\w+$/, required => 1 },
2793 # "A cursor for use in pagination. ending_before is an object ID that defines your place in the list."
2794 'ending_before' => qr/^\w+$/,
2795 'limit' => qr/^\d+$/,
2796 'starting_after' => qr/^\w+$/,
2797 };
2798 my $err = $self->_check_parameters( $okParams, $args );
2799 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
2800 my $id = CORE::delete( $args->{account} );
2801 if( $args->{expand} )
2802 {
2803 $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
2804 }
2805 my $hash = $self->get( "accounts/$id/external_accounts", $args ) || CORE::return( $self->pass_error );
2806 CORE::return( $self->_response_to_object( 'Net::API::Stripe::List', $hash ) );
2807 }
2808 PERL
2809 # NOTE: bank_account_retrieve()
2810 bank_account_retrieve => <<'PERL',
2811 sub bank_account_retrieve
2812 {
2813 my $self = shift( @_ );
2814 CORE::return( $self->error( "No parameters were provided to retrieve a bank account information." ) ) if( !scalar( @_ ) );
2815 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Connect::ExternalAccount::Bank', @_ );
2816 my $okParams =
2817 {
2818 expandable => { allowed => $EXPANDABLES->{bank_account} },
2819 id => { re => qr/^\w+$/, required => 1 },
2820 account => { re => qr/^\w+$/, required => 1 },
2821 };
2822 my $err = $self->_check_parameters( $okParams, $args );
2823 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
2824 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No bank account id was provided to retrieve its information." ) );
2825 my $acct = CORE::delete( $args->{account} );
2826 my $hash = $self->get( "accounts/${acct}/external_accounts/${id}", $args ) || CORE::return( $self->pass_error );
2827 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Connect::ExternalAccount::Bank', $hash ) );
2828 }
2829 PERL
2830 # NOTE: bank_account_update()
2831 bank_account_update => <<'PERL',
2832 sub bank_account_update
2833 {
2834 my $self = shift( @_ );
2835 CORE::return( $self->error( "No parameters were provided to update a bank account" ) ) if( !scalar( @_ ) );
2836 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Connect::ExternalAccount::Bank', @_ );
2837 my $okParams =
2838 {
2839 expandable => { allowed => $EXPANDABLES->{bank_account} },
2840 account => { re => qr/^\w+$/, required => 1 },
2841 account_holder_name => { type => "string" },
2842 account_holder_type => { re => qr/^(company|individual)$/, type => "string" },
2843 default_for_currency => {},
2844 id => { re => qr/^\w+$/, required => 1 },
2845 metadata => { type => "hash" },
2846 };
2847  
2848 $args = $self->_contract( 'bank_account', $args ) || CORE::return( $self->pass_error );
2849 # We found some errors
2850 my $err = $self->_check_parameters( $okParams, $args );
2851 # $self->message( 3, "Data to be posted: ", $self->dumper( $args ) ); exit;
2852 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
2853 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No bank account id was provided to update coupon's details" ) );
2854 my $acct = CORE::delete( $args->{account} );
2855 my $hash = $self->post( "accounts/${acct}/external_accounts/${id}", $args ) || CORE::return( $self->pass_error );
2856 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Connect::ExternalAccount::Bank', $hash ) );
2857 }
2858 PERL
2859 # NOTE: bank_account_verify()
2860 bank_account_verify => <<'PERL',
2861 sub bank_account_verify
2862 {
2863 my $self = shift( @_ );
2864 my $args = shift( @_ );
2865 my $okParams =
2866 {
2867 expandable => { allowed => $EXPANDABLES->{ 'bank_account' } },
2868 amounts => { type => "array" },
2869 };
2870 $args = $self->_contract( 'bank_account', $args ) || CORE::return( $self->pass_error );
2871 my $err = $self->_check_parameters( $okParams, $args );
2872 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
2873 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." ) );
2874 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No source id (with parameter 'id') was provided to verify its information." ) );
2875 my $hash = $self->post( "customers/${parent_id}/sources/${id}", $args ) || CORE::return( $self->pass_error );
2876 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Customer::BankAccount', $hash ) );
2877 }
2878 PERL
2879 # NOTE: bank_accounts()
2880 bank_accounts => <<'PERL',
2881 # <https://stripe.com/docs/api/customer_bank_accounts>
2882 sub bank_accounts
2883 {
2884 my $self = shift( @_ );
2885 my $allowed = [qw( create delete list retrieve update verify )];
2886 my $action = shift( @_ );
2887 my $meth = $self->_get_method( 'bank_account', $action, $allowed ) || CORE::return( $self->pass_error );
2888 CORE::return( $self->$meth( @_ ) );
2889 }
2890 PERL
2891 # NOTE: bank_token_create()
2892 bank_token_create => <<'PERL',
2893 sub bank_token_create { CORE::return( shift->token_create( @_ ) ); }
2894 PERL
2895 # NOTE: billing_details()
2896 billing_details => <<'PERL',
2897 sub billing_details { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Billing::Details', @_ ) ); }
2898 PERL
2899 # NOTE: billing_portal_configuration()
2900 billing_portal_configuration => <<'PERL',
2901 sub billing_portal_configuration { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Billing::PortalConfiguration', @_ ) ); }
2902 PERL
2903 # NOTE: billing_portal_configuration_create()
2904 billing_portal_configuration_create => <<'PERL',
2905 sub billing_portal_configuration_create
2906 {
2907 my $self = shift( @_ );
2908 my $args = shift( @_ );
2909 my $okParams =
2910 {
2911 expandable => { allowed => $EXPANDABLES->{ 'billing_portal.configuration' } },
2912 business_profile => { type => "hash", required => 1 },
2913 default_return_url => { type => "string" },
2914 features => { type => "hash", required => 1 },
2915 login_page => { type => "hash" },
2916 metadata => { type => "hash" },
2917 };
2918 $args = $self->_contract( 'billing_portal.configuration', $args ) || CORE::return( $self->pass_error );
2919 my $err = $self->_check_parameters( $okParams, $args );
2920 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
2921 my $hash = $self->post( "", $args ) || CORE::return( $self->pass_error );
2922 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::PortalConfiguration', $hash ) );
2923 }
2924 PERL
2925 # NOTE: billing_portal_configuration_list()
2926 billing_portal_configuration_list => <<'PERL',
2927 sub billing_portal_configuration_list
2928 {
2929 my $self = shift( @_ );
2930 CORE::return( $self->error( "No parameters were provided to list billing portal configuration information." ) ) if( !scalar( @_ ) );
2931 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Billing::PortalConfiguration', @_ );
2932 my $okParams =
2933 {
2934 expandable => { allowed => $EXPANDABLES->{ 'billing_portal.configuration' }, data_prefix_is_ok => 1 },
2935 active => { type => "boolean" },
2936 ending_before => { type => "string" },
2937 is_default => { type => "boolean" },
2938 limit => { type => "string" },
2939 starting_after => { type => "string" },
2940 };
2941 my $err = $self->_check_parameters( $okParams, $args );
2942 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
2943 if( $args->{expand} )
2944 {
2945 $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
2946 }
2947 my $hash = $self->get( "", $args ) || CORE::return( $self->pass_error );
2948 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::PortalConfiguration', $hash ) );
2949 }
2950 PERL
2951 # NOTE: billing_portal_configuration_retrieve()
2952 billing_portal_configuration_retrieve => <<'PERL',
2953 sub billing_portal_configuration_retrieve
2954 {
2955 my $self = shift( @_ );
2956 my $args = shift( @_ );
2957 my $okParams =
2958 {
2959 expandable => { allowed => $EXPANDABLES->{ 'billing_portal.configuration' }, data_prefix_is_ok => 1 },
2960 };
2961 $args = $self->_contract( 'billing_portal.configuration', $args ) || CORE::return( $self->pass_error );
2962 my $err = $self->_check_parameters( $okParams, $args );
2963 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
2964 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No billing_portal.configuration id (with parameter 'id') was provided to retrieve its information." ) );
2965 my $hash = $self->get( "billing_portal/configurations/${id}", $args ) || CORE::return( $self->pass_error );
2966 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::PortalConfiguration', $hash ) );
2967 }
2968 PERL
2969 # NOTE: billing_portal_configuration_update()
2970 billing_portal_configuration_update => <<'PERL',
2971 sub billing_portal_configuration_update
2972 {
2973 my $self = shift( @_ );
2974 my $args = shift( @_ );
2975 my $okParams =
2976 {
2977 expandable => { allowed => $EXPANDABLES->{ 'billing_portal.configuration' } },
2978 active => { type => "boolean" },
2979 business_profile => { type => "hash" },
2980 default_return_url => { type => "string" },
2981 features => { type => "hash" },
2982 login_page => { type => "hash" },
2983 metadata => { type => "hash" },
2984 };
2985 $args = $self->_contract( 'billing_portal.configuration', $args ) || CORE::return( $self->pass_error );
2986 my $err = $self->_check_parameters( $okParams, $args );
2987 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
2988 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No billing_portal.configuration id (with parameter 'id') was provided to update its information." ) );
2989 my $hash = $self->post( "billing_portal/configurations/${id}", $args ) || CORE::return( $self->pass_error );
2990 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::PortalConfiguration', $hash ) );
2991 }
2992 PERL
2993 # NOTE: billing_portal_configurations()
2994 billing_portal_configurations => <<'PERL',
2995 # <https://stripe.com/docs/api/customer_portal>
2996 sub billing_portal_configurations
2997 {
2998 my $self = shift( @_ );
2999 my $allowed = [qw( create list retrieve update )];
3000 my $action = shift( @_ );
3001 my $meth = $self->_get_method( 'billing_portal_configuration', $action, $allowed ) || CORE::return( $self->pass_error );
3002 CORE::return( $self->$meth( @_ ) );
3003 }
3004 PERL
3005 # NOTE: billing_portal_session()
3006 billing_portal_session => <<'PERL',
3007 sub billing_portal_session { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Billing::PortalSession', @_ ) ); }
3008 PERL
3009 # NOTE: billing_portal_session_create()
3010 billing_portal_session_create => <<'PERL',
3011 sub billing_portal_session_create
3012 {
3013 my $self = shift( @_ );
3014 my $args = shift( @_ );
3015 my $okParams =
3016 {
3017 expandable => { allowed => $EXPANDABLES->{ 'billing_portal.session' } },
3018 configuration => { type => "string" },
3019 customer => { type => "string", required => 1 },
3020 locale => { type => "string" },
3021 on_behalf_of => { type => "string" },
3022 return_url => { type => "string" },
3023 };
3024 $args = $self->_contract( 'billing_portal.session', $args ) || CORE::return( $self->pass_error );
3025 my $err = $self->_check_parameters( $okParams, $args );
3026 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
3027 my $hash = $self->post( "", $args ) || CORE::return( $self->pass_error );
3028 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::PortalSession', $hash ) );
3029 }
3030 PERL
3031 # NOTE: billing_portal_sessions()
3032 billing_portal_sessions => <<'PERL',
3033 # <https://stripe.com/docs/api/customer_portal>
3034 sub billing_portal_sessions
3035 {
3036 my $self = shift( @_ );
3037 my $allowed = [qw( create )];
3038 my $action = shift( @_ );
3039 my $meth = $self->_get_method( 'billing_portal_session', $action, $allowed ) || CORE::return( $self->pass_error );
3040 CORE::return( $self->$meth( @_ ) );
3041 }
3042 PERL
3043 # NOTE: billing_thresholds()
3044 billing_thresholds => <<'PERL',
3045 sub billing_thresholds { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Billing::Thresholds', @_ ) ); }
3046 PERL
3047 # NOTE: business_profile()
3048 business_profile => <<'PERL',
3049 sub business_profile { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Connect::Business::Profile', @_ ) ); }
3050 PERL
3051 # NOTE: capability()
3052 capability => <<'PERL',
3053 # sub billing { CORE::return( shift->_instantiate( 'billing', 'Net::API::Stripe::Billing' ) ) }
3054 sub capability { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Connect::Account::Capability', @_ ) ); }
3055 PERL
3056 # NOTE: capability_list()
3057 capability_list => <<'PERL',
3058 sub capability_list
3059 {
3060 my $self = shift( @_ );
3061 CORE::return( $self->error( "No parameters were provided to list capability information." ) ) if( !scalar( @_ ) );
3062 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Connect::Account::Capability', @_ );
3063 my $okParams =
3064 {
3065 expandable => { allowed => $EXPANDABLES->{ 'capability' }, data_prefix_is_ok => 1 },
3066 };
3067 my $err = $self->_check_parameters( $okParams, $args );
3068 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
3069 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No account id (with parameter 'id') was provided to list its information." ) );
3070 if( $args->{expand} )
3071 {
3072 $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
3073 }
3074 my $hash = $self->get( "accounts/${id}/capabilities", $args ) || CORE::return( $self->pass_error );
3075 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Connect::Account::Capability', $hash ) );
3076 }
3077 PERL
3078 # NOTE: capability_retrieve()
3079 capability_retrieve => <<'PERL',
3080 sub capability_retrieve
3081 {
3082 my $self = shift( @_ );
3083 my $args = shift( @_ );
3084 my $okParams =
3085 {
3086 expandable => { allowed => $EXPANDABLES->{ 'capability' }, data_prefix_is_ok => 1 },
3087 };
3088 $args = $self->_contract( 'capability', $args ) || CORE::return( $self->pass_error );
3089 my $err = $self->_check_parameters( $okParams, $args );
3090 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
3091 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." ) );
3092 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No account.capability id (with parameter 'id') was provided to retrieve its information." ) );
3093 my $hash = $self->get( "accounts/${parent_id}/capabilities/${id}", $args ) || CORE::return( $self->pass_error );
3094 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Connect::Account::Capability', $hash ) );
3095 }
3096 PERL
3097 # NOTE: capability_update()
3098 capability_update => <<'PERL',
3099 sub capability_update
3100 {
3101 my $self = shift( @_ );
3102 my $args = shift( @_ );
3103 my $okParams =
3104 {
3105 expandable => { allowed => $EXPANDABLES->{ 'capability' } },
3106 requested => { type => "boolean" },
3107 };
3108 $args = $self->_contract( 'capability', $args ) || CORE::return( $self->pass_error );
3109 my $err = $self->_check_parameters( $okParams, $args );
3110 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
3111 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." ) );
3112 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No account.capability id (with parameter 'id') was provided to update its information." ) );
3113 my $hash = $self->post( "accounts/${parent_id}/capabilities/${id}", $args ) || CORE::return( $self->pass_error );
3114 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Connect::Account::Capability', $hash ) );
3115 }
3116 PERL
3117 # NOTE: capabilitys()
3118 capabilitys => <<'PERL',
3119 # <https://stripe.com/docs/api/capabilities>
3120 sub capabilitys
3121 {
3122 my $self = shift( @_ );
3123 my $allowed = [qw( list retrieve update )];
3124 my $action = shift( @_ );
3125 my $meth = $self->_get_method( 'capability', $action, $allowed ) || CORE::return( $self->pass_error );
3126 CORE::return( $self->$meth( @_ ) );
3127 }
3128 PERL
3129 # NOTE: card()
3130 card => <<'PERL',
3131 sub card { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Connect::ExternalAccount::Card', @_ ) ); }
3132 PERL
3133 # NOTE: card_create()
3134 card_create => <<'PERL',
3135 sub card_create
3136 {
3137 my $self = shift( @_ );
3138 CORE::return( $self->error( "No parameters were provided to create card" ) ) if( !scalar( @_ ) );
3139 my $args = {};
3140 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 )];
3141 my $okParams =
3142 {
3143 expandable => { allowed => $EXPANDABLES->{card} },
3144 id => { re => qr/^\w+$/, required => 1 },
3145 # Token
3146 source => { type => 'hash', required => 1 },
3147 metadata => { type => 'hash' },
3148 };
3149
3150 if( $self->_is_object( $_[0] ) && $_[0]->isa( 'Net::API::Stripe::Customer' ) )
3151 {
3152 $args = $_[0]->as_hash({ json => 1 });
3153 $okParams->{_cleanup} = 1;
3154 }
3155 elsif( $self->_is_object( $_[0] ) && $_[0]->isa( 'Net::API::Stripe::Payment::Card' ) )
3156 {
3157 $args = $_[0]->as_hash({ json => 1 });
3158 $args->{id} = CORE::delete( $args->{customer} );
3159 my $ref = {};
3160 @$ref{ @$card_fields } = @$args{ @$card_fields };
3161 $args->{source} = $ref;
3162 $okParams->{_cleanup} = 1;
3163 }
3164 else
3165 {
3166 $args = $self->_get_args( @_ );
3167 }
3168
3169 $args = $self->_contract( 'card', $args ) || CORE::return( $self->pass_error );
3170 my $err = $self->_check_parameters( $okParams, $args );
3171 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
3172 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No customer id was provided to create a card for the customer" ) );
3173 my $hash = $self->post( "customers/${id}/sources", $args ) || CORE::return( $self->pass_error );
3174 CORE::return( $self->error( "Cannot find property 'object' in response hash reference: ", sub{ $self->dumper( $hash ) } ) ) if( !CORE::exists( $hash->{object} ) );
3175 my $class = $self->_object_type_to_class( $hash->{object} ) || CORE::return( $self->pass_error );
3176 # CORE::return( $self->_response_to_object( 'Net::API::Stripe::Payment::Card', $hash ) );
3177 CORE::return( $self->_response_to_object( $class, $hash ) );
3178 }
3179 PERL
3180 # NOTE: card_delete()
3181 card_delete => <<'PERL',
3182 sub card_delete
3183 {
3184 my $self = shift( @_ );
3185 CORE::return( $self->error( "No parameters were provided to delete card" ) ) if( !scalar( @_ ) );
3186 my $args = {};
3187 if( $self->_is_object( $_[0] ) && $_[0]->isa( 'Net::API::Stripe::Customer' ) )
3188 {
3189 my $cust = shift( @_ );
3190 CORE::return( $self->error( "No customer id was found in this customer object." ) ) if( !$cust->id );
3191 CORE::return( $self->error( "No source is set for the credit card to delete for this customer." ) ) if( !$cust->source );
3192 CORE::return( $self->error( "No credit card id found for this customer source to delete." ) ) if( !$cust->source->id );
3193 $args->{id} = $cust->id;
3194 $args->{card_id} = $cust->source->id;
3195 $args->{expand} = 'all';
3196 }
3197 elsif( $self->_is_object( $_[0] ) && $_[0]->isa( 'Net::API::Stripe::Payment::Card' ) )
3198 {
3199 my $card = shift( @_ );
3200 CORE::return( $self->error( "No card id was found in this card object." ) ) if( !$card->id );
3201 CORE::return( $self->error( "No customer object is set for this card object." ) ) if( !$card->customer );
3202 CORE::return( $self->error( "No customer id found in the customer object in this card object." ) ) if( !$card->customer->id );
3203 $args->{card_id} = $card->id;
3204 $args->{id} = $card->customer->id;
3205 $args->{expand} = 'all';
3206 }
3207 else
3208 {
3209 $args = $self->_get_args( @_ );
3210 }
3211 my $okParams =
3212 {
3213 expandable => { allowed => $EXPANDABLES->{card} },
3214 id => { re => qr/^\w+$/, required => 1 },
3215 card_id => { re => qr/^\w+$/, required => 1 },
3216 };
3217 my $err = $self->_check_parameters( $okParams, $args );
3218 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
3219 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No customer id was provided to delete his/her card" ) );
3220 my $cardId = CORE::delete( $args->{card_id} ) || CORE::return( $self->error( "No card id was provided to delete customer's card" ) );
3221 my $hash = $self->delete( "customers/${id}/sources/${cardId}", $args ) || CORE::return( $self->pass_error );
3222 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Payment::Card', $hash ) );
3223 }
3224 PERL
3225 # NOTE: card_holder()
3226 card_holder => <<'PERL',
3227 sub card_holder { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Issuing::Card::Holder', @_ ) ); }
3228 PERL
3229 # NOTE: card_list()
3230 card_list => <<'PERL',
3231 sub card_list
3232 {
3233 my $self = shift( @_ );
3234 CORE::return( $self->error( "No parameters were provided to list customer's cards." ) ) if( !scalar( @_ ) );
3235 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Customer', @_ );
3236 my $okParams =
3237 {
3238 expandable => { allowed => $EXPANDABLES->{card}, data_prefix_is_ok => 1 },
3239 ending_before => qr/^\w+$/,
3240 id => { re => /^\w+$/, required => 1 },
3241 limit => qr/^\d+$/,
3242 starting_after => qr/^\w+$/,
3243 };
3244 my $err = $self->_check_parameters( $okParams, $args );
3245 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
3246 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No customer id was provided to list his/her cards" ) );
3247 if( $args->{expand} )
3248 {
3249 $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
3250 }
3251 my $hash = $self->get( "customers/${id}/sources", $args ) || CORE::return( $self->pass_error );
3252 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Payment::Card::List', $hash ) );
3253 }
3254 PERL
3255 # NOTE: card_retrieve()
3256 card_retrieve => <<'PERL',
3257 sub card_retrieve
3258 {
3259 my $self = shift( @_ );
3260 CORE::return( $self->error( "No parameters were provided to retrieve card information." ) ) if( !scalar( @_ ) );
3261 # my $args = $self->_get_args_from_object( 'Net::API::Stripe::Payment::Card', @_ );
3262 my $args = {};
3263 my $okParams =
3264 {
3265 expandable => { allowed => $EXPANDABLES->{card} },
3266 id => { re => qr/^\w+$/, required => 1 },
3267 customer => { re => qr/^\w+$/, required => 1 },
3268 };
3269 if( $self->_is_object( $_[0] ) && $_[0]->isa( 'Net::API::Stripe::Customer' ) )
3270 {
3271 my $cust = shift( @_ );
3272 CORE::return( $self->error( "No customer id was found in this customer object." ) ) if( !$cust->id );
3273 CORE::return( $self->error( "No source is set for the credit card to delete for this customer." ) ) if( !$cust->source );
3274 CORE::return( $self->error( "No credit card id found for this customer source to delete." ) ) if( !$cust->source->id );
3275 $args->{customer} = $cust->id;
3276 $args->{id} = $cust->source->id;
3277 $args->{expand} = 'all';
3278 $okParams->{_cleanup} = 1;
3279 }
3280 elsif( $self->_is_object( $_[0] ) && $_[0]->isa( 'Net::API::Stripe::Payment::Card' ) )
3281 {
3282 my $card = shift( @_ );
3283 CORE::return( $self->error( "No card id was found in this card object." ) ) if( !$card->id );
3284 CORE::return( $self->error( "No customer object is set for this card object." ) ) if( !$card->customer );
3285 CORE::return( $self->error( "No customer id found in the customer object in this card object." ) ) if( !$card->customer->id );
3286 $args->{customer} = $card->customer->id;
3287 $args->{expand} = 'all';
3288 $okParams->{_cleanup} = 1;
3289 }
3290 else
3291 {
3292 $args = $self->_get_args( @_ );
3293 }
3294 my $err = $self->_check_parameters( $okParams, $args );
3295 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
3296 my $id = CORE::delete( $args->{customer} ) || CORE::return( $self->error( "No customer id was provided to retrieve his/her card" ) );
3297 my $cardId = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No card id was provided to retrieve customer's card" ) );
3298 my $hash = $self->get( "customers/${id}/sources/${cardId}", $args ) || CORE::return( $self->pass_error );
3299 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Payment::Card', $hash ) );
3300 }
3301 PERL
3302 # NOTE: card_token_create()
3303 card_token_create => <<'PERL',
3304 sub card_token_create { CORE::return( shift->token_create( @_ ) ); }
3305 PERL
3306 # NOTE: card_update()
3307 card_update => <<'PERL',
3308 sub card_update
3309 {
3310 my $self = shift( @_ );
3311 CORE::return( $self->error( "No parameters were provided to update card." ) ) if( !scalar( @_ ) );
3312 my $args = {};
3313 my $okParams =
3314 {
3315 expandable => { allowed => $EXPANDABLES->{card} },
3316 id => { re => qr/^\w+$/, required => 1 },
3317 customer => { re => qr/^\w+$/, required => 1 },
3318 address_city => qr/^.*?$/,
3319 address_country => qr/^[a-zA-Z]{2}$/,
3320 address_line1 => qr/^.*?$/,
3321 address_line2 => qr/^.*?$/,
3322 address_state => qr/^.*?$/,
3323 address_zip => qr/^.*?$/,
3324 exp_month => qr/^\d{1,2}$/,
3325 exp_year => qr/^\d{1,2}$/,
3326 metadata => sub{ CORE::return( ref( $_[0] ) eq 'HASH' ? undef() : sprintf( "A hash ref was expected, but instead received '%s'", $_[0] ) ) },
3327 name => qr/^.*?$/,
3328 };
3329 if( $self->_is_object( $_[0] ) && $_[0]->isa( 'Net::API::Stripe::Customer' ) )
3330 {
3331 my $cust = shift( @_ );
3332 CORE::return( $self->error( "No customer id was found in this customer object." ) ) if( !$cust->id );
3333 CORE::return( $self->error( "No source is set for the credit card to delete for this customer." ) ) if( !$cust->source );
3334 CORE::return( $self->error( "No credit card id found for this customer source to delete." ) ) if( !$cust->source->id );
3335 $args = $cust->source->as_hash({ json => 1 });
3336 $args->{customer} = $cust->id;
3337 $args->{expand} = 'all';
3338 $okParams->{_cleanup} = 1;
3339 }
3340 elsif( $self->_is_object( $_[0] ) && $_[0]->isa( 'Net::API::Stripe::Payment::Card' ) )
3341 {
3342 my $card = shift( @_ );
3343 CORE::return( $self->error( "No card id was found in this card object." ) ) if( !$card->id );
3344 CORE::return( $self->error( "No customer object is set for this card object." ) ) if( !$card->customer );
3345 CORE::return( $self->error( "No customer id found in the customer object in this card object." ) ) if( !$card->customer->id );
3346 $args = $card->as_hash({ json => 1 });
3347 $args->{customer} = $card->customer->id;
3348 $args->{expand} = 'all';
3349 $okParams->{_cleanup} = 1;
3350 }
3351 else
3352 {
3353 $args = $self->_get_args( @_ );
3354 }
3355 $args = $self->_contract( 'card', $args ) || CORE::return( $self->pass_error );
3356 my $err = $self->_check_parameters( $okParams, $args );
3357 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
3358 my $id = CORE::delete( $args->{customer} ) || CORE::return( $self->error( "No customer id was provided to update his/her card." ) );
3359 my $cardId = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No card id was provided to update customer's card" ) );
3360 my $hash = $self->post( "customers/${id}/sources/${cardId}", $args ) || CORE::return( $self->pass_error );
3361 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Payment::Card', $hash ) );
3362 }
3363 PERL
3364 # NOTE: cards()
3365 cards => <<'PERL',
3366 sub cards
3367 {
3368 my $self = shift( @_ );
3369 my $action = shift( @_ );
3370 my $allowed = [qw( create retrieve update delete list )];
3371 my $meth = $self->_get_method( 'card', $action, $allowed ) || CORE::return( $self->pass_error );
3372 CORE::return( $self->$meth( @_ ) );
3373 }
3374 PERL
3375 # NOTE: cash_balance()
3376 cash_balance => <<'PERL',
3377 sub cash_balance { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Cash::Balance', @_ ) ); }
3378 PERL
3379 # NOTE: cash_balance_retrieve()
3380 cash_balance_retrieve => <<'PERL',
3381 sub cash_balance_retrieve
3382 {
3383 my $self = shift( @_ );
3384 CORE::return( $self->error( "No parameters were provided to retrieve a customer cash balance" ) ) if( !scalar( @_ ) );
3385 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Cash::Balance', @_ );
3386 my $okParams =
3387 {
3388 expandable => { allowed => $EXPANDABLES->{cash_balance} },
3389 customer => { re => qr/^\w+$/, required => 1 }
3390 };
3391 my $err = $self->_check_parameters( $okParams, $args );
3392 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
3393 my $cust = CORE::delete( $args->{customer} ) || CORE::return( $self->error( "No customer id was provided to retrieve his/her cash balance details" ) );
3394 my $hash = $self->get( "customers/${cust}/cash_balance", $args ) || CORE::return( $self->pass_error );
3395 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Cash::Balance', $hash ) );
3396 }
3397 PERL
3398 # NOTE: cash_balance_update()
3399 cash_balance_update => <<'PERL',
3400 sub cash_balance_update
3401 {
3402 my $self = shift( @_ );
3403 CORE::return( $self->error( "No parameters were provided to update a customer cash balance" ) ) if( !scalar( @_ ) );
3404 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Cash::Balance', @_ );
3405 my $okParams =
3406 {
3407 expandable => { allowed => $EXPANDABLES->{cash_balance} },
3408 customer => { re => qr/^\w+$/, required => 1 },
3409 settings => { fields => ["reconciliation_mode"], type => "hash" },
3410 };
3411  
3412 $args = $self->_contract( 'cash_balance', $args ) || CORE::return( $self->pass_error );
3413 # We found some errors
3414 my $err = $self->_check_parameters( $okParams, $args );
3415 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
3416 my $cust = CORE::delete( $args->{customer} ) || CORE::return( $self->error( "No customer id was provided to update his/her cash balance details" ) );
3417 my $hash = $self->post( "customers/${cust}/cash_balance", $args ) || CORE::return( $self->pass_error );
3418 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Cash::Balance', $hash ) );
3419 }
3420 PERL
3421 # NOTE: cash_balances()
3422 cash_balances => <<'PERL',
3423 sub cash_balances
3424 {
3425 my $self = shift( @_ );
3426 my $allowed = [qw( retrieve update )];
3427 my $action = shift( @_ );
3428 my $args = $self->_get_args( @_ );
3429 my $cust = CORE::delete( $args->{customer} ) || CORE::return( $self->error( "No customer id was provided to retrieve or update its cash balance details" ) );
3430 my $meth = $self->_get_method( "customers/${cust}/cash_balance", $action, $allowed ) || CORE::return( $self->pass_error );
3431 CORE::return( $self->$meth( $args ) );
3432 }
3433 PERL
3434 # NOTE: cash_transction()
3435 cash_transction => <<'PERL',
3436 sub cash_transction { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Cash::Transaction', @_ ) ); }
3437 PERL
3438 # NOTE: charge()
3439 charge => <<'PERL',
3440 sub charge { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Charge', @_ ) ); }
3441 PERL
3442 # NOTE: charge_capture()
3443 charge_capture => <<'PERL',
3444 sub charge_capture
3445 {
3446 my $self = shift( @_ );
3447 CORE::return( $self->error( "No parameters were provided to update a charge." ) ) if( !scalar( @_ ) );
3448 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Charge', @_ );
3449 my $okParams =
3450 {
3451 id => { re => qr/^\w+$/, required => 1 },
3452 amount => qr/^\d+$/,
3453 application_fee_amount => qr/^\d+$/,
3454 destination => [qw( amount )],
3455 expandable => { allowed => $EXPANDABLES->{charge} },
3456 receipt_email => qr/.*?/,
3457 statement_descriptor => qr/^.*?$/,
3458 statement_descriptor_suffix => qr/^.*?$/,
3459 transfer_data => [qw( amount )],
3460 transfer_group => qr/^.*?$/,
3461 };
3462 my $err = $self->_check_parameters( $okParams, $args );
3463 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
3464 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No charge id was provided to update its charge details." ) );
3465 CORE::return( $self->error( "Destination specified, but not account property provided" ) ) if( exists( $args->{destination} ) && !scalar( grep( /^account$/, @{$args->{destination}} ) ) );
3466 my $hash = $self->post( "charges/${id}/capture", $args ) || CORE::return( $self->pass_error );
3467 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Charge', $hash ) );
3468 }
3469 PERL
3470 # NOTE: charge_create()
3471 charge_create => <<'PERL',
3472 # https://stripe.com/docs/api/charges/create
3473 sub charge_create
3474 {
3475 my $self = shift( @_ );
3476 CORE::return( $self->error( "No parameters were provided to create charge." ) ) if( !scalar( @_ ) );
3477 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Charge', @_ );
3478 CORE::return( $self->error( "No amount was provided" ) ) if( !exists( $args->{amount} ) || !length( $args->{amount} ) );
3479 $args->{currency} ||= $self->currency;
3480 my $okParams =
3481 {
3482 expandable => { allowed => $EXPANDABLES->{charge} },
3483 amount => { re => qr/^\d+$/, required => 1, type => "integer" },
3484 application_fee_amount => qr/^\d+$/,
3485 capture => { type => "boolean" },
3486 currency => { re => qr/^[a-zA-Z]{3}$/, required => 1 },
3487 customer => qr/^\w+$/,
3488 description => qr/^.*?$/,
3489 destination => ["account", "amount"],
3490 idempotency => qr/^.*?$/,
3491 metadata => { type => "hash" },
3492 on_behalf_of => qr/^\w+$/,
3493 radar_options => { type => "hash" },
3494 receipt_email => qr/.*?/,
3495 shipping => {
3496 fields => ["address", "name", "carrier", "phone", "tracking_number"],
3497 type => "hash",
3498 },
3499 source => qr/^\w+$/,
3500 statement_descriptor => qr/^.*?$/,
3501 statement_descriptor_suffix => qr/^.*?$/,
3502 transfer_data => { fields => ["destination", "amount"], type => "hash" },
3503 transfer_group => qr/^.*?$/,
3504 };
3505  
3506
3507 $args = $self->_contract( 'charge', $args ) || CORE::return( $self->pass_error );
3508 # We found some errors
3509 my $err = $self->_check_parameters( $okParams, $args );
3510 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
3511
3512 $args->{currency} = lc( $args->{currency} );
3513 CORE::return( $self->error( "Destination specified, but no account property provided" ) ) if( exists( $args->{destination} ) && !scalar( grep( /^account$/, @{$args->{destination}} ) ) );
3514 my $hash = $self->post( 'charges', $args ) || CORE::return( $self->pass_error );
3515 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Charge', $hash ) );
3516 }
3517 PERL
3518 # NOTE: charge_list()
3519 charge_list => <<'PERL',
3520 sub charge_list
3521 {
3522 my $self = shift( @_ );
3523 my $args = shift( @_ );
3524 my $okParams =
3525 {
3526 expandable => { allowed => $EXPANDABLES->{charge}, data_prefix_is_ok => 1 },
3527 'created' => qr/^\d+$/,
3528 'created.gt' => qr/^\d+$/,
3529 'created.gte' => qr/^\d+$/,
3530 'created.lt' => qr/^\d+$/,
3531 'created.lte' => qr/^\d+$/,
3532 'customer' => qr/^\w+$/,
3533 # "A cursor for use in pagination. ending_before is an object ID that defines your place in the list."
3534 'ending_before' => qr/^\w+$/,
3535 'limit' => qr/^\d+$/,
3536 'payment_intent' => qr/^\w+$/,
3537 'source' => [qw( object )],
3538 'starting_after' => qr/^\w+$/,
3539 'transfer_group' => qr/^.*?$/,
3540 };
3541 my $err = $self->_check_parameters( $okParams, $args );
3542 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
3543 if( $args->{source} )
3544 {
3545 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)$/ );
3546 }
3547 if( $args->{expand} )
3548 {
3549 $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
3550 }
3551 my $hash = $self->get( 'charges', $args ) || CORE::return( $self->pass_error );
3552 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Charge::List', $hash ) );
3553 }
3554 PERL
3555 # NOTE: charge_retrieve()
3556 charge_retrieve => <<'PERL',
3557 sub charge_retrieve
3558 {
3559 my $self = shift( @_ );
3560 CORE::return( $self->error( "No parameters were provided to retrieve a charge" ) ) if( !scalar( @_ ) );
3561 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Charge', @_ );
3562 my $okParams =
3563 {
3564 expandable => { allowed => $EXPANDABLES->{charge} },
3565 id => { re => qr/^\w+$/, required => 1 }
3566 };
3567 my $err = $self->_check_parameters( $okParams, $args );
3568 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
3569 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No charge id was provided to retrieve its charge details" ) );
3570 my $hash = $self->get( "charges/${id}", $args ) || CORE::return( $self->pass_error );
3571 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Charge', $hash ) );
3572 }
3573 PERL
3574 # NOTE: charge_search()
3575 charge_search => <<'PERL',
3576 sub charge_search
3577 {
3578 my $self = shift( @_ );
3579 CORE::return( $self->error( "No parameters were provided to search charges." ) ) if( !scalar( @_ ) );
3580 my $args = shift( @_ );
3581 my $okParams =
3582 {
3583 expandable => { allowed => $EXPANDABLES->{charge}, data_prefix_is_ok => 1 },
3584 limit => qr/^\d+$/,
3585 page => qr/^\d+$/,
3586 query => { re => qr/^.*?$/, required => 1, type => "string" },
3587 };
3588  
3589 my $err = $self->_check_parameters( $okParams, $args );
3590 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
3591 if( $args->{expand} )
3592 {
3593 $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
3594 }
3595 my $hash = $self->get( "charges/search", $args ) || CORE::return( $self->pass_error );
3596 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Charge::List', $hash ) );
3597 }
3598 PERL
3599 # NOTE: charge_update()
3600 charge_update => <<'PERL',
3601 sub charge_update
3602 {
3603 my $self = shift( @_ );
3604 CORE::return( $self->error( "No parameters were provided to update a charge" ) ) if( !scalar( @_ ) );
3605 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Charge', @_ );
3606 my $okParams =
3607 {
3608 expandable => { allowed => $EXPANDABLES->{charge} },
3609 customer => qr/^\w+$/,
3610 description => qr/^.*?$/,
3611 fraud_details => { fields => ["user_report"], type => "hash" },
3612 id => { re => qr/^\w+$/, required => 1 },
3613 metadata => { type => "hash" },
3614 receipt_email => qr/.*?/,
3615 shipping => {
3616 fields => ["address", "name", "carrier", "phone", "tracking_number"],
3617 type => "hash",
3618 },
3619 transfer_group => qr/^.*?$/,
3620 };
3621  
3622 $args = $self->_contract( 'charge', $args ) || CORE::return( $self->pass_error );
3623 # We found some errors
3624 my $err = $self->_check_parameters( $okParams, $args );
3625 if( $args->{fraud_details} )
3626 {
3627 my $this = $args->{fraud_details};
3628 if( $this->{user_report} !~ /^(?:fraudulent|safe)$/ )
3629 {
3630 CORE::return( $self->error( "Invalid value for fraud_details. It should be either fraudulent or safe" ) );
3631 }
3632 }
3633 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
3634 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No charge id was provided to update its charge details" ) );
3635 my $hash = $self->post( "charges/${id}", $args ) || CORE::return( $self->pass_error );
3636 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Charge', $hash ) );
3637 }
3638 PERL
3639 # NOTE: charges()
3640 charges => <<'PERL',
3641 sub charges
3642 {
3643 my $self = shift( @_ );
3644 my $allowed = [qw( create retrieve update capture list search )];
3645 my $action = shift( @_ );
3646 my $args = $self->_get_args( @_ );
3647 my $meth = $self->_get_method( 'charge', $action, $allowed ) || CORE::return( $self->pass_error );
3648 CORE::return( $self->$meth( $args ) );
3649 }
3650 PERL
3651 # NOTE: checkout_session()
3652 checkout_session => <<'PERL',
3653 sub checkout_session { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Checkout::Session', @_ ) ); }
3654 PERL
3655 # NOTE: checkout_session_create()
3656 checkout_session_create => <<'PERL',
3657 sub checkout_session_create
3658 {
3659 my $self = shift( @_ );
3660 my $args = shift( @_ );
3661 my $okParams =
3662 {
3663 expandable => { allowed => $EXPANDABLES->{ 'checkout.session' } },
3664 after_expiration => { type => "hash" },
3665 allow_promotion_codes => { type => "boolean" },
3666 automatic_tax => { type => "hash" },
3667 billing_address_collection => { type => "string" },
3668 cancel_url => { type => "string", required => 1 },
3669 client_reference_id => { type => "string" },
3670 consent_collection => { type => "hash" },
3671 currency => { type => "string" },
3672 customer => { type => "string" },
3673 customer_creation => { type => "string" },
3674 customer_email => { type => "string" },
3675 customer_update => { type => "object" },
3676 discounts => { type => "array" },
3677 expires_at => { type => "timestamp" },
3678 line_items => { type => "hash" },
3679 locale => { type => "string" },
3680 metadata => { type => "hash" },
3681 mode => { type => "string" },
3682 payment_intent_data => { type => "object" },
3683 payment_method_collection => { type => "string" },
3684 payment_method_options => { type => "hash" },
3685 payment_method_types => { type => "array" },
3686 phone_number_collection => { type => "hash" },
3687 setup_intent_data => { type => "object" },
3688 shipping_address_collection => { type => "hash" },
3689 shipping_options => { type => "array" },
3690 submit_type => { type => "string" },
3691 subscription_data => { type => "object" },
3692 success_url => { type => "string", required => 1 },
3693 tax_id_collection => { type => "hash" },
3694 };
3695 $args = $self->_contract( 'checkout.session', $args ) || CORE::return( $self->pass_error );
3696 my $err = $self->_check_parameters( $okParams, $args );
3697 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
3698 my $hash = $self->post( "", $args ) || CORE::return( $self->pass_error );
3699 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Checkout::Session', $hash ) );
3700 }
3701 PERL
3702 # NOTE: checkout_session_expire()
3703 checkout_session_expire => <<'PERL',
3704 sub checkout_session_expire
3705 {
3706 my $self = shift( @_ );
3707 my $args = shift( @_ );
3708 my $okParams =
3709 {
3710 expandable => { allowed => $EXPANDABLES->{ 'checkout.session' } },
3711 };
3712 $args = $self->_contract( 'checkout.session', $args ) || CORE::return( $self->pass_error );
3713 my $err = $self->_check_parameters( $okParams, $args );
3714 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
3715 my $hash = $self->post( "", $args ) || CORE::return( $self->pass_error );
3716 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Checkout::Session', $hash ) );
3717 }
3718 PERL
3719 # NOTE: checkout_session_items()
3720 checkout_session_items => <<'PERL',
3721 sub checkout_session_items
3722 {
3723 my $self = shift( @_ );
3724 CORE::return( $self->error( "No parameters were provided to items checkout session information." ) ) if( !scalar( @_ ) );
3725 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Checkout::Session', @_ );
3726 my $okParams =
3727 {
3728 expandable => { allowed => $EXPANDABLES->{ 'checkout.session' }, data_prefix_is_ok => 1 },
3729 ending_before => { type => "string" },
3730 limit => { type => "string" },
3731 starting_after => { type => "string" },
3732 };
3733 my $err = $self->_check_parameters( $okParams, $args );
3734 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
3735 my $hash = $self->get( "", $args ) || CORE::return( $self->pass_error );
3736 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Checkout::Session', $hash ) );
3737 }
3738 PERL
3739 # NOTE: checkout_session_list()
3740 checkout_session_list => <<'PERL',
3741 sub checkout_session_list
3742 {
3743 my $self = shift( @_ );
3744 CORE::return( $self->error( "No parameters were provided to list checkout session information." ) ) if( !scalar( @_ ) );
3745 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Checkout::Session', @_ );
3746 my $okParams =
3747 {
3748 expandable => { allowed => $EXPANDABLES->{ 'checkout.session' }, data_prefix_is_ok => 1 },
3749 customer => { type => "string" },
3750 customer_details => { type => "hash" },
3751 ending_before => { type => "string" },
3752 limit => { type => "string" },
3753 payment_intent => { type => "string" },
3754 starting_after => { type => "string" },
3755 subscription => { type => "string" },
3756 };
3757 my $err = $self->_check_parameters( $okParams, $args );
3758 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
3759 if( $args->{expand} )
3760 {
3761 $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
3762 }
3763 my $hash = $self->get( "", $args ) || CORE::return( $self->pass_error );
3764 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Checkout::Session', $hash ) );
3765 }
3766 PERL
3767 # NOTE: checkout_session_retrieve()
3768 checkout_session_retrieve => <<'PERL',
3769 sub checkout_session_retrieve
3770 {
3771 my $self = shift( @_ );
3772 my $args = shift( @_ );
3773 my $okParams =
3774 {
3775 expandable => { allowed => $EXPANDABLES->{ 'checkout.session' }, data_prefix_is_ok => 1 },
3776 };
3777 $args = $self->_contract( 'checkout.session', $args ) || CORE::return( $self->pass_error );
3778 my $err = $self->_check_parameters( $okParams, $args );
3779 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
3780 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No checkout.session id (with parameter 'id') was provided to retrieve its information." ) );
3781 my $hash = $self->get( "checkout/sessions/${id}", $args ) || CORE::return( $self->pass_error );
3782 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Checkout::Session', $hash ) );
3783 }
3784 PERL
3785 # NOTE: checkout_sessions()
3786 checkout_sessions => <<'PERL',
3787 # <https://stripe.com/docs/api/checkout/sessions>
3788 sub checkout_sessions
3789 {
3790 my $self = shift( @_ );
3791 my $allowed = [qw( create expire items list retrieve )];
3792 my $action = shift( @_ );
3793 my $meth = $self->_get_method( 'checkout_session', $action, $allowed ) || CORE::return( $self->pass_error );
3794 CORE::return( $self->$meth( @_ ) );
3795 }
3796 PERL
3797 # NOTE: code_verification()
3798 code_verification => <<'PERL',
3799 sub code_verification { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Payment::Source::CodeVerification', @_ ) ); }
3800 PERL
3801 # NOTE: company()
3802 company => <<'PERL',
3803 sub company { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Connect::Account::Company', @_ ) ); }
3804 PERL
3805 # NOTE: connection_token()
3806 connection_token => <<'PERL',
3807 sub connection_token { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Terminal::ConnectionToken', @_ ) ); }
3808 PERL
3809 # NOTE: country_spec()
3810 country_spec => <<'PERL',
3811 sub country_spec { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Connect::CountrySpec', @_ ) ); }
3812 PERL
3813 # NOTE: country_spec_list()
3814 country_spec_list => <<'PERL',
3815 sub country_spec_list
3816 {
3817 my $self = shift( @_ );
3818 CORE::return( $self->error( "No parameters were provided to list country spec information." ) ) if( !scalar( @_ ) );
3819 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Connect::CountrySpec', @_ );
3820 my $okParams =
3821 {
3822 expandable => { allowed => $EXPANDABLES->{ 'country_spec' }, data_prefix_is_ok => 1 },
3823 ending_before => { type => "string" },
3824 limit => { type => "string" },
3825 starting_after => { type => "string" },
3826 };
3827 my $err = $self->_check_parameters( $okParams, $args );
3828 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
3829 if( $args->{expand} )
3830 {
3831 $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
3832 }
3833 my $hash = $self->get( "country_specs", $args ) || CORE::return( $self->pass_error );
3834 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Connect::CountrySpec', $hash ) );
3835 }
3836 PERL
3837 # NOTE: country_spec_retrieve()
3838 country_spec_retrieve => <<'PERL',
3839 sub country_spec_retrieve
3840 {
3841 my $self = shift( @_ );
3842 my $args = shift( @_ );
3843 my $okParams =
3844 {
3845 expandable => { allowed => $EXPANDABLES->{ 'country_spec' }, data_prefix_is_ok => 1 },
3846 };
3847 $args = $self->_contract( 'country_spec', $args ) || CORE::return( $self->pass_error );
3848 my $err = $self->_check_parameters( $okParams, $args );
3849 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
3850 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No country_spec id (with parameter 'id') was provided to retrieve its information." ) );
3851 my $hash = $self->get( "country_specs/${id}", $args ) || CORE::return( $self->pass_error );
3852 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Connect::CountrySpec', $hash ) );
3853 }
3854 PERL
3855 # NOTE: country_specs()
3856 country_specs => <<'PERL',
3857 # <https://stripe.com/docs/api/country_specs>
3858 sub country_specs
3859 {
3860 my $self = shift( @_ );
3861 my $allowed = [qw( list retrieve )];
3862 my $action = shift( @_ );
3863 my $meth = $self->_get_method( 'country_spec', $action, $allowed ) || CORE::return( $self->pass_error );
3864 CORE::return( $self->$meth( @_ ) );
3865 }
3866 PERL
3867 # NOTE: coupon()
3868 coupon => <<'PERL',
3869 sub coupon { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Product::Coupon', @_ ) ); }
3870 PERL
3871 # NOTE: coupon_create()
3872 coupon_create => <<'PERL',
3873 sub coupon_create
3874 {
3875 my $self = shift( @_ );
3876 CORE::return( $self->error( "No parameters were provided to create a coupon" ) ) if( !scalar( @_ ) );
3877 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Product::Coupon', @_ );
3878 my $okParams =
3879 {
3880 expandable => { allowed => $EXPANDABLES->{coupon} },
3881 amount_off => { re => qr/^\d+$/, type => "integer" },
3882 applies_to => { type => "hash" },
3883 currency => { re => qr/^[a-zA-Z]{3}$/, type => "string" },
3884 currency_options => { type => "hash" },
3885 duration => { re => qr/^(forever|once|repeating)$/, type => "string" },
3886 duration_in_months => { re => qr/^\d+$/, type => "integer" },
3887 id => { type => "string" },
3888 max_redemptions => { re => qr/^\d+$/, type => "integer" },
3889 metadata => { type => "hash" },
3890 name => { type => "string" },
3891 percent_off => sub { ... },
3892 redeem_by => { type => "timestamp" },
3893 };
3894  
3895 $args = $self->_contract( 'coupon', $args ) || CORE::return( $self->pass_error );
3896 my $err = $self->_check_parameters( $okParams, $args );
3897 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
3898 my $hash = $self->post( 'coupons', $args ) || CORE::return( $self->pass_error );
3899 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Product::Coupon', $hash ) );
3900 }
3901 PERL
3902 # NOTE: coupon_delete()
3903 coupon_delete => <<'PERL',
3904 sub coupon_delete
3905 {
3906 my $self = shift( @_ );
3907 CORE::return( $self->error( "No parameters were provided to delete coupon information." ) ) if( !scalar( @_ ) );
3908 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Product::Coupon', @_ );
3909 my $okParams =
3910 {
3911 expandable => { allowed => $EXPANDABLES->{coupon} },
3912 id => { re => qr/^\S+$/, required => 1 }
3913 };
3914 my $err = $self->_check_parameters( $okParams, $args );
3915 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
3916 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No coupon id was provided to delete its information." ) );
3917 my $hash = $self->delete( "coupons/${id}", $args ) || CORE::return( $self->pass_error );
3918 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Product::Coupon', $hash ) );
3919 }
3920 PERL
3921 # NOTE: coupon_list()
3922 coupon_list => <<'PERL',
3923 sub coupon_list
3924 {
3925 my $self = shift( @_ );
3926 my $args = shift( @_ );
3927 my $okParams =
3928 {
3929 expandable => { allowed => $EXPANDABLES->{coupon} },
3930 'created' => qr/^\d+$/,
3931 'created.gt' => qr/^\d+$/,
3932 'created.gte' => qr/^\d+$/,
3933 'created.lt' => qr/^\d+$/,
3934 'created.lte' => qr/^\d+$/,
3935 # "A cursor for use in pagination. ending_before is an object ID that defines your place in the list."
3936 'ending_before' => qr/^\w+$/,
3937 'limit' => qr/^\d+$/,
3938 'starting_after' => qr/^\w+$/,
3939 };
3940 my $err = $self->_check_parameters( $okParams, $args );
3941 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
3942 if( $args->{expand} )
3943 {
3944 $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
3945 }
3946 my $hash = $self->get( 'coupons', $args ) || CORE::return( $self->pass_error );
3947 CORE::return( $self->_response_to_object( 'Net::API::Stripe::List', $hash ) );
3948 }
3949 PERL
3950 # NOTE: coupon_retrieve()
3951 coupon_retrieve => <<'PERL',
3952 sub coupon_retrieve
3953 {
3954 my $self = shift( @_ );
3955 CORE::return( $self->error( "No parameters were provided to retrieve coupon information." ) ) if( !scalar( @_ ) );
3956 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Product::Coupon', @_ );
3957 my $okParams =
3958 {
3959 expandable => { allowed => $EXPANDABLES->{coupon} },
3960 id => { re => qr/^\S+$/, required => 1 }
3961 };
3962 my $err = $self->_check_parameters( $okParams, $args );
3963 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
3964 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No coupon id was provided to retrieve its information." ) );
3965 my $hash = $self->get( "coupons/${id}", $args ) || CORE::return( $self->pass_error );
3966 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Product::Coupon', $hash ) );
3967 }
3968 PERL
3969 # NOTE: coupon_update()
3970 coupon_update => <<'PERL',
3971 sub coupon_update
3972 {
3973 my $self = shift( @_ );
3974 CORE::return( $self->error( "No parameters were provided to update a coupon" ) ) if( !scalar( @_ ) );
3975 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Product::Coupon', @_ );
3976 my $okParams =
3977 {
3978 expandable => { allowed => $EXPANDABLES->{coupon} },
3979 currency_options => { type => "hash" },
3980 id => { re => qr/^\S+$/, required => 1 },
3981 metadata => { type => "hash" },
3982 name => { type => "string" },
3983 };
3984  
3985 $args = $self->_contract( 'coupon', $args ) || CORE::return( $self->pass_error );
3986 # We found some errors
3987 my $err = $self->_check_parameters( $okParams, $args );
3988 # $self->message( 3, "Data to be posted: ", $self->dumper( $args ) ); exit;
3989 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
3990 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No coupon id was provided to update coupon's details" ) );
3991 my $hash = $self->post( "coupons/${id}", $args ) || CORE::return( $self->pass_error );
3992 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Product::Coupon', $hash ) );
3993 }
3994 PERL
3995 # NOTE: coupons()
3996 coupons => <<'PERL',
3997 sub coupons
3998 {
3999 my $self = shift( @_ );
4000 my $action = shift( @_ );
4001 my $allowed = [qw( create retrieve update delete list )];
4002 my $meth = $self->_get_method( 'coupon', $action, $allowed ) || CORE::return( $self->pass_error );
4003 CORE::return( $self->$meth( @_ ) );
4004 }
4005 PERL
4006 # NOTE: credit_note()
4007 credit_note => <<'PERL',
4008 sub credit_note { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Billing::CreditNote', @_ ) ); }
4009 PERL
4010 # NOTE: credit_note_create()
4011 credit_note_create => <<'PERL',
4012 sub credit_note_create
4013 {
4014 my $self = shift( @_ );
4015 CORE::return( $self->error( "No parameters were provided to create a credit note" ) ) if( !scalar( @_ ) );
4016 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Billing::CreditNote', @_ );
4017 # If we are provided with an invoice object, we change our value for only its id
4018 if( $args->{_object} &&
4019 $self->_is_object( $args->{_object}->{invoice} ) &&
4020 $args->{_object}->invoice->isa( 'Net::API::Stripe::Billing::Invoice' ) )
4021 {
4022 my $cred = CORE::delete( $args->{_object} );
4023 $args->{invoice} = $cred->invoice->id || CORE::return( $self->error( "The Invoice object provided for this credit note has no id." ) );
4024 }
4025
4026 my $okParams =
4027 {
4028 expandable => { allowed => $EXPANDABLES->{credit_note} },
4029 amount => { re => qr/^\d+$/, type => "integer" },
4030 credit_amount => { re => qr/^\d+$/, type => "integer" },
4031 invoice => { re => qr/^\w+$/, required => 1, type => "string" },
4032 lines => {
4033 fields => [
4034 "amount",
4035 "description",
4036 "invoice_line_item",
4037 "quantity",
4038 "tax_rates",
4039 "type",
4040 "unit_amount",
4041 "unit_amount_decimal",
4042 ],
4043 type => "array",
4044 },
4045 memo => { type => "string" },
4046 metadata => { type => "hash" },
4047 out_of_band_amount => { re => qr/^\d+$/, type => "integer" },
4048 reason => {
4049 re => qr/^(duplicate|fraudulent|order_change|product_unsatisfactory)$/,
4050 type => "string",
4051 },
4052 refund => { re => qr/^\w+$/, type => "string" },
4053 refund_amount => { re => qr/^\d+$/, type => "integer" },
4054 };
4055  
4056 $args = $self->_contract( 'credit_note', $args ) || CORE::return( $self->pass_error );
4057 my $err = $self->_check_parameters( $okParams, $args );
4058 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
4059 my $hash = $self->post( 'credit_notes', $args ) || CORE::return( $self->pass_error );
4060 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::CreditNote', $hash ) );
4061 }
4062 PERL
4063 # NOTE: credit_note_line_item()
4064 credit_note_line_item => <<'PERL',
4065 sub credit_note_line_item { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Billing::CreditNote::LineItem', @_ ) ); }
4066 PERL
4067 # NOTE: credit_note_line_item_list()
4068 credit_note_line_item_list => <<'PERL',
4069 sub credit_note_line_item_list
4070 {
4071 my $self = shift( @_ );
4072 CORE::return( $self->error( "No parameters were provided to list credit note line item information." ) ) if( !scalar( @_ ) );
4073 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Billing::CreditNote::LineItem', @_ );
4074 my $okParams =
4075 {
4076 expandable => { allowed => $EXPANDABLES->{ 'credit_note_line_item' }, data_prefix_is_ok => 1 },
4077 amount => { type => "integer" },
4078 credit_amount => { type => "string" },
4079 ending_before => { type => "string" },
4080 invoice => { type => "string", required => 1 },
4081 limit => { type => "string" },
4082 lines => { type => "string" },
4083 memo => { type => "string" },
4084 metadata => { type => "string" },
4085 out_of_band_amount => { type => "string" },
4086 reason => { type => "string" },
4087 refund => { type => "string" },
4088 refund_amount => { type => "string" },
4089 starting_after => { type => "string" },
4090 };
4091 my $err = $self->_check_parameters( $okParams, $args );
4092 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
4093 if( $args->{expand} )
4094 {
4095 $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
4096 }
4097 my $hash = $self->get( "credit_notes/preview/lines", $args ) || CORE::return( $self->pass_error );
4098 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::CreditNote::LineItem', $hash ) );
4099 }
4100 PERL
4101 # NOTE: credit_note_line_items()
4102 credit_note_line_items => <<'PERL',
4103 # <https://stripe.com/docs/api/credit_notes>
4104 sub credit_note_line_items
4105 {
4106 my $self = shift( @_ );
4107 my $allowed = [qw( list )];
4108 my $action = shift( @_ );
4109 my $meth = $self->_get_method( 'credit_note_line_item', $action, $allowed ) || CORE::return( $self->pass_error );
4110 CORE::return( $self->$meth( @_ ) );
4111 }
4112 PERL
4113 # NOTE: credit_note_lines()
4114 credit_note_lines => <<'PERL',
4115 sub credit_note_lines
4116 {
4117 my $self = shift( @_ );
4118 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Billing::CreditNote', @_ );
4119 CORE::return( $self->error( "No credit note id was provided to retrieve its information." ) ) if( !CORE::length( $args->{id} ) );
4120 my $okParams =
4121 {
4122 id => { re => qr/^\w+$/, required => 1 },
4123 # "A cursor for use in pagination. ending_before is an object ID that defines your place in the list."
4124 ending_before => { re => qr/^\w+$/ },
4125 limit => { re => qr/^\d+$/ },
4126 starting_after => { re => qr/^\w+$/ },
4127 };
4128 my $err = $self->_check_parameters( $okParams, $args );
4129 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
4130 my $id = CORE::delete( $args->{id} );
4131 my $hash = $self->get( "credit_notes/${id}/lines", $args ) || CORE::return( $self->pass_error );
4132 CORE::return( $self->_response_to_object( 'Net::API::Stripe::List', $hash ) );
4133 }
4134 PERL
4135 # NOTE: credit_note_lines_preview()
4136 credit_note_lines_preview => <<'PERL',
4137 sub credit_note_lines_preview
4138 {
4139 my $self = shift( @_ );
4140 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Billing::CreditNote', @_ );
4141 # CORE::return( $self->error( "No credit note id was provided to retrieve its information." ) ) if( !CORE::length( $args->{id} ) );
4142 CORE::return( $self->error( "No invoice id or object was provided." ) ) if( !CORE::length( $args->{invoice} ) );
4143 if( $args->{_object} &&
4144 $self->_is_object( $args->{_object}->{invoice} ) &&
4145 $args->{_object}->invoice->isa( 'Net::API::Stripe::Billing::Invoice' ) )
4146 {
4147 my $cred = CORE::delete( $args->{_object} );
4148 $args->{invoice} = $cred->invoice->id || CORE::return( $self->error( "The Invoice object provided for this credit note has no id." ) );
4149 }
4150
4151 my $okParams =
4152 {
4153 expandable => { allowed => $EXPANDABLES->{credit_note_lines} },
4154 # id => { re => qr/^\w+$/, required => 1 },
4155 invoice => { re => qr/^\w+$/, required => 1 },
4156 amount => { re => qr/^\d+$/ },
4157 credit_amount => { re => qr/^\d+$/ },
4158 ending_before => { re => qr/^\w+$/ },
4159 limit => { re => qr/^\d+$/ },
4160 lines => { type => 'array', fields => [qw( amount description invoice_line_item quantity tax_rates type unit_amount unit_amount_decimal )] },
4161 memo => {},
4162 metadata => { type => 'hash' },
4163 out_of_band_amount => { re => qr/^\d+$/ },
4164 reason => { re => qr/^(duplicate|fraudulent|order_change|product_unsatisfactory)$/ },
4165 refund => { re => qr/^\w+$/ },
4166 refund_amount => { re => qr/^\d+$/ },
4167 starting_after => { re => qr/^\w+$/ },
4168 };
4169 my $err = $self->_check_parameters( $okParams, $args );
4170 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
4171 my $id = CORE::delete( $args->{id} );
4172 my $hash = $self->get( "credit_notes/preview/${id}/lines", $args ) || CORE::return( $self->pass_error );
4173 CORE::return( $self->_response_to_object( 'Net::API::Stripe::List', $hash ) );
4174 }
4175 PERL
4176 # NOTE: credit_note_list()
4177 credit_note_list => <<'PERL',
4178 sub credit_note_list
4179 {
4180 my $self = shift( @_ );
4181 my $args = shift( @_ );
4182 my $okParams =
4183 {
4184 expandable => { allowed => $EXPANDABLES->{credit_note}, data_prefix_is_ok => 1 },
4185 created => qr/^\d+$/,
4186 'created.gt' => qr/^\d+$/,
4187 'created.gte' => qr/^\d+$/,
4188 'created.lt' => qr/^\d+$/,
4189 'created.lte' => qr/^\d+$/,
4190 customer => { type => "string" },
4191 ending_before => qr/^\w+$/,
4192 invoice => { type => "string" },
4193 limit => qr/^\d+$/,
4194 starting_after => qr/^\w+$/,
4195 };
4196  
4197 my $err = $self->_check_parameters( $okParams, $args );
4198 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
4199 if( $args->{expand} )
4200 {
4201 $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
4202 }
4203 my $hash = $self->get( 'coupons', $args ) || CORE::return( $self->pass_error );
4204 CORE::return( $self->_response_to_object( 'Net::API::Stripe::List', $hash ) );
4205 }
4206 PERL
4207 # NOTE: credit_note_preview()
4208 credit_note_preview => <<'PERL',
4209 sub credit_note_preview
4210 {
4211 my $self = shift( @_ );
4212 CORE::return( $self->error( "No parameters were provided to preview a credit note" ) ) if( !scalar( @_ ) );
4213 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Billing::CreditNote', @_ );
4214
4215 my $obj = $args->{_object};
4216 # If we are provided with an invoice object, we change our value for only its id
4217 if( $obj && $obj->invoice )
4218 {
4219 $args->{invoice} = $obj->invoice->id || CORE::return( $self->error( "The Invoice object provided for this credit note has no id." ) );
4220 }
4221
4222 my $okParams =
4223 {
4224 expandable => { allowed => $EXPANDABLES->{credit_note}, data_prefix_is_ok => 1 },
4225 amount => { re => qr/^\d+$/, type => "integer" },
4226 credit_amount => { re => qr/^\d+$/, type => "string" },
4227 invoice => { required => 1, type => "string" },
4228 lines => {
4229 fields => [
4230 "amount",
4231 "description",
4232 "invoice_line_item",
4233 "quantity",
4234 "tax_rates",
4235 "type",
4236 "unit_amount",
4237 "unit_amount_decimal",
4238 ],
4239 type => "array",
4240 },
4241 memo => { type => "string" },
4242 metadata => { type => "hash" },
4243 out_of_band_amount => { re => qr/^\d+$/, type => "integer" },
4244 reason => {
4245 re => qr/^(duplicate|fraudulent|order_change|product_unsatisfactory)$/,
4246 type => "string",
4247 },
4248 refund => { re => qr/^\w+$/, type => "string" },
4249 refund_amount => { re => qr/^\d+$/, type => "string" },
4250 };
4251  
4252 my $err = $self->_check_parameters( $okParams, $args );
4253 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
4254 my $hash = $self->post( 'credit_notes/preview', $args ) || CORE::return( $self->pass_error );
4255 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::CreditNote', $hash ) );
4256 }
4257 PERL
4258 # NOTE: credit_note_retrieve()
4259 credit_note_retrieve => <<'PERL',
4260 sub credit_note_retrieve
4261 {
4262 my $self = shift( @_ );
4263 CORE::return( $self->error( "No parameters were provided to retrieve credit note information." ) ) if( !scalar( @_ ) );
4264 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Billing::CreditNote', @_ );
4265 my $okParams =
4266 {
4267 expandable => { allowed => $EXPANDABLES->{credit_note} },
4268 id => { re => qr/^\w+$/, required => 1 }
4269 };
4270 my $err = $self->_check_parameters( $okParams, $args );
4271 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
4272 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No credit note id was provided to retrieve its information." ) );
4273 my $hash = $self->get( "credit_notes/${id}", $args ) || CORE::return( $self->pass_error );
4274 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::CreditNote', $hash ) );
4275 }
4276 PERL
4277 # NOTE: credit_note_update()
4278 credit_note_update => <<'PERL',
4279 sub credit_note_update
4280 {
4281 my $self = shift( @_ );
4282 CORE::return( $self->error( "No parameters were provided to update a credit note" ) ) if( !scalar( @_ ) );
4283 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Billing::CreditNote', @_ );
4284 my $okParams =
4285 {
4286 expandable => { allowed => $EXPANDABLES->{credit_note} },
4287 id => { re => qr/^\w+$/, required => 1 },
4288 memo => { type => "string" },
4289 metadata => { type => "hash" },
4290 };
4291  
4292 $args = $self->_contract( 'credit_note', $args ) || CORE::return( $self->pass_error );
4293 # We found some errors
4294 my $err = $self->_check_parameters( $okParams, $args );
4295 # $self->message( 3, "Data to be posted: ", $self->dumper( $args ) ); exit;
4296 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
4297 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No credit note id was provided to update credit note's details" ) );
4298 my $hash = $self->post( "credit_notes/${id}", $args ) || CORE::return( $self->pass_error );
4299 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::CreditNote', $hash ) );
4300 }
4301 PERL
4302 # NOTE: credit_note_void()
4303 credit_note_void => <<'PERL',
4304 sub credit_note_void
4305 {
4306 my $self = shift( @_ );
4307 CORE::return( $self->error( "No parameters were provided to void credit note information." ) ) if( !scalar( @_ ) );
4308 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Billing::CreditNote', @_ );
4309 my $okParams =
4310 {
4311 expandable => { allowed => $EXPANDABLES->{credit_note} },
4312 id => { re => qr/^\w+$/, required => 1 }
4313 };
4314 my $err = $self->_check_parameters( $okParams, $args );
4315 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
4316 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No credit note id was provided to void it." ) );
4317 my $hash = $self->post( "credit_notes/${id}/void", $args ) || CORE::return( $self->pass_error );
4318 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::CreditNote', $hash ) );
4319 }
4320 PERL
4321 # NOTE: credit_notes()
4322 credit_notes => <<'PERL',
4323 sub credit_notes
4324 {
4325 my $self = shift( @_ );
4326 my $action = shift( @_ );
4327 # delete is an alias of void to make it more mnemotechnical to remember
4328 $action = 'void' if( $action eq 'delete' );
4329 my $allowed = [qw( preview create lines lines_preview retrieve update void list )];
4330 my $meth = $self->_get_method( 'coupons', $action, $allowed ) || CORE::return( $self->pass_error );
4331 CORE::return( $self->$meth( @_ ) );
4332 }
4333 PERL
4334 # NOTE: customer()
4335 customer => <<'PERL',
4336 sub customer { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Customer', @_ ) ); }
4337 PERL
4338 # NOTE: customer_balance_transaction()
4339 customer_balance_transaction => <<'PERL',
4340 sub customer_balance_transaction { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Customer::BalanceTransaction', @_ ) ); }
4341 PERL
4342 # NOTE: customer_balance_transaction_create()
4343 customer_balance_transaction_create => <<'PERL',
4344 sub customer_balance_transaction_create
4345 {
4346 my $self = shift( @_ );
4347 CORE::return( $self->error( "No parameters were provided to create a customer balance transaction" ) ) if( !scalar( @_ ) );
4348 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Customer::BalanceTransaction', @_ );
4349 my $okParams =
4350 {
4351 expandable => { allowed => $EXPANDABLES->{customer_balance_transaction} },
4352 amount => { re => qr/^\d+$/, required => 1, type => "integer" },
4353 currency => { re => qr/^[A-Z]{3}$/, required => 1, type => "string" },
4354 customer => { re => qr/^\w+$/, required => 1 },
4355 description => { type => "string" },
4356 metadata => { type => "hash" },
4357 };
4358  
4359 $args = $self->_contract( 'customer_balance_transaction', $args ) || CORE::return( $self->pass_error );
4360 my $err = $self->_check_parameters( $okParams, $args );
4361 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
4362 my $id = CORE::delete( $args->{customer} ) || CORE::return( $self->error( "No customer id was provided to create a balance transaction." ) );
4363 my $hash = $self->post( "customers/${id}/balance_transactions" ) || CORE::return( $self->pass_error );
4364 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Customer::BalanceTransaction', $hash ) );
4365 }
4366 PERL
4367 # NOTE: customer_balance_transaction_list()
4368 customer_balance_transaction_list => <<'PERL',
4369 sub customer_balance_transaction_list
4370 {
4371 my $self = shift( @_ );
4372 my $args = shift( @_ );
4373 my $okParams =
4374 {
4375 expandable => { allowed => $EXPANDABLES->{customer_balance_transaction}, data_prefix_is_ok => 1 },
4376 customer => { re => qr/^\w+$/, required => 1 },
4377 # "A cursor for use in pagination. ending_before is an object ID that defines your place in the list."
4378 'ending_before' => qr/^\w+$/,
4379 'limit' => qr/^\d+$/,
4380 'starting_after' => qr/^\w+$/,
4381 };
4382 my $err = $self->_check_parameters( $okParams, $args );
4383 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
4384 my $cust = CORE::delete( $args->{customer} ) || CORE::return( $self->error( "No customer id was provided to get a list of his/her balance transactions." ) );
4385 if( $args->{expand} )
4386 {
4387 $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
4388 }
4389 my $hash = $self->get( "customers/${cust}/balance_transactions", $args ) || CORE::return( $self->pass_error );
4390 CORE::return( $self->_response_to_object( 'Net::API::Stripe::List', $hash ) );
4391 }
4392 PERL
4393 # NOTE: customer_balance_transaction_retrieve()
4394 customer_balance_transaction_retrieve => <<'PERL',
4395 sub customer_balance_transaction_retrieve
4396 {
4397 my $self = shift( @_ );
4398 CORE::return( $self->error( "No parameters were provided to retrieve customer balance transaction information." ) ) if( !scalar( @_ ) );
4399 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Customer::BalanceTransaction', @_ );
4400 my $okParams =
4401 {
4402 expandable => { allowed => $EXPANDABLES->{customer_balance_transaction} },
4403 id => { re => qr/^\w+$/, required => 1 },
4404 customer => { re => qr/^\w+$/, required => 1 },
4405 };
4406 my $err = $self->_check_parameters( $okParams, $args );
4407 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
4408 my $cust = CORE::delete( $args->{customer} ) || CORE::return( $self->error( "No customer id was provided to retrieve his/her bank account information." ) );
4409 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No customer balance transaction information id was provided to retrieve its information." ) );
4410 my $hash = $self->get( "customers/${cust}/balance_transactions/${id}", $args ) || CORE::return( $self->pass_error );
4411 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Customer::BalanceTransaction', $hash ) );
4412 }
4413 PERL
4414 # NOTE: customer_balance_transaction_update()
4415 customer_balance_transaction_update => <<'PERL',
4416 sub customer_balance_transaction_update
4417 {
4418 my $self = shift( @_ );
4419 CORE::return( $self->error( "No parameters were provided to update the customer balance transaction" ) ) if( !scalar( @_ ) );
4420 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Customer::BalanceTransaction', @_ );
4421 my $okParams =
4422 {
4423 expandable => { allowed => $EXPANDABLES->{customer_balance_transaction} },
4424 customer => { re => qr/^\w+$/, required => 1 },
4425 description => { type => "string" },
4426 id => { re => qr/^\w+$/, required => 1 },
4427 metadata => { type => "hash" },
4428 };
4429  
4430 $args = $self->_contract( 'customer_bank_account', $args ) || CORE::return( $self->pass_error );
4431 # We found some errors
4432 my $err = $self->_check_parameters( $okParams, $args );
4433 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
4434 my $cust = CORE::delete( $args->{customer} ) || CORE::return( $self->error( "No customer id was provided to update the customer's balance transaction details" ) );
4435 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No balance transaction id was provided to update its details" ) );
4436 my $hash = $self->post( "customers/${cust}/balance_transactions/${id}", $args ) || CORE::return( $self->pass_error );
4437 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Customer::BalanceTransaction', $hash ) );
4438 }
4439 PERL
4440 # NOTE: customer_balance_transactions()
4441 customer_balance_transactions => <<'PERL',
4442 sub customer_balance_transactions
4443 {
4444 my $self = shift( @_ );
4445 my $allowed = [qw( create retrieve update list )];
4446 my $action = shift( @_ );
4447 my $meth = $self->_get_method( 'customer_balance_transaction', $action, $allowed ) || CORE::return( $self->pass_error );
4448 CORE::return( $self->$meth( @_ ) );
4449 }
4450 PERL
4451 # NOTE: customer_bank_account()
4452 customer_bank_account => <<'PERL',
4453 sub customer_bank_account { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Customer::BankAccount', @_ ) ); }
4454 PERL
4455 # NOTE: customer_bank_account_create()
4456 customer_bank_account_create => <<'PERL',
4457 sub customer_bank_account_create
4458 {
4459 my $self = shift( @_ );
4460 CORE::return( $self->error( "No parameters were provided to create a customer bank account" ) ) if( !scalar( @_ ) );
4461 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Payment::Source', @_ );
4462 my $okParams =
4463 {
4464 expandable => { allowed => $EXPANDABLES->{customer_bank_account} },
4465 id => { re => qr/^\w+$/, required => 1 },
4466 object => { type => 'string', re => qr/^bank_account$/ },
4467 country => { re => qr/^[A-Z]{2}$/, required => 1 },
4468 currency => { re => qr/^[A-Z]{3}$/, required => 1 },
4469 account_holder_name => { re => qr/^.*?$/ },
4470 account_holder_type => { re => qr/^.*?$/ },
4471 routing_number => {},
4472 account_number => {},
4473 metadata => { type => 'hash' },
4474 };
4475 $args = $self->_contract( 'customer_bank_account', $args ) || CORE::return( $self->pass_error );
4476 my $err = $self->_check_parameters( $okParams, $args );
4477 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
4478 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No customer id was provided to create a bank account." ) );
4479 my $hash = $self->post( "customers/${id}/sources" ) || CORE::return( $self->pass_error );
4480 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Customer::BankAccount', $hash ) );
4481 }
4482 PERL
4483 # NOTE: customer_bank_account_delete()
4484 customer_bank_account_delete => <<'PERL',
4485 sub customer_bank_account_delete
4486 {
4487 my $self = shift( @_ );
4488 CORE::return( $self->error( "No parameters were provided to delete customer bank account." ) ) if( !scalar( @_ ) );
4489 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Customer::BankAccount', @_ );
4490 my $okParams =
4491 {
4492 expandable => { allowed => $EXPANDABLES->{customer_bank_account} },
4493 id => { re => qr/^\w+$/, required => 1 },
4494 customer => { re => qr/^\w+$/, required => 1 },
4495 };
4496 my $err = $self->_check_parameters( $okParams, $args );
4497 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
4498 my $cust = CORE::delete( $args->{customer} ) || CORE::return( $self->error( "No customer id was provided to delete his/her bank account." ) );
4499 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No customer bank accuont id was provided to delete." ) );
4500 my $hash = $self->delete( "customers/${cust}/sources/${id}" ) || CORE::return( $self->pass_error );
4501 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Customer::BankAccount', $hash ) );
4502 }
4503 PERL
4504 # NOTE: customer_bank_account_list()
4505 customer_bank_account_list => <<'PERL',
4506 sub customer_bank_account_list
4507 {
4508 my $self = shift( @_ );
4509 my $args = shift( @_ );
4510 my $okParams =
4511 {
4512 expandable => { allowed => $EXPANDABLES->{customer_bank_account}, data_prefix_is_ok => 1 },
4513 customer => { re => qr/^\w+$/, required => 1 },
4514 # "A cursor for use in pagination. ending_before is an object ID that defines your place in the list."
4515 'ending_before' => qr/^\w+$/,
4516 'limit' => qr/^\d+$/,
4517 'starting_after' => qr/^\w+$/,
4518 };
4519 my $err = $self->_check_parameters( $okParams, $args );
4520 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
4521 my $cust = CORE::delete( $args->{customer} ) || CORE::return( $self->error( "No customer id was provided to get a list of his/her bank accounts." ) );
4522 if( $args->{expand} )
4523 {
4524 $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
4525 }
4526 my $hash = $self->get( "customers/${cust}/sources", $args ) || CORE::return( $self->pass_error );
4527 CORE::return( $self->_response_to_object( 'Net::API::Stripe::List', $hash ) );
4528 }
4529 PERL
4530 # NOTE: customer_bank_account_retrieve()
4531 customer_bank_account_retrieve => <<'PERL',
4532 sub customer_bank_account_retrieve
4533 {
4534 my $self = shift( @_ );
4535 CORE::return( $self->error( "No parameters were provided to retrieve customer bank account information." ) ) if( !scalar( @_ ) );
4536 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Customer::BankAccount', @_ );
4537 my $okParams =
4538 {
4539 expandable => { allowed => $EXPANDABLES->{customer_bank_account} },
4540 id => { re => qr/^\w+$/, required => 1 },
4541 customer => { re => qr/^\w+$/, required => 1 },
4542 };
4543 my $err = $self->_check_parameters( $okParams, $args );
4544 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
4545 my $cust = CORE::delete( $args->{customer} ) || CORE::return( $self->error( "No customer id was provided to retrieve his/her bank account information." ) );
4546 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No customer bank account id was provided to retrieve its information." ) );
4547 my $hash = $self->get( "customers/${cust}/sources/${id}", $args ) || CORE::return( $self->pass_error );
4548 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Customer::BankAccount', $hash ) );
4549 }
4550 PERL
4551 # NOTE: customer_bank_account_update()
4552 customer_bank_account_update => <<'PERL',
4553 sub customer_bank_account_update
4554 {
4555 my $self = shift( @_ );
4556 CORE::return( $self->error( "No parameters were provided to update the customer bank account" ) ) if( !scalar( @_ ) );
4557 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Customer::BankAccount', @_ );
4558 my $okParams =
4559 {
4560 expandable => { allowed => $EXPANDABLES->{customer_bank_account} },
4561 id => { re => qr/^\w+$/, required => 1 },
4562 customer => { re => qr/^\w+$/, required => 1 },
4563 account_holder_name => { re => qr/^.*?$/ },
4564 account_holder_type => {},
4565 metadata => { type => 'hash' },
4566 };
4567 $args = $self->_contract( 'customer_bank_account', $args ) || CORE::return( $self->pass_error );
4568 # We found some errors
4569 my $err = $self->_check_parameters( $okParams, $args );
4570 # $self->message( 3, "Data to be posted: ", $self->dumper( $args ) ); exit;
4571 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
4572 my $cust = CORE::delete( $args->{customer} ) || CORE::return( $self->error( "No customer id was provided to update the customer's bank account details" ) );
4573 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No bank account id was provided to update its details" ) );
4574 my $hash = $self->post( "customers/${cust}/sources/${id}", $args ) || CORE::return( $self->pass_error );
4575 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Customer::BankAccount', $hash ) );
4576 }
4577 PERL
4578 # NOTE: customer_bank_account_verify()
4579 customer_bank_account_verify => <<'PERL',
4580 sub customer_bank_account_verify
4581 {
4582 my $self = shift( @_ );
4583 CORE::return( $self->error( "No parameters were provided to verify customer bank account information." ) ) if( !scalar( @_ ) );
4584 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Customer::BankAccount', @_ );
4585 my $okParams =
4586 {
4587 expandable => { allowed => $EXPANDABLES->{customer_bank_account} },
4588 id => { re => qr/^\w+$/, required => 1 },
4589 customer => { re => qr/^\w+$/, required => 1 },
4590 amounts => { type => 'array', re => qr/^\d+$/ },
4591 };
4592 my $err = $self->_check_parameters( $okParams, $args );
4593 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
4594 my $cust = CORE::delete( $args->{customer} ) || CORE::return( $self->error( "No customer id was provided to verify his/her bank account." ) );
4595 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No customer bank account id was provided to verify." ) );
4596 my $hash = $self->post( "customers/${cust}/sources/${id}/verify", $args ) || CORE::return( $self->pass_error );
4597 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Customer::BankAccount', $hash ) );
4598 }
4599 PERL
4600 # NOTE: customer_bank_accounts()
4601 customer_bank_accounts => <<'PERL',
4602 sub customer_bank_accounts
4603 {
4604 my $self = shift( @_ );
4605 my $action = shift( @_ );
4606 my $allowed = [qw( create retrieve update verify delete list )];
4607 my $meth = $self->_get_method( 'customer', $action, $allowed ) || CORE::return( $self->pass_error );
4608 CORE::return( $self->$meth( @_ ) );
4609 }
4610 PERL
4611 # NOTE: customer_cash_balance_transaction()
4612 customer_cash_balance_transaction => <<'PERL',
4613 sub customer_cash_balance_transaction { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Cash::Transaction', @_ ) ); }
4614 PERL
4615 # NOTE: customer_cash_balance_transaction_fund_cash_balance()
4616 customer_cash_balance_transaction_fund_cash_balance => <<'PERL',
4617 sub customer_cash_balance_transaction_fund_cash_balance
4618 {
4619 my $self = shift( @_ );
4620 my $args = shift( @_ );
4621 my $okParams =
4622 {
4623 expandable => { allowed => $EXPANDABLES->{ 'customer_cash_balance_transaction' } },
4624 amount => { type => "integer", required => 1 },
4625 currency => { type => "string", required => 1 },
4626 reference => { type => "string" },
4627 };
4628 $args = $self->_contract( 'customer_cash_balance_transaction', $args ) || CORE::return( $self->pass_error );
4629 my $err = $self->_check_parameters( $okParams, $args );
4630 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
4631 my $customer = CORE::delete( $args->{customer} ) || CORE::return( $self->error( "No customer id (with parameter 'customer') was provided to fund_cash_balance its information." ) );
4632 my $hash = $self->post( "test_helpers/customers/${customer}/fund_cash_balance", $args ) || CORE::return( $self->pass_error );
4633 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Cash::Transaction', $hash ) );
4634 }
4635 PERL
4636 # NOTE: customer_cash_balance_transaction_list()
4637 customer_cash_balance_transaction_list => <<'PERL',
4638 sub customer_cash_balance_transaction_list
4639 {
4640 my $self = shift( @_ );
4641 CORE::return( $self->error( "No parameters were provided to list customer cash balance transaction information." ) ) if( !scalar( @_ ) );
4642 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Cash::Transaction', @_ );
4643 my $okParams =
4644 {
4645 expandable => { allowed => $EXPANDABLES->{ 'customer_cash_balance_transaction' }, data_prefix_is_ok => 1 },
4646 ending_before => { type => "string" },
4647 limit => { type => "string" },
4648 starting_after => { type => "string" },
4649 };
4650 my $err = $self->_check_parameters( $okParams, $args );
4651 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
4652 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No customer id (with parameter 'id') was provided to list its information." ) );
4653 if( $args->{expand} )
4654 {
4655 $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
4656 }
4657 my $hash = $self->get( "customers/${id}/cash_balance_transactions", $args ) || CORE::return( $self->pass_error );
4658 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Cash::Transaction', $hash ) );
4659 }
4660 PERL
4661 # NOTE: customer_cash_balance_transaction_retrieve()
4662 customer_cash_balance_transaction_retrieve => <<'PERL',
4663 sub customer_cash_balance_transaction_retrieve
4664 {
4665 my $self = shift( @_ );
4666 my $args = shift( @_ );
4667 my $okParams =
4668 {
4669 expandable => { allowed => $EXPANDABLES->{ 'customer_cash_balance_transaction' }, data_prefix_is_ok => 1 },
4670 };
4671 $args = $self->_contract( 'customer_cash_balance_transaction', $args ) || CORE::return( $self->pass_error );
4672 my $err = $self->_check_parameters( $okParams, $args );
4673 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
4674 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." ) );
4675 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." ) );
4676 my $hash = $self->get( "customers/${parent_id}/cash_balance_transactions/${id}", $args ) || CORE::return( $self->pass_error );
4677 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Cash::Transaction', $hash ) );
4678 }
4679 PERL
4680 # NOTE: customer_cash_balance_transactions()
4681 customer_cash_balance_transactions => <<'PERL',
4682 # <https://stripe.com/docs/api/cash_balance>
4683 sub customer_cash_balance_transactions
4684 {
4685 my $self = shift( @_ );
4686 my $allowed = [qw( fund_cash_balance list retrieve )];
4687 my $action = shift( @_ );
4688 my $meth = $self->_get_method( 'customer_cash_balance_transaction', $action, $allowed ) || CORE::return( $self->pass_error );
4689 CORE::return( $self->$meth( @_ ) );
4690 }
4691 PERL
4692 # NOTE: customer_create()
4693 customer_create => <<'PERL',
4694 # https://stripe.com/docs/api/customers/create?lang=curl
4695 sub customer_create
4696 {
4697 my $self = shift( @_ );
4698 CORE::return( $self->error( "No parameters were provided to create customer" ) ) if( !scalar( @_ ) );
4699 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Customer', @_ );
4700 my $okParams =
4701 {
4702 expandable => { allowed => $EXPANDABLES->{customer} },
4703 account_balance => { re => qr/^\-?\d+$/ },
4704 address => {
4705 fields => ["line1", "city", "country", "line2", "postal_code", "state"],
4706 package => "Net::API::Stripe::Address",
4707 type => "hash",
4708 },
4709 balance => { re => qr/^\-?\d+$/, type => "integer" },
4710 cash_balance => { type => "hash" },
4711 coupon => { type => "string" },
4712 default_source => { re => qr/^\w+$/ },
4713 description => { type => "string" },
4714 email => { type => "string" },
4715 id => {},
4716 invoice_prefix => { re => qr/^[A-Z0-9]{3,12}$/, type => "string" },
4717 invoice_settings => {
4718 fields => ["custom_fields", "default_payment_method", "footer"],
4719 package => "Net::API::Stripe::Billing::Invoice::Settings",
4720 type => "hash",
4721 },
4722 metadata => { type => "hash" },
4723 name => { type => "string" },
4724 next_invoice_sequence => { type => "integer" },
4725 payment_method => { type => "string" },
4726 phone => { type => "string" },
4727 preferred_locales => { type => "array" },
4728 promotion_code => { type => "string" },
4729 shipping => {
4730 fields => ["address", "name", "carrier", "phone", "tracking_number"],
4731 package => "Net::API::Stripe::Shipping",
4732 type => "hash",
4733 },
4734 source => { re => qr/^\w+$/, type => "string" },
4735 tax => { type => "hash" },
4736 tax_exempt => { re => qr/^(none|exempt|reverse)$/, type => "string" },
4737 tax_id_data => { package => "Net::API::Stripe::Customer::TaxId", type => "array" },
4738 tax_info => {
4739 fields => ["tax_id", "type"],
4740 package => "Net::API::Stripe::Customer::TaxInfo",
4741 },
4742 test_clock => { type => "string" },
4743 };
4744  
4745 $args = $self->_contract( 'customer', $args ) || CORE::return( $self->pass_error );
4746 my $err = $self->_check_parameters( $okParams, $args );
4747 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
4748 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' );
4749 my $hash = $self->post( 'customers', $args ) || CORE::return( $self->pass_error );
4750 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Customer', $hash ) );
4751 }
4752 PERL
4753 # NOTE: customer_delete()
4754 customer_delete => <<'PERL',
4755 # https://stripe.com/docs/api/customers/delete?lang=curl
4756 # "Permanently deletes a customer. It cannot be undone. Also immediately cancels any active subscriptions on the customer."
4757 sub customer_delete
4758 {
4759 my $self = shift( @_ );
4760 CORE::return( $self->error( "No parameters were provided to delete customer information." ) ) if( !scalar( @_ ) );
4761 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Customer', @_ );
4762 my $okParams =
4763 {
4764 expandable => { allowed => $EXPANDABLES->{customer} },
4765 id => { re => qr/^\w+$/, required => 1 }
4766 };
4767 my $err = $self->_check_parameters( $okParams, $args );
4768 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
4769 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No customer id was provided to delete its information." ) );
4770 my $hash = $self->delete( "customers/${id}" ) || CORE::return( $self->pass_error );
4771 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Customer', $hash ) );
4772 }
4773 PERL
4774 # NOTE: customer_delete_discount()
4775 customer_delete_discount => <<'PERL',
4776 sub customer_delete_discount
4777 {
4778 my $self = shift( @_ );
4779 CORE::return( $self->error( "No parameters were provided to delete customer discount." ) ) if( !scalar( @_ ) );
4780 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Customer', @_ );
4781 my $okParams =
4782 {
4783 expandable => { allowed => $EXPANDABLES->{discount}},
4784 id => { re => qr/^\w+$/, required => 1 }
4785 };
4786 my $err = $self->_check_parameters( $okParams, $args );
4787 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
4788 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No customer id was provided to delete its coupon." ) );
4789 my $hash = $self->delete( "customers/${id}/discount", $args ) || CORE::return( $self->pass_error );
4790 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::Discount', $hash ) );
4791 }
4792 PERL
4793 # NOTE: customer_list()
4794 customer_list => <<'PERL',
4795 sub customer_list
4796 {
4797 my $self = shift( @_ );
4798 my $args = shift( @_ );
4799 my $okParams =
4800 {
4801 expandable => { allowed => $EXPANDABLES->{customer}, data_prefix_is_ok => 1 },
4802 created => qr/^\d+$/,
4803 'created.gt' => qr/^\d+$/,
4804 'created.gte' => qr/^\d+$/,
4805 'created.lt' => qr/^\d+$/,
4806 'created.lte' => qr/^\d+$/,
4807 email => qr/.*?/,
4808 ending_before => qr/^\w+$/,
4809 limit => qr/^\d+$/,
4810 starting_after => qr/^\w+$/,
4811 test_clock => { type => "string" },
4812 };
4813  
4814 my $err = $self->_check_parameters( $okParams, $args );
4815 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
4816 if( $args->{source} )
4817 {
4818 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)$/ );
4819 }
4820 if( $args->{expand} )
4821 {
4822 $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
4823 }
4824 my $hash = $self->get( 'customers', $args ) || CORE::return( $self->pass_error );
4825 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Customer::List', $hash ) );
4826 }
4827 PERL
4828 # NOTE: customer_payment_method()
4829 customer_payment_method => <<'PERL',
4830 sub customer_payment_method
4831 {
4832 my $self = shift( @_ );
4833 CORE::return( $self->error( "No parameters were provided to retrieve customer payment method information." ) ) if( !scalar( @_ ) );
4834 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Payment::Method', @_ );
4835 my $okParams =
4836 {
4837 expandable => { allowed => $EXPANDABLES->{payment_method} },
4838 # Payment method id
4839 id => { re => qr/^\w+$/, required => 1 },
4840 # Customer id
4841 customer => { re => qr/^\w+$/, required => 1 },
4842 };
4843 my $err = $self->_check_parameters( $okParams, $args );
4844 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
4845 my $cust = CORE::delete( $args->{customer} ) || CORE::return( $self->error( "No customer id was provided to retrieve its payment method information." ) );
4846 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No payment method id was provided to retrieve its information." ) );
4847 my $hash = $self->get( "customers/${cust}/payment_methods/${id}", $args ) || CORE::return( $self->pass_error );
4848 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Payment::Method', $hash ) );
4849 }
4850 PERL
4851 # NOTE: customer_payment_methods()
4852 customer_payment_methods => <<'PERL',
4853 sub customer_payment_methods
4854 {
4855 my $self = shift( @_ );
4856 CORE::return( $self->error( "No parameters were provided to list a customer payment methods" ) ) if( !scalar( @_ ) );
4857 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Customer', @_ );
4858 my $okParams =
4859 {
4860 expandable => { allowed => $EXPANDABLES->{payment_method}, data_prefix_is_ok => 1 },
4861 id => { re => qr/^\w+$/, required => 1 },
4862 };
4863 my $err = $self->_check_parameters( $okParams, $args );
4864 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
4865 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No customer id was provided to get the list of his/her payment methods." ) );
4866 if( $args->{expand} )
4867 {
4868 $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
4869 }
4870 my $hash = $self->get( "customers/${id}/payment_methods", $args ) || CORE::return( $self->pass_error );
4871 CORE::return( $self->_response_to_object( 'Net::API::Stripe::List', $hash ) );
4872 }
4873 PERL
4874 # NOTE: customer_retrieve()
4875 customer_retrieve => <<'PERL',
4876 sub customer_retrieve
4877 {
4878 my $self = shift( @_ );
4879 CORE::return( $self->error( "No parameters were provided to retrieve customer information." ) ) if( !scalar( @_ ) );
4880 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Customer', @_ );
4881 my $okParams =
4882 {
4883 expandable => { allowed => $EXPANDABLES->{customer} },
4884 id => { re => qr/^\w+$/, required => 1 },
4885 };
4886 my $err = $self->_check_parameters( $okParams, $args );
4887 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
4888 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No customer id was provided to retrieve its information." ) );
4889 my $hash = $self->get( "customers/${id}", $args ) || CORE::return( $self->pass_error );
4890 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Customer', $hash ) );
4891 }
4892 PERL
4893 # NOTE: customer_search()
4894 customer_search => <<'PERL',
4895 sub customer_search
4896 {
4897 my $self = shift( @_ );
4898 CORE::return( $self->error( "No parameters were provided to search customers." ) ) if( !scalar( @_ ) );
4899 my $args = shift( @_ );
4900 my $okParams =
4901 {
4902 expandable => { allowed => $EXPANDABLES->{customer}, data_prefix_is_ok => 1 },
4903 limit => qr/^\d+$/,
4904 page => qr/^\d+$/,
4905 query => { re => qr/^.*?$/, required => 1, type => "string" },
4906 };
4907  
4908 my $err = $self->_check_parameters( $okParams, $args );
4909 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
4910 if( $args->{expand} )
4911 {
4912 $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
4913 }
4914 my $hash = $self->get( "customers/search", $args ) || CORE::return( $self->pass_error );
4915 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Customer::List', $hash ) );
4916 }
4917 PERL
4918 # NOTE: customer_tax_id()
4919 customer_tax_id => <<'PERL',
4920 sub customer_tax_id { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Customer::TaxId', @_ ) ); }
4921 PERL
4922 # NOTE: customer_update()
4923 customer_update => <<'PERL',
4924 # https://stripe.com/docs/api/customers/update?lang=curl
4925 sub customer_update
4926 {
4927 my $self = shift( @_ );
4928 CORE::return( $self->error( "No parameters were provided to update a customer" ) ) if( !scalar( @_ ) );
4929 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Customer', @_ );
4930 my $okParams =
4931 {
4932 expandable => { allowed => $EXPANDABLES->{customer} },
4933 account_balance => { re => qr/^\d+$/ },
4934 address => {
4935 fields => ["line1", "line2", "city", "postal_code", "state", "country"],
4936 type => "hash",
4937 },
4938 balance => { type => "integer" },
4939 cash_balance => { type => "hash" },
4940 coupon => { type => "string" },
4941 default_source => { re => qr/^\w+$/, type => "string" },
4942 description => { type => "string" },
4943 email => { type => "string" },
4944 id => { re => qr/^\w+$/, required => 1 },
4945 invoice_prefix => { re => qr/^[A-Z0-9]{3,12}$/, type => "string" },
4946 invoice_settings => {
4947 fields => ["custom_fields", "default_payment_method", "footer"],
4948 type => "hash",
4949 },
4950 metadata => { type => "hash" },
4951 name => { type => "string" },
4952 next_invoice_sequence => { type => "integer" },
4953 phone => { type => "string" },
4954 preferred_locales => { type => "array" },
4955 promotion_code => { type => "string" },
4956 shipping => {
4957 fields => ["address", "name", "carrier", "phone", "tracking_number"],
4958 type => "hash",
4959 },
4960 source => { re => qr/^\w+$/, type => "string" },
4961 tax => { type => "hash" },
4962 tax_exempt => { re => qr/^(none|exempt|reverse)$/, type => "string" },
4963 tax_info => { fields => ["tax_id", "type"] },
4964 };
4965  
4966 $args = $self->_contract( 'customer', $args ) || CORE::return( $self->pass_error );
4967 # We found some errors
4968 my $err = $self->_check_parameters( $okParams, $args );
4969 if( $args->{fraud_details} )
4970 {
4971 my $this = $args->{fraud_details};
4972 if( $this->{user_report} !~ /^(?:fraudulent|safe)$/ )
4973 {
4974 CORE::return( $self->error( "Invalid value for fraud_details. It should be either fraudulent or safe" ) );
4975 }
4976 }
4977 if( $self->_is_object( $args->{invoice_settings}->{default_payment_method} ) )
4978 {
4979 $args->{invoice_settings}->{default_payment_method} = $args->{invoice_settings}->{default_payment_method}->id;
4980 }
4981 # $self->message( 3, "Data to be posted: ", $self->dumper( $args ) ); exit;
4982 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
4983 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No customer id was provided to update customer's details" ) );
4984 my $hash = $self->post( "customers/${id}", $args ) || CORE::return( $self->pass_error );
4985 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Customer', $hash ) );
4986 }
4987 PERL
4988 # NOTE: customers()
4989 customers => <<'PERL',
4990 sub customers
4991 {
4992 my $self = shift( @_ );
4993 my $action = shift( @_ );
4994 my $allowed = [qw( create retrieve update delete delete_discount list search payment_methods )];
4995 my $meth = $self->_get_method( 'customer', $action, $allowed ) || CORE::return( $self->pass_error );
4996 CORE::return( $self->$meth( @_ ) );
4997 }
4998 PERL
4999 # NOTE: cvc_update_token_create()
5000 cvc_update_token_create => <<'PERL',
5001 sub cvc_update_token_create { CORE::return( shift->token_create( @_ ) ); }
5002 PERL
5003 # NOTE: data()
5004 data => <<'PERL',
5005 sub data { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Event::Data', @_ ) ); }
5006 PERL
5007 # NOTE: discount()
5008 discount => <<'PERL',
5009 sub discount { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Billing::Discount', @_ ) ); }
5010 PERL
5011 # NOTE: discount_delete()
5012 discount_delete => <<'PERL',
5013 sub discount_delete
5014 {
5015 my $self = shift( @_ );
5016 CORE::return( $self->error( "No parameters were provided to delete discount information." ) ) if( !scalar( @_ ) );
5017 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Billing::Discount', @_ );
5018 my $okParams =
5019 {
5020 expandable => { allowed => $EXPANDABLES->{ 'discount' } },
5021 };
5022 my $err = $self->_check_parameters( $okParams, $args );
5023 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
5024 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No subscription id (with parameter 'id') was provided to delete its information." ) );
5025 my $hash = $self->delete( "subscriptions/${id}/discount", $args ) || CORE::return( $self->pass_error );
5026 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::Discount', $hash ) );
5027 }
5028 PERL
5029 # NOTE: discounts()
5030 discounts => <<'PERL',
5031 # <https://stripe.com/docs/api/discounts>
5032 sub discounts
5033 {
5034 my $self = shift( @_ );
5035 my $allowed = [qw( delete delete_customer delete_subscription )];
5036 my $action = shift( @_ );
5037 my $meth = $self->_get_method( 'discount', $action, $allowed ) || CORE::return( $self->pass_error );
5038 CORE::return( $self->$meth( @_ ) );
5039 }
5040 PERL
5041 # NOTE: dispute()
5042 dispute => <<'PERL',
5043 sub dispute { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Dispute', @_ ) ); }
5044 PERL
5045 # NOTE: dispute_close()
5046 dispute_close => <<'PERL',
5047 sub dispute_close
5048 {
5049 my $self = shift( @_ );
5050 CORE::return( $self->error( "No parameters were provided to close dispute." ) ) if( !scalar( @_ ) );
5051 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Dispute', @_ );
5052 my $okParams =
5053 {
5054 expandable => { allowed => $EXPANDABLES->{dispute} },
5055 id => { re => qr/^\w+$/, required => 1 }
5056 };
5057 my $err = $self->_check_parameters( $okParams, $args );
5058 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
5059 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No dispute id was provided to close." ) );
5060 my $hash = $self->delete( "disputes/${id}/close", $args ) || CORE::return( $self->pass_error );
5061 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Dispute', $hash ) );
5062 }
5063 PERL
5064 # NOTE: dispute_evidence()
5065 dispute_evidence => <<'PERL',
5066 sub dispute_evidence { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Dispute', @_ ) ); }
5067 PERL
5068 # NOTE: dispute_list()
5069 dispute_list => <<'PERL',
5070 sub dispute_list
5071 {
5072 my $self = shift( @_ );
5073 my $args = shift( @_ );
5074 my $okParams =
5075 {
5076 expandable => { allowed => $EXPANDABLES->{dispute}, data_prefix_is_ok => 1 },
5077 charge => { re => qr/.*?/, type => "string" },
5078 created => { re => qr/^\d+$/, type => "timestamp" },
5079 'created.gt' => { re => qr/^\d+$/ },
5080 'created.gte' => { re => qr/^\d+$/ },
5081 'created.lt' => { re => qr/^\d+$/ },
5082 'created.lte' => { re => qr/^\d+$/ },
5083 ending_before => { re => qr/^\w+$/, type => "string" },
5084 limit => { re => qr/^\d+$/, type => "string" },
5085 payment_intent => { re => qr/^\w+$/, type => "string" },
5086 starting_after => { re => qr/^\w+$/, type => "string" },
5087 };
5088  
5089 my $err = $self->_check_parameters( $okParams, $args );
5090 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
5091 if( $args->{expand} )
5092 {
5093 $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
5094 }
5095 my $hash = $self->get( 'disputes', $args ) || CORE::return( $self->pass_error );
5096 CORE::return( $self->_response_to_object( 'Net::API::Stripe::List', $hash ) );
5097 }
5098 PERL
5099 # NOTE: dispute_retrieve()
5100 dispute_retrieve => <<'PERL',
5101 sub dispute_retrieve
5102 {
5103 my $self = shift( @_ );
5104 CORE::return( $self->error( "No parameters were provided to retrieve dispute information." ) ) if( !scalar( @_ ) );
5105 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Dispute', @_ );
5106 my $okParams =
5107 {
5108 expandable => { allowed => $EXPANDABLES->{dispute} },
5109 id => { re => qr/^\w+$/, required => 1 }
5110 };
5111 my $err = $self->_check_parameters( $okParams, $args );
5112 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
5113 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No dispute id was provided to retrieve its information." ) );
5114 my $hash = $self->get( "disputes/${id}", $args ) || CORE::return( $self->pass_error );
5115 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Dispute', $hash ) );
5116 }
5117 PERL
5118 # NOTE: dispute_update()
5119 dispute_update => <<'PERL',
5120 sub dispute_update
5121 {
5122 my $self = shift( @_ );
5123 CORE::return( $self->error( "No parameters were provided to update a dispute" ) ) if( !scalar( @_ ) );
5124 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Dispute', @_ );
5125 my $okParams =
5126 {
5127 expandable => { allowed => $EXPANDABLES->{dispute} },
5128 evidence => {
5129 fields => [
5130 "access_activity_log",
5131 "billing_address",
5132 "cancellation_policy",
5133 "cancellation_policy_disclosure",
5134 "cancellation_rebuttal",
5135 "customer_communication",
5136 "customer_email_address",
5137 "customer_name",
5138 "customer_purchase_ip",
5139 "customer_signature",
5140 "duplicate_charge_documentation",
5141 "duplicate_charge_explanation",
5142 "duplicate_charge_id",
5143 "product_description",
5144 "receipt",
5145 "refund_policy",
5146 "refund_policy_disclosure",
5147 "refund_refusal_explanation",
5148 "service_date",
5149 "service_documentation",
5150 "shipping_address",
5151 "shipping_carrier",
5152 "shipping_date",
5153 "shipping_documentation",
5154 "shipping_tracking_number",
5155 "uncategorized_file",
5156 "uncategorized_text",
5157 ],
5158 type => "hash",
5159 },
5160 id => { re => qr/^\w+$/, required => 1 },
5161 metadata => { type => "hash" },
5162 submit => { type => "boolean" },
5163 };
5164  
5165 $args = $self->_contract( 'dispute', $args ) || CORE::return( $self->pass_error );
5166 # We found some errors
5167 my $err = $self->_check_parameters( $okParams, $args );
5168 # $self->message( 3, "Data to be posted: ", $self->dumper( $args ) ); exit;
5169 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
5170 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No dispute id was provided to update dispute's details" ) );
5171 my $hash = $self->post( "disputes/${id}", $args ) || CORE::return( $self->pass_error );
5172 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Dispute', $hash ) );
5173 }
5174 PERL
5175 # NOTE: disputes()
5176 disputes => <<'PERL',
5177 sub disputes
5178 {
5179 my $self = shift( @_ );
5180 my $action = shift( @_ );
5181 my $allowed = [qw( close retrieve update list )];
5182 my $meth = $self->_get_method( 'dispute', $action, $allowed ) || CORE::return( $self->pass_error );
5183 CORE::return( $self->$meth( @_ ) );
5184 }
5185 PERL
5186 # NOTE: document()
5187 document => <<'PERL',
5188 sub document { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Connect::Account::Document', @_ ) ); }
5189 PERL
5190 # NOTE: event()
5191 event => <<'PERL',
5192 sub event { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Event', @_ ) ); }
5193 PERL
5194 # NOTE: event_list()
5195 event_list => <<'PERL',
5196 sub event_list
5197 {
5198 my $self = shift( @_ );
5199 my $args = shift( @_ );
5200 my $okParams =
5201 {
5202 expandable => { allowed => $EXPANDABLES->{event}, data_prefix_is_ok => 1 },
5203 created => { re => qr/^\d+$/, type => "timestamp" },
5204 'created.gt' => { re => qr/^\d+$/ },
5205 'created.gte' => { re => qr/^\d+$/ },
5206 'created.lt' => { re => qr/^\d+$/ },
5207 'created.lte' => { re => qr/^\d+$/ },
5208 delivery_success => { re => qr/.*?/, type => "string" },
5209 ending_before => { re => qr/^\w+$/, type => "string" },
5210 limit => { re => qr/^\d+$/, type => "string" },
5211 starting_after => { re => qr/^\w+$/, type => "string" },
5212 type => { re => qr/^\w+$/, type => "string" },
5213 types => { type => "string" },
5214 };
5215  
5216 my $err = $self->_check_parameters( $okParams, $args );
5217 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
5218 if( $args->{expand} )
5219 {
5220 $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
5221 }
5222 my $hash = $self->get( 'events', $args ) || CORE::return( $self->pass_error );
5223 CORE::return( $self->_response_to_object( 'Net::API::Stripe::List', $hash ) );
5224 }
5225 PERL
5226 # NOTE: event_retrieve()
5227 event_retrieve => <<'PERL',
5228 sub event_retrieve
5229 {
5230 my $self = shift( @_ );
5231 CORE::return( $self->error( "No parameters were provided to retrieve event information." ) ) if( !scalar( @_ ) );
5232 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Event', @_ );
5233 my $okParams =
5234 {
5235 expandable => { allowed => $EXPANDABLES->{event} },
5236 id => { re => qr/^\w+$/, required => 1 }
5237 };
5238 my $err = $self->_check_parameters( $okParams, $args );
5239 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
5240 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No event id was provided to retrieve its information." ) );
5241 my $hash = $self->get( "events/${id}", $args ) || CORE::return( $self->pass_error );
5242 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Event', $hash ) );
5243 }
5244 PERL
5245 # NOTE: events()
5246 events => <<'PERL',
5247 sub events
5248 {
5249 my $self = shift( @_ );
5250 my $action = shift( @_ );
5251 my $allowed = [qw( retrieve list )];
5252 my $meth = $self->_get_method( 'events', $action, $allowed ) || CORE::return( $self->pass_error );
5253 CORE::return( $self->$meth( @_ ) );
5254 }
5255 PERL
5256 # NOTE: evidence()
5257 evidence => <<'PERL',
5258 sub evidence { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Issuing::Dispute::Evidence', @_ ) ); }
5259 PERL
5260 # NOTE: evidence_details()
5261 evidence_details => <<'PERL',
5262 sub evidence_details { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Dispute::EvidenceDetails', @_ ) ); }
5263 PERL
5264 # NOTE: fee_refund()
5265 fee_refund => <<'PERL',
5266 sub fee_refund { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Connect::ApplicationFee::Refund', @_ ) ); }
5267 PERL
5268 # NOTE: fee_refund_create()
5269 fee_refund_create => <<'PERL',
5270 sub fee_refund_create
5271 {
5272 my $self = shift( @_ );
5273 my $args = shift( @_ );
5274 my $okParams =
5275 {
5276 expandable => { allowed => $EXPANDABLES->{ 'fee_refund' } },
5277 amount => { type => "integer" },
5278 metadata => { type => "hash" },
5279 };
5280 $args = $self->_contract( 'fee_refund', $args ) || CORE::return( $self->pass_error );
5281 my $err = $self->_check_parameters( $okParams, $args );
5282 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
5283 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No application_fee id (with parameter 'id') was provided to create its information." ) );
5284 my $hash = $self->post( "application_fees/${id}/refunds", $args ) || CORE::return( $self->pass_error );
5285 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Connect::ApplicationFee::Refund', $hash ) );
5286 }
5287 PERL
5288 # NOTE: fee_refund_list()
5289 fee_refund_list => <<'PERL',
5290 sub fee_refund_list
5291 {
5292 my $self = shift( @_ );
5293 CORE::return( $self->error( "No parameters were provided to list fee refund information." ) ) if( !scalar( @_ ) );
5294 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Connect::ApplicationFee::Refund', @_ );
5295 my $okParams =
5296 {
5297 expandable => { allowed => $EXPANDABLES->{ 'fee_refund' }, data_prefix_is_ok => 1 },
5298 ending_before => { type => "string" },
5299 limit => { type => "string" },
5300 starting_after => { type => "string" },
5301 };
5302 my $err = $self->_check_parameters( $okParams, $args );
5303 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
5304 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No application_fee id (with parameter 'id') was provided to list its information." ) );
5305 if( $args->{expand} )
5306 {
5307 $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
5308 }
5309 my $hash = $self->get( "application_fees/${id}/refunds", $args ) || CORE::return( $self->pass_error );
5310 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Connect::ApplicationFee::Refund', $hash ) );
5311 }
5312 PERL
5313 # NOTE: fee_refund_retrieve()
5314 fee_refund_retrieve => <<'PERL',
5315 sub fee_refund_retrieve
5316 {
5317 my $self = shift( @_ );
5318 my $args = shift( @_ );
5319 my $okParams =
5320 {
5321 expandable => { allowed => $EXPANDABLES->{ 'fee_refund' }, data_prefix_is_ok => 1 },
5322 };
5323 $args = $self->_contract( 'fee_refund', $args ) || CORE::return( $self->pass_error );
5324 my $err = $self->_check_parameters( $okParams, $args );
5325 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
5326 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." ) );
5327 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No refund id (with parameter 'id') was provided to retrieve its information." ) );
5328 my $hash = $self->get( "application_fees/${parent_id}/refunds/${id}", $args ) || CORE::return( $self->pass_error );
5329 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Connect::ApplicationFee::Refund', $hash ) );
5330 }
5331 PERL
5332 # NOTE: fee_refund_update()
5333 fee_refund_update => <<'PERL',
5334 sub fee_refund_update
5335 {
5336 my $self = shift( @_ );
5337 my $args = shift( @_ );
5338 my $okParams =
5339 {
5340 expandable => { allowed => $EXPANDABLES->{ 'fee_refund' } },
5341 metadata => { type => "hash" },
5342 };
5343 $args = $self->_contract( 'fee_refund', $args ) || CORE::return( $self->pass_error );
5344 my $err = $self->_check_parameters( $okParams, $args );
5345 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
5346 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." ) );
5347 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No refund id (with parameter 'id') was provided to update its information." ) );
5348 my $hash = $self->post( "application_fees/${parent_id}/refunds/${id}", $args ) || CORE::return( $self->pass_error );
5349 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Connect::ApplicationFee::Refund', $hash ) );
5350 }
5351 PERL
5352 # NOTE: fee_refunds()
5353 fee_refunds => <<'PERL',
5354 # <https://stripe.com/docs/api/fee_refunds>
5355 sub fee_refunds
5356 {
5357 my $self = shift( @_ );
5358 my $allowed = [qw( create list retrieve update )];
5359 my $action = shift( @_ );
5360 my $meth = $self->_get_method( 'fee_refund', $action, $allowed ) || CORE::return( $self->pass_error );
5361 CORE::return( $self->$meth( @_ ) );
5362 }
5363 PERL
5364 # NOTE: file()
5365 file => <<'PERL',
5366 sub file { CORE::return( shift->_response_to_object( 'Net::API::Stripe::File', @_ ) ); }
5367 PERL
5368 # NOTE: file_create()
5369 file_create => <<'PERL',
5370 sub file_create
5371 {
5372 my $self = shift( @_ );
5373 CORE::return( $self->error( "No parameters were provided to create a file" ) ) if( !scalar( @_ ) );
5374 my $args = $self->_get_args_from_object( 'Net::API::Stripe::File', @_ );
5375 my $okParams =
5376 {
5377 expandable => { allowed => $EXPANDABLES->{file} },
5378 expand => { allowed => [] },
5379 file => { required => 1, type => "string" },
5380 file_link_data => { field => ["create", "expires_at", "metadata"], type => "hash" },
5381 purpose => {
5382 re => qr/^(business_icon|business_logo|customer_signature|dispute_evidence|identity_document|pci_document|tax_document_user_upload)$/,
5383 required => 1,
5384 type => "string",
5385 },
5386 };
5387  
5388 $args = $self->_contract( 'file', $args ) || CORE::return( $self->pass_error );
5389 my $err = $self->_check_parameters( $okParams, $args );
5390 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
5391 if( !CORE::length( $args->{file} ) )
5392 {
5393 CORE::return( $self->error( "No file was provided to upload." ) );
5394 }
5395 my $file = Module::Generic::File::file( $args->{file} );
5396 if( !$file->exists )
5397 {
5398 CORE::return( $self->error( "File \"$file\" does not exist." ) );
5399 }
5400 elsif( $file->is_empty )
5401 {
5402 CORE::return( $self->error( "File \"$file\" is empty." ) );
5403 }
5404 elsif( !$file->can_read )
5405 {
5406 CORE::return( $self->error( "File \"$file\" does not have read permission for us (uid = $>)." ) );
5407 }
5408 $args->{file} = { _filepath => $file };
5409 my $hash = $self->post_multipart( 'files', $args ) || CORE::return( $self->pass_error );
5410 CORE::return( $self->_response_to_object( 'Net::API::Stripe::File', $hash ) );
5411 }
5412 PERL
5413 # NOTE: file_link()
5414 file_link => <<'PERL',
5415 sub file_link { CORE::return( shift->_response_to_object( 'Net::API::Stripe::File::Link', @_ ) ); }
5416 PERL
5417 # NOTE: file_link_create()
5418 file_link_create => <<'PERL',
5419 sub file_link_create
5420 {
5421 my $self = shift( @_ );
5422 CORE::return( $self->error( "No parameters were provided to create a file link" ) ) if( !scalar( @_ ) );
5423 my $args = $self->_get_args_from_object( 'Net::API::Stripe::File::Link', @_ );
5424
5425 my $okParams =
5426 {
5427 expandable => { allowed => $EXPANDABLES->{file_link} },
5428 expires_at => { type => "timestamp" },
5429 file => { package => "Net::API::Stripe::File", required => 1, type => "string" },
5430 metadata => { type => "hash" },
5431 };
5432  
5433 $args = $self->_contract( 'file_link', $args ) || CORE::return( $self->pass_error );
5434 my $err = $self->_check_parameters( $okParams, $args );
5435 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
5436 my $hash = $self->post( 'file_links', $args ) || CORE::return( $self->pass_error );
5437 CORE::return( $self->_response_to_object( 'Net::API::Stripe::File::Link', $hash ) );
5438 }
5439 PERL
5440 # NOTE: file_link_list()
5441 file_link_list => <<'PERL',
5442 sub file_link_list
5443 {
5444 my $self = shift( @_ );
5445 my $args = $self->_get_args( @_ );
5446 if( $self->_is_object( $args->{file} ) && $args->{file}->isa( 'Net::API::Stripe::File' ) )
5447 {
5448 $args->{file} = $args->{file}->id || CORE::return( $self->error( "No file id could be found in this file object." ) );
5449 }
5450 my $okParams =
5451 {
5452 expandable => { allowed => $EXPANDABLES->{file_link}, data_prefix_is_ok => 1 },
5453 created => qr/^\d+$/,
5454 'created.gt' => qr/^\d+$/,
5455 'created.gte' => qr/^\d+$/,
5456 'created.lt' => qr/^\d+$/,
5457 'created.lte' => qr/^\d+$/,
5458 ending_before => qr/^\w+$/,
5459 expand => { allowed => ["file"] },
5460 expired => { type => "boolean" },
5461 file => { type => "string" },
5462 limit => qr/^\d+$/,
5463 starting_after => qr/^\w+$/,
5464 };
5465  
5466 my $err = $self->_check_parameters( $okParams, $args );
5467 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
5468 if( $args->{expand} )
5469 {
5470 $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
5471 }
5472 my $hash = $self->get( 'file_links', $args ) || CORE::return( $self->pass_error );
5473 CORE::return( $self->_response_to_object( 'Net::API::Stripe::List', $hash ) );
5474 }
5475 PERL
5476 # NOTE: file_link_retrieve()
5477 file_link_retrieve => <<'PERL',
5478 sub file_link_retrieve
5479 {
5480 my $self = shift( @_ );
5481 CORE::return( $self->error( "No parameters were provided to retrieve file link information." ) ) if( !scalar( @_ ) );
5482 my $args = $self->_get_args_from_object( 'Net::API::Stripe::File::Link', @_ );
5483 my $okParams =
5484 {
5485 expand => { allowed => $EXPANDABLES->{file_link} },
5486 id => { re => qr/^\w+$/, required => 1 }
5487 };
5488 my $err = $self->_check_parameters( $okParams, $args );
5489 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
5490 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No file link id was provided to retrieve its information." ) );
5491 my $hash = $self->get( "file_links/${id}", $args ) || CORE::return( $self->pass_error );
5492 CORE::return( $self->_response_to_object( 'Net::API::Stripe::File::Link', $hash ) );
5493 }
5494 PERL
5495 # NOTE: file_link_update()
5496 file_link_update => <<'PERL',
5497 sub file_link_update
5498 {
5499 my $self = shift( @_ );
5500 CORE::return( $self->error( "No parameters were provided to update a file link" ) ) if( !scalar( @_ ) );
5501 my $args = $self->_get_args_from_object( 'Net::API::Stripe::File::Link', @_ );
5502 my $okParams =
5503 {
5504 expandable => { allowed => $EXPANDABLES->{file_link} },
5505 expires_at => { type => "timestamp" },
5506 id => { re => qr/^\w+$/, required => 1 },
5507 metadata => { type => "hash" },
5508 };
5509  
5510 $args = $self->_contract( 'file_link', $args ) || CORE::return( $self->pass_error );
5511 # We found some errors
5512 my $err = $self->_check_parameters( $okParams, $args );
5513 # $self->message( 3, "Data to be posted: ", $self->dumper( $args ) ); exit;
5514 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
5515 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No file link id was provided to update its details" ) );
5516 my $hash = $self->post( "file_links/${id}", $args ) || CORE::return( $self->pass_error );
5517 CORE::return( $self->_response_to_object( 'Net::API::Stripe::File::Link', $hash ) );
5518 }
5519 PERL
5520 # NOTE: file_links()
5521 file_links => <<'PERL',
5522 sub file_links
5523 {
5524 my $self = shift( @_ );
5525 my $action = shift( @_ );
5526 my $allowed = [qw( create retrieve update list )];
5527 my $meth = $self->_get_method( 'file_links', $action, $allowed ) || CORE::return( $self->pass_error );
5528 CORE::return( $self->$meth( @_ ) );
5529 }
5530 PERL
5531 # NOTE: file_list()
5532 file_list => <<'PERL',
5533 sub file_list
5534 {
5535 my $self = shift( @_ );
5536 my $args = shift( @_ );
5537 my $okParams =
5538 {
5539 expandable => { allowed => $EXPANDABLES->{file}, data_prefix_is_ok => 1 },
5540 created => qr/^\d+$/,
5541 'created.gt' => qr/^\d+$/,
5542 'created.gte' => qr/^\d+$/,
5543 'created.lt' => qr/^\d+$/,
5544 'created.lte' => qr/^\d+$/,
5545 ending_before => qr/^\w+$/,
5546 expand => { allowed => [] },
5547 limit => qr/^\d+$/,
5548 purpose => { type => "string" },
5549 starting_after => qr/^\w+$/,
5550 };
5551  
5552 my $err = $self->_check_parameters( $okParams, $args );
5553 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
5554 if( $args->{expand} )
5555 {
5556 $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
5557 }
5558 my $hash = $self->get( 'files', $args ) || CORE::return( $self->pass_error );
5559 CORE::return( $self->_response_to_object( 'Net::API::Stripe::List', $hash ) );
5560 }
5561 PERL
5562 # NOTE: file_retrieve()
5563 file_retrieve => <<'PERL',
5564 sub file_retrieve
5565 {
5566 my $self = shift( @_ );
5567 CORE::return( $self->error( "No parameters were provided to retrieve file information." ) ) if( !scalar( @_ ) );
5568 my $args = $self->_get_args_from_object( 'Net::API::Stripe::File', @_ );
5569 my $okParams =
5570 {
5571 expand => { allowed => $EXPANDABLES->{file} },
5572 id => { re => qr/^\w+$/, required => 1 }
5573 };
5574 my $err = $self->_check_parameters( $okParams, $args );
5575 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
5576 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No file id was provided to retrieve its information." ) );
5577 my $hash = $self->get( "files/${id}", $args ) || CORE::return( $self->pass_error );
5578 CORE::return( $self->_response_to_object( 'Net::API::Stripe::File', $hash ) );
5579 }
5580 PERL
5581 # NOTE: files()
5582 files => <<'PERL',
5583 # sub fraud { CORE::return( shift->_instantiate( 'fraud', 'Net::API::Stripe::Fraud' ) ) }
5584 sub files
5585 {
5586 my $self = shift( @_ );
5587 my $action = shift( @_ );
5588 my $allowed = [qw( create retrieve list )];
5589 my $meth = $self->_get_method( 'files', $action, $allowed ) || CORE::return( $self->pass_error );
5590 CORE::return( $self->$meth( @_ ) );
5591 }
5592 PERL
5593 # NOTE: financial_connections_account()
5594 financial_connections_account => <<'PERL',
5595 sub financial_connections_account { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Financial::Connections::Account', @_ ) ); }
5596 PERL
5597 # NOTE: financial_connections_account_disconnect()
5598 financial_connections_account_disconnect => <<'PERL',
5599 sub financial_connections_account_disconnect
5600 {
5601 my $self = shift( @_ );
5602 my $args = shift( @_ );
5603 my $okParams =
5604 {
5605 expandable => { allowed => $EXPANDABLES->{ 'financial_connections.account' } },
5606 };
5607 $args = $self->_contract( 'financial_connections.account', $args ) || CORE::return( $self->pass_error );
5608 my $err = $self->_check_parameters( $okParams, $args );
5609 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
5610 my $hash = $self->post( "", $args ) || CORE::return( $self->pass_error );
5611 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Financial::Connections::Account', $hash ) );
5612 }
5613 PERL
5614 # NOTE: financial_connections_account_list()
5615 financial_connections_account_list => <<'PERL',
5616 sub financial_connections_account_list
5617 {
5618 my $self = shift( @_ );
5619 CORE::return( $self->error( "No parameters were provided to list financial connections account information." ) ) if( !scalar( @_ ) );
5620 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Financial::Connections::Account', @_ );
5621 my $okParams =
5622 {
5623 expandable => { allowed => $EXPANDABLES->{ 'financial_connections.account' }, data_prefix_is_ok => 1 },
5624 account_holder => { type => "hash" },
5625 ending_before => { type => "string" },
5626 limit => { type => "string" },
5627 session => { type => "string" },
5628 starting_after => { type => "string" },
5629 };
5630 my $err = $self->_check_parameters( $okParams, $args );
5631 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
5632 if( $args->{expand} )
5633 {
5634 $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
5635 }
5636 my $hash = $self->get( "financial_connections/accounts", $args ) || CORE::return( $self->pass_error );
5637 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Financial::Connections::Account', $hash ) );
5638 }
5639 PERL
5640 # NOTE: financial_connections_account_owner()
5641 financial_connections_account_owner => <<'PERL',
5642 sub financial_connections_account_owner { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Financial::Connections::AccountOwner', @_ ) ); }
5643 PERL
5644 # NOTE: financial_connections_account_owner_list()
5645 financial_connections_account_owner_list => <<'PERL',
5646 sub financial_connections_account_owner_list
5647 {
5648 my $self = shift( @_ );
5649 CORE::return( $self->error( "No parameters were provided to list financial connections account owner information." ) ) if( !scalar( @_ ) );
5650 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Financial::Connections::AccountOwner', @_ );
5651 my $okParams =
5652 {
5653 expandable => { allowed => $EXPANDABLES->{ 'financial_connections.account_owner' }, data_prefix_is_ok => 1 },
5654 ending_before => { type => "string" },
5655 limit => { type => "string" },
5656 ownership => { type => "string", required => 1 },
5657 starting_after => { type => "string" },
5658 };
5659 my $err = $self->_check_parameters( $okParams, $args );
5660 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
5661 if( $args->{expand} )
5662 {
5663 $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
5664 }
5665 my $hash = $self->get( "?ownership=:ownership_id", $args ) || CORE::return( $self->pass_error );
5666 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Financial::Connections::AccountOwner', $hash ) );
5667 }
5668 PERL
5669 # NOTE: financial_connections_account_owners()
5670 financial_connections_account_owners => <<'PERL',
5671 # <https://stripe.com/docs/api/financial_connections/ownership>
5672 sub financial_connections_account_owners
5673 {
5674 my $self = shift( @_ );
5675 my $allowed = [qw( list )];
5676 my $action = shift( @_ );
5677 my $meth = $self->_get_method( 'financial_connections_account_owner', $action, $allowed ) || CORE::return( $self->pass_error );
5678 CORE::return( $self->$meth( @_ ) );
5679 }
5680 PERL
5681 # NOTE: financial_connections_account_ownership()
5682 financial_connections_account_ownership => <<'PERL',
5683 sub financial_connections_account_ownership { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Financial::Connections::AccountOwnership', @_ ) ); }
5684 PERL
5685 # NOTE: financial_connections_account_refresh()
5686 financial_connections_account_refresh => <<'PERL',
5687 sub financial_connections_account_refresh
5688 {
5689 my $self = shift( @_ );
5690 CORE::return( $self->error( "No parameters were provided to refresh financial connections account information." ) ) if( !scalar( @_ ) );
5691 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Financial::Connections::Account', @_ );
5692 my $okParams =
5693 {
5694 expandable => { allowed => $EXPANDABLES->{ 'financial_connections.account' } },
5695 features => { type => "array", required => 1 },
5696 };
5697 my $err = $self->_check_parameters( $okParams, $args );
5698 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
5699 my $hash = $self->post( "", $args ) || CORE::return( $self->pass_error );
5700 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Financial::Connections::Account', $hash ) );
5701 }
5702 PERL
5703 # NOTE: financial_connections_account_retrieve()
5704 financial_connections_account_retrieve => <<'PERL',
5705 sub financial_connections_account_retrieve
5706 {
5707 my $self = shift( @_ );
5708 my $args = shift( @_ );
5709 my $okParams =
5710 {
5711 expandable => { allowed => $EXPANDABLES->{ 'financial_connections.account' }, data_prefix_is_ok => 1 },
5712 };
5713 $args = $self->_contract( 'financial_connections.account', $args ) || CORE::return( $self->pass_error );
5714 my $err = $self->_check_parameters( $okParams, $args );
5715 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
5716 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No account id (with parameter 'id') was provided to retrieve its information." ) );
5717 my $hash = $self->get( "financial_connections/accounts/${id}", $args ) || CORE::return( $self->pass_error );
5718 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Financial::Connections::Account', $hash ) );
5719 }
5720 PERL
5721 # NOTE: financial_connections_accounts()
5722 financial_connections_accounts => <<'PERL',
5723 # <https://stripe.com/docs/api/financial_connections/accounts>
5724 sub financial_connections_accounts
5725 {
5726 my $self = shift( @_ );
5727 my $allowed = [qw( disconnect list refresh retrieve )];
5728 my $action = shift( @_ );
5729 my $meth = $self->_get_method( 'financial_connections_account', $action, $allowed ) || CORE::return( $self->pass_error );
5730 CORE::return( $self->$meth( @_ ) );
5731 }
5732 PERL
5733 # NOTE: financial_connections_session()
5734 financial_connections_session => <<'PERL',
5735 sub financial_connections_session { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Financial::Connections::Session', @_ ) ); }
5736 PERL
5737 # NOTE: financial_connections_session_create()
5738 financial_connections_session_create => <<'PERL',
5739 sub financial_connections_session_create
5740 {
5741 my $self = shift( @_ );
5742 my $args = shift( @_ );
5743 my $okParams =
5744 {
5745 expandable => { allowed => $EXPANDABLES->{ 'financial_connections.session' } },
5746 account_holder => { type => "hash", required => 1 },
5747 filters => { type => "hash" },
5748 permissions => { type => "array", required => 1 },
5749 };
5750 $args = $self->_contract( 'financial_connections.session', $args ) || CORE::return( $self->pass_error );
5751 my $err = $self->_check_parameters( $okParams, $args );
5752 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
5753 my $hash = $self->post( "financial_connections/sessions", $args ) || CORE::return( $self->pass_error );
5754 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Financial::Connections::Session', $hash ) );
5755 }
5756 PERL
5757 # NOTE: financial_connections_session_retrieve()
5758 financial_connections_session_retrieve => <<'PERL',
5759 sub financial_connections_session_retrieve
5760 {
5761 my $self = shift( @_ );
5762 my $args = shift( @_ );
5763 my $okParams =
5764 {
5765 expandable => { allowed => $EXPANDABLES->{ 'financial_connections.session' }, data_prefix_is_ok => 1 },
5766 };
5767 $args = $self->_contract( 'financial_connections.session', $args ) || CORE::return( $self->pass_error );
5768 my $err = $self->_check_parameters( $okParams, $args );
5769 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
5770 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No financial_connections.session id (with parameter 'id') was provided to retrieve its information." ) );
5771 my $hash = $self->get( "financial_connections/sessions/${id}", $args ) || CORE::return( $self->pass_error );
5772 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Financial::Connections::Session', $hash ) );
5773 }
5774 PERL
5775 # NOTE: financial_connections_sessions()
5776 financial_connections_sessions => <<'PERL',
5777 # <https://stripe.com/docs/api/financial_connections/session>
5778 sub financial_connections_sessions
5779 {
5780 my $self = shift( @_ );
5781 my $allowed = [qw( create retrieve )];
5782 my $action = shift( @_ );
5783 my $meth = $self->_get_method( 'financial_connections_session', $action, $allowed ) || CORE::return( $self->pass_error );
5784 CORE::return( $self->$meth( @_ ) );
5785 }
5786 PERL
5787 # NOTE: fraud()
5788 fraud => <<'PERL',
5789 sub fraud { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Fraud', @_ ) ); }
5790 PERL
5791 # NOTE: funding_instructions()
5792 funding_instructions => <<'PERL',
5793 sub funding_instructions { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Issuing::FundingInstructions', @_ ) ); }
5794 PERL
5795 # NOTE: funding_instructions_create()
5796 funding_instructions_create => <<'PERL',
5797 sub funding_instructions_create
5798 {
5799 my $self = shift( @_ );
5800 my $args = shift( @_ );
5801 my $okParams =
5802 {
5803 expandable => { allowed => $EXPANDABLES->{ 'funding_instructions' } },
5804 bank_transfer => { type => "hash", required => 1 },
5805 currency => { type => "string", required => 1 },
5806 funding_type => { type => "string", required => 1 },
5807 };
5808 $args = $self->_contract( 'funding_instructions', $args ) || CORE::return( $self->pass_error );
5809 my $err = $self->_check_parameters( $okParams, $args );
5810 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
5811 my $hash = $self->post( "issuing/funding_instructions", $args ) || CORE::return( $self->pass_error );
5812 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Issuing::FundingInstructions', $hash ) );
5813 }
5814 PERL
5815 # NOTE: funding_instructions_fund()
5816 funding_instructions_fund => <<'PERL',
5817 sub funding_instructions_fund
5818 {
5819 my $self = shift( @_ );
5820 my $args = shift( @_ );
5821 my $okParams =
5822 {
5823 expandable => { allowed => $EXPANDABLES->{ 'funding_instructions' } },
5824 amount => { type => "string", required => 1 },
5825 currency => { type => "string", required => 1 },
5826 };
5827 $args = $self->_contract( 'funding_instructions', $args ) || CORE::return( $self->pass_error );
5828 my $err = $self->_check_parameters( $okParams, $args );
5829 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
5830 my $hash = $self->post( "test_helpers/issuing/fund_balance", $args ) || CORE::return( $self->pass_error );
5831 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Issuing::FundingInstructions', $hash ) );
5832 }
5833 PERL
5834 # NOTE: funding_instructions_list()
5835 funding_instructions_list => <<'PERL',
5836 sub funding_instructions_list
5837 {
5838 my $self = shift( @_ );
5839 CORE::return( $self->error( "No parameters were provided to list funding instructions information." ) ) if( !scalar( @_ ) );
5840 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Issuing::FundingInstructions', @_ );
5841 my $okParams =
5842 {
5843 expandable => { allowed => $EXPANDABLES->{ 'funding_instructions' }, data_prefix_is_ok => 1 },
5844 ending_before => { type => "string" },
5845 limit => { type => "string" },
5846 starting_after => { type => "string" },
5847 };
5848 my $err = $self->_check_parameters( $okParams, $args );
5849 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
5850 if( $args->{expand} )
5851 {
5852 $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
5853 }
5854 my $hash = $self->get( "issuing/funding_instructions", $args ) || CORE::return( $self->pass_error );
5855 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Issuing::FundingInstructions', $hash ) );
5856 }
5857 PERL
5858 # NOTE: funding_instructionss()
5859 funding_instructionss => <<'PERL',
5860 # <https://stripe.com/docs/api/issuing/funding_instructions>
5861 sub funding_instructionss
5862 {
5863 my $self = shift( @_ );
5864 my $allowed = [qw( create fund list )];
5865 my $action = shift( @_ );
5866 my $meth = $self->_get_method( 'funding_instructions', $action, $allowed ) || CORE::return( $self->pass_error );
5867 CORE::return( $self->$meth( @_ ) );
5868 }
5869 PERL
5870 # NOTE: identity_verification_report()
5871 identity_verification_report => <<'PERL',
5872 sub identity_verification_report { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Identity::VerificationReport', @_ ) ); }
5873 PERL
5874 # NOTE: identity_verification_report_list()
5875 identity_verification_report_list => <<'PERL',
5876 sub identity_verification_report_list
5877 {
5878 my $self = shift( @_ );
5879 CORE::return( $self->error( "No parameters were provided to list identity verification report information." ) ) if( !scalar( @_ ) );
5880 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Identity::VerificationReport', @_ );
5881 my $okParams =
5882 {
5883 expandable => { allowed => $EXPANDABLES->{ 'identity.verification_report' }, data_prefix_is_ok => 1 },
5884 created => { type => "timestamp" },
5885 ending_before => { type => "string" },
5886 limit => { type => "string" },
5887 starting_after => { type => "string" },
5888 type => { type => "string" },
5889 verification_session => { type => "string" },
5890 };
5891 my $err = $self->_check_parameters( $okParams, $args );
5892 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
5893 if( $args->{expand} )
5894 {
5895 $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
5896 }
5897 my $hash = $self->get( "", $args ) || CORE::return( $self->pass_error );
5898 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Identity::VerificationReport', $hash ) );
5899 }
5900 PERL
5901 # NOTE: identity_verification_report_retrieve()
5902 identity_verification_report_retrieve => <<'PERL',
5903 sub identity_verification_report_retrieve
5904 {
5905 my $self = shift( @_ );
5906 my $args = shift( @_ );
5907 my $okParams =
5908 {
5909 expandable => { allowed => $EXPANDABLES->{ 'identity.verification_report' }, data_prefix_is_ok => 1 },
5910 };
5911 $args = $self->_contract( 'identity.verification_report', $args ) || CORE::return( $self->pass_error );
5912 my $err = $self->_check_parameters( $okParams, $args );
5913 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
5914 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No identity.verification_report id (with parameter 'id') was provided to retrieve its information." ) );
5915 my $hash = $self->get( "identity/verification_reports/${id}", $args ) || CORE::return( $self->pass_error );
5916 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Identity::VerificationReport', $hash ) );
5917 }
5918 PERL
5919 # NOTE: identity_verification_reports()
5920 identity_verification_reports => <<'PERL',
5921 # <https://stripe.com/docs/api/identity/verification_reports>
5922 sub identity_verification_reports
5923 {
5924 my $self = shift( @_ );
5925 my $allowed = [qw( list retrieve )];
5926 my $action = shift( @_ );
5927 my $meth = $self->_get_method( 'identity_verification_report', $action, $allowed ) || CORE::return( $self->pass_error );
5928 CORE::return( $self->$meth( @_ ) );
5929 }
5930 PERL
5931 # NOTE: identity_verification_session()
5932 identity_verification_session => <<'PERL',
5933 sub identity_verification_session { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Identity::VerificationSession', @_ ) ); }
5934 PERL
5935 # NOTE: identity_verification_session_cancel()
5936 identity_verification_session_cancel => <<'PERL',
5937 sub identity_verification_session_cancel
5938 {
5939 my $self = shift( @_ );
5940 my $args = shift( @_ );
5941 my $okParams =
5942 {
5943 expandable => { allowed => $EXPANDABLES->{ 'identity.verification_session' } },
5944 };
5945 $args = $self->_contract( 'identity.verification_session', $args ) || CORE::return( $self->pass_error );
5946 my $err = $self->_check_parameters( $okParams, $args );
5947 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
5948 my $hash = $self->post( "", $args ) || CORE::return( $self->pass_error );
5949 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Identity::VerificationSession', $hash ) );
5950 }
5951 PERL
5952 # NOTE: identity_verification_session_create()
5953 identity_verification_session_create => <<'PERL',
5954 sub identity_verification_session_create
5955 {
5956 my $self = shift( @_ );
5957 my $args = shift( @_ );
5958 my $okParams =
5959 {
5960 expandable => { allowed => $EXPANDABLES->{ 'identity.verification_session' } },
5961 metadata => { type => "hash" },
5962 options => { type => "hash" },
5963 return_url => { type => "string" },
5964 type => { type => "string", required => 1 },
5965 };
5966 $args = $self->_contract( 'identity.verification_session', $args ) || CORE::return( $self->pass_error );
5967 my $err = $self->_check_parameters( $okParams, $args );
5968 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
5969 my $hash = $self->post( "", $args ) || CORE::return( $self->pass_error );
5970 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Identity::VerificationSession', $hash ) );
5971 }
5972 PERL
5973 # NOTE: identity_verification_session_list()
5974 identity_verification_session_list => <<'PERL',
5975 sub identity_verification_session_list
5976 {
5977 my $self = shift( @_ );
5978 CORE::return( $self->error( "No parameters were provided to list identity verification session information." ) ) if( !scalar( @_ ) );
5979 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Identity::VerificationSession', @_ );
5980 my $okParams =
5981 {
5982 expandable => { allowed => $EXPANDABLES->{ 'identity.verification_session' }, data_prefix_is_ok => 1 },
5983 created => { type => "timestamp" },
5984 ending_before => { type => "string" },
5985 limit => { type => "string" },
5986 starting_after => { type => "string" },
5987 status => { type => "string" },
5988 };
5989 my $err = $self->_check_parameters( $okParams, $args );
5990 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
5991 if( $args->{expand} )
5992 {
5993 $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
5994 }
5995 my $hash = $self->get( "", $args ) || CORE::return( $self->pass_error );
5996 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Identity::VerificationSession', $hash ) );
5997 }
5998 PERL
5999 # NOTE: identity_verification_session_redact()
6000 identity_verification_session_redact => <<'PERL',
6001 sub identity_verification_session_redact
6002 {
6003 my $self = shift( @_ );
6004 my $args = shift( @_ );
6005 my $okParams =
6006 {
6007 expandable => { allowed => $EXPANDABLES->{ 'identity.verification_session' } },
6008 };
6009 $args = $self->_contract( 'identity.verification_session', $args ) || CORE::return( $self->pass_error );
6010 my $err = $self->_check_parameters( $okParams, $args );
6011 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
6012 my $hash = $self->post( "", $args ) || CORE::return( $self->pass_error );
6013 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Identity::VerificationSession', $hash ) );
6014 }
6015 PERL
6016 # NOTE: identity_verification_session_retrieve()
6017 identity_verification_session_retrieve => <<'PERL',
6018 sub identity_verification_session_retrieve
6019 {
6020 my $self = shift( @_ );
6021 my $args = shift( @_ );
6022 my $okParams =
6023 {
6024 expandable => { allowed => $EXPANDABLES->{ 'identity.verification_session' }, data_prefix_is_ok => 1 },
6025 };
6026 $args = $self->_contract( 'identity.verification_session', $args ) || CORE::return( $self->pass_error );
6027 my $err = $self->_check_parameters( $okParams, $args );
6028 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
6029 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No identity.verification_session id (with parameter 'id') was provided to retrieve its information." ) );
6030 my $hash = $self->get( "identity/verification_sessions/${id}", $args ) || CORE::return( $self->pass_error );
6031 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Identity::VerificationSession', $hash ) );
6032 }
6033 PERL
6034 # NOTE: identity_verification_session_update()
6035 identity_verification_session_update => <<'PERL',
6036 sub identity_verification_session_update
6037 {
6038 my $self = shift( @_ );
6039 my $args = shift( @_ );
6040 my $okParams =
6041 {
6042 expandable => { allowed => $EXPANDABLES->{ 'identity.verification_session' } },
6043 metadata => { type => "hash" },
6044 options => { type => "hash" },
6045 type => { type => "string" },
6046 };
6047 $args = $self->_contract( 'identity.verification_session', $args ) || CORE::return( $self->pass_error );
6048 my $err = $self->_check_parameters( $okParams, $args );
6049 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
6050 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No identity.verification_session id (with parameter 'id') was provided to update its information." ) );
6051 my $hash = $self->post( "identity/verification_sessions/${id}", $args ) || CORE::return( $self->pass_error );
6052 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Identity::VerificationSession', $hash ) );
6053 }
6054 PERL
6055 # NOTE: identity_verification_sessions()
6056 identity_verification_sessions => <<'PERL',
6057 # <https://stripe.com/docs/api/identity/verification_sessions>
6058 sub identity_verification_sessions
6059 {
6060 my $self = shift( @_ );
6061 my $allowed = [qw( cancel create list redact retrieve update )];
6062 my $action = shift( @_ );
6063 my $meth = $self->_get_method( 'identity_verification_session', $action, $allowed ) || CORE::return( $self->pass_error );
6064 CORE::return( $self->$meth( @_ ) );
6065 }
6066 PERL
6067 # NOTE: invoice()
6068 invoice => <<'PERL',
6069 sub invoice { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Billing::Invoice', @_ ) ); }
6070 PERL
6071 # NOTE: invoice_create()
6072 invoice_create => <<'PERL',
6073 sub invoice_create
6074 {
6075 my $self = shift( @_ );
6076 CORE::return( $self->error( "No parameters were provided to create an invoice" ) ) if( !scalar( @_ ) );
6077 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Billing::Invoice', @_ );
6078 my $obj = $args->{_object};
6079 # If we are provided with an invoice object, we change our value for only its id
6080 if( ( $obj && $obj->customer ) ||
6081 ( $self->_is_object( $args->{customer} ) && $args->{customer}->isa( 'Net::API::Stripe::Customer' ) ) )
6082 {
6083 my $cust = $obj ? $obj->customer : $args->{customer};
6084 $args->{customer} = $cust->id || CORE::return( $self->error( "The Customer object provided for this invoice has no id." ) );
6085 }
6086
6087 if( ( $obj && $obj->subscription ) ||
6088 ( $args->{subscription} && $self->_is_object( $args->{subscription} ) && $args->{subscription}->isa( 'Net::API::Stripe::Billing::Subscription' ) ) )
6089 {
6090 my $sub = $obj ? $obj->subscription : $args->{subscription};
6091 $args->{subscription} = $sub->id || CORE::return( $self->error( "The Subscription object provided for this invoice has no id." ) );
6092 }
6093
6094 my $okParams =
6095 {
6096 expandable => { allowed => $EXPANDABLES->{invoice} },
6097 account_tax_ids => { type => "array" },
6098 application_fee_amount => { re => qr/^\d+$/, type => "integer" },
6099 auto_advance => { type => "boolean" },
6100 automatic_tax => { fields => ["enabled"], type => "hash" },
6101 collection_method => { re => qr/^(charge_automatically|send_invoice)$/, type => "string" },
6102 currency => { type => "currency" },
6103 custom_fields => { fields => ["name", "value"], type => "array" },
6104 customer => { re => qr/^\w+$/, type => "string" },
6105 days_until_due => { re => qr/^\d+$/, type => "integer" },
6106 default_payment_method => { re => qr/^\w+$/, type => "string" },
6107 default_source => { re => qr/^\w+$/, type => "string" },
6108 default_tax_rates => { re => qr/^\d+(?:\.\d+)?$/, type => "array" },
6109 description => { type => "string" },
6110 discounts => { fields => ["coupon", "discount"], type => "array" },
6111 due_date => { type => "timestamp" },
6112 footer => { type => "string" },
6113 metadata => { type => "hash" },
6114 on_behalf_of => { re => qr/^\w+$/, type => "string" },
6115 payment_settings => {
6116 fields => [
6117 "payment_method_options.acss_debit",
6118 "payment_method_options.acss_debit.mandate_options",
6119 "payment_method_options.acss_debit.mandate_options.transaction_type",
6120 "payment_method_options.acss_debit.verification_method",
6121 "payment_method_options.bancontact",
6122 "payment_method_options.bancontact.preferred_language",
6123 "payment_method_options.card",
6124 "payment_method_options.card.request_three_d_secure",
6125 "payment_method_options.customer_balance",
6126 "payment_method_options.customer_balance.bank_transfer",
6127 "payment_method_options.customer_balance.bank_transfer.eu_bank_transfer",
6128 "payment_method_options.customer_balance.bank_transfer.eu_bank_transfer.country",
6129 "payment_method_options.customer_balance.bank_transfer.type",
6130 "payment_method_options.customer_balance.funding_type",
6131 "payment_method_options.konbini",
6132 "payment_method_options.us_bank_account",
6133 "payment_method_options.us_bank_account.financial_connections",
6134 "payment_method_options.us_bank_account.financial_connections.permissions",
6135 "payment_method_options.us_bank_account.verification_method",
6136 "payment_method_types",
6137 ],
6138 type => "hash",
6139 },
6140 pending_invoice_items_behavior => { type => "string" },
6141 rendering_options => { fields => ["amount_tax_display"], type => "hash" },
6142 statement_descriptor => { type => "string" },
6143 subscription => { re => qr/^\w+$/, type => "string" },
6144 tax_percent => { re => qr/^\d+(?:\.\d+)?$/ },
6145 transfer_data => { fields => ["destination", "amount"], type => "hash" },
6146 };
6147  
6148 $args = $self->_contract( 'invoice', $args ) || CORE::return( $self->pass_error );
6149 my $err = $self->_check_parameters( $okParams, $args );
6150 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
6151 my $hash = $self->post( 'invoices', $args ) || CORE::return( $self->pass_error );
6152 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::Invoice', $hash ) );
6153 }
6154 PERL
6155 # NOTE: invoice_delete()
6156 invoice_delete => <<'PERL',
6157 # NOTE: Delete a draft invoice
6158 sub invoice_delete
6159 {
6160 my $self = shift( @_ );
6161 CORE::return( $self->error( "No parameters were provided to delete a draft invoice." ) ) if( !scalar( @_ ) );
6162 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Billing::Invoice', @_ );
6163 my $okParams =
6164 {
6165 expandable => { allowed => $EXPANDABLES->{invoice} },
6166 id => { re => qr/^\w+$/, required => 1 }
6167 };
6168 my $err = $self->_check_parameters( $okParams, $args );
6169 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
6170 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No draft invoice id was provided to delete its information." ) );
6171 my $hash = $self->delete( "invoices/${id}", $args ) || CORE::return( $self->pass_error );
6172 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::Invoice', $hash ) );
6173 }
6174 PERL
6175 # NOTE: invoice_finalise()
6176 invoice_finalise => <<'PERL',
6177 sub invoice_finalise
6178 {
6179 my $self = shift( @_ );
6180 CORE::return( $self->error( "No parameters were provided to pay invoice." ) ) if( !scalar( @_ ) );
6181 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Billing::Invoice', @_ );
6182 my $okParams =
6183 {
6184 expandable => { allowed => $EXPANDABLES->{invoice} },
6185 id => { re => qr/^\w+$/, required => 1 },
6186 auto_advance => {},
6187 };
6188 $args = $self->_contract( 'invoice', $args ) || CORE::return( $self->pass_error );
6189 my $err = $self->_check_parameters( $okParams, $args );
6190 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
6191 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No invoice id was provided to pay it." ) );
6192 my $hash = $self->post( "invoices/${id}/finalize", $args ) || CORE::return( $self->pass_error );
6193 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::Invoice', $hash ) );
6194 }
6195 PERL
6196 # NOTE: invoice_finalize()
6197 invoice_finalize => <<'PERL',
6198 sub invoice_finalize
6199 {
6200 my $self = shift( @_ );
6201 my $args = shift( @_ );
6202 my $okParams =
6203 {
6204 expandable => { allowed => $EXPANDABLES->{ 'invoice' } },
6205 auto_advance => { type => "boolean" },
6206 };
6207 $args = $self->_contract( 'invoice', $args ) || CORE::return( $self->pass_error );
6208 my $err = $self->_check_parameters( $okParams, $args );
6209 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
6210 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No invoice id (with parameter 'id') was provided to finalize its information." ) );
6211 my $hash = $self->post( "invoices/${id}", $args ) || CORE::return( $self->pass_error );
6212 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::Invoice', $hash ) );
6213 }
6214 PERL
6215 # NOTE: invoice_item()
6216 invoice_item => <<'PERL',
6217 # Make everyone happy, British English and American English
6218 sub invoice_item { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Billing::Invoice::Item', @_ ) ); }
6219 PERL
6220 # NOTE: invoice_item_create()
6221 invoice_item_create => <<'PERL',
6222 sub invoice_item_create
6223 {
6224 my $self = shift( @_ );
6225 CORE::return( $self->error( "No parameters were provided to create an invoice item" ) ) if( !scalar( @_ ) );
6226 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Billing::Invoice::Item', @_ );
6227 my $okParams =
6228 {
6229 expandable => { allowed => $EXPANDABLES->{invoiceitem} },
6230 customer => { re => qr/^\w+$/, required => 1 },
6231 amount => { type => 'integer' },
6232 currency => { type => 'string' },
6233 description => {},
6234 metadata => { type => 'hash' },
6235 period => { fields => [qw( end! start! )] },
6236 price => { re => qr/^\w+$/ },
6237 discountable => { type => 'boolean' },
6238 discounts => { type => 'array', fields => [qw( coupon discount )] },
6239 invoice => { re => qr/^\w+$/ },
6240 price_data => { fields => [qw(
6241 currency!
6242 product!
6243 unit_amount_decimal!
6244 tax_behavior
6245 unit_amount
6246 )] },
6247 quantity => { type => 'integer' },
6248 subscription => { re => qr/^\w+$/ },
6249 tax_rates => { type => 'array' },
6250 unit_amount => { type => 'integer' },
6251 unit_amount_decimal => { type => 'decimal' },
6252 };
6253 $args = $self->_contract( 'invoiceitem', $args ) || CORE::return( $self->pass_error );
6254 my $err = $self->_check_parameters( $okParams, $args );
6255 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
6256 my $hash = $self->post( 'invoiceitems', $args ) || CORE::return( $self->pass_error );
6257 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::Invoice::Item', $hash ) );
6258 }
6259 PERL
6260 # NOTE: invoice_item_delete()
6261 invoice_item_delete => <<'PERL',
6262 sub invoice_item_delete
6263 {
6264 my $self = shift( @_ );
6265 CORE::return( $self->error( "No parameters were provided to delete an invoice item information." ) ) if( !scalar( @_ ) );
6266 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Billing::Invoice::Item', @_ );
6267 my $okParams =
6268 {
6269 expandable => { allowed => $EXPANDABLES->{invoiceitem} },
6270 id => { re => qr/^\w+$/, required => 1 }
6271 };
6272 my $err = $self->_check_parameters( $okParams, $args );
6273 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
6274 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No invoice item id was provided to delete its information." ) );
6275 my $hash = $self->delete( "invoiceitems/${id}", $args ) || CORE::return( $self->pass_error );
6276 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::Invoice::Item', $hash ) );
6277 }
6278 PERL
6279 # NOTE: invoice_item_list()
6280 invoice_item_list => <<'PERL',
6281 sub invoice_item_list
6282 {
6283 my $self = shift( @_ );
6284 my $args = $self->_get_args( @_ );
6285 my $okParams =
6286 {
6287 expandable => { allowed => $EXPANDABLES->{invoiceitem} },
6288 created => { re => qr/^\d+$/ },
6289 'created.gt' => { re => qr/^\d+$/ },
6290 'created.gte' => { re => qr/^\d+$/ },
6291 'created.lt' => { re => qr/^\d+$/ },
6292 'created.lte' => { re => qr/^\d+$/ },
6293 invoice => { re => qr/^\w+$/ },
6294 ending_before => {},
6295 limit => { re => qr/^\d+$/ },
6296 pending => { type => 'boolean' },
6297 starting_after => {},
6298 };
6299 my $err = $self->_check_parameters( $okParams, $args );
6300 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
6301 if( $args->{expand} )
6302 {
6303 $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
6304 }
6305 my $hash = $self->get( 'invoiceitems', $args ) || CORE::return( $self->pass_error );
6306 CORE::return( $self->_response_to_object( 'Net::API::Stripe::List', $hash ) );
6307 }
6308 PERL
6309 # NOTE: invoice_item_retrieve()
6310 invoice_item_retrieve => <<'PERL',
6311 sub invoice_item_retrieve
6312 {
6313 my $self = shift( @_ );
6314 CORE::return( $self->error( "No parameters were provided to retrieve invoice item information." ) ) if( !scalar( @_ ) );
6315 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Billing::Invoice::Item', @_ );
6316 my $okParams =
6317 {
6318 expandable => { allowed => $EXPANDABLES->{invoiceitem} },
6319 id => { re => qr/^\w+$/, required => 1 }
6320 };
6321 my $err = $self->_check_parameters( $okParams, $args );
6322 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
6323 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No invoice item id was provided to retrieve its information." ) );
6324 my $hash = $self->get( "invoiceitems/${id}", $args ) || CORE::return( $self->pass_error );
6325 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::Invoice::Item', $hash ) );
6326 }
6327 PERL
6328 # NOTE: invoice_item_update()
6329 invoice_item_update => <<'PERL',
6330 sub invoice_item_update
6331 {
6332 my $self = shift( @_ );
6333 CORE::return( $self->error( "No parameters were provided to update an invoice item." ) ) if( !scalar( @_ ) );
6334 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Billing::Invoice::Item', @_ );
6335 my $okParams =
6336 {
6337 expandable => { allowed => $EXPANDABLES->{invoiceitem} },
6338 id => { re => qr/^\w+$/, required => 1 },
6339 amount => { type => 'integer' },
6340 description => {},
6341 metadata => { type => 'hash' },
6342 period => { fields => [qw( end! start! )] },
6343 price => { re => qr/^\w+$/ },
6344 discountable => { type => 'boolean' },
6345 discounts => { type => 'array', fields => [qw( coupon discount )] },
6346 price_data => { fields => [qw(
6347 currency!
6348 product!
6349 unit_amount_decimal!
6350 tax_behavior
6351 unit_amount
6352 )] },
6353 quantity => { type => 'integer' },
6354 tax_rates => { type => 'array' },
6355 unit_amount => { type => 'integer' },
6356 unit_amount_decimal => { type => 'decimal' },
6357 };
6358 $args = $self->_contract( 'invoiceitem', $args ) || CORE::return( $self->pass_error );
6359 # We found some errors
6360 my $err = $self->_check_parameters( $okParams, $args );
6361 # $self->message( 3, "Data to be posted: ", $self->dumper( $args ) ); exit;
6362 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
6363 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No product id was provided to update product's details" ) );
6364 my $hash = $self->post( "invoiceitems/${id}", $args ) || CORE::return( $self->pass_error );
6365 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::Invoice::Item', $hash ) );
6366 }
6367 PERL
6368 # NOTE: invoice_items()
6369 invoice_items => <<'PERL',
6370 sub invoice_items
6371 {
6372 my $self = shift( @_ );
6373 my $action = shift( @_ );
6374 my $allowed = [qw( create retrieve update list delete )];
6375 my $meth = $self->_get_method( 'invoice_item', $action, $allowed ) || CORE::return( $self->pass_error );
6376 CORE::return( $self->$meth( @_ ) );
6377 }
6378 PERL
6379 # NOTE: invoice_line_item()
6380 invoice_line_item => <<'PERL',
6381 sub invoice_line_item { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Billing::Invoice::LineItem', @_ ) ); }
6382 PERL
6383 # NOTE: invoice_lines()
6384 invoice_lines => <<'PERL',
6385 sub invoice_lines
6386 {
6387 my $self = shift( @_ );
6388 CORE::return( $self->error( "No parameters were provided to get the invoice line items." ) ) if( !scalar( @_ ) );
6389 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Billing::Invoice', @_ );
6390 # There are no expandable properties as of 2020-02-14
6391 my $okParams =
6392 {
6393 id => { re => qr/^\w+$/, required => 1 },
6394 # "A cursor for use in pagination. ending_before is an object ID that defines your place in the list."
6395 ending_before => { re => qr/^\w+$/ },
6396 limit => { re => qr/^\d+$/ },
6397 starting_after => { re => qr/^\w+$/ },
6398 };
6399 my $err = $self->_check_parameters( $okParams, $args );
6400 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
6401 my $id = CORE::delete( $args->{id} );
6402 if( $args->{expand} )
6403 {
6404 $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
6405 }
6406 my $hash = $self->get( "invoices/${id}/lines", $args ) || CORE::return( $self->pass_error );
6407 CORE::return( $self->_response_to_object( 'Net::API::Stripe::List', $hash ) );
6408 }
6409 PERL
6410 # NOTE: invoice_lines_upcoming()
6411 invoice_lines_upcoming => <<'PERL',
6412 # NOTE: Retrieve an upcoming invoice's line items
6413 sub invoice_lines_upcoming
6414 {
6415 my $self = shift( @_ );
6416 CORE::return( $self->error( "No parameters were provided to get the incoming invoice line items." ) ) if( !scalar( @_ ) );
6417 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Billing::Invoice', @_ );
6418 # If any
6419 my $obj = $args->{_object};
6420 if( ( $obj && $obj->customer ) ||
6421 ( $self->_is_object( $args->{customer} ) && $args->{customer}->isa( 'Net::API::Stripe::Customer' ) ) )
6422 {
6423 my $cust = $obj ? $obj-customer : $args->{customer};
6424 $args->{customer} = $cust->id || CORE::return( $self->error( "No customer id could be found in this customer object." ) );
6425 }
6426
6427 if( ( $obj && $obj->schedule && $obj->schedule->id ) ||
6428 ( $args->{schedule} && $self->_is_object( $args->{schedule} ) && $args->{schedule}->isa( 'Net::API::Stripe::Billing::Subscription::Schedule' ) ) )
6429 {
6430 my $sched = $obj ? $obj->schedule : $args->{schedule};
6431 $args->{schedule} = $sched->id || CORE::return( $self->error( "No subscription schedule id could be found in this subscription schedule object." ) );
6432 }
6433
6434 if( ( $obj && $obj->subscription && $obj->subscription->id ) ||
6435 ( $args->{subscription} && $self->_is_object( $args->{subscription} ) && $args->{subscription}->isa( 'Net::API::Stripe::Billing::Subscription' ) ) )
6436 {
6437 my $sub = $obj ? $obj->subscription : $args->{subscription};
6438 $args->{subscription} = $sub->id || CORE::return( $self->error( "No subscription id could be found in this subscription object." ) );
6439 }
6440
6441 my $okParams =
6442 {
6443 customer => { re => qr/^\w+$/ },
6444 coupon => {},
6445 ending_before => { re => qr/^\w+$/ },
6446 invoice_items => { type => 'array', fields => [qw( amount currency description discountable invoiceitem metadata period.end period.start quantity tax_rates unit_amount unit_amount_decimal )] },
6447 limit => { re => qr/^\d+$/ },
6448 schedule => { re => qr/^\w+$/ },
6449 starting_after => { re => qr/^\w+$/ },
6450 subscription => { re => qr/^\w+$/ },
6451 # A timestamp
6452 subscription_billing_cycle_anchor => {},
6453 # A timestamp
6454 subscription_cancel_at => {},
6455 # Boolean
6456 subscription_cancel_at_period_end => {},
6457 # "This simulates the subscription being canceled or expired immediately."
6458 subscription_cancel_now => {},
6459 subscription_default_tax_rates => { type => 'array' },
6460 subscription_items => {},
6461 subscription_prorate => { re => qr/^(subscription_items|subscription|subscription_items|subscription_trial_end)$/ },
6462 subscription_proration_behavior => { re => qr/^(create_prorations|none|always_invoice)$/ },
6463 # Timestamp
6464 subscription_proration_date => {},
6465 # Timestamp
6466 subscription_start_date => {},
6467 subscription_tax_percent=> { re => qr/^\d+(\.\d+)?$/ },
6468 subscription_trial_end => {},
6469 subscription_trial_from_plan => {},
6470 };
6471 my $err = $self->_check_parameters( $okParams, $args );
6472 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
6473 if( $args->{expand} )
6474 {
6475 $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
6476 }
6477 my $hash = $self->get( 'invoices/upcoming/lines', $args ) || CORE::return( $self->pass_error );
6478 CORE::return( $self->_response_to_object( 'Net::API::Stripe::List', $hash ) );
6479 }
6480 PERL
6481 # NOTE: invoice_list()
6482 invoice_list => <<'PERL',
6483 sub invoice_list
6484 {
6485 my $self = shift( @_ );
6486 my $args = $self->_get_args( @_ );
6487 if( $self->_is_object( $args->{customer} ) && $args->{customer}->isa( 'Net::API::Stripe::Customer' ) )
6488 {
6489 $args->{customer} = $args->{customer}->id || CORE::return( $self->error( "No customer id could be found in this customer object." ) );
6490 }
6491
6492 if( $args->{subscription} && $self->_is_object( $args->{subscription} ) && $args->{subscription}->isa( 'Net::API::Stripe::Billing::Subscription' ) )
6493 {
6494 $args->{subscription} = $args->{subscription}->id || CORE::return( $self->error( "No subscription id could be found in this subscription object." ) );
6495 }
6496
6497 my $okParams =
6498 {
6499 expandable => { allowed => $EXPANDABLES->{invoice}, data_prefix_is_ok => 1 },
6500 collection_method => { re => qr/^(charge_automatically|send_invoice)$/, type => "string" },
6501 created => { re => qr/^\d+$/, type => "timestamp" },
6502 'created.gt' => { re => qr/^\d+$/ },
6503 'created.gte' => { re => qr/^\d+$/ },
6504 'created.lt' => { re => qr/^\d+$/ },
6505 'created.lte' => { re => qr/^\d+$/ },
6506 customer => { re => qr/^\w+$/, type => "string" },
6507 due_date => { type => "timestamp" },
6508 'due_date.gt' => { re => qr/^\d+$/ },
6509 'due_date.gte' => { re => qr/^\d+$/ },
6510 'due_date.lt' => { re => qr/^\d+$/ },
6511 'due_date.lte' => { re => qr/^\d+$/ },
6512 ending_before => { re => qr/^\w+$/, type => "string" },
6513 limit => { re => qr/^\d+$/, type => "string" },
6514 starting_after => { re => qr/^\w+$/, type => "string" },
6515 status => { re => qr/^(draft|open|paid|uncollectible|void)$/, type => "string" },
6516 subscription => { re => qr/^\w+$/, type => "string" },
6517 };
6518  
6519 my $err = $self->_check_parameters( $okParams, $args );
6520 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
6521 if( $args->{expand} )
6522 {
6523 $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
6524 }
6525 my $hash = $self->get( 'invoices', $args ) || CORE::return( $self->pass_error );
6526 CORE::return( $self->_response_to_object( 'Net::API::Stripe::List', $hash ) );
6527 }
6528 PERL
6529 # NOTE: invoice_pay()
6530 invoice_pay => <<'PERL',
6531 sub invoice_pay
6532 {
6533 my $self = shift( @_ );
6534 CORE::return( $self->error( "No parameters were provided to pay invoice." ) ) if( !scalar( @_ ) );
6535 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Billing::Invoice', @_ );
6536 my $obj = $args->{_object};
6537 if( ( $obj && $obj->payment_method ) ||
6538 ( $args->{payment_method} && $self->_is_object( $args->{payment_method} ) && $args->{payment_method}->isa( 'Net::API::Stripe::Payment::Method' ) ) )
6539 {
6540 my $pm = $obj ? $obj->payment_method : $args->{payment_method};
6541 $args->{payment_method} = $pm->id || CORE::return( $self->error( "No payment method id could be found in this payment method object." ) );
6542 }
6543
6544 if( ( $obj && $obj->source ) ||
6545 ( $args->{source} && $self->_is_object( $args->{source} ) && $args->{source}->isa( 'Net::API::Stripe::Payment::Source' ) ) )
6546 {
6547 my $src = $obj ? $obj->source : $args->{source};
6548 $args->{source} = $src->id || CORE::return( $self->error( "No payment source id could be found in this payment source object." ) );
6549 }
6550 my $okParams =
6551 {
6552 expandable => { allowed => $EXPANDABLES->{invoice} },
6553 forgive => { type => "boolean" },
6554 id => { re => qr/^\w+$/, required => 1 },
6555 mandate => { type => "string" },
6556 off_session => { type => "boolean" },
6557 paid_out_of_band => { type => "boolean" },
6558 payment_method => { re => qr/^\w+$/, type => "string" },
6559 source => { re => qr/^\w+$/, type => "string" },
6560 };
6561  
6562 $args = $self->_contract( 'invoice', $args ) || CORE::return( $self->pass_error );
6563 my $err = $self->_check_parameters( $okParams, $args );
6564 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
6565 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No invoice id was provided to pay it." ) );
6566 my $hash = $self->post( "invoices/${id}/pay", $args ) || CORE::return( $self->pass_error );
6567 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::Invoice', $hash ) );
6568 }
6569 PERL
6570 # NOTE: invoice_retrieve()
6571 invoice_retrieve => <<'PERL',
6572 sub invoice_retrieve
6573 {
6574 my $self = shift( @_ );
6575 CORE::return( $self->error( "No parameters were provided to retrieve invoice information." ) ) if( !scalar( @_ ) );
6576 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Billing::Invoice', @_ );
6577 my $okParams =
6578 {
6579 expandable => { allowed => $EXPANDABLES->{invoice} },
6580 id => { re => qr/^\w+$/, required => 1 }
6581 };
6582 my $err = $self->_check_parameters( $okParams, $args );
6583 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
6584 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No invoice id was provided to retrieve its information." ) );
6585 my $hash = $self->get( "invoices/${id}", $args ) || CORE::return( $self->pass_error );
6586 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::Invoice', $hash ) );
6587 }
6588 PERL
6589 # NOTE: invoice_search()
6590 invoice_search => <<'PERL',
6591 sub invoice_search
6592 {
6593 my $self = shift( @_ );
6594 CORE::return( $self->error( "No parameters were provided to search for an invoice information." ) ) if( !scalar( @_ ) );
6595 my $args = shift( @_ );
6596 my $okParams =
6597 {
6598 expandable => { allowed => $EXPANDABLES->{invoice}, data_prefix_is_ok => 1 },
6599 limit => qr/^\d+$/,
6600 page => qr/^\d+$/,
6601 query => { re => qr/^.*?$/, required => 1, type => "string" },
6602 };
6603  
6604 my $err = $self->_check_parameters( $okParams, $args );
6605 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
6606 if( $args->{expand} )
6607 {
6608 $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
6609 }
6610 my $hash = $self->get( "invoices/search", $args ) || CORE::return( $self->pass_error );
6611 CORE::return( $self->_response_to_object( 'Net::API::Stripe::List', $hash ) );
6612 }
6613 PERL
6614 # NOTE: invoice_send()
6615 invoice_send => <<'PERL',
6616 # NOTE: Send an invoice for manual payment
6617 sub invoice_send
6618 {
6619 my $self = shift( @_ );
6620 CORE::return( $self->error( "No parameters were provided to send invoice." ) ) if( !scalar( @_ ) );
6621 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Billing::Invoice', @_ );
6622 my $okParams =
6623 {
6624 expandable => { allowed => $EXPANDABLES->{invoice} },
6625 id => { re => qr/^\w+$/, required => 1 },
6626 };
6627 $args = $self->_contract( 'invoice', $args ) || CORE::return( $self->pass_error );
6628 my $err = $self->_check_parameters( $okParams, $args );
6629 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
6630 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No invoice id was provided to send it." ) );
6631 my $hash = $self->post( "invoices/${id}/send", $args ) || CORE::return( $self->pass_error );
6632 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::Invoice', $hash ) );
6633 }
6634 PERL
6635 # NOTE: invoice_settings()
6636 invoice_settings => <<'PERL',
6637 sub invoice_settings { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Billing::Invoice::Settings', @_ ) ); }
6638 PERL
6639 # NOTE: invoice_uncollectible()
6640 invoice_uncollectible => <<'PERL',
6641 sub invoice_uncollectible
6642 {
6643 my $self = shift( @_ );
6644 my $args = shift( @_ );
6645 my $okParams =
6646 {
6647 expandable => { allowed => $EXPANDABLES->{ 'invoice' } },
6648 };
6649 $args = $self->_contract( 'invoice', $args ) || CORE::return( $self->pass_error );
6650 my $err = $self->_check_parameters( $okParams, $args );
6651 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
6652 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No invoice id (with parameter 'id') was provided to uncollectible its information." ) );
6653 my $hash = $self->post( "invoices/${id}", $args ) || CORE::return( $self->pass_error );
6654 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::Invoice', $hash ) );
6655 }
6656 PERL
6657 # NOTE: invoice_upcoming()
6658 invoice_upcoming => <<'PERL',
6659 sub invoice_upcoming
6660 {
6661 my $self = shift( @_ );
6662 CORE::return( $self->error( "No parameters were provided to retrieve an upcoming invoice." ) ) if( !scalar( @_ ) );
6663 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Billing::Invoice', @_ );
6664
6665 my $obj = $args->{_object};
6666 if( ( $obj && $obj->customer ) ||
6667 ( $self->_is_object( $args->{customer} ) && $args->{customer}->isa( 'Net::API::Stripe::Customer' ) ) )
6668 {
6669 my $cust = $obj ? $obj->customer : $args->{customer};
6670 $args->{customer} = $cust->id || CORE::return( $self->error( "No customer id could be found in this customer object." ) );
6671 }
6672
6673 if( ( $obj && $obj->schedule ) ||
6674 ( $args->{schedule} && $self->_is_object( $args->{schedule} ) && $args->{schedule}->isa( 'Net::API::Stripe::Billing::Subscription::Schedule' ) ) )
6675 {
6676 my $sched = $obj ? $obj->schedule : $args->{schedule};
6677 $args->{schedule} = $sched->id || CORE::return( $self->error( "No subscription schedule id could be found in this subscription schedule object." ) );
6678 }
6679
6680 if( ( $obj && $obj->subscription ) ||
6681 ( $args->{subscription} && $self->_is_object( $args->{subscription} ) && $args->{subscription}->isa( 'Net::API::Stripe::Billing::Subscription' ) ) )
6682 {
6683 my $sub = $obj ? $obj->subscription : $args->{subscription};
6684 $args->{subscription} = $sub->id || CORE::return( $self->error( "No subscription id could be found in this subscription object." ) );
6685 }
6686
6687 my $okParams =
6688 {
6689 expandable => { allowed => $EXPANDABLES->{invoice}, data_prefix_is_ok => 1 },
6690 automatic_tax => { type => "boolean" },
6691 coupon => { type => "string" },
6692 currency => { type => "currency" },
6693 customer => { re => qr/^\w+$/, type => "string" },
6694 customer_details => {
6695 fields => [
6696 "address",
6697 "address.city",
6698 "address.country",
6699 "address.line1",
6700 "address.line2",
6701 "address.postal_code",
6702 "address.state",
6703 "shipping",
6704 "shipping.address",
6705 "shipping.address.city",
6706 "shipping.address.country",
6707 "shipping.address.line1",
6708 "shipping.address.line2",
6709 "shipping.address.postal_code",
6710 "shipping.address.state",
6711 "shipping.name",
6712 "shipping.phone",
6713 "tax",
6714 "tax.ip_address",
6715 "tax_exempt",
6716 "tax_ids",
6717 "tax_ids.type",
6718 "tax_ids.value",
6719 ],
6720 type => "hash",
6721 },
6722 discounts => { fields => ["coupon", "discount"], type => "array" },
6723 invoice_items => {
6724 fields => [
6725 "amount",
6726 "currency",
6727 "description",
6728 "discountable",
6729 "discounts",
6730 "discounts.coupon",
6731 "discounts.discount",
6732 "invoiceitem",
6733 "metadata",
6734 "period.end!",
6735 "period.start!",
6736 "quantity",
6737 "tax_rates",
6738 "unit_amount",
6739 "unit_amount_decimal",
6740 ],
6741 type => "array",
6742 },
6743 schedule => { re => qr/^\w+$/, type => "string" },
6744 subscription => { re => qr/^\w+$/, type => "string" },
6745 subscription_billing_cycle_anchor => { type => "string" },
6746 subscription_cancel_at => { type => "string" },
6747 subscription_cancel_at_period_end => { type => "string" },
6748 subscription_cancel_now => { type => "string" },
6749 subscription_default_tax_rates => { type => "array" },
6750 subscription_items => { type => "string" },
6751 subscription_prorate => {
6752 re => qr/^(subscription_items|subscription|subscription_items|subscription_trial_end)$/,
6753 },
6754 subscription_proration_behavior => {
6755 re => qr/^(create_prorations|none|always_invoice)$/,
6756 type => "string",
6757 },
6758 subscription_proration_date => { type => "integer" },
6759 subscription_start_date => { type => "string" },
6760 subscription_tax_percent => { re => qr/^\d+(\.\d+)?$/ },
6761 subscription_trial_end => { type => "string" },
6762 subscription_trial_from_plan => { type => "string" },
6763 };
6764  
6765 $args = $self->_contract( 'invoice', $args ) || CORE::return( $self->pass_error );
6766 my $err = $self->_check_parameters( $okParams, $args );
6767 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
6768 my $hash = $self->post( 'invoices/upcoming', $args ) || CORE::return( $self->pass_error );
6769 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::Invoice', $hash ) );
6770 }
6771 PERL
6772 # NOTE: invoice_update()
6773 invoice_update => <<'PERL',
6774 sub invoice_update
6775 {
6776 my $self = shift( @_ );
6777 CORE::return( $self->error( "No parameters were provided to update an invoice" ) ) if( !scalar( @_ ) );
6778 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Billing::Invoice', @_ );
6779
6780 my $okParams =
6781 {
6782 expandable => { allowed => $EXPANDABLES->{invoice} },
6783 account_tax_ids => { type => "array" },
6784 application_fee_amount => { re => qr/^\d+$/, type => "integer" },
6785 auto_advance => { type => "boolean" },
6786 automatic_tax => { fields => ["enabled"], type => "hash" },
6787 collection_method => { re => qr/^(charge_automatically|send_invoice)$/, type => "string" },
6788 custom_fields => { fields => ["name", "value"], type => "array" },
6789 days_until_due => { re => qr/^\d+$/, type => "integer" },
6790 default_payment_method => { re => qr/^\w+$/, type => "string" },
6791 default_source => { re => qr/^\w+$/, type => "string" },
6792 default_tax_rates => { re => qr/^\d+(?:\.\d+)?$/, type => "array" },
6793 description => { type => "string" },
6794 discounts => { fields => ["coupon", "discount"], type => "array" },
6795 due_date => { type => "timestamp" },
6796 footer => { type => "string" },
6797 id => { re => qr/^\w+$/, required => 1 },
6798 metadata => { type => "hash" },
6799 on_behalf_of => { re => qr/^\w+$/, type => "string" },
6800 payment_settings => {
6801 fields => [
6802 "payment_method_options.acss_debit",
6803 "payment_method_options.acss_debit.mandate_options",
6804 "payment_method_options.acss_debit.mandate_options.transaction_type",
6805 "payment_method_options.acss_debit.verification_method",
6806 "payment_method_options.bancontact",
6807 "payment_method_options.bancontact.preferred_language",
6808 "payment_method_options.card",
6809 "payment_method_options.card.request_three_d_secure",
6810 "payment_method_options.customer_balance",
6811 "payment_method_options.customer_balance.bank_transfer",
6812 "payment_method_options.customer_balance.bank_transfer.eu_bank_transfer",
6813 "payment_method_options.customer_balance.bank_transfer.eu_bank_transfer.country",
6814 "payment_method_options.customer_balance.bank_transfer.type",
6815 "payment_method_options.customer_balance.funding_type",
6816 "payment_method_options.konbini",
6817 "payment_method_options.us_bank_account",
6818 "payment_method_options.us_bank_account.financial_connections",
6819 "payment_method_options.us_bank_account.financial_connections.permissions",
6820 "payment_method_options.us_bank_account.verification_method",
6821 "payment_method_types",
6822 ],
6823 type => "hash",
6824 },
6825 rendering_options => { fields => ["amount_tax_display"], type => "hash" },
6826 statement_descriptor => { type => "string" },
6827 transfer_data => { fields => ["destination", "amount"], type => "hash" },
6828 };
6829  
6830 $args = $self->_contract( 'invoice', $args ) || CORE::return( $self->pass_error );
6831 # We found some errors
6832 my $err = $self->_check_parameters( $okParams, $args );
6833 # $self->message( 3, "Data to be posted: ", $self->dumper( $args ) ); exit;
6834 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
6835 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No invoice id was provided to update invoice's details" ) );
6836 my $hash = $self->post( "invoices/${id}", $args ) || CORE::return( $self->pass_error );
6837 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::Invoice', $hash ) );
6838 }
6839 PERL
6840 # NOTE: invoice_void()
6841 invoice_void => <<'PERL',
6842 sub invoice_void
6843 {
6844 my $self = shift( @_ );
6845 CORE::return( $self->error( "No parameters were provided to void invoice information." ) ) if( !scalar( @_ ) );
6846 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Billing::Invoice', @_ );
6847 my $okParams =
6848 {
6849 expandable => { allowed => $EXPANDABLES->{invoice} },
6850 id => { re => qr/^\w+$/, required => 1 }
6851 };
6852 my $err = $self->_check_parameters( $okParams, $args );
6853 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
6854 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No invoice id was provided to void it." ) );
6855 my $hash = $self->post( "invoices/${id}/void", $args ) || CORE::return( $self->pass_error );
6856 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::Invoice', $hash ) );
6857 }
6858 PERL
6859 # NOTE: invoice_write_off()
6860 invoice_write_off => <<'PERL',
6861 # NOTE: Mark an invoice as uncollectible
6862 sub invoice_write_off
6863 {
6864 my $self = shift( @_ );
6865 CORE::return( $self->error( "No parameters were provided to make invoice uncollectible." ) ) if( !scalar( @_ ) );
6866 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Billing::Invoice', @_ );
6867 my $okParams =
6868 {
6869 expandable => { allowed => $EXPANDABLES->{invoice} },
6870 id => { re => qr/^\w+$/, required => 1 }
6871 };
6872 my $err = $self->_check_parameters( $okParams, $args );
6873 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
6874 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No invoice id was provided to make it uncollectible." ) );
6875 my $hash = $self->post( "invoices/${id}/mark_uncollectible", $args ) || CORE::return( $self->pass_error );
6876 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::Invoice', $hash ) );
6877 }
6878 PERL
6879 # NOTE: invoiceitem()
6880 invoiceitem => <<'PERL',
6881 sub invoiceitem { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Billing::Invoice::Item', @_ ) ); }
6882 PERL
6883 # NOTE: invoiceitem_create()
6884 invoiceitem_create => <<'PERL',
6885 sub invoiceitem_create
6886 {
6887 my $self = shift( @_ );
6888 my $args = shift( @_ );
6889 my $okParams =
6890 {
6891 expandable => { allowed => $EXPANDABLES->{ 'invoiceitem' } },
6892 amount => { type => "integer" },
6893 currency => { type => "string" },
6894 customer => { type => "string", required => 1 },
6895 description => { type => "string" },
6896 discountable => { type => "boolean" },
6897 discounts => { type => "array" },
6898 invoice => { type => "string" },
6899 metadata => { type => "hash" },
6900 period => { type => "hash" },
6901 price => { type => "hash" },
6902 price_data => { type => "object" },
6903 quantity => { type => "integer" },
6904 subscription => { type => "string" },
6905 tax_rates => { type => "array" },
6906 unit_amount => { type => "integer" },
6907 unit_amount_decimal => { type => "decimal" },
6908 };
6909 $args = $self->_contract( 'invoiceitem', $args ) || CORE::return( $self->pass_error );
6910 my $err = $self->_check_parameters( $okParams, $args );
6911 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
6912 my $hash = $self->post( "invoiceitems", $args ) || CORE::return( $self->pass_error );
6913 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::Invoice::Item', $hash ) );
6914 }
6915 PERL
6916 # NOTE: invoiceitem_delete()
6917 invoiceitem_delete => <<'PERL',
6918 sub invoiceitem_delete
6919 {
6920 my $self = shift( @_ );
6921 my $args = shift( @_ );
6922 my $okParams =
6923 {
6924 expandable => { allowed => $EXPANDABLES->{ 'invoiceitem' } },
6925 };
6926 $args = $self->_contract( 'invoiceitem', $args ) || CORE::return( $self->pass_error );
6927 my $err = $self->_check_parameters( $okParams, $args );
6928 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
6929 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No invoiceitem id (with parameter 'id') was provided to delete its information." ) );
6930 my $hash = $self->delete( "invoiceitems/${id}", $args ) || CORE::return( $self->pass_error );
6931 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::Invoice::Item', $hash ) );
6932 }
6933 PERL
6934 # NOTE: invoiceitem_list()
6935 invoiceitem_list => <<'PERL',
6936 sub invoiceitem_list
6937 {
6938 my $self = shift( @_ );
6939 CORE::return( $self->error( "No parameters were provided to list invoiceitem information." ) ) if( !scalar( @_ ) );
6940 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Billing::Invoice::Item', @_ );
6941 my $okParams =
6942 {
6943 expandable => { allowed => $EXPANDABLES->{ 'invoiceitem' }, data_prefix_is_ok => 1 },
6944 created => { type => "hash" },
6945 customer => { type => "string" },
6946 ending_before => { type => "string" },
6947 invoice => { type => "string" },
6948 limit => { type => "string" },
6949 pending => { type => "string" },
6950 starting_after => { type => "string" },
6951 };
6952 my $err = $self->_check_parameters( $okParams, $args );
6953 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
6954 if( $args->{expand} )
6955 {
6956 $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
6957 }
6958 my $hash = $self->get( "invoiceitems", $args ) || CORE::return( $self->pass_error );
6959 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::Invoice::Item', $hash ) );
6960 }
6961 PERL
6962 # NOTE: invoiceitem_retrieve()
6963 invoiceitem_retrieve => <<'PERL',
6964 sub invoiceitem_retrieve
6965 {
6966 my $self = shift( @_ );
6967 my $args = shift( @_ );
6968 my $okParams =
6969 {
6970 expandable => { allowed => $EXPANDABLES->{ 'invoiceitem' }, data_prefix_is_ok => 1 },
6971 };
6972 $args = $self->_contract( 'invoiceitem', $args ) || CORE::return( $self->pass_error );
6973 my $err = $self->_check_parameters( $okParams, $args );
6974 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
6975 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No invoiceitem id (with parameter 'id') was provided to retrieve its information." ) );
6976 my $hash = $self->get( "invoiceitems/${id}", $args ) || CORE::return( $self->pass_error );
6977 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::Invoice::Item', $hash ) );
6978 }
6979 PERL
6980 # NOTE: invoiceitem_update()
6981 invoiceitem_update => <<'PERL',
6982 sub invoiceitem_update
6983 {
6984 my $self = shift( @_ );
6985 my $args = shift( @_ );
6986 my $okParams =
6987 {
6988 expandable => { allowed => $EXPANDABLES->{ 'invoiceitem' } },
6989 amount => { type => "integer" },
6990 description => { type => "string" },
6991 discountable => { type => "boolean" },
6992 discounts => { type => "array" },
6993 metadata => { type => "hash" },
6994 period => { type => "hash" },
6995 price => { type => "hash" },
6996 price_data => { type => "object" },
6997 quantity => { type => "integer" },
6998 tax_rates => { type => "array" },
6999 unit_amount => { type => "integer" },
7000 unit_amount_decimal => { type => "decimal" },
7001 };
7002 $args = $self->_contract( 'invoiceitem', $args ) || CORE::return( $self->pass_error );
7003 my $err = $self->_check_parameters( $okParams, $args );
7004 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
7005 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No invoiceitem id (with parameter 'id') was provided to update its information." ) );
7006 my $hash = $self->post( "invoiceitems/${id}", $args ) || CORE::return( $self->pass_error );
7007 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::Invoice::Item', $hash ) );
7008 }
7009 PERL
7010 # NOTE: invoiceitems()
7011 invoiceitems => <<'PERL',
7012 # <https://stripe.com/docs/api/invoiceitems>
7013 sub invoiceitems
7014 {
7015 my $self = shift( @_ );
7016 my $allowed = [qw( create delete list retrieve update )];
7017 my $action = shift( @_ );
7018 my $meth = $self->_get_method( 'invoiceitem', $action, $allowed ) || CORE::return( $self->pass_error );
7019 CORE::return( $self->$meth( @_ ) );
7020 }
7021 PERL
7022 # NOTE: invoices()
7023 invoices => <<'PERL',
7024 # <https://stripe.com/docs/api/invoices>
7025 sub invoices
7026 {
7027 my $self = shift( @_ );
7028 my $allowed = [qw( create delete finalise finalize invoice_write_off lines lines_upcoming list pay retrieve search send uncollectible upcoming update void )];
7029 my $action = shift( @_ );
7030 my $meth = $self->_get_method( 'invoice', $action, $allowed ) || CORE::return( $self->pass_error );
7031 CORE::return( $self->$meth( @_ ) );
7032 }
7033 PERL
7034 # NOTE: ip_address_location()
7035 ip_address_location => <<'PERL',
7036 sub ip_address_location { CORE::return( shift->_response_to_object( 'Net::API::Stripe::GeoLocation', @_ ) ); }
7037 PERL
7038 # NOTE: issuing_authorization()
7039 issuing_authorization => <<'PERL',
7040 sub issuing_authorization { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Issuing::Authorization', @_ ) ); }
7041 PERL
7042 # NOTE: issuing_authorization_approve()
7043 issuing_authorization_approve => <<'PERL',
7044 sub issuing_authorization_approve
7045 {
7046 my $self = shift( @_ );
7047 my $args = shift( @_ );
7048 my $okParams =
7049 {
7050 expandable => { allowed => $EXPANDABLES->{ 'issuing.authorization' } },
7051 amount => { type => "integer" },
7052 metadata => { type => "hash" },
7053 };
7054 $args = $self->_contract( 'issuing.authorization', $args ) || CORE::return( $self->pass_error );
7055 my $err = $self->_check_parameters( $okParams, $args );
7056 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
7057 my $hash = $self->post( "", $args ) || CORE::return( $self->pass_error );
7058 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Issuing::Authorization', $hash ) );
7059 }
7060 PERL
7061 # NOTE: issuing_authorization_decline()
7062 issuing_authorization_decline => <<'PERL',
7063 sub issuing_authorization_decline
7064 {
7065 my $self = shift( @_ );
7066 my $args = shift( @_ );
7067 my $okParams =
7068 {
7069 expandable => { allowed => $EXPANDABLES->{ 'issuing.authorization' } },
7070 metadata => { type => "hash" },
7071 };
7072 $args = $self->_contract( 'issuing.authorization', $args ) || CORE::return( $self->pass_error );
7073 my $err = $self->_check_parameters( $okParams, $args );
7074 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
7075 my $hash = $self->post( "", $args ) || CORE::return( $self->pass_error );
7076 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Issuing::Authorization', $hash ) );
7077 }
7078 PERL
7079 # NOTE: issuing_authorization_list()
7080 issuing_authorization_list => <<'PERL',
7081 sub issuing_authorization_list
7082 {
7083 my $self = shift( @_ );
7084 CORE::return( $self->error( "No parameters were provided to list issuing authorization information." ) ) if( !scalar( @_ ) );
7085 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Issuing::Authorization', @_ );
7086 my $okParams =
7087 {
7088 expandable => { allowed => $EXPANDABLES->{ 'issuing.authorization' }, data_prefix_is_ok => 1 },
7089 card => { type => "hash" },
7090 cardholder => { type => "string" },
7091 created => { type => "timestamp" },
7092 ending_before => { type => "string" },
7093 limit => { type => "string" },
7094 starting_after => { type => "string" },
7095 status => { type => "string" },
7096 };
7097 my $err = $self->_check_parameters( $okParams, $args );
7098 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
7099 if( $args->{expand} )
7100 {
7101 $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
7102 }
7103 my $hash = $self->get( "", $args ) || CORE::return( $self->pass_error );
7104 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Issuing::Authorization', $hash ) );
7105 }
7106 PERL
7107 # NOTE: issuing_authorization_retrieve()
7108 issuing_authorization_retrieve => <<'PERL',
7109 sub issuing_authorization_retrieve
7110 {
7111 my $self = shift( @_ );
7112 my $args = shift( @_ );
7113 my $okParams =
7114 {
7115 expandable => { allowed => $EXPANDABLES->{ 'issuing.authorization' }, data_prefix_is_ok => 1 },
7116 };
7117 $args = $self->_contract( 'issuing.authorization', $args ) || CORE::return( $self->pass_error );
7118 my $err = $self->_check_parameters( $okParams, $args );
7119 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
7120 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No issuing.authorization id (with parameter 'id') was provided to retrieve its information." ) );
7121 my $hash = $self->get( "issuing/authorizations/${id}", $args ) || CORE::return( $self->pass_error );
7122 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Issuing::Authorization', $hash ) );
7123 }
7124 PERL
7125 # NOTE: issuing_authorization_update()
7126 issuing_authorization_update => <<'PERL',
7127 sub issuing_authorization_update
7128 {
7129 my $self = shift( @_ );
7130 my $args = shift( @_ );
7131 my $okParams =
7132 {
7133 expandable => { allowed => $EXPANDABLES->{ 'issuing.authorization' } },
7134 metadata => { type => "hash" },
7135 };
7136 $args = $self->_contract( 'issuing.authorization', $args ) || CORE::return( $self->pass_error );
7137 my $err = $self->_check_parameters( $okParams, $args );
7138 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
7139 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No issuing.authorization id (with parameter 'id') was provided to update its information." ) );
7140 my $hash = $self->post( "issuing/authorizations/${id}", $args ) || CORE::return( $self->pass_error );
7141 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Issuing::Authorization', $hash ) );
7142 }
7143 PERL
7144 # NOTE: issuing_authorizations()
7145 issuing_authorizations => <<'PERL',
7146 # <https://stripe.com/docs/api/issuing/authorizations>
7147 sub issuing_authorizations
7148 {
7149 my $self = shift( @_ );
7150 my $allowed = [qw( approve decline list retrieve update )];
7151 my $action = shift( @_ );
7152 my $meth = $self->_get_method( 'issuing_authorization', $action, $allowed ) || CORE::return( $self->pass_error );
7153 CORE::return( $self->$meth( @_ ) );
7154 }
7155 PERL
7156 # NOTE: issuing_card()
7157 issuing_card => <<'PERL',
7158 # sub issuing { CORE::return( shift->_instantiate( 'issuing', 'Net::API::Stripe::Issuing' ) ) }
7159 sub issuing_card { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Issuing::Card', @_ ) ); }
7160 PERL
7161 # NOTE: issuing_card_create()
7162 issuing_card_create => <<'PERL',
7163 sub issuing_card_create
7164 {
7165 my $self = shift( @_ );
7166 my $args = shift( @_ );
7167 my $okParams =
7168 {
7169 expandable => { allowed => $EXPANDABLES->{ 'issuing.card' } },
7170 cardholder => { type => "hash" },
7171 currency => { type => "string", required => 1 },
7172 metadata => { type => "hash" },
7173 replacement_for => { type => "string" },
7174 replacement_reason => { type => "string" },
7175 shipping => { type => "hash" },
7176 spending_controls => { type => "hash" },
7177 status => { type => "string" },
7178 type => { type => "string", required => 1 },
7179 };
7180 $args = $self->_contract( 'issuing.card', $args ) || CORE::return( $self->pass_error );
7181 my $err = $self->_check_parameters( $okParams, $args );
7182 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
7183 my $hash = $self->post( "", $args ) || CORE::return( $self->pass_error );
7184 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Issuing::Card', $hash ) );
7185 }
7186 PERL
7187 # NOTE: issuing_card_deliver()
7188 issuing_card_deliver => <<'PERL',
7189 sub issuing_card_deliver
7190 {
7191 my $self = shift( @_ );
7192 my $args = shift( @_ );
7193 my $okParams =
7194 {
7195 expandable => { allowed => $EXPANDABLES->{ 'issuing.card' } },
7196 };
7197 $args = $self->_contract( 'issuing.card', $args ) || CORE::return( $self->pass_error );
7198 my $err = $self->_check_parameters( $okParams, $args );
7199 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
7200 my $card = CORE::delete( $args->{card} ) || CORE::return( $self->error( "No issuing.card id (with parameter 'card') was provided to deliver its information." ) );
7201 my $hash = $self->post( "test_helpers/issuing/cards/${card}/shipping", $args ) || CORE::return( $self->pass_error );
7202 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Issuing::Card', $hash ) );
7203 }
7204 PERL
7205 # NOTE: issuing_card_fail()
7206 issuing_card_fail => <<'PERL',
7207 sub issuing_card_fail
7208 {
7209 my $self = shift( @_ );
7210 my $args = shift( @_ );
7211 my $okParams =
7212 {
7213 expandable => { allowed => $EXPANDABLES->{ 'issuing.card' } },
7214 };
7215 $args = $self->_contract( 'issuing.card', $args ) || CORE::return( $self->pass_error );
7216 my $err = $self->_check_parameters( $okParams, $args );
7217 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
7218 my $card = CORE::delete( $args->{card} ) || CORE::return( $self->error( "No issuing.card id (with parameter 'card') was provided to fail its information." ) );
7219 my $hash = $self->post( "test_helpers/issuing/cards/${card}/shipping", $args ) || CORE::return( $self->pass_error );
7220 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Issuing::Card', $hash ) );
7221 }
7222 PERL
7223 # NOTE: issuing_card_list()
7224 issuing_card_list => <<'PERL',
7225 sub issuing_card_list
7226 {
7227 my $self = shift( @_ );
7228 CORE::return( $self->error( "No parameters were provided to list issuing card information." ) ) if( !scalar( @_ ) );
7229 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Issuing::Card', @_ );
7230 my $okParams =
7231 {
7232 expandable => { allowed => $EXPANDABLES->{ 'issuing.card' }, data_prefix_is_ok => 1 },
7233 cardholder => { type => "hash" },
7234 created => { type => "timestamp" },
7235 ending_before => { type => "string" },
7236 exp_month => { type => "integer" },
7237 exp_year => { type => "integer" },
7238 last4 => { type => "string" },
7239 limit => { type => "string" },
7240 starting_after => { type => "string" },
7241 status => { type => "string" },
7242 type => { type => "string" },
7243 };
7244 my $err = $self->_check_parameters( $okParams, $args );
7245 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
7246 if( $args->{expand} )
7247 {
7248 $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
7249 }
7250 my $hash = $self->get( "", $args ) || CORE::return( $self->pass_error );
7251 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Issuing::Card', $hash ) );
7252 }
7253 PERL
7254 # NOTE: issuing_card_retrieve()
7255 issuing_card_retrieve => <<'PERL',
7256 sub issuing_card_retrieve
7257 {
7258 my $self = shift( @_ );
7259 my $args = shift( @_ );
7260 my $okParams =
7261 {
7262 expandable => { allowed => $EXPANDABLES->{ 'issuing.card' }, data_prefix_is_ok => 1 },
7263 };
7264 $args = $self->_contract( 'issuing.card', $args ) || CORE::return( $self->pass_error );
7265 my $err = $self->_check_parameters( $okParams, $args );
7266 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
7267 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No issuing.card id (with parameter 'id') was provided to retrieve its information." ) );
7268 my $hash = $self->get( "issuing/cards/${id}", $args ) || CORE::return( $self->pass_error );
7269 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Issuing::Card', $hash ) );
7270 }
7271 PERL
7272 # NOTE: issuing_card_return()
7273 issuing_card_return => <<'PERL',
7274 sub issuing_card_return
7275 {
7276 my $self = shift( @_ );
7277 my $args = shift( @_ );
7278 my $okParams =
7279 {
7280 expandable => { allowed => $EXPANDABLES->{ 'issuing.card' } },
7281 };
7282 $args = $self->_contract( 'issuing.card', $args ) || CORE::return( $self->pass_error );
7283 my $err = $self->_check_parameters( $okParams, $args );
7284 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
7285 my $card = CORE::delete( $args->{card} ) || CORE::return( $self->error( "No issuing.card id (with parameter 'card') was provided to return its information." ) );
7286 my $hash = $self->post( "test_helpers/issuing/cards/${card}/shipping", $args ) || CORE::return( $self->pass_error );
7287 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Issuing::Card', $hash ) );
7288 }
7289 PERL
7290 # NOTE: issuing_card_ship()
7291 issuing_card_ship => <<'PERL',
7292 sub issuing_card_ship
7293 {
7294 my $self = shift( @_ );
7295 my $args = shift( @_ );
7296 my $okParams =
7297 {
7298 expandable => { allowed => $EXPANDABLES->{ 'issuing.card' } },
7299 };
7300 $args = $self->_contract( 'issuing.card', $args ) || CORE::return( $self->pass_error );
7301 my $err = $self->_check_parameters( $okParams, $args );
7302 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
7303 my $card = CORE::delete( $args->{card} ) || CORE::return( $self->error( "No issuing.card id (with parameter 'card') was provided to ship its information." ) );
7304 my $hash = $self->post( "test_helpers/issuing/cards/${card}/shipping", $args ) || CORE::return( $self->pass_error );
7305 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Issuing::Card', $hash ) );
7306 }
7307 PERL
7308 # NOTE: issuing_card_update()
7309 issuing_card_update => <<'PERL',
7310 sub issuing_card_update
7311 {
7312 my $self = shift( @_ );
7313 my $args = shift( @_ );
7314 my $okParams =
7315 {
7316 expandable => { allowed => $EXPANDABLES->{ 'issuing.card' } },
7317 cancellation_reason => { type => "string" },
7318 metadata => { type => "hash" },
7319 pin => { type => "object" },
7320 spending_controls => { type => "hash" },
7321 status => { type => "string" },
7322 };
7323 $args = $self->_contract( 'issuing.card', $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 $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No issuing.card id (with parameter 'id') was provided to update its information." ) );
7327 my $hash = $self->post( "issuing/cards/${id}", $args ) || CORE::return( $self->pass_error );
7328 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Issuing::Card', $hash ) );
7329 }
7330 PERL
7331 # NOTE: issuing_cardholder()
7332 issuing_cardholder => <<'PERL',
7333 sub issuing_cardholder { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Issuing::Card::Holder', @_ ) ); }
7334 PERL
7335 # NOTE: issuing_cardholder_create()
7336 issuing_cardholder_create => <<'PERL',
7337 sub issuing_cardholder_create
7338 {
7339 my $self = shift( @_ );
7340 my $args = shift( @_ );
7341 my $okParams =
7342 {
7343 expandable => { allowed => $EXPANDABLES->{ 'issuing.cardholder' } },
7344 billing => { type => "hash", required => 1 },
7345 company => { type => "hash" },
7346 email => { type => "string" },
7347 individual => { type => "hash" },
7348 metadata => { type => "hash" },
7349 name => { type => "string", required => 1 },
7350 phone_number => { type => "string" },
7351 spending_controls => { type => "hash" },
7352 status => { type => "string" },
7353 type => { type => "string", required => 1 },
7354 };
7355 $args = $self->_contract( 'issuing.cardholder', $args ) || CORE::return( $self->pass_error );
7356 my $err = $self->_check_parameters( $okParams, $args );
7357 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
7358 my $hash = $self->post( "", $args ) || CORE::return( $self->pass_error );
7359 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Issuing::Card::Holder', $hash ) );
7360 }
7361 PERL
7362 # NOTE: issuing_cardholder_list()
7363 issuing_cardholder_list => <<'PERL',
7364 sub issuing_cardholder_list
7365 {
7366 my $self = shift( @_ );
7367 CORE::return( $self->error( "No parameters were provided to list issuing cardholder information." ) ) if( !scalar( @_ ) );
7368 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Issuing::Card::Holder', @_ );
7369 my $okParams =
7370 {
7371 expandable => { allowed => $EXPANDABLES->{ 'issuing.cardholder' }, data_prefix_is_ok => 1 },
7372 created => { type => "timestamp" },
7373 email => { type => "string" },
7374 ending_before => { type => "string" },
7375 limit => { type => "string" },
7376 phone_number => { type => "string" },
7377 starting_after => { type => "string" },
7378 status => { type => "string" },
7379 type => { type => "string" },
7380 };
7381 my $err = $self->_check_parameters( $okParams, $args );
7382 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
7383 if( $args->{expand} )
7384 {
7385 $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
7386 }
7387 my $hash = $self->get( "", $args ) || CORE::return( $self->pass_error );
7388 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Issuing::Card::Holder', $hash ) );
7389 }
7390 PERL
7391 # NOTE: issuing_cardholder_retrieve()
7392 issuing_cardholder_retrieve => <<'PERL',
7393 sub issuing_cardholder_retrieve
7394 {
7395 my $self = shift( @_ );
7396 my $args = shift( @_ );
7397 my $okParams =
7398 {
7399 expandable => { allowed => $EXPANDABLES->{ 'issuing.cardholder' }, data_prefix_is_ok => 1 },
7400 };
7401 $args = $self->_contract( 'issuing.cardholder', $args ) || CORE::return( $self->pass_error );
7402 my $err = $self->_check_parameters( $okParams, $args );
7403 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
7404 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No issuing.cardholder id (with parameter 'id') was provided to retrieve its information." ) );
7405 my $hash = $self->get( "issuing/cardholders/${id}", $args ) || CORE::return( $self->pass_error );
7406 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Issuing::Card::Holder', $hash ) );
7407 }
7408 PERL
7409 # NOTE: issuing_cardholder_update()
7410 issuing_cardholder_update => <<'PERL',
7411 sub issuing_cardholder_update
7412 {
7413 my $self = shift( @_ );
7414 my $args = shift( @_ );
7415 my $okParams =
7416 {
7417 expandable => { allowed => $EXPANDABLES->{ 'issuing.cardholder' } },
7418 billing => { type => "hash" },
7419 company => { type => "hash" },
7420 email => { type => "string" },
7421 individual => { type => "hash" },
7422 metadata => { type => "hash" },
7423 phone_number => { type => "string" },
7424 spending_controls => { type => "hash" },
7425 status => { type => "string" },
7426 };
7427 $args = $self->_contract( 'issuing.cardholder', $args ) || CORE::return( $self->pass_error );
7428 my $err = $self->_check_parameters( $okParams, $args );
7429 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
7430 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No issuing.cardholder id (with parameter 'id') was provided to update its information." ) );
7431 my $hash = $self->post( "issuing/cardholders/${id}", $args ) || CORE::return( $self->pass_error );
7432 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Issuing::Card::Holder', $hash ) );
7433 }
7434 PERL
7435 # NOTE: issuing_cardholders()
7436 issuing_cardholders => <<'PERL',
7437 # <https://stripe.com/docs/api/issuing/cardholders>
7438 sub issuing_cardholders
7439 {
7440 my $self = shift( @_ );
7441 my $allowed = [qw( create list retrieve update )];
7442 my $action = shift( @_ );
7443 my $meth = $self->_get_method( 'issuing_cardholder', $action, $allowed ) || CORE::return( $self->pass_error );
7444 CORE::return( $self->$meth( @_ ) );
7445 }
7446 PERL
7447 # NOTE: issuing_cards()
7448 issuing_cards => <<'PERL',
7449 # <https://stripe.com/docs/api/issuing/cards>
7450 sub issuing_cards
7451 {
7452 my $self = shift( @_ );
7453 my $allowed = [qw( create deliver fail list retrieve return ship update )];
7454 my $action = shift( @_ );
7455 my $meth = $self->_get_method( 'issuing_card', $action, $allowed ) || CORE::return( $self->pass_error );
7456 CORE::return( $self->$meth( @_ ) );
7457 }
7458 PERL
7459 # NOTE: issuing_dispute()
7460 issuing_dispute => <<'PERL',
7461 sub issuing_dispute { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Issuing::Dispute', @_ ) ); }
7462 PERL
7463 # NOTE: issuing_dispute_create()
7464 issuing_dispute_create => <<'PERL',
7465 sub issuing_dispute_create
7466 {
7467 my $self = shift( @_ );
7468 my $args = shift( @_ );
7469 my $okParams =
7470 {
7471 expandable => { allowed => $EXPANDABLES->{ 'issuing.dispute' } },
7472 evidence => { type => "hash" },
7473 metadata => { type => "hash" },
7474 transaction => { type => "string" },
7475 };
7476 $args = $self->_contract( 'issuing.dispute', $args ) || CORE::return( $self->pass_error );
7477 my $err = $self->_check_parameters( $okParams, $args );
7478 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
7479 my $hash = $self->post( "", $args ) || CORE::return( $self->pass_error );
7480 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Issuing::Dispute', $hash ) );
7481 }
7482 PERL
7483 # NOTE: issuing_dispute_list()
7484 issuing_dispute_list => <<'PERL',
7485 sub issuing_dispute_list
7486 {
7487 my $self = shift( @_ );
7488 CORE::return( $self->error( "No parameters were provided to list issuing dispute information." ) ) if( !scalar( @_ ) );
7489 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Issuing::Dispute', @_ );
7490 my $okParams =
7491 {
7492 expandable => { allowed => $EXPANDABLES->{ 'issuing.dispute' }, data_prefix_is_ok => 1 },
7493 created => { type => "timestamp" },
7494 ending_before => { type => "string" },
7495 limit => { type => "string" },
7496 starting_after => { type => "string" },
7497 status => { type => "string" },
7498 transaction => { type => "string" },
7499 };
7500 my $err = $self->_check_parameters( $okParams, $args );
7501 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
7502 if( $args->{expand} )
7503 {
7504 $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
7505 }
7506 my $hash = $self->get( "", $args ) || CORE::return( $self->pass_error );
7507 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Issuing::Dispute', $hash ) );
7508 }
7509 PERL
7510 # NOTE: issuing_dispute_retrieve()
7511 issuing_dispute_retrieve => <<'PERL',
7512 sub issuing_dispute_retrieve
7513 {
7514 my $self = shift( @_ );
7515 my $args = shift( @_ );
7516 my $okParams =
7517 {
7518 expandable => { allowed => $EXPANDABLES->{ 'issuing.dispute' }, data_prefix_is_ok => 1 },
7519 };
7520 $args = $self->_contract( 'issuing.dispute', $args ) || CORE::return( $self->pass_error );
7521 my $err = $self->_check_parameters( $okParams, $args );
7522 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
7523 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No issuing.dispute id (with parameter 'id') was provided to retrieve its information." ) );
7524 my $hash = $self->get( "issuing/disputes/${id}", $args ) || CORE::return( $self->pass_error );
7525 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Issuing::Dispute', $hash ) );
7526 }
7527 PERL
7528 # NOTE: issuing_dispute_submit()
7529 issuing_dispute_submit => <<'PERL',
7530 sub issuing_dispute_submit
7531 {
7532 my $self = shift( @_ );
7533 my $args = shift( @_ );
7534 my $okParams =
7535 {
7536 expandable => { allowed => $EXPANDABLES->{ 'issuing.dispute' } },
7537 metadata => { type => "hash" },
7538 };
7539 $args = $self->_contract( 'issuing.dispute', $args ) || CORE::return( $self->pass_error );
7540 my $err = $self->_check_parameters( $okParams, $args );
7541 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
7542 my $hash = $self->post( "", $args ) || CORE::return( $self->pass_error );
7543 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Issuing::Dispute', $hash ) );
7544 }
7545 PERL
7546 # NOTE: issuing_dispute_update()
7547 issuing_dispute_update => <<'PERL',
7548 sub issuing_dispute_update
7549 {
7550 my $self = shift( @_ );
7551 my $args = shift( @_ );
7552 my $okParams =
7553 {
7554 expandable => { allowed => $EXPANDABLES->{ 'issuing.dispute' } },
7555 evidence => { type => "hash" },
7556 metadata => { type => "hash" },
7557 };
7558 $args = $self->_contract( 'issuing.dispute', $args ) || CORE::return( $self->pass_error );
7559 my $err = $self->_check_parameters( $okParams, $args );
7560 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
7561 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No issuing.dispute id (with parameter 'id') was provided to update its information." ) );
7562 my $hash = $self->post( "issuing/disputes/${id}", $args ) || CORE::return( $self->pass_error );
7563 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Issuing::Dispute', $hash ) );
7564 }
7565 PERL
7566 # NOTE: issuing_disputes()
7567 issuing_disputes => <<'PERL',
7568 # <https://stripe.com/docs/api/issuing/disputes>
7569 sub issuing_disputes
7570 {
7571 my $self = shift( @_ );
7572 my $allowed = [qw( create list retrieve submit update )];
7573 my $action = shift( @_ );
7574 my $meth = $self->_get_method( 'issuing_dispute', $action, $allowed ) || CORE::return( $self->pass_error );
7575 CORE::return( $self->$meth( @_ ) );
7576 }
7577 PERL
7578 # NOTE: issuing_transaction()
7579 issuing_transaction => <<'PERL',
7580 sub issuing_transaction { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Issuing::Transaction', @_ ) ); }
7581 PERL
7582 # NOTE: issuing_transaction_list()
7583 issuing_transaction_list => <<'PERL',
7584 sub issuing_transaction_list
7585 {
7586 my $self = shift( @_ );
7587 CORE::return( $self->error( "No parameters were provided to list issuing transaction information." ) ) if( !scalar( @_ ) );
7588 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Issuing::Transaction', @_ );
7589 my $okParams =
7590 {
7591 expandable => { allowed => $EXPANDABLES->{ 'issuing.transaction' }, data_prefix_is_ok => 1 },
7592 card => { type => "string" },
7593 cardholder => { type => "string" },
7594 created => { type => "timestamp" },
7595 ending_before => { type => "string" },
7596 limit => { type => "string" },
7597 starting_after => { type => "string" },
7598 type => { type => "string" },
7599 };
7600 my $err = $self->_check_parameters( $okParams, $args );
7601 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
7602 if( $args->{expand} )
7603 {
7604 $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
7605 }
7606 my $hash = $self->get( "", $args ) || CORE::return( $self->pass_error );
7607 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Issuing::Transaction', $hash ) );
7608 }
7609 PERL
7610 # NOTE: issuing_transaction_retrieve()
7611 issuing_transaction_retrieve => <<'PERL',
7612 sub issuing_transaction_retrieve
7613 {
7614 my $self = shift( @_ );
7615 my $args = shift( @_ );
7616 my $okParams =
7617 {
7618 expandable => { allowed => $EXPANDABLES->{ 'issuing.transaction' }, data_prefix_is_ok => 1 },
7619 };
7620 $args = $self->_contract( 'issuing.transaction', $args ) || CORE::return( $self->pass_error );
7621 my $err = $self->_check_parameters( $okParams, $args );
7622 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
7623 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No issuing.transaction id (with parameter 'id') was provided to retrieve its information." ) );
7624 my $hash = $self->get( "issuing/transactions/${id}", $args ) || CORE::return( $self->pass_error );
7625 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Issuing::Transaction', $hash ) );
7626 }
7627 PERL
7628 # NOTE: issuing_transaction_update()
7629 issuing_transaction_update => <<'PERL',
7630 sub issuing_transaction_update
7631 {
7632 my $self = shift( @_ );
7633 my $args = shift( @_ );
7634 my $okParams =
7635 {
7636 expandable => { allowed => $EXPANDABLES->{ 'issuing.transaction' } },
7637 metadata => { type => "hash" },
7638 };
7639 $args = $self->_contract( 'issuing.transaction', $args ) || CORE::return( $self->pass_error );
7640 my $err = $self->_check_parameters( $okParams, $args );
7641 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
7642 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No issuing.transaction id (with parameter 'id') was provided to update its information." ) );
7643 my $hash = $self->post( "issuing/transactions/${id}", $args ) || CORE::return( $self->pass_error );
7644 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Issuing::Transaction', $hash ) );
7645 }
7646 PERL
7647 # NOTE: issuing_transactions()
7648 issuing_transactions => <<'PERL',
7649 # <https://stripe.com/docs/api/issuing/transactions>
7650 sub issuing_transactions
7651 {
7652 my $self = shift( @_ );
7653 my $allowed = [qw( list retrieve update )];
7654 my $action = shift( @_ );
7655 my $meth = $self->_get_method( 'issuing_transaction', $action, $allowed ) || CORE::return( $self->pass_error );
7656 CORE::return( $self->$meth( @_ ) );
7657 }
7658 PERL
7659 # NOTE: item()
7660 item => <<'PERL',
7661 sub item { CORE::return( shift->_response_to_object( 'Net::API::Stripe::List::Item', @_ ) ); }
7662 PERL
7663 # NOTE: line_item()
7664 line_item => <<'PERL',
7665 sub line_item { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Billing::Invoice::LineItem', @_ ) ); }
7666 PERL
7667 # NOTE: line_item_lines()
7668 line_item_lines => <<'PERL',
7669 sub line_item_lines
7670 {
7671 my $self = shift( @_ );
7672 CORE::return( $self->error( "No parameters were provided to lines line item information." ) ) if( !scalar( @_ ) );
7673 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Billing::Invoice::LineItem', @_ );
7674 my $okParams =
7675 {
7676 expandable => { allowed => $EXPANDABLES->{ 'line_item' }, data_prefix_is_ok => 1 },
7677 automatic_tax => { type => "hash" },
7678 coupon => { type => "string" },
7679 currency => { type => "string" },
7680 customer => { type => "string" },
7681 customer_details => { type => "hash" },
7682 discounts => { type => "array" },
7683 ending_before => { type => "string" },
7684 invoice_items => { type => "string" },
7685 limit => { type => "string" },
7686 schedule => { type => "string" },
7687 starting_after => { type => "string" },
7688 subscription => { type => "string" },
7689 subscription_billing_cycle_anchor => { type => "string" },
7690 subscription_cancel_at => { type => "string" },
7691 subscription_cancel_at_period_end => { type => "string" },
7692 subscription_cancel_now => { type => "string" },
7693 subscription_default_tax_rates => { type => "string" },
7694 subscription_items => { type => "string" },
7695 subscription_proration_behavior => { type => "string" },
7696 subscription_proration_date => { type => "string" },
7697 subscription_start_date => { type => "string" },
7698 subscription_trial_end => { type => "string" },
7699 subscription_trial_from_plan => { type => "string" },
7700 };
7701 my $err = $self->_check_parameters( $okParams, $args );
7702 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
7703 my $hash = $self->get( "invoices/upcoming", $args ) || CORE::return( $self->pass_error );
7704 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::Invoice::LineItem', $hash ) );
7705 }
7706 PERL
7707 # NOTE: line_items()
7708 line_items => <<'PERL',
7709 # <https://stripe.com/docs/api/invoices>
7710 sub line_items
7711 {
7712 my $self = shift( @_ );
7713 my $allowed = [qw( lines )];
7714 my $action = shift( @_ );
7715 my $meth = $self->_get_method( 'line_item', $action, $allowed ) || CORE::return( $self->pass_error );
7716 CORE::return( $self->$meth( @_ ) );
7717 }
7718 PERL
7719 # NOTE: location()
7720 location => <<'PERL',
7721 sub location { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Terminal::Location', @_ ) ); }
7722 PERL
7723 # NOTE: login_link()
7724 login_link => <<'PERL',
7725 sub login_link { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Connect::Account::LoginLink', @_ ) ); }
7726 PERL
7727 # NOTE: login_link_create()
7728 login_link_create => <<'PERL',
7729 sub login_link_create
7730 {
7731 my $self = shift( @_ );
7732 my $args = shift( @_ );
7733 my $okParams =
7734 {
7735 expandable => { allowed => $EXPANDABLES->{ 'login_link' } },
7736 };
7737 $args = $self->_contract( 'login_link', $args ) || CORE::return( $self->pass_error );
7738 my $err = $self->_check_parameters( $okParams, $args );
7739 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
7740 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No account id (with parameter 'id') was provided to create its information." ) );
7741 my $hash = $self->post( "accounts/${id}/login_links", $args ) || CORE::return( $self->pass_error );
7742 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Connect::Account::LoginLink', $hash ) );
7743 }
7744 PERL
7745 # NOTE: login_links()
7746 login_links => <<'PERL',
7747 # <https://stripe.com/docs/api/accounts>
7748 sub login_links
7749 {
7750 my $self = shift( @_ );
7751 my $allowed = [qw( create )];
7752 my $action = shift( @_ );
7753 my $meth = $self->_get_method( 'login_link', $action, $allowed ) || CORE::return( $self->pass_error );
7754 CORE::return( $self->$meth( @_ ) );
7755 }
7756 PERL
7757 # NOTE: mandate()
7758 mandate => <<'PERL',
7759 sub mandate { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Mandate' ) ) }
7760 PERL
7761 # NOTE: mandate_retrieve()
7762 mandate_retrieve => <<'PERL',
7763 sub mandate_retrieve
7764 {
7765 my $self = shift( @_ );
7766 CORE::return( $self->error( "No parameters were provided to retrieve a mandate" ) ) if( !scalar( @_ ) );
7767 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Mandate', @_ );
7768 my $okParams =
7769 {
7770 expandable => { allowed => $EXPANDABLES->{mandate} },
7771 id => { re => qr/^\w+$/, required => 1 },
7772 };
7773 my $err = $self->_check_parameters( $okParams, $args );
7774 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
7775 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No mandate id was provided to retrieve its information." ) );
7776 my $hash = $self->get( "mandates/${id}", $args ) || CORE::return( $self->pass_error );
7777 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Mandate', $hash ) );
7778 }
7779 PERL
7780 # NOTE: mandates()
7781 mandates => <<'PERL',
7782 sub mandates
7783 {
7784 my $self = shift( @_ );
7785 my $action = shift( @_ );
7786 my $allowed = [qw( retrieve )];
7787 my $meth = $self->_get_method( 'mandate', $action, $allowed ) || CORE::return( $self->pass_error );
7788 CORE::return( $self->$meth( @_ ) );
7789 }
7790 PERL
7791 # NOTE: merchant_data()
7792 merchant_data => <<'PERL',
7793 sub merchant_data { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Issuing::MerchantData', @_ ) ); }
7794 PERL
7795 # NOTE: next_action()
7796 next_action => <<'PERL',
7797 sub next_action { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Payment::Intent::NextAction', @_ ) ); }
7798 PERL
7799 # NOTE: order()
7800 order => <<'PERL',
7801 sub order { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Order' ) ) }
7802 PERL
7803 # NOTE: order_item()
7804 order_item => <<'PERL',
7805 sub order_item { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Order::Item' ) ) }
7806 PERL
7807 # NOTE: outcome()
7808 outcome => <<'PERL',
7809 sub outcome { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Charge::Outcome', @_ ) ); }
7810 PERL
7811 # NOTE: owner()
7812 owner => <<'PERL',
7813 sub owner { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Payment::Source::Owner', @_ ) ); }
7814 PERL
7815 # NOTE: package_dimensions()
7816 package_dimensions => <<'PERL',
7817 sub package_dimensions { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Order::SKU::PackageDimensions', @_ ) ); }
7818 PERL
7819 # NOTE: payment_intent()
7820 payment_intent => <<'PERL',
7821 # subs to access child packages
7822 sub payment_intent { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Payment::Intent', @_ ) ); }
7823 PERL
7824 # NOTE: payment_intent_apply_customer_balance()
7825 payment_intent_apply_customer_balance => <<'PERL',
7826 sub payment_intent_apply_customer_balance
7827 {
7828 my $self = shift( @_ );
7829 my $args = shift( @_ );
7830 my $okParams =
7831 {
7832 expandable => { allowed => $EXPANDABLES->{ 'payment_intent' } },
7833 amount => { type => "integer" },
7834 currency => { type => "string" },
7835 };
7836 $args = $self->_contract( 'payment_intent', $args ) || CORE::return( $self->pass_error );
7837 my $err = $self->_check_parameters( $okParams, $args );
7838 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
7839 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." ) );
7840 my $hash = $self->post( "payment_intents/${id}", $args ) || CORE::return( $self->pass_error );
7841 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Payment::Intent', $hash ) );
7842 }
7843 PERL
7844 # NOTE: payment_intent_cancel()
7845 payment_intent_cancel => <<'PERL',
7846 sub payment_intent_cancel
7847 {
7848 my $self = shift( @_ );
7849 CORE::return( $self->error( "No parameters were provided to cancel a payment intent" ) ) if( !scalar( @_ ) );
7850 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Payment::Intent', @_ );
7851 my $okParams =
7852 {
7853 expandable => { allowed => $EXPANDABLES->{payment_intent} },
7854 amount_to_capture => {},
7855 cancellation_reason => { type => "string" },
7856 id => { re => qr/^\w+$/, required => 1 },
7857 };
7858  
7859 $args = $self->_contract( 'payment_intent', $args ) || CORE::return( $self->pass_error );
7860 my $err = $self->_check_parameters( $okParams, $args );
7861 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
7862 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No payment intent id was provided to cancel it." ) );
7863 my $hash = $self->post( "payment_intents/${id}/cancel", $args ) || CORE::return( $self->pass_error );
7864 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Payment::Intent', $hash ) );
7865 }
7866 PERL
7867 # NOTE: payment_intent_capture()
7868 payment_intent_capture => <<'PERL',
7869 sub payment_intent_capture
7870 {
7871 my $self = shift( @_ );
7872 CORE::return( $self->error( "No parameters were provided to capture a payment intent" ) ) if( !scalar( @_ ) );
7873 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Payment::Intent', @_ );
7874 my $okParams =
7875 {
7876 expandable => { allowed => $EXPANDABLES->{payment_intent} },
7877 amount_to_capture => { type => "integer" },
7878 application_fee_amount => { type => "integer" },
7879 id => { re => qr/^\w+$/, required => 1 },
7880 statement_descriptor => { type => "string" },
7881 statement_descriptor_suffix => { type => "string" },
7882 transfer_data => { fields => ["amount"], type => "hash" },
7883 };
7884  
7885 $args = $self->_contract( 'payment_intent', $args ) || CORE::return( $self->pass_error );
7886 my $err = $self->_check_parameters( $okParams, $args );
7887 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
7888 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No payment intent id was provided to capture it." ) );
7889 my $hash = $self->post( "payment_intents/${id}/capture", $args ) || CORE::return( $self->pass_error );
7890 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Payment::Intent', $hash ) );
7891 }
7892 PERL
7893 # NOTE: payment_intent_confirm()
7894 payment_intent_confirm => <<'PERL',
7895 sub payment_intent_confirm
7896 {
7897 my $self = shift( @_ );
7898 CORE::return( $self->error( "No parameters were provided to confirm a payment intent" ) ) if( !scalar( @_ ) );
7899 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Payment::Intent', @_ );
7900 my $okParams =
7901 {
7902 expandable => { allowed => $EXPANDABLES->{payment_intent} },
7903 capture_method => { type => "string" },
7904 error_on_requires_action => { type => "boolean" },
7905 id => { re => qr/^\w+$/, required => 1 },
7906 mandate => { type => "string" },
7907 mandate_data => {
7908 fields => [
7909 "customer_acceptance.accepted_at",
7910 "customer_acceptance.offline",
7911 "customer_acceptance.online",
7912 "customer_acceptance.online.ip_address",
7913 "customer_acceptance.online.user_agent",
7914 "customer_acceptance.type",
7915 ],
7916 type => "hash",
7917 },
7918 off_session => { type => "string" },
7919 payment_method => { package => "Net::API::Stripe::Payment::Method", type => "string" },
7920 payment_method_data => {
7921 fields => [
7922 "alipay",
7923 "au_becs_debit",
7924 "au_becs_debit.account_number!",
7925 "au_becs_debit.bsb_number!",
7926 "bacs_debit",
7927 "bacs_debit.account_number",
7928 "bacs_debit.sort_code",
7929 "bancontact",
7930 "billing_details",
7931 "billing_details.address",
7932 "billing_details.address.city",
7933 "billing_details.address.country",
7934 "billing_details.address.line1",
7935 "billing_details.address.line2",
7936 "billing_details.address.postal_code",
7937 "billing_details.address.state",
7938 "billing_details.email",
7939 "billing_details.name",
7940 "billing_details.phone",
7941 "eps",
7942 "fpx",
7943 "fpx.bank!",
7944 "giropay",
7945 "grabpay",
7946 "ideal",
7947 "ideal.bank",
7948 "interac_present",
7949 "metadata",
7950 "oxxo",
7951 "p24",
7952 "p24.bank",
7953 "sepa_debit",
7954 "sepa_debit.iban!",
7955 "sofort",
7956 "sofort.country!",
7957 "type",
7958 ],
7959 type => "object",
7960 },
7961 payment_method_options => {
7962 fields => [
7963 "alipay",
7964 "bancontact",
7965 "bancontact.preferred_language",
7966 "card",
7967 "card.cvc_token",
7968 "card.installments",
7969 "card.installments.enabled",
7970 "card.installments.plan",
7971 "card.installments.plan.count!",
7972 "card.installments.plan.interval!",
7973 "card.installments.plan.type!",
7974 "card.network",
7975 "card.request_three_d_secure",
7976 "oxxo.expires_after_days",
7977 "p24",
7978 "sepa_debit",
7979 "sepa_debit.mandate_options",
7980 "sofort",
7981 "sofort.preferred_language",
7982 "type",
7983 ],
7984 type => "hash",
7985 },
7986 payment_method_types => { type => "array" },
7987 radar_options => { type => "object" },
7988 receipt_email => { type => "string" },
7989 return_url => { type => "string" },
7990 setup_future_usage => { type => "string" },
7991 shipping => { package => "Net::API::Stripe::Shipping", type => "hash" },
7992 use_stripe_sdk => { type => "boolean" },
7993 };
7994  
7995 $args = $self->_contract( 'payment_intent', $args ) || CORE::return( $self->pass_error );
7996 my $err = $self->_check_parameters( $okParams, $args );
7997 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
7998 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No payment intent id was provided to confirm it." ) );
7999 my $hash = $self->post( "payment_intents/${id}/confirm", $args ) || CORE::return( $self->pass_error );
8000 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Payment::Intent', $hash ) );
8001 }
8002 PERL
8003 # NOTE: payment_intent_create()
8004 payment_intent_create => <<'PERL',
8005 sub payment_intent_create
8006 {
8007 my $self = shift( @_ );
8008 CORE::return( $self->error( "No parameters were provided to create a payment intent" ) ) if( !scalar( @_ ) );
8009 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Payment::Intent', @_ );
8010 my $okParams =
8011 {
8012 expandable => { allowed => $EXPANDABLES->{payment_intent} },
8013 amount => { required => 1, type => "integer" },
8014 application_fee_amount => { type => "integer" },
8015 automatic_payment_methods => { type => "hash" },
8016 capture_method => { type => "string" },
8017 confirm => { required => 1, type => "boolean" },
8018 confirmation_method => { type => "string" },
8019 currency => { required => 1, type => "string" },
8020 customer => { re => qr/^\w+$/, type => "string" },
8021 description => { type => "string" },
8022 error_on_requires_action => { type => "boolean" },
8023 mandate => { re => qr/^\w+$/, type => "string" },
8024 mandate_data => {
8025 fields => [
8026 "customer_acceptance!",
8027 "customer_acceptance.type!",
8028 "customer_acceptance.accepted_at",
8029 "customer_acceptance.offline",
8030 "customer_acceptance.online",
8031 "customer_acceptance.online.ip_address!",
8032 "customer_acceptance.online.user_agent!",
8033 ],
8034 type => "object",
8035 },
8036 metadata => { type => "hash" },
8037 off_session => { type => "boolean" },
8038 on_behalf_of => { re => qr/^\w+$/, type => "string" },
8039 payment_method => { re => qr/^\w+$/, type => "string" },
8040 payment_method_data => {
8041 fields => [
8042 "alipay",
8043 "au_becs_debit",
8044 "au_becs_debit.account_number!",
8045 "au_becs_debit.bsb_number!",
8046 "bacs_debit",
8047 "bacs_debit.account_number",
8048 "bacs_debit.sort_code",
8049 "bancontact",
8050 "billing_details",
8051 "billing_details.address",
8052 "billing_details.address.city",
8053 "billing_details.address.country",
8054 "billing_details.address.line1",
8055 "billing_details.address.line2",
8056 "billing_details.address.postal_code",
8057 "billing_details.address.state",
8058 "billing_details.email",
8059 "billing_details.name",
8060 "billing_details.phone",
8061 "eps",
8062 "fpx",
8063 "fpx.bank!",
8064 "giropay",
8065 "grabpay",
8066 "ideal",
8067 "ideal.bank",
8068 "interac_present",
8069 "metadata",
8070 "oxxo",
8071 "p24",
8072 "p24.bank",
8073 "sepa_debit",
8074 "sepa_debit.iban!",
8075 "sofort",
8076 "sofort.country!",
8077 "type!",
8078 ],
8079 type => "object",
8080 },
8081 payment_method_options => {
8082 fields => [
8083 "alipay",
8084 "bancontact",
8085 "bancontact.preferred_language",
8086 "card",
8087 "card.cvc_token",
8088 "card.installments",
8089 "card.installments.enabled",
8090 "card.installments.plan",
8091 "card.installments.plan.count!",
8092 "card.installments.plan.interval!",
8093 "card.installments.plan.type!",
8094 "card.network",
8095 "card.request_three_d_secure",
8096 "oxxo.expires_after_days",
8097 "p24",
8098 "sepa_debit",
8099 "sepa_debit.mandate_options",
8100 "sofort",
8101 "sofort.preferred_language",
8102 "type",
8103 ],
8104 type => "hash",
8105 },
8106 payment_method_types => { type => "array" },
8107 radar_options => { type => "object" },
8108 receipt_email => { type => "string" },
8109 return_url => { type => "string" },
8110 setup_future_usage => { type => "string" },
8111 shipping => {
8112 fields => ["address!", "carrier", "name!", "phone", "tracking_number"],
8113 type => "hash",
8114 },
8115 statement_descriptor => { type => "string" },
8116 statement_descriptor_suffix => { type => "string" },
8117 transfer_data => { type => "hash" },
8118 transfer_group => { type => "string" },
8119 use_stripe_sdk => { type => "boolean" },
8120 };
8121  
8122 $args = $self->_contract( 'payment_intent', $args ) || CORE::return( $self->pass_error );
8123 my $err = $self->_check_parameters( $okParams, $args );
8124 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
8125 my $hash = $self->post( 'payment_intents', $args ) || CORE::return( $self->pass_error );
8126 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Payment::Intent', $hash ) );
8127 }
8128 PERL
8129 # NOTE: payment_intent_increment()
8130 payment_intent_increment => <<'PERL',
8131 sub payment_intent_increment
8132 {
8133 my $self = shift( @_ );
8134 CORE::return( $self->error( "No parameters were provided to increment a payment intent" ) ) if( !scalar( @_ ) );
8135 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Payment::Intent', @_ );
8136 my $okParams =
8137 {
8138 expandable => { allowed => $EXPANDABLES->{payment_intent} },
8139 id => { re => qr/^\w+$/, required => 1 },
8140 amount => { re => qr/^\d+$/, required => 1 },
8141 description => { re => qr/^.*?$/ },
8142 metadata => {},
8143 application_fee_amount => { re => qr/^\d+$/ },
8144 transfer_data => { fields => [qw( amount )] },
8145 };
8146 my $err = $self->_check_parameters( $okParams, $args );
8147 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
8148 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No payment intent id was provided to increment it." ) );
8149 my $hash = $self->post( "payment_intents/${id}/increment_authorization", $args ) || CORE::return( $self->pass_error );
8150 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Payment::Intent', $hash ) );
8151 }
8152 PERL
8153 # NOTE: payment_intent_increment_authorization()
8154 payment_intent_increment_authorization => <<'PERL',
8155 sub payment_intent_increment_authorization
8156 {
8157 my $self = shift( @_ );
8158 my $args = shift( @_ );
8159 my $okParams =
8160 {
8161 expandable => { allowed => $EXPANDABLES->{ 'payment_intent' } },
8162 amount => { type => "integer", required => 1 },
8163 application_fee_amount => { type => "integer" },
8164 description => { type => "string" },
8165 metadata => { type => "hash" },
8166 transfer_data => { type => "hash" },
8167 };
8168 $args = $self->_contract( 'payment_intent', $args ) || CORE::return( $self->pass_error );
8169 my $err = $self->_check_parameters( $okParams, $args );
8170 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
8171 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No payment_intent id (with parameter 'id') was provided to increment_authorization its information." ) );
8172 my $hash = $self->post( "payment_intents/${id}", $args ) || CORE::return( $self->pass_error );
8173 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Payment::Intent', $hash ) );
8174 }
8175 PERL
8176 # NOTE: payment_intent_list()
8177 payment_intent_list => <<'PERL',
8178 sub payment_intent_list
8179 {
8180 my $self = shift( @_ );
8181 my $args = $self->_get_args( @_ );
8182 my $okParams =
8183 {
8184 expandable => { allowed => $EXPANDABLES->{payment_intent}, data_prefix_is_ok => 1 },
8185 created => qr/^\d+$/,
8186 'created.gt' => qr/^\d+$/,
8187 'created.gte' => qr/^\d+$/,
8188 'created.lt' => qr/^\d+$/,
8189 'created.lte' => qr/^\d+$/,
8190 customer => { type => "string" },
8191 ending_before => qr/^\w+$/,
8192 limit => qr/^\d+$/,
8193 starting_after => qr/^\w+$/,
8194 };
8195  
8196 my $err = $self->_check_parameters( $okParams, $args );
8197 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
8198 if( $args->{expand} )
8199 {
8200 $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
8201 }
8202 my $hash = $self->get( 'payment_methods', $args ) || CORE::return( $self->pass_error );
8203 CORE::return( $self->_response_to_object( 'Net::API::Stripe::List', $hash ) );
8204 }
8205 PERL
8206 # NOTE: payment_intent_reconcile()
8207 payment_intent_reconcile => <<'PERL',
8208 sub payment_intent_reconcile
8209 {
8210 my $self = shift( @_ );
8211 CORE::return( $self->error( "No parameters were provided to reconcile a customer balance payment intent" ) ) if( !scalar( @_ ) );
8212 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Payment::Intent', @_ );
8213 my $okParams =
8214 {
8215 expandable => { allowed => $EXPANDABLES->{payment_intent} },
8216 id => { re => qr/^\w+$/, required => 1 },
8217 amount => { re => qr/^\d+$/ },
8218 currency => { re => qr/^[a-zA-Z]{3}$/ },
8219 };
8220 my $err = $self->_check_parameters( $okParams, $args );
8221 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
8222 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No payment intent id was provided to reconcile its customer balance." ) );
8223 my $hash = $self->post( "payment_intents/${id}/apply_customer_balance", $args ) || CORE::return( $self->pass_error );
8224 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Payment::Intent', $hash ) );
8225 }
8226 PERL
8227 # NOTE: payment_intent_retrieve()
8228 payment_intent_retrieve => <<'PERL',
8229 sub payment_intent_retrieve
8230 {
8231 my $self = shift( @_ );
8232 CORE::return( $self->error( "No parameters were provided to retrieve a payment intent" ) ) if( !scalar( @_ ) );
8233 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Payment::Intent', @_ );
8234 my $okParams =
8235 {
8236 expandable => { allowed => $EXPANDABLES->{payment_intent}, data_prefix_is_ok => 1 },
8237 client_secret => { required => 1, type => "string" },
8238 id => { re => qr/^\w+$/, required => 1 },
8239 };
8240  
8241 my $err = $self->_check_parameters( $okParams, $args );
8242 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
8243 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No payment intent id was provided to retrieve it." ) );
8244 my $hash = $self->get( "payment_intents/${id}", $args ) || CORE::return( $self->pass_error );
8245 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Payment::Intent', $hash ) );
8246 }
8247 PERL
8248 # NOTE: payment_intent_search()
8249 payment_intent_search => <<'PERL',
8250 sub payment_intent_search
8251 {
8252 my $self = shift( @_ );
8253 CORE::return( $self->error( "No parameters were provided to search payment intents." ) ) if( !scalar( @_ ) );
8254 my $args = shift( @_ );
8255 my $okParams =
8256 {
8257 expandable => { allowed => $EXPANDABLES->{payment_intent}, data_prefix_is_ok => 1 },
8258 limit => qr/^\d+$/,
8259 page => qr/^\d+$/,
8260 query => { re => qr/^.*?$/, required => 1, type => "string" },
8261 };
8262  
8263 my $err = $self->_check_parameters( $okParams, $args );
8264 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
8265 if( $args->{expand} )
8266 {
8267 $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
8268 }
8269 my $hash = $self->get( "payment_methods/search", $args ) || CORE::return( $self->pass_error );
8270 CORE::return( $self->_response_to_object( 'Net::API::Stripe::List', $hash ) );
8271 }
8272 PERL
8273 # NOTE: payment_intent_update()
8274 payment_intent_update => <<'PERL',
8275 sub payment_intent_update
8276 {
8277 my $self = shift( @_ );
8278 CORE::return( $self->error( "No parameters were provided to update a payment intent" ) ) if( !scalar( @_ ) );
8279 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Payment::Intent', @_ );
8280 my $okParams =
8281 {
8282 expandable => { allowed => $EXPANDABLES->{payment_intent} },
8283 amount => { required => 1, type => "integer" },
8284 application_fee_amount => { type => "integer" },
8285 capture_method => { type => "string" },
8286 currency => { type => "string" },
8287 customer => { re => qr/^\w+$/, type => "string" },
8288 description => { type => "string" },
8289 metadata => { type => "hash" },
8290 payment_method => { re => qr/^\w+$/, type => "string" },
8291 payment_method_data => {
8292 fields => [
8293 "alipay",
8294 "au_becs_debit",
8295 "au_becs_debit.account_number!",
8296 "au_becs_debit.bsb_number!",
8297 "bacs_debit",
8298 "bacs_debit.account_number",
8299 "bacs_debit.sort_code",
8300 "bancontact",
8301 "billing_details",
8302 "billing_details.address",
8303 "billing_details.address.city",
8304 "billing_details.address.country",
8305 "billing_details.address.line1",
8306 "billing_details.address.line2",
8307 "billing_details.address.postal_code",
8308 "billing_details.address.state",
8309 "billing_details.email",
8310 "billing_details.name",
8311 "billing_details.phone",
8312 "eps",
8313 "fpx",
8314 "fpx.bank!",
8315 "giropay",
8316 "grabpay",
8317 "ideal",
8318 "ideal.bank",
8319 "interac_present",
8320 "metadata",
8321 "oxxo",
8322 "p24",
8323 "p24.bank",
8324 "sepa_debit",
8325 "sepa_debit.iban!",
8326 "sofort",
8327 "sofort.country!",
8328 "type!",
8329 ],
8330 type => "object",
8331 },
8332 payment_method_options => {
8333 fields => [
8334 "alipay",
8335 "bancontact",
8336 "bancontact.preferred_language",
8337 "card",
8338 "card.cvc_token",
8339 "card.installments",
8340 "card.installments.enabled",
8341 "card.installments.plan",
8342 "card.installments.plan.count!",
8343 "card.installments.plan.interval!",
8344 "card.installments.plan.type!",
8345 "card.network",
8346 "card.request_three_d_secure",
8347 "oxxo.expires_after_days",
8348 "p24",
8349 "sepa_debit",
8350 "sepa_debit.mandate_options",
8351 "sofort",
8352 "sofort.preferred_language",
8353 "type",
8354 ],
8355 type => "hash",
8356 },
8357 payment_method_types => { type => "array" },
8358 receipt_email => { type => "string" },
8359 setup_future_usage => { type => "string" },
8360 shipping => {
8361 fields => ["address!", "carrier", "name!", "phone", "tracking_number"],
8362 type => "hash",
8363 },
8364 statement_descriptor => { type => "string" },
8365 statement_descriptor_suffix => { type => "string" },
8366 transfer_data => { type => "hash" },
8367 transfer_group => { type => "string" },
8368 };
8369  
8370 $args = $self->_contract( 'payment_intent', $args ) || CORE::return( $self->pass_error );
8371 my $err = $self->_check_parameters( $okParams, $args );
8372 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
8373 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No payment intent id was provided to capture it." ) );
8374 my $hash = $self->post( "payment_intents/${id}", $args ) || CORE::return( $self->pass_error );
8375 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Payment::Intent', $hash ) );
8376 }
8377 PERL
8378 # NOTE: payment_intent_verify()
8379 payment_intent_verify => <<'PERL',
8380 sub payment_intent_verify
8381 {
8382 my $self = shift( @_ );
8383 CORE::return( $self->error( "No parameters were provided to verify microdeposits on a payment intent" ) ) if( !scalar( @_ ) );
8384 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Payment::Intent', @_ );
8385 my $okParams =
8386 {
8387 expandable => { allowed => $EXPANDABLES->{payment_intent} },
8388 id => { re => qr/^\w+$/, required => 1 },
8389 client_secret => {},
8390 amounts => { type => 'array', re => qr/^\d+$/ },
8391 descriptor_code => { re => qr/^.*?$/ },
8392 };
8393 my $err = $self->_check_parameters( $okParams, $args );
8394 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
8395 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No payment intent id was provided to verify microdeposits on it." ) );
8396 my $hash = $self->post( "payment_intents/${id}/verify_microdeposits", $args ) || CORE::return( $self->pass_error );
8397 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Payment::Intent', $hash ) );
8398 }
8399 PERL
8400 # NOTE: payment_intent_verify_microdeposits()
8401 payment_intent_verify_microdeposits => <<'PERL',
8402 sub payment_intent_verify_microdeposits
8403 {
8404 my $self = shift( @_ );
8405 CORE::return( $self->error( "No parameters were provided to verify_microdeposits payment intent information." ) ) if( !scalar( @_ ) );
8406 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Payment::Intent', @_ );
8407 my $okParams =
8408 {
8409 expandable => { allowed => $EXPANDABLES->{ 'payment_intent' } },
8410 amounts => { type => "array" },
8411 client_secret => { type => "string", required => 1 },
8412 descriptor_code => { type => "string" },
8413 };
8414 my $err = $self->_check_parameters( $okParams, $args );
8415 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
8416 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No payment_intent id (with parameter 'id') was provided to verify_microdeposits its information." ) );
8417 my $hash = $self->post( "payment_intents/${id}", $args ) || CORE::return( $self->pass_error );
8418 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Payment::Intent', $hash ) );
8419 }
8420 PERL
8421 # NOTE: payment_intents()
8422 payment_intents => <<'PERL',
8423 # <https://stripe.com/docs/api/payment_intents>
8424 sub payment_intents
8425 {
8426 my $self = shift( @_ );
8427 my $allowed = [qw( apply_customer_balance cancel capture confirm create increment increment_authorization list reconcile retrieve search update verify verify_microdeposits )];
8428 my $action = shift( @_ );
8429 my $meth = $self->_get_method( 'payment_intent', $action, $allowed ) || CORE::return( $self->pass_error );
8430 CORE::return( $self->$meth( @_ ) );
8431 }
8432 PERL
8433 # NOTE: payment_link()
8434 payment_link => <<'PERL',
8435 sub payment_link { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Payment::Link', @_ ) ); }
8436 PERL
8437 # NOTE: payment_link_create()
8438 payment_link_create => <<'PERL',
8439 sub payment_link_create
8440 {
8441 my $self = shift( @_ );
8442 CORE::return( $self->error( "No parameters were provided to create a payment link." ) ) if( !scalar( @_ ) );
8443 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Payment::Link', @_ );
8444 my $okParams =
8445 {
8446 expandable => { allowed => $EXPANDABLES->{payment_link} },
8447 after_completion => {
8448 fields => [
8449 "type!",
8450 "hosted_confirmation",
8451 "hosted_confirmation.custom_message",
8452 "redirect",
8453 "redirect.url!",
8454 ],
8455 type => "hash",
8456 },
8457 allow_promotion_codes => { type => "boolean" },
8458 application_fee_amount => { type => "integer" },
8459 application_fee_percent => { type => "decimal" },
8460 automatic_tax => { fields => ["enabled!"], type => "hash" },
8461 billing_address_collection => { type => "string" },
8462 consent_collection => { fields => ["promotions"], type => "hash" },
8463 currency => { type => "currency" },
8464 customer_creation => { type => "string" },
8465 line_items => {
8466 fields => [
8467 "price!",
8468 "quantity!",
8469 "adjustable_quantity.enabled!",
8470 "adjustable_quantity.maximum",
8471 "adjustable_quantity.minimum",
8472 ],
8473 required => 1,
8474 type => "array",
8475 },
8476 metadata => { type => "hash" },
8477 on_behalf_of => { re => qr/^\w+$/, type => "string" },
8478 payment_intent_data => { fields => ["capture_method", "setup_future_usage"], type => "hash" },
8479 payment_method_collection => { type => "string" },
8480 payment_method_type => { type => "string" },
8481 payment_method_types => { type => "array" },
8482 phone_number_collection => { fields => ["enabled!"], type => "hash" },
8483 shipping_address_collection => { fields => ["allowed_countries"], type => "hash" },
8484 shipping_options => { fields => ["shipping_rate"], type => "array" },
8485 submit_type => { type => "string" },
8486 subscription_data => { fields => ["trial_period_days"], type => "hash" },
8487 tax_id_collection => { fields => ["enabled"], type => "hash" },
8488 transfer_data => { fields => ["destination!", "amount"], type => "hash" },
8489 };
8490  
8491 $args = $self->_contract( 'payment_link', $args ) || CORE::return( $self->pass_error );
8492 my $err = $self->_check_parameters( $okParams, $args );
8493 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
8494 my $hash = $self->post( 'payment_links', $args ) || CORE::return( $self->pass_error );
8495 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Payment::Link', $hash ) );
8496 }
8497 PERL
8498 # NOTE: payment_link_items()
8499 payment_link_items => <<'PERL',
8500 sub payment_link_items
8501 {
8502 my $self = shift( @_ );
8503 CORE::return( $self->error( "No parameters were provided to retrieve payment link information." ) ) if( !scalar( @_ ) );
8504 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Payment::Link', @_ );
8505 my $okParams =
8506 {
8507 expandable => { allowed => $EXPANDABLES->{payment_link} },
8508 id => { re => qr/^\w+$/, required => 1 },
8509 ending_before => { re => qr/^\w+$/ },
8510 limit => { re => qr/^\d+$/ },
8511 starting_after => { re => qr/^\w+$/ },
8512 };
8513 my $err = $self->_check_parameters( $okParams, $args );
8514 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
8515 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No product id was provided to retrieve its information." ) );
8516 my $hash = $self->get( "payment_links/${id}/line_items", $args ) || CORE::return( $self->pass_error );
8517 CORE::return( $self->_response_to_object( 'Net::API::Stripe::List', $hash ) );
8518 }
8519 PERL
8520 # NOTE: payment_link_line_items()
8521 payment_link_line_items => <<'PERL',
8522 sub payment_link_line_items
8523 {
8524 my $self = shift( @_ );
8525 CORE::return( $self->error( "No parameters were provided to line_items payment link information." ) ) if( !scalar( @_ ) );
8526 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Payment::Link', @_ );
8527 my $okParams =
8528 {
8529 expandable => { allowed => $EXPANDABLES->{ 'payment_link' }, data_prefix_is_ok => 1 },
8530 ending_before => { type => "string" },
8531 limit => { type => "string" },
8532 starting_after => { type => "string" },
8533 };
8534 my $err = $self->_check_parameters( $okParams, $args );
8535 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
8536 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No payment_link id (with parameter 'id') was provided to line_items its information." ) );
8537 my $hash = $self->get( "payment_links/${id}/line_items", $args ) || CORE::return( $self->pass_error );
8538 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Payment::Link', $hash ) );
8539 }
8540 PERL
8541 # NOTE: payment_link_list()
8542 payment_link_list => <<'PERL',
8543 sub payment_link_list
8544 {
8545 my $self = shift( @_ );
8546 my $args = $self->_get_args( @_ );
8547 my $okParams =
8548 {
8549 expandable => { allowed => $EXPANDABLES->{payment_link}, data_prefix_is_ok => 1 },
8550 active => { type => "boolean" },
8551 arrival_date => { re => qr/^\d+$/ },
8552 'arrival_date.gt' => { re => qr/^\d+$/ },
8553 'arrival_date.gte' => { re => qr/^\d+$/ },
8554 'arrival_date.lt' => { re => qr/^\d+$/ },
8555 'arrival_date.lte' => { re => qr/^\d+$/ },
8556 created => { re => qr/^\d+$/ },
8557 'created.gt' => { re => qr/^\d+$/ },
8558 'created.gte' => { re => qr/^\d+$/ },
8559 'created.lt' => { re => qr/^\d+$/ },
8560 'created.lte' => { re => qr/^\d+$/ },
8561 destination => { re => qr/^\w+$/ },
8562 ending_before => { re => qr/^\w+$/, type => "string" },
8563 limit => { re => qr/^\d+$/, type => "string" },
8564 starting_after => { re => qr/^\w+$/, type => "string" },
8565 status => { re => qr/^(pending|paid|failed|canceled)$/ },
8566 };
8567  
8568 my $err = $self->_check_parameters( $okParams, $args );
8569 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
8570 if( $args->{expand} )
8571 {
8572 $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
8573 }
8574 my $hash = $self->get( 'payment_links', $args ) || CORE::return( $self->pass_error );
8575 CORE::return( $self->_response_to_object( 'Net::API::Stripe::List', $hash ) );
8576 }
8577 PERL
8578 # NOTE: payment_link_retrieve()
8579 payment_link_retrieve => <<'PERL',
8580 sub payment_link_retrieve
8581 {
8582 my $self = shift( @_ );
8583 CORE::return( $self->error( "No parameters were provided to retrieve payment link information." ) ) if( !scalar( @_ ) );
8584 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Payment::Link', @_ );
8585 my $okParams =
8586 {
8587 expandable => { allowed => $EXPANDABLES->{payment_link} },
8588 id => { re => qr/^\w+$/, required => 1 },
8589 };
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 link id was provided to retrieve its information." ) );
8593 my $hash = $self->get( "payment_links/${id}", $args ) || CORE::return( $self->pass_error );
8594 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Payment::Link', $hash ) );
8595 }
8596 PERL
8597 # NOTE: payment_link_update()
8598 payment_link_update => <<'PERL',
8599 sub payment_link_update
8600 {
8601 my $self = shift( @_ );
8602 CORE::return( $self->error( "No parameters were provided to update a payment link" ) ) if( !scalar( @_ ) );
8603 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Payout', @_ );
8604 my $okParams =
8605 {
8606 expandable => { allowed => $EXPANDABLES->{payment_link} },
8607 active => { type => "boolean" },
8608 after_completion => { type => "hash" },
8609 allow_promotion_codes => { type => "boolean" },
8610 automatic_tax => { type => "hash" },
8611 billing_address_collection => { type => "string" },
8612 customer_creation => { type => "string" },
8613 id => { re => qr/^\w+$/, required => 1 },
8614 line_items => { type => "hash" },
8615 metadata => { type => "hash" },
8616 payment_method_collection => { type => "string" },
8617 payment_method_types => { type => "array" },
8618 shipping_address_collection => { type => "hash" },
8619 };
8620  
8621 $args = $self->_contract( 'payment_link', $args ) || CORE::return( $self->pass_error );
8622 my $err = $self->_check_parameters( $okParams, $args );
8623 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
8624 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No payment id was provided to update its details" ) );
8625 my $hash = $self->post( "payment_links/${id}", $args ) || CORE::return( $self->pass_error );
8626 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Payout', $hash ) );
8627 }
8628 PERL
8629 # NOTE: payment_links()
8630 payment_links => <<'PERL',
8631 # <https://stripe.com/docs/api/payment_links/payment_links>
8632 sub payment_links
8633 {
8634 my $self = shift( @_ );
8635 my $allowed = [qw( create items line_items list retrieve update )];
8636 my $action = shift( @_ );
8637 my $meth = $self->_get_method( 'payment_link', $action, $allowed ) || CORE::return( $self->pass_error );
8638 CORE::return( $self->$meth( @_ ) );
8639 }
8640 PERL
8641 # NOTE: payment_method()
8642 payment_method => <<'PERL',
8643 sub payment_method { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Payment::Method', @_ ) ); }
8644 PERL
8645 # NOTE: payment_method_attach()
8646 payment_method_attach => <<'PERL',
8647 sub payment_method_attach
8648 {
8649 my $self = shift( @_ );
8650 CORE::return( $self->error( "No parameters were provided to attach a payment method" ) ) if( !scalar( @_ ) );
8651 my $args;
8652 if( $self->_is_object( $_[0] ) )
8653 {
8654 if( $_[0]->isa( 'Net::API::Stripe::Customer' ) )
8655 {
8656 $args = $self->_get_args_from_object( 'Net::API::Stripe::Customer', @_ );
8657 my $obj = $args->{_object};
8658 $args->{customer} = $obj->id;
8659 $args->{id} = $obj->payment_method->id if( $obj->payment_method );
8660 }
8661 elsif( $_[0]->isa( 'Net::API::Stripe::Payment::Method' ) )
8662 {
8663 $args = $self->_get_args_from_object( 'Net::API::Stripe::Payment::Method', @_ );
8664 }
8665 }
8666 else
8667 {
8668 $args = $self->_get_args( @_ );
8669 }
8670 my $okParams =
8671 {
8672 expandable => { allowed => $EXPANDABLES->{payment_method} },
8673 customer => { re => qr/^\w+$/, required => 1, type => "string" },
8674 id => { re => qr/^\w+$/, required => 1 },
8675 };
8676  
8677 $args = $self->_contract( 'payment_method', $args ) || CORE::return( $self->pass_error );
8678 my $err = $self->_check_parameters( $okParams, $args );
8679 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
8680 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}\"." ) );
8681 my $hash = $self->post( "payment_methods/${id}/attach", $args ) || CORE::return( $self->pass_error );
8682 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Payment::Method', $hash ) );
8683 }
8684 PERL
8685 # NOTE: payment_method_create()
8686 payment_method_create => <<'PERL',
8687 sub payment_method_create
8688 {
8689 my $self = shift( @_ );
8690 CORE::return( $self->error( "No parameters were provided to create a payment_method" ) ) if( !scalar( @_ ) );
8691 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Payment::Method', @_ );
8692 my $okParams =
8693 {
8694 expandable => { allowed => $EXPANDABLES->{payment_method} },
8695 acss_debit => { type => "hash" },
8696 affirm => { type => "hash" },
8697 afterpay_clearpay => { type => "hash" },
8698 alipay => { type => "hash" },
8699 au_becs_debit => { type => "hash" },
8700 bacs_debit => { type => "hash" },
8701 bancontact => { type => "hash" },
8702 billing_details => {
8703 fields => [
8704 "address.city",
8705 "address.country",
8706 "address.line1",
8707 "address.line2",
8708 "address.postal_code",
8709 "address.state",
8710 "email",
8711 "name",
8712 "phone",
8713 ],
8714 type => "hash",
8715 },
8716 blik => { type => "hash" },
8717 boleto => { type => "hash" },
8718 card => {
8719 fields => ["exp_month", "exp_year", "number", "cvc"],
8720 type => "hash",
8721 },
8722 customer_balance => { type => "hash" },
8723 eps => { type => "hash" },
8724 fpx => { fields => ["bank"], type => "hash" },
8725 giropay => { type => "hash" },
8726 grabpay => { type => "hash" },
8727 ideal => { fields => ["bank"], type => "hash" },
8728 interac_present => { type => "hash" },
8729 klarna => { type => "hash" },
8730 konbini => { type => "hash" },
8731 link => { type => "hash" },
8732 metadata => { type => "hash" },
8733 oxxo => { type => "hash" },
8734 p24 => { type => "hash" },
8735 paynow => { type => "hash" },
8736 promptpay => { type => "hash" },
8737 radar_options => { type => "hash" },
8738 sepa_debit => { fields => ["iban"], type => "hash" },
8739 sofort => { type => "hash" },
8740 type => {
8741 re => qr/^(?:card|fpx|ideal|sepa_debit)$/,
8742 required => 1,
8743 type => "string",
8744 },
8745 us_bank_account => { type => "hash" },
8746 wechat_pay => { type => "hash" },
8747 };
8748  
8749 $args = $self->_contract( 'payment_method', $args ) || CORE::return( $self->pass_error );
8750 my $err = $self->_check_parameters( $okParams, $args );
8751 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
8752 my $hash = $self->post( 'payment_methods', $args ) || CORE::return( $self->pass_error );
8753 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Payment::Method', $hash ) );
8754 }
8755 PERL
8756 # NOTE: payment_method_detach()
8757 payment_method_detach => <<'PERL',
8758 # https://stripe.com/docs/api/payment_methods/detach
8759 sub payment_method_detach
8760 {
8761 my $self = shift( @_ );
8762 CORE::return( $self->error( "No parameters were provided to detach a payment method." ) ) if( !scalar( @_ ) );
8763 my $args;
8764 if( $self->_is_object( $_[0] ) )
8765 {
8766 if( $_[0]->isa( 'Net::API::Stripe::Customer' ) )
8767 {
8768 $args = $self->_get_args_from_object( 'Net::API::Stripe::Customer', @_ );
8769 my $obj = $args->{_object};
8770 $args->{customer} = $obj->id;
8771 if( $obj->payment_method )
8772 {
8773 $args->{id} = $obj->payment_method->id;
8774 }
8775 elsif( $obj->invoice_settings->default_payment_method )
8776 {
8777 $args->{id} = $obj->invoice_settings->default_payment_method->id;
8778 }
8779 CORE::return( $self->error( "No payent method id could be found in this customer object." ) ) if( !$args->{id} );
8780 }
8781 elsif( $_[0]->isa( 'Net::API::Stripe::Payment::Method' ) )
8782 {
8783 $args = $self->_get_args_from_object( 'Net::API::Stripe::Payment::Method', @_ );
8784 }
8785 }
8786 else
8787 {
8788 $args = $self->_get_args( @_ );
8789 }
8790 my $okParams =
8791 {
8792 expandable => { allowed => $EXPANDABLES->{payment_method} },
8793 id => { re => qr/^\w+$/, required => 1 },
8794 };
8795 my $err = $self->_check_parameters( $okParams, $args );
8796 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
8797 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}\"." ) );
8798 my $hash = $self->post( "payment_methods/${id}/detach", $args ) || CORE::return( $self->pass_error );
8799 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Payment::Method', $hash ) );
8800 }
8801 PERL
8802 # NOTE: payment_method_details()
8803 payment_method_details => <<'PERL',
8804 sub payment_method_details { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Payment::Method::Details', @_ ) ); }
8805 PERL
8806 # NOTE: payment_method_list()
8807 payment_method_list => <<'PERL',
8808 sub payment_method_list
8809 {
8810 my $self = shift( @_ );
8811 my $args = $self->_get_args( @_ );
8812 my $okParams =
8813 {
8814 expandable => { allowed => $EXPANDABLES->{payment_method}, data_prefix_is_ok => 1 },
8815 customer => { required => 1, type => "string" },
8816 ending_before => { type => "string" },
8817 limit => { re => qr/^\d+$/, type => "string" },
8818 starting_after => { type => "string" },
8819 type => {
8820 re => qr/^(?:card|fpx|ideal|sepa_debit)$/,
8821 required => 1,
8822 type => "string",
8823 },
8824 };
8825  
8826 my $err = $self->_check_parameters( $okParams, $args );
8827 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
8828 if( $args->{expand} )
8829 {
8830 $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
8831 }
8832 my $hash = $self->get( 'payment_methods', $args ) || CORE::return( $self->pass_error );
8833 CORE::return( $self->_response_to_object( 'Net::API::Stripe::List', $hash ) );
8834 }
8835 PERL
8836 # NOTE: payment_method_list_customer_payment_methods()
8837 payment_method_list_customer_payment_methods => <<'PERL',
8838 sub payment_method_list_customer_payment_methods
8839 {
8840 my $self = shift( @_ );
8841 CORE::return( $self->error( "No parameters were provided to list_customer_payment_methods payment method information." ) ) if( !scalar( @_ ) );
8842 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Payment::Method', @_ );
8843 my $okParams =
8844 {
8845 expandable => { allowed => $EXPANDABLES->{ 'payment_method' }, data_prefix_is_ok => 1 },
8846 ending_before => { type => "string" },
8847 limit => { type => "string" },
8848 starting_after => { type => "string" },
8849 type => { type => "string", required => 1 },
8850 };
8851 my $err = $self->_check_parameters( $okParams, $args );
8852 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
8853 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." ) );
8854 if( $args->{expand} )
8855 {
8856 $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
8857 }
8858 my $hash = $self->get( "customers/${customer}/payment_methods", $args ) || CORE::return( $self->pass_error );
8859 CORE::return( $self->_response_to_object( 'Net::API::Stripe::List', $hash ) );
8860 }
8861 PERL
8862 # NOTE: payment_method_retrieve()
8863 payment_method_retrieve => <<'PERL',
8864 sub payment_method_retrieve
8865 {
8866 my $self = shift( @_ );
8867 CORE::return( $self->error( "No parameters were provided to retrieve payment method information." ) ) if( !scalar( @_ ) );
8868 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Payment::Method', @_ );
8869 my $okParams =
8870 {
8871 expandable => { allowed => $EXPANDABLES->{payment_method} },
8872 id => { re => qr/^\w+$/, required => 1 }
8873 };
8874 my $err = $self->_check_parameters( $okParams, $args );
8875 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
8876 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No payment method id was provided to retrieve its information." ) );
8877 my $hash = $self->get( "payment_methods/${id}", $args ) || CORE::return( $self->pass_error );
8878 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Payment::Method', $hash ) );
8879 }
8880 PERL
8881 # NOTE: payment_method_retrieve_customer_payment_method()
8882 payment_method_retrieve_customer_payment_method => <<'PERL',
8883 sub payment_method_retrieve_customer_payment_method
8884 {
8885 my $self = shift( @_ );
8886 CORE::return( $self->error( "No parameters were provided to retrieve_customer_payment_method payment method information." ) ) if( !scalar( @_ ) );
8887 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Payment::Method', @_ );
8888 my $okParams =
8889 {
8890 expandable => { allowed => $EXPANDABLES->{ 'payment_method' }, data_prefix_is_ok => 1 },
8891 };
8892 my $err = $self->_check_parameters( $okParams, $args );
8893 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
8894 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." ) );
8895 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." ) );
8896 if( $args->{expand} )
8897 {
8898 $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
8899 }
8900 my $hash = $self->get( "customers/${customer}/payment_methods/${payment_method}", $args ) || CORE::return( $self->pass_error );
8901 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Payment::Method', $hash ) );
8902 }
8903 PERL
8904 # NOTE: payment_method_update()
8905 payment_method_update => <<'PERL',
8906 # https://stripe.com/docs/api/payment_methods/update
8907 sub payment_method_update
8908 {
8909 my $self = shift( @_ );
8910 CORE::return( $self->error( "No parameters were provided to update a payment method" ) ) if( !scalar( @_ ) );
8911 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Payment::Method', @_ );
8912 my $okParams =
8913 {
8914 expandable => { allowed => $EXPANDABLES->{payment_method} },
8915 billing_details => {
8916 fields => [
8917 "address.city",
8918 "address.country",
8919 "address.line1",
8920 "address.line2",
8921 "address.postal_code",
8922 "address.state",
8923 "email",
8924 "name",
8925 "phone",
8926 ],
8927 type => "hash",
8928 },
8929 card => { fields => ["exp_month", "exp_year"], type => "hash" },
8930 id => { re => qr/^\w+$/, required => 1 },
8931 link => { type => "hash" },
8932 metadata => { type => "hash" },
8933 sepa_debit => { fields => ["iban"] },
8934 us_bank_account => { type => "hash" },
8935 };
8936  
8937 $args = $self->_contract( 'payment_method', $args ) || CORE::return( $self->pass_error );
8938 # We found some errors
8939 my $err = $self->_check_parameters( $okParams, $args );
8940 # $self->message( 3, "Data to be posted: ", $self->dumper( $args ) ); exit;
8941 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
8942 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No payment method id was provided to update payment method's details" ) );
8943 my $hash = $self->post( "payment_methods/${id}", $args ) || CORE::return( $self->pass_error );
8944 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Payment::Method', $hash ) );
8945 }
8946 PERL
8947 # NOTE: payment_methods()
8948 payment_methods => <<'PERL',
8949 # <https://stripe.com/docs/api/payment_methods>
8950 sub payment_methods
8951 {
8952 my $self = shift( @_ );
8953 my $allowed = [qw( attach create detach list list_customer_payment_methods retrieve retrieve_customer_payment_method update )];
8954 my $action = shift( @_ );
8955 my $meth = $self->_get_method( 'payment_method', $action, $allowed ) || CORE::return( $self->pass_error );
8956 CORE::return( $self->$meth( @_ ) );
8957 }
8958 PERL
8959 # NOTE: payout()
8960 payout => <<'PERL',
8961 sub payout { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Payout', @_ ) ); }
8962 PERL
8963 # NOTE: payout_cancel()
8964 payout_cancel => <<'PERL',
8965 sub payout_cancel
8966 {
8967 my $self = shift( @_ );
8968 CORE::return( $self->error( "No parameters were provided to cancel a payout" ) ) if( !scalar( @_ ) );
8969 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Payout', @_ );
8970 my $okParams =
8971 {
8972 expandable => { allowed => $EXPANDABLES->{payout} },
8973 id => { re => qr/^\w+$/, required => 1 },
8974 };
8975 $args = $self->_contract( 'payout', $args ) || CORE::return( $self->pass_error );
8976 my $err = $self->_check_parameters( $okParams, $args );
8977 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
8978 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No payout id was provided to cancel it." ) );
8979 my $hash = $self->post( "payouts/${id}/cancel", $args ) || CORE::return( $self->pass_error );
8980 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Payout', $hash ) );
8981 }
8982 PERL
8983 # NOTE: payout_create()
8984 payout_create => <<'PERL',
8985 sub payout_create
8986 {
8987 my $self = shift( @_ );
8988 CORE::return( $self->error( "No parameters were provided to create a payout" ) ) if( !scalar( @_ ) );
8989 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Payout', @_ );
8990 my $okParams =
8991 {
8992 expandable => { allowed => $EXPANDABLES->{payout} },
8993 amount => { required => 1, type => "integer" },
8994 currency => { required => 1, type => "string" },
8995 description => { type => "string" },
8996 destination => { re => qr/^\w+$/, type => "string" },
8997 metadata => { type => "hash" },
8998 method => { re => qr/^(standard|instant)$/, type => "string" },
8999 source_type => { re => qr/^(bank_account|card|fpx)$/, type => "string" },
9000 statement_descriptor => { type => "string" },
9001 };
9002  
9003 $args = $self->_contract( 'payout', $args ) || CORE::return( $self->pass_error );
9004 my $err = $self->_check_parameters( $okParams, $args );
9005 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
9006 my $hash = $self->post( 'payouts', $args ) || CORE::return( $self->pass_error );
9007 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Payout', $hash ) );
9008 }
9009 PERL
9010 # NOTE: payout_list()
9011 payout_list => <<'PERL',
9012 sub payout_list
9013 {
9014 my $self = shift( @_ );
9015 my $args = $self->_get_args( @_ );
9016 my $okParams =
9017 {
9018 expandable => { allowed => $EXPANDABLES->{payout}, data_prefix_is_ok => 1 },
9019 arrival_date => { re => qr/^\d+$/, type => "timestamp" },
9020 'arrival_date.gt' => { re => qr/^\d+$/ },
9021 'arrival_date.gte' => { re => qr/^\d+$/ },
9022 'arrival_date.lt' => { re => qr/^\d+$/ },
9023 'arrival_date.lte' => { re => qr/^\d+$/ },
9024 created => { re => qr/^\d+$/, type => "timestamp" },
9025 'created.gt' => { re => qr/^\d+$/ },
9026 'created.gte' => { re => qr/^\d+$/ },
9027 'created.lt' => { re => qr/^\d+$/ },
9028 'created.lte' => { re => qr/^\d+$/ },
9029 destination => { re => qr/^\w+$/, type => "string" },
9030 ending_before => { re => qr/^\w+$/, type => "string" },
9031 limit => { re => qr/^\d+$/, type => "string" },
9032 starting_after => { re => qr/^\w+$/, type => "string" },
9033 status => { re => qr/^(pending|paid|failed|canceled)$/, type => "string" },
9034 };
9035  
9036 my $err = $self->_check_parameters( $okParams, $args );
9037 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
9038 if( $args->{expand} )
9039 {
9040 $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
9041 }
9042 my $hash = $self->get( 'payment_methods', $args ) || CORE::return( $self->pass_error );
9043 CORE::return( $self->_response_to_object( 'Net::API::Stripe::List', $hash ) );
9044 }
9045 PERL
9046 # NOTE: payout_retrieve()
9047 payout_retrieve => <<'PERL',
9048 sub payout_retrieve
9049 {
9050 my $self = shift( @_ );
9051 CORE::return( $self->error( "No parameters were provided to retrieve payout information." ) ) if( !scalar( @_ ) );
9052 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Payout', @_ );
9053 my $okParams =
9054 {
9055 expandable => { allowed => $EXPANDABLES->{payout} },
9056 id => { re => qr/^\w+$/, required => 1 }
9057 };
9058 my $err = $self->_check_parameters( $okParams, $args );
9059 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
9060 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No payout id was provided to retrieve its information." ) );
9061 my $hash = $self->get( "payouts/${id}", $args ) || CORE::return( $self->pass_error );
9062 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Payout', $hash ) );
9063 }
9064 PERL
9065 # NOTE: payout_reverse()
9066 payout_reverse => <<'PERL',
9067 sub payout_reverse
9068 {
9069 my $self = shift( @_ );
9070 CORE::return( $self->error( "No parameters were provided to reverse payout information." ) ) if( !scalar( @_ ) );
9071 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Payout', @_ );
9072 my $okParams =
9073 {
9074 expandable => { allowed => $EXPANDABLES->{payout} },
9075 id => { re => qr/^\w+$/, required => 1 },
9076 metadata => { type => 'hash' },
9077 };
9078 my $err = $self->_check_parameters( $okParams, $args );
9079 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
9080 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No payout id was provided to reverse it." ) );
9081 my $hash = $self->get( "payouts/${id}", $args ) || CORE::return( $self->pass_error );
9082 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Payout', $hash ) );
9083 }
9084 PERL
9085 # NOTE: payout_update()
9086 payout_update => <<'PERL',
9087 sub payout_update
9088 {
9089 my $self = shift( @_ );
9090 CORE::return( $self->error( "No parameters were provided to update a payout" ) ) if( !scalar( @_ ) );
9091 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Payout', @_ );
9092 my $okParams =
9093 {
9094 expandable => { allowed => $EXPANDABLES->{payout} },
9095 id => { re => qr/^\w+$/, required => 1 },
9096 metadata => { type => 'hash' },
9097 };
9098 $args = $self->_contract( 'payout', $args ) || CORE::return( $self->pass_error );
9099 my $err = $self->_check_parameters( $okParams, $args );
9100 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
9101 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No payout id was provided to update its details" ) );
9102 my $hash = $self->post( "payouts/${id}", $args ) || CORE::return( $self->pass_error );
9103 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Payout', $hash ) );
9104 }
9105 PERL
9106 # NOTE: payouts()
9107 payouts => <<'PERL',
9108 sub payouts
9109 {
9110 my $self = shift( @_ );
9111 my $action = shift( @_ );
9112 my $allowed = [qw( create retrieve update list cancel reverse )];
9113 my $meth = $self->_get_method( 'payout', $action, $allowed ) || CORE::return( $self->pass_error );
9114 CORE::return( $self->$meth( @_ ) );
9115 }
9116 PERL
9117 # NOTE: period()
9118 period => <<'PERL',
9119 sub period { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Billing::Invoice::Period', @_ ) ); }
9120 PERL
9121 # NOTE: person()
9122 person => <<'PERL',
9123 sub person { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Connect::Person', @_ ) ); }
9124 PERL
9125 # NOTE: person_create()
9126 person_create => <<'PERL',
9127 sub person_create
9128 {
9129 my $self = shift( @_ );
9130 my $args = shift( @_ );
9131 my $okParams =
9132 {
9133 expandable => { allowed => $EXPANDABLES->{ 'person' } },
9134 address => { type => "hash" },
9135 address_kana => { type => "hash" },
9136 address_kanji => { type => "hash" },
9137 dob => { type => "hash" },
9138 documents => { type => "object" },
9139 email => { type => "string" },
9140 first_name => { type => "string" },
9141 first_name_kana => { type => "string" },
9142 first_name_kanji => { type => "string" },
9143 full_name_aliases => { type => "array" },
9144 gender => { type => "string" },
9145 id_number => { type => "string" },
9146 id_number_secondary => { type => "string" },
9147 last_name => { type => "string" },
9148 last_name_kana => { type => "string" },
9149 last_name_kanji => { type => "string" },
9150 maiden_name => { type => "string" },
9151 metadata => { type => "hash" },
9152 nationality => { type => "string" },
9153 person_token => { type => "string" },
9154 phone => { type => "string" },
9155 political_exposure => { type => "string" },
9156 registered_address => { type => "hash" },
9157 relationship => { type => "hash" },
9158 ssn_last_4 => { type => "string" },
9159 verification => { type => "hash" },
9160 };
9161 $args = $self->_contract( 'person', $args ) || CORE::return( $self->pass_error );
9162 my $err = $self->_check_parameters( $okParams, $args );
9163 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
9164 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No account id (with parameter 'id') was provided to create its information." ) );
9165 my $hash = $self->post( "accounts/${id}/persons", $args ) || CORE::return( $self->pass_error );
9166 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Connect::Person', $hash ) );
9167 }
9168 PERL
9169 # NOTE: person_delete()
9170 person_delete => <<'PERL',
9171 sub person_delete
9172 {
9173 my $self = shift( @_ );
9174 my $args = shift( @_ );
9175 my $okParams =
9176 {
9177 expandable => { allowed => $EXPANDABLES->{ 'person' } },
9178 };
9179 $args = $self->_contract( 'person', $args ) || CORE::return( $self->pass_error );
9180 my $err = $self->_check_parameters( $okParams, $args );
9181 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
9182 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." ) );
9183 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No person id (with parameter 'id') was provided to delete its information." ) );
9184 my $hash = $self->delete( "accounts/${parent_id}/persons/${id}", $args ) || CORE::return( $self->pass_error );
9185 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Connect::Person', $hash ) );
9186 }
9187 PERL
9188 # NOTE: person_list()
9189 person_list => <<'PERL',
9190 sub person_list
9191 {
9192 my $self = shift( @_ );
9193 CORE::return( $self->error( "No parameters were provided to list person information." ) ) if( !scalar( @_ ) );
9194 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Connect::Person', @_ );
9195 my $okParams =
9196 {
9197 expandable => { allowed => $EXPANDABLES->{ 'person' }, data_prefix_is_ok => 1 },
9198 ending_before => { type => "string" },
9199 limit => { type => "string" },
9200 relationship => { type => "hash" },
9201 starting_after => { type => "string" },
9202 };
9203 my $err = $self->_check_parameters( $okParams, $args );
9204 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
9205 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No account id (with parameter 'id') was provided to list its information." ) );
9206 if( $args->{expand} )
9207 {
9208 $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
9209 }
9210 my $hash = $self->get( "accounts/${id}/persons", $args ) || CORE::return( $self->pass_error );
9211 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Connect::Person', $hash ) );
9212 }
9213 PERL
9214 # NOTE: person_retrieve()
9215 person_retrieve => <<'PERL',
9216 sub person_retrieve
9217 {
9218 my $self = shift( @_ );
9219 my $args = shift( @_ );
9220 my $okParams =
9221 {
9222 expandable => { allowed => $EXPANDABLES->{ 'person' }, data_prefix_is_ok => 1 },
9223 };
9224 $args = $self->_contract( 'person', $args ) || CORE::return( $self->pass_error );
9225 my $err = $self->_check_parameters( $okParams, $args );
9226 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
9227 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." ) );
9228 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No person id (with parameter 'id') was provided to retrieve its information." ) );
9229 my $hash = $self->get( "accounts/${parent_id}/persons/${id}", $args ) || CORE::return( $self->pass_error );
9230 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Connect::Person', $hash ) );
9231 }
9232 PERL
9233 # NOTE: person_token_create()
9234 person_token_create => <<'PERL',
9235 sub person_token_create { CORE::return( shift->token_create( @_ ) ); }
9236 PERL
9237 # NOTE: person_update()
9238 person_update => <<'PERL',
9239 sub person_update
9240 {
9241 my $self = shift( @_ );
9242 my $args = shift( @_ );
9243 my $okParams =
9244 {
9245 expandable => { allowed => $EXPANDABLES->{ 'person' } },
9246 address => { type => "hash" },
9247 address_kana => { type => "hash" },
9248 address_kanji => { type => "hash" },
9249 dob => { type => "hash" },
9250 documents => { type => "object" },
9251 email => { type => "string" },
9252 first_name => { type => "string" },
9253 first_name_kana => { type => "string" },
9254 first_name_kanji => { type => "string" },
9255 full_name_aliases => { type => "array" },
9256 gender => { type => "string" },
9257 id_number => { type => "string" },
9258 id_number_secondary => { type => "string" },
9259 last_name => { type => "string" },
9260 last_name_kana => { type => "string" },
9261 last_name_kanji => { type => "string" },
9262 maiden_name => { type => "string" },
9263 metadata => { type => "hash" },
9264 nationality => { type => "string" },
9265 person_token => { type => "string" },
9266 phone => { type => "string" },
9267 political_exposure => { type => "string" },
9268 registered_address => { type => "hash" },
9269 relationship => { type => "hash" },
9270 ssn_last_4 => { type => "string" },
9271 verification => { type => "hash" },
9272 };
9273 $args = $self->_contract( 'person', $args ) || CORE::return( $self->pass_error );
9274 my $err = $self->_check_parameters( $okParams, $args );
9275 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
9276 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." ) );
9277 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No person id (with parameter 'id') was provided to update its information." ) );
9278 my $hash = $self->post( "accounts/${parent_id}/persons/${id}", $args ) || CORE::return( $self->pass_error );
9279 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Connect::Person', $hash ) );
9280 }
9281 PERL
9282 # NOTE: persons()
9283 persons => <<'PERL',
9284 # <https://stripe.com/docs/api/persons>
9285 sub persons
9286 {
9287 my $self = shift( @_ );
9288 my $allowed = [qw( create delete list retrieve update )];
9289 my $action = shift( @_ );
9290 my $meth = $self->_get_method( 'person', $action, $allowed ) || CORE::return( $self->pass_error );
9291 CORE::return( $self->$meth( @_ ) );
9292 }
9293 PERL
9294 # NOTE: pii_token_create()
9295 pii_token_create => <<'PERL',
9296 sub pii_token_create { CORE::return( shift->token_create( @_ ) ); }
9297 PERL
9298 # NOTE: plan()
9299 plan => <<'PERL',
9300 sub plan { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Billing::Plan', @_ ) ); }
9301 PERL
9302 # NOTE: plan_by_product()
9303 plan_by_product => <<'PERL',
9304 # Find plan by product id or nickname
9305 sub plan_by_product
9306 {
9307 my $self = shift( @_ );
9308 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Product', @_ );
9309 my $id = CORE::delete( $args->{id} );
9310 my $nickname = CORE::delete( $args->{nickname} );
9311 CORE::return( $self->error( "No product id or plan name was provided to find its related product." ) ) if( !$id && !$nickname );
9312 $args->{product} = $id if( $id );
9313 my $check_both_active_and_inactive = 0;
9314 if( !CORE::length( $args->{active} ) )
9315 {
9316 $check_both_active_and_inactive++;
9317 $args->{active} = $self->true;
9318 }
9319 my $list = $self->plans( list => $args ) || CORE::return( $self->pass_error );
9320 my $objects = [];
9321 while( my $this = $list->next )
9322 {
9323 # If this was specified, this is a restrictive query
9324 if( $nickname && $this->nickname eq $nickname )
9325 {
9326 CORE::push( @$objects, $this );
9327 }
9328 # or at least we have this
9329 elsif( $id )
9330 {
9331 CORE::push( @$objects, $this );
9332 }
9333 }
9334 # Now, we also have to check for inactive plans, because Stripe requires the active parameter to be provided or else it defaults to inactive
9335 # How inefficient...
9336 if( $check_both_active_and_inactive )
9337 {
9338 $args->{active} = $self->false;
9339 my $list = $self->plans( list => $args ) || CORE::return( $self->pass_error );
9340 my $objects = [];
9341 while( my $this = $list->next )
9342 {
9343 if( $nickname && $this->nickname eq $nickname )
9344 {
9345 CORE::push( @$objects, $this );
9346 }
9347 elsif( $id )
9348 {
9349 CORE::push( @$objects, $this );
9350 }
9351 }
9352 }
9353 CORE::return( $objects );
9354 }
9355 PERL
9356 # NOTE: plan_create()
9357 plan_create => <<'PERL',
9358 sub plan_create
9359 {
9360 my $self = shift( @_ );
9361 CORE::return( $self->error( "No parameters were provided to create a plan" ) ) if( !scalar( @_ ) );
9362 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Billing::Plan', @_ );
9363 my $obj = $args->{_object};
9364 if( $self->_is_object( $args->{product} ) && $args->{product}->isa( 'Net::API::Stripe::Product' ) )
9365 {
9366 my $prod_hash = $args->{product}->as_hash({ json => 1 });
9367 $args->{product} = $prod_hash;
9368 }
9369 #exit;
9370 my $okParams =
9371 {
9372 expandable => { allowed => $EXPANDABLES->{plan} },
9373 active => { type => "boolean" },
9374 aggregate_usage => { type => "string" },
9375 amount => { required => 1, type => "integer" },
9376 amount_decimal => { type => "decimal" },
9377 billing_scheme => { type => "string" },
9378 currency => { required => 1, type => "string" },
9379 id => { type => "string" },
9380 interval => { re => qr/^(?:day|week|month|year)$/, required => 1, type => "string" },
9381 interval_count => { type => "integer" },
9382 metadata => { type => "hash" },
9383 nickname => { type => "string" },
9384 product => { required => 1, type => "string" },
9385 tiers => {
9386 fields => [
9387 "up_to",
9388 "flat_amount",
9389 "flat_amount_decimal",
9390 "unit_amount",
9391 "unit_amount_decimal",
9392 ],
9393 type => "array",
9394 },
9395 tiers_mode => { re => qr/^(graduated|volume)$/, type => "string" },
9396 transform_usage => { fields => ["divide_by", "round"], type => "hash" },
9397 trial_period_days => { type => "integer" },
9398 usage_type => { re => qr/^(?:metered|licensed)$/, type => "string" },
9399 };
9400  
9401 $args = $self->_contract( 'plan', $args ) || CORE::return( $self->pass_error );
9402 my $err = $self->_check_parameters( $okParams, $args );
9403 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
9404 my $hash = $self->post( 'plans', $args ) || CORE::return( $self->pass_error );
9405 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::Plan', $hash ) );
9406 }
9407 PERL
9408 # NOTE: plan_delete()
9409 plan_delete => <<'PERL',
9410 # https://stripe.com/docs/api/customers/delete?lang=curl
9411 # "Permanently deletes a customer. It cannot be undone. Also immediately cancels any active subscriptions on the customer."
9412 sub plan_delete
9413 {
9414 my $self = shift( @_ );
9415 CORE::return( $self->error( "No parameters were provided to delete plan information." ) ) if( !scalar( @_ ) );
9416 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Billing::Plan', @_ );
9417 my $okParams =
9418 {
9419 expandable => { allowed => $EXPANDABLES->{plan} },
9420 id => { re => qr/^\w+$/, required => 1 }
9421 };
9422 my $err = $self->_check_parameters( $okParams, $args );
9423 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
9424 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No plan id was provided to delete its information." ) );
9425 my $hash = $self->delete( "plans/${id}", $args ) || CORE::return( $self->pass_error );
9426 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::Plan', $hash ) );
9427 }
9428 PERL
9429 # NOTE: plan_list()
9430 plan_list => <<'PERL',
9431 sub plan_list
9432 {
9433 my $self = shift( @_ );
9434 my $args = $self->_get_args( @_ );
9435 if( $self->_is_object( $args->{product} ) && $args->{product}->isa( 'Net::API::Stripe::Product' ) )
9436 {
9437 my $prod_hash = $args->{product}->as_hash({ json => 1 });
9438 $args->{product} = $prod_hash->{id} ? $prod_hash->{id} : undef();
9439 }
9440 my $okParams =
9441 {
9442 expandable => { allowed => $EXPANDABLES->{plan}, data_prefix_is_ok => 1 },
9443 active => { type => "boolean" },
9444 created => { re => qr/^\d+$/, type => "timestamp" },
9445 'created.gt' => { re => qr/^\d+$/ },
9446 'created.gte' => { re => qr/^\d+$/ },
9447 'created.lt' => { re => qr/^\d+$/ },
9448 'created.lte' => { re => qr/^\d+$/ },
9449 ending_before => { type => "string" },
9450 limit => { re => qr/^\d+$/, type => "string" },
9451 product => { re => qr/^\w+$/, type => "string" },
9452 starting_after => { type => "string" },
9453 };
9454  
9455 foreach my $bool ( qw( active ) )
9456 {
9457 next if( !CORE::length( $args->{ $bool } ) );
9458 $args->{ $bool } = ( $args->{ $bool } eq 'true' || ( $args->{ $bool } ne 'false' && $args->{ $bool } ) ) ? 'true' : 'false';
9459 }
9460 my $err = $self->_check_parameters( $okParams, $args );
9461 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
9462 if( $args->{expand} )
9463 {
9464 $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
9465 }
9466 my $hash = $self->get( 'plans', $args ) || CORE::return( $self->pass_error );
9467 CORE::return( $self->_response_to_object( 'Net::API::Stripe::List', $hash ) );
9468 }
9469 PERL
9470 # NOTE: plan_retrieve()
9471 plan_retrieve => <<'PERL',
9472 sub plan_retrieve
9473 {
9474 my $self = shift( @_ );
9475 CORE::return( $self->error( "No parameters were provided to retrieve plan information." ) ) if( !scalar( @_ ) );
9476 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Billing::Plan', @_ );
9477 my $okParams =
9478 {
9479 expandable => { allowed => $EXPANDABLES->{plan} },
9480 id => { re => qr/^\w+$/, required => 1 }
9481 };
9482 my $err = $self->_check_parameters( $okParams, $args );
9483 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
9484 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No plan id was provided to retrieve its information." ) );
9485 my $hash = $self->get( "plans/${id}", $args ) || CORE::return( $self->pass_error );
9486 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::Plan', $hash ) );
9487 }
9488 PERL
9489 # NOTE: plan_update()
9490 plan_update => <<'PERL',
9491 # https://stripe.com/docs/api/customers/update?lang=curl
9492 sub plan_update
9493 {
9494 my $self = shift( @_ );
9495 CORE::return( $self->error( "No parameters were provided to update a plan" ) ) if( !scalar( @_ ) );
9496 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Billing::Plan', @_ );
9497 if( $self->_is_object( $args->{product} ) && $args->{product}->isa( 'Net::API::Stripe::Product' ) )
9498 {
9499 $args->{product} = $args->{product}->id;
9500 }
9501 my $okParams =
9502 {
9503 expandable => { allowed => $EXPANDABLES->{plan} },
9504 active => { re => qr/^(?:true|False)$/, type => "boolean" },
9505 id => { required => 1 },
9506 metadata => { type => "hash" },
9507 nickname => { type => "string" },
9508 product => { re => qr/^\w+$/, type => "string" },
9509 trial_period_days => { type => "integer" },
9510 };
9511  
9512 $args = $self->_contract( 'plan', $args ) || CORE::return( $self->pass_error );
9513 # We found some errors
9514 my $err = $self->_check_parameters( $okParams, $args );
9515 # $self->message( 3, "Data to be posted: ", $self->dumper( $args ) ); exit;
9516 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
9517 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No plan id was provided to update plan's details" ) );
9518 my $hash = $self->post( "plans/${id}", $args ) || CORE::return( $self->pass_error );
9519 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::Plan', $hash ) );
9520 }
9521 PERL
9522 # NOTE: plans()
9523 plans => <<'PERL',
9524 sub plans
9525 {
9526 my $self = shift( @_ );
9527 my $action = shift( @_ );
9528 my $allowed = [qw( create retrieve update list delete )];
9529 my $meth = $self->_get_method( 'plan', $action, $allowed ) || CORE::return( $self->pass_error );
9530 CORE::return( $self->$meth( @_ ) );
9531 }
9532 PERL
9533 # NOTE: portal_configuration()
9534 portal_configuration => <<'PERL',
9535 sub portal_configuration { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Billing::Plan', @_ ) ); }
9536 PERL
9537 # NOTE: portal_configuration_create()
9538 portal_configuration_create => <<'PERL',
9539 sub portal_configuration_create
9540 {
9541 my $self = shift( @_ );
9542 CORE::return( $self->error( "No parameters were provided to create a portal configuration" ) ) if( !scalar( @_ ) );
9543 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Billing::PortalConfiguration', @_ );
9544 my $okParams =
9545 {
9546 expandable => { allowed => $EXPANDABLES->{portal_configuration} },
9547 business_profile => { fields => [qw( headline privacy_policy_url terms_of_service_url )], required => 1 },
9548 default_return_url => { type => 'utl' },
9549 features => { fields => [qw(
9550 customer_update.enabled!
9551 customer_update.allowed_updates
9552 invoice_history.enabled!
9553 payment_method_update.enabled!
9554 subscription_cancel.enabled!
9555 subscription_cancel.cancellation_reason.enabled!
9556 subscription_cancel.cancellation_reason.options!
9557 subscription_cancel.mode
9558 subscription_cancel.proration_behavior
9559 subscription_pause.enabled
9560 subscription_update.default_allowed_updates!
9561 subscription_update.enabled!
9562 subscription_update.products!
9563 subscription_update.proration_behavior
9564 )], required => 1 },
9565 metadata => { type => 'hash' },
9566 };
9567 $args = $self->_contract( 'portal_configuration', $args ) || CORE::return( $self->pass_error );
9568 my $err = $self->_check_parameters( $okParams, $args );
9569 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
9570 my $hash = $self->post( 'billing_portal/configurations', $args ) || CORE::return( $self->pass_error );
9571 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::PortalConfiguration', $hash ) );
9572 }
9573 PERL
9574 # NOTE: portal_configuration_list()
9575 portal_configuration_list => <<'PERL',
9576 sub portal_configuration_list
9577 {
9578 my $self = shift( @_ );
9579 my $args = $self->_get_args( @_ );
9580 my $okParams =
9581 {
9582 expandable => { allowed => $EXPANDABLES->{portal_configuration}, data_prefix_is_ok => 1 },
9583 active => { type => 'boolean' },
9584 is_default => { type => 'boolean' },
9585 # "A cursor for use in pagination. ending_before is an object ID that defines your place in the list."
9586 ending_before => {},
9587 limit => { re => qr/^\d+$/ },
9588 starting_after => {},
9589 };
9590 my $err = $self->_check_parameters( $okParams, $args );
9591 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
9592 if( $args->{expand} )
9593 {
9594 $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
9595 }
9596 my $hash = $self->get( 'billing_portal/configurations', $args ) || CORE::return( $self->pass_error );
9597 CORE::return( $self->_response_to_object( 'Net::API::Stripe::List', $hash ) );
9598 }
9599 PERL
9600 # NOTE: portal_configuration_retrieve()
9601 portal_configuration_retrieve => <<'PERL',
9602 sub portal_configuration_retrieve
9603 {
9604 my $self = shift( @_ );
9605 CORE::return( $self->error( "No parameters were provided to retrieve the portal configuration." ) ) if( !scalar( @_ ) );
9606 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Billing::PortalConfiguration', @_ );
9607 my $okParams =
9608 {
9609 expandable => { allowed => $EXPANDABLES->{portal_configuration} },
9610 id => { re => qr/^\w+$/, required => 1 }
9611 };
9612 my $err = $self->_check_parameters( $okParams, $args );
9613 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
9614 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No portal configuration id was provided to retrieve its information." ) );
9615 my $hash = $self->get( "billing_portal/configurations/${id}", $args ) || CORE::return( $self->pass_error );
9616 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::PortalConfiguration', $hash ) );
9617 }
9618 PERL
9619 # NOTE: portal_configuration_update()
9620 portal_configuration_update => <<'PERL',
9621 # https://stripe.com/docs/api/customers/update?lang=curl
9622 sub portal_configuration_update
9623 {
9624 my $self = shift( @_ );
9625 CORE::return( $self->error( "No parameters were provided to update a portal configuration" ) ) if( !scalar( @_ ) );
9626 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Billing::PortalConfiguration', @_ );
9627 my $okParams =
9628 {
9629 expandable => { allowed => $EXPANDABLES->{portal_configuration} },
9630 id => { required => 1 },
9631 active => { type => 'boolean' },
9632 business_profile => { fields => [qw( headline privacy_policy_url terms_of_service_url )] },
9633 default_return_url => { type => 'utl' },
9634 features => { fields => [qw(
9635 customer_update.enabled customer_update.allowed_updates
9636 invoice_history.enabled!
9637 payment_method_update.enabled!
9638 subscription_cancel.enabled
9639 subscription_cancel.cancellation_reason.enabled!
9640 subscription_cancel.cancellation_reason.options
9641 subscription_cancel.mode
9642 subscription_cancel.proration_behavior
9643 subscription_pause.enabled
9644 subscription_update.default_allowed_updates
9645 subscription_update.enabled
9646 subscription_update.products
9647 subscription_update.proration_behavior
9648 )] },
9649 metadata => { type => 'hash' },
9650 };
9651 $args = $self->_contract( 'portal_configuration', $args ) || CORE::return( $self->pass_error );
9652 # We found some errors
9653 my $err = $self->_check_parameters( $okParams, $args );
9654 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
9655 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No portal configuration id was provided to update its information." ) );
9656 my $hash = $self->post( "billing_portal/configurations/${id}", $args ) || CORE::return( $self->pass_error );
9657 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::PortalConfiguration', $hash ) );
9658 }
9659 PERL
9660 # NOTE: portal_configurations()
9661 portal_configurations => <<'PERL',
9662 sub portal_configurations
9663 {
9664 my $self = shift( @_ );
9665 my $action = shift( @_ );
9666 my $allowed = [qw( create retrieve update list )];
9667 my $meth = $self->_get_method( 'plan', $action, $allowed ) || CORE::return( $self->pass_error );
9668 CORE::return( $self->$meth( @_ ) );
9669 }
9670 PERL
9671 # NOTE: portal_session()
9672 portal_session => <<'PERL',
9673 sub portal_session { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Billing::PortalSession', @_ ) ); }
9674 PERL
9675 # NOTE: portal_session_create()
9676 portal_session_create => <<'PERL',
9677 sub portal_session_create
9678 {
9679 my $self = shift( @_ );
9680 CORE::return( $self->error( "No parameters were provided to create a portal session" ) ) if( !scalar( @_ ) );
9681 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Billing::PortalSession', @_ );
9682 my $okParams =
9683 {
9684 expandable => { allowed => $EXPANDABLES->{portal_session} },
9685 customer => { re => qr/^\w+$/, required => 1 },
9686 configuration => { re => qr/^\w+$/ },
9687 locale => {},
9688 on_behalf_of => { re => qr/^\w+$/ },
9689 return_url => { type => 'url' },
9690 };
9691 $args = $self->_contract( 'portal_session', $args ) || CORE::return( $self->pass_error );
9692 my $err = $self->_check_parameters( $okParams, $args );
9693 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
9694 my $hash = $self->post( 'billing_portal/sessions', $args ) || CORE::return( $self->pass_error );
9695 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::PortalSession', $hash ) );
9696 }
9697 PERL
9698 # NOTE: portal_sessions()
9699 portal_sessions => <<'PERL',
9700 sub portal_sessions
9701 {
9702 my $self = shift( @_ );
9703 my $action = shift( @_ );
9704 my $allowed = [qw( create )];
9705 my $meth = $self->_get_method( 'plan', $action, $allowed ) || CORE::return( $self->pass_error );
9706 CORE::return( $self->$meth( @_ ) );
9707 }
9708 PERL
9709 # NOTE: price()
9710 price => <<'PERL',
9711 sub price { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Price', @_ ) ); }
9712 PERL
9713 # NOTE: price_create()
9714 price_create => <<'PERL',
9715 sub price_create
9716 {
9717 my $self = shift( @_ );
9718 CORE::return( $self->error( "No parameters were provided to create a price" ) ) if( !scalar( @_ ) );
9719 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Price', @_ );
9720 my $obj = $args->{_object};
9721 if( $self->_is_object( $args->{product} ) && $args->{product}->isa( 'Net::API::Stripe::Product' ) )
9722 {
9723 my $prod_hash = $args->{product}->as_hash({ json => 1 });
9724 $args->{product} = $prod_hash;
9725 }
9726 #exit;
9727 my $okParams =
9728 {
9729 expandable => { allowed => $EXPANDABLES->{price} },
9730 active => { type => "boolean" },
9731 billing_scheme => { type => "string" },
9732 currency => { required => 1, type => "string" },
9733 currency_options => { type => "hash" },
9734 custom_unit_amount => { type => "hash" },
9735 id => {},
9736 lookup_key => { type => "string" },
9737 metadata => { type => "hash" },
9738 nickname => { type => "string" },
9739 product => { required => 1, type => "string" },
9740 product_data => {
9741 fields => [
9742 "id",
9743 "name",
9744 "active",
9745 "metadata",
9746 "statement_descriptor",
9747 "unit_label",
9748 ],
9749 type => "object",
9750 },
9751 recurring => {
9752 fields => [
9753 "interval",
9754 "aggregate_usage",
9755 "interval_count",
9756 "trial_period_days",
9757 "usage_type",
9758 ],
9759 type => "hash",
9760 },
9761 tax_behavior => { type => "string" },
9762 tiers => {
9763 fields => [
9764 "up_to",
9765 "flat_amount",
9766 "flat_amount_decimal",
9767 "unit_amount",
9768 "unit_amount_decimal",
9769 ],
9770 type => "array",
9771 },
9772 tiers_mode => { re => qr/^(graduated|volume)$/, type => "string" },
9773 transfer_lookup_key => { type => "boolean" },
9774 transform_quantity => { fields => ["divide_by", "round"], type => "hash" },
9775 unit_amount => { required => 1, type => "integer" },
9776 unit_amount_decimal => { type => "decimal" },
9777 };
9778  
9779 $args = $self->_contract( 'price', $args ) || CORE::return( $self->pass_error );
9780 my $err = $self->_check_parameters( $okParams, $args );
9781 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
9782 my $hash = $self->post( 'prices', $args ) || CORE::return( $self->pass_error );
9783 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Price', $hash ) );
9784 }
9785 PERL
9786 # NOTE: price_list()
9787 price_list => <<'PERL',
9788 sub price_list
9789 {
9790 my $self = shift( @_ );
9791 my $args = $self->_get_args( @_ );
9792 if( $self->_is_object( $args->{product} ) && $args->{product}->isa( 'Net::API::Stripe::Product' ) )
9793 {
9794 my $prod_hash = $args->{product}->as_hash({ json => 1 });
9795 $args->{product} = $prod_hash->{id} ? $prod_hash->{id} : undef();
9796 }
9797 my $okParams =
9798 {
9799 expandable => { allowed => $EXPANDABLES->{price}, data_prefix_is_ok => 1 },
9800 active => { type => "boolean" },
9801 created => { re => qr/^\d+$/, type => "timestamp" },
9802 'created.gt' => { re => qr/^\d+$/ },
9803 'created.gte' => { re => qr/^\d+$/ },
9804 'created.lt' => { re => qr/^\d+$/ },
9805 'created.lte' => { re => qr/^\d+$/ },
9806 currency => { type => "string" },
9807 ending_before => { type => "string" },
9808 limit => { re => qr/^\d+$/, type => "string" },
9809 lookup_keys => { type => "string" },
9810 product => { re => qr/^\w+$/, type => "string" },
9811 recurring => { fields => ["interval", "usage_type"], type => "hash" },
9812 starting_after => { type => "string" },
9813 type => { type => "string" },
9814 };
9815  
9816 foreach my $bool ( qw( active ) )
9817 {
9818 next if( !CORE::length( $args->{ $bool } ) );
9819 $args->{ $bool } = ( $args->{ $bool } eq 'true' || ( $args->{ $bool } ne 'false' && $args->{ $bool } ) ) ? 'true' : 'false';
9820 }
9821 my $err = $self->_check_parameters( $okParams, $args );
9822 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
9823 if( $args->{expand} )
9824 {
9825 $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
9826 }
9827 my $hash = $self->get( 'prices', $args ) || CORE::return( $self->pass_error );
9828 CORE::return( $self->_response_to_object( 'Net::API::Stripe::List', $hash ) );
9829 }
9830 PERL
9831 # NOTE: price_retrieve()
9832 price_retrieve => <<'PERL',
9833 sub price_retrieve
9834 {
9835 my $self = shift( @_ );
9836 CORE::return( $self->error( "No parameters were provided to retrieve price information." ) ) if( !scalar( @_ ) );
9837 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Price', @_ );
9838 my $okParams =
9839 {
9840 expandable => { allowed => $EXPANDABLES->{price} },
9841 id => { re => qr/^\w+$/, required => 1 }
9842 };
9843 my $err = $self->_check_parameters( $okParams, $args );
9844 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
9845 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No price id was provided to retrieve its information." ) );
9846 my $hash = $self->get( "prices/${id}", $args ) || CORE::return( $self->pass_error );
9847 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Price', $hash ) );
9848 }
9849 PERL
9850 # NOTE: price_search()
9851 price_search => <<'PERL',
9852 sub price_search
9853 {
9854 my $self = shift( @_ );
9855 CORE::return( $self->error( "No parameters were provided to search for a price information." ) ) if( !scalar( @_ ) );
9856 my $args = shift( @_ );
9857 my $okParams =
9858 {
9859 expandable => { allowed => $EXPANDABLES->{price}, data_prefix_is_ok => 1 },
9860 limit => qr/^\d+$/,
9861 page => qr/^\d+$/,
9862 query => { re => qr/^.*?$/, required => 1, type => "string" },
9863 };
9864  
9865 my $err = $self->_check_parameters( $okParams, $args );
9866 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
9867 if( $args->{expand} )
9868 {
9869 $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
9870 }
9871 my $hash = $self->get( "prices/search", $args ) || CORE::return( $self->pass_error );
9872 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Product', $hash ) );
9873 }
9874 PERL
9875 # NOTE: price_update()
9876 price_update => <<'PERL',
9877 # https://stripe.com/docs/api/customers/update?lang=curl
9878 sub price_update
9879 {
9880 my $self = shift( @_ );
9881 CORE::return( $self->error( "No parameters were provided to update a price object" ) ) if( !scalar( @_ ) );
9882 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Price', @_ );
9883 if( $self->_is_object( $args->{product} ) && $args->{product}->isa( 'Net::API::Stripe::Product' ) )
9884 {
9885 $args->{product} = $args->{product}->id;
9886 }
9887 my $okParams =
9888 {
9889 expandable => { allowed => $EXPANDABLES->{price} },
9890 active => { re => qr/^(?:true|False)$/, type => "boolean" },
9891 currency_options => { type => "hash" },
9892 id => { required => 1 },
9893 lookup_key => { type => "string" },
9894 metadata => { type => "hash" },
9895 nickname => { type => "string" },
9896 recurring => {
9897 fields => [
9898 "interval",
9899 "aggregate_usage",
9900 "interval_count",
9901 "trial_period_days",
9902 "usage_type",
9903 ],
9904 },
9905 tax_behavior => { type => "string" },
9906 transfer_lookup_key => { type => "boolean" },
9907 };
9908  
9909 $args = $self->_contract( 'price', $args ) || CORE::return( $self->pass_error );
9910 # We found some errors
9911 my $err = $self->_check_parameters( $okParams, $args );
9912 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
9913 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No price id was provided to update price's details" ) );
9914 my $hash = $self->post( "prices/${id}", $args ) || CORE::return( $self->pass_error );
9915 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Price', $hash ) );
9916 }
9917 PERL
9918 # NOTE: prices()
9919 prices => <<'PERL',
9920 # <https://stripe.com/docs/api/prices>
9921 sub prices
9922 {
9923 my $self = shift( @_ );
9924 my $allowed = [qw( create list retrieve search update )];
9925 my $action = shift( @_ );
9926 my $meth = $self->_get_method( 'price', $action, $allowed ) || CORE::return( $self->pass_error );
9927 CORE::return( $self->$meth( @_ ) );
9928 }
9929 PERL
9930 # NOTE: product()
9931 product => <<'PERL',
9932 sub product { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Product', @_ ) ); }
9933 PERL
9934 # NOTE: product_by_name()
9935 product_by_name => <<'PERL',
9936 sub product_by_name
9937 {
9938 my $self = shift( @_ );
9939 my $args = $self->_get_args( @_ );
9940 my $name = CORE::delete( $args->{name} );
9941 my $nickname = CORE::delete( $args->{nickname} );
9942 my $list = $self->products( list => $args ) || CORE::return( $self->pass_error );
9943 my $objects = [];
9944 while( my $this = $list->next )
9945 {
9946 if( ( $name && $this->name eq $name ) ||
9947 ( $nickname && $this->nickname eq $nickname ) )
9948 {
9949 CORE::push( @$objects, $this );
9950 }
9951 }
9952 CORE::return( $objects );
9953 }
9954 PERL
9955 # NOTE: product_create()
9956 product_create => <<'PERL',
9957 sub product_create
9958 {
9959 my $self = shift( @_ );
9960 CORE::return( $self->error( "No parameters were provided to create a product" ) ) if( !scalar( @_ ) );
9961 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Product', @_ );
9962 my $okParams =
9963 {
9964 expandable => { allowed => $EXPANDABLES->{product} },
9965 active => { type => "boolean" },
9966 attributes => sub { ... },
9967 caption => {},
9968 deactivate_on => { type => "array" },
9969 default_price_data => { type => "object" },
9970 description => { type => "string" },
9971 id => { type => "string" },
9972 images => sub { ... },
9973 metadata => { type => "hash" },
9974 name => { required => 1, type => "string" },
9975 package_dimensions => { type => "hash" },
9976 shippable => { type => "boolean" },
9977 statement_descriptor => { type => "string" },
9978 tax_code => { type => "string" },
9979 type => { re => qr/^(good|service)$/, required => 1 },
9980 unit_label => { type => "string" },
9981 url => { type => "string" },
9982 };
9983  
9984 $args = $self->_contract( 'product', $args ) || CORE::return( $self->pass_error );
9985 my $err = $self->_check_parameters( $okParams, $args );
9986 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
9987 my $hash = $self->post( 'products', $args ) || CORE::return( $self->pass_error );
9988 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Product', $hash ) );
9989 }
9990 PERL
9991 # NOTE: product_delete()
9992 product_delete => <<'PERL',
9993 # https://stripe.com/docs/api/customers/delete?lang=curl
9994 # "Permanently deletes a customer. It cannot be undone. Also immediately cancels any active subscriptions on the customer."
9995 sub product_delete
9996 {
9997 my $self = shift( @_ );
9998 CORE::return( $self->error( "No parameters were provided to delete product information." ) ) if( !scalar( @_ ) );
9999 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Product', @_ );
10000 my $okParams =
10001 {
10002 expandable => { allowed => $EXPANDABLES->{product} },
10003 id => { re => qr/^\w+$/, required => 1 }
10004 };
10005 my $err = $self->_check_parameters( $okParams, $args );
10006 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
10007 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No product id was provided to delete its information." ) );
10008 my $hash = $self->delete( "products/${id}", $args ) || CORE::return( $self->pass_error );
10009 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Product', $hash ) );
10010 }
10011 PERL
10012 # NOTE: product_list()
10013 product_list => <<'PERL',
10014 sub product_list
10015 {
10016 my $self = shift( @_ );
10017 my $args = $self->_get_args( @_ );
10018 my $okParams =
10019 {
10020 expandable => { allowed => $EXPANDABLES->{product}, data_prefix_is_ok => 1 },
10021 active => { type => "boolean" },
10022 created => { re => qr/^\d+$/, type => "timestamp" },
10023 'created.gt' => { re => qr/^\d+$/ },
10024 'created.gte' => { re => qr/^\d+$/ },
10025 'created.lt' => { re => qr/^\d+$/ },
10026 'created.lte' => { re => qr/^\d+$/ },
10027 ending_before => { type => "string" },
10028 ids => { type => "array" },
10029 limit => { re => qr/^\d+$/, type => "string" },
10030 shippable => { type => "boolean" },
10031 starting_after => { type => "string" },
10032 type => {},
10033 url => { type => "string" },
10034 };
10035  
10036 my $err = $self->_check_parameters( $okParams, $args );
10037 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
10038 if( $args->{expand} )
10039 {
10040 $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
10041 }
10042 my $hash = $self->get( 'products', $args ) || CORE::return( $self->pass_error );
10043 CORE::return( $self->_response_to_object( 'Net::API::Stripe::List', $hash ) );
10044 }
10045 PERL
10046 # NOTE: product_retrieve()
10047 product_retrieve => <<'PERL',
10048 sub product_retrieve
10049 {
10050 my $self = shift( @_ );
10051 CORE::return( $self->error( "No parameters were provided to retrieve product information." ) ) if( !scalar( @_ ) );
10052 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Product', @_ );
10053 my $okParams =
10054 {
10055 expandable => { allowed => $EXPANDABLES->{product} },
10056 id => { re => qr/^\w+$/, required => 1 }
10057 };
10058 my $err = $self->_check_parameters( $okParams, $args );
10059 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
10060 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No product id was provided to retrieve its information." ) );
10061 my $hash = $self->get( "products/${id}", $args ) || CORE::return( $self->pass_error );
10062 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Product', $hash ) );
10063 }
10064 PERL
10065 # NOTE: product_search()
10066 product_search => <<'PERL',
10067 sub product_search
10068 {
10069 my $self = shift( @_ );
10070 CORE::return( $self->error( "No parameters were provided to search for a product information." ) ) if( !scalar( @_ ) );
10071 my $args = shift( @_ );
10072 my $okParams =
10073 {
10074 expandable => { allowed => $EXPANDABLES->{product}, data_prefix_is_ok => 1 },
10075 limit => qr/^\d+$/,
10076 page => qr/^\d+$/,
10077 query => { re => qr/^.*?$/, required => 1, type => "string" },
10078 };
10079  
10080 my $err = $self->_check_parameters( $okParams, $args );
10081 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
10082 if( $args->{expand} )
10083 {
10084 $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
10085 }
10086 my $hash = $self->get( "products/search", $args ) || CORE::return( $self->pass_error );
10087 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Product', $hash ) );
10088 }
10089 PERL
10090 # NOTE: product_update()
10091 product_update => <<'PERL',
10092 # https://stripe.com/docs/api/customers/update?lang=curl
10093 sub product_update
10094 {
10095 my $self = shift( @_ );
10096 CORE::return( $self->error( "No parameters were provided to update a product" ) ) if( !scalar( @_ ) );
10097 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Product', @_ );
10098 my $okParams =
10099 {
10100 expandable => { allowed => $EXPANDABLES->{product} },
10101 HASH(0x55bef17244e8) => "type",
10102 HASH(0x55bef172f668) => undef,
10103 HASH(0x55bef17416b8) => "unit_label",
10104 HASH(0x55bef174e1e8) => "statement_descriptor",
10105 HASH(0x55bef17598f0) => "url",
10106 HASH(0x55bef27d6400) => "shippable",
10107 active => { type => "boolean" },
10108 attributes => sub { ... },
10109 caption => {},
10110 deactivate_on => { type => "array" },
10111 default_price => { type => "string" },
10112 description => { type => "string" },
10113 id => { re => qr/^\w+$/, required => 1 },
10114 images => sub { ... },
10115 metadata => { type => "hash" },
10116 name => "HASH(0x55bef173a200)package_dimensions",
10117 package_dimensions => { type => "hash" },
10118 shippable => { type => "boolean" },
10119 statement_descriptor => { type => "string" },
10120 tax_code => { type => "string" },
10121 unit_label => { type => "string" },
10122 url => { type => "string" },
10123 };
10124  
10125 $args = $self->_contract( 'product', $args ) || CORE::return( $self->pass_error );
10126 # We found some errors
10127 my $err = $self->_check_parameters( $okParams, $args );
10128 # $self->message( 3, "Data to be posted: ", $self->dumper( $args ) ); exit;
10129 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
10130 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No product id was provided to update product's details" ) );
10131 my $hash = $self->post( "products/${id}", $args ) || CORE::return( $self->pass_error );
10132 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Product', $hash ) );
10133 }
10134 PERL
10135 # NOTE: products()
10136 products => <<'PERL',
10137 sub products
10138 {
10139 my $self = shift( @_ );
10140 my $action = shift( @_ );
10141 my $allowed = [qw( create retrieve update list delete search )];
10142 my $meth = $self->_get_method( 'product', $action, $allowed ) || CORE::return( $self->pass_error );
10143 CORE::return( $self->$meth( @_ ) );
10144 }
10145 PERL
10146 # NOTE: promotion_code()
10147 promotion_code => <<'PERL',
10148 sub promotion_code { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Product::PromotionCode', @_ ) ); }
10149 PERL
10150 # NOTE: promotion_code_create()
10151 promotion_code_create => <<'PERL',
10152 sub promotion_code_create
10153 {
10154 my $self = shift( @_ );
10155 CORE::return( $self->error( "No parameters were provided to create a promotion code" ) ) if( !scalar( @_ ) );
10156 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Product::PromotionCode', @_ );
10157 my $okParams =
10158 {
10159 expandable => { allowed => $EXPANDABLES->{promotion_code} },
10160 active => { type => "boolean" },
10161 code => { re => qr/^.*?$/, type => "string" },
10162 coupon => { re => qr/^\w+$/, required => 1, type => "hash" },
10163 customer => { re => qr/^\w+$/, type => "string" },
10164 expires_at => { type => "timestamp" },
10165 max_redemptions => { type => "integer" },
10166 metadata => { type => "hash" },
10167 restrictions => {
10168 fields => [
10169 "restrictions.first_time_transaction",
10170 "restrictions.minimum_amount",
10171 "restrictions.minimum_amount_currency",
10172 ],
10173 type => "hash",
10174 },
10175 };
10176  
10177 $args = $self->_contract( 'promotion_code', $args ) || CORE::return( $self->pass_error );
10178 my $err = $self->_check_parameters( $okParams, $args );
10179 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
10180 my $hash = $self->post( 'promotion_codes', $args ) || CORE::return( $self->pass_error );
10181 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Product::PromotionCode', $hash ) );
10182 }
10183 PERL
10184 # NOTE: promotion_code_list()
10185 promotion_code_list => <<'PERL',
10186 sub promotion_code_list
10187 {
10188 my $self = shift( @_ );
10189 my $args = shift( @_ );
10190 my $okParams =
10191 {
10192 expandable => { allowed => $EXPANDABLES->{promotion_code}, data_prefix_is_ok => 1 },
10193 active => { type => "boolean" },
10194 code => { re => qr/^.*?$/, type => "string" },
10195 coupon => { re => qr/^\w+$/, type => "hash" },
10196 created => qr/^\d+$/,
10197 'created.gt' => qr/^\d+$/,
10198 'created.gte' => qr/^\d+$/,
10199 'created.lt' => qr/^\d+$/,
10200 'created.lte' => qr/^\d+$/,
10201 customer => { re => qr/^\w+$/, type => "string" },
10202 ending_before => qr/^\w+$/,
10203 limit => qr/^\d+$/,
10204 starting_after => qr/^\w+$/,
10205 };
10206  
10207 my $err = $self->_check_parameters( $okParams, $args );
10208 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
10209 if( $args->{expand} )
10210 {
10211 $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
10212 }
10213 my $hash = $self->get( 'promotion_codes', $args ) || CORE::return( $self->pass_error );
10214 CORE::return( $self->_response_to_object( 'Net::API::Stripe::List', $hash ) );
10215 }
10216 PERL
10217 # NOTE: promotion_code_retrieve()
10218 promotion_code_retrieve => <<'PERL',
10219 sub promotion_code_retrieve
10220 {
10221 my $self = shift( @_ );
10222 CORE::return( $self->error( "No parameters were provided to retrieve promotion code information." ) ) if( !scalar( @_ ) );
10223 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Product::PromotionCode', @_ );
10224 my $okParams =
10225 {
10226 expandable => { allowed => $EXPANDABLES->{promotion_code} },
10227 id => { re => qr/^\S+$/, required => 1 }
10228 };
10229 my $err = $self->_check_parameters( $okParams, $args );
10230 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
10231 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No promotion code id was provided to retrieve its information." ) );
10232 my $hash = $self->get( "promotion_codes/${id}", $args ) || CORE::return( $self->pass_error );
10233 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Product::PromotionCode', $hash ) );
10234 }
10235 PERL
10236 # NOTE: promotion_code_update()
10237 promotion_code_update => <<'PERL',
10238 sub promotion_code_update
10239 {
10240 my $self = shift( @_ );
10241 CORE::return( $self->error( "No parameters were provided to update a promotion code" ) ) if( !scalar( @_ ) );
10242 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Product::PromotionCode', @_ );
10243 my $okParams =
10244 {
10245 expandable => { allowed => $EXPANDABLES->{promotion_code} },
10246 active => { type => "boolean" },
10247 id => { re => qr/^\S+$/, required => 1 },
10248 metadata => { type => "hash" },
10249 restrictions => { type => "hash" },
10250 };
10251  
10252 $args = $self->_contract( 'promotion_code', $args ) || CORE::return( $self->pass_error );
10253 # We found some errors
10254 my $err = $self->_check_parameters( $okParams, $args );
10255 # $self->message( 3, "Data to be posted: ", $self->dumper( $args ) ); exit;
10256 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
10257 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No promotion code id was provided to update its details" ) );
10258 my $hash = $self->post( "promotion_codes/${id}", $args ) || CORE::return( $self->pass_error );
10259 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Product::PromotionCode', $hash ) );
10260 }
10261 PERL
10262 # NOTE: promotion_codes()
10263 promotion_codes => <<'PERL',
10264 sub promotion_codes
10265 {
10266 my $self = shift( @_ );
10267 my $action = shift( @_ );
10268 my $allowed = [qw( create retrieve update list )];
10269 my $meth = $self->_get_method( 'promotion_code', $action, $allowed ) || CORE::return( $self->pass_error );
10270 CORE::return( $self->$meth( @_ ) );
10271 }
10272 PERL
10273 # NOTE: quote()
10274 quote => <<'PERL',
10275 sub quote { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Billing::Quote', @_ ) ); }
10276 PERL
10277 # NOTE: quote_accept()
10278 quote_accept => <<'PERL',
10279 sub quote_accept
10280 {
10281 my $self = shift( @_ );
10282 CORE::return( $self->error( "No parameters were provided to accept a quote." ) ) if( !scalar( @_ ) );
10283 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Billing::Quote', @_ );
10284 my $okParams =
10285 {
10286 expandable => { allowed => $EXPANDABLES->{quote} },
10287 id => { re => qr/^\w+$/, required => 1 },
10288 };
10289 my $err = $self->_check_parameters( $okParams, $args );
10290 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
10291 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No quote id was provided to accept it." ) );
10292 my $hash = $self->post( "quotes/${id}/accept", $args ) || CORE::return( $self->pass_error );
10293 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::Quote', $hash ) );
10294 }
10295 PERL
10296 # NOTE: quote_cancel()
10297 quote_cancel => <<'PERL',
10298 sub quote_cancel
10299 {
10300 my $self = shift( @_ );
10301 CORE::return( $self->error( "No parameters were provided to cancel a quote." ) ) if( !scalar( @_ ) );
10302 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Billing::Quote', @_ );
10303 my $okParams =
10304 {
10305 expandable => { allowed => $EXPANDABLES->{quote} },
10306 id => { re => qr/^\w+$/, required => 1 },
10307 };
10308 my $err = $self->_check_parameters( $okParams, $args );
10309 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
10310 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No quote id was provided to cancel it." ) );
10311 my $hash = $self->post( "quotes/${id}/cancel", $args ) || CORE::return( $self->pass_error );
10312 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::Quote', $hash ) );
10313 }
10314 PERL
10315 # NOTE: quote_create()
10316 quote_create => <<'PERL',
10317 sub quote_create
10318 {
10319 my $self = shift( @_ );
10320 CORE::return( $self->error( "No parameters were provided to create a quote" ) ) if( !scalar( @_ ) );
10321 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Billing::Quote', @_ );
10322 my $obj = $args->{_object};
10323 if( $self->_is_object( $args->{customer} ) && $args->{customer}->isa( 'Net::API::Stripe::Customer' ) )
10324 {
10325 $args->{customer} = $args->{customer}->id;
10326 }
10327 my $okParams =
10328 {
10329 expandable => { allowed => $EXPANDABLES->{quote} },
10330 application_fee_amount => { type => "integer" },
10331 application_fee_percent => { type => "decomal" },
10332 automatic_tax => { fields => ["enabled!"], type => "hash" },
10333 collection_method => { type => "string" },
10334 customer => { re => qr/^\w+$/, type => "string" },
10335 default_tax_rates => { type => "array" },
10336 description => { type => "string" },
10337 discounts => { fields => ["coupon", "discount"], type => "array" },
10338 expires_at => { type => "datetime" },
10339 footer => { type => "string" },
10340 from_quote => { fields => ["qoute!", "is_revision"], type => "hash" },
10341 header => { type => "string" },
10342 invoice_settings => { fields => ["days_until_due"], type => "hash" },
10343 line_items => {
10344 fields => [
10345 "price",
10346 "price_data",
10347 "price_data.currency!",
10348 "price_data.product!",
10349 "price_data.unit_amount_decimal!",
10350 "price_data.recurring.interval!",
10351 "price_data.recurring.interval_count",
10352 "price_data.tax_behavior",
10353 "price_data.unit_amount",
10354 "quantity",
10355 "tax_rates",
10356 ],
10357 type => "hash",
10358 },
10359 metadata => { type => "hash" },
10360 on_behalf_of => { re => qr/^\w+$/, type => "string" },
10361 subscription_data => { fields => ["effective_date", "trial_period_days"], type => "hash" },
10362 test_clock => { re => qr/^\w+$/, type => "string" },
10363 transfer_data => {
10364 fields => ["destination!", "amount", "amount_percent"],
10365 type => "hash",
10366 },
10367 };
10368  
10369 $args = $self->_contract( 'quote', $args ) || CORE::return( $self->pass_error );
10370 my $err = $self->_check_parameters( $okParams, $args );
10371 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
10372 my $hash = $self->post( 'quotes', $args ) || CORE::return( $self->pass_error );
10373 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::Quote', $hash ) );
10374 }
10375 PERL
10376 # NOTE: quote_download()
10377 quote_download => <<'PERL',
10378 sub quote_download
10379 {
10380 my $self = shift( @_ );
10381 CORE::return( $self->error( "No parameters were provided to download quote as pdf." ) ) if( !scalar( @_ ) );
10382 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Billing::Quote', @_ );
10383 my $okParams =
10384 {
10385 expandable => { allowed => $EXPANDABLES->{quote} },
10386 id => { re => qr/^\w+$/, required => 1 }
10387 };
10388 my $err = $self->_check_parameters( $okParams, $args );
10389 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
10390 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No quote id was provided to download it as pdf." ) );
10391 $args->{_file_api} = 1;
10392 my $hash = $self->get( "quotes/${id}/pdf", $args ) || CORE::return( $self->pass_error );
10393 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::Quote', $hash ) );
10394 }
10395 PERL
10396 # NOTE: quote_finalize()
10397 quote_finalize => <<'PERL',
10398 sub quote_finalize
10399 {
10400 my $self = shift( @_ );
10401 CORE::return( $self->error( "No parameters were provided to finalize a quote." ) ) if( !scalar( @_ ) );
10402 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Billing::Quote', @_ );
10403 my $okParams =
10404 {
10405 expandable => { allowed => $EXPANDABLES->{quote} },
10406 id => { re => qr/^\w+$/, required => 1 },
10407 expires_at => { type => 'datetime' },
10408 };
10409 my $err = $self->_check_parameters( $okParams, $args );
10410 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
10411 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No quote id was provided to finalize it." ) );
10412 my $hash = $self->post( "quotes/${id}/finalize", $args ) || CORE::return( $self->pass_error );
10413 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::Quote', $hash ) );
10414 }
10415 PERL
10416 # NOTE: quote_line_items()
10417 quote_line_items => <<'PERL',
10418 sub quote_line_items
10419 {
10420 my $self = shift( @_ );
10421 CORE::return( $self->error( "No parameters were provided to line_items quote information." ) ) if( !scalar( @_ ) );
10422 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Billing::Quote', @_ );
10423 my $okParams =
10424 {
10425 expandable => { allowed => $EXPANDABLES->{ 'quote' }, data_prefix_is_ok => 1 },
10426 ending_before => { type => "string" },
10427 limit => { type => "string" },
10428 starting_after => { type => "string" },
10429 };
10430 my $err = $self->_check_parameters( $okParams, $args );
10431 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
10432 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No quote id (with parameter 'id') was provided to line_items its information." ) );
10433 my $hash = $self->get( "quotes/${id}/line_items", $args ) || CORE::return( $self->pass_error );
10434 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::Quote', $hash ) );
10435 }
10436 PERL
10437 # NOTE: quote_lines()
10438 quote_lines => <<'PERL',
10439 sub quote_lines
10440 {
10441 my $self = shift( @_ );
10442 CORE::return( $self->error( "No parameters were provided to retrieve a quote line items." ) ) if( !scalar( @_ ) );
10443 my $args = $self->_get_args_as_hash( @_ );
10444 if( $self->_is_object( $args->{quote} ) && $args->{quote}->isa( 'Net::API::Stripe::Billing::Quote' ) )
10445 {
10446 $args->{id} = $args->{quote}->id;
10447 }
10448 my $okParams =
10449 {
10450 expandable => { allowed => $EXPANDABLES->{quote} },
10451 id => { re => qr/^\w+$/, required => 1 },
10452 ending_before => {},
10453 limit => { re => qr/^\d+$/ },
10454 starting_after => {},
10455 };
10456 my $err = $self->_check_parameters( $okParams, $args );
10457 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
10458 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No quote id was provided to retrieve its line items." ) );
10459 my $hash = $self->get( "quotes/${id}/line_items", $args ) || CORE::return( $self->pass_error );
10460 CORE::return( $self->_response_to_object( 'Net::API::Stripe::List', $hash ) );
10461 }
10462 PERL
10463 # NOTE: quote_list()
10464 quote_list => <<'PERL',
10465 sub quote_list
10466 {
10467 my $self = shift( @_ );
10468 my $args = $self->_get_args( @_ );
10469 if( $self->_is_object( $args->{customer} ) && $args->{customer}->isa( 'Net::API::Stripe::Customer' ) )
10470 {
10471 $args->{customer} = $args->{customer}->id;
10472 }
10473 my $okParams =
10474 {
10475 expandable => { allowed => $EXPANDABLES->{quote}, data_prefix_is_ok => 1 },
10476 customer => { re => qr/^\w+$/, type => "string" },
10477 ending_before => { type => "string" },
10478 limit => { re => qr/^\d+$/, type => "string" },
10479 starting_after => { type => "string" },
10480 status => { type => "string" },
10481 test_clock => { type => "string" },
10482 };
10483  
10484 my $err = $self->_check_parameters( $okParams, $args );
10485 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
10486 if( $args->{expand} )
10487 {
10488 $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
10489 }
10490 my $hash = $self->get( 'quotes', $args ) || CORE::return( $self->pass_error );
10491 CORE::return( $self->_response_to_object( 'Net::API::Stripe::List', $hash ) );
10492 }
10493 PERL
10494 # NOTE: quote_retrieve()
10495 quote_retrieve => <<'PERL',
10496 sub quote_retrieve
10497 {
10498 my $self = shift( @_ );
10499 CORE::return( $self->error( "No parameters were provided to retrieve quote information." ) ) if( !scalar( @_ ) );
10500 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Billing::Quote', @_ );
10501 my $okParams =
10502 {
10503 expandable => { allowed => $EXPANDABLES->{quote} },
10504 id => { re => qr/^\w+$/, required => 1 }
10505 };
10506 my $err = $self->_check_parameters( $okParams, $args );
10507 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
10508 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No quote id was provided to retrieve its information." ) );
10509 my $hash = $self->get( "quotes/${id}", $args ) || CORE::return( $self->pass_error );
10510 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::Quote', $hash ) );
10511 }
10512 PERL
10513 # NOTE: quote_update()
10514 quote_update => <<'PERL',
10515 # https://stripe.com/docs/api/quotes/update
10516 sub quote_update
10517 {
10518 my $self = shift( @_ );
10519 CORE::return( $self->error( "No parameters were provided to update a quote" ) ) if( !scalar( @_ ) );
10520 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Billing::Quote', @_ );
10521 if( $self->_is_object( $args->{customer} ) && $args->{customer}->isa( 'Net::API::Stripe::Customer' ) )
10522 {
10523 $args->{customer} = $args->{customer}->id;
10524 }
10525 my $okParams =
10526 {
10527 expandable => { allowed => $EXPANDABLES->{quote} },
10528 application_fee_amount => { type => "integer" },
10529 application_fee_percent => { type => "decomal" },
10530 automatic_tax => { fields => ["enabled!"], type => "hash" },
10531 collection_method => { type => "string" },
10532 customer => { re => qr/^\w+$/, type => "string" },
10533 default_tax_rates => { type => "array" },
10534 description => { type => "string" },
10535 discounts => { fields => ["coupon", "discount"], type => "array" },
10536 expires_at => { type => "datetime" },
10537 footer => { type => "string" },
10538 from_quote => { fields => ["qoute!", "is_revision"] },
10539 header => { type => "string" },
10540 id => { required => 1 },
10541 invoice_settings => { fields => ["days_until_due"], type => "hash" },
10542 line_items => {
10543 fields => [
10544 "id",
10545 "price",
10546 "price_data",
10547 "price_data.currency!",
10548 "price_data.product!",
10549 "price_data.unit_amount_decimal!",
10550 "price_data.recurring.interval!",
10551 "price_data.recurring.interval_count",
10552 "price_data.tax_behavior",
10553 "price_data.unit_amount",
10554 "quantity",
10555 "tax_rates",
10556 ],
10557 type => "hash",
10558 },
10559 metadata => { type => "hash" },
10560 on_behalf_of => { re => qr/^\w+$/, type => "string" },
10561 subscription_data => { fields => ["effective_date", "trial_period_days"], type => "hash" },
10562 test_clock => { re => qr/^\w+$/ },
10563 transfer_data => {
10564 fields => ["destination!", "amount", "amount_percent"],
10565 type => "hash",
10566 },
10567 };
10568  
10569 $args = $self->_contract( 'quote', $args ) || CORE::return( $self->pass_error );
10570 # We found some errors
10571 my $err = $self->_check_parameters( $okParams, $args );
10572 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
10573 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No quote id was provided to update quote's details" ) );
10574 my $hash = $self->post( "quotes/${id}", $args ) || CORE::return( $self->pass_error );
10575 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::Quote', $hash ) );
10576 }
10577 PERL
10578 # NOTE: quote_upfront_line_items()
10579 quote_upfront_line_items => <<'PERL',
10580 sub quote_upfront_line_items
10581 {
10582 my $self = shift( @_ );
10583 CORE::return( $self->error( "No parameters were provided to upfront_line_items quote information." ) ) if( !scalar( @_ ) );
10584 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Billing::Quote', @_ );
10585 my $okParams =
10586 {
10587 expandable => { allowed => $EXPANDABLES->{ 'quote' }, data_prefix_is_ok => 1 },
10588 ending_before => { type => "string" },
10589 limit => { type => "string" },
10590 starting_after => { type => "string" },
10591 };
10592 my $err = $self->_check_parameters( $okParams, $args );
10593 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
10594 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No quote id (with parameter 'id') was provided to upfront_line_items its information." ) );
10595 my $hash = $self->get( "quotes/${id}", $args ) || CORE::return( $self->pass_error );
10596 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::Quote', $hash ) );
10597 }
10598 PERL
10599 # NOTE: quote_upfront_lines()
10600 quote_upfront_lines => <<'PERL',
10601 sub quote_upfront_lines
10602 {
10603 my $self = shift( @_ );
10604 CORE::return( $self->error( "No parameters were provided to retrieve a quote upfront line items." ) ) if( !scalar( @_ ) );
10605 my $args = $self->_get_args_as_hash( @_ );
10606 if( $self->_is_object( $args->{quote} ) && $args->{quote}->isa( 'Net::API::Stripe::Billing::Quote' ) )
10607 {
10608 $args->{id} = $args->{quote}->id;
10609 }
10610 my $okParams =
10611 {
10612 expandable => { allowed => $EXPANDABLES->{quote} },
10613 id => { re => qr/^\w+$/, required => 1 },
10614 ending_before => {},
10615 limit => { re => qr/^\d+$/ },
10616 starting_after => {},
10617 };
10618 my $err = $self->_check_parameters( $okParams, $args );
10619 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
10620 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No quote id was provided to retrieve its upfront line items." ) );
10621 my $hash = $self->get( "quotes/${id}/computed_upfront_line_items", $args ) || CORE::return( $self->pass_error );
10622 CORE::return( $self->_response_to_object( 'Net::API::Stripe::List', $hash ) );
10623 }
10624 PERL
10625 # NOTE: quotes()
10626 quotes => <<'PERL',
10627 # <https://stripe.com/docs/api/quotes>
10628 sub quotes
10629 {
10630 my $self = shift( @_ );
10631 my $allowed = [qw( accept cancel create download finalize line_items lines list retrieve update upfront_line_items upfront_lines )];
10632 my $action = shift( @_ );
10633 my $meth = $self->_get_method( 'quote', $action, $allowed ) || CORE::return( $self->pass_error );
10634 CORE::return( $self->$meth( @_ ) );
10635 }
10636 PERL
10637 # NOTE: radar_early_fraud_warning()
10638 radar_early_fraud_warning => <<'PERL',
10639 sub radar_early_fraud_warning { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Fraud', @_ ) ); }
10640 PERL
10641 # NOTE: radar_early_fraud_warning_list()
10642 radar_early_fraud_warning_list => <<'PERL',
10643 sub radar_early_fraud_warning_list
10644 {
10645 my $self = shift( @_ );
10646 CORE::return( $self->error( "No parameters were provided to list radar early fraud warning information." ) ) if( !scalar( @_ ) );
10647 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Fraud', @_ );
10648 my $okParams =
10649 {
10650 expandable => { allowed => $EXPANDABLES->{ 'radar.early_fraud_warning' }, data_prefix_is_ok => 1 },
10651 charge => { type => "string" },
10652 ending_before => { type => "string" },
10653 limit => { type => "string" },
10654 payment_intent => { type => "string" },
10655 starting_after => { type => "string" },
10656 };
10657 my $err = $self->_check_parameters( $okParams, $args );
10658 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
10659 if( $args->{expand} )
10660 {
10661 $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
10662 }
10663 my $hash = $self->get( "", $args ) || CORE::return( $self->pass_error );
10664 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Fraud', $hash ) );
10665 }
10666 PERL
10667 # NOTE: radar_early_fraud_warning_retrieve()
10668 radar_early_fraud_warning_retrieve => <<'PERL',
10669 sub radar_early_fraud_warning_retrieve
10670 {
10671 my $self = shift( @_ );
10672 my $args = shift( @_ );
10673 my $okParams =
10674 {
10675 expandable => { allowed => $EXPANDABLES->{ 'radar.early_fraud_warning' }, data_prefix_is_ok => 1 },
10676 };
10677 $args = $self->_contract( 'radar.early_fraud_warning', $args ) || CORE::return( $self->pass_error );
10678 my $err = $self->_check_parameters( $okParams, $args );
10679 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
10680 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." ) );
10681 my $hash = $self->get( "radar/early_fraud_warnings/${id}", $args ) || CORE::return( $self->pass_error );
10682 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Fraud', $hash ) );
10683 }
10684 PERL
10685 # NOTE: radar_early_fraud_warnings()
10686 radar_early_fraud_warnings => <<'PERL',
10687 # <https://stripe.com/docs/api/radar/early_fraud_warnings>
10688 sub radar_early_fraud_warnings
10689 {
10690 my $self = shift( @_ );
10691 my $allowed = [qw( list retrieve )];
10692 my $action = shift( @_ );
10693 my $meth = $self->_get_method( 'radar_early_fraud_warning', $action, $allowed ) || CORE::return( $self->pass_error );
10694 CORE::return( $self->$meth( @_ ) );
10695 }
10696 PERL
10697 # NOTE: radar_value_list()
10698 radar_value_list => <<'PERL',
10699 sub radar_value_list { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Fraud::ValueList', @_ ) ); }
10700 PERL
10701 # NOTE: radar_value_list_create()
10702 radar_value_list_create => <<'PERL',
10703 sub radar_value_list_create
10704 {
10705 my $self = shift( @_ );
10706 my $args = shift( @_ );
10707 my $okParams =
10708 {
10709 expandable => { allowed => $EXPANDABLES->{ 'radar.value_list' } },
10710 alias => { type => "string", required => 1 },
10711 item_type => { type => "string" },
10712 metadata => { type => "hash" },
10713 name => { type => "string", required => 1 },
10714 };
10715 $args = $self->_contract( 'radar.value_list', $args ) || CORE::return( $self->pass_error );
10716 my $err = $self->_check_parameters( $okParams, $args );
10717 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
10718 my $hash = $self->post( "", $args ) || CORE::return( $self->pass_error );
10719 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Fraud::ValueList', $hash ) );
10720 }
10721 PERL
10722 # NOTE: radar_value_list_delete()
10723 radar_value_list_delete => <<'PERL',
10724 sub radar_value_list_delete
10725 {
10726 my $self = shift( @_ );
10727 my $args = shift( @_ );
10728 my $okParams =
10729 {
10730 expandable => { allowed => $EXPANDABLES->{ 'radar.value_list' } },
10731 };
10732 $args = $self->_contract( 'radar.value_list', $args ) || CORE::return( $self->pass_error );
10733 my $err = $self->_check_parameters( $okParams, $args );
10734 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
10735 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No radar.value_list id (with parameter 'id') was provided to delete its information." ) );
10736 my $hash = $self->delete( "radar/value_lists/${id}", $args ) || CORE::return( $self->pass_error );
10737 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Fraud::ValueList', $hash ) );
10738 }
10739 PERL
10740 # NOTE: radar_value_list_item()
10741 radar_value_list_item => <<'PERL',
10742 sub radar_value_list_item { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Fraud::ValueList::Item', @_ ) ); }
10743 PERL
10744 # NOTE: radar_value_list_item_create()
10745 radar_value_list_item_create => <<'PERL',
10746 sub radar_value_list_item_create
10747 {
10748 my $self = shift( @_ );
10749 my $args = shift( @_ );
10750 my $okParams =
10751 {
10752 expandable => { allowed => $EXPANDABLES->{ 'radar.value_list_item' } },
10753 value => { type => "string", required => 1 },
10754 value_list => { type => "string", required => 1 },
10755 };
10756 $args = $self->_contract( 'radar.value_list_item', $args ) || CORE::return( $self->pass_error );
10757 my $err = $self->_check_parameters( $okParams, $args );
10758 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
10759 my $hash = $self->post( "", $args ) || CORE::return( $self->pass_error );
10760 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Fraud::ValueList::Item', $hash ) );
10761 }
10762 PERL
10763 # NOTE: radar_value_list_item_delete()
10764 radar_value_list_item_delete => <<'PERL',
10765 sub radar_value_list_item_delete
10766 {
10767 my $self = shift( @_ );
10768 my $args = shift( @_ );
10769 my $okParams =
10770 {
10771 expandable => { allowed => $EXPANDABLES->{ 'radar.value_list_item' } },
10772 };
10773 $args = $self->_contract( 'radar.value_list_item', $args ) || CORE::return( $self->pass_error );
10774 my $err = $self->_check_parameters( $okParams, $args );
10775 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
10776 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." ) );
10777 my $hash = $self->delete( "radar/value_list_items/${id}", $args ) || CORE::return( $self->pass_error );
10778 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Fraud::ValueList::Item', $hash ) );
10779 }
10780 PERL
10781 # NOTE: radar_value_list_item_list()
10782 radar_value_list_item_list => <<'PERL',
10783 sub radar_value_list_item_list
10784 {
10785 my $self = shift( @_ );
10786 CORE::return( $self->error( "No parameters were provided to list radar value list item information." ) ) if( !scalar( @_ ) );
10787 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Fraud::ValueList::Item', @_ );
10788 my $okParams =
10789 {
10790 expandable => { allowed => $EXPANDABLES->{ 'radar.value_list_item' }, data_prefix_is_ok => 1 },
10791 created => { type => "timestamp" },
10792 ending_before => { type => "string" },
10793 limit => { type => "string" },
10794 starting_after => { type => "string" },
10795 value => { type => "string" },
10796 value_list => { type => "string", required => 1 },
10797 };
10798 my $err = $self->_check_parameters( $okParams, $args );
10799 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
10800 if( $args->{expand} )
10801 {
10802 $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
10803 }
10804 my $hash = $self->get( "", $args ) || CORE::return( $self->pass_error );
10805 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Fraud::ValueList::Item', $hash ) );
10806 }
10807 PERL
10808 # NOTE: radar_value_list_item_retrieve()
10809 radar_value_list_item_retrieve => <<'PERL',
10810 sub radar_value_list_item_retrieve
10811 {
10812 my $self = shift( @_ );
10813 my $args = shift( @_ );
10814 my $okParams =
10815 {
10816 expandable => { allowed => $EXPANDABLES->{ 'radar.value_list_item' }, data_prefix_is_ok => 1 },
10817 };
10818 $args = $self->_contract( 'radar.value_list_item', $args ) || CORE::return( $self->pass_error );
10819 my $err = $self->_check_parameters( $okParams, $args );
10820 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
10821 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." ) );
10822 my $hash = $self->get( "radar/value_list_items/${id}", $args ) || CORE::return( $self->pass_error );
10823 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Fraud::ValueList::Item', $hash ) );
10824 }
10825 PERL
10826 # NOTE: radar_value_list_items()
10827 radar_value_list_items => <<'PERL',
10828 # <https://stripe.com/docs/api/radar/value_list_items>
10829 sub radar_value_list_items
10830 {
10831 my $self = shift( @_ );
10832 my $allowed = [qw( create delete list retrieve )];
10833 my $action = shift( @_ );
10834 my $meth = $self->_get_method( 'radar_value_list_item', $action, $allowed ) || CORE::return( $self->pass_error );
10835 CORE::return( $self->$meth( @_ ) );
10836 }
10837 PERL
10838 # NOTE: radar_value_list_list()
10839 radar_value_list_list => <<'PERL',
10840 sub radar_value_list_list
10841 {
10842 my $self = shift( @_ );
10843 CORE::return( $self->error( "No parameters were provided to list radar value list information." ) ) if( !scalar( @_ ) );
10844 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Fraud::ValueList', @_ );
10845 my $okParams =
10846 {
10847 expandable => { allowed => $EXPANDABLES->{ 'radar.value_list' }, data_prefix_is_ok => 1 },
10848 alias => { type => "string" },
10849 contains => { type => "string" },
10850 created => { type => "timestamp" },
10851 ending_before => { type => "string" },
10852 limit => { type => "string" },
10853 starting_after => { type => "string" },
10854 };
10855 my $err = $self->_check_parameters( $okParams, $args );
10856 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
10857 if( $args->{expand} )
10858 {
10859 $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
10860 }
10861 my $hash = $self->get( "", $args ) || CORE::return( $self->pass_error );
10862 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Fraud::ValueList', $hash ) );
10863 }
10864 PERL
10865 # NOTE: radar_value_list_retrieve()
10866 radar_value_list_retrieve => <<'PERL',
10867 sub radar_value_list_retrieve
10868 {
10869 my $self = shift( @_ );
10870 my $args = shift( @_ );
10871 my $okParams =
10872 {
10873 expandable => { allowed => $EXPANDABLES->{ 'radar.value_list' }, data_prefix_is_ok => 1 },
10874 };
10875 $args = $self->_contract( 'radar.value_list', $args ) || CORE::return( $self->pass_error );
10876 my $err = $self->_check_parameters( $okParams, $args );
10877 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
10878 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No radar.value_list id (with parameter 'id') was provided to retrieve its information." ) );
10879 my $hash = $self->get( "radar/value_lists/${id}", $args ) || CORE::return( $self->pass_error );
10880 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Fraud::ValueList', $hash ) );
10881 }
10882 PERL
10883 # NOTE: radar_value_list_update()
10884 radar_value_list_update => <<'PERL',
10885 sub radar_value_list_update
10886 {
10887 my $self = shift( @_ );
10888 my $args = shift( @_ );
10889 my $okParams =
10890 {
10891 expandable => { allowed => $EXPANDABLES->{ 'radar.value_list' } },
10892 alias => { type => "string" },
10893 metadata => { type => "hash" },
10894 name => { type => "string" },
10895 };
10896 $args = $self->_contract( 'radar.value_list', $args ) || CORE::return( $self->pass_error );
10897 my $err = $self->_check_parameters( $okParams, $args );
10898 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
10899 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No radar.value_list id (with parameter 'id') was provided to update its information." ) );
10900 my $hash = $self->post( "radar/value_lists/${id}", $args ) || CORE::return( $self->pass_error );
10901 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Fraud::ValueList', $hash ) );
10902 }
10903 PERL
10904 # NOTE: radar_value_lists()
10905 radar_value_lists => <<'PERL',
10906 # <https://stripe.com/docs/api/radar/value_lists>
10907 sub radar_value_lists
10908 {
10909 my $self = shift( @_ );
10910 my $allowed = [qw( create delete list retrieve update )];
10911 my $action = shift( @_ );
10912 my $meth = $self->_get_method( 'radar_value_list', $action, $allowed ) || CORE::return( $self->pass_error );
10913 CORE::return( $self->$meth( @_ ) );
10914 }
10915 PERL
10916 # NOTE: reader()
10917 reader => <<'PERL',
10918 sub reader { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Terminal::Reader' ) ) }
10919 PERL
10920 # NOTE: receiver()
10921 receiver => <<'PERL',
10922 sub receiver { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Payment::Source::Receiver', @_ ) ); }
10923 PERL
10924 # NOTE: redirect()
10925 redirect => <<'PERL',
10926 sub redirect { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Payment::Source::Redirect', @_ ) ); }
10927 PERL
10928 # NOTE: refund()
10929 refund => <<'PERL',
10930 sub refund { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Refund', @_ ) ); }
10931 PERL
10932 # NOTE: refund_cancel()
10933 refund_cancel => <<'PERL',
10934 sub refund_cancel
10935 {
10936 my $self = shift( @_ );
10937 CORE::return( $self->error( "No parameters were provided to cancel a refund." ) ) if( !scalar( @_ ) );
10938 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Refund', @_ );
10939 my $okParams =
10940 {
10941 expandable => { allowed => $EXPANDABLES->{refund} },
10942 id => { re => qr/^\w+$/, required => 1 }
10943 };
10944 my $err = $self->_check_parameters( $okParams, $args );
10945 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
10946 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No refund id was provided to cancel." ) );
10947 my $hash = $self->post( "refunds/${id}/cancel", $args ) || CORE::return( $self->pass_error );
10948 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Refund', $hash ) );
10949 }
10950 PERL
10951 # NOTE: refund_create()
10952 refund_create => <<'PERL',
10953 sub refund_create
10954 {
10955 my $self = shift( @_ );
10956 CORE::return( $self->error( "No parameters were provided to create a payout" ) ) if( !scalar( @_ ) );
10957 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Refund', @_ );
10958 my $okParams =
10959 {
10960 expandable => { allowed => $EXPANDABLES->{refund} },
10961 amount => { required => 1, type => "integer" },
10962 charge => { re => qr/^\w+$/, type => "string" },
10963 metadata => { type => "hash" },
10964 payment_intent => { re => qr/^\w+$/, type => "string" },
10965 reason => {
10966 re => qr/^(duplicate|fraudulent|requested_by_customer)$/,
10967 type => "string",
10968 },
10969 refund_application_fee => { type => "boolean" },
10970 reverse_transfer => { type => "boolean" },
10971 };
10972  
10973 $args = $self->_contract( 'refund', $args ) || CORE::return( $self->pass_error );
10974 my $err = $self->_check_parameters( $okParams, $args );
10975 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
10976 my $hash = $self->post( 'refunds', $args ) || CORE::return( $self->pass_error );
10977 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Refund', $hash ) );
10978 }
10979 PERL
10980 # NOTE: refund_list()
10981 refund_list => <<'PERL',
10982 sub refund_list
10983 {
10984 my $self = shift( @_ );
10985 my $args = $self->_get_args( @_ );
10986 my $okParams =
10987 {
10988 expandable => { allowed => $EXPANDABLES->{refund}, data_prefix_is_ok => 1 },
10989 charge => { re => qr/^\w+$/, type => "string" },
10990 created => { re => qr/^\d+$/, type => "timestamp" },
10991 'created.gt' => { re => qr/^\d+$/ },
10992 'created.gte' => { re => qr/^\d+$/ },
10993 'created.lt' => { re => qr/^\d+$/ },
10994 'created.lte' => { re => qr/^\d+$/ },
10995 ending_before => { re => qr/^\w+$/, type => "string" },
10996 limit => { re => qr/^\d+$/, type => "string" },
10997 payment_intent => { re => qr/^\w+$/, type => "string" },
10998 starting_after => { re => qr/^\w+$/, type => "string" },
10999 };
11000  
11001 my $err = $self->_check_parameters( $okParams, $args );
11002 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
11003 if( $args->{expand} )
11004 {
11005 $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
11006 }
11007 my $hash = $self->get( 'refunds', $args ) || CORE::return( $self->pass_error );
11008 CORE::return( $self->_response_to_object( 'Net::API::Stripe::List', $hash ) );
11009 }
11010 PERL
11011 # NOTE: refund_retrieve()
11012 refund_retrieve => <<'PERL',
11013 sub refund_retrieve
11014 {
11015 my $self = shift( @_ );
11016 CORE::return( $self->error( "No parameters were provided to retrieve refund information." ) ) if( !scalar( @_ ) );
11017 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Refund', @_ );
11018 my $okParams =
11019 {
11020 expandable => { allowed => $EXPANDABLES->{refund} },
11021 id => { re => qr/^\w+$/, required => 1 }
11022 };
11023 my $err = $self->_check_parameters( $okParams, $args );
11024 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
11025 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No refund id was provided to retrieve its information." ) );
11026 my $hash = $self->get( "refunds/${id}", $args ) || CORE::return( $self->pass_error );
11027 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Refund', $hash ) );
11028 }
11029 PERL
11030 # NOTE: refund_update()
11031 refund_update => <<'PERL',
11032 sub refund_update
11033 {
11034 my $self = shift( @_ );
11035 CORE::return( $self->error( "No parameters were provided to update a refund" ) ) if( !scalar( @_ ) );
11036 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Refund', @_ );
11037 my $okParams =
11038 {
11039 expandable => { allowed => $EXPANDABLES->{refund} },
11040 id => { re => qr/^\w+$/, required => 1 },
11041 metadata => { type => 'hash' },
11042 };
11043 $args = $self->_contract( 'refund', $args ) || CORE::return( $self->pass_error );
11044 my $err = $self->_check_parameters( $okParams, $args );
11045 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
11046 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No refund id was provided to update its details" ) );
11047 my $hash = $self->post( "refunds/${id}", $args ) || CORE::return( $self->pass_error );
11048 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Refund', $hash ) );
11049 }
11050 PERL
11051 # NOTE: refunds()
11052 refunds => <<'PERL',
11053 sub refunds
11054 {
11055 my $self = shift( @_ );
11056 my $action = shift( @_ );
11057 my $allowed = [qw( create retrieve update cancel list )];
11058 my $meth = $self->_get_method( 'refund', $action, $allowed ) || CORE::return( $self->pass_error );
11059 CORE::return( $self->$meth( @_ ) );
11060 }
11061 PERL
11062 # NOTE: relationship()
11063 relationship => <<'PERL',
11064 sub relationship { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Connect::Account::Relationship', @_ ) ); }
11065 PERL
11066 # NOTE: reporting_report_run()
11067 reporting_report_run => <<'PERL',
11068 sub reporting_report_run { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Reporting::ReportRun', @_ ) ); }
11069 PERL
11070 # NOTE: reporting_report_run_create()
11071 reporting_report_run_create => <<'PERL',
11072 sub reporting_report_run_create
11073 {
11074 my $self = shift( @_ );
11075 my $args = shift( @_ );
11076 my $okParams =
11077 {
11078 expandable => { allowed => $EXPANDABLES->{ 'reporting.report_run' } },
11079 parameters => { type => "hash" },
11080 report_type => { type => "string", required => 1 },
11081 };
11082 $args = $self->_contract( 'reporting.report_run', $args ) || CORE::return( $self->pass_error );
11083 my $err = $self->_check_parameters( $okParams, $args );
11084 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
11085 my $hash = $self->post( "", $args ) || CORE::return( $self->pass_error );
11086 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Reporting::ReportRun', $hash ) );
11087 }
11088 PERL
11089 # NOTE: reporting_report_run_list()
11090 reporting_report_run_list => <<'PERL',
11091 sub reporting_report_run_list
11092 {
11093 my $self = shift( @_ );
11094 CORE::return( $self->error( "No parameters were provided to list reporting report run information." ) ) if( !scalar( @_ ) );
11095 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Reporting::ReportRun', @_ );
11096 my $okParams =
11097 {
11098 expandable => { allowed => $EXPANDABLES->{ 'reporting.report_run' }, data_prefix_is_ok => 1 },
11099 created => { type => "timestamp" },
11100 ending_before => { type => "string" },
11101 limit => { type => "string" },
11102 starting_after => { type => "string" },
11103 };
11104 my $err = $self->_check_parameters( $okParams, $args );
11105 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
11106 if( $args->{expand} )
11107 {
11108 $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
11109 }
11110 my $hash = $self->get( "", $args ) || CORE::return( $self->pass_error );
11111 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Reporting::ReportRun', $hash ) );
11112 }
11113 PERL
11114 # NOTE: reporting_report_run_retrieve()
11115 reporting_report_run_retrieve => <<'PERL',
11116 sub reporting_report_run_retrieve
11117 {
11118 my $self = shift( @_ );
11119 my $args = shift( @_ );
11120 my $okParams =
11121 {
11122 expandable => { allowed => $EXPANDABLES->{ 'reporting.report_run' }, data_prefix_is_ok => 1 },
11123 };
11124 $args = $self->_contract( 'reporting.report_run', $args ) || CORE::return( $self->pass_error );
11125 my $err = $self->_check_parameters( $okParams, $args );
11126 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
11127 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No reporting.report_run id (with parameter 'id') was provided to retrieve its information." ) );
11128 my $hash = $self->get( "reporting/report_runs/${id}", $args ) || CORE::return( $self->pass_error );
11129 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Reporting::ReportRun', $hash ) );
11130 }
11131 PERL
11132 # NOTE: reporting_report_runs()
11133 reporting_report_runs => <<'PERL',
11134 # <https://stripe.com/docs/api/reporting/report_run>
11135 sub reporting_report_runs
11136 {
11137 my $self = shift( @_ );
11138 my $allowed = [qw( create list retrieve )];
11139 my $action = shift( @_ );
11140 my $meth = $self->_get_method( 'reporting_report_run', $action, $allowed ) || CORE::return( $self->pass_error );
11141 CORE::return( $self->$meth( @_ ) );
11142 }
11143 PERL
11144 # NOTE: reporting_report_type()
11145 reporting_report_type => <<'PERL',
11146 sub reporting_report_type { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Reporting::ReportType', @_ ) ); }
11147 PERL
11148 # NOTE: reporting_report_type_list()
11149 reporting_report_type_list => <<'PERL',
11150 sub reporting_report_type_list
11151 {
11152 my $self = shift( @_ );
11153 CORE::return( $self->error( "No parameters were provided to list reporting report type information." ) ) if( !scalar( @_ ) );
11154 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Reporting::ReportType', @_ );
11155 my $okParams =
11156 {
11157 expandable => { allowed => $EXPANDABLES->{ 'reporting.report_type' }, data_prefix_is_ok => 1 },
11158 };
11159 my $err = $self->_check_parameters( $okParams, $args );
11160 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
11161 if( $args->{expand} )
11162 {
11163 $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
11164 }
11165 my $hash = $self->get( "", $args ) || CORE::return( $self->pass_error );
11166 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Reporting::ReportType', $hash ) );
11167 }
11168 PERL
11169 # NOTE: reporting_report_type_retrieve()
11170 reporting_report_type_retrieve => <<'PERL',
11171 sub reporting_report_type_retrieve
11172 {
11173 my $self = shift( @_ );
11174 my $args = shift( @_ );
11175 my $okParams =
11176 {
11177 expandable => { allowed => $EXPANDABLES->{ 'reporting.report_type' }, data_prefix_is_ok => 1 },
11178 };
11179 $args = $self->_contract( 'reporting.report_type', $args ) || CORE::return( $self->pass_error );
11180 my $err = $self->_check_parameters( $okParams, $args );
11181 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
11182 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No reporting.report_type id (with parameter 'id') was provided to retrieve its information." ) );
11183 my $hash = $self->get( "reporting/report_types/${id}", $args ) || CORE::return( $self->pass_error );
11184 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Reporting::ReportType', $hash ) );
11185 }
11186 PERL
11187 # NOTE: reporting_report_types()
11188 reporting_report_types => <<'PERL',
11189 # <https://stripe.com/docs/api/reporting/report_type>
11190 sub reporting_report_types
11191 {
11192 my $self = shift( @_ );
11193 my $allowed = [qw( list retrieve )];
11194 my $action = shift( @_ );
11195 my $meth = $self->_get_method( 'reporting_report_type', $action, $allowed ) || CORE::return( $self->pass_error );
11196 CORE::return( $self->$meth( @_ ) );
11197 }
11198 PERL
11199 # NOTE: request()
11200 request => <<'PERL',
11201 sub request { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Event::Request', @_ ) ); }
11202 PERL
11203 # NOTE: requirements()
11204 requirements => <<'PERL',
11205 sub requirements { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Connect::Account::Requirements', @_ ) ); }
11206 PERL
11207 # NOTE: return()
11208 return => <<'PERL',
11209 sub return { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Order::Return' ) ) }
11210 PERL
11211 # NOTE: review()
11212 review => <<'PERL',
11213 sub review { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Fraud::Review', @_ ) ); }
11214 PERL
11215 # NOTE: review_approve()
11216 review_approve => <<'PERL',
11217 sub review_approve
11218 {
11219 my $self = shift( @_ );
11220 my $args = shift( @_ );
11221 my $okParams =
11222 {
11223 expandable => { allowed => $EXPANDABLES->{ 'review' } },
11224 };
11225 $args = $self->_contract( 'review', $args ) || CORE::return( $self->pass_error );
11226 my $err = $self->_check_parameters( $okParams, $args );
11227 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
11228 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No review id (with parameter 'id') was provided to approve its information." ) );
11229 my $hash = $self->post( "reviews/${id}", $args ) || CORE::return( $self->pass_error );
11230 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Fraud::Review', $hash ) );
11231 }
11232 PERL
11233 # NOTE: review_list()
11234 review_list => <<'PERL',
11235 sub review_list
11236 {
11237 my $self = shift( @_ );
11238 CORE::return( $self->error( "No parameters were provided to list review information." ) ) if( !scalar( @_ ) );
11239 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Fraud::Review', @_ );
11240 my $okParams =
11241 {
11242 expandable => { allowed => $EXPANDABLES->{ 'review' }, data_prefix_is_ok => 1 },
11243 created => { type => "timestamp" },
11244 ending_before => { type => "string" },
11245 limit => { type => "string" },
11246 starting_after => { type => "string" },
11247 };
11248 my $err = $self->_check_parameters( $okParams, $args );
11249 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
11250 if( $args->{expand} )
11251 {
11252 $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
11253 }
11254 my $hash = $self->get( "reviews", $args ) || CORE::return( $self->pass_error );
11255 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Fraud::Review', $hash ) );
11256 }
11257 PERL
11258 # NOTE: review_retrieve()
11259 review_retrieve => <<'PERL',
11260 sub review_retrieve
11261 {
11262 my $self = shift( @_ );
11263 my $args = shift( @_ );
11264 my $okParams =
11265 {
11266 expandable => { allowed => $EXPANDABLES->{ 'review' }, data_prefix_is_ok => 1 },
11267 };
11268 $args = $self->_contract( 'review', $args ) || CORE::return( $self->pass_error );
11269 my $err = $self->_check_parameters( $okParams, $args );
11270 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
11271 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No review id (with parameter 'id') was provided to retrieve its information." ) );
11272 my $hash = $self->get( "reviews/${id}", $args ) || CORE::return( $self->pass_error );
11273 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Fraud::Review', $hash ) );
11274 }
11275 PERL
11276 # NOTE: reviews()
11277 reviews => <<'PERL',
11278 # <https://stripe.com/docs/api/radar/reviews>
11279 sub reviews
11280 {
11281 my $self = shift( @_ );
11282 my $allowed = [qw( approve list retrieve )];
11283 my $action = shift( @_ );
11284 my $meth = $self->_get_method( 'review', $action, $allowed ) || CORE::return( $self->pass_error );
11285 CORE::return( $self->$meth( @_ ) );
11286 }
11287 PERL
11288 # NOTE: schedule()
11289 schedule => <<'PERL',
11290 sub schedule { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Billing::Subscription::Schedule', @_ ) ); }
11291 PERL
11292 # NOTE: schedule_cancel()
11293 schedule_cancel => <<'PERL',
11294 # https://stripe.com/docs/api/subscription_schedules/cancel?lang=curl
11295 # "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."
11296 sub schedule_cancel
11297 {
11298 my $self = shift( @_ );
11299 CORE::return( $self->error( "No parameters were provided to cancel subscription schedule information." ) ) if( !scalar( @_ ) );
11300 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Billing::Subscription::Schedule', @_ );
11301 my $okParams =
11302 {
11303 expandable => { allowed => $EXPANDABLES->{schedule} },
11304 id => { re => qr/^\w+$/, required => 1 },
11305 # "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."
11306 invoice_now => { type => 'boolean' },
11307 # "If the subscription schedule is active, indicates if the cancellation should be prorated. Defaults to true."
11308 prorate => { type => 'boolean' },
11309 };
11310 my $err = $self->_check_parameters( $okParams, $args );
11311 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
11312 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No subscription schedule id was provided to cancel." ) );
11313 my $hash = $self->post( "subscription_schedules/${id}/cancel", $args ) || CORE::return( $self->pass_error );
11314 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::Subscription::Schedule', $hash ) );
11315 }
11316 PERL
11317 # NOTE: schedule_create()
11318 schedule_create => <<'PERL',
11319 sub schedule_create
11320 {
11321 my $self = shift( @_ );
11322 CORE::return( $self->error( "No parameters were provided to create a subscription schedule" ) ) if( !scalar( @_ ) );
11323 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Billing::Subscription::Schedule', @_ );
11324 my $okParams =
11325 {
11326 expandable => { allowed => $EXPANDABLES->{schedule} },
11327 customer => {},
11328 default_settings => { fields => [qw( billing_thresholds.amount_gte billing_thresholds.reset_billing_cycle_anchor collection_method default_payment_method invoice_settings.days_until_due )] },
11329 end_behavior => { re => qr/^(release|cancel)$/ },
11330 from_subscription => {},
11331 metadata => {},
11332 phases => { type => 'array', fields => [qw(
11333 add_invoice_items.price
11334 add_invoice_items.price_data.currency!
11335 add_invoice_items.price_data.product!
11336 add_invoice_items.price_data.unit_amount_decimal
11337 add_invoice_items.price_data.unit_amount
11338 add_invoice_items.quantity
11339 add_invoice_items.tax_rates
11340
11341 application_fee_percent
11342  
11343 billing_cycle_anchor
11344
11345 billing_thresholds.amount_gte
11346 billing_thresholds.reset_billing_cycle_anchor
11347
11348 collection_method
11349
11350 coupon
11351
11352 default_payment_method
11353
11354 default_tax_rates
11355  
11356 end_date
11357
11358 invoice_settings.days_until_due
11359
11360 items!
11361 items.billing_thresholds.usage_gte!
11362 items.price
11363 items.price_data.currency!
11364 items.price_data.product!
11365 items.price_data.recurring!
11366 items.price_data.recurring.interval!
11367 items.price_data.recurring.interval_count
11368 items.price_data.unit_amount_decimal
11369 items.price_data.unit_amount
11370 items.quantity
11371 items.tax_rates
11372
11373 iterations
11374
11375 plans.plan
11376 plans.billing_thresholds.usage_gte
11377 plans.quantity
11378 plans.tax_rates
11379
11380 proration_behavior
11381
11382 tax_percent
11383
11384 transfer_data.destination!
11385 transfer_data.amount_percent
11386
11387 trial
11388 trial_end
11389 )]},
11390 start_date => { type => 'datetime' },
11391 };
11392
11393 my $obj = $args->{_object};
11394 if( $obj && !length( $args->{start_date} ) && $obj->current_phase->start_date )
11395 {
11396 $args->{start_date} = $obj->current_phase->start_date->epoch;
11397 }
11398 $args = $self->_contract( 'schedule', $args ) || CORE::return( $self->pass_error );
11399 my $err = $self->_check_parameters( $okParams, $args );
11400 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
11401 my $hash = $self->post( 'subscription_schedules', $args ) || CORE::return( $self->pass_error );
11402 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::Subscription::Schedule', $hash ) );
11403 }
11404 PERL
11405 # NOTE: schedule_list()
11406 schedule_list => <<'PERL',
11407 sub schedule_list
11408 {
11409 my $self = shift( @_ );
11410 my $args = shift( @_ );
11411 my $okParams =
11412 {
11413 expandable => { allowed => $EXPANDABLES->{schedule}, data_prefix_is_ok => 1 },
11414 'canceled_at' => { re => qr/^\d+$/ },
11415 'canceled_at.gt' => { re => qr/^\d+$/ },
11416 'canceled_at.gte' => { re => qr/^\d+$/ },
11417 'canceled_at.lt' => { re => qr/^\d+$/ },
11418 'canceled_at.lte' => { re => qr/^\d+$/ },
11419 'completed_at' => { re => qr/^\d+$/ },
11420 'completed_at.gt' => { re => qr/^\d+$/ },
11421 'completed_at.gte' => { re => qr/^\d+$/ },
11422 'completed_at.lt' => { re => qr/^\d+$/ },
11423 'completed_at.lte' => { re => qr/^\d+$/ },
11424 'created' => { re => qr/^\d+$/ },
11425 'created.gt' => { re => qr/^\d+$/ },
11426 'created.gte' => { re => qr/^\d+$/ },
11427 'created.lt' => { re => qr/^\d+$/ },
11428 'created.lte' => { re => qr/^\d+$/ },
11429 'customer' => {},
11430 # "A cursor for use in pagination. ending_before is an object ID that defines your place in the list."
11431 'ending_before' => {},
11432 'limit' => { re => qr/^\d+$/ },
11433 'released_at' => { re => qr/^\d+$/ },
11434 'released_at.gt' => { re => qr/^\d+$/ },
11435 'released_at.gte' => { re => qr/^\d+$/ },
11436 'released_at.lt' => { re => qr/^\d+$/ },
11437 'released_at.lte' => { re => qr/^\d+$/ },
11438 'scheduled' => { type => 'boolean' },
11439 'starting_after' => {},
11440 };
11441 my $err = $self->_check_parameters( $okParams, $args );
11442 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
11443 if( $args->{expand} )
11444 {
11445 $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
11446 }
11447 my $hash = $self->get( 'subscription_schedules', $args ) || CORE::return( $self->pass_error );
11448 CORE::return( $self->_response_to_object( 'Net::API::Stripe::List', $hash ) );
11449 }
11450 PERL
11451 # NOTE: schedule_query()
11452 schedule_query => <<'PERL',
11453 # sub session { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Session', @_ ) ); }
11454 sub schedule_query { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Sigma::ScheduledQueryRun' ) ) }
11455 PERL
11456 # NOTE: schedule_release()
11457 schedule_release => <<'PERL',
11458 # "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."
11459 # https://stripe.com/docs/api/subscription_schedules/release
11460 sub schedule_release
11461 {
11462 my $self = shift( @_ );
11463 CORE::return( $self->error( "No parameters were provided to retrieve subscription schedule information." ) ) if( !scalar( @_ ) );
11464 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Billing::Subscription::Schedule', @_ );
11465 my $okParams =
11466 {
11467 expandable => { allowed => $EXPANDABLES->{schedule} },
11468 id => { re => qr/^\w+$/, required => 1 },
11469 preserve_cancel_date => { type => 'boolean' },
11470 };
11471 my $err = $self->_check_parameters( $okParams, $args );
11472 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
11473 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No subscription schedule id was provided to retrieve its information." ) );
11474 my $hash = $self->post( "subscription_schedules/${id}/release", $args ) || CORE::return( $self->pass_error );
11475 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::Subscription::Schedule', $hash ) );
11476 }
11477 PERL
11478 # NOTE: schedule_retrieve()
11479 schedule_retrieve => <<'PERL',
11480 sub schedule_retrieve
11481 {
11482 my $self = shift( @_ );
11483 CORE::return( $self->error( "No parameters were provided to retrieve subscription schedule information." ) ) if( !scalar( @_ ) );
11484 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Billing::Subscription::Schedule', @_ );
11485 my $okParams =
11486 {
11487 expandable => { allowed => $EXPANDABLES->{schedule} },
11488 id => { re => qr/^\w+$/, required => 1 }
11489 };
11490 my $err = $self->_check_parameters( $okParams, $args );
11491 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
11492 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No subscription schedule id was provided to retrieve its information." ) );
11493 my $hash = $self->get( "subscription_schedules/${id}", $args ) || CORE::return( $self->pass_error );
11494 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::Subscription::Schedule', $hash ) );
11495 }
11496 PERL
11497 # NOTE: schedule_update()
11498 schedule_update => <<'PERL',
11499 # https://stripe.com/docs/api/customers/update?lang=curl
11500 sub schedule_update
11501 {
11502 my $self = shift( @_ );
11503 CORE::return( $self->error( "No parameters were provided to update a subscription schedule" ) ) if( !scalar( @_ ) );
11504 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Billing::Subscription::Schedule', @_ );
11505 my $okParams =
11506 {
11507 expandable => { allowed => $EXPANDABLES->{schedule} },
11508 id => { re => qr/^\w+$/, required => 1 },
11509 default_settings => { fields => [qw( billing_thresholds.amount_gte billing_thresholds.reset_billing_cycle_anchor collection_method default_payment_method invoice_settings.days_until_due )] },
11510 end_behavior => { re => qr/^(release|cancel)$/ },
11511 from_subscription => {},
11512 metadata => { type => 'hash' },
11513 phases => { type => 'array', fields => [qw(
11514 add_invoice_items.price
11515 add_invoice_items.price_data.currency!
11516 add_invoice_items.price_data.product!
11517 add_invoice_items.price_data.unit_amount_decimal
11518 add_invoice_items.price_data.unit_amount
11519 add_invoice_items.quantity
11520 add_invoice_items.tax_rates
11521
11522 application_fee_percent
11523
11524 billing_cycle_anchor
11525
11526 billing_thresholds.amount_gte
11527 billing_thresholds.reset_billing_cycle_anchor
11528
11529 collection_method
11530 coupon
11531  
11532 default_payment_method
11533 default_tax_rates
11534  
11535 end_date
11536
11537 invoice_settings.days_until_due
11538
11539 items!
11540 items.billing_thresholds
11541 items.billing_thresholds.usage_gte!
11542 items.price
11543 items.price_data.currency!
11544 items.price_data.product!
11545 items.price_data.recurring!
11546 items.price_data.recurring.interval!
11547 items.price_data.recurring.interval_count
11548 items.price_data.unit_amount_decimal
11549 items.price_data.unit_amount
11550 items.quantity
11551 items.tax_rates
11552
11553 iterations
11554
11555 plans.plan
11556 plans.billing_thresholds.usage_gte
11557 plans.quantity
11558 plans.tax_rates
11559
11560 proration_behavior
11561
11562 start_date
11563
11564 tax_percent
11565
11566 transfer_data.destination!
11567 transfer_data.amount_percent
11568
11569 trial
11570 trial_end
11571 )]},
11572 prorate => { type => 'boolean' },
11573 proration_behavior => { type => 'scalar' },
11574 start_date => { type => 'datetime' },
11575 };
11576 $args = $self->_contract( 'schedule', $args ) || CORE::return( $self->pass_error );
11577 # We found some errors
11578 my $err = $self->_check_parameters( $okParams, $args );
11579 # $self->message( 3, "Data to be posted: ", $self->dumper( $args ) ); exit;
11580 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
11581 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No subscription schedule id was provided to update subscription schedule's details" ) );
11582 my $hash = $self->post( "subscription_schedules/${id}", $args ) || CORE::return( $self->pass_error );
11583 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::Subscription::Schedule', $hash ) );
11584 }
11585 PERL
11586 # NOTE: scheduled_query_run()
11587 scheduled_query_run => <<'PERL',
11588 sub scheduled_query_run { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Sigma::ScheduledQueryRun', @_ ) ); }
11589 PERL
11590 # NOTE: scheduled_query_run_list()
11591 scheduled_query_run_list => <<'PERL',
11592 sub scheduled_query_run_list
11593 {
11594 my $self = shift( @_ );
11595 CORE::return( $self->error( "No parameters were provided to list scheduled query run information." ) ) if( !scalar( @_ ) );
11596 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Sigma::ScheduledQueryRun', @_ );
11597 my $okParams =
11598 {
11599 expandable => { allowed => $EXPANDABLES->{ 'scheduled_query_run' }, data_prefix_is_ok => 1 },
11600 ending_before => { type => "string" },
11601 limit => { type => "string" },
11602 starting_after => { type => "string" },
11603 };
11604 my $err = $self->_check_parameters( $okParams, $args );
11605 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
11606 if( $args->{expand} )
11607 {
11608 $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
11609 }
11610 my $hash = $self->get( "sigma/scheduled_query_runs", $args ) || CORE::return( $self->pass_error );
11611 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Sigma::ScheduledQueryRun', $hash ) );
11612 }
11613 PERL
11614 # NOTE: scheduled_query_run_retrieve()
11615 scheduled_query_run_retrieve => <<'PERL',
11616 sub scheduled_query_run_retrieve
11617 {
11618 my $self = shift( @_ );
11619 my $args = shift( @_ );
11620 my $okParams =
11621 {
11622 expandable => { allowed => $EXPANDABLES->{ 'scheduled_query_run' }, data_prefix_is_ok => 1 },
11623 };
11624 $args = $self->_contract( 'scheduled_query_run', $args ) || CORE::return( $self->pass_error );
11625 my $err = $self->_check_parameters( $okParams, $args );
11626 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
11627 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No scheduled_query_run id (with parameter 'id') was provided to retrieve its information." ) );
11628 my $hash = $self->get( "sigma/scheduled_query_runs/${id}", $args ) || CORE::return( $self->pass_error );
11629 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Sigma::ScheduledQueryRun', $hash ) );
11630 }
11631 PERL
11632 # NOTE: scheduled_query_runs()
11633 scheduled_query_runs => <<'PERL',
11634 # <https://stripe.com/docs/api/sigma/scheduled_queries>
11635 sub scheduled_query_runs
11636 {
11637 my $self = shift( @_ );
11638 my $allowed = [qw( list retrieve )];
11639 my $action = shift( @_ );
11640 my $meth = $self->_get_method( 'scheduled_query_run', $action, $allowed ) || CORE::return( $self->pass_error );
11641 CORE::return( $self->$meth( @_ ) );
11642 }
11643 PERL
11644 # NOTE: schedules()
11645 schedules => <<'PERL',
11646 sub schedules
11647 {
11648 my $self = shift( @_ );
11649 my $action = shift( @_ );
11650 my $allowed = [qw( create retrieve update list cancel release )];
11651 my $meth = $self->_get_method( 'schedule', $action, $allowed ) || CORE::return( $self->pass_error );
11652 CORE::return( $self->$meth( @_ ) );
11653 }
11654 PERL
11655 # NOTE: session()
11656 session => <<'PERL',
11657 sub session { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Checkout::Session', @_ ) ); }
11658 PERL
11659 # NOTE: session_create()
11660 session_create => <<'PERL',
11661 # https://stripe.com/docs/api/checkout/sessions/create
11662 # https://stripe.com/docs/payments/checkout/fulfillment#webhooks
11663 # See webhook event checkout.session.completed
11664 sub session_create
11665 {
11666 my $self = shift( @_ );
11667 CORE::return( $self->error( "No parameters were provided to create a checkout session" ) ) if( !scalar( @_ ) );
11668 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Checkout::Session', @_ );
11669 my $okParams =
11670 {
11671 expandable => { allowed => $EXPANDABLES->{session} },
11672 cancel_url => { required => 1 },
11673 payment_method_types => { required => 1, re => qr/^(card|ideal)$/ },
11674 success_url => { required => 1 },
11675 billing_address_collection => { re => qr/^(auto|required)$/ },
11676 client_reference_id => {},
11677 # ID of an existing customer, if one exists.
11678 customer => {},
11679 customer_email => {},
11680 # array of hash reference
11681 line_items => { type => 'array', fields => [qw( amount currency name quantity description images )] },
11682 locale => { re => qr/^(local|[a-z]{2})$/ },
11683 mode => { re => qr/^(setup|subscription)$/ },
11684 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 )] },
11685 setup_intent_data => { fields => [qw( description metadata on_behalf_of )] },
11686 submit_type => { re => qr/^(auto|book|donate|pay)$/ },
11687 subscription_data => { fields => [qw( items.plan items.quantity application_fee_percent metadata trial_end trial_from_plan trial_period_days )] },
11688 };
11689 $args = $self->_contract( 'session', $args ) || CORE::return( $self->pass_error );
11690 my $err = $self->_check_parameters( $okParams, $args );
11691 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
11692 my $hash = $self->post( 'checkout/sessions', $args ) || CORE::return( $self->pass_error );
11693 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Checkout::Session', $hash ) );
11694 }
11695 PERL
11696 # NOTE: session_expire()
11697 session_expire => <<'PERL',
11698 sub session_expire
11699 {
11700 my $self = shift( @_ );
11701 my $args = shift( @_ ) || CORE::return( $self->error( "No parameters were provided to expire a checkout session" ) );
11702 my $okParams =
11703 {
11704 expandable => { allowed => $EXPANDABLES->{session} },
11705 id => { re => qr/^\w+$/, required => 1 },
11706 };
11707 my $err = $self->_check_parameters( $okParams, $args );
11708 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
11709 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No tax id was provided to retrieve its details" ) );
11710 my $hash = $self->get( "checkout/sessions/${id}/expire", $args ) || CORE::return( $self->pass_error );
11711 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Checkout::Session', $hash ) );
11712 }
11713 PERL
11714 # NOTE: session_list()
11715 session_list => <<'PERL',
11716 sub session_list
11717 {
11718 my $self = shift( @_ );
11719 my $args = shift( @_ );
11720 my $okParams =
11721 {
11722 expandable => { allowed => $EXPANDABLES->{session}, data_prefix_is_ok => 1 },
11723 # "A cursor for use in pagination. ending_before is an object ID that defines your place in the list."
11724 'ending_before' => {},
11725 'limit' => { re => qr/^\d+$/ },
11726 'payment_intent' => { type => 'scalar' },
11727 'subscription' => { re => qr/^\w+$/ },
11728 'starting_after' => {},
11729 };
11730 my $err = $self->_check_parameters( $okParams, $args );
11731 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
11732 if( $args->{expand} )
11733 {
11734 $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
11735 }
11736 my $hash = $self->get( 'checkout/sessions', $args ) || CORE::return( $self->pass_error );
11737 CORE::return( $self->_response_to_object( 'Net::API::Stripe::List', $hash ) );
11738 }
11739 PERL
11740 # NOTE: session_retrieve()
11741 session_retrieve => <<'PERL',
11742 sub session_retrieve
11743 {
11744 my $self = shift( @_ );
11745 my $args = shift( @_ ) || CORE::return( $self->error( "No parameters were provided to retrieve a checkout session" ) );
11746 my $okParams =
11747 {
11748 expandable => { allowed => $EXPANDABLES->{session} },
11749 id => { re => qr/^\w+$/, required => 1 },
11750 };
11751 my $err = $self->_check_parameters( $okParams, $args );
11752 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
11753 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No checkout session id was provided to retrieve its details" ) );
11754 my $hash = $self->get( "checkout/sessions/${id}", $args ) || CORE::return( $self->pass_error );
11755 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Checkout::Session', $hash ) );
11756 }
11757 PERL
11758 # NOTE: session_retrieve_items()
11759 session_retrieve_items => <<'PERL',
11760 sub session_retrieve_items
11761 {
11762 my $self = shift( @_ );
11763 my $args = shift( @_ ) || CORE::return( $self->error( "No parameters were provided to retrieve a checkout session items" ) );
11764 my $okParams =
11765 {
11766 expandable => { allowed => $EXPANDABLES->{item} },
11767 id => { re => qr/^\w+$/, required => 1 },
11768 ending_before => {},
11769 limit => { re => qr/^\d+$/ },
11770 starting_after => {},
11771 };
11772 my $err = $self->_check_parameters( $okParams, $args );
11773 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
11774 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No checkout session id was provided to retrieve its items details" ) );
11775 my $hash = $self->get( "checkout/sessions/${id}/line_items", $args ) || CORE::return( $self->pass_error );
11776 CORE::return( $self->_response_to_object( 'Net::API::Stripe::List', $hash ) );
11777 }
11778 PERL
11779 # NOTE: sessions()
11780 sessions => <<'PERL',
11781 sub sessions
11782 {
11783 my $self = shift( @_ );
11784 my $action = shift( @_ );
11785 my $allowed = [qw( create expire retrieve list retrieve_items )];
11786 my $meth = $self->_get_method( 'session', $action, $allowed ) || CORE::return( $self->pass_error );
11787 CORE::return( $self->$meth( @_ ) );
11788 }
11789 PERL
11790 # NOTE: settings()
11791 settings => <<'PERL',
11792 sub settings { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Connect::Account::Settings', @_ ) ); }
11793 PERL
11794 # NOTE: setup_attempt()
11795 setup_attempt => <<'PERL',
11796 sub setup_attempt { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Payment::Intent::Attempt', @_ ) ); }
11797 PERL
11798 # NOTE: setup_attempt_list()
11799 setup_attempt_list => <<'PERL',
11800 sub setup_attempt_list
11801 {
11802 my $self = shift( @_ );
11803 my $args = $self->_get_args( @_ );
11804 my $okParams =
11805 {
11806 expandable => { allowed => $EXPANDABLES->{setup_attempt}, data_prefix_is_ok => 1 },
11807 active => { type => "boolean" },
11808 created => { re => qr/^\d+$/, type => "timestamp" },
11809 'created.gt' => { re => qr/^\d+$/ },
11810 'created.gte' => { re => qr/^\d+$/ },
11811 'created.lt' => { re => qr/^\d+$/ },
11812 'created.lte' => { re => qr/^\d+$/ },
11813 ending_before => { type => "string" },
11814 limit => { re => qr/^\d+$/, type => "string" },
11815 setup_intent => { re => qr/^\w+$/, required => 1, type => "string" },
11816 starting_after => { type => "string" },
11817 };
11818  
11819 my $err = $self->_check_parameters( $okParams, $args );
11820 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
11821 if( $args->{expand} )
11822 {
11823 $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
11824 }
11825 my $hash = $self->get( 'setup_attempts', $args ) || CORE::return( $self->pass_error );
11826 CORE::return( $self->_response_to_object( 'Net::API::Stripe::List', $hash ) );
11827 }
11828 PERL
11829 # NOTE: setup_attempts()
11830 setup_attempts => <<'PERL',
11831 sub setup_attempts
11832 {
11833 my $self = shift( @_ );
11834 my $action = shift( @_ );
11835 my $allowed = [qw( list )];
11836 my $meth = $self->_get_method( 'setup_attempts', $action, $allowed ) || CORE::return( $self->pass_error );
11837 CORE::return( $self->$meth( @_ ) );
11838 }
11839 PERL
11840 # NOTE: setup_intent()
11841 setup_intent => <<'PERL',
11842 sub setup_intent { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Payment::Intent::Attempt', @_ ) ); }
11843 PERL
11844 # NOTE: setup_intent_cancel()
11845 setup_intent_cancel => <<'PERL',
11846 sub setup_intent_cancel
11847 {
11848 my $self = shift( @_ );
11849 CORE::return( $self->error( "No parameters were provided to cancel the setup intent." ) ) if( !scalar( @_ ) );
11850 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Payment::Intent::Setup', @_ );
11851 my $okParams =
11852 {
11853 expandable => { allowed => $EXPANDABLES->{setup_intent} },
11854 cancellation_reason => {
11855 re => qr/^(?:abandoned|requested_by_customer|duplicate)$/,
11856 type => "string",
11857 },
11858 id => { re => qr/^\w+$/, required => 1 },
11859 };
11860  
11861 my $err = $self->_check_parameters( $okParams, $args );
11862 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
11863 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No setup intent id was provided to cancel." ) );
11864 my $hash = $self->post( "setup_intents/${id}/cancel", $args ) || CORE::return( $self->pass_error );
11865 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Payment::Intent::Setup', $hash ) );
11866 }
11867 PERL
11868 # NOTE: setup_intent_confirm()
11869 setup_intent_confirm => <<'PERL',
11870 sub setup_intent_confirm
11871 {
11872 my $self = shift( @_ );
11873 CORE::return( $self->error( "No parameters were provided to confirm the setup intent." ) ) if( !scalar( @_ ) );
11874 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Payment::Intent::Setup', @_ );
11875 my $okParams =
11876 {
11877 expandable => { allowed => $EXPANDABLES->{setup_intent} },
11878 id => { re => qr/^\w+$/, required => 1 },
11879 mandate_data => {
11880 fields => [
11881 "customer_acceptance.type",
11882 "customer_acceptance.accepted_at",
11883 "customer_acceptance.offline",
11884 "customer_acceptance.online.ip_address",
11885 "customer_acceptance.online.user_agent",
11886 ],
11887 type => "hash",
11888 },
11889 payment_method => { re => qr/^\w+$/, type => "string" },
11890 payment_method_data => { type => "object" },
11891 payment_method_options => {
11892 fields => [
11893 "acss_debit.currency",
11894 "acss_debit.mandate_options.custom_mandate_url",
11895 "acss_debit.mandate_options.default_for",
11896 "acss_debit.mandate_options.interval_description",
11897 "acss_debit.mandate_options.payment_schedule",
11898 "acss_debit.mandate_options.transaction_type",
11899 "acss_debit.verification_method",
11900 "card.request_three_d_secure",
11901 "sepa_debit.mandate_options",
11902 ],
11903 type => "hash",
11904 },
11905 return_url => { type => "string" },
11906 };
11907  
11908 my $err = $self->_check_parameters( $okParams, $args );
11909 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
11910 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No setup intent id was provided to confirm." ) );
11911 my $hash = $self->post( "setup_intents/${id}/confirm", $args ) || CORE::return( $self->pass_error );
11912 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Payment::Intent::Setup', $hash ) );
11913 }
11914 PERL
11915 # NOTE: setup_intent_create()
11916 setup_intent_create => <<'PERL',
11917 sub setup_intent_create
11918 {
11919 my $self = shift( @_ );
11920 CORE::return( $self->error( "No parameters were provided to create a the setup intent." ) ) if( !scalar( @_ ) );
11921 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Payment::Intent::Setup', @_ );
11922 my $okParams =
11923 {
11924 expandable => { allowed => $EXPANDABLES->{setup_intent} },
11925 attach_to_self => { type => "boolean" },
11926 confirm => { type => "boolean" },
11927 customer => { type => "string" },
11928 description => { type => "string" },
11929 flow_directions => { type => "array" },
11930 # id => { re => qr/^\w+$/, required => 1 },
11931 mandate_data => {
11932 fields => [
11933 "customer_acceptance.type",
11934 "customer_acceptance.accepted_at",
11935 "customer_acceptance.offline",
11936 "customer_acceptance.online.ip_address",
11937 "customer_acceptance.online.user_agent",
11938 ],
11939 type => "object",
11940 },
11941 metadata => { type => "hash" },
11942 on_behalf_of => { type => "string" },
11943 payment_method => { re => qr/^\w+$/, type => "string" },
11944 payment_method_data => { type => "object" },
11945 payment_method_options => {
11946 fields => [
11947 "acss_debit.currency",
11948 "acss_debit.mandate_options.custom_mandate_url",
11949 "acss_debit.mandate_options.default_for",
11950 "acss_debit.mandate_options.interval_description",
11951 "acss_debit.mandate_options.payment_schedule",
11952 "acss_debit.mandate_options.transaction_type",
11953 "acss_debit.verification_method",
11954 "card.request_three_d_secure",
11955 "sepa_debit.mandate_options",
11956 ],
11957 type => "hash",
11958 },
11959 payment_method_types => { type => "array" },
11960 return_url => { type => "string" },
11961 single_use => { fields => ["amount", "currency"], type => "object" },
11962 usage => { type => "string" },
11963 };
11964  
11965 $args = $self->_contract( 'setup_intent', $args ) || CORE::return( $self->pass_error );
11966 my $err = $self->_check_parameters( $okParams, $args );
11967 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
11968 my $hash = $self->post( 'setup_intents', $args ) || CORE::return( $self->pass_error );
11969 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Payment::Intent::Setup', $hash ) );
11970 }
11971 PERL
11972 # NOTE: setup_intent_list()
11973 setup_intent_list => <<'PERL',
11974 sub setup_intent_list
11975 {
11976 my $self = shift( @_ );
11977 my $args = $self->_get_args( @_ );
11978 my $okParams =
11979 {
11980 expandable => { allowed => $EXPANDABLES->{setup_intent}, data_prefix_is_ok => 1 },
11981 active => { type => "boolean" },
11982 attach_to_self => { type => "boolean" },
11983 created => { re => qr/^\d+$/, type => "timestamp" },
11984 'created.gt' => { re => qr/^\d+$/ },
11985 'created.gte' => { re => qr/^\d+$/ },
11986 'created.lt' => { re => qr/^\d+$/ },
11987 'created.lte' => { re => qr/^\d+$/ },
11988 customer => { re => qr/^\w+$/, type => "string" },
11989 ending_before => { type => "string" },
11990 limit => { re => qr/^\d+$/, type => "string" },
11991 payment_method => { type => "string" },
11992 starting_after => { type => "string" },
11993 };
11994  
11995 my $err = $self->_check_parameters( $okParams, $args );
11996 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
11997 if( $args->{expand} )
11998 {
11999 $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
12000 }
12001 my $hash = $self->get( 'setup_intents', $args ) || CORE::return( $self->pass_error );
12002 CORE::return( $self->_response_to_object( 'Net::API::Stripe::List', $hash ) );
12003 }
12004 PERL
12005 # NOTE: setup_intent_retrieve()
12006 setup_intent_retrieve => <<'PERL',
12007 sub setup_intent_retrieve
12008 {
12009 my $self = shift( @_ );
12010 CORE::return( $self->error( "No parameters were provided to retrieve setup intent information." ) ) if( !scalar( @_ ) );
12011 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Payment::Intent::Setup', @_ );
12012 my $okParams =
12013 {
12014 expandable => { allowed => $EXPANDABLES->{setup_intent}, data_prefix_is_ok => 1 },
12015 client_secret => { required => 1, type => "string" },
12016 id => { re => qr/^\w+$/, required => 1 },
12017 };
12018  
12019 my $err = $self->_check_parameters( $okParams, $args );
12020 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
12021 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No setup intent id was provided to retrieve its information." ) );
12022 my $hash = $self->get( "setup_intents/${id}", $args ) || CORE::return( $self->pass_error );
12023 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Payment::Intent::Setup', $hash ) );
12024 }
12025 PERL
12026 # NOTE: setup_intent_update()
12027 setup_intent_update => <<'PERL',
12028 sub setup_intent_update
12029 {
12030 my $self = shift( @_ );
12031 CORE::return( $self->error( "No parameters were provided to update the setup intent." ) ) if( !scalar( @_ ) );
12032 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Payment::Intent::Setup', @_ );
12033 my $okParams =
12034 {
12035 expandable => { allowed => $EXPANDABLES->{setup_intent} },
12036 attach_to_self => { type => "boolean" },
12037 customer => { type => "string" },
12038 description => { type => "string" },
12039 flow_directions => { type => "array" },
12040 id => { re => qr/^\w+$/, required => 1 },
12041 metadata => { type => "hash" },
12042 payment_method => { re => qr/^\w+$/, type => "string" },
12043 payment_method_data => { type => "object" },
12044 payment_method_options => {
12045 fields => [
12046 "acss_debit.currency",
12047 "acss_debit.mandate_options.custom_mandate_url",
12048 "acss_debit.mandate_options.default_for",
12049 "acss_debit.mandate_options.interval_description",
12050 "acss_debit.mandate_options.payment_schedule",
12051 "acss_debit.mandate_options.transaction_type",
12052 "acss_debit.verification_method",
12053 "card.request_three_d_secure",
12054 "sepa_debit.mandate_options",
12055 ],
12056 type => "hash",
12057 },
12058 payment_method_types => { type => "array" },
12059 };
12060  
12061 $args = $self->_contract( 'setup_intent', $args ) || CORE::return( $self->pass_error );
12062 # We found some errors
12063 my $err = $self->_check_parameters( $okParams, $args );
12064 # $self->message( 3, "Data to be posted: ", $self->dumper( $args ) ); exit;
12065 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
12066 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No setup intent id was provided to update its details" ) );
12067 my $hash = $self->post( "setup_intents/${id}", $args ) || CORE::return( $self->pass_error );
12068 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Payment::Intent::Setup', $hash ) );
12069 }
12070 PERL
12071 # NOTE: setup_intent_verify()
12072 setup_intent_verify => <<'PERL',
12073 sub setup_intent_verify
12074 {
12075 my $self = shift( @_ );
12076 CORE::return( $self->error( "No parameters were provided to verify microdeposits on the setup intent." ) ) if( !scalar( @_ ) );
12077 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Payment::Intent::Setup', @_ );
12078 my $okParams =
12079 {
12080 expandable => { allowed => $EXPANDABLES->{setup_intent} },
12081 id => { re => qr/^\w+$/, required => 1 },
12082 client_secret => {},
12083 amounts => { type => 'array', re => qr/^\d+$/ },
12084 descriptor_code => { re => qr/^.*?$/ },
12085 };
12086 my $err = $self->_check_parameters( $okParams, $args );
12087 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
12088 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No setup intent id was provided to verify microdeposits on it." ) );
12089 my $hash = $self->post( "setup_intents/${id}/verify_microdeposits", $args ) || CORE::return( $self->pass_error );
12090 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Payment::Intent::Setup', $hash ) );
12091 }
12092 PERL
12093 # NOTE: setup_intent_verify_microdeposits()
12094 setup_intent_verify_microdeposits => <<'PERL',
12095 sub setup_intent_verify_microdeposits
12096 {
12097 my $self = shift( @_ );
12098 CORE::return( $self->error( "No parameters were provided to verify_microdeposits setup intent information." ) ) if( !scalar( @_ ) );
12099 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Payment::Intent::Setup', @_ );
12100 my $okParams =
12101 {
12102 expandable => { allowed => $EXPANDABLES->{ 'setup_intent' } },
12103 amounts => { type => "array" },
12104 client_secret => { type => "string", required => 1 },
12105 descriptor_code => { type => "string" },
12106 };
12107 my $err = $self->_check_parameters( $okParams, $args );
12108 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
12109 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No setup_intent id (with parameter 'id') was provided to verify_microdeposits its information." ) );
12110 my $hash = $self->post( "setup_intents/${id}", $args ) || CORE::return( $self->pass_error );
12111 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Payment::Intent::Setup', $hash ) );
12112 }
12113 PERL
12114 # NOTE: setup_intents()
12115 setup_intents => <<'PERL',
12116 # <https://stripe.com/docs/api/setup_intents>
12117 sub setup_intents
12118 {
12119 my $self = shift( @_ );
12120 my $allowed = [qw( cancel confirm create list retrieve update verify verify_microdeposits )];
12121 my $action = shift( @_ );
12122 my $meth = $self->_get_method( 'setup_intent', $action, $allowed ) || CORE::return( $self->pass_error );
12123 CORE::return( $self->$meth( @_ ) );
12124 }
12125 PERL
12126 # NOTE: shipping()
12127 shipping => <<'PERL',
12128 # sub sigma { CORE::return( shift->_instantiate( 'sigma', 'Net::API::Stripe::Sigma' ) ) }
12129 sub shipping { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Shipping', @_ ) ); }
12130 PERL
12131 # NOTE: shipping_rate()
12132 shipping_rate => <<'PERL',
12133 sub shipping_rate { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Shipping::Rate', @_ ) ); }
12134 PERL
12135 # NOTE: shipping_rate_create()
12136 shipping_rate_create => <<'PERL',
12137 sub shipping_rate_create
12138 {
12139 my $self = shift( @_ );
12140 CORE::return( $self->error( "No parameters were provided to create a shipping rate" ) ) if( !scalar( @_ ) );
12141 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Shipping::Rate', @_ );
12142 my $okParams =
12143 {
12144 expandable => { allowed => $EXPANDABLES->{shipping_rate} },
12145 delivery_estimate => {
12146 fields => [
12147 "maximum.unit",
12148 "maximum.value",
12149 "minimum.unit",
12150 "minimum.value",
12151 ],
12152 type => "hash",
12153 },
12154 display_name => { re => qr/^.+$/, required => 1, type => "string" },
12155 fixed_amount => { fields => ["amount", "currency"], required => 1, type => "hash" },
12156 metadata => { type => "hash" },
12157 tax_behavior => { type => "string" },
12158 tax_code => { type => "string" },
12159 type => { re => qr/^\w+$/, required => 1, type => "string" },
12160 };
12161  
12162 $args = $self->_contract( 'shipping_rate', $args ) || CORE::return( $self->pass_error );
12163 my $err = $self->_check_parameters( $okParams, $args );
12164 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
12165 my $hash = $self->post( "shipping_rates", $args ) || CORE::return( $self->pass_error );
12166 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Shipping::Rate', $hash ) );
12167 }
12168 PERL
12169 # NOTE: shipping_rate_list()
12170 shipping_rate_list => <<'PERL',
12171 sub shipping_rate_list
12172 {
12173 my $self = shift( @_ );
12174 CORE::return( $self->error( "No parameters were provided to list shipping rates" ) ) if( !scalar( @_ ) );
12175 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Shipping::Rate', @_ );
12176 my $okParams =
12177 {
12178 expandable => { allowed => $EXPANDABLES->{shipping_rate}, data_prefix_is_ok => 1 },
12179 active => { type => "boolean" },
12180 created => { re => qr/^\d+$/, type => "timestamp" },
12181 'created.gt' => { re => qr/^\d+$/ },
12182 'created.gte' => { re => qr/^\d+$/ },
12183 'created.lt' => { re => qr/^\d+$/ },
12184 'created.lte' => { re => qr/^\d+$/ },
12185 currency => { re => qr/^[A-Z]+$/, type => "string" },
12186 ending_before => { re => qr/^\w+$/, type => "string" },
12187 id => { re => qr/^\w+$/, required => 1 },
12188 limit => { re => qr/^\d+$/, type => "string" },
12189 starting_after => { re => qr/^\w+$/, type => "string" },
12190 };
12191  
12192 my $err = $self->_check_parameters( $okParams, $args );
12193 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
12194 if( $args->{expand} )
12195 {
12196 $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
12197 }
12198 my $hash = $self->get( "shipping_rates", $args ) || CORE::return( $self->pass_error );
12199 CORE::return( $self->_response_to_object( 'Net::API::Stripe::List', $hash ) );
12200 }
12201 PERL
12202 # NOTE: shipping_rate_retrieve()
12203 shipping_rate_retrieve => <<'PERL',
12204 sub shipping_rate_retrieve
12205 {
12206 my $self = shift( @_ );
12207 CORE::return( $self->error( "No parameters were provided to retrieve a shipping rate" ) ) if( !scalar( @_ ) );
12208 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Shipping::Rate', @_ );
12209 my $okParams =
12210 {
12211 expandable => { allowed => $EXPANDABLES->{shipping_rate} },
12212 id => { re => qr/^\w+$/, required => 1 },
12213 };
12214 my $err = $self->_check_parameters( $okParams, $args );
12215 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
12216 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No shipping rate id was provided to retrieve its information" ) );
12217 my $hash = $self->get( "shipping_rates/${id}", $args ) || CORE::return( $self->pass_error );
12218 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Shipping::Rate', $hash ) );
12219 }
12220 PERL
12221 # NOTE: shipping_rate_update()
12222 shipping_rate_update => <<'PERL',
12223 sub shipping_rate_update
12224 {
12225 my $self = shift( @_ );
12226 CORE::return( $self->error( "No parameters were provided to update a shipping rate" ) ) if( !scalar( @_ ) );
12227 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Shipping::Rate', @_ );
12228 my $okParams =
12229 {
12230 expandable => { allowed => $EXPANDABLES->{shipping_rate} },
12231 active => { type => "boolean" },
12232 fixed_amount => { type => "hash" },
12233 id => { re => qr/^\w+$/, required => 1 },
12234 metadata => { type => "hash" },
12235 tax_behavior => { type => "string" },
12236 };
12237  
12238 $args = $self->_contract( 'shipping_rate', $args ) || CORE::return( $self->pass_error );
12239 # We found some errors
12240 my $err = $self->_check_parameters( $okParams, $args );
12241 # $self->message( 3, "Data to be posted: ", $self->dumper( $args ) ); exit;
12242 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
12243 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No shipping rate id was provided to update its details" ) );
12244 my $hash = $self->post( "shipping_rates/${id}", $args ) || CORE::return( $self->pass_error );
12245 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Shipping::Rate', $hash ) );
12246 }
12247 PERL
12248 # NOTE: shipping_rates()
12249 shipping_rates => <<'PERL',
12250 sub shipping_rates
12251 {
12252 my $self = shift( @_ );
12253 my $action = shift( @_ );
12254 my $allowed = [qw( create retrieve update list )];
12255 my $meth = $self->_get_method( 'shipping_rate', $action, $allowed ) || CORE::return( $self->pass_error );
12256 CORE::return( $self->$meth( @_ ) );
12257 }
12258 PERL
12259 # NOTE: sku()
12260 sku => <<'PERL',
12261 sub sku { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Order::SKU' ) ) }
12262 PERL
12263 # NOTE: source()
12264 source => <<'PERL',
12265 sub source { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Payment::Source', @_ ) ); }
12266 PERL
12267 # NOTE: source_attach()
12268 source_attach => <<'PERL',
12269 sub source_attach
12270 {
12271 my $self = shift( @_ );
12272 CORE::return( $self->error( "No parameters were provided to attach a source." ) ) if( !scalar( @_ ) );
12273 my $args;
12274 if( $self->_is_object( $_[0] ) )
12275 {
12276 if( $_[0]->isa( 'Net::API::Stripe::Customer' ) )
12277 {
12278 $args = $self->_get_args_from_object( 'Net::API::Stripe::Customer', @_ );
12279 }
12280 elsif( $_[0]->isa( 'Net::API::Stripe::Payment::Source' ) )
12281 {
12282 $args = $self->_get_args_from_object( 'Net::API::Stripe::Payment::Source', @_ );
12283 my $obj = $args->{_object};
12284 $args->{source} = $obj->id;
12285 $args->{id} = $obj->customer->id if( $obj->customer );
12286 }
12287 }
12288 else
12289 {
12290 $args = $self->_get_args( @_ );
12291 }
12292 my $okParams =
12293 {
12294 expandable => { allowed => $EXPANDABLES->{source} },
12295 id => { re => qr/^\w+$/, required => 1 },
12296 source => { re => qr/^\w+$/, required => 1, type => "string" },
12297 };
12298  
12299 $args = $self->_contract( 'source', $args ) || CORE::return( $self->pass_error );
12300 my $err = $self->_check_parameters( $okParams, $args );
12301 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
12302 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No customer id was provided to attach the source to." ) );
12303 my $hash = $self->post( "customers/${id}/sources", $args ) || CORE::return( $self->pass_error );
12304 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Payment::Source', $hash ) );
12305 }
12306 PERL
12307 # NOTE: source_create()
12308 source_create => <<'PERL',
12309 sub source_create
12310 {
12311 my $self = shift( @_ );
12312 CORE::return( $self->error( "No parameters were provided to create a source" ) ) if( !scalar( @_ ) );
12313 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Payment::Source', @_ );
12314 my $okParams =
12315 {
12316 expandable => { allowed => $EXPANDABLES->{source} },
12317 amount => { type => "integer" },
12318 currency => { type => "string" },
12319 flow => { type => "string" },
12320 mandate => {
12321 fields => [
12322 "acceptance",
12323 "acceptance.status",
12324 "acceptance.date",
12325 "acceptance.ip",
12326 "acceptance.offline.contact_email",
12327 "acceptance.online",
12328 "acceptance.type",
12329 "acceptance.user_agent",
12330 "amount",
12331 "currency",
12332 "interval",
12333 "notification_method",
12334 ],
12335 type => "object",
12336 },
12337 metadata => { type => "hash" },
12338 owner => {
12339 fields => [
12340 "address.city",
12341 "address.country",
12342 "address.line1",
12343 "address.line2",
12344 "address.postal_code",
12345 "address.state",
12346 "email",
12347 "name",
12348 "phone",
12349 ],
12350 type => "hash",
12351 },
12352 receiver => { fields => ["refund_attributes_method"], type => "hash" },
12353 redirect => { fields => ["return_url"], type => "hash" },
12354 source_order => {
12355 fields => [
12356 "items.amount",
12357 "items.currency",
12358 "items.description",
12359 "items.parent",
12360 "items.quantity",
12361 "items.type",
12362 "shipping.address.city",
12363 "shipping.address.country",
12364 "shipping.address.line1",
12365 "shipping.address.line2",
12366 "shipping.address.postal_code",
12367 "shipping.address.state",
12368 "shipping.carrier",
12369 "shipping.name",
12370 "shipping.phone",
12371 "shipping.tracking_number",
12372 ],
12373 type => "hash",
12374 },
12375 statement_descriptor => { type => "string" },
12376 token => { type => "string" },
12377 type => { required => 1, type => "string" },
12378 usage => { type => "string" },
12379 };
12380  
12381 $args = $self->_contract( 'source', $args ) || CORE::return( $self->pass_error );
12382 my $err = $self->_check_parameters( $okParams, $args );
12383 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
12384 my $hash = $self->post( 'sources', $args ) || CORE::return( $self->pass_error );
12385 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Payment::Source', $hash ) );
12386 }
12387 PERL
12388 # NOTE: source_detach()
12389 source_detach => <<'PERL',
12390 # https://stripe.com/docs/api/customers/delete?lang=curl
12391 # "Permanently deletes a customer. It cannot be undone. Also immediately cancels any active subscriptions on the customer."
12392 sub source_detach
12393 {
12394 my $self = shift( @_ );
12395 CORE::return( $self->error( "No parameters were provided to detach a source." ) ) if( !scalar( @_ ) );
12396 my $args;
12397 if( $self->_is_object( $_[0] ) )
12398 {
12399 if( $_[0]->isa( 'Net::API::Stripe::Customer' ) )
12400 {
12401 $args = $self->_get_args_from_object( 'Net::API::Stripe::Customer', @_ );
12402 }
12403 elsif( $_[0]->isa( 'Net::API::Stripe::Payment::Source' ) )
12404 {
12405 $args = $self->_get_args_from_object( 'Net::API::Stripe::Payment::Source', @_ );
12406 my $obj = $args->{_object};
12407 $args->{source} = $obj->id;
12408 $args->{id} = $obj->customer->id if( $obj->customer );
12409 }
12410 }
12411 else
12412 {
12413 $args = $self->_get_args( @_ );
12414 }
12415 my $okParams =
12416 {
12417 expandable => { allowed => $EXPANDABLES->{source} },
12418 id => { re => qr/^\w+$/, required => 1 },
12419 source => { re => qr/^\w+$/, required => 1 },
12420 };
12421 $args = $self->_contract( 'source', $args ) || CORE::return( $self->pass_error );
12422 my $err = $self->_check_parameters( $okParams, $args );
12423 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
12424 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No customer id was provided to detach the source from it." ) );
12425 my $src_id = CORE::delete( $args->{source} ) || CORE::return( $self->error( "No source id was provided to detach." ) );
12426 my $hash = $self->delete( "customers/${id}/sources/${src_id}", $args ) || CORE::return( $self->pass_error );
12427 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Payment::Source', $hash ) );
12428 }
12429 PERL
12430 # NOTE: source_order()
12431 source_order => <<'PERL',
12432 sub source_order { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Order', @_ ) ); }
12433 PERL
12434 # NOTE: source_retrieve()
12435 source_retrieve => <<'PERL',
12436 sub source_retrieve
12437 {
12438 my $self = shift( @_ );
12439 CORE::return( $self->error( "No parameters were provided to retrieve source information." ) ) if( !scalar( @_ ) );
12440 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Payment::Source', @_ );
12441 my $okParams =
12442 {
12443 expandable => { allowed => $EXPANDABLES->{source}, data_prefix_is_ok => 1 },
12444 client_secret => { type => "string" },
12445 id => { re => qr/^\w+$/, required => 1 },
12446 };
12447  
12448 $args = $self->_contract( 'source', $args ) || CORE::return( $self->pass_error );
12449 my $err = $self->_check_parameters( $okParams, $args );
12450 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
12451 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No source id was provided to retrieve its information." ) );
12452 my $hash = $self->get( "sources/${id}", $args ) || CORE::return( $self->pass_error );
12453 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Payment::Source', $hash ) );
12454 }
12455 PERL
12456 # NOTE: source_update()
12457 source_update => <<'PERL',
12458 # https://stripe.com/docs/api/sources/update?lang=curl
12459 sub source_update
12460 {
12461 my $self = shift( @_ );
12462 CORE::return( $self->error( "No parameters were provided to update a source" ) ) if( !scalar( @_ ) );
12463 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Payment::Source', @_ );
12464 my $okParams =
12465 {
12466 expandable => { allowed => $EXPANDABLES->{source} },
12467 amount => { type => "integer" },
12468 id => { re => qr/^\w+$/, required => 1 },
12469 mandate => {
12470 fields => [
12471 "acceptance",
12472 "acceptance.status",
12473 "acceptance.date",
12474 "acceptance.ip",
12475 "acceptance.offline.contact_email",
12476 "acceptance.online",
12477 "acceptance.type",
12478 "acceptance.user_agent",
12479 "amount",
12480 "currency",
12481 "interval",
12482 "notification_method",
12483 ],
12484 type => "object",
12485 },
12486 metadata => { type => "hash" },
12487 owner => {
12488 fields => [
12489 "address.city",
12490 "address.country",
12491 "address.line1",
12492 "address.line2",
12493 "address.postal_code",
12494 "address.state",
12495 "email",
12496 "name",
12497 "phone",
12498 ],
12499 type => "hash",
12500 },
12501 source_order => {
12502 fields => [
12503 "items.amount",
12504 "items.currency",
12505 "items.description",
12506 "items.parent",
12507 "items.quantity",
12508 "items.type",
12509 "shipping.address.city",
12510 "shipping.address.country",
12511 "shipping.address.line1",
12512 "shipping.address.line2",
12513 "shipping.address.postal_code",
12514 "shipping.address.state",
12515 "shipping.carrier",
12516 "shipping.name",
12517 "shipping.phone",
12518 "shipping.tracking_number",
12519 ],
12520 type => "hash",
12521 },
12522 };
12523  
12524 $args = $self->_contract( 'source', $args ) || CORE::return( $self->pass_error );
12525 # We found some errors
12526 my $err = $self->_check_parameters( $okParams, $args );
12527 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
12528 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No source id was provided to update source's details" ) );
12529 my $hash = $self->post( "sources/${id}", $args ) || CORE::return( $self->pass_error );
12530 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Payment::Source', $hash ) );
12531 }
12532 PERL
12533 # NOTE: sources()
12534 sources => <<'PERL',
12535 sub sources
12536 {
12537 my $self = shift( @_ );
12538 my $action = shift( @_ );
12539 my $allowed = [qw( create retrieve update detach attach )];
12540 my $meth = $self->_get_method( 'source', $action, $allowed ) || CORE::return( $self->pass_error );
12541 CORE::return( $self->$meth( @_ ) );
12542 }
12543 PERL
12544 # NOTE: status_transitions()
12545 status_transitions => <<'PERL',
12546 sub status_transitions { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Billing::Invoice::StatusTransition', @_ ) ); }
12547 PERL
12548 # NOTE: subscription()
12549 subscription => <<'PERL',
12550 sub subscription { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Billing::Subscription', @_ ) ); }
12551 PERL
12552 # NOTE: subscription_cancel()
12553 subscription_cancel => <<'PERL',
12554 # https://stripe.com/docs/api/customers/delete?lang=curl
12555 # "Permanently deletes a customer. It cannot be undone. Also immediately cancels any active subscriptions on the customer."
12556 sub subscription_cancel
12557 {
12558 my $self = shift( @_ );
12559 CORE::return( $self->error( "No parameters were provided to cancel subscription information." ) ) if( !scalar( @_ ) );
12560 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Billing::Subscription', @_ );
12561 my $okParams =
12562 {
12563 expandable => { allowed => $EXPANDABLES->{subscription} },
12564 id => { re => qr/^\w+$/, required => 1 }
12565 };
12566 my $err = $self->_check_parameters( $okParams, $args );
12567 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
12568 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No subscription id was provided to cancel." ) );
12569 my $hash = $self->delete( "subscriptions/${id}", $args ) || CORE::return( $self->pass_error );
12570 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::Subscription', $hash ) );
12571 }
12572 PERL
12573 # NOTE: subscription_create()
12574 subscription_create => <<'PERL',
12575 sub subscription_create
12576 {
12577 my $self = shift( @_ );
12578 CORE::return( $self->error( "No parameters were provided to create a subscription" ) ) if( !scalar( @_ ) );
12579 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Billing::Subscription', @_ );
12580 my $okParams =
12581 {
12582 expandable => { allowed => $EXPANDABLES->{subscription} },
12583 add_invoice_items => {
12584 fields => ["price", "price_data", "quantity", "tax_rates"],
12585 type => "array",
12586 },
12587 application_fee_percent => { re => qr/^[0-100]$/, type => "decimal" },
12588 automatic_tax => { fields => ["enabled!"], type => "hash" },
12589 backdate_start_date => { type => "datetime" },
12590 billing_cycle_anchor => { type => "datetime" },
12591 billing_thresholds => {
12592 fields => ["amount_gte", "reset_billing_cycle_anchor"],
12593 type => "hash",
12594 },
12595 cancel_at => { type => "datetime" },
12596 cancel_at_period_end => { type => "boolean" },
12597 collection_method => { re => qr/^(?:charge_automatically|send_invoice)$/, type => "string" },
12598 coupon => { type => "string" },
12599 currency => { type => "currency" },
12600 customer => { required => 1, type => "string" },
12601 days_until_due => { type => "integer" },
12602 default_payment_method => { type => "string" },
12603 default_source => { type => "string" },
12604 default_tax_rates => { type => "array" },
12605 description => { type => "string" },
12606 items => {
12607 fields => [
12608 "billing_thresholds.usage_gte",
12609 "metadata",
12610 "plan",
12611 "price",
12612 "price_data.currency!",
12613 "price_data.product!",
12614 "price_data.recurring!",
12615 "price_data.recurring.interval!",
12616 "price_data.recurring.interval_count",
12617 "price_data.tax_behavior",
12618 "price_data.unit_amount_decimal!",
12619 "price_data.unit_amount",
12620 "quantity",
12621 "tax_rates",
12622 ],
12623 required => 1,
12624 type => "array",
12625 },
12626 metadata => { type => "hash" },
12627 off_session => { type => "boolean" },
12628 payment_behavior => {
12629 re => qr/^(?:allow_incomplete|error_if_incomplete)$/,
12630 type => "string",
12631 },
12632 payment_settings => { class => "Net::API::Stripe::Payment::Settings", type => "object" },
12633 pending_invoice_item_interval => { fields => ["interval", "interval_count"], type => "hash" },
12634 promotion_code => { type => "string" },
12635 prorate => {},
12636 proration_behavior => {
12637 re => qr/^(billing_cycle_anchor|create_prorations|none)$/,
12638 type => "string",
12639 },
12640 tax_percent => { re => qr/^[0-100]$/ },
12641 transfer_data => { fields => ["desination", "amount_percent"], type => "hash" },
12642 trial_end => { re => qr/^(?:\d+|now)$/, type => "timestamp" },
12643 trial_from_plan => { type => "boolean" },
12644 trial_period_days => { type => "integer" },
12645 };
12646  
12647 $args = $self->_contract( 'subscription', $args ) || CORE::return( $self->pass_error );
12648 my $err = $self->_check_parameters( $okParams, $args );
12649 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
12650 my $hash = $self->post( 'subscriptions', $args ) || CORE::return( $self->pass_error );
12651 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::Subscription', $hash ) );
12652 }
12653 PERL
12654 # NOTE: subscription_delete()
12655 subscription_delete => <<'PERL',
12656 sub subscription_delete
12657 {
12658 my $self = shift( @_ );
12659 my $args = shift( @_ );
12660 my $okParams =
12661 {
12662 expandable => { allowed => $EXPANDABLES->{ 'subscription' } },
12663 invoice_now => { type => "boolean" },
12664 prorate => { type => "boolean" },
12665 };
12666 $args = $self->_contract( 'subscription', $args ) || CORE::return( $self->pass_error );
12667 my $err = $self->_check_parameters( $okParams, $args );
12668 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
12669 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No subscription id (with parameter 'id') was provided to delete its information." ) );
12670 my $hash = $self->delete( "subscriptions/${id}", $args ) || CORE::return( $self->pass_error );
12671 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::Subscription', $hash ) );
12672 }
12673 PERL
12674 # NOTE: subscription_delete_discount()
12675 subscription_delete_discount => <<'PERL',
12676 sub subscription_delete_discount
12677 {
12678 my $self = shift( @_ );
12679 CORE::return( $self->error( "No parameters were provided to delete subscription discount." ) ) if( !scalar( @_ ) );
12680 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Billing::Subscription', @_ );
12681 my $okParams =
12682 {
12683 expandable => { allowed => $EXPANDABLES->{discount} },
12684 id => { re => qr/^\w+$/, required => 1 }
12685 };
12686 my $err = $self->_check_parameters( $okParams, $args );
12687 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
12688 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No subscription id was provided to delete its coupon." ) );
12689 my $hash = $self->delete( "subscriptions/${id}/discount", $args ) || CORE::return( $self->pass_error );
12690 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::Discount', $hash ) );
12691 }
12692 PERL
12693 # NOTE: subscription_item()
12694 subscription_item => <<'PERL',
12695 sub subscription_item { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Billing::Subscription::Item', @_ ) ); }
12696 PERL
12697 # NOTE: subscription_item_create()
12698 subscription_item_create => <<'PERL',
12699 sub subscription_item_create
12700 {
12701 my $self = shift( @_ );
12702 my $args = shift( @_ );
12703 my $okParams =
12704 {
12705 expandable => { allowed => $EXPANDABLES->{ 'subscription_item' } },
12706 billing_thresholds => { type => "hash" },
12707 metadata => { type => "hash" },
12708 payment_behavior => { type => "string" },
12709 price => { type => "hash" },
12710 price_data => { type => "object" },
12711 proration_behavior => { type => "string" },
12712 proration_date => { type => "integer" },
12713 quantity => { type => "integer" },
12714 subscription => { type => "string", required => 1 },
12715 tax_rates => { type => "array" },
12716 };
12717 $args = $self->_contract( 'subscription_item', $args ) || CORE::return( $self->pass_error );
12718 my $err = $self->_check_parameters( $okParams, $args );
12719 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
12720 my $hash = $self->post( "subscription_items", $args ) || CORE::return( $self->pass_error );
12721 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::Subscription::Item', $hash ) );
12722 }
12723 PERL
12724 # NOTE: subscription_item_delete()
12725 subscription_item_delete => <<'PERL',
12726 sub subscription_item_delete
12727 {
12728 my $self = shift( @_ );
12729 my $args = shift( @_ );
12730 my $okParams =
12731 {
12732 expandable => { allowed => $EXPANDABLES->{ 'subscription_item' } },
12733 clear_usage => { type => "boolean" },
12734 proration_behavior => { type => "string" },
12735 proration_date => { type => "integer" },
12736 };
12737 $args = $self->_contract( 'subscription_item', $args ) || CORE::return( $self->pass_error );
12738 my $err = $self->_check_parameters( $okParams, $args );
12739 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
12740 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No subscription_item id (with parameter 'id') was provided to delete its information." ) );
12741 my $hash = $self->delete( "subscription_items/${id}", $args ) || CORE::return( $self->pass_error );
12742 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::Subscription::Item', $hash ) );
12743 }
12744 PERL
12745 # NOTE: subscription_item_list()
12746 subscription_item_list => <<'PERL',
12747 sub subscription_item_list
12748 {
12749 my $self = shift( @_ );
12750 CORE::return( $self->error( "No parameters were provided to list subscription item information." ) ) if( !scalar( @_ ) );
12751 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Billing::Subscription::Item', @_ );
12752 my $okParams =
12753 {
12754 expandable => { allowed => $EXPANDABLES->{ 'subscription_item' }, data_prefix_is_ok => 1 },
12755 ending_before => { type => "string" },
12756 limit => { type => "string" },
12757 starting_after => { type => "string" },
12758 subscription => { type => "string", required => 1 },
12759 };
12760 my $err = $self->_check_parameters( $okParams, $args );
12761 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
12762 if( $args->{expand} )
12763 {
12764 $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
12765 }
12766 my $hash = $self->get( "subscription_items", $args ) || CORE::return( $self->pass_error );
12767 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::Subscription::Item', $hash ) );
12768 }
12769 PERL
12770 # NOTE: subscription_item_retrieve()
12771 subscription_item_retrieve => <<'PERL',
12772 sub subscription_item_retrieve
12773 {
12774 my $self = shift( @_ );
12775 my $args = shift( @_ );
12776 my $okParams =
12777 {
12778 expandable => { allowed => $EXPANDABLES->{ 'subscription_item' }, data_prefix_is_ok => 1 },
12779 };
12780 $args = $self->_contract( 'subscription_item', $args ) || CORE::return( $self->pass_error );
12781 my $err = $self->_check_parameters( $okParams, $args );
12782 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
12783 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No subscription_item id (with parameter 'id') was provided to retrieve its information." ) );
12784 my $hash = $self->get( "subscription_items/${id}", $args ) || CORE::return( $self->pass_error );
12785 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::Subscription::Item', $hash ) );
12786 }
12787 PERL
12788 # NOTE: subscription_item_update()
12789 subscription_item_update => <<'PERL',
12790 sub subscription_item_update
12791 {
12792 my $self = shift( @_ );
12793 my $args = shift( @_ );
12794 my $okParams =
12795 {
12796 expandable => { allowed => $EXPANDABLES->{ 'subscription_item' } },
12797 billing_thresholds => { type => "hash" },
12798 metadata => { type => "hash" },
12799 off_session => { type => "boolean" },
12800 payment_behavior => { type => "string" },
12801 price => { type => "hash" },
12802 price_data => { type => "object" },
12803 proration_behavior => { type => "string" },
12804 proration_date => { type => "integer" },
12805 quantity => { type => "integer" },
12806 tax_rates => { type => "array" },
12807 };
12808 $args = $self->_contract( 'subscription_item', $args ) || CORE::return( $self->pass_error );
12809 my $err = $self->_check_parameters( $okParams, $args );
12810 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
12811 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No subscription_item id (with parameter 'id') was provided to update its information." ) );
12812 my $hash = $self->post( "subscription_items/${id}", $args ) || CORE::return( $self->pass_error );
12813 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::Subscription::Item', $hash ) );
12814 }
12815 PERL
12816 # NOTE: subscription_items()
12817 subscription_items => <<'PERL',
12818 # <https://stripe.com/docs/api/subscription_items>
12819 sub subscription_items
12820 {
12821 my $self = shift( @_ );
12822 my $allowed = [qw( create delete list retrieve update )];
12823 my $action = shift( @_ );
12824 my $meth = $self->_get_method( 'subscription_item', $action, $allowed ) || CORE::return( $self->pass_error );
12825 CORE::return( $self->$meth( @_ ) );
12826 }
12827 PERL
12828 # NOTE: subscription_list()
12829 subscription_list => <<'PERL',
12830 sub subscription_list
12831 {
12832 my $self = shift( @_ );
12833 my $args = $self->_get_args( @_ );
12834 my $okParams =
12835 {
12836 expandable => { allowed => $EXPANDABLES->{subscription}, data_prefix_is_ok => 1 },
12837 active => { type => "boolean" },
12838 collection_method => { type => "string" },
12839 created => { re => qr/^\d+$/, type => "timestamp" },
12840 'created.gt' => { re => qr/^\d+$/ },
12841 'created.gte' => { re => qr/^\d+$/ },
12842 'created.lt' => { re => qr/^\d+$/ },
12843 'created.lte' => { re => qr/^\d+$/ },
12844 current_period_end => { type => "timestamp" },
12845 current_period_start => { type => "timestamp" },
12846 customer => { type => "string" },
12847 ending_before => { type => "string" },
12848 ids => { type => "array" },
12849 limit => { re => qr/^\d+$/, type => "string" },
12850 price => { type => "string" },
12851 shippable => { type => "boolean" },
12852 starting_after => { type => "string" },
12853 status => { type => "string" },
12854 test_clock => { type => "string" },
12855 };
12856  
12857 my $err = $self->_check_parameters( $okParams, $args );
12858 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
12859 if( $args->{expand} )
12860 {
12861 $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
12862 }
12863 my $hash = $self->get( 'subscriptions', $args ) || CORE::return( $self->pass_error );
12864 CORE::return( $self->_response_to_object( 'Net::API::Stripe::List', $hash ) );
12865 }
12866 PERL
12867 # NOTE: subscription_retrieve()
12868 subscription_retrieve => <<'PERL',
12869 sub subscription_retrieve
12870 {
12871 my $self = shift( @_ );
12872 CORE::return( $self->error( "No parameters were provided to retrieve subscription information." ) ) if( !scalar( @_ ) );
12873 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Billing::Subscription', @_ );
12874 my $okParams =
12875 {
12876 expandable => { allowed => $EXPANDABLES->{subscription} },
12877 id => { re => qr/^\w+$/, required => 1 }
12878 };
12879 my $err = $self->_check_parameters( $okParams, $args );
12880 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
12881 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No subscription id was provided to retrieve its information." ) );
12882 my $hash = $self->get( "subscriptions/${id}", $args ) || CORE::return( $self->pass_error );
12883 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::Subscription', $hash ) );
12884 }
12885 PERL
12886 # NOTE: subscription_schedule()
12887 subscription_schedule => <<'PERL',
12888 sub subscription_schedule { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Billing::Subscription::Schedule', @_ ) ); }
12889 PERL
12890 # NOTE: subscription_schedule_cancel()
12891 subscription_schedule_cancel => <<'PERL',
12892 sub subscription_schedule_cancel
12893 {
12894 my $self = shift( @_ );
12895 my $args = shift( @_ );
12896 my $okParams =
12897 {
12898 expandable => { allowed => $EXPANDABLES->{ 'subscription_schedule' } },
12899 invoice_now => { type => "boolean" },
12900 prorate => { type => "boolean" },
12901 };
12902 $args = $self->_contract( 'subscription_schedule', $args ) || CORE::return( $self->pass_error );
12903 my $err = $self->_check_parameters( $okParams, $args );
12904 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
12905 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No subscription_schedule id (with parameter 'id') was provided to cancel its information." ) );
12906 my $hash = $self->post( "subscription_schedules/${id}", $args ) || CORE::return( $self->pass_error );
12907 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::Subscription::Schedule', $hash ) );
12908 }
12909 PERL
12910 # NOTE: subscription_schedule_create()
12911 subscription_schedule_create => <<'PERL',
12912 sub subscription_schedule_create
12913 {
12914 my $self = shift( @_ );
12915 my $args = shift( @_ );
12916 my $okParams =
12917 {
12918 expandable => { allowed => $EXPANDABLES->{ 'subscription_schedule' } },
12919 customer => { type => "string" },
12920 default_settings => { type => "hash" },
12921 end_behavior => { type => "string" },
12922 from_subscription => { type => "string" },
12923 metadata => { type => "hash" },
12924 phases => { type => "array" },
12925 start_date => { type => "string" },
12926 };
12927 $args = $self->_contract( 'subscription_schedule', $args ) || CORE::return( $self->pass_error );
12928 my $err = $self->_check_parameters( $okParams, $args );
12929 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
12930 my $hash = $self->post( "subscription_schedules", $args ) || CORE::return( $self->pass_error );
12931 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::Subscription::Schedule', $hash ) );
12932 }
12933 PERL
12934 # NOTE: subscription_schedule_list()
12935 subscription_schedule_list => <<'PERL',
12936 sub subscription_schedule_list
12937 {
12938 my $self = shift( @_ );
12939 CORE::return( $self->error( "No parameters were provided to list subscription schedule information." ) ) if( !scalar( @_ ) );
12940 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Billing::Subscription::Schedule', @_ );
12941 my $okParams =
12942 {
12943 expandable => { allowed => $EXPANDABLES->{ 'subscription_schedule' }, data_prefix_is_ok => 1 },
12944 canceled_at => { type => "timestamp" },
12945 completed_at => { type => "timestamp" },
12946 created => { type => "timestamp" },
12947 customer => { type => "string" },
12948 ending_before => { type => "string" },
12949 limit => { type => "string" },
12950 released_at => { type => "timestamp" },
12951 scheduled => { type => "string" },
12952 starting_after => { type => "string" },
12953 };
12954 my $err = $self->_check_parameters( $okParams, $args );
12955 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
12956 if( $args->{expand} )
12957 {
12958 $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
12959 }
12960 my $hash = $self->get( "subscription_schedules", $args ) || CORE::return( $self->pass_error );
12961 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::Subscription::Schedule', $hash ) );
12962 }
12963 PERL
12964 # NOTE: subscription_schedule_release()
12965 subscription_schedule_release => <<'PERL',
12966 sub subscription_schedule_release
12967 {
12968 my $self = shift( @_ );
12969 my $args = shift( @_ );
12970 my $okParams =
12971 {
12972 expandable => { allowed => $EXPANDABLES->{ 'subscription_schedule' } },
12973 preserve_cancel_date => { type => "boolean" },
12974 };
12975 $args = $self->_contract( 'subscription_schedule', $args ) || CORE::return( $self->pass_error );
12976 my $err = $self->_check_parameters( $okParams, $args );
12977 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
12978 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No subscription_schedule id (with parameter 'id') was provided to release its information." ) );
12979 my $hash = $self->post( "subscription_schedules/${id}", $args ) || CORE::return( $self->pass_error );
12980 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::Subscription::Schedule', $hash ) );
12981 }
12982 PERL
12983 # NOTE: subscription_schedule_retrieve()
12984 subscription_schedule_retrieve => <<'PERL',
12985 sub subscription_schedule_retrieve
12986 {
12987 my $self = shift( @_ );
12988 my $args = shift( @_ );
12989 my $okParams =
12990 {
12991 expandable => { allowed => $EXPANDABLES->{ 'subscription_schedule' }, data_prefix_is_ok => 1 },
12992 };
12993 $args = $self->_contract( 'subscription_schedule', $args ) || CORE::return( $self->pass_error );
12994 my $err = $self->_check_parameters( $okParams, $args );
12995 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
12996 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No subscription_schedule id (with parameter 'id') was provided to retrieve its information." ) );
12997 my $hash = $self->get( "subscription_schedules/${id}", $args ) || CORE::return( $self->pass_error );
12998 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::Subscription::Schedule', $hash ) );
12999 }
13000 PERL
13001 # NOTE: subscription_schedule_update()
13002 subscription_schedule_update => <<'PERL',
13003 sub subscription_schedule_update
13004 {
13005 my $self = shift( @_ );
13006 my $args = shift( @_ );
13007 my $okParams =
13008 {
13009 expandable => { allowed => $EXPANDABLES->{ 'subscription_schedule' } },
13010 default_settings => { type => "hash" },
13011 end_behavior => { type => "string" },
13012 metadata => { type => "hash" },
13013 phases => { type => "array" },
13014 proration_behavior => { type => "string" },
13015 };
13016 $args = $self->_contract( 'subscription_schedule', $args ) || CORE::return( $self->pass_error );
13017 my $err = $self->_check_parameters( $okParams, $args );
13018 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
13019 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No subscription_schedule id (with parameter 'id') was provided to update its information." ) );
13020 my $hash = $self->post( "subscription_schedules/${id}", $args ) || CORE::return( $self->pass_error );
13021 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::Subscription::Schedule', $hash ) );
13022 }
13023 PERL
13024 # NOTE: subscription_schedules()
13025 subscription_schedules => <<'PERL',
13026 # <https://stripe.com/docs/api/subscription_schedules>
13027 sub subscription_schedules
13028 {
13029 my $self = shift( @_ );
13030 my $allowed = [qw( cancel create list release retrieve update )];
13031 my $action = shift( @_ );
13032 my $meth = $self->_get_method( 'subscription_schedule', $action, $allowed ) || CORE::return( $self->pass_error );
13033 CORE::return( $self->$meth( @_ ) );
13034 }
13035 PERL
13036 # NOTE: subscription_search()
13037 subscription_search => <<'PERL',
13038 sub subscription_search
13039 {
13040 my $self = shift( @_ );
13041 my $args = shift( @_ );
13042 my $okParams =
13043 {
13044 expandable => { allowed => $EXPANDABLES->{ 'subscription' }, data_prefix_is_ok => 1 },
13045 limit => { type => "string" },
13046 page => { type => "string" },
13047 query => { type => "string", required => 1 },
13048 };
13049 $args = $self->_contract( 'subscription', $args ) || CORE::return( $self->pass_error );
13050 my $err = $self->_check_parameters( $okParams, $args );
13051 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
13052 my $hash = $self->get( "subscriptions", $args ) || CORE::return( $self->pass_error );
13053 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::Subscription', $hash ) );
13054 }
13055 PERL
13056 # NOTE: subscription_update()
13057 subscription_update => <<'PERL',
13058 # https://stripe.com/docs/api/customers/update?lang=curl
13059 sub subscription_update
13060 {
13061 my $self = shift( @_ );
13062 CORE::return( $self->error( "No parameters were provided to update a subscription" ) ) if( !scalar( @_ ) );
13063 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Billing::Subscription', @_ );
13064 my $okParams =
13065 {
13066 expandable => { allowed => $EXPANDABLES->{subscription} },
13067 add_invoice_items => { type => "array" },
13068 application_fee_percent => { re => qr/^[0-100]$/, type => "decimal" },
13069 automatic_tax => { type => "hash" },
13070 billing_cycle_anchor => { re => qr/^\d+$/, type => "timestamp" },
13071 billing_thresholds => {
13072 fields => ["amount_gte", "reset_billing_cycle_anchor"],
13073 type => "hash",
13074 },
13075 cancel_at => { type => "timestamp" },
13076 cancel_at_period_end => { type => "boolean" },
13077 collection_method => { re => qr/^(?:charge_automatically|send_invoice)$/, type => "string" },
13078 coupon => { type => "string" },
13079 days_until_due => { type => "integer" },
13080 default_payment_method => { re => qr/^[\w\_]+$/, type => "string" },
13081 default_source => { type => "string" },
13082 default_tax_rates => { type => "array" },
13083 description => { type => "string" },
13084 id => { re => qr/^\w+$/, required => 1 },
13085 items => {
13086 fields => [
13087 "id",
13088 "plan",
13089 "billing_thresholds.usage_gte",
13090 "clear_usage",
13091 "deleted",
13092 "metadata",
13093 "quantity",
13094 "tax_rates",
13095 ],
13096 type => "array",
13097 },
13098 metadata => { type => "hash" },
13099 off_session => { type => "boolean" },
13100 pause_collection => { fields => ["behavior", "resumes_at"], type => "string" },
13101 payment_behavior => {
13102 re => qr/^(?:allow_incomplete|error_if_incomplete)$/,
13103 type => "string",
13104 },
13105 payment_settings => { type => "hash" },
13106 pending_invoice_item_interval => { fields => ["interval", "interval_count"], type => "hash" },
13107 promotion_code => { type => "string" },
13108 prorate => {},
13109 proration_behavior => { type => "string" },
13110 proration_date => { type => "datetime" },
13111 tax_percent => { re => qr/^[0-100]$/ },
13112 transfer_data => { type => "hash" },
13113 trial_end => { re => qr/^(?:\d+|now)$/, type => "timestamp" },
13114 trial_from_plan => { type => "boolean" },
13115 };
13116  
13117 $args = $self->_contract( 'subscription', $args ) || CORE::return( $self->pass_error );
13118 # We found some errors
13119 my $err = $self->_check_parameters( $okParams, $args );
13120 # $self->message( 3, "Data to be posted: ", $self->dumper( $args ) ); exit;
13121 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
13122 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No subscription id was provided to update subscription's details" ) );
13123 my $hash = $self->post( "subscriptions/${id}", $args ) || CORE::return( $self->pass_error );
13124 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::Subscription', $hash ) );
13125 }
13126 PERL
13127 # NOTE: subscriptions()
13128 subscriptions => <<'PERL',
13129 # <https://stripe.com/docs/api/subscriptions>
13130 sub subscriptions
13131 {
13132 my $self = shift( @_ );
13133 my $allowed = [qw( cancel create delete delete_discount list retrieve search update )];
13134 my $action = shift( @_ );
13135 my $meth = $self->_get_method( 'subscription', $action, $allowed ) || CORE::return( $self->pass_error );
13136 CORE::return( $self->$meth( @_ ) );
13137 }
13138 PERL
13139 # NOTE: tax_code()
13140 tax_code => <<'PERL',
13141 sub tax_code { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Product::TaxCode', @_ ) ); }
13142 PERL
13143 # NOTE: tax_code_list()
13144 tax_code_list => <<'PERL',
13145 sub tax_code_list
13146 {
13147 my $self = shift( @_ );
13148 CORE::return( $self->error( "No parameters were provided to list tax codes" ) ) if( !scalar( @_ ) );
13149 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Product::TaxCode', @_ );
13150 my $okParams =
13151 {
13152 expandable => { allowed => $EXPANDABLES->{tax_code}, data_prefix_is_ok => 1 },
13153 ending_before => { re => qr/^\w+$/, type => "string" },
13154 limit => { re => qr/^\d+$/, type => "string" },
13155 starting_after => { re => qr/^\w+$/, type => "string" },
13156 };
13157  
13158 my $err = $self->_check_parameters( $okParams, $args );
13159 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
13160 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No tax code id was provided to list its information" ) );
13161 if( $args->{expand} )
13162 {
13163 $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
13164 }
13165 my $hash = $self->get( "tax_codes", $args ) || CORE::return( $self->pass_error );
13166 CORE::return( $self->_response_to_object( 'Net::API::Stripe::List', $hash ) );
13167 }
13168 PERL
13169 # NOTE: tax_code_retrieve()
13170 tax_code_retrieve => <<'PERL',
13171 sub tax_code_retrieve
13172 {
13173 my $self = shift( @_ );
13174 CORE::return( $self->error( "No parameters were provided to retrieve tax code" ) ) if( !scalar( @_ ) );
13175 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Product::TaxCode', @_ );
13176 my $okParams =
13177 {
13178 expandable => { allowed => $EXPANDABLES->{tax_code} },
13179 id => { re => qr/^\w+$/, required => 1 },
13180 };
13181 my $err = $self->_check_parameters( $okParams, $args );
13182 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
13183 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No tax id was provided to retrieve tax code information" ) );
13184 my $hash = $self->get( "tax_codes/${id}", $args ) || CORE::return( $self->pass_error );
13185 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Product::TaxCode', $hash ) );
13186 }
13187 PERL
13188 # NOTE: tax_codes()
13189 tax_codes => <<'PERL',
13190 sub tax_codes
13191 {
13192 my $self = shift( @_ );
13193 my $action = shift( @_ );
13194 my $allowed = [qw( retrieve list )];
13195 my $meth = $self->_get_method( 'tax_code', $action, $allowed ) || CORE::return( $self->pass_error );
13196 CORE::return( $self->$meth( @_ ) );
13197 }
13198 PERL
13199 # NOTE: tax_id()
13200 tax_id => <<'PERL',
13201 sub tax_id { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Billing::TaxID', @_ ) ); }
13202 PERL
13203 # NOTE: tax_id_create()
13204 tax_id_create => <<'PERL',
13205 sub tax_id_create
13206 {
13207 my $self = shift( @_ );
13208 CORE::return( $self->error( "No parameters were provided to create a tax_id" ) ) if( !scalar( @_ ) );
13209 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Billing::TaxID', @_ );
13210 my $okParams =
13211 {
13212 expandable => { allowed => $EXPANDABLES->{tax_id} },
13213 customer => { re => qr/^\w+$/, required => 1 },
13214 type => { re => qr/^\w+$/, required => 1, type => "string" },
13215 value => { required => 1, type => "string" },
13216 };
13217  
13218 $args = $self->_contract( 'tax_id', $args ) || CORE::return( $self->pass_error );
13219 my $err = $self->_check_parameters( $okParams, $args );
13220 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
13221 my $id = CORE::delete( $args->{customer} ) || CORE::return( $self->error( "No customer id was provided to create a tax_id for the customer" ) );
13222 my $hash = $self->post( "customers/$id/tax_ids", $args ) || CORE::return( $self->pass_error );
13223 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::TaxID', $hash ) );
13224 }
13225 PERL
13226 # NOTE: tax_id_delete()
13227 tax_id_delete => <<'PERL',
13228 sub tax_id_delete
13229 {
13230 my $self = shift( @_ );
13231 CORE::return( $self->error( "No parameters were provided to delete a tax_id" ) ) if( !scalar( @_ ) );
13232 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Billing::TaxID', @_ );
13233 my $okParams =
13234 {
13235 expandable => { allowed => $EXPANDABLES->{tax_id} },
13236 id => { re => qr/^\w+$/, required => 1 },
13237 customer => { re => qr/^\w+$/, required => 1 },
13238 };
13239 my $err = $self->_check_parameters( $okParams, $args );
13240 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
13241 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No tax id was provided to delete." ) );
13242 my $cust_id = CORE::delete( $args->{customer} ) || CORE::return( $self->error( "No customer id was provided to delete his/her tax_id" ) );
13243 my $hash = $self->delete( "customers/${cust_id}/tax_ids/${id}", $args ) || CORE::return( $self->pass_error );
13244 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::TaxID', $hash ) );
13245 }
13246 PERL
13247 # NOTE: tax_id_list()
13248 tax_id_list => <<'PERL',
13249 sub tax_id_list
13250 {
13251 my $self = shift( @_ );
13252 CORE::return( $self->error( "No parameters were provided to list customer's tax ids" ) ) if( !scalar( @_ ) );
13253 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Customer', @_ );
13254 my $okParams =
13255 {
13256 expandable => { allowed => $EXPANDABLES->{tax_id}, data_prefix_is_ok => 1 },
13257 customer => { re => qr/^\w+$/, required => 1 },
13258 # "A cursor for use in pagination. ending_before is an object ID that defines your place in the list."
13259 ending_before => qr/^\w+$/,
13260 limit => qr/^\d+$/,
13261 starting_after => qr/^\w+$/,
13262 };
13263 my $err = $self->_check_parameters( $okParams, $args );
13264 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
13265 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" ) );
13266 if( $args->{expand} )
13267 {
13268 $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
13269 }
13270 my $hash = $self->get( "customers/${id}/tax_ids", $args ) || CORE::return( $self->pass_error );
13271 CORE::return( $self->_response_to_object( 'Net::API::Stripe::List', $hash ) );
13272 }
13273 PERL
13274 # NOTE: tax_id_retrieve()
13275 tax_id_retrieve => <<'PERL',
13276 sub tax_id_retrieve
13277 {
13278 my $self = shift( @_ );
13279 CORE::return( $self->error( "No parameters were provided to retrieve tax_id" ) ) if( !scalar( @_ ) );
13280 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Billing::TaxID', @_ );
13281 my $okParams =
13282 {
13283 expandable => { allowed => $EXPANDABLES->{tax_id} },
13284 id => { re => qr/^\w+$/, required => 1 },
13285 customer => { re => qr/^\w+$/, required => 1 },
13286 };
13287 my $err = $self->_check_parameters( $okParams, $args );
13288 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
13289 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No tax id was provided to retrieve customer's tax_id" ) );
13290 my $cust_id = CORE::delete( $args->{customer} ) || CORE::return( $self->error( "No customer id was provided to retrieve his/her tax_id" ) );
13291 my $hash = $self->get( "customers/${cust_id}/tax_ids/${id}", $args ) || CORE::return( $self->pass_error );
13292 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::TaxID', $hash ) );
13293 }
13294 PERL
13295 # NOTE: tax_ids()
13296 tax_ids => <<'PERL',
13297 sub tax_ids
13298 {
13299 my $self = shift( @_ );
13300 my $action = shift( @_ );
13301 my $allowed = [qw( create retrieve delete list )];
13302 my $meth = $self->_get_method( 'tax_id', $action, $allowed ) || CORE::return( $self->pass_error );
13303 CORE::return( $self->$meth( @_ ) );
13304 }
13305 PERL
13306 # NOTE: tax_rate()
13307 tax_rate => <<'PERL',
13308 sub tax_rate { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Tax::Rate', @_ ) ); }
13309 PERL
13310 # NOTE: tax_rate_create()
13311 tax_rate_create => <<'PERL',
13312 sub tax_rate_create
13313 {
13314 my $self = shift( @_ );
13315 CORE::return( $self->error( "No parameters were provided to create a tax rate" ) ) if( !scalar( @_ ) );
13316 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Tax::Rate', @_ );
13317 my $okParams =
13318 {
13319 expandable => { allowed => $EXPANDABLES->{tax_rate} },
13320 active => { type => "boolean" },
13321 country => { re => qr/^[A-Z]+$/, type => "string" },
13322 description => { type => "string" },
13323 display_name => { re => qr/^.+$/, required => 1, type => "string" },
13324 inclusive => { required => 1, type => "boolean" },
13325 jurisdiction => { re => qr/^[A-Z]+$/, type => "string" },
13326 metadata => { type => "hash" },
13327 percentage => { required => 1, type => "integer" },
13328 state => { type => "string" },
13329 tax_type => { type => "string" },
13330 };
13331  
13332 $args = $self->_contract( 'tax_rate', $args ) || CORE::return( $self->pass_error );
13333 my $err = $self->_check_parameters( $okParams, $args );
13334 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
13335 my $hash = $self->post( "tax_rates", $args ) || CORE::return( $self->pass_error );
13336 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Tax::Rate', $hash ) );
13337 }
13338 PERL
13339 # NOTE: tax_rate_list()
13340 tax_rate_list => <<'PERL',
13341 sub tax_rate_list
13342 {
13343 my $self = shift( @_ );
13344 CORE::return( $self->error( "No parameters were provided to list tax rates" ) ) if( !scalar( @_ ) );
13345 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Tax::Rate', @_ );
13346 my $okParams =
13347 {
13348 expandable => { allowed => $EXPANDABLES->{tax_rate}, data_prefix_is_ok => 1 },
13349 active => { type => "boolean" },
13350 created => { re => qr/^\d+$/, type => "timestamp" },
13351 'created.gt' => { re => qr/^\d+$/ },
13352 'created.gte' => { re => qr/^\d+$/ },
13353 'created.lt' => { re => qr/^\d+$/ },
13354 'created.lte' => { re => qr/^\d+$/ },
13355 ending_before => { re => qr/^\w+$/, type => "string" },
13356 id => { re => qr/^\w+$/, required => 1 },
13357 inclusive => { type => "boolean" },
13358 limit => { re => qr/^\d+$/, type => "string" },
13359 starting_after => { re => qr/^\w+$/, type => "string" },
13360 };
13361  
13362 my $err = $self->_check_parameters( $okParams, $args );
13363 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
13364 if( $args->{expand} )
13365 {
13366 $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
13367 }
13368 my $hash = $self->get( "tax_rates", $args ) || CORE::return( $self->pass_error );
13369 CORE::return( $self->_response_to_object( 'Net::API::Stripe::List', $hash ) );
13370 }
13371 PERL
13372 # NOTE: tax_rate_retrieve()
13373 tax_rate_retrieve => <<'PERL',
13374 sub tax_rate_retrieve
13375 {
13376 my $self = shift( @_ );
13377 CORE::return( $self->error( "No parameters were provided to retrieve a tax rate" ) ) if( !scalar( @_ ) );
13378 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Tax::Rate', @_ );
13379 my $okParams =
13380 {
13381 expandable => { allowed => $EXPANDABLES->{tax_rate} },
13382 id => { re => qr/^\w+$/, required => 1 },
13383 };
13384 my $err = $self->_check_parameters( $okParams, $args );
13385 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
13386 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No tax id was provided to retrieve a tax rate" ) );
13387 my $hash = $self->get( "tax_rates/${id}", $args ) || CORE::return( $self->pass_error );
13388 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Tax::Rate', $hash ) );
13389 }
13390 PERL
13391 # NOTE: tax_rate_update()
13392 tax_rate_update => <<'PERL',
13393 sub tax_rate_update
13394 {
13395 my $self = shift( @_ );
13396 CORE::return( $self->error( "No parameters were provided to update a tax rate" ) ) if( !scalar( @_ ) );
13397 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Tax::Rate', @_ );
13398 my $okParams =
13399 {
13400 expandable => { allowed => $EXPANDABLES->{tax_rate} },
13401 active => { type => "boolean" },
13402 country => { re => qr/^[A-Z]+$/, type => "string" },
13403 description => { type => "string" },
13404 display_name => { re => qr/^.+$/, required => 1, type => "string" },
13405 id => { re => qr/^\w+$/, required => 1 },
13406 jurisdiction => { re => qr/^[A-Z]+$/, type => "string" },
13407 metadata => { type => "hash" },
13408 state => { type => "string" },
13409 tax_type => { type => "string" },
13410 };
13411  
13412 $args = $self->_contract( 'tax_rate', $args ) || CORE::return( $self->pass_error );
13413 # We found some errors
13414 my $err = $self->_check_parameters( $okParams, $args );
13415 # $self->message( 3, "Data to be posted: ", $self->dumper( $args ) ); exit;
13416 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
13417 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No tax rate id was provided to update its details" ) );
13418 my $hash = $self->post( "tax_rates/${id}", $args ) || CORE::return( $self->pass_error );
13419 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Tax::Rate', $hash ) );
13420 }
13421 PERL
13422 # NOTE: tax_rates()
13423 tax_rates => <<'PERL',
13424 sub tax_rates
13425 {
13426 my $self = shift( @_ );
13427 my $action = shift( @_ );
13428 my $allowed = [qw( create retrieve update list )];
13429 my $meth = $self->_get_method( 'tax_rate', $action, $allowed ) || CORE::return( $self->pass_error );
13430 CORE::return( $self->$meth( @_ ) );
13431 }
13432 PERL
13433 # NOTE: terminal_configuration()
13434 terminal_configuration => <<'PERL',
13435 sub terminal_configuration { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Terminal::Configuration', @_ ) ); }
13436 PERL
13437 # NOTE: terminal_configuration_create()
13438 terminal_configuration_create => <<'PERL',
13439 sub terminal_configuration_create
13440 {
13441 my $self = shift( @_ );
13442 my $args = shift( @_ );
13443 my $okParams =
13444 {
13445 expandable => { allowed => $EXPANDABLES->{ 'terminal.configuration' } },
13446 bbpos_wisepos_e => { type => "hash" },
13447 tipping => { type => "hash" },
13448 verifone_p400 => { type => "hash" },
13449 };
13450 $args = $self->_contract( 'terminal.configuration', $args ) || CORE::return( $self->pass_error );
13451 my $err = $self->_check_parameters( $okParams, $args );
13452 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
13453 my $hash = $self->post( "", $args ) || CORE::return( $self->pass_error );
13454 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Terminal::Configuration', $hash ) );
13455 }
13456 PERL
13457 # NOTE: terminal_configuration_delete()
13458 terminal_configuration_delete => <<'PERL',
13459 sub terminal_configuration_delete
13460 {
13461 my $self = shift( @_ );
13462 my $args = shift( @_ );
13463 my $okParams =
13464 {
13465 expandable => { allowed => $EXPANDABLES->{ 'terminal.configuration' } },
13466 };
13467 $args = $self->_contract( 'terminal.configuration', $args ) || CORE::return( $self->pass_error );
13468 my $err = $self->_check_parameters( $okParams, $args );
13469 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
13470 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No terminal.configuration id (with parameter 'id') was provided to delete its information." ) );
13471 my $hash = $self->delete( "terminal/configurations/${id}", $args ) || CORE::return( $self->pass_error );
13472 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Terminal::Configuration', $hash ) );
13473 }
13474 PERL
13475 # NOTE: terminal_configuration_list()
13476 terminal_configuration_list => <<'PERL',
13477 sub terminal_configuration_list
13478 {
13479 my $self = shift( @_ );
13480 CORE::return( $self->error( "No parameters were provided to list terminal configuration information." ) ) if( !scalar( @_ ) );
13481 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Terminal::Configuration', @_ );
13482 my $okParams =
13483 {
13484 expandable => { allowed => $EXPANDABLES->{ 'terminal.configuration' }, data_prefix_is_ok => 1 },
13485 ending_before => { type => "string" },
13486 is_account_default => { type => "boolean" },
13487 limit => { type => "string" },
13488 starting_after => { type => "string" },
13489 };
13490 my $err = $self->_check_parameters( $okParams, $args );
13491 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
13492 if( $args->{expand} )
13493 {
13494 $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
13495 }
13496 my $hash = $self->get( "", $args ) || CORE::return( $self->pass_error );
13497 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Terminal::Configuration', $hash ) );
13498 }
13499 PERL
13500 # NOTE: terminal_configuration_retrieve()
13501 terminal_configuration_retrieve => <<'PERL',
13502 sub terminal_configuration_retrieve
13503 {
13504 my $self = shift( @_ );
13505 my $args = shift( @_ );
13506 my $okParams =
13507 {
13508 expandable => { allowed => $EXPANDABLES->{ 'terminal.configuration' }, data_prefix_is_ok => 1 },
13509 };
13510 $args = $self->_contract( 'terminal.configuration', $args ) || CORE::return( $self->pass_error );
13511 my $err = $self->_check_parameters( $okParams, $args );
13512 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
13513 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No terminal.configuration id (with parameter 'id') was provided to retrieve its information." ) );
13514 my $hash = $self->get( "terminal/configurations/${id}", $args ) || CORE::return( $self->pass_error );
13515 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Terminal::Configuration', $hash ) );
13516 }
13517 PERL
13518 # NOTE: terminal_configuration_update()
13519 terminal_configuration_update => <<'PERL',
13520 sub terminal_configuration_update
13521 {
13522 my $self = shift( @_ );
13523 my $args = shift( @_ );
13524 my $okParams =
13525 {
13526 expandable => { allowed => $EXPANDABLES->{ 'terminal.configuration' } },
13527 bbpos_wisepos_e => { type => "hash" },
13528 tipping => { type => "hash" },
13529 verifone_p400 => { type => "hash" },
13530 };
13531 $args = $self->_contract( 'terminal.configuration', $args ) || CORE::return( $self->pass_error );
13532 my $err = $self->_check_parameters( $okParams, $args );
13533 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
13534 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No terminal.configuration id (with parameter 'id') was provided to update its information." ) );
13535 my $hash = $self->post( "terminal/configurations/${id}", $args ) || CORE::return( $self->pass_error );
13536 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Terminal::Configuration', $hash ) );
13537 }
13538 PERL
13539 # NOTE: terminal_configurations()
13540 terminal_configurations => <<'PERL',
13541 # <https://stripe.com/docs/api/terminal/configuration>
13542 sub terminal_configurations
13543 {
13544 my $self = shift( @_ );
13545 my $allowed = [qw( create delete list retrieve update )];
13546 my $action = shift( @_ );
13547 my $meth = $self->_get_method( 'terminal_configuration', $action, $allowed ) || CORE::return( $self->pass_error );
13548 CORE::return( $self->$meth( @_ ) );
13549 }
13550 PERL
13551 # NOTE: terminal_connection_token()
13552 terminal_connection_token => <<'PERL',
13553 sub terminal_connection_token { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Terminal::ConnectionToken', @_ ) ); }
13554 PERL
13555 # NOTE: terminal_connection_token_create()
13556 terminal_connection_token_create => <<'PERL',
13557 sub terminal_connection_token_create
13558 {
13559 my $self = shift( @_ );
13560 my $args = shift( @_ );
13561 my $okParams =
13562 {
13563 expandable => { allowed => $EXPANDABLES->{ 'terminal.connection_token' } },
13564 location => { type => "string" },
13565 };
13566 $args = $self->_contract( 'terminal.connection_token', $args ) || CORE::return( $self->pass_error );
13567 my $err = $self->_check_parameters( $okParams, $args );
13568 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
13569 my $hash = $self->post( "", $args ) || CORE::return( $self->pass_error );
13570 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Terminal::ConnectionToken', $hash ) );
13571 }
13572 PERL
13573 # NOTE: terminal_connection_tokens()
13574 terminal_connection_tokens => <<'PERL',
13575 # <https://stripe.com/docs/api/terminal/connection_tokens>
13576 sub terminal_connection_tokens
13577 {
13578 my $self = shift( @_ );
13579 my $allowed = [qw( create )];
13580 my $action = shift( @_ );
13581 my $meth = $self->_get_method( 'terminal_connection_token', $action, $allowed ) || CORE::return( $self->pass_error );
13582 CORE::return( $self->$meth( @_ ) );
13583 }
13584 PERL
13585 # NOTE: terminal_location()
13586 terminal_location => <<'PERL',
13587 sub terminal_location { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Terminal::Location', @_ ) ); }
13588 PERL
13589 # NOTE: terminal_location_create()
13590 terminal_location_create => <<'PERL',
13591 sub terminal_location_create
13592 {
13593 my $self = shift( @_ );
13594 my $args = shift( @_ );
13595 my $okParams =
13596 {
13597 expandable => { allowed => $EXPANDABLES->{ 'terminal.location' } },
13598 address => { type => "hash", required => 1 },
13599 configuration_overrides => { type => "string" },
13600 display_name => { type => "string", required => 1 },
13601 metadata => { type => "hash" },
13602 };
13603 $args = $self->_contract( 'terminal.location', $args ) || CORE::return( $self->pass_error );
13604 my $err = $self->_check_parameters( $okParams, $args );
13605 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
13606 my $hash = $self->post( "", $args ) || CORE::return( $self->pass_error );
13607 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Terminal::Location', $hash ) );
13608 }
13609 PERL
13610 # NOTE: terminal_location_delete()
13611 terminal_location_delete => <<'PERL',
13612 sub terminal_location_delete
13613 {
13614 my $self = shift( @_ );
13615 my $args = shift( @_ );
13616 my $okParams =
13617 {
13618 expandable => { allowed => $EXPANDABLES->{ 'terminal.location' } },
13619 };
13620 $args = $self->_contract( 'terminal.location', $args ) || CORE::return( $self->pass_error );
13621 my $err = $self->_check_parameters( $okParams, $args );
13622 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
13623 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No terminal.location id (with parameter 'id') was provided to delete its information." ) );
13624 my $hash = $self->delete( "terminal/locations/${id}", $args ) || CORE::return( $self->pass_error );
13625 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Terminal::Location', $hash ) );
13626 }
13627 PERL
13628 # NOTE: terminal_location_list()
13629 terminal_location_list => <<'PERL',
13630 sub terminal_location_list
13631 {
13632 my $self = shift( @_ );
13633 CORE::return( $self->error( "No parameters were provided to list terminal location information." ) ) if( !scalar( @_ ) );
13634 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Terminal::Location', @_ );
13635 my $okParams =
13636 {
13637 expandable => { allowed => $EXPANDABLES->{ 'terminal.location' }, data_prefix_is_ok => 1 },
13638 ending_before => { type => "string" },
13639 limit => { type => "string" },
13640 starting_after => { type => "string" },
13641 };
13642 my $err = $self->_check_parameters( $okParams, $args );
13643 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
13644 if( $args->{expand} )
13645 {
13646 $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
13647 }
13648 my $hash = $self->get( "", $args ) || CORE::return( $self->pass_error );
13649 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Terminal::Location', $hash ) );
13650 }
13651 PERL
13652 # NOTE: terminal_location_retrieve()
13653 terminal_location_retrieve => <<'PERL',
13654 sub terminal_location_retrieve
13655 {
13656 my $self = shift( @_ );
13657 my $args = shift( @_ );
13658 my $okParams =
13659 {
13660 expandable => { allowed => $EXPANDABLES->{ 'terminal.location' }, data_prefix_is_ok => 1 },
13661 };
13662 $args = $self->_contract( 'terminal.location', $args ) || CORE::return( $self->pass_error );
13663 my $err = $self->_check_parameters( $okParams, $args );
13664 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
13665 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No terminal.location id (with parameter 'id') was provided to retrieve its information." ) );
13666 my $hash = $self->get( "terminal/locations/${id}", $args ) || CORE::return( $self->pass_error );
13667 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Terminal::Location', $hash ) );
13668 }
13669 PERL
13670 # NOTE: terminal_location_update()
13671 terminal_location_update => <<'PERL',
13672 sub terminal_location_update
13673 {
13674 my $self = shift( @_ );
13675 my $args = shift( @_ );
13676 my $okParams =
13677 {
13678 expandable => { allowed => $EXPANDABLES->{ 'terminal.location' } },
13679 address => { type => "hash" },
13680 configuration_overrides => { type => "string" },
13681 display_name => { type => "string" },
13682 metadata => { type => "hash" },
13683 };
13684 $args = $self->_contract( 'terminal.location', $args ) || CORE::return( $self->pass_error );
13685 my $err = $self->_check_parameters( $okParams, $args );
13686 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
13687 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No terminal.location id (with parameter 'id') was provided to update its information." ) );
13688 my $hash = $self->post( "terminal/locations/${id}", $args ) || CORE::return( $self->pass_error );
13689 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Terminal::Location', $hash ) );
13690 }
13691 PERL
13692 # NOTE: terminal_locations()
13693 terminal_locations => <<'PERL',
13694 # <https://stripe.com/docs/api/terminal/locations>
13695 sub terminal_locations
13696 {
13697 my $self = shift( @_ );
13698 my $allowed = [qw( create delete list retrieve update )];
13699 my $action = shift( @_ );
13700 my $meth = $self->_get_method( 'terminal_location', $action, $allowed ) || CORE::return( $self->pass_error );
13701 CORE::return( $self->$meth( @_ ) );
13702 }
13703 PERL
13704 # NOTE: terminal_reader()
13705 terminal_reader => <<'PERL',
13706 sub terminal_reader { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Terminal::Reader', @_ ) ); }
13707 PERL
13708 # NOTE: terminal_reader_cancel_action()
13709 terminal_reader_cancel_action => <<'PERL',
13710 sub terminal_reader_cancel_action
13711 {
13712 my $self = shift( @_ );
13713 my $args = shift( @_ );
13714 my $okParams =
13715 {
13716 expandable => { allowed => $EXPANDABLES->{ 'terminal.reader' } },
13717 };
13718 $args = $self->_contract( 'terminal.reader', $args ) || CORE::return( $self->pass_error );
13719 my $err = $self->_check_parameters( $okParams, $args );
13720 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
13721 my $hash = $self->post( "", $args ) || CORE::return( $self->pass_error );
13722 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Terminal::Reader', $hash ) );
13723 }
13724 PERL
13725 # NOTE: terminal_reader_create()
13726 terminal_reader_create => <<'PERL',
13727 sub terminal_reader_create
13728 {
13729 my $self = shift( @_ );
13730 my $args = shift( @_ );
13731 my $okParams =
13732 {
13733 expandable => { allowed => $EXPANDABLES->{ 'terminal.reader' } },
13734 label => { type => "string" },
13735 location => { type => "string" },
13736 metadata => { type => "hash" },
13737 registration_code => { type => "string", required => 1 },
13738 };
13739 $args = $self->_contract( 'terminal.reader', $args ) || CORE::return( $self->pass_error );
13740 my $err = $self->_check_parameters( $okParams, $args );
13741 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
13742 my $hash = $self->post( "", $args ) || CORE::return( $self->pass_error );
13743 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Terminal::Reader', $hash ) );
13744 }
13745 PERL
13746 # NOTE: terminal_reader_delete()
13747 terminal_reader_delete => <<'PERL',
13748 sub terminal_reader_delete
13749 {
13750 my $self = shift( @_ );
13751 my $args = shift( @_ );
13752 my $okParams =
13753 {
13754 expandable => { allowed => $EXPANDABLES->{ 'terminal.reader' } },
13755 };
13756 $args = $self->_contract( 'terminal.reader', $args ) || CORE::return( $self->pass_error );
13757 my $err = $self->_check_parameters( $okParams, $args );
13758 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
13759 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No terminal.reader id (with parameter 'id') was provided to delete its information." ) );
13760 my $hash = $self->delete( "terminal/readers/${id}", $args ) || CORE::return( $self->pass_error );
13761 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Terminal::Reader', $hash ) );
13762 }
13763 PERL
13764 # NOTE: terminal_reader_list()
13765 terminal_reader_list => <<'PERL',
13766 sub terminal_reader_list
13767 {
13768 my $self = shift( @_ );
13769 CORE::return( $self->error( "No parameters were provided to list terminal reader information." ) ) if( !scalar( @_ ) );
13770 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Terminal::Reader', @_ );
13771 my $okParams =
13772 {
13773 expandable => { allowed => $EXPANDABLES->{ 'terminal.reader' }, data_prefix_is_ok => 1 },
13774 device_type => { type => "string" },
13775 ending_before => { type => "string" },
13776 limit => { type => "string" },
13777 location => { type => "string" },
13778 serial_number => { type => "string" },
13779 starting_after => { type => "string" },
13780 status => { type => "string" },
13781 };
13782 my $err = $self->_check_parameters( $okParams, $args );
13783 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
13784 if( $args->{expand} )
13785 {
13786 $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
13787 }
13788 my $hash = $self->get( "", $args ) || CORE::return( $self->pass_error );
13789 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Terminal::Reader', $hash ) );
13790 }
13791 PERL
13792 # NOTE: terminal_reader_present_payment_method()
13793 terminal_reader_present_payment_method => <<'PERL',
13794 sub terminal_reader_present_payment_method
13795 {
13796 my $self = shift( @_ );
13797 my $args = shift( @_ );
13798 my $okParams =
13799 {
13800 expandable => { allowed => $EXPANDABLES->{ 'terminal.reader' } },
13801 card_present => { type => "object" },
13802 type => { type => "string" },
13803 };
13804 $args = $self->_contract( 'terminal.reader', $args ) || CORE::return( $self->pass_error );
13805 my $err = $self->_check_parameters( $okParams, $args );
13806 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
13807 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." ) );
13808 my $hash = $self->post( "test_helpers/terminal/readers/${id}", $args ) || CORE::return( $self->pass_error );
13809 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Terminal::Reader', $hash ) );
13810 }
13811 PERL
13812 # NOTE: terminal_reader_process_payment_intent()
13813 terminal_reader_process_payment_intent => <<'PERL',
13814 sub terminal_reader_process_payment_intent
13815 {
13816 my $self = shift( @_ );
13817 my $args = shift( @_ );
13818 my $okParams =
13819 {
13820 expandable => { allowed => $EXPANDABLES->{ 'terminal.reader' } },
13821 payment_intent => { type => "string", required => 1 },
13822 process_config => { type => "object" },
13823 };
13824 $args = $self->_contract( 'terminal.reader', $args ) || CORE::return( $self->pass_error );
13825 my $err = $self->_check_parameters( $okParams, $args );
13826 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
13827 my $hash = $self->post( "", $args ) || CORE::return( $self->pass_error );
13828 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Terminal::Reader', $hash ) );
13829 }
13830 PERL
13831 # NOTE: terminal_reader_process_setup_intent()
13832 terminal_reader_process_setup_intent => <<'PERL',
13833 sub terminal_reader_process_setup_intent
13834 {
13835 my $self = shift( @_ );
13836 my $args = shift( @_ );
13837 my $okParams =
13838 {
13839 expandable => { allowed => $EXPANDABLES->{ 'terminal.reader' } },
13840 customer_consent_collected => { type => "boolean", required => 1 },
13841 setup_intent => { type => "string", required => 1 },
13842 };
13843 $args = $self->_contract( 'terminal.reader', $args ) || CORE::return( $self->pass_error );
13844 my $err = $self->_check_parameters( $okParams, $args );
13845 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
13846 my $hash = $self->post( "", $args ) || CORE::return( $self->pass_error );
13847 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Terminal::Reader', $hash ) );
13848 }
13849 PERL
13850 # NOTE: terminal_reader_retrieve()
13851 terminal_reader_retrieve => <<'PERL',
13852 sub terminal_reader_retrieve
13853 {
13854 my $self = shift( @_ );
13855 my $args = shift( @_ );
13856 my $okParams =
13857 {
13858 expandable => { allowed => $EXPANDABLES->{ 'terminal.reader' }, data_prefix_is_ok => 1 },
13859 };
13860 $args = $self->_contract( 'terminal.reader', $args ) || CORE::return( $self->pass_error );
13861 my $err = $self->_check_parameters( $okParams, $args );
13862 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
13863 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No terminal.reader id (with parameter 'id') was provided to retrieve its information." ) );
13864 my $hash = $self->get( "terminal/readers/${id}", $args ) || CORE::return( $self->pass_error );
13865 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Terminal::Reader', $hash ) );
13866 }
13867 PERL
13868 # NOTE: terminal_reader_set_reader_display()
13869 terminal_reader_set_reader_display => <<'PERL',
13870 sub terminal_reader_set_reader_display
13871 {
13872 my $self = shift( @_ );
13873 my $args = shift( @_ );
13874 my $okParams =
13875 {
13876 expandable => { allowed => $EXPANDABLES->{ 'terminal.reader' } },
13877 cart => { type => "object" },
13878 type => { type => "string", required => 1 },
13879 };
13880 $args = $self->_contract( 'terminal.reader', $args ) || CORE::return( $self->pass_error );
13881 my $err = $self->_check_parameters( $okParams, $args );
13882 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
13883 my $hash = $self->post( "", $args ) || CORE::return( $self->pass_error );
13884 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Terminal::Reader', $hash ) );
13885 }
13886 PERL
13887 # NOTE: terminal_reader_update()
13888 terminal_reader_update => <<'PERL',
13889 sub terminal_reader_update
13890 {
13891 my $self = shift( @_ );
13892 my $args = shift( @_ );
13893 my $okParams =
13894 {
13895 expandable => { allowed => $EXPANDABLES->{ 'terminal.reader' } },
13896 label => { type => "string" },
13897 metadata => { type => "hash" },
13898 };
13899 $args = $self->_contract( 'terminal.reader', $args ) || CORE::return( $self->pass_error );
13900 my $err = $self->_check_parameters( $okParams, $args );
13901 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
13902 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No terminal.reader id (with parameter 'id') was provided to update its information." ) );
13903 my $hash = $self->post( "terminal/readers/${id}", $args ) || CORE::return( $self->pass_error );
13904 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Terminal::Reader', $hash ) );
13905 }
13906 PERL
13907 # NOTE: terminal_readers()
13908 terminal_readers => <<'PERL',
13909 # <https://stripe.com/docs/api/terminal/readers>
13910 sub terminal_readers
13911 {
13912 my $self = shift( @_ );
13913 my $allowed = [qw( cancel_action create delete list present_payment_method process_payment_intent process_setup_intent retrieve set_reader_display update )];
13914 my $action = shift( @_ );
13915 my $meth = $self->_get_method( 'terminal_reader', $action, $allowed ) || CORE::return( $self->pass_error );
13916 CORE::return( $self->$meth( @_ ) );
13917 }
13918 PERL
13919 # NOTE: test_helpers_test_clock()
13920 test_helpers_test_clock => <<'PERL',
13921 sub test_helpers_test_clock { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Billing::TestHelpersTestClock', @_ ) ); }
13922 PERL
13923 # NOTE: test_helpers_test_clock_advance()
13924 test_helpers_test_clock_advance => <<'PERL',
13925 sub test_helpers_test_clock_advance
13926 {
13927 my $self = shift( @_ );
13928 my $args = shift( @_ );
13929 my $okParams =
13930 {
13931 expandable => { allowed => $EXPANDABLES->{ 'test_helpers.test_clock' } },
13932 frozen_time => { type => "timestamp", required => 1 },
13933 };
13934 $args = $self->_contract( 'test_helpers.test_clock', $args ) || CORE::return( $self->pass_error );
13935 my $err = $self->_check_parameters( $okParams, $args );
13936 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
13937 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." ) );
13938 my $hash = $self->post( "test_helpers/test_clocks/${id}", $args ) || CORE::return( $self->pass_error );
13939 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::TestHelpersTestClock', $hash ) );
13940 }
13941 PERL
13942 # NOTE: test_helpers_test_clock_create()
13943 test_helpers_test_clock_create => <<'PERL',
13944 sub test_helpers_test_clock_create
13945 {
13946 my $self = shift( @_ );
13947 my $args = shift( @_ );
13948 my $okParams =
13949 {
13950 expandable => { allowed => $EXPANDABLES->{ 'test_helpers.test_clock' } },
13951 frozen_time => { type => "timestamp", required => 1 },
13952 name => { type => "string" },
13953 };
13954 $args = $self->_contract( 'test_helpers.test_clock', $args ) || CORE::return( $self->pass_error );
13955 my $err = $self->_check_parameters( $okParams, $args );
13956 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
13957 my $hash = $self->post( "", $args ) || CORE::return( $self->pass_error );
13958 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::TestHelpersTestClock', $hash ) );
13959 }
13960 PERL
13961 # NOTE: test_helpers_test_clock_delete()
13962 test_helpers_test_clock_delete => <<'PERL',
13963 sub test_helpers_test_clock_delete
13964 {
13965 my $self = shift( @_ );
13966 my $args = shift( @_ );
13967 my $okParams =
13968 {
13969 expandable => { allowed => $EXPANDABLES->{ 'test_helpers.test_clock' } },
13970 };
13971 $args = $self->_contract( 'test_helpers.test_clock', $args ) || CORE::return( $self->pass_error );
13972 my $err = $self->_check_parameters( $okParams, $args );
13973 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
13974 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." ) );
13975 my $hash = $self->delete( "test_helpers/test_clocks/${id}", $args ) || CORE::return( $self->pass_error );
13976 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::TestHelpersTestClock', $hash ) );
13977 }
13978 PERL
13979 # NOTE: test_helpers_test_clock_list()
13980 test_helpers_test_clock_list => <<'PERL',
13981 sub test_helpers_test_clock_list
13982 {
13983 my $self = shift( @_ );
13984 CORE::return( $self->error( "No parameters were provided to list test helpers test clock information." ) ) if( !scalar( @_ ) );
13985 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Billing::TestHelpersTestClock', @_ );
13986 my $okParams =
13987 {
13988 expandable => { allowed => $EXPANDABLES->{ 'test_helpers.test_clock' }, data_prefix_is_ok => 1 },
13989 ending_before => { type => "string" },
13990 limit => { type => "string" },
13991 starting_after => { type => "string" },
13992 };
13993 my $err = $self->_check_parameters( $okParams, $args );
13994 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
13995 if( $args->{expand} )
13996 {
13997 $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
13998 }
13999 my $hash = $self->get( "", $args ) || CORE::return( $self->pass_error );
14000 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::TestHelpersTestClock', $hash ) );
14001 }
14002 PERL
14003 # NOTE: test_helpers_test_clock_retrieve()
14004 test_helpers_test_clock_retrieve => <<'PERL',
14005 sub test_helpers_test_clock_retrieve
14006 {
14007 my $self = shift( @_ );
14008 my $args = shift( @_ );
14009 my $okParams =
14010 {
14011 expandable => { allowed => $EXPANDABLES->{ 'test_helpers.test_clock' }, data_prefix_is_ok => 1 },
14012 };
14013 $args = $self->_contract( 'test_helpers.test_clock', $args ) || CORE::return( $self->pass_error );
14014 my $err = $self->_check_parameters( $okParams, $args );
14015 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
14016 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." ) );
14017 my $hash = $self->get( "test_helpers/test_clocks/${id}", $args ) || CORE::return( $self->pass_error );
14018 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::TestHelpersTestClock', $hash ) );
14019 }
14020 PERL
14021 # NOTE: test_helpers_test_clocks()
14022 test_helpers_test_clocks => <<'PERL',
14023 # <https://stripe.com/docs/api/test_clocks>
14024 sub test_helpers_test_clocks
14025 {
14026 my $self = shift( @_ );
14027 my $allowed = [qw( advance create delete list retrieve )];
14028 my $action = shift( @_ );
14029 my $meth = $self->_get_method( 'test_helpers_test_clock', $action, $allowed ) || CORE::return( $self->pass_error );
14030 CORE::return( $self->$meth( @_ ) );
14031 }
14032 PERL
14033 # NOTE: token()
14034 token => <<'PERL',
14035 # sub terminal { CORE::return( shift->_instantiate( 'terminal', 'Net::API::Stripe::Terminal' ) ) }
14036 sub token { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Token', @_ ) ); }
14037 PERL
14038 # NOTE: token_create()
14039 token_create => <<'PERL',
14040 sub token_create
14041 {
14042 my $self = shift( @_ );
14043 CORE::return( $self->error( "No parameters were provided to create a token" ) ) if( !scalar( @_ ) );
14044 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Token', @_ );
14045 my $okParams =
14046 {
14047 expandable => { allowed => $EXPANDABLES->{token} },
14048 account => { fields => [qw( business_type company individual tos_shown_and_accepted )] },
14049 bank_account => { fields => [qw( country currency account_holder_name account_holder_type routing_number account_number )] },
14050 card => { fields => [qw( exp_month exp_year number currency cvc name address_line1 address_line2 address_city address_state address_zip address_country )] },
14051 customer => { re => qr/^\w+$/ },
14052 cvc_update => { fields => [qw( cvc )] },
14053 person => { re => [qw( address.city address.country address.line1 address.line2 address.postal_code address.state
14054 address_kana.city address_kanji.line1 address_kanji.line2 address_kanji.postal_code address_kanji.state address_kanji.town
14055 address_kanji.city address_kanji.line1 address_kanji.line2 address_kanji.postal_code address_kanji.state address_kanji.town
14056 dob.day dob.month dob.year
14057 documents.company_authorization.files documents.passport.files documents.visa.files
14058 email first_name first_name.kana first_name.kanji
14059 full_name_aliases gender id_number
14060 last_name last_name.kana last_name.kanji
14061 maiden_name metadata nationality phone political_exposure
14062 relationship.director relationship.executive relationship.owner relationship.percent_ownership relationship.representative relationship.title
14063 ssn_last_4 verification.additional_document.back verification.additional_document.front
14064 verification.document.back verification.document.front )] },
14065 pii => { fiekds => [qw( id_number )] },
14066 };
14067 $args = $self->_contract( 'token', $args ) || CORE::return( $self->pass_error );
14068 my $err = $self->_check_parameters( $okParams, $args );
14069 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
14070 my $hash = $self->post( 'tokens', $args ) || CORE::return( $self->pass_error );
14071 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Token', $hash ) );
14072 }
14073 PERL
14074 # NOTE: token_create_account()
14075 token_create_account => <<'PERL',
14076 sub token_create_account
14077 {
14078 my $self = shift( @_ );
14079 my $args = shift( @_ );
14080 my $okParams =
14081 {
14082 expandable => { allowed => $EXPANDABLES->{ 'token' } },
14083 account => { type => "object", required => 1 },
14084 };
14085 $args = $self->_contract( 'token', $args ) || CORE::return( $self->pass_error );
14086 my $err = $self->_check_parameters( $okParams, $args );
14087 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
14088 my $hash = $self->post( "tokens", $args ) || CORE::return( $self->pass_error );
14089 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Token', $hash ) );
14090 }
14091 PERL
14092 # NOTE: token_create_bank_account()
14093 token_create_bank_account => <<'PERL',
14094 sub token_create_bank_account
14095 {
14096 my $self = shift( @_ );
14097 my $args = shift( @_ );
14098 my $okParams =
14099 {
14100 expandable => { allowed => $EXPANDABLES->{ 'token' } },
14101 bank_account => { type => "hash" },
14102 customer => { type => "string" },
14103 };
14104 $args = $self->_contract( 'token', $args ) || CORE::return( $self->pass_error );
14105 my $err = $self->_check_parameters( $okParams, $args );
14106 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
14107 my $hash = $self->post( "tokens", $args ) || CORE::return( $self->pass_error );
14108 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Token', $hash ) );
14109 }
14110 PERL
14111 # NOTE: token_create_card()
14112 token_create_card => <<'PERL',
14113 sub token_create_card
14114 {
14115 my $self = shift( @_ );
14116 my $args = shift( @_ );
14117 my $okParams =
14118 {
14119 expandable => { allowed => $EXPANDABLES->{ 'token' } },
14120 card => { type => "hash" },
14121 customer => { type => "string" },
14122 };
14123 $args = $self->_contract( 'token', $args ) || CORE::return( $self->pass_error );
14124 my $err = $self->_check_parameters( $okParams, $args );
14125 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
14126 my $hash = $self->post( "tokens", $args ) || CORE::return( $self->pass_error );
14127 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Token', $hash ) );
14128 }
14129 PERL
14130 # NOTE: token_create_cvc_update()
14131 token_create_cvc_update => <<'PERL',
14132 sub token_create_cvc_update
14133 {
14134 my $self = shift( @_ );
14135 my $args = shift( @_ );
14136 my $okParams =
14137 {
14138 expandable => { allowed => $EXPANDABLES->{ 'token' } },
14139 cvc_update => { type => "object", required => 1 },
14140 };
14141 $args = $self->_contract( 'token', $args ) || CORE::return( $self->pass_error );
14142 my $err = $self->_check_parameters( $okParams, $args );
14143 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
14144 my $hash = $self->post( "tokens", $args ) || CORE::return( $self->pass_error );
14145 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Token', $hash ) );
14146 }
14147 PERL
14148 # NOTE: token_create_person()
14149 token_create_person => <<'PERL',
14150 sub token_create_person
14151 {
14152 my $self = shift( @_ );
14153 my $args = shift( @_ );
14154 my $okParams =
14155 {
14156 expandable => { allowed => $EXPANDABLES->{ 'token' } },
14157 person => { type => "object", required => 1 },
14158 };
14159 $args = $self->_contract( 'token', $args ) || CORE::return( $self->pass_error );
14160 my $err = $self->_check_parameters( $okParams, $args );
14161 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
14162 my $hash = $self->post( "tokens", $args ) || CORE::return( $self->pass_error );
14163 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Token', $hash ) );
14164 }
14165 PERL
14166 # NOTE: token_create_pii()
14167 token_create_pii => <<'PERL',
14168 sub token_create_pii
14169 {
14170 my $self = shift( @_ );
14171 my $args = shift( @_ );
14172 my $okParams =
14173 {
14174 expandable => { allowed => $EXPANDABLES->{ 'token' } },
14175 pii => { type => "object", required => 1 },
14176 };
14177 $args = $self->_contract( 'token', $args ) || CORE::return( $self->pass_error );
14178 my $err = $self->_check_parameters( $okParams, $args );
14179 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
14180 my $hash = $self->post( "tokens", $args ) || CORE::return( $self->pass_error );
14181 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Token', $hash ) );
14182 }
14183 PERL
14184 # NOTE: token_retrieve()
14185 token_retrieve => <<'PERL',
14186 sub token_retrieve
14187 {
14188 my $self = shift( @_ );
14189 CORE::return( $self->error( "No parameters were provided to retrieve token information." ) ) if( !scalar( @_ ) );
14190 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Token', @_ );
14191 my $okParams =
14192 {
14193 expandable => { allowed => $EXPANDABLES->{token} },
14194 id => { re => qr/^\w+$/, required => 1 }
14195 };
14196 my $err = $self->_check_parameters( $okParams, $args );
14197 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
14198 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No token id was provided to retrieve its information." ) );
14199 my $hash = $self->get( "tokens/${id}", $args ) || CORE::return( $self->pass_error );
14200 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Token', $hash ) );
14201 }
14202 PERL
14203 # NOTE: tokens()
14204 tokens => <<'PERL',
14205 # <https://stripe.com/docs/api/tokens>
14206 sub tokens
14207 {
14208 my $self = shift( @_ );
14209 my $allowed = [qw( create create_account create_bank_account create_card create_cvc_update create_person create_pii retrieve )];
14210 my $action = shift( @_ );
14211 my $meth = $self->_get_method( 'token', $action, $allowed ) || CORE::return( $self->pass_error );
14212 CORE::return( $self->$meth( @_ ) );
14213 }
14214 PERL
14215 # NOTE: topup()
14216 topup => <<'PERL',
14217 sub topup { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Connect::TopUp', @_ ) ); }
14218 PERL
14219 # NOTE: topup_cancel()
14220 topup_cancel => <<'PERL',
14221 sub topup_cancel
14222 {
14223 my $self = shift( @_ );
14224 my $args = shift( @_ );
14225 my $okParams =
14226 {
14227 expandable => { allowed => $EXPANDABLES->{ 'topup' } },
14228 };
14229 $args = $self->_contract( 'topup', $args ) || CORE::return( $self->pass_error );
14230 my $err = $self->_check_parameters( $okParams, $args );
14231 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
14232 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No topup id (with parameter 'id') was provided to cancel its information." ) );
14233 my $hash = $self->post( "topups/${id}", $args ) || CORE::return( $self->pass_error );
14234 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Connect::TopUp', $hash ) );
14235 }
14236 PERL
14237 # NOTE: topup_create()
14238 topup_create => <<'PERL',
14239 sub topup_create
14240 {
14241 my $self = shift( @_ );
14242 my $args = shift( @_ );
14243 my $okParams =
14244 {
14245 expandable => { allowed => $EXPANDABLES->{ 'topup' } },
14246 amount => { type => "integer", required => 1 },
14247 currency => { type => "string", required => 1 },
14248 description => { type => "string" },
14249 metadata => { type => "hash" },
14250 source => { type => "hash" },
14251 statement_descriptor => { type => "string" },
14252 transfer_group => { type => "string" },
14253 };
14254 $args = $self->_contract( 'topup', $args ) || CORE::return( $self->pass_error );
14255 my $err = $self->_check_parameters( $okParams, $args );
14256 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
14257 my $hash = $self->post( "topups", $args ) || CORE::return( $self->pass_error );
14258 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Connect::TopUp', $hash ) );
14259 }
14260 PERL
14261 # NOTE: topup_list()
14262 topup_list => <<'PERL',
14263 sub topup_list
14264 {
14265 my $self = shift( @_ );
14266 CORE::return( $self->error( "No parameters were provided to list topup information." ) ) if( !scalar( @_ ) );
14267 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Connect::TopUp', @_ );
14268 my $okParams =
14269 {
14270 expandable => { allowed => $EXPANDABLES->{ 'topup' }, data_prefix_is_ok => 1 },
14271 amount => { type => "integer" },
14272 created => { type => "timestamp" },
14273 ending_before => { type => "string" },
14274 limit => { type => "string" },
14275 starting_after => { type => "string" },
14276 status => { type => "string" },
14277 };
14278 my $err = $self->_check_parameters( $okParams, $args );
14279 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
14280 if( $args->{expand} )
14281 {
14282 $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
14283 }
14284 my $hash = $self->get( "topups", $args ) || CORE::return( $self->pass_error );
14285 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Connect::TopUp', $hash ) );
14286 }
14287 PERL
14288 # NOTE: topup_retrieve()
14289 topup_retrieve => <<'PERL',
14290 sub topup_retrieve
14291 {
14292 my $self = shift( @_ );
14293 my $args = shift( @_ );
14294 my $okParams =
14295 {
14296 expandable => { allowed => $EXPANDABLES->{ 'topup' }, data_prefix_is_ok => 1 },
14297 };
14298 $args = $self->_contract( 'topup', $args ) || CORE::return( $self->pass_error );
14299 my $err = $self->_check_parameters( $okParams, $args );
14300 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
14301 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No topup id (with parameter 'id') was provided to retrieve its information." ) );
14302 my $hash = $self->get( "topups/${id}", $args ) || CORE::return( $self->pass_error );
14303 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Connect::TopUp', $hash ) );
14304 }
14305 PERL
14306 # NOTE: topup_update()
14307 topup_update => <<'PERL',
14308 sub topup_update
14309 {
14310 my $self = shift( @_ );
14311 my $args = shift( @_ );
14312 my $okParams =
14313 {
14314 expandable => { allowed => $EXPANDABLES->{ 'topup' } },
14315 description => { type => "string" },
14316 metadata => { type => "hash" },
14317 };
14318 $args = $self->_contract( 'topup', $args ) || CORE::return( $self->pass_error );
14319 my $err = $self->_check_parameters( $okParams, $args );
14320 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
14321 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No topup id (with parameter 'id') was provided to update its information." ) );
14322 my $hash = $self->post( "topups/${id}", $args ) || CORE::return( $self->pass_error );
14323 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Connect::TopUp', $hash ) );
14324 }
14325 PERL
14326 # NOTE: topups()
14327 topups => <<'PERL',
14328 # <https://stripe.com/docs/api/topups>
14329 sub topups
14330 {
14331 my $self = shift( @_ );
14332 my $allowed = [qw( cancel create list retrieve update )];
14333 my $action = shift( @_ );
14334 my $meth = $self->_get_method( 'topup', $action, $allowed ) || CORE::return( $self->pass_error );
14335 CORE::return( $self->$meth( @_ ) );
14336 }
14337 PERL
14338 # NOTE: tos_acceptance()
14339 tos_acceptance => <<'PERL',
14340 sub tos_acceptance { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Connect::Account::TosAcceptance', @_ ) ); }
14341 PERL
14342 # NOTE: transfer()
14343 transfer => <<'PERL',
14344 sub transfer { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Connect::Transfer', @_ ) ); }
14345 PERL
14346 # NOTE: transfer_create()
14347 transfer_create => <<'PERL',
14348 sub transfer_create
14349 {
14350 my $self = shift( @_ );
14351 my $args = shift( @_ );
14352 my $okParams =
14353 {
14354 expandable => { allowed => $EXPANDABLES->{ 'transfer' } },
14355 amount => { type => "integer" },
14356 currency => { type => "string", required => 1 },
14357 description => { type => "string" },
14358 destination => { type => "string", required => 1 },
14359 metadata => { type => "hash" },
14360 source_transaction => { type => "string" },
14361 source_type => { type => "string" },
14362 transfer_group => { type => "string" },
14363 };
14364 $args = $self->_contract( 'transfer', $args ) || CORE::return( $self->pass_error );
14365 my $err = $self->_check_parameters( $okParams, $args );
14366 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
14367 my $hash = $self->post( "transfers", $args ) || CORE::return( $self->pass_error );
14368 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Connect::Transfer', $hash ) );
14369 }
14370 PERL
14371 # NOTE: transfer_data()
14372 transfer_data => <<'PERL',
14373 sub transfer_data { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Payment::Intent::TransferData', @_ ) ); }
14374 PERL
14375 # NOTE: transfer_list()
14376 transfer_list => <<'PERL',
14377 sub transfer_list
14378 {
14379 my $self = shift( @_ );
14380 CORE::return( $self->error( "No parameters were provided to list transfer information." ) ) if( !scalar( @_ ) );
14381 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Connect::Transfer', @_ );
14382 my $okParams =
14383 {
14384 expandable => { allowed => $EXPANDABLES->{ 'transfer' }, data_prefix_is_ok => 1 },
14385 created => { type => "timestamp" },
14386 destination => { type => "string" },
14387 ending_before => { type => "string" },
14388 limit => { type => "string" },
14389 starting_after => { type => "string" },
14390 transfer_group => { type => "string" },
14391 };
14392 my $err = $self->_check_parameters( $okParams, $args );
14393 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
14394 if( $args->{expand} )
14395 {
14396 $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
14397 }
14398 my $hash = $self->get( "transfers", $args ) || CORE::return( $self->pass_error );
14399 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Connect::Transfer', $hash ) );
14400 }
14401 PERL
14402 # NOTE: transfer_retrieve()
14403 transfer_retrieve => <<'PERL',
14404 sub transfer_retrieve
14405 {
14406 my $self = shift( @_ );
14407 my $args = shift( @_ );
14408 my $okParams =
14409 {
14410 expandable => { allowed => $EXPANDABLES->{ 'transfer' }, data_prefix_is_ok => 1 },
14411 };
14412 $args = $self->_contract( 'transfer', $args ) || CORE::return( $self->pass_error );
14413 my $err = $self->_check_parameters( $okParams, $args );
14414 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
14415 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No transfer id (with parameter 'id') was provided to retrieve its information." ) );
14416 my $hash = $self->get( "transfers/${id}", $args ) || CORE::return( $self->pass_error );
14417 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Connect::Transfer', $hash ) );
14418 }
14419 PERL
14420 # NOTE: transfer_reversal()
14421 transfer_reversal => <<'PERL',
14422 sub transfer_reversal { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Connect::Transfer::Reversal', @_ ) ); }
14423 PERL
14424 # NOTE: transfer_reversal_create()
14425 transfer_reversal_create => <<'PERL',
14426 sub transfer_reversal_create
14427 {
14428 my $self = shift( @_ );
14429 my $args = shift( @_ );
14430 my $okParams =
14431 {
14432 expandable => { allowed => $EXPANDABLES->{ 'transfer_reversal' } },
14433 amount => { type => "integer" },
14434 description => { type => "string" },
14435 metadata => { type => "hash" },
14436 refund_application_fee => { type => "boolean" },
14437 };
14438 $args = $self->_contract( 'transfer_reversal', $args ) || CORE::return( $self->pass_error );
14439 my $err = $self->_check_parameters( $okParams, $args );
14440 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
14441 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No transfer id (with parameter 'id') was provided to create its information." ) );
14442 my $hash = $self->post( "transfers/${id}/reversals", $args ) || CORE::return( $self->pass_error );
14443 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Connect::Transfer::Reversal', $hash ) );
14444 }
14445 PERL
14446 # NOTE: transfer_reversal_list()
14447 transfer_reversal_list => <<'PERL',
14448 sub transfer_reversal_list
14449 {
14450 my $self = shift( @_ );
14451 CORE::return( $self->error( "No parameters were provided to list transfer reversal information." ) ) if( !scalar( @_ ) );
14452 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Connect::Transfer::Reversal', @_ );
14453 my $okParams =
14454 {
14455 expandable => { allowed => $EXPANDABLES->{ 'transfer_reversal' }, data_prefix_is_ok => 1 },
14456 ending_before => { type => "string" },
14457 limit => { type => "string" },
14458 starting_after => { type => "string" },
14459 };
14460 my $err = $self->_check_parameters( $okParams, $args );
14461 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
14462 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No transfer id (with parameter 'id') was provided to list its information." ) );
14463 if( $args->{expand} )
14464 {
14465 $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
14466 }
14467 my $hash = $self->get( "transfers/${id}/reversals", $args ) || CORE::return( $self->pass_error );
14468 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Connect::Transfer::Reversal', $hash ) );
14469 }
14470 PERL
14471 # NOTE: transfer_reversal_retrieve()
14472 transfer_reversal_retrieve => <<'PERL',
14473 sub transfer_reversal_retrieve
14474 {
14475 my $self = shift( @_ );
14476 my $args = shift( @_ );
14477 my $okParams =
14478 {
14479 expandable => { allowed => $EXPANDABLES->{ 'transfer_reversal' }, data_prefix_is_ok => 1 },
14480 };
14481 $args = $self->_contract( 'transfer_reversal', $args ) || CORE::return( $self->pass_error );
14482 my $err = $self->_check_parameters( $okParams, $args );
14483 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
14484 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." ) );
14485 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No transfer_reversal id (with parameter 'id') was provided to retrieve its information." ) );
14486 my $hash = $self->get( "transfers/${parent_id}/reversals/${id}", $args ) || CORE::return( $self->pass_error );
14487 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Connect::Transfer::Reversal', $hash ) );
14488 }
14489 PERL
14490 # NOTE: transfer_reversal_update()
14491 transfer_reversal_update => <<'PERL',
14492 sub transfer_reversal_update
14493 {
14494 my $self = shift( @_ );
14495 my $args = shift( @_ );
14496 my $okParams =
14497 {
14498 expandable => { allowed => $EXPANDABLES->{ 'transfer_reversal' } },
14499 metadata => { type => "hash" },
14500 };
14501 $args = $self->_contract( 'transfer_reversal', $args ) || CORE::return( $self->pass_error );
14502 my $err = $self->_check_parameters( $okParams, $args );
14503 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
14504 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." ) );
14505 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No transfer_reversal id (with parameter 'id') was provided to update its information." ) );
14506 my $hash = $self->post( "transfers/${parent_id}/reversals/${id}", $args ) || CORE::return( $self->pass_error );
14507 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Connect::Transfer::Reversal', $hash ) );
14508 }
14509 PERL
14510 # NOTE: transfer_reversals()
14511 transfer_reversals => <<'PERL',
14512 # <https://stripe.com/docs/api/transfer_reversals>
14513 sub transfer_reversals
14514 {
14515 my $self = shift( @_ );
14516 my $allowed = [qw( create list retrieve update )];
14517 my $action = shift( @_ );
14518 my $meth = $self->_get_method( 'transfer_reversal', $action, $allowed ) || CORE::return( $self->pass_error );
14519 CORE::return( $self->$meth( @_ ) );
14520 }
14521 PERL
14522 # NOTE: transfer_update()
14523 transfer_update => <<'PERL',
14524 sub transfer_update
14525 {
14526 my $self = shift( @_ );
14527 my $args = shift( @_ );
14528 my $okParams =
14529 {
14530 expandable => { allowed => $EXPANDABLES->{ 'transfer' } },
14531 description => { type => "string" },
14532 metadata => { type => "hash" },
14533 };
14534 $args = $self->_contract( 'transfer', $args ) || CORE::return( $self->pass_error );
14535 my $err = $self->_check_parameters( $okParams, $args );
14536 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
14537 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No transfer id (with parameter 'id') was provided to update its information." ) );
14538 my $hash = $self->post( "transfers/${id}", $args ) || CORE::return( $self->pass_error );
14539 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Connect::Transfer', $hash ) );
14540 }
14541 PERL
14542 # NOTE: transfers()
14543 transfers => <<'PERL',
14544 # <https://stripe.com/docs/api/transfers>
14545 sub transfers
14546 {
14547 my $self = shift( @_ );
14548 my $allowed = [qw( create list retrieve update )];
14549 my $action = shift( @_ );
14550 my $meth = $self->_get_method( 'transfer', $action, $allowed ) || CORE::return( $self->pass_error );
14551 CORE::return( $self->$meth( @_ ) );
14552 }
14553 PERL
14554 # NOTE: transform_usage()
14555 transform_usage => <<'PERL',
14556 sub transform_usage { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Billing::Plan::TransformUsage', @_ ) ); }
14557 PERL
14558 # NOTE: treasury_credit_reversal()
14559 treasury_credit_reversal => <<'PERL',
14560 sub treasury_credit_reversal { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Treasury::CreditReversal', @_ ) ); }
14561 PERL
14562 # NOTE: treasury_credit_reversal_create()
14563 treasury_credit_reversal_create => <<'PERL',
14564 sub treasury_credit_reversal_create
14565 {
14566 my $self = shift( @_ );
14567 my $args = shift( @_ );
14568 my $okParams =
14569 {
14570 expandable => { allowed => $EXPANDABLES->{ 'treasury.credit_reversal' } },
14571 metadata => { type => "hash" },
14572 received_credit => { type => "string", required => 1 },
14573 };
14574 $args = $self->_contract( 'treasury.credit_reversal', $args ) || CORE::return( $self->pass_error );
14575 my $err = $self->_check_parameters( $okParams, $args );
14576 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
14577 my $hash = $self->post( "", $args ) || CORE::return( $self->pass_error );
14578 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Treasury::CreditReversal', $hash ) );
14579 }
14580 PERL
14581 # NOTE: treasury_credit_reversal_list()
14582 treasury_credit_reversal_list => <<'PERL',
14583 sub treasury_credit_reversal_list
14584 {
14585 my $self = shift( @_ );
14586 CORE::return( $self->error( "No parameters were provided to list treasury credit reversal information." ) ) if( !scalar( @_ ) );
14587 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Treasury::CreditReversal', @_ );
14588 my $okParams =
14589 {
14590 expandable => { allowed => $EXPANDABLES->{ 'treasury.credit_reversal' }, data_prefix_is_ok => 1 },
14591 ending_before => { type => "string" },
14592 financial_account => { type => "string", required => 1 },
14593 limit => { type => "string" },
14594 received_credit => { type => "string" },
14595 starting_after => { type => "string" },
14596 status => { type => "string" },
14597 };
14598 my $err = $self->_check_parameters( $okParams, $args );
14599 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
14600 if( $args->{expand} )
14601 {
14602 $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
14603 }
14604 my $hash = $self->get( "", $args ) || CORE::return( $self->pass_error );
14605 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Treasury::CreditReversal', $hash ) );
14606 }
14607 PERL
14608 # NOTE: treasury_credit_reversal_retrieve()
14609 treasury_credit_reversal_retrieve => <<'PERL',
14610 sub treasury_credit_reversal_retrieve
14611 {
14612 my $self = shift( @_ );
14613 my $args = shift( @_ );
14614 my $okParams =
14615 {
14616 expandable => { allowed => $EXPANDABLES->{ 'treasury.credit_reversal' }, data_prefix_is_ok => 1 },
14617 };
14618 $args = $self->_contract( 'treasury.credit_reversal', $args ) || CORE::return( $self->pass_error );
14619 my $err = $self->_check_parameters( $okParams, $args );
14620 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
14621 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No treasury.credit_reversal id (with parameter 'id') was provided to retrieve its information." ) );
14622 my $hash = $self->get( "treasury/credit_reversals/${id}", $args ) || CORE::return( $self->pass_error );
14623 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Treasury::CreditReversal', $hash ) );
14624 }
14625 PERL
14626 # NOTE: treasury_credit_reversals()
14627 treasury_credit_reversals => <<'PERL',
14628 # <https://stripe.com/docs/api/treasury/credit_reversals>
14629 sub treasury_credit_reversals
14630 {
14631 my $self = shift( @_ );
14632 my $allowed = [qw( create list retrieve )];
14633 my $action = shift( @_ );
14634 my $meth = $self->_get_method( 'treasury_credit_reversal', $action, $allowed ) || CORE::return( $self->pass_error );
14635 CORE::return( $self->$meth( @_ ) );
14636 }
14637 PERL
14638 # NOTE: treasury_debit_reversal()
14639 treasury_debit_reversal => <<'PERL',
14640 sub treasury_debit_reversal { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Treasury::DebitReversal', @_ ) ); }
14641 PERL
14642 # NOTE: treasury_debit_reversal_create()
14643 treasury_debit_reversal_create => <<'PERL',
14644 sub treasury_debit_reversal_create
14645 {
14646 my $self = shift( @_ );
14647 my $args = shift( @_ );
14648 my $okParams =
14649 {
14650 expandable => { allowed => $EXPANDABLES->{ 'treasury.debit_reversal' } },
14651 metadata => { type => "hash" },
14652 received_debit => { type => "string", required => 1 },
14653 };
14654 $args = $self->_contract( 'treasury.debit_reversal', $args ) || CORE::return( $self->pass_error );
14655 my $err = $self->_check_parameters( $okParams, $args );
14656 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
14657 my $hash = $self->post( "", $args ) || CORE::return( $self->pass_error );
14658 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Treasury::DebitReversal', $hash ) );
14659 }
14660 PERL
14661 # NOTE: treasury_debit_reversal_list()
14662 treasury_debit_reversal_list => <<'PERL',
14663 sub treasury_debit_reversal_list
14664 {
14665 my $self = shift( @_ );
14666 CORE::return( $self->error( "No parameters were provided to list treasury debit reversal information." ) ) if( !scalar( @_ ) );
14667 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Treasury::DebitReversal', @_ );
14668 my $okParams =
14669 {
14670 expandable => { allowed => $EXPANDABLES->{ 'treasury.debit_reversal' }, data_prefix_is_ok => 1 },
14671 ending_before => { type => "string" },
14672 financial_account => { type => "string", required => 1 },
14673 limit => { type => "string" },
14674 received_debit => { type => "string" },
14675 resolution => { type => "string" },
14676 starting_after => { type => "string" },
14677 status => { type => "string" },
14678 };
14679 my $err = $self->_check_parameters( $okParams, $args );
14680 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
14681 if( $args->{expand} )
14682 {
14683 $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
14684 }
14685 my $hash = $self->get( "", $args ) || CORE::return( $self->pass_error );
14686 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Treasury::DebitReversal', $hash ) );
14687 }
14688 PERL
14689 # NOTE: treasury_debit_reversal_retrieve()
14690 treasury_debit_reversal_retrieve => <<'PERL',
14691 sub treasury_debit_reversal_retrieve
14692 {
14693 my $self = shift( @_ );
14694 my $args = shift( @_ );
14695 my $okParams =
14696 {
14697 expandable => { allowed => $EXPANDABLES->{ 'treasury.debit_reversal' }, data_prefix_is_ok => 1 },
14698 };
14699 $args = $self->_contract( 'treasury.debit_reversal', $args ) || CORE::return( $self->pass_error );
14700 my $err = $self->_check_parameters( $okParams, $args );
14701 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
14702 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No treasury.debit_reversal id (with parameter 'id') was provided to retrieve its information." ) );
14703 my $hash = $self->get( "treasury/debit_reversals/${id}", $args ) || CORE::return( $self->pass_error );
14704 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Treasury::DebitReversal', $hash ) );
14705 }
14706 PERL
14707 # NOTE: treasury_debit_reversals()
14708 treasury_debit_reversals => <<'PERL',
14709 # <https://stripe.com/docs/api/treasury/debit_reversals>
14710 sub treasury_debit_reversals
14711 {
14712 my $self = shift( @_ );
14713 my $allowed = [qw( create list retrieve )];
14714 my $action = shift( @_ );
14715 my $meth = $self->_get_method( 'treasury_debit_reversal', $action, $allowed ) || CORE::return( $self->pass_error );
14716 CORE::return( $self->$meth( @_ ) );
14717 }
14718 PERL
14719 # NOTE: treasury_financial_account()
14720 treasury_financial_account => <<'PERL',
14721 sub treasury_financial_account { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Treasury::FinancialAccount', @_ ) ); }
14722 PERL
14723 # NOTE: treasury_financial_account_create()
14724 treasury_financial_account_create => <<'PERL',
14725 sub treasury_financial_account_create
14726 {
14727 my $self = shift( @_ );
14728 my $args = shift( @_ );
14729 my $okParams =
14730 {
14731 expandable => { allowed => $EXPANDABLES->{ 'treasury.financial_account' } },
14732 features => { type => "hash" },
14733 metadata => { type => "hash" },
14734 platform_restrictions => { type => "hash" },
14735 supported_currencies => { type => "array", required => 1 },
14736 };
14737 $args = $self->_contract( 'treasury.financial_account', $args ) || CORE::return( $self->pass_error );
14738 my $err = $self->_check_parameters( $okParams, $args );
14739 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
14740 my $hash = $self->post( "", $args ) || CORE::return( $self->pass_error );
14741 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Treasury::FinancialAccount', $hash ) );
14742 }
14743 PERL
14744 # NOTE: treasury_financial_account_features()
14745 treasury_financial_account_features => <<'PERL',
14746 sub treasury_financial_account_features { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Treasury::FinancialAccountFeatures', @_ ) ); }
14747 PERL
14748 # NOTE: treasury_financial_account_features_retrieve()
14749 treasury_financial_account_features_retrieve => <<'PERL',
14750 sub treasury_financial_account_features_retrieve
14751 {
14752 my $self = shift( @_ );
14753 my $args = shift( @_ );
14754 my $okParams =
14755 {
14756 expandable => { allowed => $EXPANDABLES->{ 'treasury.financial_account_features' }, data_prefix_is_ok => 1 },
14757 };
14758 $args = $self->_contract( 'treasury.financial_account_features', $args ) || CORE::return( $self->pass_error );
14759 my $err = $self->_check_parameters( $okParams, $args );
14760 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
14761 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No treasury.financial_account id (with parameter 'id') was provided to retrieve its information." ) );
14762 my $hash = $self->get( "treasury/financial_accounts/${id}/features", $args ) || CORE::return( $self->pass_error );
14763 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Treasury::FinancialAccountFeatures', $hash ) );
14764 }
14765 PERL
14766 # NOTE: treasury_financial_account_features_update()
14767 treasury_financial_account_features_update => <<'PERL',
14768 sub treasury_financial_account_features_update
14769 {
14770 my $self = shift( @_ );
14771 my $args = shift( @_ );
14772 my $okParams =
14773 {
14774 expandable => { allowed => $EXPANDABLES->{ 'treasury.financial_account_features' } },
14775 card_issuing => { type => "hash" },
14776 deposit_insurance => { type => "hash" },
14777 financial_addresses => { type => "hash" },
14778 inbound_transfers => { type => "hash" },
14779 intra_stripe_flows => { type => "hash" },
14780 outbound_payments => { type => "hash" },
14781 outbound_transfers => { type => "hash" },
14782 };
14783 $args = $self->_contract( 'treasury.financial_account_features', $args ) || CORE::return( $self->pass_error );
14784 my $err = $self->_check_parameters( $okParams, $args );
14785 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
14786 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No treasury.financial_account id (with parameter 'id') was provided to update its information." ) );
14787 my $hash = $self->post( "treasury/financial_accounts/${id}/features", $args ) || CORE::return( $self->pass_error );
14788 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Treasury::FinancialAccountFeatures', $hash ) );
14789 }
14790 PERL
14791 # NOTE: treasury_financial_account_featuress()
14792 treasury_financial_account_featuress => <<'PERL',
14793 # <https://stripe.com/docs/api/treasury/financial_account_features>
14794 sub treasury_financial_account_featuress
14795 {
14796 my $self = shift( @_ );
14797 my $allowed = [qw( retrieve update )];
14798 my $action = shift( @_ );
14799 my $meth = $self->_get_method( 'treasury_financial_account_features', $action, $allowed ) || CORE::return( $self->pass_error );
14800 CORE::return( $self->$meth( @_ ) );
14801 }
14802 PERL
14803 # NOTE: treasury_financial_account_list()
14804 treasury_financial_account_list => <<'PERL',
14805 sub treasury_financial_account_list
14806 {
14807 my $self = shift( @_ );
14808 CORE::return( $self->error( "No parameters were provided to list treasury financial account information." ) ) if( !scalar( @_ ) );
14809 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Treasury::FinancialAccount', @_ );
14810 my $okParams =
14811 {
14812 expandable => { allowed => $EXPANDABLES->{ 'treasury.financial_account' }, data_prefix_is_ok => 1 },
14813 created => { type => "timestamp" },
14814 ending_before => { type => "string" },
14815 limit => { type => "string" },
14816 starting_after => { type => "string" },
14817 };
14818 my $err = $self->_check_parameters( $okParams, $args );
14819 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
14820 if( $args->{expand} )
14821 {
14822 $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
14823 }
14824 my $hash = $self->get( "", $args ) || CORE::return( $self->pass_error );
14825 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Treasury::FinancialAccount', $hash ) );
14826 }
14827 PERL
14828 # NOTE: treasury_financial_account_retrieve()
14829 treasury_financial_account_retrieve => <<'PERL',
14830 sub treasury_financial_account_retrieve
14831 {
14832 my $self = shift( @_ );
14833 my $args = shift( @_ );
14834 my $okParams =
14835 {
14836 expandable => { allowed => $EXPANDABLES->{ 'treasury.financial_account' }, data_prefix_is_ok => 1 },
14837 };
14838 $args = $self->_contract( 'treasury.financial_account', $args ) || CORE::return( $self->pass_error );
14839 my $err = $self->_check_parameters( $okParams, $args );
14840 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
14841 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No treasury.financial_account id (with parameter 'id') was provided to retrieve its information." ) );
14842 my $hash = $self->get( "treasury/financial_accounts/${id}", $args ) || CORE::return( $self->pass_error );
14843 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Treasury::FinancialAccount', $hash ) );
14844 }
14845 PERL
14846 # NOTE: treasury_financial_account_update()
14847 treasury_financial_account_update => <<'PERL',
14848 sub treasury_financial_account_update
14849 {
14850 my $self = shift( @_ );
14851 my $args = shift( @_ );
14852 my $okParams =
14853 {
14854 expandable => { allowed => $EXPANDABLES->{ 'treasury.financial_account' } },
14855 features => { type => "hash" },
14856 metadata => { type => "hash" },
14857 platform_restrictions => { type => "hash" },
14858 };
14859 $args = $self->_contract( 'treasury.financial_account', $args ) || CORE::return( $self->pass_error );
14860 my $err = $self->_check_parameters( $okParams, $args );
14861 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
14862 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No treasury.financial_account id (with parameter 'id') was provided to update its information." ) );
14863 my $hash = $self->post( "treasury/financial_accounts/${id}", $args ) || CORE::return( $self->pass_error );
14864 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Treasury::FinancialAccount', $hash ) );
14865 }
14866 PERL
14867 # NOTE: treasury_financial_accounts()
14868 treasury_financial_accounts => <<'PERL',
14869 # <https://stripe.com/docs/api/treasury/financial_accounts>
14870 sub treasury_financial_accounts
14871 {
14872 my $self = shift( @_ );
14873 my $allowed = [qw( create list retrieve update )];
14874 my $action = shift( @_ );
14875 my $meth = $self->_get_method( 'treasury_financial_account', $action, $allowed ) || CORE::return( $self->pass_error );
14876 CORE::return( $self->$meth( @_ ) );
14877 }
14878 PERL
14879 # NOTE: treasury_inbound_transfer()
14880 treasury_inbound_transfer => <<'PERL',
14881 sub treasury_inbound_transfer { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Treasury::InboundTransfer', @_ ) ); }
14882 PERL
14883 # NOTE: treasury_inbound_transfer_cancel()
14884 treasury_inbound_transfer_cancel => <<'PERL',
14885 sub treasury_inbound_transfer_cancel
14886 {
14887 my $self = shift( @_ );
14888 my $args = shift( @_ );
14889 my $okParams =
14890 {
14891 expandable => { allowed => $EXPANDABLES->{ 'treasury.inbound_transfer' } },
14892 };
14893 $args = $self->_contract( 'treasury.inbound_transfer', $args ) || CORE::return( $self->pass_error );
14894 my $err = $self->_check_parameters( $okParams, $args );
14895 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
14896 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No treasury.inbound_transfer id (with parameter 'id') was provided to cancel its information." ) );
14897 my $hash = $self->post( "treasury/inbound_transfers/${id}", $args ) || CORE::return( $self->pass_error );
14898 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Treasury::InboundTransfer', $hash ) );
14899 }
14900 PERL
14901 # NOTE: treasury_inbound_transfer_create()
14902 treasury_inbound_transfer_create => <<'PERL',
14903 sub treasury_inbound_transfer_create
14904 {
14905 my $self = shift( @_ );
14906 my $args = shift( @_ );
14907 my $okParams =
14908 {
14909 expandable => { allowed => $EXPANDABLES->{ 'treasury.inbound_transfer' } },
14910 amount => { type => "integer", required => 1 },
14911 currency => { type => "string", required => 1 },
14912 description => { type => "string" },
14913 financial_account => { type => "string", required => 1 },
14914 metadata => { type => "hash" },
14915 origin_payment_method => { type => "string", required => 1 },
14916 statement_descriptor => { type => "string" },
14917 };
14918 $args = $self->_contract( 'treasury.inbound_transfer', $args ) || CORE::return( $self->pass_error );
14919 my $err = $self->_check_parameters( $okParams, $args );
14920 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
14921 my $hash = $self->post( "", $args ) || CORE::return( $self->pass_error );
14922 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Treasury::InboundTransfer', $hash ) );
14923 }
14924 PERL
14925 # NOTE: treasury_inbound_transfer_fail()
14926 treasury_inbound_transfer_fail => <<'PERL',
14927 sub treasury_inbound_transfer_fail
14928 {
14929 my $self = shift( @_ );
14930 my $args = shift( @_ );
14931 my $okParams =
14932 {
14933 expandable => { allowed => $EXPANDABLES->{ 'treasury.inbound_transfer' } },
14934 failure_details => { type => "hash" },
14935 };
14936 $args = $self->_contract( 'treasury.inbound_transfer', $args ) || CORE::return( $self->pass_error );
14937 my $err = $self->_check_parameters( $okParams, $args );
14938 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
14939 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No treasury.inbound_transfer id (with parameter 'id') was provided to fail its information." ) );
14940 my $hash = $self->post( "test_helpers/treasury/inbound_transfers/${id}", $args ) || CORE::return( $self->pass_error );
14941 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Treasury::InboundTransfer', $hash ) );
14942 }
14943 PERL
14944 # NOTE: treasury_inbound_transfer_list()
14945 treasury_inbound_transfer_list => <<'PERL',
14946 sub treasury_inbound_transfer_list
14947 {
14948 my $self = shift( @_ );
14949 CORE::return( $self->error( "No parameters were provided to list treasury inbound transfer information." ) ) if( !scalar( @_ ) );
14950 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Treasury::InboundTransfer', @_ );
14951 my $okParams =
14952 {
14953 expandable => { allowed => $EXPANDABLES->{ 'treasury.inbound_transfer' }, data_prefix_is_ok => 1 },
14954 ending_before => { type => "string" },
14955 financial_account => { type => "string", required => 1 },
14956 limit => { type => "string" },
14957 starting_after => { type => "string" },
14958 status => { type => "string" },
14959 };
14960 my $err = $self->_check_parameters( $okParams, $args );
14961 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
14962 if( $args->{expand} )
14963 {
14964 $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
14965 }
14966 my $hash = $self->get( "", $args ) || CORE::return( $self->pass_error );
14967 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Treasury::InboundTransfer', $hash ) );
14968 }
14969 PERL
14970 # NOTE: treasury_inbound_transfer_retrieve()
14971 treasury_inbound_transfer_retrieve => <<'PERL',
14972 sub treasury_inbound_transfer_retrieve
14973 {
14974 my $self = shift( @_ );
14975 my $args = shift( @_ );
14976 my $okParams =
14977 {
14978 expandable => { allowed => $EXPANDABLES->{ 'treasury.inbound_transfer' }, data_prefix_is_ok => 1 },
14979 };
14980 $args = $self->_contract( 'treasury.inbound_transfer', $args ) || CORE::return( $self->pass_error );
14981 my $err = $self->_check_parameters( $okParams, $args );
14982 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
14983 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No treasury.inbound_transfer id (with parameter 'id') was provided to retrieve its information." ) );
14984 my $hash = $self->get( "treasury/inbound_transfers/${id}", $args ) || CORE::return( $self->pass_error );
14985 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Treasury::InboundTransfer', $hash ) );
14986 }
14987 PERL
14988 # NOTE: treasury_inbound_transfer_return()
14989 treasury_inbound_transfer_return => <<'PERL',
14990 sub treasury_inbound_transfer_return
14991 {
14992 my $self = shift( @_ );
14993 my $args = shift( @_ );
14994 my $okParams =
14995 {
14996 expandable => { allowed => $EXPANDABLES->{ 'treasury.inbound_transfer' } },
14997 };
14998 $args = $self->_contract( 'treasury.inbound_transfer', $args ) || CORE::return( $self->pass_error );
14999 my $err = $self->_check_parameters( $okParams, $args );
15000 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
15001 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No treasury.inbound_transfer id (with parameter 'id') was provided to return its information." ) );
15002 my $hash = $self->post( "test_helpers/treasury/inbound_transfers/${id}", $args ) || CORE::return( $self->pass_error );
15003 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Treasury::InboundTransfer', $hash ) );
15004 }
15005 PERL
15006 # NOTE: treasury_inbound_transfer_succeed()
15007 treasury_inbound_transfer_succeed => <<'PERL',
15008 sub treasury_inbound_transfer_succeed
15009 {
15010 my $self = shift( @_ );
15011 my $args = shift( @_ );
15012 my $okParams =
15013 {
15014 expandable => { allowed => $EXPANDABLES->{ 'treasury.inbound_transfer' } },
15015 };
15016 $args = $self->_contract( 'treasury.inbound_transfer', $args ) || CORE::return( $self->pass_error );
15017 my $err = $self->_check_parameters( $okParams, $args );
15018 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
15019 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No treasury.inbound_transfer id (with parameter 'id') was provided to succeed its information." ) );
15020 my $hash = $self->post( "test_helpers/treasury/inbound_transfers/${id}", $args ) || CORE::return( $self->pass_error );
15021 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Treasury::InboundTransfer', $hash ) );
15022 }
15023 PERL
15024 # NOTE: treasury_inbound_transfers()
15025 treasury_inbound_transfers => <<'PERL',
15026 # <https://stripe.com/docs/api/treasury/inbound_transfers>
15027 sub treasury_inbound_transfers
15028 {
15029 my $self = shift( @_ );
15030 my $allowed = [qw( cancel create fail list retrieve return succeed )];
15031 my $action = shift( @_ );
15032 my $meth = $self->_get_method( 'treasury_inbound_transfer', $action, $allowed ) || CORE::return( $self->pass_error );
15033 CORE::return( $self->$meth( @_ ) );
15034 }
15035 PERL
15036 # NOTE: treasury_outbound_payment()
15037 treasury_outbound_payment => <<'PERL',
15038 sub treasury_outbound_payment { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Treasury::OutboundPayment', @_ ) ); }
15039 PERL
15040 # NOTE: treasury_outbound_payment_cancel()
15041 treasury_outbound_payment_cancel => <<'PERL',
15042 sub treasury_outbound_payment_cancel
15043 {
15044 my $self = shift( @_ );
15045 my $args = shift( @_ );
15046 my $okParams =
15047 {
15048 expandable => { allowed => $EXPANDABLES->{ 'treasury.outbound_payment' } },
15049 };
15050 $args = $self->_contract( 'treasury.outbound_payment', $args ) || CORE::return( $self->pass_error );
15051 my $err = $self->_check_parameters( $okParams, $args );
15052 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
15053 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No treasury.outbound_payment id (with parameter 'id') was provided to cancel its information." ) );
15054 my $hash = $self->post( "treasury/outbound_payments/${id}", $args ) || CORE::return( $self->pass_error );
15055 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Treasury::OutboundPayment', $hash ) );
15056 }
15057 PERL
15058 # NOTE: treasury_outbound_payment_create()
15059 treasury_outbound_payment_create => <<'PERL',
15060 sub treasury_outbound_payment_create
15061 {
15062 my $self = shift( @_ );
15063 my $args = shift( @_ );
15064 my $okParams =
15065 {
15066 expandable => { allowed => $EXPANDABLES->{ 'treasury.outbound_payment' } },
15067 amount => { type => "integer", required => 1 },
15068 currency => { type => "string", required => 1 },
15069 customer => { type => "string" },
15070 description => { type => "string" },
15071 destination_payment_method => { type => "string" },
15072 destination_payment_method_data => { type => "object" },
15073 destination_payment_method_options => { type => "object" },
15074 end_user_details => { type => "hash" },
15075 financial_account => { type => "string", required => 1 },
15076 metadata => { type => "hash" },
15077 statement_descriptor => { type => "string" },
15078 };
15079 $args = $self->_contract( 'treasury.outbound_payment', $args ) || CORE::return( $self->pass_error );
15080 my $err = $self->_check_parameters( $okParams, $args );
15081 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
15082 my $hash = $self->post( "", $args ) || CORE::return( $self->pass_error );
15083 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Treasury::OutboundPayment', $hash ) );
15084 }
15085 PERL
15086 # NOTE: treasury_outbound_payment_fail()
15087 treasury_outbound_payment_fail => <<'PERL',
15088 sub treasury_outbound_payment_fail
15089 {
15090 my $self = shift( @_ );
15091 my $args = shift( @_ );
15092 my $okParams =
15093 {
15094 expandable => { allowed => $EXPANDABLES->{ 'treasury.outbound_payment' } },
15095 };
15096 $args = $self->_contract( 'treasury.outbound_payment', $args ) || CORE::return( $self->pass_error );
15097 my $err = $self->_check_parameters( $okParams, $args );
15098 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
15099 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No treasury.outbound_payment id (with parameter 'id') was provided to fail its information." ) );
15100 my $hash = $self->post( "test_helpers/treasury/outbound_payments/${id}", $args ) || CORE::return( $self->pass_error );
15101 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Treasury::OutboundPayment', $hash ) );
15102 }
15103 PERL
15104 # NOTE: treasury_outbound_payment_list()
15105 treasury_outbound_payment_list => <<'PERL',
15106 sub treasury_outbound_payment_list
15107 {
15108 my $self = shift( @_ );
15109 CORE::return( $self->error( "No parameters were provided to list treasury outbound payment information." ) ) if( !scalar( @_ ) );
15110 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Treasury::OutboundPayment', @_ );
15111 my $okParams =
15112 {
15113 expandable => { allowed => $EXPANDABLES->{ 'treasury.outbound_payment' }, data_prefix_is_ok => 1 },
15114 customer => { type => "string" },
15115 ending_before => { type => "string" },
15116 financial_account => { type => "string", required => 1 },
15117 limit => { type => "string" },
15118 starting_after => { type => "string" },
15119 status => { type => "string" },
15120 };
15121 my $err = $self->_check_parameters( $okParams, $args );
15122 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
15123 if( $args->{expand} )
15124 {
15125 $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
15126 }
15127 my $hash = $self->get( "", $args ) || CORE::return( $self->pass_error );
15128 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Treasury::OutboundPayment', $hash ) );
15129 }
15130 PERL
15131 # NOTE: treasury_outbound_payment_post()
15132 treasury_outbound_payment_post => <<'PERL',
15133 sub treasury_outbound_payment_post
15134 {
15135 my $self = shift( @_ );
15136 my $args = shift( @_ );
15137 my $okParams =
15138 {
15139 expandable => { allowed => $EXPANDABLES->{ 'treasury.outbound_payment' } },
15140 };
15141 $args = $self->_contract( 'treasury.outbound_payment', $args ) || CORE::return( $self->pass_error );
15142 my $err = $self->_check_parameters( $okParams, $args );
15143 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
15144 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No treasury.outbound_payment id (with parameter 'id') was provided to post its information." ) );
15145 my $hash = $self->post( "test_helpers/treasury/outbound_payments/${id}", $args ) || CORE::return( $self->pass_error );
15146 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Treasury::OutboundPayment', $hash ) );
15147 }
15148 PERL
15149 # NOTE: treasury_outbound_payment_retrieve()
15150 treasury_outbound_payment_retrieve => <<'PERL',
15151 sub treasury_outbound_payment_retrieve
15152 {
15153 my $self = shift( @_ );
15154 my $args = shift( @_ );
15155 my $okParams =
15156 {
15157 expandable => { allowed => $EXPANDABLES->{ 'treasury.outbound_payment' }, data_prefix_is_ok => 1 },
15158 };
15159 $args = $self->_contract( 'treasury.outbound_payment', $args ) || CORE::return( $self->pass_error );
15160 my $err = $self->_check_parameters( $okParams, $args );
15161 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
15162 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No treasury.outbound_payment id (with parameter 'id') was provided to retrieve its information." ) );
15163 my $hash = $self->get( "treasury/outbound_payments/${id}", $args ) || CORE::return( $self->pass_error );
15164 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Treasury::OutboundPayment', $hash ) );
15165 }
15166 PERL
15167 # NOTE: treasury_outbound_payment_return()
15168 treasury_outbound_payment_return => <<'PERL',
15169 sub treasury_outbound_payment_return
15170 {
15171 my $self = shift( @_ );
15172 my $args = shift( @_ );
15173 my $okParams =
15174 {
15175 expandable => { allowed => $EXPANDABLES->{ 'treasury.outbound_payment' } },
15176 returned_details => { type => "hash" },
15177 };
15178 $args = $self->_contract( 'treasury.outbound_payment', $args ) || CORE::return( $self->pass_error );
15179 my $err = $self->_check_parameters( $okParams, $args );
15180 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
15181 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No treasury.outbound_payment id (with parameter 'id') was provided to return its information." ) );
15182 my $hash = $self->post( "test_helpers/treasury/outbound_payments/${id}", $args ) || CORE::return( $self->pass_error );
15183 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Treasury::OutboundPayment', $hash ) );
15184 }
15185 PERL
15186 # NOTE: treasury_outbound_payments()
15187 treasury_outbound_payments => <<'PERL',
15188 # <https://stripe.com/docs/api/treasury/outbound_payments>
15189 sub treasury_outbound_payments
15190 {
15191 my $self = shift( @_ );
15192 my $allowed = [qw( cancel create fail list post retrieve return )];
15193 my $action = shift( @_ );
15194 my $meth = $self->_get_method( 'treasury_outbound_payment', $action, $allowed ) || CORE::return( $self->pass_error );
15195 CORE::return( $self->$meth( @_ ) );
15196 }
15197 PERL
15198 # NOTE: treasury_outbound_transfer()
15199 treasury_outbound_transfer => <<'PERL',
15200 sub treasury_outbound_transfer { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Treasury::OutboundTransfer', @_ ) ); }
15201 PERL
15202 # NOTE: treasury_outbound_transfer_cancel()
15203 treasury_outbound_transfer_cancel => <<'PERL',
15204 sub treasury_outbound_transfer_cancel
15205 {
15206 my $self = shift( @_ );
15207 my $args = shift( @_ );
15208 my $okParams =
15209 {
15210 expandable => { allowed => $EXPANDABLES->{ 'treasury.outbound_transfer' } },
15211 };
15212 $args = $self->_contract( 'treasury.outbound_transfer', $args ) || CORE::return( $self->pass_error );
15213 my $err = $self->_check_parameters( $okParams, $args );
15214 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
15215 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No treasury.outbound_transfer id (with parameter 'id') was provided to cancel its information." ) );
15216 my $hash = $self->post( "treasury/outbound_transfers/${id}", $args ) || CORE::return( $self->pass_error );
15217 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Treasury::OutboundTransfer', $hash ) );
15218 }
15219 PERL
15220 # NOTE: treasury_outbound_transfer_create()
15221 treasury_outbound_transfer_create => <<'PERL',
15222 sub treasury_outbound_transfer_create
15223 {
15224 my $self = shift( @_ );
15225 my $args = shift( @_ );
15226 my $okParams =
15227 {
15228 expandable => { allowed => $EXPANDABLES->{ 'treasury.outbound_transfer' } },
15229 amount => { type => "integer", required => 1 },
15230 currency => { type => "string", required => 1 },
15231 description => { type => "string" },
15232 destination_payment_method => { type => "string" },
15233 destination_payment_method_options => { type => "object" },
15234 financial_account => { type => "string", required => 1 },
15235 metadata => { type => "hash" },
15236 statement_descriptor => { type => "string" },
15237 };
15238 $args = $self->_contract( 'treasury.outbound_transfer', $args ) || CORE::return( $self->pass_error );
15239 my $err = $self->_check_parameters( $okParams, $args );
15240 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
15241 my $hash = $self->post( "", $args ) || CORE::return( $self->pass_error );
15242 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Treasury::OutboundTransfer', $hash ) );
15243 }
15244 PERL
15245 # NOTE: treasury_outbound_transfer_fail()
15246 treasury_outbound_transfer_fail => <<'PERL',
15247 sub treasury_outbound_transfer_fail
15248 {
15249 my $self = shift( @_ );
15250 my $args = shift( @_ );
15251 my $okParams =
15252 {
15253 expandable => { allowed => $EXPANDABLES->{ 'treasury.outbound_transfer' } },
15254 };
15255 $args = $self->_contract( 'treasury.outbound_transfer', $args ) || CORE::return( $self->pass_error );
15256 my $err = $self->_check_parameters( $okParams, $args );
15257 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
15258 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No treasury.outbound_transfer id (with parameter 'id') was provided to fail its information." ) );
15259 my $hash = $self->post( "test_helpers/treasury/outbound_transfers/${id}", $args ) || CORE::return( $self->pass_error );
15260 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Treasury::OutboundTransfer', $hash ) );
15261 }
15262 PERL
15263 # NOTE: treasury_outbound_transfer_list()
15264 treasury_outbound_transfer_list => <<'PERL',
15265 sub treasury_outbound_transfer_list
15266 {
15267 my $self = shift( @_ );
15268 CORE::return( $self->error( "No parameters were provided to list treasury outbound transfer information." ) ) if( !scalar( @_ ) );
15269 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Treasury::OutboundTransfer', @_ );
15270 my $okParams =
15271 {
15272 expandable => { allowed => $EXPANDABLES->{ 'treasury.outbound_transfer' }, data_prefix_is_ok => 1 },
15273 ending_before => { type => "string" },
15274 financial_account => { type => "string", required => 1 },
15275 limit => { type => "string" },
15276 starting_after => { type => "string" },
15277 status => { type => "string" },
15278 };
15279 my $err = $self->_check_parameters( $okParams, $args );
15280 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
15281 if( $args->{expand} )
15282 {
15283 $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
15284 }
15285 my $hash = $self->get( "", $args ) || CORE::return( $self->pass_error );
15286 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Treasury::OutboundTransfer', $hash ) );
15287 }
15288 PERL
15289 # NOTE: treasury_outbound_transfer_post()
15290 treasury_outbound_transfer_post => <<'PERL',
15291 sub treasury_outbound_transfer_post
15292 {
15293 my $self = shift( @_ );
15294 my $args = shift( @_ );
15295 my $okParams =
15296 {
15297 expandable => { allowed => $EXPANDABLES->{ 'treasury.outbound_transfer' } },
15298 };
15299 $args = $self->_contract( 'treasury.outbound_transfer', $args ) || CORE::return( $self->pass_error );
15300 my $err = $self->_check_parameters( $okParams, $args );
15301 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
15302 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No treasury.outbound_transfer id (with parameter 'id') was provided to post its information." ) );
15303 my $hash = $self->post( "test_helpers/treasury/outbound_transfers/${id}", $args ) || CORE::return( $self->pass_error );
15304 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Treasury::OutboundTransfer', $hash ) );
15305 }
15306 PERL
15307 # NOTE: treasury_outbound_transfer_retrieve()
15308 treasury_outbound_transfer_retrieve => <<'PERL',
15309 sub treasury_outbound_transfer_retrieve
15310 {
15311 my $self = shift( @_ );
15312 my $args = shift( @_ );
15313 my $okParams =
15314 {
15315 expandable => { allowed => $EXPANDABLES->{ 'treasury.outbound_transfer' }, data_prefix_is_ok => 1 },
15316 };
15317 $args = $self->_contract( 'treasury.outbound_transfer', $args ) || CORE::return( $self->pass_error );
15318 my $err = $self->_check_parameters( $okParams, $args );
15319 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
15320 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No treasury.outbound_transfer id (with parameter 'id') was provided to retrieve its information." ) );
15321 my $hash = $self->get( "treasury/outbound_transfers/${id}", $args ) || CORE::return( $self->pass_error );
15322 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Treasury::OutboundTransfer', $hash ) );
15323 }
15324 PERL
15325 # NOTE: treasury_outbound_transfer_return()
15326 treasury_outbound_transfer_return => <<'PERL',
15327 sub treasury_outbound_transfer_return
15328 {
15329 my $self = shift( @_ );
15330 my $args = shift( @_ );
15331 my $okParams =
15332 {
15333 expandable => { allowed => $EXPANDABLES->{ 'treasury.outbound_transfer' } },
15334 returned_details => { type => "hash" },
15335 };
15336 $args = $self->_contract( 'treasury.outbound_transfer', $args ) || CORE::return( $self->pass_error );
15337 my $err = $self->_check_parameters( $okParams, $args );
15338 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
15339 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No treasury.outbound_transfer id (with parameter 'id') was provided to return its information." ) );
15340 my $hash = $self->post( "test_helpers/treasury/outbound_transfers/${id}", $args ) || CORE::return( $self->pass_error );
15341 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Treasury::OutboundTransfer', $hash ) );
15342 }
15343 PERL
15344 # NOTE: treasury_outbound_transfers()
15345 treasury_outbound_transfers => <<'PERL',
15346 # <https://stripe.com/docs/api/treasury/outbound_transfers>
15347 sub treasury_outbound_transfers
15348 {
15349 my $self = shift( @_ );
15350 my $allowed = [qw( cancel create fail list post retrieve return )];
15351 my $action = shift( @_ );
15352 my $meth = $self->_get_method( 'treasury_outbound_transfer', $action, $allowed ) || CORE::return( $self->pass_error );
15353 CORE::return( $self->$meth( @_ ) );
15354 }
15355 PERL
15356 # NOTE: treasury_received_credit()
15357 treasury_received_credit => <<'PERL',
15358 sub treasury_received_credit { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Treasury::ReceivedCredit', @_ ) ); }
15359 PERL
15360 # NOTE: treasury_received_credit_list()
15361 treasury_received_credit_list => <<'PERL',
15362 sub treasury_received_credit_list
15363 {
15364 my $self = shift( @_ );
15365 CORE::return( $self->error( "No parameters were provided to list treasury received credit information." ) ) if( !scalar( @_ ) );
15366 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Treasury::ReceivedCredit', @_ );
15367 my $okParams =
15368 {
15369 expandable => { allowed => $EXPANDABLES->{ 'treasury.received_credit' }, data_prefix_is_ok => 1 },
15370 ending_before => { type => "string" },
15371 financial_account => { type => "string", required => 1 },
15372 limit => { type => "string" },
15373 linked_flows => { type => "hash" },
15374 starting_after => { type => "string" },
15375 status => { type => "string" },
15376 };
15377 my $err = $self->_check_parameters( $okParams, $args );
15378 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
15379 if( $args->{expand} )
15380 {
15381 $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
15382 }
15383 my $hash = $self->get( "", $args ) || CORE::return( $self->pass_error );
15384 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Treasury::ReceivedCredit', $hash ) );
15385 }
15386 PERL
15387 # NOTE: treasury_received_credit_received_credit()
15388 treasury_received_credit_received_credit => <<'PERL',
15389 sub treasury_received_credit_received_credit
15390 {
15391 my $self = shift( @_ );
15392 my $args = shift( @_ );
15393 my $okParams =
15394 {
15395 expandable => { allowed => $EXPANDABLES->{ 'treasury.received_credit' } },
15396 amount => { type => "integer", required => 1 },
15397 currency => { type => "string", required => 1 },
15398 description => { type => "string" },
15399 financial_account => { type => "string", required => 1 },
15400 initiating_payment_method_details => { type => "hash" },
15401 network => { type => "string", required => 1 },
15402 };
15403 $args = $self->_contract( 'treasury.received_credit', $args ) || CORE::return( $self->pass_error );
15404 my $err = $self->_check_parameters( $okParams, $args );
15405 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
15406 my $hash = $self->post( "test_helpers/treasury/received_credits", $args ) || CORE::return( $self->pass_error );
15407 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Treasury::ReceivedCredit', $hash ) );
15408 }
15409 PERL
15410 # NOTE: treasury_received_credit_retrieve()
15411 treasury_received_credit_retrieve => <<'PERL',
15412 sub treasury_received_credit_retrieve
15413 {
15414 my $self = shift( @_ );
15415 my $args = shift( @_ );
15416 my $okParams =
15417 {
15418 expandable => { allowed => $EXPANDABLES->{ 'treasury.received_credit' }, data_prefix_is_ok => 1 },
15419 };
15420 $args = $self->_contract( 'treasury.received_credit', $args ) || CORE::return( $self->pass_error );
15421 my $err = $self->_check_parameters( $okParams, $args );
15422 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
15423 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No treasury.received_credit id (with parameter 'id') was provided to retrieve its information." ) );
15424 my $hash = $self->get( "treasury/received_credits/${id}", $args ) || CORE::return( $self->pass_error );
15425 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Treasury::ReceivedCredit', $hash ) );
15426 }
15427 PERL
15428 # NOTE: treasury_received_credits()
15429 treasury_received_credits => <<'PERL',
15430 # <https://stripe.com/docs/api/treasury/received_credits>
15431 sub treasury_received_credits
15432 {
15433 my $self = shift( @_ );
15434 my $allowed = [qw( list received_credit retrieve )];
15435 my $action = shift( @_ );
15436 my $meth = $self->_get_method( 'treasury_received_credit', $action, $allowed ) || CORE::return( $self->pass_error );
15437 CORE::return( $self->$meth( @_ ) );
15438 }
15439 PERL
15440 # NOTE: treasury_received_debit()
15441 treasury_received_debit => <<'PERL',
15442 sub treasury_received_debit { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Treasury::ReceivedDebit', @_ ) ); }
15443 PERL
15444 # NOTE: treasury_received_debit_list()
15445 treasury_received_debit_list => <<'PERL',
15446 sub treasury_received_debit_list
15447 {
15448 my $self = shift( @_ );
15449 CORE::return( $self->error( "No parameters were provided to list treasury received debit information." ) ) if( !scalar( @_ ) );
15450 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Treasury::ReceivedDebit', @_ );
15451 my $okParams =
15452 {
15453 expandable => { allowed => $EXPANDABLES->{ 'treasury.received_debit' }, data_prefix_is_ok => 1 },
15454 ending_before => { type => "string" },
15455 financial_account => { type => "string", required => 1 },
15456 limit => { type => "string" },
15457 starting_after => { type => "string" },
15458 status => { type => "string" },
15459 };
15460 my $err = $self->_check_parameters( $okParams, $args );
15461 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
15462 if( $args->{expand} )
15463 {
15464 $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
15465 }
15466 my $hash = $self->get( "", $args ) || CORE::return( $self->pass_error );
15467 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Treasury::ReceivedDebit', $hash ) );
15468 }
15469 PERL
15470 # NOTE: treasury_received_debit_received_debit()
15471 treasury_received_debit_received_debit => <<'PERL',
15472 sub treasury_received_debit_received_debit
15473 {
15474 my $self = shift( @_ );
15475 my $args = shift( @_ );
15476 my $okParams =
15477 {
15478 expandable => { allowed => $EXPANDABLES->{ 'treasury.received_debit' } },
15479 amount => { type => "integer", required => 1 },
15480 currency => { type => "string", required => 1 },
15481 description => { type => "string" },
15482 financial_account => { type => "string", required => 1 },
15483 initiating_payment_method_details => { type => "hash" },
15484 network => { type => "string", required => 1 },
15485 };
15486 $args = $self->_contract( 'treasury.received_debit', $args ) || CORE::return( $self->pass_error );
15487 my $err = $self->_check_parameters( $okParams, $args );
15488 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
15489 my $hash = $self->post( "test_helpers/treasury/received_debits", $args ) || CORE::return( $self->pass_error );
15490 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Treasury::ReceivedDebit', $hash ) );
15491 }
15492 PERL
15493 # NOTE: treasury_received_debit_retrieve()
15494 treasury_received_debit_retrieve => <<'PERL',
15495 sub treasury_received_debit_retrieve
15496 {
15497 my $self = shift( @_ );
15498 my $args = shift( @_ );
15499 my $okParams =
15500 {
15501 expandable => { allowed => $EXPANDABLES->{ 'treasury.received_debit' }, data_prefix_is_ok => 1 },
15502 };
15503 $args = $self->_contract( 'treasury.received_debit', $args ) || CORE::return( $self->pass_error );
15504 my $err = $self->_check_parameters( $okParams, $args );
15505 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
15506 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No treasury.received_debit id (with parameter 'id') was provided to retrieve its information." ) );
15507 my $hash = $self->get( "treasury/received_debits/${id}", $args ) || CORE::return( $self->pass_error );
15508 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Treasury::ReceivedDebit', $hash ) );
15509 }
15510 PERL
15511 # NOTE: treasury_received_debits()
15512 treasury_received_debits => <<'PERL',
15513 # <https://stripe.com/docs/api/treasury/received_debits>
15514 sub treasury_received_debits
15515 {
15516 my $self = shift( @_ );
15517 my $allowed = [qw( list received_debit retrieve )];
15518 my $action = shift( @_ );
15519 my $meth = $self->_get_method( 'treasury_received_debit', $action, $allowed ) || CORE::return( $self->pass_error );
15520 CORE::return( $self->$meth( @_ ) );
15521 }
15522 PERL
15523 # NOTE: treasury_transaction()
15524 treasury_transaction => <<'PERL',
15525 sub treasury_transaction { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Treasury::Transaction', @_ ) ); }
15526 PERL
15527 # NOTE: treasury_transaction_entry()
15528 treasury_transaction_entry => <<'PERL',
15529 sub treasury_transaction_entry { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Treasury::TransactionEntry', @_ ) ); }
15530 PERL
15531 # NOTE: treasury_transaction_entry_list()
15532 treasury_transaction_entry_list => <<'PERL',
15533 sub treasury_transaction_entry_list
15534 {
15535 my $self = shift( @_ );
15536 CORE::return( $self->error( "No parameters were provided to list treasury transaction entry information." ) ) if( !scalar( @_ ) );
15537 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Treasury::TransactionEntry', @_ );
15538 my $okParams =
15539 {
15540 expandable => { allowed => $EXPANDABLES->{ 'treasury.transaction_entry' }, data_prefix_is_ok => 1 },
15541 created => { type => "timestamp" },
15542 effective_at => { type => "timestamp" },
15543 ending_before => { type => "string" },
15544 financial_account => { type => "string", required => 1 },
15545 limit => { type => "string" },
15546 order_by => { type => "string" },
15547 starting_after => { type => "string" },
15548 transaction => { type => "string" },
15549 };
15550 my $err = $self->_check_parameters( $okParams, $args );
15551 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
15552 if( $args->{expand} )
15553 {
15554 $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
15555 }
15556 my $hash = $self->get( "treasury/transaction_entries", $args ) || CORE::return( $self->pass_error );
15557 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Treasury::TransactionEntry', $hash ) );
15558 }
15559 PERL
15560 # NOTE: treasury_transaction_entry_retrieve()
15561 treasury_transaction_entry_retrieve => <<'PERL',
15562 sub treasury_transaction_entry_retrieve
15563 {
15564 my $self = shift( @_ );
15565 my $args = shift( @_ );
15566 my $okParams =
15567 {
15568 expandable => { allowed => $EXPANDABLES->{ 'treasury.transaction_entry' }, data_prefix_is_ok => 1 },
15569 };
15570 $args = $self->_contract( 'treasury.transaction_entry', $args ) || CORE::return( $self->pass_error );
15571 my $err = $self->_check_parameters( $okParams, $args );
15572 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
15573 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No treasury.transaction_entry id (with parameter 'id') was provided to retrieve its information." ) );
15574 my $hash = $self->get( "treasury/transaction_entries/${id}", $args ) || CORE::return( $self->pass_error );
15575 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Treasury::TransactionEntry', $hash ) );
15576 }
15577 PERL
15578 # NOTE: treasury_transaction_entrys()
15579 treasury_transaction_entrys => <<'PERL',
15580 # <https://stripe.com/docs/api/treasury/transaction_entries>
15581 sub treasury_transaction_entrys
15582 {
15583 my $self = shift( @_ );
15584 my $allowed = [qw( list retrieve )];
15585 my $action = shift( @_ );
15586 my $meth = $self->_get_method( 'treasury_transaction_entry', $action, $allowed ) || CORE::return( $self->pass_error );
15587 CORE::return( $self->$meth( @_ ) );
15588 }
15589 PERL
15590 # NOTE: treasury_transaction_list()
15591 treasury_transaction_list => <<'PERL',
15592 sub treasury_transaction_list
15593 {
15594 my $self = shift( @_ );
15595 CORE::return( $self->error( "No parameters were provided to list treasury transaction information." ) ) if( !scalar( @_ ) );
15596 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Treasury::Transaction', @_ );
15597 my $okParams =
15598 {
15599 expandable => { allowed => $EXPANDABLES->{ 'treasury.transaction' }, data_prefix_is_ok => 1 },
15600 created => { type => "timestamp" },
15601 ending_before => { type => "string" },
15602 financial_account => { type => "string", required => 1 },
15603 limit => { type => "string" },
15604 order_by => { type => "string" },
15605 starting_after => { type => "string" },
15606 status => { type => "string" },
15607 status_transitions => { type => "hash" },
15608 };
15609 my $err = $self->_check_parameters( $okParams, $args );
15610 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
15611 if( $args->{expand} )
15612 {
15613 $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
15614 }
15615 my $hash = $self->get( "", $args ) || CORE::return( $self->pass_error );
15616 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Treasury::Transaction', $hash ) );
15617 }
15618 PERL
15619 # NOTE: treasury_transaction_retrieve()
15620 treasury_transaction_retrieve => <<'PERL',
15621 sub treasury_transaction_retrieve
15622 {
15623 my $self = shift( @_ );
15624 my $args = shift( @_ );
15625 my $okParams =
15626 {
15627 expandable => { allowed => $EXPANDABLES->{ 'treasury.transaction' }, data_prefix_is_ok => 1 },
15628 };
15629 $args = $self->_contract( 'treasury.transaction', $args ) || CORE::return( $self->pass_error );
15630 my $err = $self->_check_parameters( $okParams, $args );
15631 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
15632 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No treasury.transaction id (with parameter 'id') was provided to retrieve its information." ) );
15633 my $hash = $self->get( "treasury/transactions/${id}", $args ) || CORE::return( $self->pass_error );
15634 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Treasury::Transaction', $hash ) );
15635 }
15636 PERL
15637 # NOTE: treasury_transactions()
15638 treasury_transactions => <<'PERL',
15639 # <https://stripe.com/docs/api/treasury/transactions>
15640 sub treasury_transactions
15641 {
15642 my $self = shift( @_ );
15643 my $allowed = [qw( list retrieve )];
15644 my $action = shift( @_ );
15645 my $meth = $self->_get_method( 'treasury_transaction', $action, $allowed ) || CORE::return( $self->pass_error );
15646 CORE::return( $self->$meth( @_ ) );
15647 }
15648 PERL
15649 # NOTE: usage_record()
15650 usage_record => <<'PERL',
15651 sub usage_record { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Billing::UsageRecord', @_ ) ); }
15652 PERL
15653 # NOTE: usage_record_create()
15654 usage_record_create => <<'PERL',
15655 sub usage_record_create
15656 {
15657 my $self = shift( @_ );
15658 my $args = shift( @_ );
15659 my $okParams =
15660 {
15661 expandable => { allowed => $EXPANDABLES->{ 'usage_record' } },
15662 action => { type => "string" },
15663 quantity => { type => "integer", required => 1 },
15664 timestamp => { type => "timestamp" },
15665 };
15666 $args = $self->_contract( 'usage_record', $args ) || CORE::return( $self->pass_error );
15667 my $err = $self->_check_parameters( $okParams, $args );
15668 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
15669 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No subscription_item id (with parameter 'id') was provided to create its information." ) );
15670 my $hash = $self->post( "subscription_items/${id}/usage_records", $args ) || CORE::return( $self->pass_error );
15671 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::UsageRecord', $hash ) );
15672 }
15673 PERL
15674 # NOTE: usage_record_list()
15675 usage_record_list => <<'PERL',
15676 sub usage_record_list
15677 {
15678 my $self = shift( @_ );
15679 CORE::return( $self->error( "No parameters were provided to list usage record information." ) ) if( !scalar( @_ ) );
15680 my $args = $self->_get_args_from_object( 'Net::API::Stripe::Billing::UsageRecord', @_ );
15681 my $okParams =
15682 {
15683 expandable => { allowed => $EXPANDABLES->{ 'usage_record' }, data_prefix_is_ok => 1 },
15684 ending_before => { type => "string" },
15685 limit => { type => "string" },
15686 starting_after => { type => "string" },
15687 };
15688 my $err = $self->_check_parameters( $okParams, $args );
15689 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
15690 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No subscription_item id (with parameter 'id') was provided to list its information." ) );
15691 if( $args->{expand} )
15692 {
15693 $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
15694 }
15695 my $hash = $self->get( "subscription_items/${id}", $args ) || CORE::return( $self->pass_error );
15696 CORE::return( $self->_response_to_object( 'Net::API::Stripe::Billing::UsageRecord', $hash ) );
15697 }
15698 PERL
15699 # NOTE: usage_record_summary()
15700 usage_record_summary => <<'PERL',
15701 sub usage_record_summary { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Billing::UserRecord::Summary', @_ ) ); }
15702 PERL
15703 # NOTE: usage_records()
15704 usage_records => <<'PERL',
15705 # <https://stripe.com/docs/api/usage_records>
15706 sub usage_records
15707 {
15708 my $self = shift( @_ );
15709 my $allowed = [qw( create list )];
15710 my $action = shift( @_ );
15711 my $meth = $self->_get_method( 'usage_record', $action, $allowed ) || CORE::return( $self->pass_error );
15712 CORE::return( $self->$meth( @_ ) );
15713 }
15714 PERL
15715 # NOTE: value_list()
15716 value_list => <<'PERL',
15717 sub value_list { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Fraud::ValueList', @_ ) ); }
15718 PERL
15719 # NOTE: value_list_item()
15720 value_list_item => <<'PERL',
15721 sub value_list_item { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Fraud::ValueList::Item', @_ ) ); }
15722 PERL
15723 # NOTE: verification()
15724 verification => <<'PERL',
15725 sub verification { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Connect::Account::Verification', @_ ) ); }
15726 PERL
15727 # NOTE: verification_data()
15728 verification_data => <<'PERL',
15729 sub verification_data { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Issuing::Authorization::VerificationData', @_ ) ); }
15730 PERL
15731 # NOTE: verification_fields()
15732 verification_fields => <<'PERL',
15733 sub verification_fields { CORE::return( shift->_response_to_object( 'Net::API::Stripe::Connect::CountrySpec::VerificationFields', @_ ) ); }
15734 PERL
15735 # NOTE: webhook()
15736 webhook => <<'PERL',
15737 sub webhook { CORE::return( shift->_response_to_object( 'Net::API::Stripe::WebHook::Object' ) ) }
15738 PERL
15739 # NOTE: webhook_endpoint()
15740 webhook_endpoint => <<'PERL',
15741 sub webhook_endpoint { CORE::return( shift->_response_to_object( 'Net::API::Stripe::WebHook::Object', @_ ) ); }
15742 PERL
15743 # NOTE: webhook_endpoint_create()
15744 webhook_endpoint_create => <<'PERL',
15745 sub webhook_endpoint_create
15746 {
15747 my $self = shift( @_ );
15748 my $args = shift( @_ );
15749 my $okParams =
15750 {
15751 expandable => { allowed => $EXPANDABLES->{ 'webhook_endpoint' } },
15752 api_version => { type => "string" },
15753 connect => { type => "boolean" },
15754 description => { type => "string" },
15755 enabled_events => { type => "array", required => 1 },
15756 metadata => { type => "hash" },
15757 url => { type => "string", required => 1 },
15758 };
15759 $args = $self->_contract( 'webhook_endpoint', $args ) || CORE::return( $self->pass_error );
15760 my $err = $self->_check_parameters( $okParams, $args );
15761 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
15762 my $hash = $self->post( "webhook_endpoints", $args ) || CORE::return( $self->pass_error );
15763 CORE::return( $self->_response_to_object( 'Net::API::Stripe::WebHook::Object', $hash ) );
15764 }
15765 PERL
15766 # NOTE: webhook_endpoint_delete()
15767 webhook_endpoint_delete => <<'PERL',
15768 sub webhook_endpoint_delete
15769 {
15770 my $self = shift( @_ );
15771 my $args = shift( @_ );
15772 my $okParams =
15773 {
15774 expandable => { allowed => $EXPANDABLES->{ 'webhook_endpoint' } },
15775 };
15776 $args = $self->_contract( 'webhook_endpoint', $args ) || CORE::return( $self->pass_error );
15777 my $err = $self->_check_parameters( $okParams, $args );
15778 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
15779 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No webhook_endpoint id (with parameter 'id') was provided to delete its information." ) );
15780 my $hash = $self->delete( "webhook_endpoints/${id}", $args ) || CORE::return( $self->pass_error );
15781 CORE::return( $self->_response_to_object( 'Net::API::Stripe::WebHook::Object', $hash ) );
15782 }
15783 PERL
15784 # NOTE: webhook_endpoint_list()
15785 webhook_endpoint_list => <<'PERL',
15786 sub webhook_endpoint_list
15787 {
15788 my $self = shift( @_ );
15789 CORE::return( $self->error( "No parameters were provided to list webhook endpoint information." ) ) if( !scalar( @_ ) );
15790 my $args = $self->_get_args_from_object( 'Net::API::Stripe::WebHook::Object', @_ );
15791 my $okParams =
15792 {
15793 expandable => { allowed => $EXPANDABLES->{ 'webhook_endpoint' }, data_prefix_is_ok => 1 },
15794 ending_before => { type => "string" },
15795 limit => { type => "string" },
15796 starting_after => { type => "string" },
15797 };
15798 my $err = $self->_check_parameters( $okParams, $args );
15799 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
15800 if( $args->{expand} )
15801 {
15802 $self->_adjust_list_expandables( $args ) || CORE::return( $self->pass_error );
15803 }
15804 my $hash = $self->get( "webhook_endpoints", $args ) || CORE::return( $self->pass_error );
15805 CORE::return( $self->_response_to_object( 'Net::API::Stripe::WebHook::Object', $hash ) );
15806 }
15807 PERL
15808 # NOTE: webhook_endpoint_retrieve()
15809 webhook_endpoint_retrieve => <<'PERL',
15810 sub webhook_endpoint_retrieve
15811 {
15812 my $self = shift( @_ );
15813 my $args = shift( @_ );
15814 my $okParams =
15815 {
15816 expandable => { allowed => $EXPANDABLES->{ 'webhook_endpoint' }, data_prefix_is_ok => 1 },
15817 };
15818 $args = $self->_contract( 'webhook_endpoint', $args ) || CORE::return( $self->pass_error );
15819 my $err = $self->_check_parameters( $okParams, $args );
15820 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
15821 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No webhook_endpoint id (with parameter 'id') was provided to retrieve its information." ) );
15822 my $hash = $self->get( "webhook_endpoints/${id}", $args ) || CORE::return( $self->pass_error );
15823 CORE::return( $self->_response_to_object( 'Net::API::Stripe::WebHook::Object', $hash ) );
15824 }
15825 PERL
15826 # NOTE: webhook_endpoint_update()
15827 webhook_endpoint_update => <<'PERL',
15828 sub webhook_endpoint_update
15829 {
15830 my $self = shift( @_ );
15831 my $args = shift( @_ );
15832 my $okParams =
15833 {
15834 expandable => { allowed => $EXPANDABLES->{ 'webhook_endpoint' } },
15835 description => { type => "string" },
15836 disabled => { type => "boolean" },
15837 enabled_events => { type => "array" },
15838 metadata => { type => "hash" },
15839 url => { type => "string" },
15840 };
15841 $args = $self->_contract( 'webhook_endpoint', $args ) || CORE::return( $self->pass_error );
15842 my $err = $self->_check_parameters( $okParams, $args );
15843 CORE::return( $self->error( join( ' ', @$err ) ) ) if( scalar( @$err ) );
15844 my $id = CORE::delete( $args->{id} ) || CORE::return( $self->error( "No webhook_endpoint id (with parameter 'id') was provided to update its information." ) );
15845 my $hash = $self->post( "webhook_endpoints/${id}", $args ) || CORE::return( $self->pass_error );
15846 CORE::return( $self->_response_to_object( 'Net::API::Stripe::WebHook::Object', $hash ) );
15847 }
15848 PERL
15849 # NOTE: webhook_endpoints()
15850 webhook_endpoints => <<'PERL',
15851 # <https://stripe.com/docs/api/webhook_endpoints>
15852 sub webhook_endpoints
15853 {
15854 my $self = shift( @_ );
15855 my $allowed = [qw( create delete list retrieve update )];
15856 my $action = shift( @_ );
15857 my $meth = $self->_get_method( 'webhook_endpoint', $action, $allowed ) || CORE::return( $self->pass_error );
15858 CORE::return( $self->$meth( @_ ) );
15859 }
15860 PERL
15861 };
15862 }
15863 # NOTE: End of auto-generated methods
15864  
15865  
15866 sub _adjust_list_expandables
15867 0 ▶{
Subroutine _adjust_list_expandables: not called CC=6 SCAR=37.4
15868 0 my $self = shift( @_ );
15869 0 my $args = shift( @_ );
15870 0 ▶ CORE::return( $self->error( "User parameters list provided is '$args' and I was expecting a hash reference." ) ) if( ref( $args ) ne 'HASH' );
Branch: 1 branch
BranchTrueFalseTotal
if ref $args ne "HASH" 0 0 0
15871 0 ▶ if( ref( $args->{expand} ) eq 'ARRAY' )
Branch: 1 branch
BranchTrueFalseTotal
if (ref $args->{"expand"} eq "ARRAY") 0 0 0
15872 {
15873 0 my $new = [];
15874 0 ▶ for( my $i = 0; $i < scalar( @{$args->{expand}} ); $i++ )
Branch: 1 branch
BranchTrueFalseTotal
if ($i < scalar @{$args->{"expand"};}) 0 0 0
15875 {
15876 0 ▶ substr( $args->{expand}->[$i], 0, 0 ) = 'data.' if( substr( $args->{expand}->[$i], 0, 5 ) ne 'data.' );
Branch: 1 branch
BranchTrueFalseTotal
if substr($args->{"expand"}[$i], 0, 5) ne "data." 0 0 0
15877 0 my $path = [split( /\./, $args->{expand}->[$i] )];
15878 # Make sure that with the new 'data' prefix, this does not exceed 4 level of depth
15879 0 ▶ push( @$new, $args->{expand}->[$i] ) if( scalar( @$path ) <= $EXPAND_MAX_DEPTH );
Branch: 1 branch
BranchTrueFalseTotal
if scalar @$path <= $Net::API::Stripe::EXPAND_MAX_DEPTH 0 0 0
15880 }
15881 0 $args->{expand} = $new;
15882 }
15883 0 CORE::return( $self );
15884 }
15885  
15886 sub _as_hash
15887 0 ▶{
Subroutine _as_hash: not called CC=19 SCAR=59.4
15888 0 my $self = shift( @_ );
15889 0 my $this = shift( @_ );
15890 0 my $opts = {};
15891 0 ▶ $opts = shift( @_ ) if( @_ && ref( $_[0] ) eq 'HASH' );
Branch: 1 branch
BranchTrueFalseTotal
if @_ and ref $_[0] eq "HASH" 0 0 0
Condition0%0/3
@_ and ref $_[0] eq "HASH"
!ll&&!rl&&r
000
MC/DC0%0/2
@_ and ref $_[0] eq "HASH"
@_ ref $_[0] eq "HASH"
Truth table0%0/3
A and B
A= @_B= ref $_[0] eq "HASH"
ABresult
0X0
100
111
15892 0 ▶ $opts->{seen} = {} if( !$opts->{seen} );
Branch: 1 branch
BranchTrueFalseTotal
unless $opts->{"seen"} 0 0 0
15893 0 my $ref = {};
15894 0 ▶ if( $self->_is_object( $this ) )
Branch: 2 branches
BranchTrueFalseTotal
if ($self->_is_object($this)) { } 0 0 0
elsif (ref $this eq 'HASH') { } 0 0 0
15895 {
15896 0 ▶ $ref = $this->as_hash if( $this->can( 'as_hash' ) );
Branch: 1 branch
BranchTrueFalseTotal
if $this->can("as_hash") 0 0 0
15897 }
15898 # Recursively transform into hash
15899 elsif( ref( $this ) eq 'HASH' )
15900 {
15901 # Prevent recursion
15902 0 my $ref_addr = Scalar::Util::refaddr( $this );
15903 0 ▶ CORE::return( $opts->{seen}->{ $ref_addr } ) if( $opts->{seen}->{ $ref_addr } );
Branch: 1 branch
BranchTrueFalseTotal
if $opts->{"seen"}{$ref_addr} 0 0 0
15904 0 $opts->{seen}->{ $ref_addr } = $this;
15905 # $ref = $hash;
15906 0 foreach my $k ( keys( %$this ) )
15907 {
15908 0 ▶ if( ref( $this->{ $k } ) eq 'HASH' || $self->_is_object( $this->{ $k } ) )
Branch: 3 branches
BranchTrueFalseTotal
if (ref $this->{$k} eq 'HASH' or $self->_is_object($this->{$k})) { } 0 0 0
elsif (ref $this->{$k} eq 'ARRAY') { } 0 0 0
elsif (length "$this->{$k}") { } 0 0 0
Condition0%0/3
ref $this->{$k} eq "HASH" or $self->_is_object($this->{$k})
l!l&&r!l&&!r
000
MC/DC0%0/2
ref $this->{$k} eq "HASH" or $self->_is_object($this->{$k})
ref $this->{$k} eq "HASH" $self->_is_object($this->{$k})
Truth table0%0/3
A or B
A= ref $this->{$k} eq "HASH"B= $self->_is_object($this->{$k})
ABresult
1X1
011
000
15909 {
15910 0 my $rv = $self->_as_hash( $this->{ $k }, $opts );
15911 0 ▶ $ref->{ $k } = $rv if( scalar( keys( %$rv ) ) );
Branch: 1 branch
BranchTrueFalseTotal
if scalar keys %$rv 0 0 0
15912 }
15913 elsif( ref( $this->{ $k } ) eq 'ARRAY' )
15914 {
15915 0 my $new = [];
15916 0 foreach my $that ( @{$this->{ $k }} )
15917 {
15918 0 ▶ if( ref( $that ) eq 'HASH' || $self->_is_object( $that ) )
Branch: 1 branch
BranchTrueFalseTotal
if (ref $that eq "HASH" or $self->_is_object($that)) 0 0 0
Condition0%0/3
ref $that eq "HASH" or $self->_is_object($that)
l!l&&r!l&&!r
000
MC/DC0%0/2
ref $that eq "HASH" or $self->_is_object($that)
ref $that eq "HASH" $self->_is_object($that)
Truth table0%0/3
A or B
A= ref $that eq "HASH"B= $self->_is_object($that)
ABresult
1X1
011
000
15919 {
15920 0 my $rv = $self->_as_hash( $that, $opts );
15921 0 ▶ push( @$new, $rv ) if( scalar( keys( %$rv ) ) );
Branch: 1 branch
BranchTrueFalseTotal
if scalar keys %$rv 0 0 0
15922 }
15923 }
15924 0 ▶ $ref->{ $k } = $new if( scalar( @$new ) );
Branch: 1 branch
BranchTrueFalseTotal
if scalar @$new 0 0 0
15925 }
15926 # For stringification
15927 elsif( CORE::length( "$this->{$k}" ) )
15928 {
15929 0 $ref->{ $k } = $this->{ $k };
15930 }
15931 }
15932 }
15933 else
15934 {
15935 0 CORE::return( $self->error( "Unknown data type $this to be converted into hash for api call." ) );
15936 }
15937 0 CORE::return( $ref );
15938 }
15939  
15940 sub _check_parameters
15941 0 ▶{
Subroutine _check_parameters: not called CC=88 SCAR=89.7
15942 0 my $self = shift( @_ );
15943 0 my $okParams = shift( @_ );
15944 0 my $args = shift( @_ );
15945 # $self->dumpto_dumper( $args, '/home/ai/legal/var/check_parameters.pl' );
15946 0 my $err = [];
15947
15948 0 my $seen = {};
15949 0 my $check_fields_recursive;
15950 $check_fields_recursive = sub
15951 0 ▶ {
Subroutine __ANON__: not called CC=16 SCAR=56.1
15952 0 my( $hash, $mirror, $field, $required ) = @_;
15953 0 my $errors = [];
15954 # push( @$err, "Unknown property $v for key $k." ) if( !scalar( grep( /^$v$/, @$this ) ) );
15955 0 foreach my $k ( sort( keys( %$hash ) ) )
15956 {
15957 0 ▶ if( !CORE::exists( $mirror->{ $k } ) )
Branch: 1 branch
BranchTrueFalseTotal
unless (exists $mirror->{$k}) 0 0 0
15958 {
15959 0 push( @$errors, "Unknown property \"$k\" for key \"$field\"." );
15960 0 next;
15961 }
15962 0 my $addr;
15963 0 ▶ $addr = Scalar::Util::refaddr( $hash->{ $k } ) if( ref( $hash->{ $k } ) eq 'HASH' );
Branch: 1 branch
BranchTrueFalseTotal
if ref $hash->{$k} eq "HASH" 0 0 0
15964 # Found a hash, check recursively and avoid looping endlessly
15965 0 ▶ if( ref( $hash->{ $k } ) eq 'HASH' &&
Branch: 1 branch
BranchTrueFalseTotal
if (ref $hash->{$k} eq "HASH" and ref $mirror->{$k} eq "HASH" and ++$seen->{$addr} == 1) 0 0 0
Condition0%0/6
ref $hash->{$k} eq "HASH" and ref $mirror->{$k} eq "HASH" and ++$seen->{$addr} == 1
!ll&&!rl&&r
000
ref $hash->{$k} eq "HASH" and ref $mirror->{$k} eq "HASH"
!ll&&!rl&&r
000
MC/DC0%0/3
ref $hash->{$k} eq "HASH" and ref $mirror->{$k} eq "HASH" and ++$seen->{$addr} == 1
ref $hash->{$k} eq "HASH" ref $mirror->{$k} eq "HASH" ++$seen->{$addr} == 1
Truth table0%0/4
A and B and C
A= ref $hash->{$k} eq "HASH"B= ref $mirror->{$k} eq "HASH"C= ++$seen->{$addr} == 1
ABCresult
0XX0
10X0
1100
1111
15966 ref( $mirror->{ $k } ) eq 'HASH' &&
15967 # ++$hash->{ $k }->{__check_fields_recursive_looping} == 1 )
15968 ++$seen->{ $addr } == 1 )
15969 {
15970 0 ▶ my $deep_errors = $check_fields_recursive->( $hash->{ $k }, $mirror->{ $k }, $k, CORE::exists( $required->{ $k } ) ? $required->{ $k } : {} );
Branch: 1 branch
BranchTrueFalseTotal
exists $required->{$k} ? : 0 0 0
15971 0 CORE::push( @$errors, @$deep_errors );
15972 }
15973 }
15974
15975 # Check required fields
15976 # if in the mirror structure, the field value is 1, the field is required, otherwise with 0 the field is not required
15977 0 foreach my $k ( sort( keys( %$mirror ) ) )
15978 {
15979 0 ▶ next if( $k eq '_required' );
Branch: 1 branch
BranchTrueFalseTotal
if $k eq "_required" 0 0 0
15980 # If this property contains sub properties, we look at the sub hash entry _required to check if this property is required or not
15981 0 ▶ if( ref( $mirror->{ $k } ) eq 'HASH' )
Branch: 1 branch
BranchTrueFalseTotal
if (ref $mirror->{$k} eq 'HASH') { } 0 0 0
15982 {
15983 0 ▶ if( !CORE::exists( $hash->{ $k } ) && $mirror->{ $k }->{_required} )
Branch: 1 branch
BranchTrueFalseTotal
if (not exists $hash->{$k} and $mirror->{$k}{"_required"}) 0 0 0
Condition0%0/3
not exists $hash->{$k} and $mirror->{$k}{"_required"}
!ll&&!rl&&r
000
MC/DC0%0/2
not exists $hash->{$k} and $mirror->{$k}{"_required"}
not exists $hash->{$k} $mirror->{$k}{"_required"}
Truth table0%0/3
not(A) and B
A= not exists $hash->{$k}B= $mirror->{$k}{"_required"}
ABresult
0X0
100
111
15984 {
15985 0 CORE::push( @$errors, "Hash property \"$k\" is required but missing in hash provided for parent field \"$field\"." );
15986 }
15987 }
15988 else
15989 {
15990 0 ▶ if( ( !CORE::exists( $hash->{ $k } ) || !CORE::length( $hash->{ $k } ) ) &&
Branch: 1 branch
BranchTrueFalseTotal
if (not exists $hash->{$k} && length $hash->{$k} and $mirror->{$k}) 0 0 0
Condition0%0/6
not exists $hash->{$k} && length $hash->{$k} and $mirror->{$k}
!ll&&!rl&&r
000
exists $hash->{$k} && length $hash->{$k}
!ll&&!rl&&r
000
MC/DC0%0/3
not exists $hash->{$k} && length $hash->{$k} and $mirror->{$k}
exists $hash->{$k} length $hash->{$k} $mirror->{$k}
Truth table0%0/5
not(A && B) and C
A= exists $hash->{$k}B= length $hash->{$k}C= $mirror->{$k}
ABCresult
11X0
0X00
1000
0X11
1011
15991 $mirror->{ $k } )
15992 {
15993 0 CORE::push( @$errors, "Field \"$k\" is required but missing in hash provided for parent field \"$field\"." );
15994 }
15995 }
15996 }
15997 0 CORE::return( $errors );
15998 0 };
15999
16000 0 foreach my $k ( keys( %$args ) )
16001 {
16002 # Special case for expand and for private parameters starting with '_'
16003 0 ▶ next if( $k eq 'expand' || $k eq 'expandable' || substr( $k, 0, 1 ) eq '_' );
Branch: 1 branch
BranchTrueFalseTotal
if $k eq "expand" or $k eq "expandable" or substr($k, 0, 1) eq "_" 0 0 0
Condition0%0/6
$k eq "expand" or $k eq "expandable" or substr($k, 0, 1) eq "_"
l!l&&r!l&&!r
000
$k eq "expand" or $k eq "expandable"
l!l&&r!l&&!r
000
MC/DC0%0/3
$k eq "expand" or $k eq "expandable" or substr($k, 0, 1) eq "_"
$k eq "expand" $k eq "expandable" substr($k, 0, 1) eq "_"
Truth table0%0/4
A or B or C
A= $k eq "expand"B= $k eq "expandable"C= substr($k, 0, 1) eq "_"
ABCresult
1XX1
01X1
0011
0000
16004 # if( !CORE::exists( $okParams->{ $k } ) )
16005 # {
16006 # # This is handy when an object was passed to one of the api method and
16007 # # the object contains a bunch of data not all relevant to the api call
16008 # # It makes it easy to pass the object and let this interface take only what is relevant
16009 # if( $okParams->{_cleanup} || $args->{_cleanup} || $self->ignore_unknown_parameters )
16010 # {
16011 # CORE::delete( $args->{ $k } );
16012 # }
16013 # else
16014 # {
16015 # push( @$err, "Unknown parameter \"$k\"." );
16016 # }
16017 # next;
16018 # }
16019 # $dict is either a hash dictionary or a sub
16020 0 my $dict = $okParams->{ $k };
16021 0 ▶ if( ref( $dict ) eq 'HASH' )
Branch: 2 branches
BranchTrueFalseTotal
if (ref $dict eq 'HASH') { } 0 0 0
elsif (ref $dict eq 'CODE') { } 0 0 0
16022 {
16023 0 my $pkg;
16024 # We stringify object that can be stringified
16025 0 ▶ if( defined( $args->{ $k } ) &&
Branch: 1 branch
BranchTrueFalseTotal
if (defined $args->{$k} and ref $args->{$k} and overload::Method($args->{$k}, "\"\"")) 0 0 0
Condition0%0/6
defined $args->{$k} and ref $args->{$k} and overload::Method($args->{$k}, "\"\"")
!ll&&!rl&&r
000
defined $args->{$k} and ref $args->{$k}
!ll&&!rl&&r
000
MC/DC0%0/3
defined $args->{$k} and ref $args->{$k} and overload::Method($args->{$k}, "\"\"")
defined $args->{$k} ref $args->{$k} overload::Method($args->{$k}, "\"\"")
Truth table0%0/4
A and B and C
A= defined $args->{$k}B= ref $args->{$k}C= overload::Method($args->{$k}, "\"\"")
ABCresult
0XX0
10X0
1100
1111
16026 ref( $args->{ $k } ) &&
16027 overload::Method( $args->{ $k } => '""' ) )
16028 {
16029 0 $args->{ $k } = $args->{ $k } . '';
16030 }
16031
16032 0 ▶ if( defined( $dict->{required} ) &&
Branch: 9 branches
BranchTrueFalseTotal
if (defined $dict->{'required'} and $dict->{'required'} and not exists $args->{$k}) { } 0 0 0
elsif (not defined $args->{$k} && length $args->{$k}) { } 0 0 0
elsif ($pkg = $self->_is_object($args->{$k}) and $dict->{'package'} and $dict->{'package'} ne $pkg) { } 0 0 0
elsif ($dict->{'re'} and ref $dict->{'re'} eq 'Regexp' and not $args->{$k} =~ /$dict->{'re'}/) { } 0 0 0
elsif (defined $dict->{'type'} and $dict->{'type'} eq 'boolean' and defined $args->{$k} and length $args->{$k}) { } 0 0 0
elsif (defined $dict->{'type'} and $dict->{'type'} and $dict->{'type'} eq 'scalar' && ref $args->{$k} || $dict->{'type'} ne 'scalar' && ref $args->{$k} && lc ref $args->{$k} ne $dict->{'type'}) { } 0 0 0
elsif (defined $dict->{'type'} and $dict->{'type'} eq 'integer') { } 0 0 0
elsif (defined $dict->{'type'} and $dict->{'type'} eq 'number' || $dict->{'type'} eq 'decimal' || $dict->{'type'} eq 'float' || $dict->{'type'} eq 'double') { } 0 0 0
elsif (defined $dict->{'type'} and $dict->{'type'} eq 'date' || $dict->{'type'} eq 'datetime' || $dict->{'type'} eq 'timestamp') { } 0 0 0
Condition0%0/6
defined $dict->{"required"} and $dict->{"required"} and not exists $args->{$k}
!ll&&!rl&&r
000
defined $dict->{"required"} and $dict->{"required"}
!ll&&!rl&&r
000
MC/DC0%0/3
defined $dict->{"required"} and $dict->{"required"} and not exists $args->{$k}
defined $dict->{"required"} $dict->{"required"} not exists $args->{$k}
Truth table0%0/4
A and B and not(C)
A= defined $dict->{"required"}B= $dict->{"required"}C= not exists $args->{$k}
ABCresult
0XX0
10X0
1100
1111
16033 $dict->{required} &&
16034 !CORE::exists( $args->{ $k } ) )
16035 {
16036 0 push( @$err, "Parameter \"$k\" is required, but missing" );
16037 }
16038 ▶ elsif( !defined( $args->{ $k } ) ||
Condition0%0/3
defined $args->{$k} && length $args->{$k}
!ll&&!rl&&r
000
MC/DC0%0/2
defined $args->{$k} && length $args->{$k}
defined $args->{$k} length $args->{$k}
Truth table0%0/3
A && B
A= defined $args->{$k}B= length $args->{$k}
ABresult
0X0
100
111
16039 !length( $args->{ $k } ) )
16040 {
16041 0 push( @$err, "Empty value provided for parameter \"$k\"." );
16042 }
16043 # _is_object is inherited from Module::Object
16044 ▶ elsif( ( $pkg = $self->_is_object( $args->{ $k } ) ) && $dict->{package} && $dict->{package} ne $pkg )
Condition0%0/6
$pkg = $self->_is_object($args->{$k}) and $dict->{"package"} and $dict->{"package"} ne $pkg
!ll&&!rl&&r
000
$pkg = $self->_is_object($args->{$k}) and $dict->{"package"}
!ll&&!rl&&r
000
MC/DC0%0/3
$pkg = $self->_is_object($args->{$k}) and $dict->{"package"} and $dict->{"package"} ne $pkg
$pkg = $self->_is_object($args->{$k}) $dict->{"package"} $dict->{"package"} ne $pkg
Truth table0%0/4
A and B and C
A= $pkg = $self->_is_object($args->{$k})B= $dict->{"package"}C= $dict->{"package"} ne $pkg
ABCresult
0XX0
10X0
1100
1111
16045 {
16046 0 push( @$err, "Parameter \"$k\" value is a package \"$pkg\", but I was expecting \"$dict->{package}\"" );
16047 }
16048 ▶ elsif( $dict->{re} && ref( $dict->{re} ) eq 'Regexp' && $args->{ $k } !~ /$dict->{re}/ )
Condition0%0/6
$dict->{"re"} and ref $dict->{"re"} eq "Regexp" and not $args->{$k} =~ /$dict->{"re"}/
!ll&&!rl&&r
000
$dict->{"re"} and ref $dict->{"re"} eq "Regexp"
!ll&&!rl&&r
000
MC/DC0%0/3
$dict->{"re"} and ref $dict->{"re"} eq "Regexp" and not $args->{$k} =~ /$dict->{"re"}/
$dict->{"re"} ref $dict->{"re"} eq "Regexp" not $args->{$k} =~ /$dict->{"re"}/
Truth table0%0/4
A and B and not(C)
A= $dict->{"re"}B= ref $dict->{"re"} eq "Regexp"C= not $args->{$k} =~ /$dict->{"re"}/
ABCresult
0XX0
10X0
1100
1111
16049 {
16050 0 push( @$err, "Parameter \"$k\" with value \"$args->{$k}\" does not have a legitimate value." );
16051 }
16052 ▶ elsif( defined( $dict->{type} ) &&
Condition0%0/9
defined $dict->{"type"} and $dict->{"type"} eq "boolean" and defined $args->{$k} and length $args->{$k}
!ll&&!rl&&r
000
defined $dict->{"type"} and $dict->{"type"} eq "boolean" and defined $args->{$k}
!ll&&!rl&&r
000
defined $dict->{"type"} and $dict->{"type"} eq "boolean"
!ll&&!rl&&r
000
MC/DC0%0/4
defined $dict->{"type"} and $dict->{"type"} eq "boolean" and defined $args->{$k} and length $args->{$k}
defined $dict->{"type"} $dict->{"type"} eq "boolean" defined $args->{$k} length $args->{$k}
Truth table0%0/5
A and B and C and D
A= defined $dict->{"type"}B= $dict->{"type"} eq "boolean"C= defined $args->{$k}D= length $args->{$k}
ABCDresult
0XXX0
10XX0
110X0
11100
11111
16053 $dict->{type} eq 'boolean' &&
16054 defined( $args->{ $k } ) &&
16055 CORE::length( $args->{ $k } ) )
16056 {
16057 0 ▶ $args->{ $k } = ( $args->{ $k } eq 'true' || ( $args->{ $k } ne 'false' && $args->{ $k } ) ) ? 'true' : 'false';
Branch: 1 branch
BranchTrueFalseTotal
$args->{$k} eq 'true' || $args->{$k} ne 'false' && $args->{$k} ? : 0 0 0
Condition0%0/6
$args->{$k} eq "true" or $args->{$k} ne "false" and $args->{$k}
l!l&&r!l&&!r
000
$args->{$k} ne "false" and $args->{$k}
!ll&&!rl&&r
000
MC/DC0%0/3
$args->{$k} eq "true" or $args->{$k} ne "false" and $args->{$k}
$args->{$k} eq "true" $args->{$k} ne "false" $args->{$k}
Truth table0%0/4
A or B and C
A= $args->{$k} eq "true"B= $args->{$k} ne "false"C= $args->{$k}
ABCresult
1XX1
0111
00X0
0100
16058 }
16059 ▶ elsif( defined( $dict->{type} ) &&
Condition0%0/18
defined $dict->{"type"} and $dict->{"type"} and $dict->{"type"} eq "scalar" && ref $args->{$k} || $dict->{"type"} ne "scalar" && ref $args->{$k} && lc ref $args->{$k} ne $dict->{"type"}
!ll&&!rl&&r
000
defined $dict->{"type"} and $dict->{"type"}
!ll&&!rl&&r
000
$dict->{"type"} eq "scalar" and ref $args->{$k} or $dict->{"type"} ne "scalar" and ref $args->{$k} and lc ref $args->{$k} ne $dict->{"type"}
l!l&&r!l&&!r
000
$dict->{"type"} eq "scalar" and ref $args->{$k}
!ll&&!rl&&r
000
$dict->{"type"} ne "scalar" and ref $args->{$k} and lc ref $args->{$k} ne $dict->{"type"}
!ll&&!rl&&r
000
$dict->{"type"} ne "scalar" and ref $args->{$k}
!ll&&!rl&&r
000
MC/DC0%0/7
defined $dict->{"type"} and $dict->{"type"} and $dict->{"type"} eq "scalar" && ref $args->{$k} || $dict->{"type"} ne "scalar" && ref $args->{$k} && lc ref $args->{$k} ne $dict->{"type"}
defined $dict->{"type"} $dict->{"type"} $dict->{"type"} eq "scalar" ref $args->{$k} $dict->{"type"} ne "scalar" ref $args->{$k} lc ref $args->{$k} ne $dict->{"type"}
Truth table0%0/11
A and B and C and D or E and F and G
A= defined $dict->{"type"}B= $dict->{"type"}C= $dict->{"type"} eq "scalar"D= ref $args->{$k}E= $dict->{"type"} ne "scalar"F= ref $args->{$k}G= lc ref $args->{$k} ne $dict->{"type"}
ABCDEFGresult
0XXXXXX0
10XXXXX0
110X0XX0
110X10X0
110X1100
11100XX0
111010X0
11101100
1111XXX1
110X1111
11101111
16060 $dict->{type} &&
16061 (
16062 ( $dict->{type} eq 'scalar' && ref( $args->{ $k } ) ) ||
16063 ( $dict->{type} ne 'scalar' && ref( $args->{ $k } ) && lc( ref( $args->{ $k } ) ) ne $dict->{type} )
16064 )
16065 )
16066 {
16067 0 push( @$err, "I was expecting a data of type $dict->{type}, but got " . lc( ref( $args->{ $k } ) ) );
16068 }
16069 ▶ elsif( defined( $dict->{type} ) &&
Condition0%0/3
defined $dict->{"type"} and $dict->{"type"} eq "integer"
!ll&&!rl&&r
000
MC/DC0%0/2
defined $dict->{"type"} and $dict->{"type"} eq "integer"
defined $dict->{"type"} $dict->{"type"} eq "integer"
Truth table0%0/3
A and B
A= defined $dict->{"type"}B= $dict->{"type"} eq "integer"
ABresult
0X0
100
111
16070 $dict->{type} eq 'integer' )
16071 {
16072 0 ▶ push( @$err, "Parameter \"$k\" value \" $args->{$k}\" is not an integer." ) if( $args->{ $k } !~ /^[-+]?\d+$/ );
Branch: 1 branch
BranchTrueFalseTotal
unless $args->{$k} =~ /^[-+]?\d+$/ 0 0 0
16073 }
16074 ▶ elsif( defined( $dict->{type} ) &&
Condition0%0/12
defined $dict->{"type"} and $dict->{"type"} eq "number" || $dict->{"type"} eq "decimal" || $dict->{"type"} eq "float" || $dict->{"type"} eq "double"
!ll&&!rl&&r
000
$dict->{"type"} eq "number" or $dict->{"type"} eq "decimal" or $dict->{"type"} eq "float" or $dict->{"type"} eq "double"
l!l&&r!l&&!r
000
$dict->{"type"} eq "number" or $dict->{"type"} eq "decimal" or $dict->{"type"} eq "float"
l!l&&r!l&&!r
000
$dict->{"type"} eq "number" or $dict->{"type"} eq "decimal"
l!l&&r!l&&!r
000
MC/DC0%0/5
defined $dict->{"type"} and $dict->{"type"} eq "number" || $dict->{"type"} eq "decimal" || $dict->{"type"} eq "float" || $dict->{"type"} eq "double"
defined $dict->{"type"} $dict->{"type"} eq "number" $dict->{"type"} eq "decimal" $dict->{"type"} eq "float" $dict->{"type"} eq "double"
Truth table0%0/6
A and B or C or D or E
A= defined $dict->{"type"}B= $dict->{"type"} eq "number"C= $dict->{"type"} eq "decimal"D= $dict->{"type"} eq "float"E= $dict->{"type"} eq "double"
ABCDEresult
0XXXX0
100000
11XXX1
101XX1
1001X1
100011
16075 (
16076 $dict->{type} eq 'number' ||
16077 $dict->{type} eq 'decimal' ||
16078 $dict->{type} eq 'float' ||
16079 $dict->{type} eq 'double'
16080 ) )
16081 {
16082 0 ▶ push( @$err, "Parameter \"$k\" value \" $args->{$k}\" is not a $dict->{type}." ) if( $args->{ $k } !~ /^$RE{num}{real}$/ );
Branch: 1 branch
BranchTrueFalseTotal
unless $args->{$k} =~ /^$Net::API::Stripe::RE{"num"}{"real"}$/ 0 0 0
16083 }
16084 ▶ elsif( defined( $dict->{type} ) &&
Condition0%0/9
defined $dict->{"type"} and $dict->{"type"} eq "date" || $dict->{"type"} eq "datetime" || $dict->{"type"} eq "timestamp"
!ll&&!rl&&r
000
$dict->{"type"} eq "date" or $dict->{"type"} eq "datetime" or $dict->{"type"} eq "timestamp"
l!l&&r!l&&!r
000
$dict->{"type"} eq "date" or $dict->{"type"} eq "datetime"
l!l&&r!l&&!r
000
MC/DC0%0/4
defined $dict->{"type"} and $dict->{"type"} eq "date" || $dict->{"type"} eq "datetime" || $dict->{"type"} eq "timestamp"
defined $dict->{"type"} $dict->{"type"} eq "date" $dict->{"type"} eq "datetime" $dict->{"type"} eq "timestamp"
Truth table0%0/5
A and B or C or D
A= defined $dict->{"type"}B= $dict->{"type"} eq "date"C= $dict->{"type"} eq "datetime"D= $dict->{"type"} eq "timestamp"
ABCDresult
0XXX0
10000
11XX1
101X1
10011
16085 (
16086 $dict->{type} eq 'date' ||
16087 $dict->{type} eq 'datetime' ||
16088 $dict->{type} eq 'timestamp'
16089 ) )
16090 {
16091 0 ▶ unless( $self->_is_object( $args->{ $k } ) && $args->{ $k }->isa( 'DateTime' ) )
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->_is_object($args->{$k}) and $args->{$k}->isa("DateTime")) 0 0 0
Condition0%0/3
$self->_is_object($args->{$k}) and $args->{$k}->isa("DateTime")
!ll&&!rl&&r
000
MC/DC0%0/2
$self->_is_object($args->{$k}) and $args->{$k}->isa("DateTime")
$self->_is_object($args->{$k}) $args->{$k}->isa("DateTime")
Truth table0%0/3
A and B
A= $self->_is_object($args->{$k})B= $args->{$k}->isa("DateTime")
ABresult
0X0
100
111
16092 {
16093 0 ▶ my $tz = $dict->{time_zone} ? $dict->{time_zone} : 'GMT';
Branch: 1 branch
BranchTrueFalseTotal
$dict->{'time_zone'} ? : 0 0 0
16094 0 my $dt;
16095 0 ▶ if( $dict->{type} eq 'date' &&
Branch: 3 branches
BranchTrueFalseTotal
if ($dict->{'type'} eq 'date' and $args->{$k} =~ /^(?<year>\d{4})[\.|\-](?<month>\d{1,2})[\.|\-](?<day>\d{1,2})$/) { } 0 0 0
elsif ($dict->{'type'} eq 'datetime' and $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})$/) { } 0 0 0
elsif ($args->{$k} =~ /^\d+$/) { } 0 0 0
Condition0%0/3
$dict->{"type"} eq "date" and $args->{$k} =~ /^(?<year>\d{4})[\.|\-](?<month>\d{1,2})[\.|\-](?<day>\d{1,2})$/
!ll&&!rl&&r
000
MC/DC0%0/2
$dict->{"type"} eq "date" and $args->{$k} =~ /^(?<year>\d{4})[\.|\-](?<month>\d{1,2})[\.|\-](?<day>\d{1,2})$/
$dict->{"type"} eq "date" $args->{$k} =~ /^(?<year>\d{4})[\.|\-](?<month>\d{1,2})[\.|\-](?<day>\d{1,2})$/
Truth table0%0/3
A and B
A= $dict->{"type"} eq "date"B= $args->{$k} =~ /^(?<year>\d{4})[\.|\-](?<month>\d{1,2})[\.|\-](?<day>\d{1,2})$/
ABresult
0X0
100
111
16096 $args->{ $k } =~ /^(?<year>\d{4})[\.|\-](?<month>\d{1,2})[\.|\-](?<day>\d{1,2})$/ )
16097 {
16098 0 local $@;
16099 # try-catch
16100 eval
16101 0 {
16102 $dt = DateTime(
16103 year => int( $+{year} ),
16104 month => int( $+{month} ),
16105 0 day => int( $+{day} ),
16106 hour => 0,
16107 minute => 0,
16108 second => 0,
16109 time_zone => $tz
16110 );
16111 0 $args->{ $k } = $dt;
16112 };
16113 0 ▶ if( $@ )
Branch: 1 branch
BranchTrueFalseTotal
if ($@) 0 0 0
16114 {
16115 0 push( @$err, "Invalid date (" . $args->{ $k } . ") provided for parameter \"$k\": $@" );
16116 }
16117 }
16118 ▶ elsif( $dict->{type} eq 'datetime' &&
Condition0%0/3
$dict->{"type"} eq "datetime" and $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})$/
!ll&&!rl&&r
000
MC/DC0%0/2
$dict->{"type"} eq "datetime" and $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})$/
$dict->{"type"} eq "datetime" $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})$/
Truth table0%0/3
A and B
A= $dict->{"type"} eq "datetime"B= $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})$/
ABresult
0X0
100
111
16119 $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})$/ )
16120 {
16121 0 local $@;
16122 # try-catch
16123 eval
16124 0 {
16125 $dt = DateTime(
16126 year => int( $+{year} ),
16127 month => int( $+{month} ),
16128 day => int( $+{day} ),
16129 hour => int( $+{hour} ),
16130 minute => int( $+{minute} ),
16131 0 second => int( $+{second} ),
16132 time_zone => $tz
16133 );
16134 0 $args->{ $k } = $dt;
16135 };
16136 0 ▶ if( $@ )
Branch: 1 branch
BranchTrueFalseTotal
if ($@) 0 0 0
16137 {
16138 0 push( @$err, "Invalid datetime (" . $args->{ $k } . ") provided for parameter \"$k\": $@" );
16139 }
16140 }
16141 elsif( $args->{ $k } =~ /^\d+$/ )
16142 {
16143 0 local $@;
16144 # try-catch
16145 eval
16146 0 {
16147 $dt = DateTime->from_epoch(
16148 0 epoch => $args->{ $k },
16149 time_zone => $tz,
16150 );
16151 };
16152 0 ▶ if( $@ )
Branch: 1 branch
BranchTrueFalseTotal
if ($@) 0 0 0
16153 {
16154 0 push( @$err, "Invalid timestamp (" . $args->{ $k } . ") provided for parameter \"$k\": $@" );
16155 }
16156 }
16157 0 ▶ if( $dt )
Branch: 1 branch
BranchTrueFalseTotal
if ($dt) 0 0 0
16158 {
16159 0 ▶ my $pattern = $dict->{pattern} ? $dict->{pattern} : '%s';
Branch: 1 branch
BranchTrueFalseTotal
$dict->{'pattern'} ? : 0 0 0
16160 0 my $strp = DateTime::Format::Strptime->new(
16161 pattern => $pattern,
16162 locale => 'en_GB',
16163 time_zone => $tz,
16164 );
16165 0 $dt->set_formatter( $strp );
16166 0 $args->{ $k } = $dt;
16167 }
16168 }
16169 }
16170 }
16171 elsif( ref( $dict ) eq 'CODE' )
16172 {
16173 0 my $res = $dict->( $args->{ $k } );
16174 0 ▶ push( @$err, "Invalid parameter \"$k\" with value \"$args->{$k}\": $res" ) if( $res );
Branch: 1 branch
BranchTrueFalseTotal
if $res 0 0 0
16175 }
16176 }
16177
16178 0 ▶ $args->{expand} = $self->expand if( !CORE::length( $args->{expand} ) );
Branch: 1 branch
BranchTrueFalseTotal
unless length $args->{"expand"} 0 0 0
16179 0 ▶ if( exists( $args->{expand} ) )
Branch: 1 branch
BranchTrueFalseTotal
if (exists $args->{'expand'}) { } 0 0 0
16180 {
16181 0 my $depth;
16182 0 my $no_need_to_check = 0;
16183 0 ▶ if( $args->{expand} eq 'all' || $args->{expand} =~ /^\d+$/ )
Branch: 1 branch
BranchTrueFalseTotal
if ($args->{"expand"} eq "all" or $args->{"expand"} =~ /^\d+$/) 0 0 0
Condition0%0/3
$args->{"expand"} eq "all" or $args->{"expand"} =~ /^\d+$/
l!l&&r!l&&!r
000
MC/DC0%0/2
$args->{"expand"} eq "all" or $args->{"expand"} =~ /^\d+$/
$args->{"expand"} eq "all" $args->{"expand"} =~ /^\d+$/
Truth table0%0/3
A or B
A= $args->{"expand"} eq "all"B= $args->{"expand"} =~ /^\d+$/
ABresult
1X1
011
000
16184 {
16185 0 $no_need_to_check++;
16186 0 ▶ if( $args->{expand} =~ /^\d+$/ )
Branch: 1 branch
BranchTrueFalseTotal
if ($args->{'expand'} =~ /^\d+$/) { } 0 0 0
16187 {
16188 0 $depth = int( $args->{expand} );
16189 }
16190 else
16191 {
16192 0 $depth = $EXPAND_MAX_DEPTH;
16193 }
16194 0 ▶ if( exists( $okParams->{expandable} ) && exists( $okParams->{expandable}->{allowed} ) && ref( $okParams->{expandable}->{allowed} ) eq 'ARRAY' )
Branch: 1 branch
BranchTrueFalseTotal
if (exists $okParams->{'expandable'} and exists $okParams->{'expandable'}{'allowed'} and ref $okParams->{'expandable'}{'allowed'} eq 'ARRAY') { } 0 0 0
Condition0%0/6
exists $okParams->{"expandable"} and exists $okParams->{"expandable"}{"allowed"} and ref $okParams->{"expandable"}{"allowed"} eq "ARRAY"
!ll&&!rl&&r
000
exists $okParams->{"expandable"} and exists $okParams->{"expandable"}{"allowed"}
!ll&&!rl&&r
000
MC/DC0%0/3
exists $okParams->{"expandable"} and exists $okParams->{"expandable"}{"allowed"} and ref $okParams->{"expandable"}{"allowed"} eq "ARRAY"
exists $okParams->{"expandable"} exists $okParams->{"expandable"}{"allowed"} ref $okParams->{"expandable"}{"allowed"} eq "ARRAY"
Truth table0%0/4
A and B and C
A= exists $okParams->{"expandable"}B= exists $okParams->{"expandable"}{"allowed"}C= ref $okParams->{"expandable"}{"allowed"} eq "ARRAY"
ABCresult
0XX0
10X0
1100
1111
16195 {
16196 # We duplicate the array, so the original array does not get modified
16197 # This is important, because methods that list objects such as customer_list use the 'data' property
16198 0 $args->{expand} = [ @{$okParams->{expandable}->{allowed}} ];
16199 }
16200 # There is no allowed expandable properties, but it was called anyway, so we do this to avoid an error below
16201 else
16202 {
16203 0 $args->{expand} = [];
16204 }
16205 }
16206 0 ▶ push( @$err, sprintf( "expand property should be an array, but instead '%s' was provided", $args->{expand} ) ) if( ref( $args->{expand} ) ne 'ARRAY' );
Branch: 1 branch
BranchTrueFalseTotal
if ref $args->{"expand"} ne "ARRAY" 0 0 0
16207 0 ▶ if( scalar( @{$args->{expand}} ) && exists( $okParams->{expandable} ) )
Branch: 2 branches
BranchTrueFalseTotal
if (scalar @{$args->{'expand'};} and exists $okParams->{'expandable'}) { } 0 0 0
elsif (not exists $okParams->{'expandable'}) { } 0 0 0
Condition0%0/3
scalar @{$args->{"expand"};} and exists $okParams->{"expandable"}
!ll&&!rl&&r
000
MC/DC0%0/2
scalar @{$args->{"expand"};} and exists $okParams->{"expandable"}
scalar @{$args->{"expand"};} exists $okParams->{"expandable"}
Truth table0%0/3
A and B
A= scalar @{$args->{"expand"};}B= exists $okParams->{"expandable"}
ABresult
0X0
100
111
16208 {
16209 0 ▶ CORE::return( $self->error( "expandable parameter is not a hash (", ref( $okParams->{expandable} ), ")." ) ) if( ref( $okParams->{expandable} ) ne 'HASH' );
Branch: 1 branch
BranchTrueFalseTotal
if ref $okParams->{"expandable"} ne "HASH" 0 0 0
16210 0 ▶ CORE::return( $self->error( "No \"allowed\" attribute in the expandable parameter hash." ) ) if( !CORE::exists( $okParams->{expandable}->{allowed} ) );
Branch: 1 branch
BranchTrueFalseTotal
unless exists $okParams->{"expandable"}{"allowed"} 0 0 0
16211 0 my $expandable = $okParams->{expandable}->{allowed};
16212 0 my $errExpandables = [];
16213 0 ▶ if( !$no_need_to_check )
Branch: 2 branches
BranchTrueFalseTotal
if (not $no_need_to_check) { } 0 0 0
elsif ($depth) { } 0 0 0
16214 {
16215 0 ▶ if( scalar( @$expandable ) )
Branch: 1 branch
BranchTrueFalseTotal
if (scalar @$expandable) { } 0 0 0
16216 {
16217 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' );
Branch: 1 branch
BranchTrueFalseTotal
if ref $expandable ne "ARRAY" 0 0 0
16218 # Return a list with the dot prefixed with backslash
16219 0 my $list = join( '|', map( quotemeta( $_ ), @$expandable ) );
16220 0 ▶ my $re = $okParams->{expandable}->{data_prefix_is_ok} ? qr/^(?:data\.)?($list)$/ : qr/^($list)$/;
Branch: 1 branch
BranchTrueFalseTotal
$okParams->{'expandable'}{'data_prefix_is_ok'} ? : 0 0 0
16221 0 foreach my $k ( @{$args->{expand}} )
16222 {
16223 0 ▶ if( $k !~ /$re/ )
Branch: 1 branch
BranchTrueFalseTotal
unless ($k =~ /$re/) 0 0 0
16224 {
16225 0 push( @$errExpandables, $k );
16226 }
16227 }
16228 }
16229 else
16230 {
16231 0 push( @$errExpandables, @{$args->{expand}} );
16232 }
16233 }
16234 elsif( $depth )
16235 {
16236 0 ▶ my $max_depth = CORE::length( $depth ) ? $depth : $EXPAND_MAX_DEPTH;
Branch: 1 branch
BranchTrueFalseTotal
length $depth ? : 0 0 0
16237 0 ▶ for( my $i = 0; $i < scalar( @{$args->{expand}} ); $i++ )
Branch: 1 branch
BranchTrueFalseTotal
if ($i < scalar @{$args->{"expand"};}) 0 0 0
16238 {
16239 # Count the number of dots. Make sure this does not exceed the $EXPAND_MAX_DEPTH which is 4 as of today (2020-02-23)
16240 # my $this_depth = scalar( () = $args->{expand}->[$i] =~ /\./g );
16241 0 my $path_parts = [split( /\./, $args->{expand}->[$i] )];
16242 0 ▶ if( scalar( @$path_parts ) > $max_depth )
Branch: 1 branch
BranchTrueFalseTotal
if (scalar @$path_parts > $max_depth) 0 0 0
16243 {
16244 0 my $old = [CORE::splice( @$path_parts, $max_depth - 1 )];
16245 0 $args->{expand}->[$i] = $path_parts;
16246 }
16247 }
16248 }
16249 0 ▶ push( @$err, sprintf( "The following properties are not allowed to expand: %s", join( ', ', @$errExpandables ) ) ) if( scalar( @$errExpandables ) );
Branch: 1 branch
BranchTrueFalseTotal
if scalar @$errExpandables 0 0 0
16250 }
16251 elsif( !exists( $okParams->{expandable} ) )
16252 {
16253 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}} ) );
Branch: 1 branch
BranchTrueFalseTotal
if scalar @{$args->{"expand"};} 0 0 0
16254 }
16255 }
16256 else
16257 {
16258 }
16259 0 my @private_params = grep( /^_/, keys( %$args ) );
16260 0 CORE::delete( @$args{ @private_params } );
16261 0 CORE::return( $err );
16262 }
16263  
16264 sub _check_required
16265 0 ▶{
Subroutine _check_required: not called CC=6 SCAR=37.4
16266 0 my $self = shift( @_ );
16267 0 my $required = shift( @_ );
16268 0 ▶ CORE::return( $self->error( "I was expecting an array reference of required field." ) ) if( ref( $required ) ne 'ARRAY' );
Branch: 1 branch
BranchTrueFalseTotal
if ref $required ne "ARRAY" 0 0 0
16269 0 my $args = shift( @_ );
16270 0 ▶ CORE::return( $self->error( "I was expecting an hash reference of parameters." ) ) if( ref( $args ) ne 'HASH' );
Branch: 1 branch
BranchTrueFalseTotal
if ref $args ne "HASH" 0 0 0
16271 0 my $err = [];
16272 0 foreach my $f ( @$required )
16273 {
16274 0 ▶ push( @$err, "Parameter $f is missing, and is required." ) if( !CORE::exists( $args->{ $f } ) || !CORE::length( $args->{ $f } ) );
Branch: 1 branch
BranchTrueFalseTotal
unless exists $args->{$f} and length $args->{$f} 0 0 0
Condition0%0/3
exists $args->{$f} and length $args->{$f}
!ll&&!rl&&r
000
MC/DC0%0/2
exists $args->{$f} and length $args->{$f}
exists $args->{$f} length $args->{$f}
Truth table0%0/3
A and B
A= exists $args->{$f}B= length $args->{$f}
ABresult
0X0
100
111
16275 }
16276 0 CORE::return( $args );
16277 }
16278  
16279 # As in opposite of expand
16280 # This is used for switching object to their id for Stripe api methods that post data.
16281 # Objects are expanded when retrieving data, but when posting data, objects should be represented to Stripe by their id
16282 sub _contract
16283 0 ▶{
Subroutine _contract: not called CC=36 SCAR=71.9
16284 0 my $self = shift( @_ );
16285 0 ▶ my $class = shift( @_ ) || CORE::return( $self->error( "No object class was provided to contract objects within." ) );
Condition0%0/2
shift @_ || (return $self->error('No object class was provided to contract objects within.'))
l!l
00
MC/DC0%0/1
shift @_ || (return $self->error('No object class was provided to contract objects within.'))
shift @_
Truth table0%0/2
A
A= shift @_
Aresult
11
00
16286 0 ▶ my $args = shift( @_ ) || CORE::return( $self->error( "No data to process for class \"$class\" was provided." ) );
Condition0%0/2
shift @_ || (return $self->error(qq[No data to process for class "$class" was provided.]))
l!l
00
MC/DC0%0/1
shift @_ || (return $self->error(qq[No data to process for class "$class" was provided.]))
shift @_
Truth table0%0/2
A
A= shift @_
Aresult
11
00
16287 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 ) );
Branch: 1 branch
BranchTrueFalseTotal
if ref $args ne "HASH" and ref $args ne "Module::Generic::Hash" and not $self->_is_object($args) 0 0 0
Condition0%0/6
ref $args ne "HASH" and ref $args ne "Module::Generic::Hash" and not $self->_is_object($args)
!ll&&!rl&&r
000
ref $args ne "HASH" and ref $args ne "Module::Generic::Hash"
!ll&&!rl&&r
000
MC/DC0%0/3
ref $args ne "HASH" and ref $args ne "Module::Generic::Hash" and not $self->_is_object($args)
ref $args ne "HASH" ref $args ne "Module::Generic::Hash" not $self->_is_object($args)
Truth table0%0/4
A and B and not(C)
A= ref $args ne "HASH"B= ref $args ne "Module::Generic::Hash"C= not $self->_is_object($args)
ABCresult
0XX0
10X0
1100
1111
16288 0 ▶ CORE::return( $self->error( "No class \"$class\" found to contract the possible objects contained." ) ) if( !exists( $EXPANDABLES_BY_CLASS->{ $class } ) );
Branch: 1 branch
BranchTrueFalseTotal
unless exists $Net::API::Stripe::EXPANDABLES_BY_CLASS->{$class} 0 0 0
16289 0 my $ref = $EXPANDABLES_BY_CLASS->{ $class };
16290 0 ▶ CORE::return( $self->error( "Definition hash found for class \"$class\" is not an hash! This should not happen." ) ) if( ref( $ref ) ne 'HASH' );
Branch: 1 branch
BranchTrueFalseTotal
if ref $ref ne "HASH" 0 0 0
16291 0 PROPERTY: foreach my $p ( sort( keys( %$ref ) ) )
16292 {
16293 0 ▶ if( CORE::index( $p, '.' ) != -1 )
Branch: 1 branch
BranchTrueFalseTotal
if (index($p, '.') != -1) { } 0 0 0
16294 {
16295 0 my @parts = split( /\./, $p );
16296 # Can be an object or just a hash
16297 0 my $obj = $args;
16298 0 ▶ PART: for( my $i = 0; $i < scalar( @parts ); $i++ )
Branch: 1 branch
BranchTrueFalseTotal
if ($i < scalar @parts) 0 0 0
16299 {
16300 0 my $prop = $parts[ $i ];
16301 0 my $this;
16302 my $type;
16303 0 ▶ if( $self->_is_object( $obj ) )
Branch: 2 branches
BranchTrueFalseTotal
if ($self->_is_object($obj)) { } 0 0 0
elsif (ref $obj eq 'HASH' or ref $obj eq 'Module::Generic::Hash') { } 0 0 0
16304 {
16305 0 $type = 'object';
16306 0 ▶ if( !( defined( my $code = $obj->can( $prop ) ) ) )
Branch: 1 branch
BranchTrueFalseTotal
unless (defined(my $code = $obj->can($prop))) 0 0 0
16307 {
16308 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\"." ) );
16309 }
16310 0 $this = $obj->$prop();
16311 }
16312 ▶ elsif( ref( $obj ) eq 'HASH' || ref( $obj ) eq 'Module::Generic::Hash' )
Condition0%0/3
ref $obj eq "HASH" or ref $obj eq "Module::Generic::Hash"
l!l&&r!l&&!r
000
MC/DC0%0/2
ref $obj eq "HASH" or ref $obj eq "Module::Generic::Hash"
ref $obj eq "HASH" ref $obj eq "Module::Generic::Hash"
Truth table0%0/3
A or B
A= ref $obj eq "HASH"B= ref $obj eq "Module::Generic::Hash"
ABresult
1X1
011
000
16313 {
16314 0 $type = 'hash';
16315 0 $this = $obj->{ $prop };
16316 }
16317 0 ▶ next PROPERTY if( !length( $this ) );
Branch: 1 branch
BranchTrueFalseTotal
unless length $this 0 0 0
16318
16319 # If this is an object, we convert it to its id string representation for Stripe, or
16320 # we continue to drill down if the path continues
16321 0 ▶ if( $self->_is_object( $this ) )
Branch: 2 branches
BranchTrueFalseTotal
if ($self->_is_object($this)) { } 0 0 0
elsif (ref $this eq 'HASH' or ref $this eq 'Module::Generic::Hash') { } 0 0 0
16322 {
16323 # If this is the last element of this property path
16324 0 ▶ if( $i == $#parts )
Branch: 1 branch
BranchTrueFalseTotal
if ($i == $#parts) 0 0 0
16325 {
16326 0 ▶ if( $type eq 'object' )
Branch: 2 branches
BranchTrueFalseTotal
if ($type eq 'object') { } 0 0 0
elsif ($type eq 'hash') { } 0 0 0
16327 {
16328 0 $obj->$prop( $this->id );
16329 }
16330 elsif( $type eq 'hash' )
16331 {
16332 0 $obj->{ $prop } = $this->id;
16333 }
16334 }
16335 # Continue to drill down the property path
16336 0 $obj = $this;
16337 }
16338 ▶ elsif( ref( $this ) eq 'HASH' || ref( $this ) eq 'Module::Generic::Hash' )
Condition0%0/3
ref $this eq "HASH" or ref $this eq "Module::Generic::Hash"
l!l&&r!l&&!r
000
MC/DC0%0/2
ref $this eq "HASH" or ref $this eq "Module::Generic::Hash"
ref $this eq "HASH" ref $this eq "Module::Generic::Hash"
Truth table0%0/3
A or B
A= ref $this eq "HASH"B= ref $this eq "Module::Generic::Hash"
ABresult
1X1
011
000
16339 {
16340 0 ▶ if( $i == $#parts )
Branch: 1 branch
BranchTrueFalseTotal
if ($i == $#parts) 0 0 0
16341 {
16342 0 ▶ if( $type eq 'object' )
Branch: 2 branches
BranchTrueFalseTotal
if ($type eq 'object') { } 0 0 0
elsif ($type eq 'hash') { } 0 0 0
16343 {
16344 0 $obj->$prop( $this->{id} );
16345 }
16346 elsif( $type eq 'hash' )
16347 {
16348 0 $obj->{ $prop } = $this->{id};
16349 }
16350 }
16351 0 $obj = $this;
16352 }
16353 }
16354 }
16355 else
16356 {
16357 0 ▶ if( $self->_is_object( $args ) )
Branch: 2 branches
BranchTrueFalseTotal
if ($self->_is_object($args)) { } 0 0 0
elsif (ref $args eq 'HASH' or ref $args eq 'Module::Generic::Hash') { } 0 0 0
16358 {
16359 0 my $this = $args->$p();
16360 0 ▶ next if( !length( $this ) );
Branch: 1 branch
BranchTrueFalseTotal
unless length $this 0 0 0
16361 0 ▶ if( $self->_is_object( $this ) )
Branch: 2 branches
BranchTrueFalseTotal
if ($self->_is_object($this)) { } 0 0 0
elsif (ref $this eq 'HASH' or ref $this eq 'Module::Generic::Hash') { } 0 0 0
16362 {
16363 0 $args->$p( $this->id );
16364 }
16365 ▶ elsif( ref( $this ) eq 'HASH' || ref( $this ) eq 'Module::Generic::Hash' )
Condition0%0/3
ref $this eq "HASH" or ref $this eq "Module::Generic::Hash"
l!l&&r!l&&!r
000
MC/DC0%0/2
ref $this eq "HASH" or ref $this eq "Module::Generic::Hash"
ref $this eq "HASH" ref $this eq "Module::Generic::Hash"
Truth table0%0/3
A or B
A= ref $this eq "HASH"B= ref $this eq "Module::Generic::Hash"
ABresult
1X1
011
000
16366 {
16367 0 $args->$p( $this->{id} );
16368 }
16369 }
16370 ▶ elsif( ref( $args ) eq 'HASH' || ref( $args ) eq 'Module::Generic::Hash' )
Condition0%0/3
ref $args eq "HASH" or ref $args eq "Module::Generic::Hash"
l!l&&r!l&&!r
000
MC/DC0%0/2
ref $args eq "HASH" or ref $args eq "Module::Generic::Hash"
ref $args eq "HASH" ref $args eq "Module::Generic::Hash"
Truth table0%0/3
A or B
A= ref $args eq "HASH"B= ref $args eq "Module::Generic::Hash"
ABresult
1X1
011
000
16371 {
16372 0 my $this = $args->{ $p };
16373 0 ▶ next if( !length( $this ) );
Branch: 1 branch
BranchTrueFalseTotal
unless length $this 0 0 0
16374 0 ▶ if( $self->_is_object( $this ) )
Branch: 2 branches
BranchTrueFalseTotal
if ($self->_is_object($this)) { } 0 0 0
elsif (ref $this eq 'HASH' or ref $this eq 'Module::Generic::Hash') { } 0 0 0
16375 {
16376 0 $args->{ $p } = $this->id;
16377 }
16378 ▶ elsif( ref( $this ) eq 'HASH' || ref( $this ) eq 'Module::Generic::Hash' )
Condition0%0/3
ref $this eq "HASH" or ref $this eq "Module::Generic::Hash"
l!l&&r!l&&!r
000
MC/DC0%0/2
ref $this eq "HASH" or ref $this eq "Module::Generic::Hash"
ref $this eq "HASH" ref $this eq "Module::Generic::Hash"
Truth table0%0/3
A or B
A= ref $this eq "HASH"B= ref $this eq "Module::Generic::Hash"
ABresult
1X1
011
000
16379 {
16380 0 $args->{ $p } = $this->{id};
16381 }
16382 }
16383 }
16384 }
16385 0 CORE::return( $args );
16386 }
16387  
16388 sub _convert_boolean_for_json
16389 0 ▶{
Subroutine _convert_boolean_for_json: not called CC=2 SCAR=17.9
16390 0 my $self = shift( @_ );
16391 0 ▶ my $hash = shift( @_ ) || CORE::return( $self->pass_error );
Condition0%0/2
shift @_ || (return $self->pass_error)
l!l
00
MC/DC0%0/1
shift @_ || (return $self->pass_error)
shift @_
Truth table0%0/2
A
A= shift @_
Aresult
11
00
16392 0 my $seen = {};
16393 0 my $crawl;
16394 $crawl = sub
16395 0 ▶ {
Subroutine __ANON__: not called CC=7 SCAR=40.3
16396 0 my $this = shift( @_ );
16397 0 foreach my $k ( keys( %$this ) )
16398 {
16399 0 ▶ if( ref( $this->{ $k } ) eq 'HASH' )
Branch: 2 branches
BranchTrueFalseTotal
if (ref $this->{$k} eq 'HASH') { } 0 0 0
elsif ($self->_is_object($this->{$k}) and $this->{$k}->isa('Module::Generic::Boolean')) { } 0 0 0
16400 {
16401 0 my $addr = Scalar::Util::refaddr( $this->{ $k } );
16402 0 ▶ next if( ++$seen->{ $addr } > 1 );
Branch: 1 branch
BranchTrueFalseTotal
if ++$seen->{$addr} > 1 0 0 0
16403 0 $crawl->( $this->{ $k } );
16404 }
16405 ▶ elsif( $self->_is_object( $this->{ $k } ) && $this->{ $k }->isa( 'Module::Generic::Boolean' ) )
Condition0%0/3
$self->_is_object($this->{$k}) and $this->{$k}->isa("Module::Generic::Boolean")
!ll&&!rl&&r
000
MC/DC0%0/2
$self->_is_object($this->{$k}) and $this->{$k}->isa("Module::Generic::Boolean")
$self->_is_object($this->{$k}) $this->{$k}->isa("Module::Generic::Boolean")
Truth table0%0/3
A and B
A= $self->_is_object($this->{$k})B= $this->{$k}->isa("Module::Generic::Boolean")
ABresult
0X0
100
111
16406 {
16407 0 ▶ $this->{ $k } = $this->{ $k } ? 'true' : 'false';
Branch: 1 branch
BranchTrueFalseTotal
$this->{$k} ? : 0 0 0
16408 }
16409 }
16410 0 };
16411 0 $crawl->( $hash );
16412 }
16413  
16414 sub _encode_params
16415 0 ▶{
Subroutine _encode_params: not called CC=2 SCAR=17.9
16416 0 my $self = shift( @_ );
16417 0 my $args = shift( @_ );
16418 0 ▶ if( $self->{ '_encode_with_json' } )
Branch: 1 branch
BranchTrueFalseTotal
if ($self->{"_encode_with_json"}) 0 0 0
16419 {
16420 0 CORE::return( $self->json->utf8->allow_blessed->encode( $args ) );
16421 }
16422 0 my $encode;
16423 $encode = sub
16424 0 ▶ {
Subroutine __ANON__: not called CC=24 SCAR=64.0
16425 0 my( $pref, $data ) = @_;
16426 0 my $ref = ref( $data );
16427 0 my $type = lc( ref( $data ) );
16428 0 my $comp = [];
16429 0 ▶ if( $type eq 'hash' || $ref eq 'Module::Generic::Hash' )
Branch: 7 branches
BranchTrueFalseTotal
if ($type eq 'hash' or $ref eq 'Module::Generic::Hash') { } 0 0 0
elsif ($type eq 'array' or $ref eq 'Module::Generic::Array') { } 0 0 0
elsif (ref $data eq 'JSON::PP::Boolean' or ref $data eq 'Module::Generic::Boolean') { } 0 0 0
elsif (ref $data eq 'SCALAR' and $$data == 1 || $$data == 0) { } 0 0 0
elsif ($ref and builtin::reftype($data) eq 'SCALAR') { } 0 0 0
elsif ($type eq 'datetime') { } 0 0 0
elsif ($type) { } 0 0 0
Condition0%0/3
$type eq "hash" or $ref eq "Module::Generic::Hash"
l!l&&r!l&&!r
000
MC/DC0%0/2
$type eq "hash" or $ref eq "Module::Generic::Hash"
$type eq "hash" $ref eq "Module::Generic::Hash"
Truth table0%0/3
A or B
A= $type eq "hash"B= $ref eq "Module::Generic::Hash"
ABresult
1X1
011
000
16430 {
16431 0 foreach my $k ( sort( keys( %$data ) ) )
16432 {
16433 0 my $ke = URI::Escape::uri_escape( $k );
16434 0 my $pkg = Scalar::Util::blessed( $data->{ $k } );
16435 0 ▶ if( $pkg && $pkg =~ /^Net::API::Stripe/ &&
Branch: 1 branch
BranchTrueFalseTotal
if ($pkg and $pkg =~ /^Net::API::Stripe/ and $data->{$k}->can("id") and $data->{$k}->id) 0 0 0
Condition0%0/9
$pkg and $pkg =~ /^Net::API::Stripe/ and $data->{$k}->can("id") and $data->{$k}->id
!ll&&!rl&&r
000
$pkg and $pkg =~ /^Net::API::Stripe/ and $data->{$k}->can("id")
!ll&&!rl&&r
000
$pkg and $pkg =~ /^Net::API::Stripe/
!ll&&!rl&&r
000
MC/DC0%0/4
$pkg and $pkg =~ /^Net::API::Stripe/ and $data->{$k}->can("id") and $data->{$k}->id
$pkg $pkg =~ /^Net::API::Stripe/ $data->{$k}->can("id") $data->{$k}->id
Truth table0%0/5
A and B and C and D
A= $pkgB= $pkg =~ /^Net::API::Stripe/C= $data->{$k}->can("id")D= $data->{$k}->id
ABCDresult
0XXX0
10XX0
110X0
11100
11111
16436 $data->{ $k }->can( 'id' ) &&
16437 $data->{ $k }->id )
16438 {
16439 0 push( @$comp, "${pref}${ke}" . '=' . $data->{ $k }->id );
16440 0 next;
16441 }
16442 0 ▶ my $res = $encode->( ( $pref ? sprintf( '%s[%s]', $pref, $ke ) : $ke ), $data->{ $k } );
Branch: 1 branch
BranchTrueFalseTotal
$pref ? : 0 0 0
16443 0 push( @$comp, @$res );
16444 }
16445 }
16446 ▶ elsif( $type eq 'array' || $ref eq 'Module::Generic::Array' )
Condition0%0/3
$type eq "array" or $ref eq "Module::Generic::Array"
l!l&&r!l&&!r
000
MC/DC0%0/2
$type eq "array" or $ref eq "Module::Generic::Array"
$type eq "array" $ref eq "Module::Generic::Array"
Truth table0%0/3
A or B
A= $type eq "array"B= $ref eq "Module::Generic::Array"
ABresult
1X1
011
000
16447 {
16448 # 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
16449 0 ▶ for( my $i = 0; $i < scalar( @$data ); $i++ )
Branch: 1 branch
BranchTrueFalseTotal
if ($i < scalar @$data) 0 0 0
16450 {
16451 0 ▶ my $res = $encode->( ( $pref ? sprintf( '%s[%d]', $pref, $i ) : sprintf( '[%d]', $i ) ), $data->[$i] );
Branch: 1 branch
BranchTrueFalseTotal
$pref ? : 0 0 0
16452 0 push( @$comp, @$res );
16453 }
16454 }
16455 ▶ elsif( ref( $data ) eq 'JSON::PP::Boolean' || ref( $data ) eq 'Module::Generic::Boolean' )
Condition0%0/3
ref $data eq "JSON::PP::Boolean" or ref $data eq "Module::Generic::Boolean"
l!l&&r!l&&!r
000
MC/DC0%0/2
ref $data eq "JSON::PP::Boolean" or ref $data eq "Module::Generic::Boolean"
ref $data eq "JSON::PP::Boolean" ref $data eq "Module::Generic::Boolean"
Truth table0%0/3
A or B
A= ref $data eq "JSON::PP::Boolean"B= ref $data eq "Module::Generic::Boolean"
ABresult
1X1
011
000
16456 {
16457 0 ▶ push( @$comp, sprintf( '%s=%s', $pref, $data ? 'true' : 'false' ) );
Branch: 1 branch
BranchTrueFalseTotal
$data ? : 0 0 0
16458 }
16459 ▶ elsif( ref( $data ) eq 'SCALAR' && ( $$data == 1 || $$data == 0 ) )
Condition0%0/6
ref $data eq "SCALAR" and $$data == 1 || $$data == 0
!ll&&!rl&&r
000
$$data == 1 or $$data == 0
l!l&&r!l&&!r
000
MC/DC0%0/3
ref $data eq "SCALAR" and $$data == 1 || $$data == 0
ref $data eq "SCALAR" $$data == 1 $$data == 0
Truth table0%0/4
A and B or C
A= ref $data eq "SCALAR"B= $$data == 1C= $$data == 0
ABCresult
0XX0
1000
11X1
1011
16460 {
16461 0 ▶ push( @$comp, sprintf( '%s=%s', $pref, $$data ? 'true' : 'false' ) );
Branch: 1 branch
BranchTrueFalseTotal
$$data ? : 0 0 0
16462 }
16463 # Other type of scalar like Module::Generic
16464 ▶ elsif( $ref && Scalar::Util::reftype( $data ) eq 'SCALAR' )
Condition0%0/3
$ref and builtin::reftype($data) eq "SCALAR"
!ll&&!rl&&r
000
MC/DC0%0/2
$ref and builtin::reftype($data) eq "SCALAR"
$ref builtin::reftype($data) eq "SCALAR"
Truth table0%0/3
A and B
A= $refB= builtin::reftype($data) eq "SCALAR"
ABresult
0X0
100
111
16465 {
16466 0 push( @$comp, sprintf( '%s=%s', $pref, $$data ) );
16467 }
16468 elsif( $type eq 'datetime' )
16469 {
16470 0 push( @$comp, sprintf( '%s=%s', $pref, $data->epoch ) );
16471 }
16472 elsif( $type )
16473 {
16474 0 die( "Don't know what to do with data type $type\n" );
16475 }
16476 else
16477 {
16478 0 push( @$comp, sprintf( '%s=%s', $pref, URI::Escape::uri_escape_utf8( "$data" ) ) );
16479 }
16480 0 CORE::return( $comp );
16481 0 };
16482 0 my $res = $encode->( '', $args );
16483 0 CORE::return( join( '&', @$res ) );
16484 }
16485  
16486 sub _encode_params_multipart
16487 0 ▶{
Subroutine _encode_params_multipart: not called CC=3 SCAR=24.8
16488 0 my $self = shift( @_ );
16489 0 my $args = shift( @_ );
16490 0 my $opts = {};
16491 0 ▶ $opts = pop( @_ ) if( scalar( @_ ) && ref( $_[-1] ) eq 'HASH' );
Branch: 1 branch
BranchTrueFalseTotal
if scalar @_ and ref $_[-1] eq "HASH" 0 0 0
Condition0%0/3
scalar @_ and ref $_[-1] eq "HASH"
!ll&&!rl&&r
000
MC/DC0%0/2
scalar @_ and ref $_[-1] eq "HASH"
scalar @_ ref $_[-1] eq "HASH"
Truth table0%0/3
A and B
A= scalar @_B= ref $_[-1] eq "HASH"
ABresult
0X0
100
111
16492 my $set_value = sub
16493 0 ▶ {
Subroutine __ANON__: not called CC=11 SCAR=48.8
16494 0 my( $key, $val, $ref, $param ) = @_;
16495 0 ▶ $param = {} if( !CORE::length( $param ) );
Branch: 1 branch
BranchTrueFalseTotal
unless length $param 0 0 0
16496 0 ▶ $param->{encoding} = $opts->{encoding} if( !CORE::length( $param->{encoding} ) );
Branch: 1 branch
BranchTrueFalseTotal
unless length $param->{"encoding"} 0 0 0
16497 0 ▶ if( !CORE::exists( $ref->{ $key } ) )
Branch: 1 branch
BranchTrueFalseTotal
unless (exists $ref->{$key}) 0 0 0
16498 {
16499 0 $ref->{ $key } = [];
16500 }
16501 0 my $this = {};
16502 0 ▶ $this->{filename} = $param->{filename} if( CORE::length( $param->{filename} ) );
Branch: 1 branch
BranchTrueFalseTotal
if length $param->{"filename"} 0 0 0
16503 0 ▶ $this->{type} = $param->{type} if( CORE::length( $param->{type} ) );
Branch: 1 branch
BranchTrueFalseTotal
if length $param->{"type"} 0 0 0
16504 0 ▶ $val = Encode::encode_utf8( $val ) if( substr( $this->{type}, 0, 4 ) eq 'text' );
Branch: 1 branch
BranchTrueFalseTotal
if substr($this->{"type"}, 0, 4) eq "text" 0 0 0
16505 0 ▶ if( $param->{encoding} )
Branch: 1 branch
BranchTrueFalseTotal
if ($param->{'encoding'}) { } 0 0 0
16506 {
16507 0 ▶ if( $param->{encoding} eq 'qp' || $param->{encoding} eq 'quoted-printable' )
Branch: 2 branches
BranchTrueFalseTotal
if ($param->{'encoding'} eq 'qp' or $param->{'encoding'} eq 'quoted-printable') { } 0 0 0
elsif ($param->{'encoding'} eq 'base64') { } 0 0 0
Condition0%0/3
$param->{"encoding"} eq "qp" or $param->{"encoding"} eq "quoted-printable"
l!l&&r!l&&!r
000
MC/DC0%0/2
$param->{"encoding"} eq "qp" or $param->{"encoding"} eq "quoted-printable"
$param->{"encoding"} eq "qp" $param->{"encoding"} eq "quoted-printable"
Truth table0%0/3
A or B
A= $param->{"encoding"} eq "qp"B= $param->{"encoding"} eq "quoted-printable"
ABresult
1X1
011
000
16508 {
16509 0 $this->{value} = MIME::QuotedPrint::encode_qp( $val );
16510 0 $this->{encoding} = 'Quoted-Printable';
16511 }
16512 elsif( $param->{encoding} eq 'base64' )
16513 {
16514 0 $this->{value} = MIME::Base64::encode_base64( $val );
16515 0 $this->{encoding} = 'Base64';
16516 }
16517 else
16518 {
16519 0 die( "Unknown encoding method \"", $param->{encoding}, "\"\n" );
16520 }
16521 }
16522 else
16523 {
16524 0 $this->{value} = $val;
16525 }
16526 0 CORE::push( @{$ref->{ $key }}, $this );
16527 0 };
16528
16529 0 my $encode;
16530 $encode = sub
16531 0 ▶ {
Subroutine __ANON__: not called CC=25 SCAR=64.8
16532 0 my( $pref, $data, $hash ) = @_;
16533 0 my $type = lc( ref( $data ) );
16534 0 ▶ if( $type eq 'hash' )
Branch: 5 branches
BranchTrueFalseTotal
if ($type eq 'hash') { } 0 0 0
elsif ($type eq 'array') { } 0 0 0
elsif (ref $data eq 'JSON::PP::Boolean' or ref $data eq 'Module::Generic::Boolean') { } 0 0 0
elsif (ref $data eq 'SCALAR' and $$data == 1 || $$data == 0) { } 0 0 0
elsif ($type) { } 0 0 0
16535 {
16536 0 foreach my $k ( sort( keys( %$data ) ) )
16537 {
16538 # my $ke = URI::Escape::uri_escape( $k );
16539 0 my $ke = $k;
16540 0 $ke =~ s/([\\\"])/\\$1/g;
16541 0 my $pkg = Scalar::Util::blessed( $data->{ $k } );
16542 0 ▶ if( $pkg && $pkg =~ /^Net::API::Stripe/ &&
Branch: 2 branches
BranchTrueFalseTotal
if ($pkg and $pkg =~ /^Net::API::Stripe/ and $data->{$k}->can('id') and $data->{$k}->id) { } 0 0 0
elsif (ref $data->{$k} eq 'HASH' and exists $data->{$k}{'_filepath'}) { } 0 0 0
Condition0%0/9
$pkg and $pkg =~ /^Net::API::Stripe/ and $data->{$k}->can("id") and $data->{$k}->id
!ll&&!rl&&r
000
$pkg and $pkg =~ /^Net::API::Stripe/ and $data->{$k}->can("id")
!ll&&!rl&&r
000
$pkg and $pkg =~ /^Net::API::Stripe/
!ll&&!rl&&r
000
MC/DC0%0/4
$pkg and $pkg =~ /^Net::API::Stripe/ and $data->{$k}->can("id") and $data->{$k}->id
$pkg $pkg =~ /^Net::API::Stripe/ $data->{$k}->can("id") $data->{$k}->id
Truth table0%0/5
A and B and C and D
A= $pkgB= $pkg =~ /^Net::API::Stripe/C= $data->{$k}->can("id")D= $data->{$k}->id
ABCDresult
0XXX0
10XX0
110X0
11100
11111
16543 $data->{ $k }->can( 'id' ) &&
16544 $data->{ $k }->id )
16545 {
16546 0 $set_value->( "${pref}${ke}", $data->{ $k }->id, $hash, { type => 'text/plain' } );
16547 0 next;
16548 }
16549 # This is a file
16550 ▶ elsif( ref( $data->{ $k } ) eq 'HASH' &&
Condition0%0/3
ref $data->{$k} eq "HASH" and exists $data->{$k}{"_filepath"}
!ll&&!rl&&r
000
MC/DC0%0/2
ref $data->{$k} eq "HASH" and exists $data->{$k}{"_filepath"}
ref $data->{$k} eq "HASH" exists $data->{$k}{"_filepath"}
Truth table0%0/3
A and B
A= ref $data->{$k} eq "HASH"B= exists $data->{$k}{"_filepath"}
ABresult
0X0
100
111
16551 CORE::exists( $data->{ $k }->{_filepath} ) )
16552 {
16553 0 ▶ CORE::return( $self->error( "File path argument is actually empty" ) ) if( !CORE::length( $data->{ $k }->{_filepath} ) );
Branch: 1 branch
BranchTrueFalseTotal
unless length $data->{$k}{"_filepath"} 0 0 0
16554 0 my $this_file = Module::Generic::File::file( $data->{ $k }->{_filepath} );
16555 0 my $fname = $this_file->basename;
16556 0 ▶ if( !$this_file->exists )
Branch: 2 branches
BranchTrueFalseTotal
if (not $this_file->exists) { } 0 0 0
elsif (not $this_file->can_read) { } 0 0 0
16557 {
16558 0 $self->error( "File \"$this_file\" does not exist." );
16559 0 next;
16560 }
16561 elsif( !$this_file->can_read )
16562 {
16563 0 $self->error( "File \"$this_file\" is not reaable by uid $>." );
16564 0 next;
16565 }
16566 0 ▶ my $binary = $this_file->load ||
Condition0%0/2
$this_file->load || (return $self->pass_error($this_file->error))
l!l
00
MC/DC0%0/1
$this_file->load || (return $self->pass_error($this_file->error))
$this_file->load
Truth table0%0/2
A
A= $this_file->load
Aresult
11
00
16567 return( $self->pass_error( $this_file->error ) );
16568 0 my $mime_type = $this_file->finfo->mime_type;
16569 0 $fname =~ s/([\\\"])/\\$1/g;
16570 0 $set_value->( "${pref}${ke}", $binary, $hash, { encoding => 'base64', filename => $fname, type => $mime_type } );
16571 0 next;
16572 }
16573 0 ▶ $encode->( ( $pref ? sprintf( '%s[%s]', $pref, $ke ) : $ke ), $data->{ $k }, $hash );
Branch: 1 branch
BranchTrueFalseTotal
$pref ? : 0 0 0
16574 }
16575 }
16576 elsif( $type eq 'array' )
16577 {
16578 # 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
16579 0 ▶ for( my $i = 0; $i < scalar( @$data ); $i++ )
Branch: 1 branch
BranchTrueFalseTotal
if ($i < scalar @$data) 0 0 0
16580 {
16581 0 ▶ $encode->( ( $pref ? sprintf( '%s[%d]', $pref, $i ) : sprintf( '[%d]', $i ) ), $data->[$i], $hash );
Branch: 1 branch
BranchTrueFalseTotal
$pref ? : 0 0 0
16582 }
16583 }
16584 ▶ elsif( ref( $data ) eq 'JSON::PP::Boolean' || ref( $data ) eq 'Module::Generic::Boolean' )
Condition0%0/3
ref $data eq "JSON::PP::Boolean" or ref $data eq "Module::Generic::Boolean"
l!l&&r!l&&!r
000
MC/DC0%0/2
ref $data eq "JSON::PP::Boolean" or ref $data eq "Module::Generic::Boolean"
ref $data eq "JSON::PP::Boolean" ref $data eq "Module::Generic::Boolean"
Truth table0%0/3
A or B
A= ref $data eq "JSON::PP::Boolean"B= ref $data eq "Module::Generic::Boolean"
ABresult
1X1
011
000
16585 {
16586 0 ▶ $set_value->( $pref, $data ? 'true' : 'false', $hash, { type => 'text/plain' } );
Branch: 1 branch
BranchTrueFalseTotal
$data ? : 0 0 0
16587 }
16588 ▶ elsif( ref( $data ) eq 'SCALAR' && ( $$data == 1 || $$data == 0 ) )
Condition0%0/6
ref $data eq "SCALAR" and $$data == 1 || $$data == 0
!ll&&!rl&&r
000
$$data == 1 or $$data == 0
l!l&&r!l&&!r
000
MC/DC0%0/3
ref $data eq "SCALAR" and $$data == 1 || $$data == 0
ref $data eq "SCALAR" $$data == 1 $$data == 0
Truth table0%0/4
A and B or C
A= ref $data eq "SCALAR"B= $$data == 1C= $$data == 0
ABCresult
0XX0
1000
11X1
1011
16589 {
16590 0 ▶ $set_value->( $pref, $$data ? 'true' : 'false', $hash, { type => 'text/plain' } );
Branch: 1 branch
BranchTrueFalseTotal
$$data ? : 0 0 0
16591 }
16592 elsif( $type )
16593 {
16594 0 die( "Don't know what to do with data type $type\n" );
16595 }
16596 else
16597 {
16598 0 $set_value->( $pref, $data, $hash, { type => 'text/plain' } );
16599 }
16600 0 };
16601 0 my $result = {};
16602 0 $encode->( '', $args, $result );
16603 0 CORE::return( $result );
16604 }
16605  
16606 sub _get_args
16607 0 ▶{
Subroutine _get_args: not called CC=7 SCAR=40.3
16608 0 my $self = shift( @_ );
16609 0 ▶ CORE::return( {} ) if( !scalar( @_ ) || ( scalar( @_ ) == 1 && !defined( $_[0] ) ) );
Branch: 1 branch
BranchTrueFalseTotal
if not scalar @_ or scalar @_ == 1 and not defined $_[0] 0 0 0
Condition0%0/6
not scalar @_ or scalar @_ == 1 and not defined $_[0]
l!l&&r!l&&!r
000
scalar @_ == 1 and not defined $_[0]
!ll&&!rl&&r
000
MC/DC0%0/3
not scalar @_ or scalar @_ == 1 and not defined $_[0]
not scalar @_ scalar @_ == 1 not defined $_[0]
Truth table0%0/4
not(A) or B and not(C)
A= not scalar @_B= scalar @_ == 1C= not defined $_[0]
ABCresult
1XX1
0111
00X0
0100
16610 # Arg is one of our unique object
16611 0 ▶ CORE::return( $_[0] ) if( $self->_is_a( $_[0] => 'Net::API::Stripe::Generic' ) );
Branch: 1 branch
BranchTrueFalseTotal
if $self->_is_a($_[0], "Net::API::Stripe::Generic") 0 0 0
16612 0 ▶ my $args = ref( $_[0] ) eq 'HASH' ? $_[0] : { @_ == 1 ? ( id => $_[0] ) : @_ };
Branch: 2 branches
BranchTrueFalseTotal
ref $_[0] eq 'HASH' ? : 0 0 0
@_ == 1 ? : 0 0 0
16613 0 CORE::return( $args );
16614 }
16615  
16616 sub _get_args_from_object
16617 0 ▶{
Subroutine _get_args_from_object: not called CC=4 SCAR=30.0
16618 0 my $self = shift( @_ );
16619 0 ▶ my $class = shift( @_ ) || CORE::return( $self->error( "No class was provided to get its information as parameters." ) );
Condition0%0/2
shift @_ || (return $self->error('No class was provided to get its information as parameters.'))
l!l
00
MC/DC0%0/1
shift @_ || (return $self->error('No class was provided to get its information as parameters.'))
shift @_
Truth table0%0/2
A
A= shift @_
Aresult
11
00
16620 0 my $args = {};
16621 0 ▶ if( $self->_is_object( $_[0] ) && $_[0]->isa( $class ) )
Branch: 1 branch
BranchTrueFalseTotal
if ($self->_is_object($_[0]) and $_[0]->isa($class)) { } 0 0 0
Condition0%0/3
$self->_is_object($_[0]) and $_[0]->isa($class)
!ll&&!rl&&r
000
MC/DC0%0/2
$self->_is_object($_[0]) and $_[0]->isa($class)
$self->_is_object($_[0]) $_[0]->isa($class)
Truth table0%0/3
A and B
A= $self->_is_object($_[0])B= $_[0]->isa($class)
ABresult
0X0
100
111
16622 {
16623 0 my $obj = shift( @_ );
16624 0 $args = $obj->as_hash({ json => 1 });
16625 0 $args->{expand} = 'all';
16626 0 $args->{_cleanup} = 1;
16627 0 $args->{_object} = $obj;
16628 }
16629 else
16630 {
16631 0 $args = $self->_get_args( @_ );
16632 }
16633 0 CORE::return( $args );
16634 }
16635  
16636 sub _get_method
16637 0 ▶{
Subroutine _get_method: not called CC=8 SCAR=42.8
16638 0 my $self = shift( @_ );
16639 0 my( $type, $action, $allowed ) = @_;
16640 0 ▶ CORE::return( $self->error( "No action was provided to get the associated method." ) ) if( !CORE::length( $action ) );
Branch: 1 branch
BranchTrueFalseTotal
unless length $action 0 0 0
16641 0 ▶ CORE::return( $self->error( "Allowed method list provided is not an array reference." ) ) if( ref( $allowed ) ne 'ARRAY' );
Branch: 1 branch
BranchTrueFalseTotal
if ref $allowed ne "ARRAY" 0 0 0
16642 0 ▶ CORE::return( $self->error( "Allowed method list provided is empty." ) ) if( !scalar( @$allowed ) );
Branch: 1 branch
BranchTrueFalseTotal
unless scalar @$allowed 0 0 0
16643 0 ▶ if( $action eq 'remove' )
Branch: 2 branches
BranchTrueFalseTotal
if ($action eq 'remove') { } 0 0 0
elsif ($action eq 'add') { } 0 0 0
16644 {
16645 0 $action = 'delete';
16646 }
16647 elsif( $action eq 'add' )
16648 {
16649 0 $action = 'create';
16650 }
16651 0 ▶ if( !scalar( grep( /^$action$/, @$allowed ) ) )
Branch: 1 branch
BranchTrueFalseTotal
unless (scalar grep(/^$action$/, @$allowed)) 0 0 0
16652 {
16653 0 CORE::return( $self->error( "Method $action is not authorised for $type" ) );
16654 }
16655 0 my $meth = $self->can( "${type}_${action}" );
16656 0 ▶ CORE::return( $self->error( "Method ${type}_${action} is not implemented in class '", ref( $self ), "'" ) ) if( !$meth );
Branch: 1 branch
BranchTrueFalseTotal
unless $meth 0 0 0
16657 0 CORE::return( $meth );
16658 }
16659  
16660 sub _instantiate
16661 0 ▶{
Subroutine _instantiate: not called CC=6 SCAR=37.4
16662 0 my $self = shift( @_ );
16663 0 my $name = shift( @_ );
16664 0 ▶ CORE::return( $self->{ $name } ) if( exists( $self->{ $name } ) && Scalar::Util::blessed( $self->{ $name } ) );
Branch: 1 branch
BranchTrueFalseTotal
if exists $self->{$name} and builtin::blessed($self->{$name}) 0 0 0
Condition0%0/3
exists $self->{$name} and builtin::blessed($self->{$name})
!ll&&!rl&&r
000
MC/DC0%0/2
exists $self->{$name} and builtin::blessed($self->{$name})
exists $self->{$name} builtin::blessed($self->{$name})
Truth table0%0/3
A and B
A= exists $self->{$name}B= builtin::blessed($self->{$name})
ABresult
0X0
100
111
16665 0 my $class = shift( @_ );
16666 0 my $this;
16667 0 local $@;
16668 # try-catch
16669 eval
16670 0 {
16671 # https://stackoverflow.com/questions/32608504/how-to-check-if-perl-module-is-available#comment53081298_32608860
16672 # require $class unless( defined( *{"${class}::"} ) );
16673 0 my $rc = eval{ $self->_load_class( $class ) };
16674 0 ▶ CORE::return( $self->error( "Unable to load class $class: $@" ) ) if( $@ );
Branch: 1 branch
BranchTrueFalseTotal
if $@ 0 0 0
16675 0 ▶ $this = $class->new(
Condition0%0/2
$class->new('debug', $self->debug, 'verbose', $self->verbose) || (return $self->pass_error($class->error))
l!l
00
MC/DC0%0/1
$class->new('debug', $self->debug, 'verbose', $self->verbose) || (return $self->pass_error($class->error))
$class->new('debug', $self->debug, 'verbose', $self->verbose)
Truth table0%0/2
A
A= $class->new('debug', $self->debug, 'verbose', $self->verbose)
Aresult
11
00
16676 'debug' => $self->debug,
16677 'verbose' => $self->verbose,
16678 ) || CORE::return( $self->pass_error( $class->error ) );
16679 0 $this->{parent} = $self;
16680 };
16681 0 ▶ if( $@ )
Branch: 1 branch
BranchTrueFalseTotal
if ($@) 0 0 0
16682 {
16683 0 CORE::return( $self->error({ code => 500, message => $@ }) );
16684 }
16685 0 CORE::return( $this );
16686 }
16687  
16688 sub _make_error
16689 0 ▶{
Subroutine _make_error: not called CC=3 SCAR=24.8
16690 0 my $self = shift( @_ );
16691 0 my $args = shift( @_ );
16692 0 ▶ $args->{skip_frames} = 1 if( !exists( $args->{skip_frames} ) && !defined( $args->{skip_frames} ) );
Branch: 1 branch
BranchTrueFalseTotal
unless exists $args->{"skip_frames"} or defined $args->{"skip_frames"} 0 0 0
Condition0%0/3
exists $args->{"skip_frames"} or defined $args->{"skip_frames"}
l!l&&r!l&&!r
000
MC/DC0%0/2
exists $args->{"skip_frames"} or defined $args->{"skip_frames"}
exists $args->{"skip_frames"} defined $args->{"skip_frames"}
Truth table0%0/3
A or B
A= exists $args->{"skip_frames"}B= defined $args->{"skip_frames"}
ABresult
1X1
011
000
16693 0 CORE::return( $self->error( $args ) );
16694 }
16695  
16696 sub _make_request
16697 0 ▶{
Subroutine _make_request: not called CC=15 SCAR=54.8
16698 0 my $self = shift( @_ );
16699 0 my $req = shift( @_ );
16700 0 my( $e, $resp, $ret, $is_error );
16701 $ret = eval
16702 0 {
16703 0 $req->header( 'Authorization' => $self->{auth} );
16704 0 $req->header( 'Stripe_Version' => $self->{version} );
16705 0 $req->header( 'Content-Type' => 'application/x-www-form-urlencoded' );
16706 0 ▶ $req->header( 'Content-Type' => 'application/json' ) if( $self->encode_with_json );
Branch: 1 branch
BranchTrueFalseTotal
if $self->encode_with_json 0 0 0
16707 0 $req->header( 'Accept' => 'application/json' );
16708  
16709 # This commented out block below is used when we use HTTP::Promise while enabling the use of promise, but since we do not need
16710 # my $prom = $self->http_client->request( $req )->then(sub
16711 # {
16712 # my( $resolve, $reject ) = @$_;
16713 # $resolve->( @_ );
16714 # })->wait;
16715 # $resp = $prom->result;
16716 # We use this more straightforward approach:
16717 0 $resp = $self->http_client->request( $req );
16718 0 ▶ return( $self->pass_error( $self->http_client->error ) ) if( !defined( $resp ) );
Branch: 1 branch
BranchTrueFalseTotal
unless defined $resp 0 0 0
16719 0 $self->{http_request} = $req;
16720 0 $self->{http_response} = $resp;
16721 0 ▶ if( $self->_is_a( $resp => 'HTTP::Promise::Exception' ) )
Branch: 1 branch
BranchTrueFalseTotal
if ($self->_is_a($resp, "HTTP::Promise::Exception")) 0 0 0
16722 {
16723 0 return( $self->pass_error( $resp ) );
16724 }
16725
16726 # if( $resp->code == 200 )
16727 0 ▶ if( $resp->is_success || $resp->is_redirect )
Branch: 1 branch
BranchTrueFalseTotal
if ($resp->is_success or $resp->is_redirect) { } 0 0 0
Condition0%0/3
$resp->is_success or $resp->is_redirect
l!l&&r!l&&!r
000
MC/DC0%0/2
$resp->is_success or $resp->is_redirect
$resp->is_success $resp->is_redirect
Truth table0%0/3
A or B
A= $resp->is_successB= $resp->is_redirect
ABresult
1X1
011
000
16728 {
16729 0 my $content = $resp->decoded_content;
16730 # decoded_content returns a scalar object, which we force into regular string, otherwise JSON complains it cannot parse it.
16731 0 my $hash = $self->json->utf8->decode( "${content}" );
16732 # $ret = data_object( $hash );
16733 0 CORE::return( $hash );
16734 }
16735 else
16736 {
16737 0 ▶ if( $resp->header( 'Content_Type' ) =~ m{text/html} )
Branch: 1 branch
BranchTrueFalseTotal
if ($resp->header('Content_Type') =~ m[text/html]) { } 0 0 0
16738 {
16739 0 CORE::return( $self->error({
16740 code => $resp->code,
16741 type => $resp->status,
16742 message => $resp->status
16743 }) );
16744 }
16745 else
16746 {
16747 0 my $content = $resp->decoded_content;
16748 # decoded_content returns a scalar object, which we force into regular string, otherwise JSON complains it cannot parse it.
16749 0 my $hash = $self->json->utf8->decode( "${content}" );
16750 # For example:
16751 # {
16752 # "error" => {
16753 # "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.",
16754 # "request_log_url" => "https://dashboard.stripe.com/test/logs/req_1Gy9CkPgC0eTw1?t=1666611614",
16755 # "type" => "invalid_request_error"
16756 # }
16757 # }
16758 0 my $ref = {};
16759 0 ▶ if( exists( $hash->{error} ) &&
Branch: 1 branch
BranchTrueFalseTotal
if (exists $hash->{'error'} and defined $hash->{'error'}) { } 0 0 0
Condition0%0/3
exists $hash->{"error"} and defined $hash->{"error"}
!ll&&!rl&&r
000
MC/DC0%0/2
exists $hash->{"error"} and defined $hash->{"error"}
exists $hash->{"error"} defined $hash->{"error"}
Truth table0%0/3
A and B
A= exists $hash->{"error"}B= defined $hash->{"error"}
ABresult
0X0
100
111
16760 defined( $hash->{error} ) )
16761 {
16762 0 ▶ if( ref( $hash->{error} ) eq 'HASH' &&
Branch: 1 branch
BranchTrueFalseTotal
if (ref $hash->{"error"} eq "HASH" and exists $hash->{"error"}{"message"}) 0 0 0
Condition0%0/3
ref $hash->{"error"} eq "HASH" and exists $hash->{"error"}{"message"}
!ll&&!rl&&r
000
MC/DC0%0/2
ref $hash->{"error"} eq "HASH" and exists $hash->{"error"}{"message"}
ref $hash->{"error"} eq "HASH" exists $hash->{"error"}{"message"}
Truth table0%0/3
A and B
A= ref $hash->{"error"} eq "HASH"B= exists $hash->{"error"}{"message"}
ABresult
0X0
100
111
16763 exists( $hash->{error}->{message} ) )
16764 {
16765 0 $ref->{message} = $hash->{error}->{message};
16766 0 foreach my $prop ( qw( charge code decline_code doc_url param payment_intent payment_method payment_method_type request_log_url setup_intent source type ) )
16767 {
16768 0 ▶ $ref->{ $prop } = $hash->{error}->{ $prop } if( exists( $hash->{error}->{ $prop } ) );
Branch: 1 branch
BranchTrueFalseTotal
if exists $hash->{"error"}{$prop} 0 0 0
16769 }
16770 }
16771 }
16772 else
16773 {
16774 0 $ref = $hash;
16775 }
16776 0 $ref->{http_code} = $resp->code;
16777 0 $ref->{http_headers} = $resp->headers;
16778 0 CORE::return( $self->error( $ref ) );
16779 }
16780 }
16781 };
16782 0 ▶ if( $@ )
Branch: 1 branch
BranchTrueFalseTotal
if ($@) 0 0 0
16783 {
16784 0 ▶ CORE::return( $self->error({
Branch: 1 branch
BranchTrueFalseTotal
$resp ? : 0 0 0
16785 # type => "Could not decode HTTP response: $@",
16786 $resp
16787 ? ( message => ( "Could not decode HTTP response: $@\n" ) . $resp->status_line . ' - ' . $resp->content )
16788 : ( message => "Could not decode HTTP response: $@" ),
16789 }) );
16790 }
16791 # CORE::return( $ret ) if( $ret );
16792 0 CORE::return( $ret );
16793 }
16794  
16795 sub _object_class_to_type
16796 0 ▶{
Subroutine _object_class_to_type: not called CC=5 SCAR=34.0
16797 0 my $self = shift( @_ );
16798 0 ▶ my $class = shift( @_ ) || CORE::return( $self->error( "No class was provided to find its associated type." ) );
Condition0%0/2
shift @_ || (return $self->error('No class was provided to find its associated type.'))
l!l
00
MC/DC0%0/1
shift @_ || (return $self->error('No class was provided to find its associated type.'))
shift @_
Truth table0%0/2
A
A= shift @_
Aresult
11
00
16799 0 ▶ $class = ref( $class ) if( $self->_is_object( $class ) );
Branch: 1 branch
BranchTrueFalseTotal
if $self->_is_object($class) 0 0 0
16800 0 my $ref = $Net::API::Stripe::TYPE2CLASS;
16801 0 foreach my $c ( keys( %$ref ) )
16802 {
16803 0 ▶ CORE::return( $c ) if( $ref->{ $c } eq $class );
Branch: 1 branch
BranchTrueFalseTotal
if $ref->{$c} eq $class 0 0 0
16804 }
16805 0 CORE::return;
16806 }
16807  
16808 sub _object_type_to_class
16809 0 ▶{
Subroutine _object_type_to_class: not called CC=3 SCAR=24.8
16810 0 my $self = shift( @_ );
16811 0 ▶ my $type = shift( @_ ) || CORE::return( $self->error( "No object type was provided" ) );
Condition0%0/2
shift @_ || (return $self->error('No object type was provided'))
l!l
00
MC/DC0%0/1
shift @_ || (return $self->error('No object type was provided'))
shift @_
Truth table0%0/2
A
A= shift @_
Aresult
11
00
16812 0 my $ref = $Net::API::Stripe::TYPE2CLASS;
16813 0 ▶ CORE::return( $self->error( "No object type '$type' known to get its related class for field $self->{_field}" ) ) if( !exists( $ref->{ $type } ) );
Branch: 1 branch
BranchTrueFalseTotal
unless exists $ref->{$type} 0 0 0
16814 0 CORE::return( $ref->{ $type } );
16815 }
16816  
16817 sub _process_array_objects
16818 0 ▶{
Subroutine _process_array_objects: not called CC=6 SCAR=37.4
16819 0 my $self = shift( @_ );
16820 0 my $class = shift( @_ );
16821 0 ▶ my $ref = shift( @_ ) || CORE::return( $self->error( "No array reference provided" ) );
Condition0%0/2
shift @_ || (return $self->error('No array reference provided'))
l!l
00
MC/DC0%0/1
shift @_ || (return $self->error('No array reference provided'))
shift @_
Truth table0%0/2
A
A= shift @_
Aresult
11
00
16822 0 ▶ CORE::return( $self->error( "Reference provided ($ref) is not an array reference." ) ) if( !ref( $ref ) || ref( $ref ) ne 'ARRAY' );
Branch: 1 branch
BranchTrueFalseTotal
if not ref $ref or ref $ref ne "ARRAY" 0 0 0
Condition0%0/3
not ref $ref or ref $ref ne "ARRAY"
l!l&&r!l&&!r
000
MC/DC0%0/2
not ref $ref or ref $ref ne "ARRAY"
not ref $ref ref $ref ne "ARRAY"
Truth table0%0/3
not(A) or B
A= not ref $refB= ref $ref ne "ARRAY"
ABresult
1X1
011
000
16823 0 ▶ for( my $i = 0; $i < scalar( @$ref ); $i++ )
Branch: 1 branch
BranchTrueFalseTotal
if ($i < scalar @$ref) 0 0 0
16824 {
16825 0 my $hash = $ref->[$i];
16826 0 ▶ next if( ref( $hash ) ne 'HASH' );
Branch: 1 branch
BranchTrueFalseTotal
if ref $hash ne "HASH" 0 0 0
16827 0 my $o = $class->new( %$hash );
16828 0 $ref->[$i] = $o;
16829 }
16830 0 CORE::return( $ref );
16831 }
16832  
16833 sub _response_to_object
16834 0 ▶{
Subroutine _response_to_object: not called CC=6 SCAR=37.4
16835 0 my $self = shift( @_ );
16836 0 my $class = shift( @_ );
16837 0 ▶ CORE::return( $self->error( "No hash was provided" ) ) if( !scalar( @_ ) );
Branch: 1 branch
BranchTrueFalseTotal
unless scalar @_ 0 0 0
16838 0 my $hash = $self->_get_args( @_ );
16839 # my $callbacks = $CALLBACKS->{ $class };
16840 0 my $o;
16841 0 local $@;
16842 # try-catch
16843 eval
16844 0 {
16845 # https://stackoverflow.com/questions/32608504/how-to-check-if-perl-module-is-available#comment53081298_32608860
16846 # eval( "require $class;" ) unless( defined( *{"${class}::"} ) );
16847 0 my $rc = eval{ $self->_load_class( $class ) };
16848 0 ▶ CORE::return( $self->error( "An error occured while trying to load the module $class: $@" ) ) if( $@ );
Branch: 1 branch
BranchTrueFalseTotal
if $@ 0 0 0
16849 $o = $class->new({
16850 '_parent' => $self,
16851 '_debug' => $self->{debug},
16852 '_dbh' => $self->{_dbh},
16853 0 ▶ }, $hash ) || CORE::return( $self->pass_error( $class->error ) );
Condition0%0/2
$class->new({'_parent', $self, '_debug', $self->{'debug'}, '_dbh', $self->{'_dbh'}}, $hash) || (return $self->pass_error($class->error))
l!l
00
MC/DC0%0/1
$class->new({'_parent', $self, '_debug', $self->{'debug'}, '_dbh', $self->{'_dbh'}}, $hash) || (return $self->pass_error($class->error))
$class->new({'_parent', $self, '_debug', $self->{'debug'}, '_dbh', $self->{'_dbh'}}, $hash)
Truth table0%0/2
A
A= $class->new({'_parent', $self, '_debug', $self->{'debug'}, '_dbh', $self->{'_dbh'}}, $hash)
Aresult
11
00
16854 };
16855 0 ▶ if( $@ )
Branch: 1 branch
BranchTrueFalseTotal
if ($@) 0 0 0
16856 {
16857 0 CORE::return( $self->error( $@ ) );
16858 }
16859 0 ▶ CORE::return( $self->pass_error( $class->error ) ) if( !defined( $o ) );
Branch: 1 branch
BranchTrueFalseTotal
unless defined $o 0 0 0
16860 0 CORE::return( $o );
16861 }
16862  
16863 # NOTE:: AUTOLOAD
16864 AUTOLOAD
16865 0 ▶{
Subroutine AUTOLOAD: not called CC=11 SCAR=45.6
16866 0 my $self;
16867 0 ▶ $self = shift( @_ ) if( Scalar::Util::blessed( $_[0] ) && $_[0]->isa( 'Net::API::Stripe' ) );
Branch: 1 branch
BranchTrueFalseTotal
if builtin::blessed($_[0]) and $_[0]->isa("Net::API::Stripe") 0 0 0
Condition0%0/3
builtin::blessed($_[0]) and $_[0]->isa("Net::API::Stripe")
!ll&&!rl&&r
000
MC/DC0%0/2
builtin::blessed($_[0]) and $_[0]->isa("Net::API::Stripe")
builtin::blessed($_[0]) $_[0]->isa("Net::API::Stripe")
Truth table0%0/3
A and B
A= builtin::blessed($_[0])B= $_[0]->isa("Net::API::Stripe")
ABresult
0X0
100
111
16868 0 my( $class, $meth );
16869 0 ▶ $class = ref( $self ) || __PACKAGE__;
Condition0%0/2
ref $self || __PACKAGE__
l!l
00
MC/DC0%0/1
ref $self || __PACKAGE__
ref $self
Truth table0%0/2
A
A= ref $self
Aresult
11
00
16870 0 $meth = $AUTOLOAD;
16871 0 ▶ if( CORE::index( $meth, '::' ) != -1 )
Branch: 1 branch
BranchTrueFalseTotal
if (index($meth, "::") != -1) 0 0 0
16872 {
16873 0 my $idx = rindex( $meth, '::' );
16874 0 $class = substr( $meth, 0, $idx );
16875 0 $meth = substr( $meth, $idx + 2 );
16876 }
16877
16878 # printf( STDERR __PACKAGE__ . "::AUTOLOAD: %d autoload subs found.\n", scalar( keys( %$AUTOLOAD_SUBS ) ) ) if( $DEBUG >= 4 );
16879 0 ▶ unless( scalar( keys( %$AUTOLOAD_SUBS ) ) )
Branch: 1 branch
BranchTrueFalseTotal
unless (scalar keys %$Net::API::Stripe::AUTOLOAD_SUBS) 0 0 0
16880 {
16881 0 &Net::API::Stripe::_autoload_subs();
16882 # 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 );
16883 }
16884
16885 # print( STDERR "Checking if sub '$meth' from class '$class' ($AUTOLOAD) is within the autoload subroutines\n" ) if( $DEBUG >= 4 );
16886 0 my $code;
16887 0 ▶ if( CORE::exists( $AUTOLOAD_SUBS->{ $meth } ) )
Branch: 1 branch
BranchTrueFalseTotal
if (exists $Net::API::Stripe::AUTOLOAD_SUBS->{$meth}) 0 0 0
16888 {
16889 0 $code = $AUTOLOAD_SUBS->{ $meth };
16890 }
16891
16892 0 ▶ if( CORE::defined( $code ) )
Branch: 1 branch
BranchTrueFalseTotal
if (defined $code) 0 0 0
16893 {
16894 # $code = Nice::Try->implement( $code ) if( CORE::index( $code, 'try' ) != -1 );
16895 # print( STDERR __PACKAGE__, "::AUTOLOAD: updated code for method \"$meth\" ($AUTOLOAD) and \$self '$self' is:\n$code\n" ) if( $DEBUG >= 4 );
16896 0 my $saved = $@;
16897 {
16898 0 ▶ no strict;
Subroutine BEGIN: called CC=1 SCAR=0.2
16899 0 eval( $code );
16900 }
16901 0 ▶ if( $@ )
Branch: 1 branch
BranchTrueFalseTotal
if ($@) 0 0 0
16902 {
16903 0 $@ =~ s/ at .*\n//;
16904 0 die( $@ );
16905 }
16906 0 $@ = $saved;
16907 # defined( &$AUTOLOAD ) || die( "AUTOLOAD inconsistency error for dynamic sub \"$meth\"." );
16908 0 ▶ my $ref = $class->can( $meth ) || die( "AUTOLOAD inconsistency error for dynamic sub \"$meth\"." );
Condition0%0/2
$class->can($meth) || die(qq[AUTOLOAD inconsistency error for dynamic sub "$meth".])
l!l
00
MC/DC0%0/1
$class->can($meth) || die(qq[AUTOLOAD inconsistency error for dynamic sub "$meth".])
$class->can($meth)
Truth table0%0/2
A
A= $class->can($meth)
Aresult
11
00
16909 # No need to keep it in the cache
16910 # delete( $AUTOLOAD_SUBS->{ $meth } );
16911 # goto( &$AUTOLOAD );
16912 # return( &$meth( $self, @_ ) ) if( $self );
16913 0 ▶ return( $ref->( $self, @_ ) ) if( $self );
Branch: 1 branch
BranchTrueFalseTotal
if $self 0 0 0
16914 1 ▶ no strict 'refs';
Subroutine BEGIN: called CC=1 SCAR=0.0
16915 0 return( &$AUTOLOAD( @_ ) );
16916 }
16917 0 die( "Method \"${meth}\" is not defined in Net::API::Stripe" );
16918 };
16919  
16920 DESTROY
16921 0 ▶{
Subroutine DESTROY: not called CC=1 SCAR=0.0
16922 # Do nothing; just avoid calling AUTOLOAD
16923 };
16924  
16925 1 1;
16926  
16927 __END__
↑ Summary Stripe/List.pm »