'') $replyType = 'RAW REPLY: '; else $replyType = "No Reply available."; } $messageToSend = sprintf( "STATUS: %d\nERROR INFO: %s\nREQUEST: \n%s\n%s\n$s\n", nStatus, $reply[CYBS_SK_ERROR_INFO], getArrayContent( $request ), $replyType, $replyText ); // send $messageToSend to the appropriate personnel at your company // using any suitable method, e.g. e-mail, multicast log, etc. // // This sample code simply sends it to standard output. printf( "\nThis is a critical error. Send the following information to the appropriate personnel at your company: \n%s\n", $messageToSend ); } //----------------------------------------------------------------------------- function getFaultContent( $reply ) //----------------------------------------------------------------------------- { $requestID = $reply[CYBS_SK_FAULT_REQUEST_ID]; if ( $requestID == "") $requestID = "(unavailable)"; return( sprintf( "Fault code: %s\nFault string: %s\nRequestID: %s\nFault document: %s", $reply[CYBS_SK_FAULT_CODE], $reply[CYBS_SK_FAULT_STRING], $requestID, $reply[CYBS_SK_FAULT_DOCUMENT] ) ); } //----------------------------------------------------------------------------- function getArrayContent( $arr ) //----------------------------------------------------------------------------- { $content = ''; while (list( $key, $val ) = each( $arr )) { $content = $content . $key . ' => ' . $val . "\n"; } return( $content ); } //----------------------------------------------------------------------------- function getReplyContent( $reply ) { //----------------------------------------------------------------------------- $reasonCode = $reply['reasonCode']; switch ( $reasonCode ) { // Success case '100': return( sprintf( "Request ID: %s\nAuthorizedAmount: %s\nAuthorization Code: %s", $reply['requestID'], $reply['ccAuthReply_amount'], $reply['ccAuthReply_authorizationCode'] ) ); break; ####################################################################### // The request is missing one or more required fields. case '101': $i = 0; $res = ''; // getting missed fileds from response while ( !empty( $reply['missingField_'.$i] ) ) { $res .= $reply['missingField_'.$i] ."\n"; $i++; } return( "Some required fields are missed:\n". $res ); break; ####################################################################### // One or more fields in the request contains invalid data. case '102': $i = 0; $res = ''; // getting missed fileds from response while ( !empty( $reply['invalidField_'.$i] ) ) { $res .= $reply['invalidField_'.$i] ."\n"; $i++; } return( "Following fields contain invalid data:\n". $res ); break; ####################################################################### // Invalid Credit Card Number case '231': return( "The credit card number is declined! Please try different credit card." ); break; ####################################################################### // Expired credit card case '202': return( "This credit card has expired! Please try different credit card." ); break; ####################################################################### // Insufficient funds case '204': return( sprintf( "Insufficient funds in account. Please use a different card or select another form of payment." ) ); break; ####################################################################### // Add other reason codes here that you need to handle // specifically // For all other reason codes, return an empty string, // in which case, you should display a generic message // appropriate to the decision value you received. default: return ( $reasonCode ); break; } } ?> InsideMetals® - All About Gold Stocks | Milling

InsideMetals®  |  Milling | Heap Leaching | Mining Glossary

 

Copyright InsideMetals® 2005 | Produced by Whitney & Whitney Inc. | All rights reserved.