Авторизация в сервисе B2BFamily

@return array
2501
public function login()
    {
        $response = $this->request(self::METHOD_POST, '/user/login', [
            'appkey' => $this->parameters->getAuth('appkey'),
            'email' => $this->parameters->getAuth('email'),
            'password' => $this->parameters->getAuth('password'),
            'hash' => $this->parameters->getAuth('hash'),
        ]);

        if (isset($response['apikey'])) {
            $this->apikey = $response['apikey'];
        }

        return $response;
    }
994637
public function getWorkflowNames()
    {
        try {
            return $this->getConfiguration()->getWorkflowNames();
        } catch (FactoryException $e) {
            $errMsg = 'Ошибка при получение имен workflow';
            $this->getLog()->error($errMsg, [$e]);
        }

        return [];
    }
895452
public function getUnavailableRegistrationIds()
    {
        if ($this->getFailureCount() == 0) {
            return array();
        }
        $filteredResults = array_filter(
            $this->results,
            function ($result) {
                return (
                    isset($result['error'])
                    &&
                    ($result['error'] == "Unavailable")
                );
            }
        );

        return array_keys($filteredResults);
    }
160561
public function toWebDriver()
    {
        return [
            'type' => 'receipt',
            'recipient_name' => $this->recipient_name,
            'merchant_name' => $this->merchant_name,
            'order_number' => $this->order_number,
            'currency' => $this->currency,
            'payment_method' => $this->payment_method,
            'order_url' => $this->order_url,
            'timestamp' => $this->timestamp,
            'elements' => $this->elements,
            'address' => $this->address,
            'summary' => $this->summary,
            'adjustments' => $this->adjustments,
        ];
    }
914515
public function getFlattenValidators()
    {
        if (!$this->exists) {
            return [];
        }

        $validators = $this->validators;
        $return     = [];
        if (!empty($validators)) {
            foreach ($validators as $validator) {
                $return[$validator->validator_id] = $validator->value;
            }
        }
        return $return;
    }
956787
protected function getIDListFromDB() : array
    {
            if ($this->sValue == OfferListStore::SORT_PRICE_ASC) {
                $arElementIDList = $this->getByPriceASC();
            } elseif ($this->sValue == OfferListStore::SORT_PRICE_DESC) {
                $arElementIDList = $this->getByPriceDESC();
            } elseif ($this->sValue == OfferListStore::SORT_NEW) {
                $arElementIDList = $this->getNewOfferList();
            } elseif ($this->sValue == OfferListStore::SORT_NO) {
                $arElementIDList = $this->getOfferList();
            } elseif (preg_match('%^'.OfferListStore::SORT_PRICE_ASC.'\|.+%', $this->sValue)) {
                $arElementIDList = $this->getByPriceTypeASC();
            } elseif (preg_match('%^'.OfferListStore::SORT_PRICE_DESC.'\|.+%', $this->sValue)) {
                $arElementIDList = $this->getByPriceTypeDESC();
            } else {
                $arElementIDList = $this->getCustomSortingList();
            }

        return $arElementIDList;
    }
392551
public function toOptionArray()
    {
        return [
            [
                'value' => \Dotdigitalgroup\Email\Model\Sync\Catalog\CatalogSyncFactory::SYNC_CATALOG_DEFAULT_LEVEL,
                'label' => 'Default Level',
            ],
            [
                'value' => \Dotdigitalgroup\Email\Model\Sync\Catalog\CatalogSyncFactory::SYNC_CATALOG_STORE_LEVEL,
                'label' => 'Store Level',
            ],
        ];
    }
1137131
public function getBusinessEntityExtends()
    {
        $myConfig = \OxidEsales\Eshop\Core\Registry::getConfig();
        $aExtends = [];

        foreach ($this->_aBusinessEntityExtends as $sExtend) {
            $aExtends[$sExtend] = $myConfig->getConfigParam($sExtend);
        }

        return $aExtends;
    }
623933
public function getAttributes()
    {
        return [
            Attributes\IdAttribute::make(),
            Attributes\TextAttribute::make('name')
                ->setRequired(true)
                ->setUnique(true),
            Attributes\LongTextAttribute::make('description'),
            Attributes\TextAttribute::make('filename')
                ->setRequired(true),
            Attributes\EnumAttribute::make('filetype', array_keys(Config::get('amethyst.template.generators', [])))
                ->setRequired(true),
            Attributes\LongTextAttribute::make('content'),
            AmethystAttributes\FileChecksumAttribute::make('checksum'),
            Attributes\BelongsToAttribute::make('data_builder_id')
                ->setRelationName('data_builder')
                ->setRelationManager(DataBuilderManager::class),
            Attributes\CreatedAtAttribute::make(),
            Attributes\UpdatedAtAttribute::make(),
            Attributes\DeletedAtAttribute::make(),
        ];
    }
130409
protected function getPaymentTransactionStructure()
    {
        return [
            'payment_type'       => $this->payment_type,
            'amount'             => $this->transformAmount($this->amount, $this->currency),
            'currency'           => $this->currency,
            'return_success_url' => $this->return_success_url,
            'return_failure_url' => $this->return_failure_url,
            'customer_email'     => $this->customer_email,
            'customer_phone'     => $this->customer_phone,
            'account_number'     => $this->account_number,
            'bank_code'          => $this->bank_code,
            'bic'                => $this->bic,
            'iban'               => $this->iban,
            'account_phone'      => $this->account_phone,
            'billing_address'    => $this->getBillingAddressParamsStructure(),
            'shipping_address'   => $this->getShippingAddressParamsStructure()
        ];
    }
1288888
public function getDefaults()
    {
        return [
            'activation_token_expire' => self::SECONDS_ACTIVATION_TOKEN_EXPIRE,
            'allow_polls' => self::FLAG_ALLOW_POLLS,
            'email_token_expire' => self::SECONDS_EMAIL_TOKEN_EXPIRE,
            'from_email' => self::DEFAULT_FROM_EMAIL,
            'from_name' => self::DEFAULT_FROM_NAME,
            'hot_minimum' => self::HOT_MINIMUM,
            'maintenance_mode' => self::MAINTENANCE_MODE,
            'max_attempts' => self::MAX_SEND_ATTEMPTS,
            'members_visible' => self::FLAG_MEMBERS_VISIBLE,
            'merge_posts' => self::FLAG_MERGE_POSTS,
            'meta_description' => self::META_DESCRIPTION,
            'meta_keywords' => self::META_KEYWORDS,
            'name' => self::PODIUM_NAME,
            'password_reset_token_expire' => self::SECONDS_PASSWORD_RESET_TOKEN_EXPIRE,
            'recaptcha_secretkey' => '',
            'recaptcha_sitekey' => '',
            'registration_off' => self::REGISTRATION_OFF,
            'use_captcha' => self::FLAG_USE_CAPTCHA,
            'use_wysiwyg' => self::FLAG_USE_WYSIWYG,
            'version' => Podium::getInstance()->version,
        ];
    }
1161021
public function getAttributes()
    {
        return [
            Attributes\IdAttribute::make(),
            Attributes\BelongsToAttribute::make('catalogue_id')
                ->setRelationName('catalogue')
                ->setRelationManager(CatalogueManager::class)
                ->setRequired(true),
            Attributes\BelongsToAttribute::make('product_id')
                ->setRelationName('product')
                ->setRelationManager(ProductManager::class)
                ->setRequired(true),
            Attributes\BelongsToAttribute::make('target_id')
                ->setRelationName('target')
                ->setRelationManager(TargetManager::class)
                ->setRequired(true),
            Attributes\BelongsToAttribute::make('tax_id')
                ->setRelationName('tax')
                ->setRelationManager(TaxManager::class)
                ->setRequired(true),
            Attributes\BelongsToAttribute::make('price_rule_id')
                ->setRelationName('price_rule')
                ->setRelationManager(PriceRuleManager::class)
                ->setRequired(true),
            Attributes\NumberAttribute::make('price'),
            Attributes\BelongsToAttribute::make('consume_rule_id')
                ->setRelationName('consume_rule')
                ->setRelationManager(ConsumeRuleManager::class)
                ->setRequired(true),
            Attributes\CreatedAtAttribute::make(),
            Attributes\UpdatedAtAttribute::make(),
            Attributes\DeletedAtAttribute::make(),
        ];
    }
495028
public function actionImport()
    {
        $result = ['error' => Yii::t('podium/view', 'Error')];

        if (Yii::$app->request->isPost) {
            $drop = Yii::$app->request->post('drop');
            if ($drop !== null) {
                $installation = new Installation();
                if ((is_bool($drop) && $drop) || $drop === 'true') {
                    $result = $installation->nextDrop();
                } else {
                    $result = $installation->nextStep();
                }
            }
        }

        return Json::encode($result);
    }
1287395
public function rules(): array
    {
        $manager = $this->route('manager') ?? app('cortex.auth.manager');

        // Attach attribute rules
        $manager->getEntityAttributes()->each(function ($attribute, $attributeName) use (&$rules) {
            switch ($attribute->type) {
                case 'datetime':
                    $type = 'date';
                    break;
                case 'text':
                case 'check':
                case 'select':
                case 'varchar':
                    $type = 'string';
                    break;
                default:
                    $type = $attribute->type;
                    break;
            }

            $rule = ($attribute->is_required ? 'required|' : 'nullable|').$type;
            $rules[$attributeName.($attribute->is_collection ? '.*' : '')] = $rule;
        });

        return $rules ?? [];
    }
1332607
public function getAttributes()
    {
        return [
            Attributes\IdAttribute::make(),
            Attributes\TextAttribute::make('name')
                ->setRequired(true)
                ->setUnique(true),
            Attributes\LongTextAttribute::make('description'),
            Attributes\TextAttribute::make('event_class')
                ->setRequired(true),
            Attributes\BooleanAttribute::make('enabled'),
            Attributes\YamlAttribute::make('data')->setDefault(function (EntityContract $entity) {
                return file_get_contents(__DIR__.'/../../resources/schema/default/data.yaml');
            }),
            Attributes\TextAttribute::make('condition'),
            Attributes\BelongsToAttribute::make('work_id')
                ->setRelationName('work')
                ->setRelationManager(WorkManager::class)
                ->setRequired(true),
            Attributes\CreatedAtAttribute::make(),
            Attributes\UpdatedAtAttribute::make(),
            Attributes\DeletedAtAttribute::make(),
        ];
    }
967484
public function toArray()
    {
        return array_merge(
            [
                'linha_digitavel' => $this->getLinhaDigitavel(),
                'codigo_barras' => $this->getCodigoBarras(),
                'beneficiario' => [
                    'nome' => $this->getBeneficiario()->getNome(),
                    'endereco' => $this->getBeneficiario()->getEndereco(),
                    'bairro' => $this->getBeneficiario()->getBairro(),
                    'cep' => $this->getBeneficiario()->getCep(),
                    'uf' => $this->getBeneficiario()->getUf(),
                    'cidade' => $this->getBeneficiario()->getCidade(),
                    'documento' => $this->getBeneficiario()->getDocumento(),
                    'nome_documento' => $this->getBeneficiario()->getNomeDocumento(),
                    'endereco2' => $this->getBeneficiario()->getCepCidadeUf(),
                    'endereco_completo' => $this->getBeneficiario()->getEnderecoCompleto(),
                ],
                'logo_base64' => $this->getLogoBase64(),
                'logo' => $this->getLogo(),
                'logo_banco_base64' => $this->getLogoBancoBase64(),
                'logo_banco' => $this->getLogoBanco(),
                'codigo_banco' => $this->getCodigoBanco(),
                'codigo_banco_com_dv' => $this->getCodigoBancoComDv(),
                'especie' => 'R$',
                'data_vencimento' => $this->getDataVencimento(),
                'data_processamento' => $this->getDataProcessamento(),
                'data_documento' => $this->getDataDocumento(),
                'data_desconto' => $this->getDataDesconto(),
                'valor' => Util::nReal($this->getValor(), 2, false),
                'desconto' => Util::nReal($this->getDesconto(), 2, false),
                'multa' => Util::nReal($this->getMulta(), 2, false),
                'juros' => Util::nReal($this->getJuros(), 2, false),
                'juros_apos' => $this->getJurosApos(),
                'dias_protesto' => $this->getDiasProtesto(),
                'sacador_avalista' =>
                    $this->getSacadorAvalista()
                        ? [
                        'nome' => $this->getSacadorAvalista()->getNome(),
                        'endereco' => $this->getSacadorAvalista()->getEndereco(),
                        'bairro' => $this->getSacadorAvalista()->getBairro(),
                        'cep' => $this->getSacadorAvalista()->getCep(),
                        'uf' => $this->getSacadorAvalista()->getUf(),
                        'cidade' => $this->getSacadorAvalista()->getCidade(),
                        'documento' => $this->getSacadorAvalista()->getDocumento(),
                        'nome_documento' => $this->getSacadorAvalista()->getNomeDocumento(),
                        'endereco2' => $this->getSacadorAvalista()->getCepCidadeUf(),
						'endereco_completo' => $this->getSacadorAvalista()->getEnderecoCompleto(),
                    ]
                        : [],
                'pagador' => [
                    'nome' => $this->getPagador()->getNome(),
                    'endereco' => $this->getPagador()->getEndereco(),
                    'bairro' => $this->getPagador()->getBairro(),
                    'cep' => $this->getPagador()->getCep(),
                    'uf' => $this->getPagador()->getUf(),
                    'cidade' => $this->getPagador()->getCidade(),
                    'documento' => $this->getPagador()->getDocumento(),
                    'nome_documento' => $this->getPagador()->getNomeDocumento(),
                    'endereco2' => $this->getPagador()->getCepCidadeUf(),
					'endereco_completo' => $this->getPagador()->getEnderecoCompleto(),
                ],
                'demonstrativo' => $this->getDescricaoDemonstrativo(),
                'instrucoes' => $this->getInstrucoes(),
                'instrucoes_impressao' => $this->getInstrucoesImpressao(),
                'local_pagamento' => $this->getLocalPagamento(),
                'numero' => $this->getNumero(),
                'numero_documento' => $this->getNumeroDocumento(),
                'numero_controle' => $this->getNumeroControle(),
                'agencia_codigo_beneficiario' => $this->getAgenciaCodigoBeneficiario(),
                'nosso_numero' => $this->getNossoNumero(),
                'nosso_numero_boleto' => $this->getNossoNumeroBoleto(),
                'especie_doc' => $this->getEspecieDoc(),
                'especie_doc_cod' => $this->getEspecieDocCodigo(),
                'aceite' => $this->getAceite(),
                'carteira' => $this->getCarteira(),
                'carteira_nome' => $this->getCarteiraNome(),
                'uso_banco' => $this->getUsoBanco(),
                'status' => $this->getStatus(),
                'mostrar_endereco_ficha_compensacao' => $this->getMostrarEnderecoFichaCompensacao()
            ], $this->variaveis_adicionais
        );
    }
1232794
protected function getFormList()
    {
        $formList = [];
        foreach ($this->availableAuthenticators as $key => $className) {
            /** @var BootstrapMFAAuthenticator $class */
            $class = Injector::inst()->get($className);
            $formList[] = $class->getMFAForm($this, static::VERIFICATION_METHOD);
        }

        return $formList;
    }