Issues (93)

Security Analysis    no request data  

This project does not seem to handle request data directly as such no vulnerable execution paths were found.

  Cross-Site Scripting
Cross-Site Scripting enables an attacker to inject code into the response of a web-request that is viewed by other users. It can for example be used to bypass access controls, or even to take over other users' accounts.
  File Exposure
File Exposure allows an attacker to gain access to local files that he should not be able to access. These files can for example include database credentials, or other configuration files.
  File Manipulation
File Manipulation enables an attacker to write custom data to files. This potentially leads to injection of arbitrary code on the server.
  Object Injection
Object Injection enables an attacker to inject an object into PHP code, and can lead to arbitrary code execution, file exposure, or file manipulation attacks.
  Code Injection
Code Injection enables an attacker to execute arbitrary code on the server.
  Response Splitting
Response Splitting can be used to send arbitrary responses.
  File Inclusion
File Inclusion enables an attacker to inject custom files into PHP's file loading mechanism, either explicitly passed to include, or for example via PHP's auto-loading mechanism.
  Command Injection
Command Injection enables an attacker to inject a shell command that is execute with the privileges of the web-server. This can be used to expose sensitive data, or gain access of your server.
  SQL Injection
SQL Injection enables an attacker to execute arbitrary SQL code on your database server gaining access to user data, or manipulating user data.
  XPath Injection
XPath Injection enables an attacker to modify the parts of XML document that are read. If that XML document is for example used for authentication, this can lead to further vulnerabilities similar to SQL Injection.
  LDAP Injection
LDAP Injection enables an attacker to inject LDAP statements potentially granting permission to run unauthorized queries, or modify content inside the LDAP tree.
  Header Injection
  Other Vulnerability
This category comprises other attack vectors such as manipulating the PHP runtime, loading custom extensions, freezing the runtime, or similar.
  Regex Injection
Regex Injection enables an attacker to execute arbitrary code in your PHP process.
  XML Injection
XML Injection enables an attacker to read files on your local filesystem including configuration files, or can be abused to freeze your web-server process.
  Variable Injection
Variable Injection enables an attacker to overwrite program variables with custom data, and can lead to further vulnerabilities.
Unfortunately, the security analysis is currently not available for your project. If you are a non-commercial open-source project, please contact support to gain access.

src/Configuration/AccountCreate.php (2 issues)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * This software may be modified and distributed under the terms
7
 * of the MIT license. See the LICENSE file for details.
8
 */
9
10
namespace Shapin\Stripe\Configuration;
11
12
use Shapin\Stripe\Model\Account\Account;
13
use Symfony\Component\Config\Definition\Builder\TreeBuilder;
14
use Symfony\Component\Config\Definition\ConfigurationInterface;
15
16
class AccountCreate implements ConfigurationInterface
17
{
18 14
    public function getConfigTreeBuilder()
19
    {
20 14
        $treeBuilder = new TreeBuilder('shapin_stripe');
21 14
        $rootNode = $treeBuilder->getRootNode();
22
23
        $rootNode
24 14
            ->children()
25 14
                ->enumNode('type')
26 14
                    ->isRequired()
27 14
                    ->values([Account::TYPE_STANDARD, Account::TYPE_CUSTOM])
28 14
                    ->info('Whether you’d like to create a Standard or Custom account. Standard accounts are normal Stripe accounts: Stripe will email the account holder to set up a username and password, and will handle all account management directly with them. Custom accounts have extra parameters available to them, and require that you, the platform, handle all communication with the account holder. Possible values are standard and custom.')
29 14
                ->end()
30 14
                ->scalarNode('country')
31 14
                    ->info('The country in which the account holder resides, or in which the business is legally established. This should be an ISO 3166-1 alpha-2 country code. For example, if you are in the United States and the business for which you’re creating an account is legally represented in Canada, you would use CA as the country for the account being created.')
32 14
                ->end()
33 14
                ->scalarNode('email')
34 14
                    ->info('The email address of the account holder. For Standard accounts, Stripe will email your user with instructions on how to set up their account. For Custom accounts, this is only to make the account easier to identify to you: Stripe will never directly email your users.')
35 14
                ->end()
36 14
                ->scalarNode('account_token')
37 14
                    ->info('An account token, used to securely provide details to the account.')
38 14
                ->end()
39 14
                ->scalarNode('business_logo')
40 14
                    ->info('(ID of a file upload) A logo for this account (at least 128px x 128px)')
41 14
                ->end()
42 14
                ->scalarNode('business_name')
43 14
                    ->info('The publicly sharable name for this account.')
44 14
                ->end()
45 14
                ->scalarNode('business_primary_color')
46 14
                    ->info('A CSS hex color value representing the primary branding color for this account.')
47 14
                ->end()
48 14
                ->scalarNode('business_url')
49 14
                    ->info('The URL that best shows the service or product provided by this account.')
50 14
                ->end()
51 14
                ->booleanNode('debit_negative_balances')
52 14
                    ->info('A Boolean indicating whether Stripe should try to reclaim negative balances from an attached bank account. For details, see Understanding Connect Account Balances.')
53 14
                ->end()
54 14
                ->arrayNode('decline_charge_on')
55 14
                    ->children()
56 14
                        ->booleanNode('avs_failure')
57 14
                            ->info('Whether Stripe automatically declines charges with an incorrect ZIP or postal code. This setting only applies when a ZIP or postal code is provided and they fail bank verification.')
58 14
                        ->end()
59 14
                        ->booleanNode('cvc_failure')
60 14
                            ->info('Whether Stripe automatically declines charges with an incorrect CVC. This setting only applies when a CVC is provided and it fails bank verification.')
61 14
                        ->end()
62 14
                    ->end()
63 14
                    ->info('Account-level settings to automatically decline certain types of charges, regardless of the card issuer’s decision.')
64 14
                ->end()
65 14
                ->scalarNode('default_currency')
66 14
                    ->info('Three-letter ISO currency code representing the default currency for the account. This must be a currency that Stripe supports in the account’s country.')
67 14
                ->end()
68 14
                ->arrayNode('external_account')
69 14
                    ->children()
70 14
                        ->scalarNode('object')
71 14
                            ->isRequired()
72 14
                            ->info('The type of external account. Should be bank_account.')
73 14
                        ->end()
74 14
                        ->scalarNode('country')
75 14
                            ->isRequired()
76 14
                            ->info('The country in which the bank account is located.')
77 14
                        ->end()
78 14
                        ->scalarNode('currency')
79 14
                            ->isRequired()
80 14
                            ->info('The currency the bank account is in. This must be a country/currency pairing that Stripe supports.')
81 14
                        ->end()
82 14
                        ->scalarNode('account_holder_name')
83 14
                            ->info('The name of the person or business that owns the bank account. This field is required when attaching the bank account to a Customer object.')
84 14
                        ->end()
85 14
                        ->enumNode('account_holder_type')
86 14
                            ->values(['individual', 'company'])
87 14
                            ->info('The type of entity that holds the account. This can be either individual or company. This field is required when attaching the bank account to a Customer object.')
88 14
                        ->end()
89 14
                        ->scalarNode('routing_number')
90 14
                            ->info('The routing number, sort code, or other country-appropriate institution number for the bank account. For US bank accounts, this is required and should be the ACH routing number, not the wire routing number. If you are providing an IBAN for account_number, this field is not required.')
91 14
                        ->end()
92 14
                        ->scalarNode('account_number')
93 14
                            ->isRequired()
94 14
                            ->info('The account number for the bank account, in string form. Must be a checking account.')
95 14
                        ->end()
96 14
                    ->end()
97 14
                    ->info('A card or bank account to attach to the account. You can provide either a token, like the ones returned by Stripe.js, or a dictionary, as documented in the external_account parameter for bank account creation. By default, providing an external account sets it as the new default external account for its currency, and deletes the old default if one exists. To add additional external accounts without replacing the existing default for the currency, use the bank account or card creation API.')
98 14
                ->end()
99 14
                ->arrayNode('legal_entity')
100 14
                    ->children()
101 14
                        ->arrayNode('additional_owners')
102 14
                            ->children()
103 14
                                ->arrayNode('address')
104 14
                                    ->children()
105 14
                                        ->scalarNode('city')
106 14
                                            ->info('City, district, suburb, town, or village. This will be unset if you POST an empty value.')
107 14
                                        ->end()
108 14
                                        ->scalarNode('country')
109 14
                                            ->info('Two-letter country code (ISO 3166-1 alpha-2). This will be unset if you POST an empty value.')
110 14
                                        ->end()
111 14
                                        ->scalarNode('line1')
112 14
                                            ->info('Address line 1 (e.g., street, PO Box, or company name). This will be unset if you POST an empty value.')
113 14
                                        ->end()
114 14
                                        ->scalarNode('line2')
115 14
                                            ->info('Address line 2 (e.g., apartment, suite, unit, or building). This will be unset if you POST an empty value.')
116 14
                                        ->end()
117 14
                                        ->scalarNode('postal_code')
118 14
                                            ->info('ZIP or postal code. This will be unset if you POST an empty value.')
119 14
                                        ->end()
120 14
                                        ->scalarNode('state')
121 14
                                            ->info('State, county, province, or region. This will be unset if you POST an empty value.')
122 14
                                        ->end()
123 14
                                    ->end()
124 14
                                    ->info('The personal address of the owner, used for verification')
125 14
                                ->end()
126 14
                                ->arrayNode('dob')
127 14
                                    ->children()
128 14
                                        ->integerNode('day')
129 14
                                            ->isRequired()
130 14
                                            ->min(1)->max(31)
131 14
                                            ->info('The day of birth, between 1 and 31.')
132 14
                                        ->end()
133 14
                                        ->integerNode('month')
134 14
                                            ->isRequired()
135 14
                                            ->min(1)->max(12)
136 14
                                            ->info('The month of birth, between 1 and 12.')
137 14
                                        ->end()
138 14
                                        ->integerNode('year')
139 14
                                            ->isRequired()
140 14
                                            ->info('The four-digit year of birth.')
141 14
                                        ->end()
142 14
                                    ->end()
143 14
                                    ->info('The owner’s date of birth. Note that you must provide the entire date of birth at the same time. You cannot, for example, provide only the year without also providing month and day.')
144 14
                                ->end()
145 14
                                ->scalarNode('first_name')
146 14
                                    ->info('The owner’s first name. This will be unset if you POST an empty value.')
147 14
                                ->end()
148 14
                                ->scalarNode('last_name')
149 14
                                    ->info('The owner’s last name. This will be unset if you POST an empty value.')
150 14
                                ->end()
151 14
                                ->scalarNode('maiden_name')
152 14
                                    ->info('The owner’s maiden name. This will be unset if you POST an empty value.')
153 14
                                ->end()
154 14
                                ->scalarNode('personal_id_number')
155 14
                                    ->info('The government-issued ID number of the account representative, as appropriate for the representative’s country. (Examples are a Social Security Number in the U.S., or a Social Insurance Number in Canada). This will be unset if you POST an empty value.')
156 14
                                ->end()
157 14
                                ->arrayNode('verification')
158 14
                                    ->children()
159 14
                                        ->scalarNode('document')
160 14
                                            ->info('An ID returned by a file upload with a purpose value of identity_document. This will be unset if you POST an empty value.')
161 14
                                        ->end()
162 14
                                        ->scalarNode('status')
163 14
                                            ->info('The verification status of the provided ID. This will be unset if you POST an empty value.')
164 14
                                        ->end()
165 14
                                    ->end()
166 14
                                    ->info('Information on the verification state of the owner, including what information is needed and by when')
167 14
                                ->end()
168 14
                            ->end()
169 14
                            ->info('Information about anyone besides the account representative who owns at least 25% of the legal entity. This field is required only for Singapore, Hong Kong, and SEPA member countries. For details, see our Handling Identity Verification with the API documentation.')
170 14
                        ->end()
171 14
                        ->arrayNode('address')
172 14
                            ->children()
173 14
                                ->scalarNode('city')
174 14
                                    ->info('City, district, suburb, town, or village. This will be unset if you POST an empty value.')
175 14
                                ->end()
176 14
                                ->scalarNode('country')
177 14
                                    ->info('Two-letter country code (ISO 3166-1 alpha-2). This will be unset if you POST an empty value.')
178 14
                                ->end()
179 14
                                ->scalarNode('line1')
180 14
                                    ->info('Address line 1 (e.g., street, PO Box, or company name). This will be unset if you POST an empty value.')
181 14
                                ->end()
182 14
                                ->scalarNode('line2')
183 14
                                    ->info('Address line 2 (e.g., apartment, suite, unit, or building). This will be unset if you POST an empty value.')
184 14
                                ->end()
185 14
                                ->scalarNode('postal_code')
186 14
                                    ->info('ZIP or postal code. This will be unset if you POST an empty value.')
187 14
                                ->end()
188 14
                                ->scalarNode('state')
189 14
                                    ->info('State, county, province, or region. This will be unset if you POST an empty value.')
190 14
                                ->end()
191 14
                            ->end()
192 14
                            ->info('The address of the legal entity (i.e., individual or company).')
193 14
                        ->end()
194 14
                        ->arrayNode('address_kana')
195 14
                            ->children()
196 14
                                ->scalarNode('city')
197 14
                                    ->info('City or ward. This will be unset if you POST an empty value.')
198 14
                                ->end()
199 14
                                ->scalarNode('country')
200 14
                                    ->info('Two-letter country code (ISO 3166-1 alpha-2). This will be unset if you POST an empty value.')
201 14
                                ->end()
202 14
                                ->scalarNode('line1')
203 14
                                    ->info('Block or building number. This will be unset if you POST an empty value.')
204 14
                                ->end()
205 14
                                ->scalarNode('line2')
206 14
                                    ->info('Building details. This will be unset if you POST an empty value.')
207 14
                                ->end()
208 14
                                ->scalarNode('postal_code')
209 14
                                    ->info('Postal code. This will be unset if you POST an empty value.')
210 14
                                ->end()
211 14
                                ->scalarNode('state')
212 14
                                    ->info('Prefecture. This will be unset if you POST an empty value.')
213 14
                                ->end()
214 14
                                ->scalarNode('town')
215 14
                                    ->info('Town or cho-me. This will be unset if you POST an empty value.')
216 14
                                ->end()
217 14
                            ->end()
218 14
                            ->info('The Kana address variation for the legal entity (Japan only).')
219 14
                        ->end()
220 14
                        ->arrayNode('address_kanji')
221 14
                            ->children()
222 14
                                ->scalarNode('city')
223 14
                                    ->info('City or ward. This will be unset if you POST an empty value.')
224 14
                                ->end()
225 14
                                ->scalarNode('country')
226 14
                                    ->info('Two-letter country code (ISO 3166-1 alpha-2). This will be unset if you POST an empty value.')
227 14
                                ->end()
228 14
                                ->scalarNode('line1')
229 14
                                    ->info('Block or building number. This will be unset if you POST an empty value.')
230 14
                                ->end()
231 14
                                ->scalarNode('line2')
232 14
                                    ->info('Building details. This will be unset if you POST an empty value.')
233 14
                                ->end()
234 14
                                ->scalarNode('postal_code')
235 14
                                    ->info('Postal code. This will be unset if you POST an empty value.')
236 14
                                ->end()
237 14
                                ->scalarNode('state')
238 14
                                    ->info('Prefecture. This will be unset if you POST an empty value.')
239 14
                                ->end()
240 14
                                ->scalarNode('town')
241 14
                                    ->info('Town or cho-me. This will be unset if you POST an empty value.')
242 14
                                ->end()
243 14
                            ->end()
244 14
                            ->info('The Kanji address variation for the legal entity (Japan only).')
245 14
                        ->end()
246 14
                        ->scalarNode('business_name')
247 14
                            ->info('The legal name of the entity (companies only). This will be unset if you POST an empty value.')
248 14
                        ->end()
249 14
                        ->scalarNode('business_name_kana')
250 14
                            ->info('The Kana legal name variation for the company (Japan-based companies only). This will be unset if you POST an empty value.')
251 14
                        ->end()
252 14
                        ->scalarNode('business_name_kanji')
253 14
                            ->info('The Kanji legal name variation for the company (Japan-based companies only). This will be unset if you POST an empty value.')
254 14
                        ->end()
255 14
                        ->scalarNode('business_tax_id')
256 14
                            ->info('The business ID number of the legal entity (companies only), as appropriate for the company’s country. (Examples are an Employer ID Number in the U.S., a Business Number in Canada, or a Company Number in the UK.) This will be unset if you POST an empty value.')
257 14
                        ->end()
258 14
                        ->scalarNode('business_vat_id')
259 14
                            ->info('The VAT number of the legal entity (companies only). This will be unset if you POST an empty value.')
260 14
                        ->end()
261 14
                        ->arrayNode('dob')
262 14
                            ->children()
263 14
                                ->integerNode('day')
264 14
                                    ->isRequired()
265 14
                                    ->min(1)->max(31)
266 14
                                    ->info('The day of birth, between 1 and 31.')
267 14
                                ->end()
268 14
                                ->integerNode('month')
269 14
                                    ->isRequired()
270 14
                                    ->min(1)->max(12)
271 14
                                    ->info('The month of birth, between 1 and 12.')
272 14
                                ->end()
273 14
                                ->integerNode('year')
274 14
                                    ->isRequired()
275 14
                                    ->info('The four-digit year of birth.')
276 14
                                ->end()
277 14
                            ->end()
278 14
                            ->info('The account representative’s date of birth. Note that you must provide the entire date of birth at the same time. You cannot, for example, provide only the year without also providing the month and day.')
279 14
                        ->end()
280 14
                        ->scalarNode('first_name')
281 14
                            ->info('The account representative’s first name. This will be unset if you POST an empty value.')
282 14
                        ->end()
283 14
                        ->scalarNode('first_name_kana')
284 14
                            ->info('The Kana variation of the account representative’s first name (Japan only). This will be unset if you POST an empty value.')
285 14
                        ->end()
286 14
                        ->scalarNode('first_name_kanji')
287 14
                            ->info('The Kanji variation of the account representative’s first name (Japan only). This will be unset if you POST an empty value.')
288 14
                        ->end()
289 14
                        ->enumNode('gender')
290 14
                            ->values(['male', 'female'])
291 14
                            ->info('The gender of the account representative. Can be male or female (by international regulations). This will be unset if you POST an empty value.')
292 14
                        ->end()
293 14
                        ->scalarNode('last_name')
294 14
                            ->info('The account representative’s last name. This will be unset if you POST an empty value.')
295 14
                        ->end()
296 14
                        ->scalarNode('last_name_kana')
297 14
                            ->info('The Kana variation of the account representative’s last name (Japan only). This will be unset if you POST an empty value.')
298 14
                        ->end()
299 14
                        ->scalarNode('last_name_kanji')
300 14
                            ->info('The Kanji variation of the account representative’s last name (Japan only). This will be unset if you POST an empty value.')
301 14
                        ->end()
302 14
                        ->scalarNode('maiden_name')
303 14
                            ->info('The account representative’s maiden name. This will be unset if you POST an empty value.')
304 14
                        ->end()
305 14
                        ->arrayNode('personal_address')
306 14
                            ->children()
307 14
                                ->scalarNode('city')
308 14
                                    ->info('City, district, suburb, town, or village. This will be unset if you POST an empty value.')
309 14
                                ->end()
310 14
                                ->scalarNode('country')
311 14
                                    ->info('Two-letter country code (ISO 3166-1 alpha-2). This will be unset if you POST an empty value.')
312 14
                                ->end()
313 14
                                ->scalarNode('line1')
314 14
                                    ->info('Address line 1 (e.g., street, PO Box, or company name). This will be unset if you POST an empty value.')
315 14
                                ->end()
316 14
                                ->scalarNode('line2')
317 14
                                    ->info('Address line 2 (e.g., apartment, suite, unit, or building). This will be unset if you POST an empty value.')
318 14
                                ->end()
319 14
                                ->scalarNode('postal_code')
320 14
                                    ->info('ZIP or postal code. This will be unset if you POST an empty value.')
321 14
                                ->end()
322 14
                                ->scalarNode('state')
323 14
                                    ->info('State, county, province, or region. This will be unset if you POST an empty value.')
324 14
                                ->end()
325 14
                            ->end()
326 14
                            ->info('The account representative’s personal address, used for verification.')
327 14
                        ->end()
328 14
                        ->arrayNode('personal_address_kana')
329 14
                            ->children()
330 14
                                ->scalarNode('city')
331 14
                                    ->info('City or ward. This will be unset if you POST an empty value.')
332 14
                                ->end()
333 14
                                ->scalarNode('country')
334 14
                                    ->info('Two-letter country code (ISO 3166-1 alpha-2). This will be unset if you POST an empty value.')
335 14
                                ->end()
336 14
                                ->scalarNode('line1')
337 14
                                    ->info('Block or building number. This will be unset if you POST an empty value.')
338 14
                                ->end()
339 14
                                ->scalarNode('line2')
340 14
                                    ->info('Building details. This will be unset if you POST an empty value.')
341 14
                                ->end()
342 14
                                ->scalarNode('postal_code')
343 14
                                    ->info('Postal code. This will be unset if you POST an empty value.')
344 14
                                ->end()
345 14
                                ->scalarNode('state')
346 14
                                    ->info('Prefecture. This will be unset if you POST an empty value.')
347 14
                                ->end()
348 14
                                ->scalarNode('town')
349 14
                                    ->info('Town or cho-me. This will be unset if you POST an empty value.')
350 14
                                ->end()
351 14
                            ->end()
352 14
                            ->info('The Kana address variation for the legal entity (Japan only).')
353 14
                        ->end()
354 14
                        ->arrayNode('personal_address_kanji')
355 14
                            ->children()
356 14
                                ->scalarNode('city')
357 14
                                    ->info('City or ward. This will be unset if you POST an empty value.')
358 14
                                ->end()
359 14
                                ->scalarNode('country')
360 14
                                    ->info('Two-letter country code (ISO 3166-1 alpha-2). This will be unset if you POST an empty value.')
361 14
                                ->end()
362 14
                                ->scalarNode('line1')
363 14
                                    ->info('Block or building number. This will be unset if you POST an empty value.')
364 14
                                ->end()
365 14
                                ->scalarNode('line2')
366 14
                                    ->info('Building details. This will be unset if you POST an empty value.')
367 14
                                ->end()
368 14
                                ->scalarNode('postal_code')
369 14
                                    ->info('Postal code. This will be unset if you POST an empty value.')
370 14
                                ->end()
371 14
                                ->scalarNode('state')
372 14
                                    ->info('Prefecture. This will be unset if you POST an empty value.')
373 14
                                ->end()
374 14
                                ->scalarNode('town')
375 14
                                    ->info('Town or cho-me. This will be unset if you POST an empty value.')
376 14
                                ->end()
377 14
                            ->end()
378 14
                            ->info('The Kanji address variation for the legal entity (Japan only).')
379 14
                        ->end()
380 14
                        ->scalarNode('personal_id_number')
381 14
                            ->info('The government-issued ID number of the account representative, as appropriate for the representative’s country. (Examples are a Social Security Number in the U.S., or a Social Insurance Number in Canada). Instead of the number itself, you can also provide a PII token created with Stripe.js. This will be unset if you POST an empty value.')
382 14
                        ->end()
383 14
                        ->scalarNode('phone_number')
384 14
                            ->info('The legal entity’s phone number, used for verification. This will be unset if you POST an empty value.')
385 14
                        ->end()
386 14
                        ->scalarNode('ssn_last_4')
387 14
                            ->info('The last four digits of the account representative’s Social Security Number (U.S. only). This will be unset if you POST an empty value.')
388 14
                        ->end()
389 14
                        ->scalarNode('tax_id_registrar')
390 14
                            ->info('The jurisdiction in which the business_tax_id is registered (Germany-based companies only). This will be unset if you POST an empty value.')
391 14
                        ->end()
392 14
                        ->enumNode('type')
393 14
                            ->values(['individual', 'company'])
394 14
                            ->info('The legal entity type. Can be individual or company.')
395 14
                        ->end()
396 14
                        ->arrayNode('verification')
397 14
                            ->children()
398 14
                                ->scalarNode('document')
399 14
                                    ->info('An ID returned by a file upload with a purpose value of identity_document. This will be unset if you POST an empty value.')
400 14
                                ->end()
401 14
                                ->scalarNode('status')
402 14
                                    ->info('The verification status of the provided ID. This will be unset if you POST an empty value.')
403 14
                                ->end()
404 14
                            ->end()
405 14
                            ->info('Information on the verification state of the account representative.')
406 14
                        ->end()
407 14
                    ->end()
408 14
                    ->info('Information about the legal entity itself, including information about the associated account representative.')
409 14
                ->end()
410 14
                ->arrayNode('metadata')
411 14
                    ->scalarPrototype()->end()
412 14
                    ->info('A set of key-value pairs that you can attach to an Account object. This can be useful for storing additional information about the account in a structured format.')
413 14
                ->end()
414 14
                ->arrayNode('payout_schedule')
415 14
                    ->children()
416 14
                        ->scalarNode('delay_days')
417 14
                            ->info('The number of days charge funds are held before being paid out. May also be set to minimum, representing the lowest available value for the account country. Default is minimum. The delay_days parameter does not apply when the interval is manual.')
418 14
                        ->end()
419 14
                        ->scalarNode('interval')
420 14
                            ->info('How frequently available funds are paid out. One of: daily, manual, weekly, or monthly. Default is daily.')
421 14
                        ->end()
422 14
                        ->scalarNode('monthly_anchor')
423 14
                            ->info('The day of the month when available funds are paid out. Required and applicable only if interval is monthly.')
424 14
                        ->end()
425 14
                        ->scalarNode('weekly_anchor')
426 14
                            ->info('The day of the week when available funds are paid out, specified as monday, tuesday, etc. (required and applicable only if interval is weekly.)')
427 14
                        ->end()
428 14
                    ->end()
429 14
                    ->info('Details on when funds from charges are available, and when they are paid out to an external account. For details, see our Setting Bank and Debit Card Payouts documentation.')
430 14
                ->end()
431 14
                ->scalarNode('payout_statement_descriptor')
432 14
                    ->info('The text that appears on the bank account statement for payouts. If not set, this defaults to the platform’s bank descriptor as set in the Dashboard. This will be unset if you POST an empty value.')
433 14
                ->end()
434 14
                ->scalarNode('product_description')
435 14
                    ->info('Internal-only description of the product sold or service provided by the business. It’s used by Stripe for risk and underwriting purposes.')
436 14
                ->end()
437 14
                ->scalarNode('statement_descriptor')
438 14
                    ->info('The default text that appears on credit card statements when a charge is made directly on the account')
439 14
                ->end()
440 14
                ->scalarNode('support_email')
441 14
                    ->info('A publicly shareable support email address for the business.')
442 14
                ->end()
443 14
                ->scalarNode('support_phone')
444 14
                    ->info('A publicly shareable support phone number for the business.')
445 14
                ->end()
446 14
                ->scalarNode('support_url')
447 14
                    ->info('A publicly shareable URL that provides support for this account.')
448 14
                ->end()
449 14
                ->arrayNode('tos_acceptance')
450 14
                    ->children()
451 14
                        ->integerNode('date')
452 14
                            ->isRequired(true)
453 14
                            ->info('The Unix timestamp marking when the account representative accepted the Stripe Services Agreement.')
454 14
                        ->end()
455 14
                        ->scalarNode('ip')
456 14
                            ->isRequired(true)
457 14
                            ->info('The IP address from which the account representative accepted the Stripe Services Agreement.')
458 14
                        ->end()
459 14
                        ->scalarNode('user_agent')
460 14
                            ->info('The user agent of the browser from which the account representative accepted the Stripe Services Agreement. This will be unset if you POST an empty value.')
461 14
                        ->end()
462 14
                    ->end()
463 14
                    ->info('Details on the account’s acceptance of the Stripe Services Agreement.')
464 14
                ->end()
465 14
            ->end()
466
        ;
467
468 14
        $customOnlyFields = ['business_logo', 'business_name', 'business_primary_color', 'business_url', 'legal_entity', 'product_description', 'support_email', 'support_phone', 'support_url'];
469 14 View Code Duplication
        foreach ($customOnlyFields as $field) {
0 ignored issues
show
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
470 14
            $rootNode->validate()
471
                ->ifTrue(function ($v) use ($field) {
472 14
                    return isset($v['type']) && Account::TYPE_CUSTOM !== $v['type'] && isset($v[$field]);
473 14
                })
474 14
                ->thenInvalid("You can only set \"$field\" for custom accounts.")
475 14
            ->end();
476
        }
477
478 14
        $forbiddenForStandardAccounts = ['debit_negative_balances', 'decline_charge_on', 'payout_schedule', 'payout_statement_descriptor'];
479 14 View Code Duplication
        foreach ($forbiddenForStandardAccounts as $field) {
0 ignored issues
show
This code seems to be duplicated across your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
480 14
            $rootNode->validate()
481
                ->ifTrue(function ($v) use ($field) {
482 5
                    return isset($v['type']) && Account::TYPE_STANDARD === $v['type'] && isset($v[$field]);
483 14
                })
484 14
                ->thenInvalid("You cannot set \"$field\" for standard accounts.")
485 14
            ->end();
486
        }
487
488
        $rootNode
489 14
            ->validate()
490
                ->ifTrue(function ($v) {
491 1
                    return isset($v['type']) && Account::TYPE_STANDARD === $v['type'] && !isset($v['email']);
492 14
                })
493 14
                ->thenInvalid('An email must be specified to create a standard account.')
494 14
            ->end()
495
        ;
496
497 14
        return $treeBuilder;
498
    }
499
}
500