Giter VIP home page Giter VIP logo

laterpay-client-php's People

Contributors

aliaksandrvahura-sciencesoft avatar anselmh avatar chrico avatar doismellburning avatar drdla avatar ericflarsen avatar jdelic avatar ksmoore125 avatar larsschenk avatar mturalenka avatar patelutkarsh avatar suligap avatar thrijith avatar ykasenka avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

laterpay-client-php's Issues

Produce a standalone version of the laterpay-php-client

We absolutely have to do that and soon. laterpay/laterpay-wordpress-plugin#3 doesn't really factor into this, because HOW the client ends up in the wordpress-plugin is really not that interesting to me. If we have to copy new versions manually... fine.

However, I just tried to build an example for a customer out of the LaterPay client, and realized that that's impossible because the client is now completely polluted by WordPress references (in particular wp_remote_retrieve_body and get_option).

I previously was under the impression that we had specifically built an abstraction between the different ways to perform HTTP requests in PHP. Why that was replaced with WordPress-specific code without fallbacks... I don't know. In any case, we should resurrect that previous code and build on it:

  • The client should select a HTTP call method available to it, be it fopen, curl or wget or wordpress wp_*. WordPress in that sense is really just a backend.
  • The client should never reference WordPress configuration or WordPress-plugin constants. These should be passed into the client from the calling code in the WordPress-plugin.

The client should be minimal and have a trusted PHP 5.2-compatible loading method, which likely means a single file that can be require_onced that loads all dependencies. The current SPL-based autoloader seems much too magic to me (e.g. replacing "_" in classnames with path separators to figure out where a source file is). We can ship such magic in the WordPress-Plugin, but I'd rather not ship it in the PHP client.

(+CC @drdla @doismellburning fyi and comments)
(+assign to @mturalenka for implementation and comments)

The PHP client seems to generate wrong signatures

Using these LIVE credentials:

Key Value
Merchant ID Now redacted and deleted
API Key Now redacted and deleted

Dominik's test installation sent this URL:

https://api.laterpay.net/access?article_id=8&article_id=14&article_id=30&article_id=32&article_id=36&cp=zemksBsxUYbgkWRi2VjEKg&lptoken=t|F6lmmVngjdRvaslagv65cKK%2FgT%2B9CwMghdGZcCH9Tuo%2BVpKy6sNE5648cOVeAC30EOHU30P%2BrDeo9XjqgGXX9A%3D%3D|1409823881|b9ef6427eb6b60856795c9dd1f083ec29fbf9c124403392e8a0b8e53&ts=1409861570&hmac=e6e3c89e268b422fd41494dfe41f2f16ee0709589aaa798f9c938b5e

However that returned a

{"status": "error", "message": "Wrong signature: \"e6e3c89e268b422fd41494dfe41f2f16ee0709589aaa798f9c938b5e\"", "http_status": 403}

Using the official Python client, for the same parameters, I generated this URL

https://api.laterpay.net/access?article_id=14&article_id=30&article_id=32&article_id=36&article_id=8&cp=zemksBsxUYbgkWRi2VjEKg&lptoken=t%7CF6lmmVngjdRvaslagv65cKK%2FgT%2B9CwMghdGZcCH9Tuo%2BVpKy6sNE5648cOVeAC30EOHU30P%2BrDeo9XjqgGXX9A%3D%3D%7C1409823881%7Cb9ef6427eb6b60856795c9dd1f083ec29fbf9c124403392e8a0b8e53&ts=1409861570&hmac=90c7a21786f06e3aa827f18e1ce55475ca011831ab4e88ccd27d1239

Obviously the article_id parameter is sorted differently. This is because 8 is greater than 32 (8 > 32) in string sort.

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.