Compare commits

...
5 changed files with 0 additions and 535 deletions

No files matched your search

-48
View File
@@ -1,48 +0,0 @@
dnl
dnl $Id$
dnl
PHP_ARG_WITH(cybermut, for cybermut support,
[ --with-cybermut[=DIR] Include CyberMut (french Credit Mutuel telepaiement)])
if test "$PHP_CYBERMUT" != "no"; then
for i in /usr/local /usr $PHP_CYBERMUT; do
if test -r $i/cm-mac.h; then
CYBERMUT_INC_DIR=$i
elif test -r $i/include/cm-mac.h; then
CYBERMUT_INC_DIR=$i/include
fi
if test -r $i/libcm-mac.a; then
CYBERMUT_LIB_DIR=$i
elif test -r $i/lib/libcm-mac.a; then
CYBERMUT_LIB_DIR=$i/lib
fi
done
if test -z "$CYBERMUT_INC_DIR"; then
AC_MSG_ERROR(Could not find cm-mac.h Please make sure you have the
CyberMut SDK installed. Use
./configure --with-cybermut=<cybermut-dir> if necessary)
fi
if test -z "$CYBERMUT_LIB_DIR"; then
AC_MSG_ERROR(Could not find libcm-mac.a Please make sure you have the
CyberMut SDK installed. Use
./configure --with-cybermut=<cybermut-dir> if necessary)
fi
AC_MSG_RESULT(found in $CYBERMUT_LIB_DIR)
AC_MSG_RESULT(linking libcm-mac.a with libcybermut.a)
ln -sf $CYBERMUT_LIB_DIR/libcm-mac.a $CYBERMUT_LIB_DIR/libcybermut.a
PHP_ADD_INCLUDE($CYBERMUT_INC_DIR)
PHP_SUBST(CYBERMUT_SHARED_LIBADD)
PHP_ADD_LIBRARY_WITH_PATH(cybermut, $CYBERMUT_LIB_DIR, CYBERMUT_SHARED_LIBADD)
AC_DEFINE(HAVE_CYBERMUT, 1, [ ])
PHP_NEW_EXTENSION(cybermut, cybermut.c, $ext_shared)
fi
-178
View File
@@ -1,178 +0,0 @@
/*
+----------------------------------------------------------------------+
| PHP Version 4 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2002 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 2.02 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available at through the world-wide-web at |
| http://www.php.net/license/2_02.txt. |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Author: Sylvain PAGES <spages@free.fr> |
+----------------------------------------------------------------------+
*/
/* $Id$ */
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "php.h"
#include "php_ini.h"
#include "php_cybermut.h"
#include "cm-mac.h"
/* If you declare any globals in php_cybermut.h uncomment this:
ZEND_DECLARE_MODULE_GLOBALS(cybermut)
*/
/* True global resources - no need for thread safety here */
static int le_cybermut;
/* {{{ cybermut_functions[]
*/
function_entry cybermut_functions[] = {
PHP_FE(cybermut_creerformulairecm, NULL)
PHP_FE(cybermut_testmac, NULL)
PHP_FE(cybermut_creerreponsecm, NULL)
{NULL, NULL, NULL} /* Must be the last line in cybermut_functions[] */
};
/* }}} */
/* {{{ cybermut_module_entry
*/
zend_module_entry cybermut_module_entry = {
STANDARD_MODULE_HEADER,
"cybermut",
cybermut_functions,
PHP_MINIT(cybermut),
PHP_MSHUTDOWN(cybermut),
NULL,
NULL,
PHP_MINFO(cybermut),
NO_VERSION_YET,
STANDARD_MODULE_PROPERTIES
};
/* }}} */
#ifdef COMPILE_DL_CYBERMUT
ZEND_GET_MODULE(cybermut)
#endif
PHP_MINIT_FUNCTION(cybermut)
{
return SUCCESS;
}
PHP_MSHUTDOWN_FUNCTION(cybermut)
{
return SUCCESS;
}
/* {{{ PHP_MINFO_FUNCTION
*/
PHP_MINFO_FUNCTION(cybermut)
{
php_info_print_table_start();
php_info_print_table_header(2, "cybermut support", "enabled");
php_info_print_table_end();
}
/* }}} */
/* {{{ proto string cybermut_creerformulairecm(string url_CM, string version, string TPE, string montant, string ref_commande, string texte_libre, string url_retour, string url_retour_ok, string url_retour_err, string langue, string code_societe, string texte_bouton)
Returns a string containing source HTML of the form of request for payment. This result corresponds to the last parameter "formulaire" of the original function which was removed */
PHP_FUNCTION(cybermut_creerformulairecm)
{
zval **url_CM, **version, **TPE, **montant, **ref_commande, **texte_libre, **url_retour, **url_retour_ok, **url_retour_err, **langue, **code_societe, **texte_bouton;
char formulaire [10000];
if (ZEND_NUM_ARGS() != 12 || zend_get_parameters_ex(12, &url_CM, &version, &TPE, &montant, &ref_commande, &texte_libre, &url_retour, &url_retour_ok, &url_retour_err, &langue, &code_societe, &texte_bouton) == FAILURE){
WRONG_PARAM_COUNT;
}
convert_to_string_ex(url_CM);
convert_to_string_ex(version);
convert_to_string_ex(TPE);
convert_to_string_ex(montant);
convert_to_string_ex(ref_commande);
convert_to_string_ex(texte_libre);
convert_to_string_ex(url_retour);
convert_to_string_ex(url_retour_ok);
convert_to_string_ex(url_retour_err);
convert_to_string_ex(langue);
convert_to_string_ex(code_societe);
convert_to_string_ex(texte_bouton);
CreerFormulaireCM ( Z_STRVAL_PP(url_CM), Z_STRVAL_PP(version), Z_STRVAL_PP(TPE), Z_STRVAL_PP(montant), Z_STRVAL_PP(ref_commande), Z_STRVAL_PP(texte_libre), Z_STRVAL_PP(url_retour), Z_STRVAL_PP(url_retour_ok), Z_STRVAL_PP(url_retour_err), Z_STRVAL_PP(langue), Z_STRVAL_PP(code_societe), Z_STRVAL_PP(texte_bouton), formulaire);
RETURN_STRING(formulaire, 1);
}
/* }}} */
/* {{{ proto bool cybermut_testmac(string code_MAC, string version, string TPE, string cdate, string montant, string ref_commande, string texte_libre, string code_retour)
Returns a boolean attesting that the authentification proceeded well. TRUE if the received message is authenticated and FALSE if not */
PHP_FUNCTION(cybermut_testmac)
{
zval **code_MAC, **version, **TPE, **cdate, **montant, **ref_commande, **texte_libre, **code_retour;
int cdr_test;
if (ZEND_NUM_ARGS() != 8 || zend_get_parameters_ex(8, &code_MAC, &version, &TPE, &cdate, &montant, &ref_commande, &texte_libre, &code_retour) == FAILURE){
WRONG_PARAM_COUNT;
}
convert_to_string_ex(code_MAC);
convert_to_string_ex(version);
convert_to_string_ex(TPE);
convert_to_string_ex(cdate);
convert_to_string_ex(montant);
convert_to_string_ex(ref_commande);
convert_to_string_ex(texte_libre);
convert_to_string_ex(code_retour);
cdr_test = TestMAC ( Z_STRVAL_PP(code_MAC), Z_STRVAL_PP(version), Z_STRVAL_PP(TPE), Z_STRVAL_PP(cdate), Z_STRVAL_PP(montant), Z_STRVAL_PP(ref_commande), Z_STRVAL_PP(texte_libre), Z_STRVAL_PP(code_retour));
if (cdr_test == 1) {
RETURN_TRUE;
} else {
RETURN_FALSE;
}
}
/* }}} */
/* {{{ proto string cybermut_creerreponsecm(string phrase)
Returns a string containing the message of acknowledgement of delivery (headers and body of the message). This result corresponds to the last parameter "reponse" of the original function which was removed */
PHP_FUNCTION(cybermut_creerreponsecm)
{
zval **phrase;
char buf[5000];
if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &phrase) == FAILURE){
WRONG_PARAM_COUNT;
}
convert_to_string_ex(phrase);
CreerReponseCM( Z_STRVAL_PP(phrase), buf);
RETURN_STRING (buf, 1);
}
/* }}} */
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* End:
* vim600: sw=4 ts=4 fdm=marker
* vim<600: sw=4 ts=4
*/
-214
View File
@@ -1,214 +0,0 @@
<reference id="ref.cybermut">
<title>Credit Mutuel CyberMUT functions</title>
<titleabbrev>CyberMUT</titleabbrev>
<partintro>
<simpara>
This extension allows you to process credit cards transactions using Credit
Mutuel CyberMUT system (<ulink url="http://www.creditmutuel.fr/centre_commercial/vendez_sur_internet.html">http://www.creditmutuel.fr/centre_commercial/vendez_sur_internet.html</ulink>).
</simpara>
<simpara>
CynerMUT is a popular Web Payment Service in France, provided by the
Credit Mutuel bank. If you are foreign in France, these functions will not
be useful for you.
</simpara>
<simpara>
These functions are only available if PHP has been compiled with the
<option role="configure">--with-cybermut[=DIR]</option> option, where DIR is
the location of libcm-mac.a and cm-mac.h. You will require the
appropriate SDK for your platform, which may be sent to you after your
CyberMUT's subscription (contact them via Web, or go to the nearest
Credit Mutuel).
</simpara>
<simpara>
The use of these functions is almost identical to the original functions,
except for the parameters of return for CreerFormulaireCM and CreerReponseCM,
which are returned directly by functions PHP, whereas they had passed in
reference in the original functions.
</simpara>
<simpara>
These functions have been added in PHP 4.0.4. ???
</simpara>
<note><para>
These functions only provide a link to CyberMUT SDK. Be sure to read the
CynerMUT Developers Guide for full details of the required parameters.
</para></note>
</partintro>
<refentry id="function.cybermut_creerformulairecm">
<refnamediv>
<refname>cybermut_creerformulairecm</refname>
<refpurpose>Generate HTML form of request for payment</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<funcsynopsis>
<funcprototype>
<funcdef>string <function>pfpro_init</function></funcdef>
<paramdef>string <parameter>url_CM</parameter></paramdef>
<paramdef>string <parameter>version</parameter></paramdef>
<paramdef>string <parameter>TPE</parameter></paramdef>
<paramdef>string <parameter>montant</parameter></paramdef>
<paramdef>string <parameter>ref_commande</parameter></paramdef>
<paramdef>string <parameter>texte_libre</parameter></paramdef>
<paramdef>string <parameter>url_retour</parameter></paramdef>
<paramdef>string <parameter>url_retour_ok</parameter></paramdef>
<paramdef>string <parameter>url_retour_err</parameter></paramdef>
<paramdef>string <parameter>langue</parameter></paramdef>
<paramdef>string <parameter>code_societe</parameter></paramdef>
<paramdef>string <parameter>texte_bouton</parameter></paramdef>
</funcprototype>
</funcsynopsis>
<para>
<function>cynermut_creerformulairecm</function> is used to generate the
HTML form of request for payment.
</para>
<para>
See also <function>cybermut_testmac</function>
<function>cybermut_creerreponsecm</function>.
</para>
<example>
<title>First step of payment (equiv cgi1.c)</title>
<programlisting role="php">
&lt;?php
// Directory where are located the keys
putenv("CMKEYDIR=/var/creditmut/cles");
// Version number
$VERSION="1.2";
$retour = creditmut_creerformulairecm(
"https://www.creditmutuel.fr/test/telepaiement/paiement.cgi",
$VERSION,
"1234567890",
"300FRF",
$REFERENCE,
$TEXTE_LIBRE,
$URL_RETOUR,
$URL_RETOUR_OK,
$URL_RETOUR_ERR,
"francais",
"company",
"Paiement par carte bancaire");
echo $retour;
?>
</programlisting>
</example>
</refsect1>
</refentry>
<refentry id="function.cybermut_testmac">
<refnamediv>
<refname>cybermut_testmac</refname>
<refpurpose>Make sure that there no was data diddling contained
in the received message of confirmation </refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<funcsynopsis>
<funcprototype>
<funcdef>bool <function>cybermut_testmac</function></funcdef>
<paramdef>string <parameter>code_MAC</parameter></paramdef>
<paramdef>string <parameter>version</parameter></paramdef>
<paramdef>string <parameter>TPE</parameter></paramdef>
<paramdef>string <parameter>cdate</parameter></paramdef>
<paramdef>string <parameter>montant</parameter></paramdef>
<paramdef>string <parameter>ref_commande</parameter></paramdef>
<paramdef>string <parameter>texte_libre</parameter></paramdef>
<paramdef>string <parameter>code-retour</parameter></paramdef>
</funcprototype>
</funcsynopsis>
<para>
<function>cybermut_testmac</function> is used to make sure that there was
not data diddling contained in the received message of confirmation.
Pay attention to parameters code-retour and texte-libre, which cannot be
evaluated as is, because auf the dash. You must retrieve them by using:
<programlisting role="php">
$code_retour=$HTTP_GET_VARS["code-retour"];
$texte_libre=$HTTP_GET_VARS["texte-libre"];
</programlisting>
</para>
<para>
See also <function>cybermut_creerformulairecm</function>
<function>cybermut_creerreponsecm</function>.
</para>
<example>
<title>Last step of payment (equiv cgi2.c)</title>
<programlisting role="php">
&lt;?php_track_vars?>
&lt;?php
// Directory where are located the keys
putenv("CMKEYDIR=/var/creditmut/cles");
// Version number
$VERSION="1.2";
$texte_libre = $HTTP_GET_VARS["texte-libre"];
$code_retour = $HTTP_GET_VARS["code-retour"];
$mac_ok = creditmut_testmac($MAC,$VERSION,$TPE,$date,$montant,$reference,$texte_libre,$code_retour);
if ($mac_ok) {
//
// insert data processing here
//
//
$result=creditmut_creerreponsecm("OK");
} else {
$result=creditmut_creerreponsecm("Document Falsifie");}
?>
</programlisting>
</example>
</refsect1>
</refentry>
<refentry id="function.cybermut_creerreponsecm">
<refnamediv>
<refname>cybermut_creerreponsecm</refname>
<refpurpose>Generate the acknowledgement of delivery of the confirmation
of payment</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<funcsynopsis>
<funcprototype>
<funcdef>string <function>cybermut_creerreponsecm</function></funcdef>
<paramdef>string <parameter>phrase</parameter></paramdef>
</funcprototype>
</funcsynopsis>
<para>
Returns: string containing the message of aknowledgement of delivery.
</para>
<para>
The parameter is "OK" if the message of confirmation of the payment
were correctly auhentified by <function>cybermut_testmac</function>.
Any other chain is regarded as an error message.
</para>
<para>
See also <function>cybermut_creerformulairecm</function>
<function>cybermut_testmac</function>.
</para>
</refsect1>
</refentry>
</reference>
<!-- Keep this comment at the end of the file
Local variables:
mode: sgml
sgml-omittag:t
sgml-shorttag:t
sgml-minimize-attributes:nil
sgml-always-quote-attributes:t
sgml-indent-step:1
sgml-indent-data:t
sgml-parent-document:nil
sgml-default-dtd-file:"../../manual.ced"
sgml-exposed-tags:nil
sgml-local-catalogs:nil
sgml-local-ecat-files:nil
End:
-->
-72
View File
@@ -1,72 +0,0 @@
/*
+----------------------------------------------------------------------+
| PHP Version 4 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2002 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 2.02 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available at through the world-wide-web at |
| http://www.php.net/license/2_02.txt. |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| license@php.net so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Author: Sylvain PAGES <spages@free.fr> |
+----------------------------------------------------------------------+
*/
#ifndef PHP_CYBERMUT_H
#define PHP_CYBERMUT_H
extern zend_module_entry cybermut_module_entry;
#define phpext_cybermut_ptr &cybermut_module_entry
#ifdef PHP_WIN32
#define PHP_CYBERMUT_API __declspec(dllexport)
#else
#define PHP_CYBERMUT_API
#endif
PHP_MINIT_FUNCTION(cybermut);
PHP_MSHUTDOWN_FUNCTION(cybermut);
PHP_RINIT_FUNCTION(cybermut);
PHP_RSHUTDOWN_FUNCTION(cybermut);
PHP_MINFO_FUNCTION(cybermut);
PHP_FUNCTION(confirm_cybermut_compiled); /* For testing, remove later. */
PHP_FUNCTION(cybermut_creerformulairecm);
PHP_FUNCTION(cybermut_testmac);
PHP_FUNCTION(cybermut_creerreponsecm);
/*
Declare any global variables you may need between the BEGIN
and END macros here:
ZEND_BEGIN_MODULE_GLOBALS(cybermut)
int global_variable;
ZEND_END_MODULE_GLOBALS(cybermut)
*/
/* In every function that needs to use variables in php_cybermut_globals,
do call CYBERMUTLS_FETCH(); after declaring other variables used by
that function, and always refer to them as CYBERMUTG(variable).
You are encouraged to rename these macros something shorter, see
examples in any other php module directory.
*/
#ifdef ZTS
#define CYBERMUTG(v) TSRMG(cybermut_globals_id, php_cybermut_globals *, v)
#else
#define CYBERMUTG(v) (cybermut_globals.v)
#endif
#endif /* PHP_CYBERMUT_H */
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* End:
*/
-23
View File
@@ -1,23 +0,0 @@
--TEST--
Check for cybermut presence
--SKIPIF--
<?php if (!extension_loaded("cybermut")) print "skip"; ?>
--POST--
--GET--
--FILE--
<?php
echo "cybermut extension is available";
/*
you can add regression tests for your extension here
the output of your test code has to be equal to the
text in the --EXPECT-- section below for the tests
to pass, differences between the output and the
expected text are interpreted as failure
see php4/tests/README for further information on
writing regression tests
*/
?>
--EXPECT--
cybermut extension is available