* -------------------------------------------------------------------- *
* Copyright (c) 2003 - 2009 by Roland Haeder *
* Copyright (c) 2009 - 2011 by Mailer Developer Team *
- * For more information visit: http://www.mxchange.org *
+ * For more information visit: http://mxchange.org *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
$response = sendPostRequest($requestString, $requestData);
// Check the response header if all is fine
- if (strpos($response[0], '200') === false) {
+ if (!isInString('200', $response[0])) {
// Something bad happend... :(
return array(
'status' => 'request_error',
$result = true;
// Log the transfer
- WERNIS_LOG_TRANSFER($wdsId, $amount, 'IN');
+ WERNIS_LOG_TRANSFER($wdsId, $amount, 'WITHDRAW');
} else {
// Status failure text
WERNIS_STATUS_MESSAGE($return['message'], $return['status']);
$result = true;
// Log the transfer
- WERNIS_LOG_TRANSFER($wdsId, $amount, 'OUT');
+ WERNIS_LOG_TRANSFER($wdsId, $amount, 'PAYOUT');
} else {
// Status failure text
WERNIS_STATUS_MESSAGE($return['message'], $return['status']);
// Translate the status IN/OUT
function translateWernisTransferStatus ($status) {
- // Default status
+ // Default status is unknown
$return = '{%message,WERNIS_STATUS_UNKNWOWN=' . $status . '%}';
- // Which status?
- switch ($status) {
- case 'IN': // Withdraw
- $return = '{--WERNIS_STATUS_WITHDRAW--}';
- break;
-
- case 'OUT': // Payout
- $return = '{--WERNIS_STATUS_PAYOUT--}';
- break;
+ // Construct message id
+ $messageId = 'WERNIS_STATUS_' . $status;
- case 'FAILED': // Payout
- $return = '{--WERNIS_STATUS_FAILED--}';
- break;
- } // END - switch
+ // Is it there?
+ if (isMessageIdValid($messageId)) {
+ // Then use it as message string
+ $return = '{--' . $messageId . '--}';
+ } // END - if
// Return the status
return $return;
// Take fees and factor
function WERNIS_TAKE_FEE ($points, $mode) {
// Payout or withdraw are allowed modes!
- //* DEBUG: */ debugOutput('mode='.$mode.',points='.$points);
+ //* DEBUG: */ debugOutput('mode=' . $mode . ',points=' . $points);
if (!in_array($mode, array('payout', 'withdraw'))) {
// Log error and abort
- logDebugMessage(__FUNCTION__, __LINE__, 'userid=' . getMemberId() . ',mode=' . $mode . ',points=' . $points);
+ logDebugMessage(__FUNCTION__, __LINE__, 'userid=' . getMemberId() . ',mode=' . $mode . ',points=' . $points . ' - unknown mode detected.');
return false;
} // END - if