[ --with-pfpro[=DIR] Include Verisign Payflow Pro support])
if test "$PHP_PFPRO" != "no"; then
+ PFPRO_LIB=libpfpro.so
+ PFPRO_HDR=pfpro.h
for i in /usr/local /usr $PHP_PFPRO; do
- if test -r $i/pfpro.h; then
+ if test -r $i/$PFPRO_HDR; then
PFPRO_INC_DIR=$i
- elif test -r $i/include/pfpro.h; then
+ elif test -r $i/include/$PFPRO_HDR; then
PFPRO_INC_DIR=$i/include
+ elif test -r $i/lib/$PFPRO_HDR; then
+ PFPRO_INC_DIR=$i/lib
+ elif test -r $i/bin/$PFPRO_HDR; then
+ PFPRO_INC_DIR=$i/bin
fi
- if test -r $i/libpfpro.so; then
+ if test -r $i/$PFPRO_LIB; then
PFPRO_LIB_DIR=$i
- elif test -r $i/lib/libpfpro.so; then
+ elif test -r $i/lib/$PFPRO_LIB; then
PFPRO_LIB_DIR=$i/lib
fi
done
./configure --with-pfpro=<pfpro-dir> if necessary)
fi
- AC_MSG_RESULT(found in $PFPRO_LIB_DIR)
+ PFPRO_VERSION3=`nm $PFPRO_LIB_DIR/$PFPRO_LIB | awk '{print $3}' | grep ^pfpro > /dev/null && echo 1 || echo 0`
+ PFPRO_VERSION2=`nm $PFPRO_LIB_DIR/$PFPRO_LIB | awk '{print $3}' | grep ^PN > /dev/null && echo 1 || echo 0`
+
+ if test "$PFPRO_VERSION3" -eq 1 ; then
+ PFPRO_VERSION=3
+ elif test "$PFPRO_VERSION2" -eq 1 ; then
+ PFPRO_VERSION=2
+ else
+ AC_MSG_ERROR(The pfpro extension requires version 2 or 3 of the SDK)
+ fi
+
+ AC_DEFINE_UNQUOTED(PFPRO_VERSION, $PFPRO_VERSION, [Version of SDK])
+ dnl AC_MSG_RESULT(found in $PFPRO_LIB_DIR)
PHP_ADD_INCLUDE($PFPRO_INC_DIR)
PFPROLS_FETCH();
if (PFPROG(initialized) == 1) {
- PNCleanup();
+ pfproCleanup();
}
return SUCCESS;
{
php_info_print_table_start();
php_info_print_table_header(2, "Verisign Payflow Pro support", "enabled");
- php_info_print_table_row(2, "libpfpro version", PNVersion());
+ php_info_print_table_row(2, "libpfpro version", pfproVersion());
php_info_print_table_end();
DISPLAY_INI_ENTRIES();
WRONG_PARAM_COUNT;
}
- RETURN_STRING(PNVersion(), 1);
+ RETURN_STRING((char *)pfproVersion(), 1);
}
/* }}} */
/* {{{ proto void pfpro_init()
- Initialises the Payflow Pro library */
+ Initializes the Payflow Pro library */
PHP_FUNCTION(pfpro_init)
{
PFPROLS_FETCH();
WRONG_PARAM_COUNT;
}
- PNInit();
+ pfproInit();
PFPROG(initialized) = 1;
WRONG_PARAM_COUNT;
}
- PNCleanup();
+ pfproCleanup();
PFPROG(initialized) = 0;
{
zval ***args;
- char *parmlist;
+ char *parmlist = NULL;
char *address = NULL;
int port = PFPROG(defaultport);
int timeout = PFPROG(defaulttimeout);
int freeaddress = 0;
- /* No, I don't like that Signio tell you to use a
- fixed length buffer either */
-
+#if PFPRO_VERSION < 3
char response[512] = "";
+#else
+ int context;
+ char *response;
+#endif
PFPROLS_FETCH();
printf("Proxy password: >%s<\n", proxyPassword);
#endif
+#if PFPRO_VERSION < 3
/* Blank the response buffer */
-
memset(response, 0, sizeof(response));
+#endif
- /* Initialise the library if needed */
+ /* Initialize the library if needed */
if (PFPROG(initialized) == 0) {
- PNInit();
+ pfproInit();
PFPROG(initialized) = 1;
}
/* Perform the transaction */
+#if PFPRO_VERSION < 3
ProcessPNTransaction(address, port, proxyAddress, proxyPort, proxyLogon, proxyPassword, parmlist, strlen(parmlist), timeout, response);
+#else
+ pfproCreateContext(&context, address, port, timeout, proxyAddress, proxyPort, proxyLogon, proxyPassword);
+ pfproSubmitTransaction(context, parmlist, strlen(parmlist), &response);
+ //pfproCompleteTransaction(response);
+ pfproDestroyContext(context);
+#endif
if (freeaddress) {
efree(address);
zval **entry;
int pass;
+ char *parmlist = NULL;
char *address = NULL;
int port = PFPROG(defaultport);
int timeout = PFPROG(defaulttimeout);
char *proxyLogon = PFPROG(proxylogon);
char *proxyPassword = PFPROG(proxypassword);
- int freeaddress = 0;
-
- char *parmlist = NULL;
int parmlength = 0;
+ int freeaddress = 0;
- /* No, I don't like that Signio tell you to use a
- fixed length buffer either */
-
+#if PFPRO_VERSION < 3
char response[512] = "";
+#else
+ int context;
+ char *response;
+#endif
char tmpbuf[128];
- char *rsppos, *valpos;
char buf[128], sbuf[128];
char *p1, *p2, *p_end, /* Pointers for string manipulation */
- *sp1, *sp2, *sp_end,
+ *sp1, *sp2,
*pdelim1="&", *pdelim2="=";
PFPROLS_FETCH();
RETURN_FALSE;
}
+#if PFPRO_VERSION < 3
/* Blank the response buffer */
-
memset(response, 0, sizeof(response));
+#endif
- /* Initialise the library if needed */
+ /* Initialize the library if needed */
if (PFPROG(initialized) == 0) {
- PNInit();
+ pfproInit();
PFPROG(initialized) = 1;
}
/* Perform the transaction */
- ProcessPNTransaction(address, port, proxyAddress, proxyPort, proxyLogon, proxyPassword, parmlist, parmlength, timeout, response);
+#if PFPRO_VERSION < 3
+ ProcessPNTransaction(address, port, proxyAddress, proxyPort, proxyLogon, proxyPassword, parmlist, strlen(parmlist), timeout, response);
+#else
+ pfproCreateContext(&context, address, port, timeout, proxyAddress, proxyPort, proxyLogon, proxyPassword);
+ pfproSubmitTransaction(context, parmlist, strlen(parmlist), &response);
+ //pfproCompleteTransaction(response);
+ pfproDestroyContext(context);
+#endif
if (freeaddress) {
efree(address);
}
-#if 0
- /* Decode the response back into a PHP array */
-
- rsppos = strtok(response, "&");
-
- do {
- valpos = strchr(rsppos, '=');
- if (valpos) {
- strncpy(tmpbuf, rsppos, valpos - rsppos);
- tmpbuf[valpos - rsppos] = 0;
- add_assoc_string(return_value, tmpbuf, valpos + 1, 1);
- }
-
- } while (rsppos = strtok(NULL, "&"));
-#else
-
-
/* This final chunk of code is to walk the string returned by Signio
and build a string array to return to the user */
add_assoc_string(return_value, &buf[0], &sbuf[0], 1);
}
-#endif
}
/* }}} */