Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
OsvoDev authored May 3, 2020
0 parents commit bf1a50e
Show file tree
Hide file tree
Showing 81 changed files with 2,961 additions and 0 deletions.
2 changes: 2 additions & 0 deletions CREDITS
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
LiqPay PHP Extension
Osvo Developers
14 changes: 14 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
Copyright (c) 2020, Osvo All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
- Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer
in the documentation and/or other materials provided with the distribution.
- Neither the name of the Osvo nor the names of its contributors may be used to endorse or promote products derived from this software
without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
58 changes: 58 additions & 0 deletions Readme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# cliqpay
### LiqPay on C. PHP extension for the LiqPay API

API documentation (en): [www.liqpay.ua/documentation/en](https://www.liqpay.ua/documentation/en)

API documentation (ru): [www.liqpay.ua/documentation/ru](https://www.liqpay.ua/documentation/ru)

## Compile

PHP Supported Versions : 7.0 >= 7.4.4

### Dependencies

1. Standard
2. Spl
3. Curl
4. Json

----------------------------------------------

****You must make sure that you have all the necessary libraries for the normal operation of cURL, more information [here](https://www.php.net/manual/en/curl.installation.php)***

----------------------------------------------

##### Commands:

*Standard :*

`--enable-cli --enable-cgi --enable-json --enable-liqpay`

*Fast and clean :*

`--disable-all --enable-cli --enable-cgi --enable-json --enable-liqpay`

To enable [ZTS](http://www.phpinternalsbook.com/php7/extensions_design/globals_management.html#using-tsrm-macros-to-protect-global-space) you need to add `--enable-zts` and to disable it `--disable-zts`

And to use this extension in production, add the command `--enable-liqpay-release`

Example : `--disable-all --enable-cli --enable-cgi --enable-json --enable-liqpay --enable-liqpay-release`

---------------------------------------------

****You need to download a version of Visual Studio in advance (Community is fine) for a specific version of PHP***

#### To compile on Windows you need to download the appropriate version of phpsdk:
**[7.4](https://windows.php.net/download#php-7.4)**

**[7.3](https://windows.php.net/download#php-7.3)**

**[7.2](https://windows.php.net/download#php-7.2)**

#### or download php-sdk from Microsoft:

[php-sdk-binary-tools](https://github.com/microsoft/php-sdk-binary-tools)

#### or download compiled libraries for your architecture and version PHP [here](https://github.com/OsvoDev/cliqpay-src/releases/tag/1.0.0)

#### To compile on Linux :
23 changes: 23 additions & 0 deletions config.m4
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
dnl Copyright (c) 2020, Osvo All rights reserved.
dnl Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
dnl - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
dnl - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer
dnl in the documentation and/or other materials provided with the distribution.
dnl - Neither the name of the Osvo nor the names of its contributors may be used to endorse or promote products derived from this software
dnl without specific prior written permission.
dnl
dnl THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
dnl LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
dnl IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
dnl OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
dnl OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
dnl OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

PHP_ARG_ENABLE(liqpay, Whether to enable the "LiqPay" support, [ --enable-liqpay Enable "LiqPay" support])
if test "$PHP_LIQPAY" != "no"; then
AC_DEFINE(HAVE_LIQPAY, 1, [Whether you have LiqPay])
liqpay_src = "php_liqpay.c liqpay_class.c liqpay_functions.c"
PHP_NEW_EXTENSION(liqpay, $liqpay_src, $ext_shared)
PHP_SUBST(LIQPAY_SHARED_LIBADD)
AC_DEFINE(LIQPAY_RELEASE, 1, [LiqPay release])
fi
84 changes: 84 additions & 0 deletions config.w32
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
// Copyright (c) 2020, Osvo All rights reserved.
// Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
// - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
// - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer
// in the documentation and/or other materials provided with the distribution.
// - Neither the name of the Osvo nor the names of its contributors may be used to endorse or promote products derived from this software
// without specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
// IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
// OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
// OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

ARG_ENABLE("liqpay-release", "Enable the extension LiqPay Release support", "no");
ARG_ENABLE("liqpay", "Enable the extension LiqPay support", "no");

if (PHP_LIQPAY != "no") {
if (PHP_VERSION == 7 && PHP_MINOR_VERSION == 0) {
if (CHECK_LIB("libcurl_a.lib;libcurl.lib", "liqpay", PHP_LIQPAY) &&
CHECK_HEADER_ADD_INCLUDE("curl/easy.h", "CFLAGS_LIQPAY") &&
CHECK_LIB("ssleay32.lib", "liqpay", PHP_LIQPAY) &&
CHECK_LIB("libeay32.lib", "liqpay", PHP_LIQPAY) &&
CHECK_LIB("winmm.lib", "liqpay", PHP_LIQPAY) &&
CHECK_LIB("wldap32.lib", "liqpay", PHP_LIQPAY) &&
((PHP_ZLIB == "no") && (CHECK_LIB("zlib_a.lib;zlib.lib", "liqpay", PHP_LIQPAY))) ||
(PHP_ZLIB_SHARED && CHECK_LIB("zlib.lib", "liqpay", PHP_LIQPAY)) || (PHP_ZLIB == "yes" && (!PHP_ZLIB_SHARED))) {
if (PHP_JSON != "no") {
EXTENSION("liqpay", "php_liqpay.c", null, "-I" + configure_module_dirname);
ADD_SOURCES(configure_module_dirname + "/", "liqpay_class.c liqpay_functions.c", "liqpay");
AC_DEFINE('HAVE_LIQPAY', 1, 'Have LiqPay library');
ADD_EXTENSION_DEP("liqpay", "json");
ADD_FLAG("CFLAGS_LIQPAY", "/D CURL_STATICLIB");
if (PHP_LIQPAY_RELEASE != "no") {
ADD_FLAG("CFLAGS_LIQPAY", "/D LIQPAY_RELEASE");
ADD_FLAG("CFLAGS", "/D LIQPAY_RELEASE");
}
} else {
WARNING("LiqPay extension not enabled. JSON extension not included");
}
} else {
WARNING("LiqPay extension not enabled. Not Find Curl libraries");
}
} else {
var ver_num = NaN;
var f = PHP_PHP_BUILD + "/include/curl/curlver.h";
if (FSO.FileExists(f)) {
var reg = /LIBCURL_VERSION_NUM\s+(0x[a-z0-9]+)/gi;
var m = reg.exec(file_get_contents(PHP_PHP_BUILD + "/include/curl/curlver.h"));
if (!!m && m.length >= 2) {
ver_num = parseInt(m[1]);
}
}
if (CHECK_LIB("libcurl_a.lib;libcurl.lib", "liqpay", PHP_LIQPAY) &&
CHECK_HEADER_ADD_INCLUDE("curl/easy.h", "CFLAGS_OSVO_TEST") &&
SETUP_OPENSSL("liqpay", PHP_LIQPAY) > 0 &&
CHECK_LIB("winmm.lib", "liqpay", PHP_LIQPAY) &&
CHECK_LIB("wldap32.lib", "liqpay", PHP_LIQPAY) &&
(((PHP_ZLIB == "no") && (CHECK_LIB("zlib_a.lib;zlib.lib", "liqpay", PHP_LIQPAY))) ||
(PHP_ZLIB_SHARED && CHECK_LIB("zlib.lib", "liqpay", PHP_LIQPAY)) || (PHP_ZLIB == "yes" && (!PHP_ZLIB_SHARED))) &&
!isNaN(ver_num) &&
(ver_num <= parseInt("0x073b00") || ver_num > parseInt("0x073b00") &&
CHECK_LIB("normaliz.lib", "liqpay", PHP_LIQPAY) &&
CHECK_LIB("libssh2.lib", "liqpay", PHP_LIQPAY) &&
CHECK_LIB("nghttp2.lib", "liqpay", PHP_LIQPAY))) {
if (PHP_JSON != "no") {
EXTENSION("liqpay", "php_liqpay.c", null, "-I" + configure_module_dirname);
ADD_SOURCES(configure_module_dirname + "/", "liqpay_class.c liqpay_functions.c", "liqpay");
AC_DEFINE('HAVE_LIQPAY', 1, 'Have LiqPay library');
ADD_EXTENSION_DEP("liqpay", "json");
ADD_FLAG("CFLAGS_LIQPAY", "/D CURL_STATICLIB");
if (PHP_LIQPAY_RELEASE != "no") {
ADD_FLAG("CFLAGS_LIQPAY", "/D LIQPAY_RELEASE");
ADD_FLAG("CFLAGS", "/D LIQPAY_RELEASE");
}
} else {
WARNING("LiqPay extension not enabled. JSON extension not included");
}
} else {
WARNING("LiqPay extension not enabled. Not Find Curl libraries");
}
}
}
51 changes: 51 additions & 0 deletions definitions.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/**
*******************************************************************************************************************************************************
* LiqPay Php Extension *
* ( v1.0.1 ) *
*******************************************************************************************************************************************************
* LiqPay API version : 3 *
* More info about LiqPay API : https://liqpay.ua/documentation/en *
* PhpSdk as Example : https://github.com/liqpay/sdk-php License OSL-3(http://opensource.org/licenses/osl-3.0.php) *
*******************************************************************************************************************************************************
* *
* Copyright (c) 2020, Osvo *
* All rights reserved. *
* *
* Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: *
* - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. *
* - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer *
* in the documentation and/or other materials provided with the distribution. *
* - Neither the name of the Osvo nor the names of its contributors may be used to endorse or promote products derived from this software *
* without specific prior written permission. *
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT *
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. *
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, *
* OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; *
* OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, *
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. *
* *
*******************************************************************************************************************************************************
*/

#ifndef LIQPAY_DEFINITIONS_H
#define LIQPAY_DEFINITIONS_H

#define PHP_EXTENSION_NAME "LiqPay"
#define PHP_EXTENSION_VERSION "1.0.1"
#define PHP_EXTENSION_AUTHOR_NAME "Osvo"
#define PHP_EXTENSION_API_V "3"

#ifndef LIQPAY_RELEASE
#define PHP_EXTENSION_STATUS "Debug"
#else //EL_LIQPAY_RELEASE
#define PHP_EXTENSION_STATUS "Production"
#endif // LIQPAY_RELEASE

#define CURRENCY_EUR "EUR"
#define CURRENCY_USD "USD"
#define CURRENCY_UAH "UAH"
#define CURRENCY_RUB "RUB"
#define CURRENCY_RUR "RUR"

#endif //LIQPAY_DEFINITIONS_H
Loading

0 comments on commit bf1a50e

Please sign in to comment.