Skip to content

Commit f4e20cb

Browse files
committed
Initial commit
0 parents  commit f4e20cb

Some content is hidden

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

45 files changed

+3923
-0
lines changed

README.md

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
# osCommerce plugin for Paylike
2+
3+
This plugin is *not* developed or maintained by Paylike but kindly made
4+
available by a user.
5+
6+
Released under the GPL V3 license: https://opensource.org/licenses/GPL-3.0
7+
8+
9+
## Supported osCommerce versions
10+
11+
*The plugin has been tested with osCommerce v.2.3.4.1
12+
13+
14+
## Installation
15+
16+
1. Upload the files in the `upload` folder to root of your osCommerce store.
17+
1. In: `includes/javascript/javascript.php` add:
18+
```
19+
<script src="https://sdk.paylike.io/3.js"></script>
20+
<script src="<?=DIR_WS_JAVASCRIPT?>paylike.js"></script>
21+
```
22+
Between `<?php if($content == 'checkout') { ?> <? } ?>` (line:43-47).
23+
1. Install the Paylike module from modules -> payment in the admin
24+
1. Insert the app key and your public key in the settings and enable the plugin
25+
26+
27+
## Updating settings
28+
29+
Under the Paylike settings, you can:
30+
* Update the title that shows up in the payment popup
31+
* Add test/live keys
32+
* Set payment mode (test/live)
33+
* Change the capture type (Instant/Delayed)
34+
35+
## How to
36+
37+
1. Capture
38+
* In Instant mode, the orders are captured automatically
39+
* In delayed mode you can capture funds only from the paylike dashboard.
40+
2. Refund
41+
* To refund an order you can use the paylike dashboard.
42+
3. Void
43+
* To void an order you can use the paylike dashboard.
44+
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: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
<?php
2+
if (empty($_GET['transactionId'])){
3+
die;
4+
}
5+
$rootPath = dirname(dirname(dirname($_SERVER['SCRIPT_FILENAME'])));
6+
chdir('../../');
7+
8+
require($rootPath.'/includes/application_top.php');
9+
10+
include(DIR_WS_LANGUAGES . $language . '/checkout_process.php');
11+
include(DIR_WS_LANGUAGES . $language . '/checkout.php');
12+
if (!class_exists('osC_onePageCheckout') ) {
13+
require( 'includes/classes/onepage_checkout.php' );
14+
}
15+
$onePageCheckout = new osC_onePageCheckout();
16+
// generate user data from database (table "orders"):
17+
$onePageCheckout->generate_email_by_order_id($order_id);
18+
19+
// send message only once. if we send email, change customer_notified to 1.
20+
$check_status_query = tep_db_query('SELECT `orders_id` FROM ' . TABLE_ORDERS_STATUS_HISTORY . ' WHERE `customer_notified` = 1 AND `orders_id` = "' . $order_id . '"');
21+
if (tep_db_num_rows($check_status_query) == 0) {
22+
23+
// for create emails:
24+
$onePageCheckout->createEmails($order_id);
25+
26+
tep_db_perform('orders_status_history', [
27+
'orders_id' => $order_id,
28+
'orders_status_id' => $order_status,
29+
'date_added' => 'now()',
30+
'customer_notified' => '1'
31+
]);
32+
33+
}
34+
35+
// if success - change order status to success:
36+
37+
tep_db_perform('orders', ['orders_status' => MODULE_PAYMENT_PAYLIKE_ORDER_STATUS_ID], 'update', "orders_id='" . $order_id . "'");
38+
tep_db_perform('orders_status_history', [
39+
'orders_id' => $order_id,
40+
'orders_status_id' => MODULE_PAYMENT_PAYLIKE_ORDER_STATUS_ID,
41+
'date_added' => 'now()',
42+
'customer_notified' => '0',
43+
'comments' => 'Paylike - success!'
44+
]);
45+
46+
// send email to customer:
47+
$payment_method = 'Paylike';
48+
if($content_email_array = get_email_contents('success_payment')){
49+
50+
$store_categories = '';
51+
$store_categories_query=tep_db_query("select categories_id, categories_name from " . TABLE_CATEGORIES_DESCRIPTION . " where language_id = '" . (int)$languages_id . "' limit 5");
52+
while($sc_array=tep_db_fetch_array($store_categories_query)) {
53+
$store_categories .= '<a style="text-decoration:underline;color:inherit" href="'.$_SERVER['HTTP_HOST'].'/index.php?cPath='.$sc_array['categories_id'].'"><span>'.$sc_array['categories_name'].'</span></a><span style="padding:0 5px">&bull;</span>';
54+
}
55+
56+
// array to replace variables from html template:
57+
$array_from_to = array (
58+
'{STORE_NAME}' => STORE_NAME,
59+
'{CUSTOMER_NAME}' => $customer_name,
60+
'{ORDER_ID}' => $order_id,
61+
'{PAYMENT_METHOD}' => $payment_method,
62+
'{STORE_LOGO}' => HTTP_SERVER . '/' . LOGO_IMAGE,
63+
'{STORE_URL}' => HTTP_SERVER,
64+
'{STORE_OWNER_EMAIL}' => STORE_OWNER_EMAIL_ADDRESS,
65+
'{STORE_ADDRESS}' => strip_tags(renderArticle('contacts_footer')),
66+
'{STORE_PHONE}' => strip_tags(renderArticle('phones')),
67+
'{STORE_CATEGORIES}' => $store_categories);
68+
69+
$email_text = strtr($content_email_array['content_html'], $array_from_to);
70+
}
71+
tep_mail($customer_name, $order->customer['email_address'], sprintf($content_email_array['subject'],$order_id,strftime(DATE_FORMAT_LONG)), $email_text, STORE_OWNER, STORE_OWNER_EMAIL_ADDRESS);
72+
73+
74+
$_SESSION['callback'] = true;
75+
tep_redirect(HTTP_SERVER.'/'.FILENAME_CHECKOUT_SUCCESS);
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.

0 commit comments

Comments
 (0)