Giter Club home page Giter Club logo

traffictest's Introduction

Traffic test

Подготовка к установке и запуску приложения

Скопируйте файл .env.dist в .env (https://symfony.com/doc/current/configuration/dot-env-changes.html)

в .env заполните значение параметров (https://developers.mindbox.ru/docs/%D0%B23)

MINDBOX_BASE_URL=https://api.mindbox.ru

MINDBOX_ASYNC_ROUTE=/v3/operations/async

MINDBOX_ENDPOINT_ID=YOUR_ENDPOINT_ID

MINDBOX_SECRET=YOUR_SECRET

Установка и запуск приложения

Установите зависимости через composer

composer install

запустите приложение

php bin/console server:run

Работа без заглушек

Проект использует заглушки для тестирования работы приложения без аутентификационных данных от mindBox. Чтобы работать с боевыми данными, следует:

  • удалить из config/packages/eight_points_guzzle.yaml MockHandler
eight_points_guzzle:
    clients:
        mindbox_crm_client:
            handler: 'GuzzleHttp\Handler\MockHandler' #remove me
  • Очистить или закомментировать MockHandler из src/Client/MindBoxCrmApiClient.php
namespace App\Client;
...
class MindBoxCrmApiClient extends Client
...
        $mock = new MockHandler(
            [
                new Response(200, ['Content-Type' => 'application/json'], json_encode(['status' => 'Success'])),
                new Response(
                    200, ['Content-Type' => 'application/json'], json_encode(
                        [
                            'status' => 'ValidationError',
                            'validationMessages' => [
                                [
                                    'message' => 'Потребитель с таким адресом электронной почты уже зарегистрирован',
                                    'location' => '/operation/customer/email',
                                ],
                                [
                                    'message' => 'Потребитель с таким мобильным телефоном уже зарегистрирован',
                                    'location' => '/operation/customer/mobilePhone',
                                ],
                            ],
                        ]
                    )
                ),
            ]
        );

        $handler = HandlerStack::create($mock);
...
//также необходимо убрать handler из запросов клиента
            $promise = $this->requestAsync(
                'POST',
                ...
                [
                    'handler' => $handler,
                    ...
                ]
...

Просмотр запросов

Для отладки запроса, есть возможность ознакомиться с ним в symfony profiler

не работает с MockHandler

Alt text

Разработано с помощью

traffictest's People

Contributors

ovsyan avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.