Formata os dados para enviar a alteração do método de pagamento.

@param array $paymentSettings

@return array
188257
private function formatPreApprovalPaymentMethodData(array $paymentSettings)
    {
        $this->senderInfo['phone'] = [
            'areaCode' => $this->senderInfo['senderAreaCode'],
            'number'   => $this->senderInfo['senderPhone'],
        ];

        $this->creditCardHolder['phone'] = [
            'areaCode' => $this->creditCardHolder['creditCardHolderAreaCode'],
            'number'   => $this->creditCardHolder['creditCardHolderPhone'],
        ];

        $this->creditCardHolder['billingAddress'] = $this->billingAddress;

        if (!empty($this->senderInfo['senderCPF'])) {
            $this->senderInfo['documents'][0] = [
                'type'  => 'CPF',
                'value' => $this->senderInfo['senderCPF'],
            ];

            unset($this->senderInfo['senderCPF']);
        } else {
            $this->senderInfo['documents'][0] = [
                'type'  => 'CNPJ',
                'value' => $this->senderInfo['senderCNPJ'],
            ];

            unset($this->senderInfo['senderCNPJ']);
        }

        $this->creditCardHolder['documents'][0] = [
            'type'  => 'CPF',
            'value' => $this->creditCardHolder['creditCardHolderCPF'],
        ];

        unset($this->creditCardHolder['creditCardHolderCPF']);
        unset($this->senderInfo['senderAreaCode']);
        unset($this->senderInfo['senderPhone']);
        unset($this->creditCardHolder['creditCardHolderAreaCode']);
        unset($this->creditCardHolder['creditCardHolderPhone']);

        $data = [
            'type'          => $this->type,
            'sender'        => [
                'ip'         => $this->senderInfo['ip'],
                'hash'       => $this->senderInfo['hash'],
            ],
            'creditCard'    => [
                'token'          => $paymentSettings['creditCardToken'],
                'holder'         => $this->creditCardHolder,
            ],
        ];

        return $data;
    }
1282380
public static function listAllPaymentSourcesAsync(array $parameters = [])
    {
        return self::listAllPaymentSourcesAsyncWithHttpInfo($page, $size, $sort)
            ->then(
                function ($response) {
                    return $response[0];
                }
            );
    }
1323867
protected function formatBindings($bindings)
    {
        foreach ($bindings as $key => $binding) {
            if ($binding instanceof DateTime) {
                $bindings[$key] = $binding->format('Y-m-d H:i:s');
            } elseif (is_string($binding)) {
                $bindings[$key] = str_replace("'", "\\'", $binding);
            }
        }

        return $bindings;
    }
892795
public function formatMappings($mappings)
    {
        $types = $this->getTypes();

        foreach ($mappings as $key => $mapping) {
            $mappings[$key] = $types[$mappings[$key]['type']];
        }

        return $mappings;
    }
212943
protected function storeDateSettings($settings)
    {
        // Set up start/end dates:
        $from = empty($settings['from'])
            ? $this->stateManager->loadDate() : $settings['from'];
        $until = empty($settings['until']) ? null : $settings['until'];
        $this->setStartDate($from);
        $this->setEndDate($until);
    }
171643
public function validateFieldSettings($fieldSettings)
    {
        $validationErrors = [];

        foreach ($fieldSettings as $name => $value) {
            if (isset($this->settingsSchema[$name])) {
                switch ($name) {
                    case 'useSeconds':
                        if (!is_bool($value)) {
                            $validationErrors[] = new ValidationError(
                                "Setting 'Use seconds' value must be of boolean type",
                                null,
                                [],
                                "[$name]"
                            );
                        }
                        break;
                    case 'defaultType':
                        $definedTypes = [
                            self::DEFAULT_EMPTY,
                            self::DEFAULT_CURRENT_DATE,
                            self::DEFAULT_CURRENT_DATE_ADJUSTED,
                        ];
                        if (!in_array($value, $definedTypes, true)) {
                            $validationErrors[] = new ValidationError(
                                "Setting 'Default value' is of unknown type",
                                null,
                                [],
                                "[$name]"
                            );
                        }
                        break;
                    case 'dateInterval':
                        if (isset($value)) {
                            if ($value instanceof DateInterval) {
                                // String conversion of $value, because DateInterval objects cannot be compared directly
                                if (
                                    isset($fieldSettings['defaultType'])
                                    && $fieldSettings['defaultType'] !== self::DEFAULT_CURRENT_DATE_ADJUSTED
                                    && $value->format('%y%m%d%h%i%s') !== '000000'
                                ) {
                                    $validationErrors[] = new ValidationError(
                                        "Setting 'Current date and time adjusted by' can be used only when setting 'Default value' is set to 'Adjusted current datetime'",
                                        null,
                                        [],
                                        "[$name]"
                                    );
                                }
                            } else {
                                $validationErrors[] = new ValidationError(
                                    "Setting 'Current date and time adjusted by' value must be an instance of 'DateInterval' class",
                                    null,
                                    [],
                                    "[$name]"
                                );
                            }
                        }
                        break;
                }
            } else {
                $validationErrors[] = new ValidationError(
                    "Setting '%setting%' is unknown",
                    null,
                    ['%setting%' => $name],
                    "[$name]"
                );
            }
        }

        return $validationErrors;
    }
327359
public function validateFieldSettings($fieldSettings)
    {
        $validationErrors = array();

        foreach ($fieldSettings as $name => $value) {
            if (!isset($this->settingsSchema[$name])) {
                $validationErrors[] = new ValidationError(
                    "Setting '%setting%' is unknown",
                    null,
                    array(
                        '%setting%' => $name,
                    ),
                    "[$name]"
                );
                continue;
            }

            switch ($name) {
                case 'selectionMethod':
                    if (!$this->isValidSelectionMethod($value)) {
                        $validationErrors[] = new ValidationError(
                            "Setting '%setting%' must be one of %selection_browse%, %selection_dropdown%, %selection_list_with_radio_buttons%, %selection_list_with_checkboxes%, %selection_multiple_selection_list%, %selection_template_based_multiple%, %selection_template_based_single%",
                            null,
                            array(
                                '%setting%' => $name,
                                '%selection_browse%' => self::SELECTION_BROWSE,
                                '%selection_dropdown%' => self::SELECTION_DROPDOWN,
                                '%selection_list_with_radio_buttons%' => self::SELECTION_LIST_WITH_RADIO_BUTTONS,
                                '%selection_list_with_checkboxes%' => self::SELECTION_LIST_WITH_CHECKBOXES,
                                '%selection_multiple_selection_list%' => self::SELECTION_MULTIPLE_SELECTION_LIST,
                                '%selection_template_based_multiple%' => self::SELECTION_TEMPLATE_BASED_MULTIPLE,
                                '%selection_template_based_single%' => self::SELECTION_TEMPLATE_BASED_SINGLE,
                            ),
                            "[$name]"
                        );
                    }
                    break;
                case 'selectionDefaultLocation':
                    if (!is_int($value) && !is_string($value) && $value !== null) {
                        $validationErrors[] = new ValidationError(
                            "Setting '%setting%' value must be of either null, string or integer",
                            null,
                            array(
                                '%setting%' => $name,
                            ),
                            "[$name]"
                        );
                    }
                    break;
                case 'selectionContentTypes':
                    if (!is_array($value)) {
                        $validationErrors[] = new ValidationError(
                            "Setting '%setting%' value must be of array type",
                            null,
                            array(
                                '%setting%' => $name,
                            ),
                            "[$name]"
                        );
                    }
                    break;
                case 'selectionLimit':
                    if (!is_int($value)) {
                        $validationErrors[] = new ValidationError(
                            "Setting '%setting%' value must be of integer type",
                            null,
                            array(
                                '%setting%' => $name,
                            ),
                            "[$name]"
                        );
                    }
                    if ($value < 0) {
                        $validationErrors[] = new ValidationError(
                            "Setting '%setting%' value cannot be lower than 0",
                            null,
                            array(
                                '%setting%' => $name,
                            ),
                            "[$name]"
                        );
                    }
                    break;
            }
        }

        return $validationErrors;
    }
1047816
public function setComposerSettings(array $composerSettings = [])
    {
        /**
         * If array is type array("config.value:true","require:library/src",)
         */
        $settings = [];
        foreach ($composerSettings as $index => $value) {
            if (is_numeric($index) && mb_strpos($value, ':') > 0) {
                $path = implode('', array_slice(explode(':', $value), 0, 1));
                $val = implode(':', array_slice(explode(':', $value), 1));
                self::dotNotationToArray($path, $val, $settings);
            } else {
                $settings[$index] = $value;
            }
        }
        return $this->setOptionValue(self::COMPOSER_SETTINGS, $settings);
    }
1048557
protected function loadApplicationConfigFiles($userSettings)
    {
        $parser = $this['config-parser'];
        $loader = $this['config-finder'];
        $userSettings = array();
        foreach ($loader->findFiles() as $path) {
            if (is_readable($path)) {
                $parsedFile = $parser->parseFile($path);
                if ($parsedFile !== false) {
                    $this->addConfig($parsedFile);
                }
            } else {
                echo "Invalid path $path\n";
            }
        }
    }
1095099
public function mergeSettings($newSettings)
    {
        if (\is_object($this->getSettings())) {
            $settingsClass = \get_class($this->getSettings());
            $settings = $settingsClass::createFromArray($newSettings, $this->getSettings());
        } else {
            $settings = \array_replace($this->getSettings(), $newSettings);
        }

        $this->setSettings($settings);
    }
612258
private function getFluteSettings(): array
    {
        /** @var SettingsProviderInterface $settingsProvider */
        $settingsProvider = $this->getContainer()->get(SettingsProviderInterface::class);
        $settings         = $settingsProvider->get(FluteSettings::class);

        return $settings;
    }
1322282
protected function getSettings() {
        if (!$this->_settings) {
            $this->_settings = new SettingsList($this->version);
        }

        return $this->_settings;
    }
877124
public static function listAllPaymentsAsync(array $parameters = [])
    {
        return self::listAllPaymentsAsyncWithHttpInfo($page, $size, $sort)
            ->then(
                function ($response) {
                    return $response[0];
                }
            );
    }
1340132
protected function combineSettings(array $settings)/*# : array */
    {
        return array_replace(
            $this->getBuilder()->getSettings(), // builder settings
            $this->getBuilder()->getDialect()->dialectSettings(), // dialect
            $settings,  // user settings
            $this->getSettings() // statement settings
        );
    }
165615
protected function updateSettingsWithConsoleOptions($settings)
    {
        $directMapSettings = [
            'url', 'set', 'metadataPrefix', 'timeout', 'combineRecordsTag',
            'injectDate', 'injectId', 'injectSetName', 'injectSetSpec',
            'idSearch', 'idReplace', 'dateGranularity', 'harvestedIdLog',
            'badXMLLog', 'httpUser', 'httpPass', 'sslcapath', 'sslcafile',
            'sanitizeRegex',
        ];
        foreach ($directMapSettings as $setting) {
            if ($value = $this->opts->getOption($setting)) {
                $settings[$setting] = $value;
            }
        }
        $flagSettings = [
            'combineRecords' => ['combineRecords', true],
            'v' => ['verbose', true],
            'autosslca' => ['autosslca', true],
            'nosslverifypeer' => ['sslverifypeer', false],
            'sanitize' => ['sanitize', true],
        ];
        foreach ($flagSettings as $in => $details) {
            if ($this->opts->getOption($in)) {
                list($out, $val) = $details;
                $settings[$out] = $val;
            }
        }
        return $settings;
    }
535088
private function _loadSettingsFromArray($settings)
    {
        if (isset($settings['sp'])) {
            $this->_sp = $settings['sp'];
        }
        if (isset($settings['idp'])) {
            $this->_idp = $settings['idp'];
        }

        $errors = $this->checkSettings($settings);
        if (empty($errors)) {
            $this->_errors = array();

            if (isset($settings['strict'])) {
                $this->_strict = $settings['strict'];
            }
            if (isset($settings['debug'])) {
                $this->_debug = $settings['debug'];
            }

            if (isset($settings['baseurl'])) {
                $this->_baseurl = $settings['baseurl'];
            }

            if (isset($settings['compress'])) {
                $this->_compress = $settings['compress'];
            }

            if (isset($settings['security'])) {
                $this->_security = $settings['security'];
            }

            if (isset($settings['contactPerson'])) {
                $this->_contacts = $settings['contactPerson'];
            }

            if (isset($settings['organization'])) {
                $this->_organization = $settings['organization'];
            }

            $this->_addDefaultValues();
            return true;
        } else {
            $this->_errors = $errors;
            return false;
        }
    }
854281
protected function getDoctrineSettings(array $databaseSettings)
    {
        $databaseMapping = [
            'ezmysqli' => 'pdo_mysql',
            'eZMySQLiDB' => 'pdo_mysql',
            'ezmysql' => 'pdo_mysql',
            'eZMySQLDB' => 'pdo_mysql',
            'ezpostgresql' => 'pdo_pgsql',
            'eZPostgreSQL' => 'pdo_pgsql',
            'postgresql' => 'pdo_pgsql',
            'pgsql' => 'pdo_pgsql',
            'oracle' => 'oci8',
            'ezoracle' => 'oci8',
        ];

        $databaseType = $databaseSettings['DatabaseImplementation'];
        if (isset($databaseMapping[$databaseType])) {
            $databaseType = $databaseMapping[$databaseType];
        }

        $databasePassword = $databaseSettings['Password'] != '' ? $databaseSettings['Password'] : null;
        $doctrineSettings = [
            'driver' => $databaseType,
            'host' => $databaseSettings['Server'],
            'user' => $databaseSettings['User'],
            'password' => $databasePassword,
            'dbname' => $databaseSettings['Database'],
            'charset' => 'UTF8',
        ];
        if (isset($databaseSettings['Port']) && !empty($databaseSettings['Port'])) {
            $doctrineSettings['port'] = $databaseSettings['Port'];
        }
        if (isset($databaseSettings['Socket']) && $databaseSettings['Socket'] !== 'disabled') {
            $doctrineSettings['unix_socket'] = $databaseSettings['Socket'];
        }

        return $doctrineSettings;
    }