| @@ 15-118 (lines=104) @@ | ||
| 12 | use Symfony\Component\Config\Definition\Builder\TreeBuilder; |
|
| 13 | use Symfony\Component\Config\Definition\ConfigurationInterface; |
|
| 14 | ||
| 15 | class CustomerCreate implements ConfigurationInterface |
|
| 16 | { |
|
| 17 | public function getConfigTreeBuilder() |
|
| 18 | { |
|
| 19 | $treeBuilder = new TreeBuilder('shapin_stripe_customer_create'); |
|
| 20 | $rootNode = $treeBuilder->getRootNode(); |
|
| 21 | ||
| 22 | $rootNode |
|
| 23 | ->children() |
|
| 24 | ->integerNode('account_balance') |
|
| 25 | ->info('An integer amount in pence that represents the account balance for your customer. Account balances only affect invoices. A negative amount represents a credit that decreases the amount due on an invoice; a positive amount increases the amount due on an invoice.') |
|
| 26 | ->end() |
|
| 27 | ->scalarNode('coupon') |
|
| 28 | ->info('The code of the coupon to apply to this subscription. A coupon applied to a subscription will only affect invoices created for that particular subscription. This can be unset by updating the value to null and then saving.') |
|
| 29 | ->end() |
|
| 30 | ->scalarNode('default_source') |
|
| 31 | ->info('ID of the default payment source for the customer.') |
|
| 32 | ->end() |
|
| 33 | ->scalarNode('description') |
|
| 34 | ->info('An arbitrary string that you can attach to a customer object. It is displayed alongside the customer in the dashboard. This can be unset by updating the value to null and then saving.') |
|
| 35 | ->end() |
|
| 36 | ->scalarNode('email') |
|
| 37 | ->info('Customer’s email address. It’s displayed alongside the customer in your dashboard and can be useful for searching and tracking. This may be up to 512 characters. This can be unset by updating the value to null and then saving.') |
|
| 38 | ->end() |
|
| 39 | ->scalarNode('invoice_prefix') |
|
| 40 | ->info('The prefix for the customer used to generate unique invoice numbers. Must be 3–12 uppercase letters or numbers.') |
|
| 41 | ->end() |
|
| 42 | ->arrayNode('invoice_settings') |
|
| 43 | ->children() |
|
| 44 | ->arrayNode('custom_fields') |
|
| 45 | ->arrayPrototype() |
|
| 46 | ->children() |
|
| 47 | ->scalarNode('name') |
|
| 48 | ->isRequired() |
|
| 49 | ->info('The name of the custom field. This may be up to 30 characters.') |
|
| 50 | ->end() |
|
| 51 | ->scalarNode('value') |
|
| 52 | ->isRequired() |
|
| 53 | ->info('The value of the custom field. This may be up to 30 characters.') |
|
| 54 | ->end() |
|
| 55 | ->end() |
|
| 56 | ->end() |
|
| 57 | ->info('Default custom fields to be displayed on invoices for this customer.') |
|
| 58 | ->end() |
|
| 59 | ->scalarNode('footer') |
|
| 60 | ->info('Default footer to be displayed on invoices for this customer. This can be unset by updating the value to null and then saving.') |
|
| 61 | ->end() |
|
| 62 | ->end() |
|
| 63 | ->info('Default invoice settings for this customer.') |
|
| 64 | ->end() |
|
| 65 | ->arrayNode('metadata') |
|
| 66 | ->scalarPrototype()->end() |
|
| 67 | ->info('A set of key-value pairs that you can attach to a customer object. It can be useful for storing additional information about the customer in a structured format.') |
|
| 68 | ->end() |
|
| 69 | ->arrayNode('shipping') |
|
| 70 | ->children() |
|
| 71 | ->arrayNode('address') |
|
| 72 | ->isRequired() |
|
| 73 | ->children() |
|
| 74 | ->scalarNode('line1') |
|
| 75 | ->isRequired() |
|
| 76 | ->cannotBeEmpty() |
|
| 77 | ->end() |
|
| 78 | ->scalarNode('city')->end() |
|
| 79 | ->scalarNode('country')->end() |
|
| 80 | ->scalarNode('line2')->end() |
|
| 81 | ->scalarNode('postal_code')->end() |
|
| 82 | ->scalarNode('state')->end() |
|
| 83 | ->end() |
|
| 84 | ->info('Customer shipping address.') |
|
| 85 | ->end() |
|
| 86 | ->scalarNode('name') |
|
| 87 | ->isRequired() |
|
| 88 | ->cannotBeEmpty() |
|
| 89 | ->info('Customer name. This can be unset by updating the value to null and then saving.') |
|
| 90 | ->end() |
|
| 91 | ->scalarNode('phone') |
|
| 92 | ->info('Customer phone (including extension). This can be unset by updating the value to null and then saving.') |
|
| 93 | ->end() |
|
| 94 | ->end() |
|
| 95 | ->info('The customer’s shipping information. Appears on invoices emailed to this customer.') |
|
| 96 | ->end() |
|
| 97 | ->scalarNode('source') |
|
| 98 | ->info('The source can either be a Token or a Source, as returned by Elements, or a associative array containing a user’s credit card details (with the options shown below). You must provide a source if the customer does not already have a valid source attached, and you are subscribing the customer to be charged automatically for a plan that is not free. Passing source will create a new source object, make it the customer default source, and delete the old customer default if one exists. If you want to add an additional source, instead use the card creation API to add the card and then the customer update API to set it as the default. Whenever you attach a card to a customer, Stripe will automatically validate the card.') |
|
| 99 | ->end() |
|
| 100 | ->arrayNode('tax_info') |
|
| 101 | ->children() |
|
| 102 | ->scalarNode('tax_id') |
|
| 103 | ->isRequired(true) |
|
| 104 | ->info('The customer’s tax ID number. This can be unset by updating the value to null and then saving.') |
|
| 105 | ->end() |
|
| 106 | ->scalarNode('type') |
|
| 107 | ->isRequired(true) |
|
| 108 | ->info('The type of ID number. The only possible value is vat') |
|
| 109 | ->end() |
|
| 110 | ->end() |
|
| 111 | ->info('The customer’s tax information. Appears on invoices emailed to this customer.') |
|
| 112 | ->end() |
|
| 113 | ->end() |
|
| 114 | ; |
|
| 115 | ||
| 116 | return $treeBuilder; |
|
| 117 | } |
|
| 118 | } |
|
| 119 | ||
| @@ 15-118 (lines=104) @@ | ||
| 12 | use Symfony\Component\Config\Definition\Builder\TreeBuilder; |
|
| 13 | use Symfony\Component\Config\Definition\ConfigurationInterface; |
|
| 14 | ||
| 15 | class CustomerUpdate implements ConfigurationInterface |
|
| 16 | { |
|
| 17 | public function getConfigTreeBuilder() |
|
| 18 | { |
|
| 19 | $treeBuilder = new TreeBuilder('shapin_stripe_customer_update'); |
|
| 20 | $rootNode = $treeBuilder->getRootNode(); |
|
| 21 | ||
| 22 | $rootNode |
|
| 23 | ->children() |
|
| 24 | ->integerNode('account_balance') |
|
| 25 | ->info('An integer amount in cents that represents the account balance for your customer. Account balances only affect invoices. A negative amount represents a credit that decreases the amount due on an invoice; a positive amount increases the amount due on an invoice.') |
|
| 26 | ->end() |
|
| 27 | ->scalarNode('coupon') |
|
| 28 | ->info('If you provide a coupon code, the customer will have a discount applied on all recurring charges. Charges you create through the API will not have the discount. This will be unset if you POST an empty value.') |
|
| 29 | ->end() |
|
| 30 | ->scalarNode('default_source') |
|
| 31 | ->info('ID of the default payment source for the customer.') |
|
| 32 | ->end() |
|
| 33 | ->scalarNode('description') |
|
| 34 | ->info('An arbitrary string that you can attach to a customer object. It is displayed alongside the customer in the dashboard. This will be unset if you POST an empty value.') |
|
| 35 | ->end() |
|
| 36 | ->scalarNode('email') |
|
| 37 | ->info('Customer’s email address. It’s displayed alongside the customer in your dashboard and can be useful for searching and tracking. This may be up to 512 characters. This will be unset if you POST an empty value.') |
|
| 38 | ->end() |
|
| 39 | ->scalarNode('invoice_prefix') |
|
| 40 | ->info('The prefix for the customer used to generate unique invoice numbers. Must be 3–12 uppercase letters or numbers.') |
|
| 41 | ->end() |
|
| 42 | ->arrayNode('invoice_settings') |
|
| 43 | ->children() |
|
| 44 | ->arrayNode('custom_fields') |
|
| 45 | ->arrayPrototype() |
|
| 46 | ->children() |
|
| 47 | ->scalarNode('name') |
|
| 48 | ->isRequired() |
|
| 49 | ->info('The name of the custom field. This may be up to 30 characters.') |
|
| 50 | ->end() |
|
| 51 | ->scalarNode('value') |
|
| 52 | ->isRequired() |
|
| 53 | ->info('The value of the custom field. This may be up to 30 characters.') |
|
| 54 | ->end() |
|
| 55 | ->end() |
|
| 56 | ->end() |
|
| 57 | ->info('Default custom fields to be displayed on invoices for this customer.') |
|
| 58 | ->end() |
|
| 59 | ->scalarNode('footer') |
|
| 60 | ->info('Default footer to be displayed on invoices for this customer. This will be unset if you POST an empty value.') |
|
| 61 | ->end() |
|
| 62 | ->end() |
|
| 63 | ->info('Default invoice settings for this customer.') |
|
| 64 | ->end() |
|
| 65 | ->arrayNode('metadata') |
|
| 66 | ->scalarPrototype()->end() |
|
| 67 | ->info('A set of key-value pairs that you can attach to a customer object. It can be useful for storing additional information about the customer in a structured format.') |
|
| 68 | ->end() |
|
| 69 | ->arrayNode('shipping') |
|
| 70 | ->children() |
|
| 71 | ->arrayNode('address') |
|
| 72 | ->isRequired() |
|
| 73 | ->children() |
|
| 74 | ->scalarNode('line1') |
|
| 75 | ->isRequired() |
|
| 76 | ->cannotBeEmpty() |
|
| 77 | ->end() |
|
| 78 | ->scalarNode('city')->end() |
|
| 79 | ->scalarNode('country')->end() |
|
| 80 | ->scalarNode('line2')->end() |
|
| 81 | ->scalarNode('postal_code')->end() |
|
| 82 | ->scalarNode('state')->end() |
|
| 83 | ->end() |
|
| 84 | ->info('Customer shipping address.') |
|
| 85 | ->end() |
|
| 86 | ->scalarNode('name') |
|
| 87 | ->isRequired() |
|
| 88 | ->cannotBeEmpty() |
|
| 89 | ->info('Customer name. This can be unset by updating the value to null and then saving.') |
|
| 90 | ->end() |
|
| 91 | ->scalarNode('phone') |
|
| 92 | ->info('Customer phone (including extension). This can be unset by updating the value to null and then saving.') |
|
| 93 | ->end() |
|
| 94 | ->end() |
|
| 95 | ->info('The customer’s shipping information. Appears on invoices emailed to this customer.') |
|
| 96 | ->end() |
|
| 97 | ->scalarNode('source') |
|
| 98 | ->info('A Token’s or a Source’s ID, as returned by Elements. Passing source will create a new source object, make it the new customer default source, and delete the old customer default if one exists. If you want to add additional sources instead of replacing the existing default, use the card creation API. Whenever you attach a card to a customer, Stripe will automatically validate the card.') |
|
| 99 | ->end() |
|
| 100 | ->arrayNode('tax_info') |
|
| 101 | ->children() |
|
| 102 | ->scalarNode('tax_id') |
|
| 103 | ->isRequired(true) |
|
| 104 | ->info('The customer’s tax ID number. This can be unset by updating the value to null and then saving.') |
|
| 105 | ->end() |
|
| 106 | ->scalarNode('type') |
|
| 107 | ->isRequired(true) |
|
| 108 | ->info('The type of ID number. The only possible value is vat') |
|
| 109 | ->end() |
|
| 110 | ->end() |
|
| 111 | ->info('The customer’s tax information. Appears on invoices emailed to this customer.') |
|
| 112 | ->end() |
|
| 113 | ->end() |
|
| 114 | ; |
|
| 115 | ||
| 116 | return $treeBuilder; |
|
| 117 | } |
|
| 118 | } |
|
| 119 | ||