GithubHelp home page GithubHelp logo

payex-sdk-php's Introduction

payex-sdk-php's People

Contributors

aait avatar asbjornu avatar dependabot-support avatar hanimayahi avatar olegisk avatar samtroll avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

payex-sdk-php's Issues

Allow setting User-Agent

To be able to distinguish different implementaions of this library from one another, it should be possible to set a $userAgent parameter that is used in a User-Agent header which is sent every HTTP request against PayEx' API.

It should be possible to set custom HTTP headers in the stream_context key of the options array parameter of the SoapClient constructor:

// We should of course figure out which version this library as well as PHP we're running dynamically and not hard coded liket his:
$userAgent = $this->_userAgent . 'PayEx.Ecommerce.Php/1.0.2 php/7.0.6';
// The stream_context needs to include the 'ssl' key if 'ssl_verify' is set to true.
$context = stream_context_create(array('http' => array('header' => "User-Agent: $userAgent"));
$options = array('stream_context' => $context);
$client = new \SoapClient($wsdl, $options);

Since the stream_context is already initialized in __construct(), the header key can just be added there along with the already existing ssl key being set if ssl_verify is true.

The format of the User-Agent header should be as per RFC 7231 section 5.5.3. We should include as much information in the header as possible, such as the version of PHP and any library relevant to the HTTP request. Simply put, it should look something like this:

User-Agent: PayEx.Magento/1.2.3 PayEx.Ecommerce.Php/1.0.2 Magento/1.9.2.4 PHP/7.0.6

Add tests

We should have some automatic tests that can be executed to verify that the code is in working order. Travis can execute PHPUnit tests, so we should look into adding some of those.

How to create Payments instance with array $data argument?

Seems like the following way of creating a Payments instance doesn't work:
$data = [
"operation" => "Purchase",
"intent" => "Authorization"
];
$payment = new PayEx\Api\Service\Payment\Request\Payments( $data );
I believe, this is because in \src\PayEx\Api\Service\Request (parent class) in the constructor the $data is sent as a first and only argument (in case if $data is array or string):
$this->setRequestResource($this->resourceFactory->newRequestResource($data));
while newRequestResource method of PayEx\Api\Service\ResourceFactory class expects 3 optional arguments, where $data is the last one:
public function newRequestResource($service = '', $resource = '', $data = [])

PayEx API Service\Request 'send' method throws an exception if any of payment URLs contains a percent symbol.

Hi!

During the PaymentorderObject preparation my PaymentorderUrls are created using the PHP urlencode() function, that replaces all non-alphanumeric characters except -_. ... with a percent (%) sign followed by two hex digits (https://www.php.net/manual/en/function.urlencode.php).
As a result, after the \vendor\payex\payex-sdk-php\src\PayEx\Api\Service\Request->send() method invocation, the API shows the following error:
message: sprintf(): Too few arguments
status_code: 500
debug: {โ€ฆ}
line: 203
file: /vendor/payex/payex-sdk-php/src/PayEx/Api/Service/Request.php
class: PayEx\Api\Client\Exception

Could you, please, fix this issue, so as the 'urlencoding' is widely used in URLs generation?
Thanks in advance!

New addreses for SOAP test

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.