Skip to content

Commit 4693021

Browse files
authored
Merge pull request #1 from genuineq/master
Compatibility fixes for CE_Phoenix distribution
2 parents 4b46f42 + 0a85acb commit 4693021

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+3652
-19
lines changed

README.md

Lines changed: 29 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,64 @@
1-
# osCommerce plugin for Paylike
1+
# osCommerce plugin for Paylike
22

33
This plugin is *not* developed or maintained by Paylike but kindly made
44
available by a user.
55

66
Released under the GPL V3 license: https://opensource.org/licenses/GPL-3.0
77

88

9-
## Supported osCommerce versions
10-
11-
*The plugin has been tested with osCommerce v.2.3.4.1
9+
## Supported osCommerce versions
1210

11+
*The plugin has been tested with osCommerce v.2.3.4.1 and osCommerce CE Phoenix
1312

1413
## Installation
1514

1615
Once you have installed osCommerce, follow these simple steps:
17-
1. Signup at [paylike.io](https://paylike.io) (it’s free)
18-
1. Create a live account
19-
1. Create an app key for your osCommerce website
20-
1. Upload the files in the `upload` folder to root of your osCommerce store.
21-
1. In: `includes/template_top.php` add:
16+
1. Signup at [paylike.io](https://paylike.io) (it’s free)
17+
2. Create a live account
18+
3. Create an app key for your osCommerce website
19+
4. Upload the files in the `upload` folder to root of your osCommerce store.
20+
5. In: `includes/template_top.php` add:
2221
```
2322
<?php
2423
if ( basename( $PHP_SELF ) == 'checkout_confirmation.php' ) {
2524
?>
2625
<script src="https://sdk.paylike.io/3.js"></script>
27-
<script src="<?php echo DIR_WS_INCLUDES ?>javascript/paylike.js"></script>
26+
<script src= "includes/javascript/paylike.js"></script>
2827
<?php
2928
}
3029
?>
3130
```
3231
Anywhere betwen the `head` tags.
33-
1. Install the Paylike module from modules -> payment in the admin
34-
1. Insert the app key and your public key in the settings and enable the plugin
35-
32+
6. In: `includes/.htaccess` add:
33+
```
34+
<FilesMatch "paylike\.php$">
35+
<IfModule mod_authz_core.c>
36+
Require all granted
37+
</IfModule>
38+
<IfModule !mod_authz_core.c>
39+
Allow from all
40+
</IfModule>
41+
</FilesMatch>
42+
```
43+
After the last line.
44+
7. Install the Paylike module from modules -> payment in the admin
45+
8. Insert the app key and your public key in the settings and enable the plugin
46+
3647
3748
## Updating settings
3849
3950
Under the Paylike settings, you can:
40-
* Update the title that shows up in the payment popup
51+
* Update the title that shows up in the payment popup
4152
* Add test/live keys
4253
* Set payment mode (test/live)
4354
* Change the capture type (Instant/Delayed)
44-
55+
4556
## How to
46-
57+
4758
1. Capture
4859
* In Instant mode, the orders are captured automatically
49-
* In delayed mode you can capture funds only from the paylike dashboard.
60+
* In delayed mode you can capture funds only from the paylike dashboard.
5061
2. Refund
5162
* To refund an order you can use the paylike dashboard.
5263
3. Void
53-
* To void an order you can use the paylike dashboard.
54-
64+
* To void an order you can use the paylike dashboard.
Lines changed: 1 addition & 0 deletions
Loading
Lines changed: 1 addition & 0 deletions
Loading
6.17 KB
Loading
Lines changed: 1 addition & 0 deletions
Loading
Lines changed: 1 addition & 0 deletions
Loading
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
* text=auto
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
# Created by .ignore support plugin (hsz.mobi)
2+
### macOS template
3+
*.DS_Store
4+
.AppleDouble
5+
.LSOverride
6+
7+
# Icon must end with two \r
8+
Icon
9+
10+
11+
# Thumbnails
12+
._*
13+
14+
# Files that might appear in the root of a volume
15+
.DocumentRevisions-V100
16+
.fseventsd
17+
.Spotlight-V100
18+
.TemporaryItems
19+
.Trashes
20+
.VolumeIcon.icns
21+
.com.apple.timemachine.donotpresent
22+
23+
# Directories potentially created on remote AFP share
24+
.AppleDB
25+
.AppleDesktop
26+
Network Trash Folder
27+
Temporary Items
28+
.apdisk
29+
### Composer template
30+
composer.phar
31+
/vendor/
32+
33+
# Commit your application's lock file http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file
34+
# You may choose to ignore a library lock file http://getcomposer.org/doc/02-libraries.md#lock-file
35+
composer.lock
36+
### Windows template
37+
# Windows thumbnail cache files
38+
Thumbs.db
39+
ehthumbs.db
40+
ehthumbs_vista.db
41+
42+
# Folder config file
43+
Desktop.ini
44+
45+
# Recycle Bin used on file shares
46+
$RECYCLE.BIN/
47+
48+
# Windows Installer files
49+
*.cab
50+
*.msi
51+
*.msm
52+
*.msp
53+
54+
# Windows shortcuts
55+
*.lnk
56+
### JetBrains template
57+
.idea/
58+
59+
## File-based project format:
60+
*.iws
61+
62+
## Plugin-specific files:
63+
64+
# IntelliJ
65+
/out/
66+
67+
# mpeltonen/sbt-idea plugin
68+
.idea_modules/
69+
70+
# JIRA plugin
71+
atlassian-ide-plugin.xml
72+
73+
# Crashlytics plugin (for Android Studio and IntelliJ)
74+
com_crashlytics_export_strings.xml
75+
crashlytics.properties
76+
crashlytics-build.properties
77+
fabric.properties
78+
.env
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2017 Ionut Calara
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.
Lines changed: 149 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,149 @@
1+
# Paylike client (PHP)
2+
3+
You can sign up for a Paylike account at [https://paylike.io](https://paylike.io).
4+
5+
## Getting an API key
6+
7+
An API key can be obtained by creating a merchant and adding an app through
8+
Paylike [dashboard](https://app.paylike.io).
9+
10+
## Requirements
11+
12+
PHP 5.3.3 and later.
13+
14+
## Install
15+
16+
You can install the package via [Composer](http://getcomposer.org/). Run the following command:
17+
18+
```bash
19+
composer require paylike/php-api
20+
```
21+
22+
If you don't use Composer, you can download the [latest release](https://github.com/paylike/php-api/releases) and include the `init.php` file.
23+
24+
```php
25+
require_once('/path/to/php-api/init.php');
26+
```
27+
28+
## Dependencies
29+
30+
The bindings require the following extension in order to work properly:
31+
32+
- [`curl`](https://secure.php.net/manual/en/book.curl.php)
33+
34+
If you use Composer, these dependencies should be handled automatically. If you install manually, you'll want to make sure that these extensions are available.
35+
If you don't want to use curl, you can create your own client to extend from `HttpClientInterface` and send that as a parameter when instantiating the `Paylike` class.
36+
37+
## Example
38+
39+
```php
40+
$paylike = new \Paylike\Paylike($private_api_key);
41+
42+
// fetch a card
43+
$cards = $paylike->cards();
44+
$card = $cards->fetch($card_id);
45+
46+
// capture a transaction
47+
$transactions = $paylike->transactions();
48+
$transaction = $transactions->capture($transaction_id, array(
49+
'amount' => 100,
50+
'currency' => 'EUR'
51+
));
52+
```
53+
54+
## Methods
55+
```php
56+
$paylike = new \Paylike\Paylike($private_api_key);
57+
58+
$apps = $paylike->apps();
59+
$apps->create($args);
60+
$apps->fetch();
61+
62+
$merchants = $paylike->merchants();
63+
$merchants->create($args);
64+
$merchants->fetch($merchant_id);
65+
$merchants->update($merchant_id, $args);
66+
$all_merchants = $merchants->find($app_id,$args);
67+
$some_merchants = $merchants->before($app_id,$before);
68+
$some_merchants = $merchants->after($app_id,$before);
69+
70+
$cards = $paylike->cards();
71+
$cards->create($merchant_id, $args);
72+
$cards->fetch($card_id);
73+
74+
$transactions = $paylike->transactions();
75+
$transactions->create($merchant_id, $args);
76+
$transactions->fetch($transaction_id);
77+
$transactions->capture($transaction_id, $args);
78+
$transactions->void($transaction_id, $args);
79+
$transactions->refund($transaction_id, $args);
80+
$all_transactions = $transactions->find($merchant_id,$args);
81+
$some_transactions = $transactions->before($merchant_id,$before);
82+
$some_transactions = $transactions->after($merchant_id,$before);
83+
84+
// explicit args
85+
$limit = 10;
86+
$after = '5b8e839d7cc76f04ecd3f733';
87+
$before = '5b98deef882cf804f6108700';
88+
$api_transactions = $transactions->find($merchant_id, array(
89+
'limit' => $limit,
90+
'after' => $after,
91+
'before' => $before,
92+
'filter' => array(
93+
'successful' => true
94+
)
95+
));
96+
```
97+
98+
## Pagination
99+
The methods that return multiple merchants/transactions (find,after,before) use cursors, so you don't need to worry about pagination, you can access any index, or iterate all the items, this is handled in the background.
100+
101+
## Error handling
102+
103+
The api wrapper will throw errors when things do not fly. All errors inherit from
104+
`ApiException`. A very verbose example of catching all types of errors:
105+
106+
```php
107+
$paylike = new \Paylike\Paylike($private_api_key);
108+
try {
109+
$transactions = $paylike->transactions();
110+
$transactions->capture($transaction_id, array(
111+
'amount' => 100,
112+
'currency' => 'EUR'
113+
));
114+
} catch (\Paylike\Exception\NotFound $e) {
115+
// The transaction was not found
116+
} catch (\Paylike\Exception\InvalidRequest $e) {
117+
// Bad (invalid) request - see $e->getJsonBody() for the error
118+
} catch (\Paylike\Exception\Forbidden $e) {
119+
// You are correctly authenticated but do not have access.
120+
} catch (\Paylike\Exception\Unauthorized $e) {
121+
// You need to provide credentials (an app's API key)
122+
} catch (\Paylike\Exception\Conflict $e) {
123+
// Everything you submitted was fine at the time of validation, but something changed in the meantime and came into conflict with this (e.g. double-capture).
124+
} catch (\Paylike\Exception\ApiConnection $e) {
125+
// Network error on connecting via cURL
126+
} catch (\Paylike\Exception\ApiException $e) {
127+
// Unknown api error
128+
}
129+
```
130+
131+
In most cases catching `NotFound` and `InvalidRequest` as client errors
132+
and logging `ApiException` would suffice.
133+
134+
## Development
135+
136+
Install dependencies:
137+
138+
``` bash
139+
composer install
140+
```
141+
142+
## Tests
143+
144+
Install dependencies as mentioned above (which will resolve [PHPUnit](http://packagist.org/packages/phpunit/phpunit)), then you can run the test suite:
145+
146+
```bash
147+
./vendor/bin/phpunit
148+
```
149+

0 commit comments

Comments
 (0)