Giter Club home page Giter Club logo

anytime-api-php-sdk's People

Contributors

david-vde avatar lecompteanytime avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

anytime-api-php-sdk's Issues

Content empty when logging enable

When logging is enabled at guzzle client level, the logger can read the content of the body.

Then because of stream usage, the pointer can already be at the end of the stream.

You should replace this line:

$this->responseParser->parse($response->getBody()->getContents())

By:

$this->responseParser->parse((string) $response->getBody())

The __toString method rewind the Stream when the getContents one does not

https://github.com/guzzle/psr7/blob/1.4.2/src/Stream.php#L90

https://github.com/guzzle/psr7/blob/1.4.2/src/Stream.php#L100

Compliance with PSD2

Hello!

I am writing to inquire about the compliance of your APIs with the Payment Services Directive 2 (PSD2) API specifications.

I would appreciate if you could provide me with more information on the measures your company has taken to ensure compliance with these technical standards.

Thank you in advance for your attention to this matter.

Sincerely,
Ivars S

Allow to pass a custom guzzle client

Hi,

We're currently using your SDK.
In your ApiClientFactory.php (method create), you generate a new instance of a guzzle client.

I'd like to know if you could make it configurable ?
For exemple:

<?php

use GuzzleHttp\Client;
use GuzzleHttp\ClientInterface;

class ApiClientFactory
{
    /**
     * @var FileReaderInterface
     */
    private $fileReader;

    /**
     * @var ClientInterface
     */
    private $client;

    /**
     * ApiClientFactory constructor.
     *
     * @param FileReaderInterface|null $fileReader Specific file reader implementing FileReaderInterface. Default is DiskFileReader.
     * @param ClientInterface|null $client Specific guzzle client implementing ClientInterface. Default is Client.
     */
    public function __construct(FileReaderInterface $fileReader = null, ClientInterface $client = null)
    {
        if(!$fileReader) {
            $fileReader = new DiskFileReader();
        }
        $this->fileReader = $fileReader;
        $this->client = $client ?? new Client([ 'timeout'   =>  0 ]);
    }

    /**
     * @param array $params Accepted params: version, client-id, client-secret, username, password, private-key
     * @param string $environment
     * @return ApiClient
     */
    public function create($params = [], $environment = Environment::SANDBOX)
    {
        if(!Environment::isValidEnvironment($environment)) {
            throw new \RuntimeException('Invalid environment "' . $environment . '"');
        }

        $setting = $this->createSettingObject($environment, $params);
        $modelResponsePopulator = new ModelResponsePopulator();
        $modelResponseFactory = new ModelResponseFactory($modelResponsePopulator);
        $jsonResponseParser = new JsonResponseParser();
        $binaryResponseParser = new BinaryResponseParser();

        return new ApiClient(
            $setting,
            new IOList(
                new IOFactory(
                    $this->client,
                    $setting,
                    new ModelRequestFactory(),
                    $modelResponseFactory,
                    new RequestDirectorFactory($setting, $this->fileReader),
                    new ApiClientExceptionFactory(
                        $modelResponsePopulator,
                        $modelResponseFactory,
                        $jsonResponseParser
                    ),
                    $modelResponsePopulator,
                    $jsonResponseParser,
                    $binaryResponseParser,
                    new ResponseAuthenticator()
                )
            )
        );
    }

There are many other ways to do so, but we would like to be able to pass a custom Guzzle Client.

wrong API Doc

Hello,

The API don't match the documentation. It return corp/user_addr_1/2 instead of corp/user_addr_line_1/2

return (string)$this->getDataValue('corp_addr_line1');

return (string)$this->getDataValue('corp_addr_line2');

return (string)$this->getDataValue('user_addr_line1');

return (string)$this->getDataValue('user_addr_line2');

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.