diff --git a/Resources/ExternalConfiguration.php b/Resources/ExternalConfiguration.php index 06d4309..cd3ca1e 100644 --- a/Resources/ExternalConfiguration.php +++ b/Resources/ExternalConfiguration.php @@ -71,10 +71,10 @@ function FutureDate($format){ return $retDate; } - function CallTestLogging($testId, $apiName, $responseMessage){ + function CallTestLogging($testId, $apiName, $assertMessage, $inputMessage){ $runtime = date('d-m-Y H:i:s'); - $file = fopen("./CSV_Files/TestReport/TestResults.csv", "a+"); - fputcsv($file, array($testId, $runtime, $apiName, $responseMessage)); + $file = fopen("./SamplesQA/CSV_Files/TestReport/TestResults.csv", "a+"); + fputcsv($file, array($testId, $apiName, $assertMessage, $inputMessage, $runtime)); fclose($file); } @@ -87,4 +87,4 @@ function downloadReport($downloadData, $fileName){ } } -?> +?> \ No newline at end of file diff --git a/Samples/Flex/CoreServices/GenerateKey.php b/Samples/Flex/CoreServices/GenerateKey.php index 9fe1bf8..3509e2f 100644 --- a/Samples/Flex/CoreServices/GenerateKey.php +++ b/Samples/Flex/CoreServices/GenerateKey.php @@ -13,21 +13,32 @@ function GenerateKey() 'encryptionType' => "None", ]; $flexRequest = new CyberSource\Model\KeyParameters($flexRequestArr); + $flexRequestArr = json_decode($flexRequest); + echo "The Api Request Body: \n". json_encode($flexRequestArr, JSON_UNESCAPED_SLASHES) ."\n\n"; $api_response = list($response, $statusCode, $httpHeader)=null; try { $api_response = $api_instance->generatePublicKey($flexRequest); - print_r($api_response); + echo "The API Request Header: \n". json_encode($config->getRequestHeaders(), JSON_UNESCAPED_SLASHES)."\n\n"; + $resBodyArr= json_decode($api_response[0]); + echo "The Api Response Body: \n". json_encode($resBodyArr, JSON_UNESCAPED_SLASHES)."\n\n"; + echo "The Api Response StatusCode: ".json_encode($api_response[1])."\n\n"; + echo "The Api Response Header: \n".json_encode($api_response[2], JSON_UNESCAPED_SLASHES)."\n"; } catch (Cybersource\ApiException $e) { - print_r($e->getResponseBody()); - print_r($e->getMessage()); + echo "The API Request Header: \n". json_encode($config->getRequestHeaders(), JSON_UNESCAPED_SLASHES)."\n\n"; + echo "The Exception Response Body: \n"; + print_r($e->getResponseBody()); echo "\n\n"; + echo "The Exception Response Header: \n"; + print_r($e->getResponseHeaders()); echo "\n\n"; + echo "The Exception Response Header: \n"; + print_r($e->getMessage());echo "\n\n"; } } // Call Sample Code if(!defined('DO_NOT_RUN_SAMPLES')){ - echo "GenerateKey Samplecode is Running.. \n"; + echo "[BEGIN] EXECUTION OF SAMPLE CODE: GenerateKey\n\n"; GenerateKey(); } diff --git a/Samples/Flex/CoreServices/TokenizeCard.php b/Samples/Flex/CoreServices/TokenizeCard.php index 3c56355..123a2cf 100644 --- a/Samples/Flex/CoreServices/TokenizeCard.php +++ b/Samples/Flex/CoreServices/TokenizeCard.php @@ -25,21 +25,32 @@ function TokenizeCard($keyId, $publicKey) 'cardInfo' => $card_information ]; $flexRequest = new CyberSource\Model\TokenizeRequest($flexRequestArr); - $api_response = list($response,$statusCode,$httpHeader)=null; + $flexRequestArr = json_decode($flexRequest); + echo "The Api Request Body: \n". json_encode($flexRequestArr, JSON_UNESCAPED_SLASHES) ."\n\n"; + $api_response = list($response,$statusCode,$httpHeader)=null; try { $api_response = $api_instance->tokenize($flexRequest); - print_r($api_response); + echo "The API Request Header: \n". json_encode($config->getRequestHeaders(), JSON_UNESCAPED_SLASHES)."\n\n"; + $resBodyArr= json_decode($api_response[0]); + echo "The Api Response Body: \n". json_encode($resBodyArr, JSON_UNESCAPED_SLASHES)."\n\n"; + echo "The Api Response StatusCode: ".json_encode($api_response[1])."\n\n"; + echo "The Api Response Header: \n".json_encode($api_response[2], JSON_UNESCAPED_SLASHES)."\n"; $verifyObj = new Verifier(); return $verifyObj->verifySignature($publicKey, $api_response); } catch (Cybersource\ApiException $e) { - print_r($e->getResponseBody()); - print_r($e->getMessage()); - } + echo "The API Request Header: \n". json_encode($config->getRequestHeaders(), JSON_UNESCAPED_SLASHES)."\n\n"; + echo "The Exception Response Body: \n"; + print_r($e->getResponseBody()); echo "\n\n"; + echo "The Exception Response Header: \n"; + print_r($e->getResponseHeaders()); echo "\n\n"; + echo "The Exception Response Header: \n"; + print_r($e->getMessage());echo "\n\n"; + } } if(!defined('DO_NOT_RUN_SAMPLES')){ - echo "TokenizeCard Samplecode is Processing\n"; + echo "[BEGIN] EXECUTION OF SAMPLE CODE: TokenizeCard\n\n"; include_once __DIR__. DIRECTORY_SEPARATOR .'../KeyGenerationNoEnc.php'; $data = KeyGenerationNoEnc(true); TokenizeCard($data[0], $data[1]); diff --git a/Samples/Flex/KeyGenerationNoEnc.php b/Samples/Flex/KeyGenerationNoEnc.php index 73d39aa..d917b0b 100644 --- a/Samples/Flex/KeyGenerationNoEnc.php +++ b/Samples/Flex/KeyGenerationNoEnc.php @@ -14,7 +14,8 @@ function KeyGenerationNoEnc($flag) 'encryptionType' => "None", ]; $flexRequest = new CyberSource\Model\KeyParameters($flexRequestArr); - $api_response = list($response,$statusCode,$httpHeader)=null; + + $api_response = list($response,$statusCode,$httpHeader)=null; try { $api_response = $api_instance->generatePublicKey($flexRequest); $keyId = $api_response[0]['keyId']; diff --git a/Samples/Payments/CoreServices/CapturePayment.php b/Samples/Payments/CoreServices/CapturePayment.php index 2e03d41..96ec83f 100644 --- a/Samples/Payments/CoreServices/CapturePayment.php +++ b/Samples/Payments/CoreServices/CapturePayment.php @@ -32,9 +32,12 @@ function CapturePayment($flag) ]; //Creating model $request = new CyberSource\Model\CapturePaymentRequest($requestArr); - $api_response = list($response,$statusCode,$httpHeader)=null; + $requestArr = json_decode($request); + $requestBody = $apiclient->dataMasking(json_encode($requestArr, JSON_UNESCAPED_SLASHES)); + echo "The Request Payload : \n".$requestBody."\n\n"; + + $api_response = list($response,$statusCode,$httpHeader)=null; try { - //Calling the Api $api_response = $api_instance->capturePayment($request, $id); if($flag == true){ @@ -42,18 +45,27 @@ function CapturePayment($flag) echo "Fetching Capture ID: ".$api_response[0]['id']."\n"; return $api_response[0]['id']; }else{ - print_r($api_response); + $resBodyArr= json_decode($api_response[0]); + echo "The Api Response Body: \n". json_encode($resBodyArr, JSON_UNESCAPED_SLASHES)."\n\n"; + echo "The Api Response StatusCode: ".json_encode($api_response[1])."\n\n"; + echo "The Api Response Header: \n".json_encode($api_response[2], JSON_UNESCAPED_SLASHES)."\n"; } } catch (Cybersource\ApiException $e) { - print_r($e->getResponseBody()); - print_r($e->getMessage()); + + echo "The API Request Header: \n". json_encode($config->getRequestHeaders(), JSON_UNESCAPED_SLASHES)."\n\n"; + echo "The Exception Response Body: \n"; + print_r($e->getResponseBody()); echo "\n\n"; + echo "The Exception Response Header: \n"; + print_r($e->getResponseHeaders()); echo "\n\n"; + echo "The Exception Response Header: \n"; + print_r($e->getMessage());echo "\n\n"; } } // Call Sample Code if(!defined('DO_NOT_RUN_SAMPLES')){ - echo "Capture payment Samplecode is Running.. \n"; + echo "[BEGIN] EXECUTION OF SAMPLE CODE: CapturePayment \n\n"; CapturePayment(false); } diff --git a/Samples/Payments/CoreServices/ProcessAuthorizationReversal.php b/Samples/Payments/CoreServices/ProcessAuthorizationReversal.php index cb6017c..8e9bb82 100644 --- a/Samples/Payments/CoreServices/ProcessAuthorizationReversal.php +++ b/Samples/Payments/CoreServices/ProcessAuthorizationReversal.php @@ -33,26 +33,41 @@ function ProcessAuthorizationReversal($flag) ]; $paymentRequest = new CyberSource\Model\AuthReversalRequest($paymentRequestArr); - $api_response = list($response,$statusCode,$httpHeader)=null; + $requestArr = json_decode($paymentRequest); + $requestBody = $apiclient->dataMasking(json_encode($requestArr, JSON_UNESCAPED_SLASHES)); + echo "The Request Payload : \n".$requestBody."\n\n"; + + $api_response = list($response,$statusCode,$httpHeader)=null; try { + $api_response = $api_instance->authReversal($id, $paymentRequest); + if($flag == true){ //Returning the ID echo "Fetching Reversal: ".$api_response[0]['id']."\n"; return $api_response[0]['id']; }else{ - print_r($api_response); + $resBodyArr= json_decode($api_response[0]); + echo "The Api Response Body: \n". json_encode($resBodyArr, JSON_UNESCAPED_SLASHES)."\n\n"; + echo "The Api Response StatusCode: ".json_encode($api_response[1])."\n\n"; + echo "The Api Response Header: \n".json_encode($api_response[2], JSON_UNESCAPED_SLASHES)."\n"; } } catch (Cybersource\ApiException $e) { - print_r($e->getResponseBody()); - print_r($e->getMessage()); + + echo "The API Request Header: \n". json_encode($config->getRequestHeaders(), JSON_UNESCAPED_SLASHES)."\n\n"; + echo "The Exception Response Body: \n"; + print_r($e->getResponseBody()); echo "\n\n"; + echo "The Exception Response Header: \n"; + print_r($e->getResponseHeaders()); echo "\n\n"; + echo "The Exception Response Header: \n"; + print_r($e->getMessage());echo "\n\n"; } } // Call Sample Code if(!defined('DO_NOT_RUN_SAMPLES')){ - echo "ProcessAuthorizationReversal Samplecode is Running.. \n"; + echo "[BEGIN] EXECUTION OF SAMPLE CODE: ProcessAuthorizationReversal \n\n"; ProcessAuthorizationReversal(false); } diff --git a/Samples/Payments/CoreServices/ProcessCredit.php b/Samples/Payments/CoreServices/ProcessCredit.php index 6f0b6f4..f51f8fb 100644 --- a/Samples/Payments/CoreServices/ProcessCredit.php +++ b/Samples/Payments/CoreServices/ProcessCredit.php @@ -58,8 +58,12 @@ function ProcessCredit($flag) ]; $paymentRequest = new CyberSource\Model\CreateCreditRequest($paymentRequestArr); - $api_response = list($response,$statusCode,$httpHeader)=null; + $requestArr = json_decode($paymentRequest); + $requestBody = $apiclient->dataMasking(json_encode($requestArr, JSON_UNESCAPED_SLASHES)); + echo "The Request Payload : \n".$requestBody."\n\n"; + $api_response = list($response,$statusCode,$httpHeader)=null; try { + $api_response = $api_instance->createCredit($paymentRequest); if($flag ==true){ //Returning the ID @@ -67,18 +71,28 @@ function ProcessCredit($flag) return $api_response[0]['id']; } else { - print_r($api_response); + echo "The API Request Header: \n". json_encode($config->getRequestHeaders(), JSON_UNESCAPED_SLASHES)."\n\n"; + $resBodyArr= json_decode($api_response[0]); + echo "The Api Response Body: \n". json_encode($resBodyArr, JSON_UNESCAPED_SLASHES)."\n\n"; + echo "The Api Response StatusCode: ".json_encode($api_response[1])."\n\n"; + echo "The Api Response Header: \n".json_encode($api_response[2], JSON_UNESCAPED_SLASHES)."\n"; } } catch (Cybersource\ApiException $e) { - print_r($e->getResponseBody()); - print_r($e->getMessage()); + + echo "The API Request Header: \n". json_encode($config->getRequestHeaders(), JSON_UNESCAPED_SLASHES)."\n\n"; + echo "The Exception Response Body: \n"; + print_r($e->getResponseBody()); echo "\n\n"; + echo "The Exception Response Header: \n"; + print_r($e->getResponseHeaders()); echo "\n\n"; + echo "The Exception Response Header: \n"; + print_r($e->getMessage());echo "\n\n"; } } // Call Sample Code if(!defined('DO_NOT_RUN_SAMPLES')){ - echo "Process Credit Samplecode is Running.. \n"; + echo "[BEGIN] EXECUTION OF SAMPLE CODE: ProcessCredit \n\n"; ProcessCredit(false); } diff --git a/Samples/Payments/CoreServices/ProcessPayment.php b/Samples/Payments/CoreServices/ProcessPayment.php index 3b805aa..cbf1183 100644 --- a/Samples/Payments/CoreServices/ProcessPayment.php +++ b/Samples/Payments/CoreServices/ProcessPayment.php @@ -70,30 +70,41 @@ function ProcessPayment($flag) ]; //Creating model $paymentRequest = new CyberSource\Model\CreatePaymentRequest($paymentRequestArr); - $api_response = list($response,$statusCode,$httpHeader)=null; + $requestArr = json_decode($paymentRequest); + $requestBody = $apiclient->dataMasking(json_encode($requestArr, JSON_UNESCAPED_SLASHES)); + echo "The Api Request Body: \n". $requestBody."\n\n"; + $api_response = list($response,$statusCode,$httpHeader)=null; try { //Calling the Api $api_response = $api_instance->createPayment($paymentRequest); - if($flag =="true" || $flag =="notallow"){ //Returning the ID echo "Fetching Payment ID: ".$api_response[0]['id']."\n"; return $api_response[0]['id']; } else { - print_r($api_response); + echo "The API Request Header: \n". json_encode($config->getRequestHeaders(), JSON_UNESCAPED_SLASHES)."\n\n"; + $resBodyArr= json_decode($api_response[0]); + echo "The Api Response Body: \n". json_encode($resBodyArr, JSON_UNESCAPED_SLASHES)."\n\n"; + echo "The Api Response StatusCode: ".json_encode($api_response[1])."\n\n"; + echo "The Api Response Header: \n".json_encode($api_response[2], JSON_UNESCAPED_SLASHES)."\n"; } } catch (Cybersource\ApiException $e) { - print_r($e->getResponseBody()); - print_r($e->getMessage()); + echo "The API Request Header: \n". json_encode($config->getRequestHeaders(), JSON_UNESCAPED_SLASHES)."\n\n"; + echo "The Exception Response Body: \n"; + print_r($e->getResponseBody()); echo "\n\n"; + echo "The Exception Response Header: \n"; + print_r($e->getResponseHeaders()); echo "\n\n"; + echo "The Exception Response Header: \n"; + print_r($e->getMessage());echo "\n\n"; } } // Call Sample Code if(!defined('DO_NOT_RUN_SAMPLES')){ - echo "Process payment Samplecode is Running.. \n"; + echo "[BEGIN] EXECUTION OF SAMPLE CODE: ProcessPayment\n\n"; ProcessPayment("false"); } diff --git a/Samples/Payments/CoreServices/RefundCapture.php b/Samples/Payments/CoreServices/RefundCapture.php index cae34e1..6cacc86 100644 --- a/Samples/Payments/CoreServices/RefundCapture.php +++ b/Samples/Payments/CoreServices/RefundCapture.php @@ -33,20 +33,32 @@ function RefundCapture() ]; $paymentRequest = new CyberSource\Model\RefundCaptureRequest($paymentRequestArr); - $api_response = list($response,$statusCode,$httpHeader)=null; + $requestArr = json_decode($paymentRequest); + $requestBody = $apiclient->dataMasking(json_encode($requestArr, JSON_UNESCAPED_SLASHES)); + echo "The Api Request Body: \n". $requestBody."\n\n"; + $api_response = list($response,$statusCode,$httpHeader)=null; try { $api_response = $api_instance->refundCapture($paymentRequest, $id); - echo "
";print_r($api_response); + echo "The API Request Header: \n". json_encode($config->getRequestHeaders(), JSON_UNESCAPED_SLASHES)."\n\n"; + $resBodyArr= json_decode($api_response[0]); + echo "The Api Response Body: \n". json_encode($resBodyArr, JSON_UNESCAPED_SLASHES)."\n\n"; + echo "The Api Response StatusCode: ".json_encode($api_response[1])."\n\n"; + echo "The Api Response Header: \n".json_encode($api_response[2], JSON_UNESCAPED_SLASHES)."\n"; } catch (Cybersource\ApiException $e) { - print_r($e->getResponseBody()); - print_r($e->getMessage()); + echo "The API Request Header: \n". json_encode($config->getRequestHeaders(), JSON_UNESCAPED_SLASHES)."\n\n"; + echo "The Exception Response Body: \n"; + print_r($e->getResponseBody()); echo "\n\n"; + echo "The Exception Response Header: \n"; + print_r($e->getResponseHeaders()); echo "\n\n"; + echo "The Exception Response Header: \n"; + print_r($e->getMessage());echo "\n\n"; } } // Call Sample Code if(!defined('DO_NOT_RUN_SAMPLES')){ - echo "RefundCapture Samplecode is Running.. \n"; + echo "[BEGIN] EXECUTION OF SAMPLE CODE: RefundCapture\n\n"; RefundCapture(); } diff --git a/Samples/Payments/CoreServices/RefundPayment.php b/Samples/Payments/CoreServices/RefundPayment.php index d6dd41b..5fc8158 100644 --- a/Samples/Payments/CoreServices/RefundPayment.php +++ b/Samples/Payments/CoreServices/RefundPayment.php @@ -31,8 +31,10 @@ function RefundPayment($flag) ]; $paymentRequest = new CyberSource\Model\RefundPaymentRequest($paymentRequestArr); - - $api_response = list($response,$statusCode,$httpHeader)=null; + $requestArr = json_decode($paymentRequest); + $requestBody = $apiclient->dataMasking(json_encode($requestArr, JSON_UNESCAPED_SLASHES)); + echo "The Api Request Body: \n". $requestBody."\n\n"; + $api_response = list($response,$statusCode,$httpHeader)=null; try { $api_response = $api_instance->refundPayment($paymentRequest, $id); if($flag ==true){ @@ -41,18 +43,27 @@ function RefundPayment($flag) return $api_response[0]['id']; } else { - print_r($api_response); + echo "The API Request Header: \n". json_encode($config->getRequestHeaders(), JSON_UNESCAPED_SLASHES)."\n\n"; + $resBodyArr= json_decode($api_response[0]); + echo "The Api Response Body: \n". json_encode($resBodyArr, JSON_UNESCAPED_SLASHES)."\n\n"; + echo "The Api Response StatusCode: ".json_encode($api_response[1])."\n\n"; + echo "The Api Response Header: \n".json_encode($api_response[2], JSON_UNESCAPED_SLASHES)."\n"; } } catch (Cybersource\ApiException $e) { - print_r($e->getResponseBody()); - print_r($e->getMessage()); + echo "The API Request Header: \n". json_encode($config->getRequestHeaders(), JSON_UNESCAPED_SLASHES)."\n\n"; + echo "The Exception Response Body: \n"; + print_r($e->getResponseBody()); echo "\n\n"; + echo "The Exception Response Header: \n"; + print_r($e->getResponseHeaders()); echo "\n\n"; + echo "The Exception Response Header: \n"; + print_r($e->getMessage());echo "\n\n"; } } // Call Sample Code if(!defined('DO_NOT_RUN_SAMPLES')){ - echo "Refund Payment Samplecode is Running.. \n"; + echo "[BEGIN] EXECUTION OF SAMPLE CODE: RefundPayment\n\n"; RefundPayment(false); } diff --git a/Samples/Payments/CoreServices/VoidCapture.php b/Samples/Payments/CoreServices/VoidCapture.php index e085c7a..d546d02 100644 --- a/Samples/Payments/CoreServices/VoidCapture.php +++ b/Samples/Payments/CoreServices/VoidCapture.php @@ -20,20 +20,32 @@ function VoidCapture() ]; $paymentRequest = new CyberSource\Model\VoidCaptureRequest($paymentRequestArr); - $api_response = list($response,$statusCode,$httpHeader)=null; + $requestArr = json_decode($paymentRequest); + $requestBody = $apiclient->dataMasking(json_encode($requestArr, JSON_UNESCAPED_SLASHES)); + echo "The Api Request Body: \n". $requestBody."\n\n"; + $api_response = list($response,$statusCode,$httpHeader)=null; try { $api_response = $api_instance->voidCapture($paymentRequest, $id); - echo "";print_r($api_response); + echo "The API Request Header: \n". json_encode($config->getRequestHeaders(), JSON_UNESCAPED_SLASHES)."\n\n"; + $resBodyArr= json_decode($api_response[0]); + echo "The Api Response Body: \n". json_encode($resBodyArr, JSON_UNESCAPED_SLASHES)."\n\n"; + echo "The Api Response StatusCode: ".json_encode($api_response[1])."\n\n"; + echo "The Api Response Header: \n".json_encode($api_response[2], JSON_UNESCAPED_SLASHES)."\n"; } catch (Cybersource\ApiException $e) { - print_r($e->getResponseBody()); - print_r($e->getMessage()); + echo "The API Request Header: \n". json_encode($config->getRequestHeaders(), JSON_UNESCAPED_SLASHES)."\n\n"; + echo "The Exception Response Body: \n"; + print_r($e->getResponseBody()); echo "\n\n"; + echo "The Exception Response Header: \n"; + print_r($e->getResponseHeaders()); echo "\n\n"; + echo "The Exception Response Header: \n"; + print_r($e->getMessage());echo "\n\n"; } } // Call Sample Code if(!defined('DO_NOT_RUN_SAMPLES')){ - echo "VoidCapture Samplecode is Running.. \n"; + echo "[BEGIN] EXECUTION OF SAMPLE CODE: VoidCapture\n\n"; VoidCapture(); } diff --git a/Samples/Payments/CoreServices/VoidCredit.php b/Samples/Payments/CoreServices/VoidCredit.php index af4cabc..ca5dd1f 100644 --- a/Samples/Payments/CoreServices/VoidCredit.php +++ b/Samples/Payments/CoreServices/VoidCredit.php @@ -20,20 +20,32 @@ function VoidCredit() ]; $paymentRequest = new CyberSource\Model\VoidCreditRequest($paymentRequestArr); - $api_response = list($response,$statusCode,$httpHeader)=null; + $requestArr = json_decode($paymentRequest); + $requestBody = $apiclient->dataMasking(json_encode($requestArr, JSON_UNESCAPED_SLASHES)); + echo "The Api Request Body: \n". $requestBody."\n\n"; + $api_response = list($response,$statusCode,$httpHeader)=null; try { $api_response = $api_instance->voidCredit($paymentRequest, $id); - echo "";print_r($api_response); + echo "The API Request Header: \n". json_encode($config->getRequestHeaders(), JSON_UNESCAPED_SLASHES)."\n\n"; + $resBodyArr= json_decode($api_response[0]); + echo "The Api Response Body: \n". json_encode($resBodyArr, JSON_UNESCAPED_SLASHES)."\n\n"; + echo "The Api Response StatusCode: ".json_encode($api_response[1])."\n\n"; + echo "The Api Response Header: \n".json_encode($api_response[2], JSON_UNESCAPED_SLASHES)."\n"; } catch (Cybersource\ApiException $e) { - print_r($e->getResponseBody()); - print_r($e->getMessage()); + echo "The API Request Header: \n". json_encode($config->getRequestHeaders(), JSON_UNESCAPED_SLASHES)."\n\n"; + echo "The Exception Response Body: \n"; + print_r($e->getResponseBody()); echo "\n\n"; + echo "The Exception Response Header: \n"; + print_r($e->getResponseHeaders()); echo "\n\n"; + echo "The Exception Response Header: \n"; + print_r($e->getMessage());echo "\n\n"; } } // Call Sample Code if(!defined('DO_NOT_RUN_SAMPLES')){ - echo "Void Credit Samplecode is Running.. \n"; + echo "[BEGIN] EXECUTION OF SAMPLE CODE: VoidCredit\n\n"; VoidCredit(); } diff --git a/Samples/Payments/CoreServices/VoidPayment.php b/Samples/Payments/CoreServices/VoidPayment.php index a86e2c1..7871146 100644 --- a/Samples/Payments/CoreServices/VoidPayment.php +++ b/Samples/Payments/CoreServices/VoidPayment.php @@ -20,20 +20,32 @@ function VoidPayment() ]; $paymentRequest = new CyberSource\Model\VoidPaymentRequest($paymentRequestArr); - $api_response = list($response,$statusCode,$httpHeader)=null; + $requestArr = json_decode($paymentRequest); + $requestBody = $apiclient->dataMasking(json_encode($requestArr, JSON_UNESCAPED_SLASHES)); + echo "The Api Request Body: \n". $requestBody."\n\n"; + $api_response = list($response,$statusCode,$httpHeader)=null; try { $api_response = $api_instance->voidPayment($paymentRequest, $id); - echo "";print_r($api_response); + echo "The API Request Header: \n". json_encode($config->getRequestHeaders(), JSON_UNESCAPED_SLASHES)."\n\n"; + $resBodyArr= json_decode($api_response[0]); + echo "The Api Response Body: \n". json_encode($resBodyArr, JSON_UNESCAPED_SLASHES)."\n\n"; + echo "The Api Response StatusCode: ".json_encode($api_response[1])."\n\n"; + echo "The Api Response Header: \n".json_encode($api_response[2], JSON_UNESCAPED_SLASHES)."\n"; - } catch (Cybersource\ApiException $e) { - print_r($e->getResponseBody()); - print_r($e->getMessage()); + } catch (Cybersource\ApiException $e) { + echo "The API Request Header: \n". json_encode($config->getRequestHeaders(), JSON_UNESCAPED_SLASHES)."\n\n"; + echo "The Exception Response Body: \n"; + print_r($e->getResponseBody()); echo "\n\n"; + echo "The Exception Response Header: \n"; + print_r($e->getResponseHeaders()); echo "\n\n"; + echo "The Exception Response Header: \n"; + print_r($e->getMessage());echo "\n\n"; } } // Call Sample Code if(!defined('DO_NOT_RUN_SAMPLES')){ - echo "Voidpayment Samplecode is Running.. \n"; + echo "[BEGIN] EXECUTION OF SAMPLE CODE: VoidPayment\n\n"; VoidPayment(); } diff --git a/Samples/Payments/CoreServices/VoidRefund.php b/Samples/Payments/CoreServices/VoidRefund.php index ad22dae..abd1228 100644 --- a/Samples/Payments/CoreServices/VoidRefund.php +++ b/Samples/Payments/CoreServices/VoidRefund.php @@ -20,20 +20,32 @@ function VoidRefund() ]; $paymentRequest = new CyberSource\Model\VoidRefundRequest($paymentRequestArr); - $api_response = list($response,$statusCode,$httpHeader)=null; + $requestArr = json_decode($paymentRequest); + $requestBody = $apiclient->dataMasking(json_encode($requestArr, JSON_UNESCAPED_SLASHES)); + echo "The Api Request Body: \n". $requestBody."\n\n"; + $api_response = list($response,$statusCode,$httpHeader)=null; try { $api_response = $api_instance->voidRefund($paymentRequest, $id); - echo "";print_r($api_response); + echo "The API Request Header: \n". json_encode($config->getRequestHeaders(), JSON_UNESCAPED_SLASHES)."\n\n"; + $resBodyArr= json_decode($api_response[0]); + echo "The Api Response Body: \n". json_encode($resBodyArr, JSON_UNESCAPED_SLASHES)."\n\n"; + echo "The Api Response StatusCode: ".json_encode($api_response[1])."\n\n"; + echo "The Api Response Header: \n".json_encode($api_response[2], JSON_UNESCAPED_SLASHES)."\n"; } catch (Cybersource\ApiException $e) { - print_r($e->getResponseBody()); - print_r($e->getMessage()); + echo "The API Request Header: \n". json_encode($config->getRequestHeaders(), JSON_UNESCAPED_SLASHES)."\n\n"; + echo "The Exception Response Body: \n"; + print_r($e->getResponseBody()); echo "\n\n"; + echo "The Exception Response Header: \n"; + print_r($e->getResponseHeaders()); echo "\n\n"; + echo "The Exception Response Header: \n"; + print_r($e->getMessage());echo "\n\n"; } } // Call Sample Code if(!defined('DO_NOT_RUN_SAMPLES')){ - echo "Voidrefund Samplecode is Running.. \n"; + echo "[BEGIN] EXECUTION OF SAMPLE CODE: VoidRefund\n\n"; VoidRefund(); } diff --git a/Samples/Payouts/CoreServices/ProcessPayout.php b/Samples/Payouts/CoreServices/ProcessPayout.php index 6a447f1..81e6667 100644 --- a/Samples/Payouts/CoreServices/ProcessPayout.php +++ b/Samples/Payouts/CoreServices/ProcessPayout.php @@ -97,21 +97,34 @@ function ProcessPayout() "processingInformation" => $processingInformation ]; - $paymentRequest = new CyberSource\Model\PtsV2PayoutsPostResponse($paymentRequestArr); - $api_response = list($response,$statusCode,$httpHeader)=null; + $request = new CyberSource\Model\PtsV2PayoutsPostResponse($paymentRequestArr); + $requestArr = json_decode($request); + $requestBody = $apiclient->dataMasking(json_encode($requestArr, JSON_UNESCAPED_SLASHES)); + echo "The Request Payload : \n".$requestBody."\n\n"; + $api_response = list($response,$statusCode,$httpHeader)=null; try { - $api_response = $api_instance->octCreatePayment($paymentRequest); - echo "";print_r($api_response); + + $api_response = $api_instance->octCreatePayment($request); + echo "The API Request Header: \n". json_encode($config->getRequestHeaders(), JSON_UNESCAPED_SLASHES)."\n\n"; + echo "The Api Response Body: \n"; print_r($api_response[0]);echo "\n\n"; + echo "The Api Response StatusCode: ".json_encode($api_response[1])."\n\n"; + echo "The Api Response Header: \n".json_encode($api_response[2], JSON_UNESCAPED_SLASHES)."\n"; } catch (Cybersource\ApiException $e) { - print_r($e->getResponseBody()); - print_r($e->getMessage()); + + echo "The API Request Header: \n". json_encode($config->getRequestHeaders(), JSON_UNESCAPED_SLASHES)."\n\n"; + echo "The Exception Response Body: \n"; + print_r($e->getResponseBody()); echo "\n\n"; + echo "The Exception Response Header: \n"; + print_r($e->getResponseHeaders()); echo "\n\n"; + echo "The Exception Response Header: \n"; + print_r($e->getMessage());echo "\n\n"; } } // Call Sample Code if(!defined('DO_NOT_RUN_SAMPLES')){ - echo "ProcessPayout Samplecode is Running.. \n"; + echo "[BEGIN] EXECUTION OF SAMPLE CODE: ProcessPayout \n\n"; ProcessPayout(); } diff --git a/Samples/Payouts/Payout.php b/Samples/Payouts/Payout.php index b7101ef..bb8ebd2 100644 --- a/Samples/Payouts/Payout.php +++ b/Samples/Payouts/Payout.php @@ -100,21 +100,35 @@ function Payout() "processingInformation" => $processingInformation ]; - $paymentRequest = new CyberSource\Model\PtsV2PayoutsPostResponse($paymentRequestArr); - $api_response = list($response,$statusCode,$httpHeader)=null; + $request = new CyberSource\Model\PtsV2PayoutsPostResponse($paymentRequestArr); + $requestArr = json_decode($request); + $requestBody = $apiclient->dataMasking(json_encode($requestArr, JSON_UNESCAPED_SLASHES)); + echo "The Request Payload : \n".$requestBody."\n\n"; + + $api_response = list($response,$statusCode,$httpHeader)=null; try { - $api_response = $api_instance->octCreatePayment($paymentRequest); - echo "";print_r($api_response); + + $api_response = $api_instance->octCreatePayment($request); + $resBodyArr= json_decode($api_response[0]); + echo "The Api Response Body: \n". json_encode($resBodyArr, JSON_UNESCAPED_SLASHES)."\n\n"; + echo "The Api Response StatusCode: ".json_encode($api_response[1])."\n\n"; + echo "The Api Response Header: \n".json_encode($api_response[2], JSON_UNESCAPED_SLASHES)."\n"; } catch (Cybersource\ApiException $e) { - print_r($e->getresponseBody()); - print_r($e->getMessage()); - } + + echo "The API Request Header: \n". json_encode($config->getRequestHeaders(), JSON_UNESCAPED_SLASHES)."\n\n"; + echo "The Exception Response Body: \n"; + print_r($e->getResponseBody()); echo "\n\n"; + echo "The Exception Response Header: \n"; + print_r($e->getResponseHeaders()); echo "\n\n"; + echo "The Exception Response Header: \n"; + print_r($e->getMessage());echo "\n\n"; + } } // Call Sample Code if(!defined('DO_NOT_RUN_SAMPLES')){ - echo "ProcessPayout Samplecode is Running.."; + echo "[BEGIN] EXECUTION OF SAMPLE CODE: ProcessPayout \n\n"; Payout(); } diff --git a/Samples/Reporting/CoreServices/CreateAdhocReport.php b/Samples/Reporting/CoreServices/CreateAdhocReport.php index 5bcbe3f..cd856ee 100644 --- a/Samples/Reporting/CoreServices/CreateAdhocReport.php +++ b/Samples/Reporting/CoreServices/CreateAdhocReport.php @@ -21,20 +21,34 @@ function CreateAdhocReport() $reportRequest = new CyberSource\Model\RequestBody1($createReportRequestArr); - $api_response = list($response,$statusCode,$httpHeader)=null; + $requestArr = json_decode($reportRequest); + $requestBody = $apiclient->dataMasking(json_encode($requestArr, JSON_UNESCAPED_SLASHES)); + echo "The Request Payload : \n".$requestBody."\n\n"; + + $api_response = list($response,$statusCode,$httpHeader)=null; try { + $api_response = $api_instance->createReport($reportRequest); - echo "";print_r($api_response); + echo "The API Request Header: \n". json_encode($config->getRequestHeaders(), JSON_UNESCAPED_SLASHES)."\n\n"; + echo "The Api Response Body: \n"; print_r($api_response[0]);echo "\n\n"; + echo "The Api Response StatusCode: ".json_encode($api_response[1])."\n\n"; + echo "The Api Response Header: \n".json_encode($api_response[2], JSON_UNESCAPED_SLASHES)."\n"; } catch (Exception $e) { - print_r($e->getresponseBody()); - print_r($e->getmessage()); + + echo "The API Request Header: \n". json_encode($config->getRequestHeaders(), JSON_UNESCAPED_SLASHES)."\n\n"; + echo "The Exception Response Body: \n"; + print_r($e->getResponseBody()); echo "\n\n"; + echo "The Exception Response Header: \n"; + print_r($e->getResponseHeaders()); echo "\n\n"; + echo "The Exception Response Header: \n"; + print_r($e->getMessage());echo "\n\n"; } } // Call Sample Code if(!defined('DO_NOT_RUN_SAMPLES')){ - echo "CreateAdhocReport Samplecode is Running.. \n"; + echo "[BEGIN] EXECUTION OF SAMPLE CODE: CreateAdhocReport \n\n"; CreateAdhocReport(); } diff --git a/Samples/Reporting/CoreServices/CreateReportSubscriptionForReportNameByOrganization.php b/Samples/Reporting/CoreServices/CreateReportSubscriptionForReportNameByOrganization.php index f27f831..5a28e52 100644 --- a/Samples/Reporting/CoreServices/CreateReportSubscriptionForReportNameByOrganization.php +++ b/Samples/Reporting/CoreServices/CreateReportSubscriptionForReportNameByOrganization.php @@ -16,26 +16,39 @@ function CreateReportSubscriptionForReportNameByOrganization() "Request.MerchantID"], 'reportMimeType' => 'application/xml', 'reportFrequency' => 'WEEKLY', - 'reportName' => 'testrests_subcription_v1', + 'reportName' => 'testrestsa_subcription_v1', 'timezone' => 'GMT', - 'startTime' => '0900', + 'startTime' => '0901', 'startDay' => "3" ]; $reportRequest = new CyberSource\Model\RequestBody($createReportRequestArr); - $api_response = list($response,$statusCode,$httpHeader)=null; + $requestArr = json_decode($reportRequest); + $requestBody = $apiclient->dataMasking(json_encode($requestArr, JSON_UNESCAPED_SLASHES)); + echo "The Request Payload : \n".$requestBody."\n\n"; + $api_response = list($response,$statusCode,$httpHeader)=null; try { + $api_response = $api_instance->createSubscription(null,$reportRequest); - echo "";print_r($api_response); + echo "The API Request Header: \n". json_encode($config->getRequestHeaders(), JSON_UNESCAPED_SLASHES)."\n\n"; + echo "The Api Response Body: \n"; print_r($api_response[0]);echo "\n\n"; + echo "The Api Response StatusCode: ".json_encode($api_response[1])."\n\n"; + echo "The Api Response Header: \n".json_encode($api_response[2], JSON_UNESCAPED_SLASHES)."\n"; } catch (Cybersource\ApiException $e) { - print_r($e->getResponseBody()); - print_r($e->getMessage()); + + echo "The API Request Header: \n". json_encode($config->getRequestHeaders(), JSON_UNESCAPED_SLASHES)."\n\n"; + echo "The Exception Response Body: \n"; + print_r($e->getResponseBody()); echo "\n\n"; + echo "The Exception Response Header: \n"; + print_r($e->getResponseHeaders()); echo "\n\n"; + echo "The Exception Response Header: \n"; + print_r($e->getMessage());echo "\n\n"; } } // Call Sample Code if(!defined('DO_NOT_RUN_SAMPLES')){ - echo "CreateReportSubscriptionForReportNameByOrganization Samplecode is Running.. \n"; + echo "[BEGIN] EXECUTION OF SAMPLE CODE: CreateReportSubscriptionForReportNameByOrganization \n\n"; CreateReportSubscriptionForReportNameByOrganization(); } diff --git a/Samples/Reporting/CoreServices/DeleteSubscriptionOfReportNameByOrganization.php b/Samples/Reporting/CoreServices/DeleteSubscriptionOfReportNameByOrganization.php index 2086924..3a0688e 100644 --- a/Samples/Reporting/CoreServices/DeleteSubscriptionOfReportNameByOrganization.php +++ b/Samples/Reporting/CoreServices/DeleteSubscriptionOfReportNameByOrganization.php @@ -8,20 +8,31 @@ function DeleteSubscriptionOfReportNameByOrganization($id) $config = $commonElement->ConnectionHost(); $apiclient = new CyberSource\ApiClient($config); $api_instance = new CyberSource\Api\ReportSubscriptionsApi($apiclient); - $api_response = list($response,$statusCode,$httpHeader)=null; + + $api_response = list($response,$statusCode,$httpHeader)=null; try { + $api_response = $api_instance->deleteSubscription($id); - echo "";print_r($api_response); + echo "The API Request Header: \n". json_encode($config->getRequestHeaders(), JSON_UNESCAPED_SLASHES)."\n\n"; + $resBodyArr= json_decode($api_response[0]); + echo "The Api Response Body: \n". json_encode($resBodyArr, JSON_UNESCAPED_SLASHES)."\n\n"; + echo "The Api Response StatusCode: ".json_encode($api_response[1])."\n\n"; + echo "The Api Response Header: \n".json_encode($api_response[2], JSON_UNESCAPED_SLASHES)."\n"; } catch (Cybersource\ApiException $e) { - print_r($e->getResponseBody()); - print_r($e->getMessage()); + echo "The API Request Header: \n". json_encode($config->getRequestHeaders(), JSON_UNESCAPED_SLASHES)."\n\n"; + echo "The Exception Response Body: \n"; + print_r($e->getResponseBody()); echo "\n\n"; + echo "The Exception Response Header: \n"; + print_r($e->getResponseHeaders()); echo "\n\n"; + echo "The Exception Response Header: \n"; + print_r($e->getMessage());echo "\n\n"; } } // Call Sample Code if(!defined('DO_NOT_RUN_SAMPLES')){ - echo "DeleteSubscriptionOfReportNameByOrganization Samplecode is Running.. \n"; + echo "[BEGIN] EXECUTION OF SAMPLE CODE: DeleteSubscriptionOfReportNameByOrganization \n\n"; DeleteSubscriptionOfReportNameByOrganization("testrests_subcription_v1"); } diff --git a/Samples/Reporting/CoreServices/DownloadReport.php b/Samples/Reporting/CoreServices/DownloadReport.php index b11fcb6..28b5f90 100644 --- a/Samples/Reporting/CoreServices/DownloadReport.php +++ b/Samples/Reporting/CoreServices/DownloadReport.php @@ -7,21 +7,29 @@ function DownloadReport() $commonElement = new CyberSource\ExternalConfiguration(); $config = $commonElement->ConnectionHost(); $apiclient = new CyberSource\ApiClient($config); - $api_instance = new CyberSource\Api\ReportDownloadsApi($apiclient); + $api_instance = new CyberSource\Api\ReportDownloadsApi($apiclient); - $api_response = list($response,$statusCode,$httpHeader)=null; + $api_response = list($response,$statusCode,$httpHeader)=null; $reportDate="2018-09-02"; $reportName="testrest v2"; try { $api_response = $api_instance->downloadReport($reportDate, $reportName, $organizationId = null); $downloadData = $api_response[0]; $filePath = $commonElement->downloadReport($downloadData, "DownloadReport.xml"); - print_r($api_response); + echo "The Api Response Body: \n"; + print_r($downloadData);echo "\n\n"; + echo "The Api Response StatusCode: ".json_encode($api_response[1])."\n\n"; + echo "The Api Response Header: \n".json_encode($api_response[2], JSON_UNESCAPED_SLASHES)."\n"; echo "File has been downloaded in the location: \n".$filePath."\n"; } catch (Cybersource\ApiException $e) { - print_r($e->getResponseBody()); - print_r($e->getMessage()); + echo "The API Request Header: \n". json_encode($config->getRequestHeaders(), JSON_UNESCAPED_SLASHES)."\n\n"; + echo "The Exception Response Body: \n"; + print_r($e->getResponseBody()); echo "\n\n"; + echo "The Exception Response Header: \n"; + print_r($e->getResponseHeaders()); echo "\n\n"; + echo "The Exception Response Header: \n"; + print_r($e->getMessage());echo "\n\n"; } } @@ -29,7 +37,7 @@ function DownloadReport() // Call Sample Code if(!defined('DO_NOT_RUN_SAMPLES')){ - echo "DownloadReport Samplecode is Running.. \n"; + echo "[BEGIN] EXECUTION OF SAMPLE CODE: DownloadReport \n\n"; DownloadReport(); } diff --git a/Samples/Reporting/CoreServices/GetAllSubscriptions.php b/Samples/Reporting/CoreServices/GetAllSubscriptions.php index 937e3cd..02b44b2 100644 --- a/Samples/Reporting/CoreServices/GetAllSubscriptions.php +++ b/Samples/Reporting/CoreServices/GetAllSubscriptions.php @@ -8,20 +8,29 @@ function GetAllSubscriptions() $config = $commonElement->ConnectionHost(); $apiclient = new CyberSource\ApiClient($config); $api_instance = new CyberSource\Api\ReportSubscriptionsApi($apiclient); - $api_response = list($response,$statusCode,$httpHeader)=null; + + $api_response = list($response,$statusCode,$httpHeader)=null; try { $api_response = $api_instance->getAllSubscriptions(); - echo "";print_r($api_response); + echo "The API Request Header: \n". json_encode($config->getRequestHeaders(), JSON_UNESCAPED_SLASHES)."\n\n"; + echo "The Api Response Body: \n"; print_r($api_response[0]);echo "\n\n"; + echo "The Api Response StatusCode: ".json_encode($api_response[1])."\n\n"; + echo "The Api Response Header: \n".json_encode($api_response[2], JSON_UNESCAPED_SLASHES)."\n"; } catch (Cybersource\ApiException $e) { - print_r($e->getResponseBody()); - print_r($e->getMessage()); + echo "The API Request Header: \n". json_encode($config->getRequestHeaders(), JSON_UNESCAPED_SLASHES)."\n\n"; + echo "The Exception Response Body: \n"; + print_r($e->getResponseBody()); echo "\n\n"; + echo "The Exception Response Header: \n"; + print_r($e->getResponseHeaders()); echo "\n\n"; + echo "The Exception Response Header: \n"; + print_r($e->getMessage());echo "\n\n"; } } // Call Sample Code if(!defined('DO_NOT_RUN_SAMPLES')){ - echo "GetAllSubscriptions Samplecode is Running.. \n"; + echo "[BEGIN] EXECUTION OF SAMPLE CODE: GetAllSubscriptions \n\n"; GetAllSubscriptions(); } diff --git a/Samples/Reporting/CoreServices/GetNotificationOfChanges.php b/Samples/Reporting/CoreServices/GetNotificationOfChanges.php index b8e5ddb..83204ef 100644 --- a/Samples/Reporting/CoreServices/GetNotificationOfChanges.php +++ b/Samples/Reporting/CoreServices/GetNotificationOfChanges.php @@ -8,22 +8,32 @@ function GetNotificationOfChanges() $config = $commonElement->ConnectionHost(); $apiclient = new CyberSource\ApiClient($config); $api_instance = new CyberSource\Api\NotificationOfChangesApi($apiclient); - $api_response = list($response,$statusCode,$httpHeader)=null; + + $api_response = list($response,$statusCode,$httpHeader)=null; try { $startTime='2018-05-01T12:00:00-05:00'; $endTime='2018-05-30T12:00:00-05:00'; $api_response = $api_instance->getNotificationOfChangeReport($startTime, $endTime); - echo "";print_r($api_response); + echo "The API Request Header: \n". json_encode($config->getRequestHeaders(), JSON_UNESCAPED_SLASHES)."\n\n"; + $resBodyArr= json_decode($api_response[0]); + echo "The Api Response Body: \n". json_encode($resBodyArr, JSON_UNESCAPED_SLASHES)."\n\n"; + echo "The Api Response StatusCode: ".json_encode($api_response[1])."\n\n"; + echo "The Api Response Header: \n".json_encode($api_response[2], JSON_UNESCAPED_SLASHES)."\n"; } catch (Cybersource\ApiException $e) { - print_r($e->getResponseBody()); - print_r($e->getMessage()); + echo "The API Request Header: \n". json_encode($config->getRequestHeaders(), JSON_UNESCAPED_SLASHES)."\n\n"; + echo "The Exception Response Body: \n"; + print_r($e->getResponseBody()); echo "\n\n"; + echo "The Exception Response Header: \n"; + print_r($e->getResponseHeaders()); echo "\n\n"; + echo "The Exception Response Header: \n"; + print_r($e->getMessage());echo "\n\n"; } } // Call Sample Code if(!defined('DO_NOT_RUN_SAMPLES')){ - echo "GetNotificationOfChanges Samplecode is Running.. \n"; + echo "[BEGIN] EXECUTION OF SAMPLE CODE: GetNotificationOfChanges \n\n"; GetNotificationOfChanges(); } diff --git a/Samples/Reporting/CoreServices/GetPurchaseAndRefundDetails.php b/Samples/Reporting/CoreServices/GetPurchaseAndRefundDetails.php index c8cfc60..6a9c850 100644 --- a/Samples/Reporting/CoreServices/GetPurchaseAndRefundDetails.php +++ b/Samples/Reporting/CoreServices/GetPurchaseAndRefundDetails.php @@ -8,23 +8,33 @@ function GetPurchaseAndRefundDetails() $config = $commonElement->ConnectionHost(); $apiclient = new CyberSource\ApiClient($config); $api_instance = new CyberSource\Api\PurchaseAndRefundDetailsApi($apiclient); - $api_response = list($response,$statusCode,$httpHeader)=null; + + $api_response = list($response,$statusCode,$httpHeader)=null; $startTime="2018-05-01T12:00:00-05:00"; $endTime="2018-05-30T12:00:00-05:00"; try { $api_response = $api_instance->getPurchaseAndRefundDetails($startTime, $endTime, $organizationId = null, $paymentSubtype = 'ALL', $viewBy = 'requestDate', $groupName = null, $offset = null, $limit = '2000'); - echo "";print_r($api_response); + echo "The API Request Header: \n". json_encode($config->getRequestHeaders(), JSON_UNESCAPED_SLASHES)."\n\n"; + $resBodyArr= json_decode($api_response[0]); + echo "The Api Response Body: \n". json_encode($resBodyArr, JSON_UNESCAPED_SLASHES)."\n\n"; + echo "The Api Response StatusCode: ".json_encode($api_response[1])."\n\n"; + echo "The Api Response Header: \n".json_encode($api_response[2], JSON_UNESCAPED_SLASHES)."\n"; } catch (Exception $e) { - print_r($e->getresponseBody()); - print_r($e->getmessage()); + echo "The API Request Header: \n". json_encode($config->getRequestHeaders(), JSON_UNESCAPED_SLASHES)."\n\n"; + echo "The Exception Response Body: \n"; + print_r($e->getResponseBody()); echo "\n\n"; + echo "The Exception Response Header: \n"; + print_r($e->getResponseHeaders()); echo "\n\n"; + echo "The Exception Response Header: \n"; + print_r($e->getMessage());echo "\n\n"; } } // Call Sample Code if(!defined('DO_NOT_RUN_SAMPLES')){ - echo "GetPurchaseAndRefundDetails Samplecode is Running.. \n"; + echo "[BEGIN] EXECUTION OF SAMPLE CODE: GetPurchaseAndRefundDetails \n\n"; GetPurchaseAndRefundDetails(); } diff --git a/Samples/Reporting/CoreServices/GetReportBasedOnReportid.php b/Samples/Reporting/CoreServices/GetReportBasedOnReportid.php index 1caead3..5f48435 100644 --- a/Samples/Reporting/CoreServices/GetReportBasedOnReportid.php +++ b/Samples/Reporting/CoreServices/GetReportBasedOnReportid.php @@ -9,20 +9,30 @@ function GetReportBasedOnReportid() $apiclient = new CyberSource\ApiClient($config); $api_instance = new CyberSource\Api\ReportsApi($apiclient); $reportId = "79642c43-2368-0cd5-e053-a2588e0a7b3c"; - $api_response = list($response,$statusCode,$httpHeader)=null; + + $api_response = list($response,$statusCode,$httpHeader)=null; try { $api_response = $api_instance->getReportByReportId($reportId); - echo "";print_r($api_response); + echo "The API Request Header: \n". json_encode($config->getRequestHeaders(), JSON_UNESCAPED_SLASHES)."\n\n"; + $resBodyArr= json_decode($api_response[0]); + echo "The Api Response Body: \n". json_encode($resBodyArr, JSON_UNESCAPED_SLASHES)."\n\n"; + echo "The Api Response StatusCode: ".json_encode($api_response[1])."\n\n"; + echo "The Api Response Header: \n".json_encode($api_response[2], JSON_UNESCAPED_SLASHES)."\n"; } catch (Cybersource\ApiException $e) { - print_r($e->getResponseBody()); - print_r($e->getMessage()); + echo "The API Request Header: \n". json_encode($config->getRequestHeaders(), JSON_UNESCAPED_SLASHES)."\n\n"; + echo "The Exception Response Body: \n"; + print_r($e->getResponseBody()); echo "\n\n"; + echo "The Exception Response Header: \n"; + print_r($e->getResponseHeaders()); echo "\n\n"; + echo "The Exception Response Header: \n"; + print_r($e->getMessage());echo "\n\n"; } } // Call Sample Code if(!defined('DO_NOT_RUN_SAMPLES')){ - echo "GetReportBasedOnReportid Samplecode is Running.. \n"; + echo "[BEGIN] EXECUTION OF SAMPLE CODE: GetReportBasedOnReportid \n\n"; GetReportBasedOnReportid(); } diff --git a/Samples/Reporting/CoreServices/GetReportDefinition.php b/Samples/Reporting/CoreServices/GetReportDefinition.php index 597938b..c39577d 100644 --- a/Samples/Reporting/CoreServices/GetReportDefinition.php +++ b/Samples/Reporting/CoreServices/GetReportDefinition.php @@ -9,20 +9,30 @@ function GetReportDefinition() $apiclient = new CyberSource\ApiClient($config); $api_instance = new CyberSource\Api\ReportDefinitionsApi($apiclient); $reportDefinitionName = "AcquirerExceptionDetailClass"; - $api_response = list($response,$statusCode,$httpHeader)=null; + + $api_response = list($response,$statusCode,$httpHeader)=null; try { $api_response = $api_instance->getResourceInfoByReportDefinition($reportDefinitionName, $organizationId = null); - echo "";print_r($api_response); + echo "The API Request Header: \n". json_encode($config->getRequestHeaders(), JSON_UNESCAPED_SLASHES)."\n\n"; + $resBodyArr= json_decode($api_response[0]); + echo "The Api Response Body: \n". json_encode($resBodyArr, JSON_UNESCAPED_SLASHES)."\n\n"; + echo "The Api Response StatusCode: ".json_encode($api_response[1])."\n\n"; + echo "The Api Response Header: \n".json_encode($api_response[2], JSON_UNESCAPED_SLASHES)."\n"; } catch (Exception $e) { - print_r($e->getresponseBody()); - print_r($e->getmessage()); + echo "The API Request Header: \n". json_encode($config->getRequestHeaders(), JSON_UNESCAPED_SLASHES)."\n\n"; + echo "The Exception Response Body: \n"; + print_r($e->getResponseBody()); echo "\n\n"; + echo "The Exception Response Header: \n"; + print_r($e->getResponseHeaders()); echo "\n\n"; + echo "The Exception Response Header: \n"; + print_r($e->getMessage());echo "\n\n"; } } // Call Sample Code if(!defined('DO_NOT_RUN_SAMPLES')){ - echo "GetReportDefinition Samplecode is Running.. \n"; + echo "[BEGIN] EXECUTION OF SAMPLE CODE: GetReportDefinition \n\n"; GetReportDefinition(); } diff --git a/Samples/Reporting/CoreServices/GetReportingResourceInformation.php b/Samples/Reporting/CoreServices/GetReportingResourceInformation.php index d81467a..3d945fc 100644 --- a/Samples/Reporting/CoreServices/GetReportingResourceInformation.php +++ b/Samples/Reporting/CoreServices/GetReportingResourceInformation.php @@ -8,20 +8,30 @@ function GetReportingResourceInformation() $config = $commonElement->ConnectionHost(); $apiclient = new CyberSource\ApiClient($config); $api_instance = new CyberSource\Api\ReportDefinitionsApi($apiclient); - $api_response = list($response,$statusCode,$httpHeader)=null; + + $api_response = list($response,$statusCode,$httpHeader)=null; try { $api_response = $api_instance->getResourceV2Info(); - echo "";print_r($api_response); + echo "The API Request Header: \n". json_encode($config->getRequestHeaders(), JSON_UNESCAPED_SLASHES)."\n\n"; + $resBodyArr= json_decode($api_response[0]); + echo "The Api Response Body: \n". json_encode($resBodyArr, JSON_UNESCAPED_SLASHES)."\n\n"; + echo "The Api Response StatusCode: ".json_encode($api_response[1])."\n\n"; + echo "The Api Response Header: \n".json_encode($api_response[2], JSON_UNESCAPED_SLASHES)."\n"; } catch (Cybersource\ApiException $e) { - print_r($e->getResponseBody()); - print_r($e->getMessage()); + echo "The API Request Header: \n". json_encode($config->getRequestHeaders(), JSON_UNESCAPED_SLASHES)."\n\n"; + echo "The Exception Response Body: \n"; + print_r($e->getResponseBody()); echo "\n\n"; + echo "The Exception Response Header: \n"; + print_r($e->getResponseHeaders()); echo "\n\n"; + echo "The Exception Response Header: \n"; + print_r($e->getMessage());echo "\n\n"; } } // Call Sample Code if(!defined('DO_NOT_RUN_SAMPLES')){ - echo "GetReportingResourceInformation Samplecode is Running.. \n"; + echo "[BEGIN] EXECUTION OF SAMPLE CODE: GetReportingResourceInformation \n\n"; GetReportingResourceInformation(); } diff --git a/Samples/Reporting/CoreServices/GetSubscriptionForReportName.php b/Samples/Reporting/CoreServices/GetSubscriptionForReportName.php index 72ee388..85d5ea0 100644 --- a/Samples/Reporting/CoreServices/GetSubscriptionForReportName.php +++ b/Samples/Reporting/CoreServices/GetSubscriptionForReportName.php @@ -9,20 +9,30 @@ function GetSubscriptionForReportName() $apiclient = new CyberSource\ApiClient($config); $api_instance = new CyberSource\Api\ReportSubscriptionsApi($apiclient); $reportName = "testv2_subscriprion"; - $api_response = list($response,$statusCode,$httpHeader)=null; + + $api_response = list($response,$statusCode,$httpHeader)=null; try { $api_response = $api_instance->getSubscription($reportName); - echo "";print_r($api_response); + echo "The API Request Header: \n". json_encode($config->getRequestHeaders(), JSON_UNESCAPED_SLASHES)."\n\n"; + $resBodyArr= json_decode($api_response[0]); + echo "The Api Response Body: \n". json_encode($resBodyArr, JSON_UNESCAPED_SLASHES)."\n\n"; + echo "The Api Response StatusCode: ".json_encode($api_response[1])."\n\n"; + echo "The Api Response Header: \n".json_encode($api_response[2], JSON_UNESCAPED_SLASHES)."\n"; } catch (Cybersource\ApiException $e) { - print_r($e->getResponseBody()); - print_r($e->getMessage()); + echo "The API Request Header: \n". json_encode($config->getRequestHeaders(), JSON_UNESCAPED_SLASHES)."\n\n"; + echo "The Exception Response Body: \n"; + print_r($e->getResponseBody()); echo "\n\n"; + echo "The Exception Response Header: \n"; + print_r($e->getResponseHeaders()); echo "\n\n"; + echo "The Exception Response Header: \n"; + print_r($e->getMessage());echo "\n\n"; } } // Call Sample Code if(!defined('DO_NOT_RUN_SAMPLES')){ - echo "GetSubscriptionForReportName Samplecode is Running.. \n"; + echo "[BEGIN] EXECUTION OF SAMPLE CODE: GetSubscriptionForReportName \n\n"; GetSubscriptionForReportName(); } diff --git a/Samples/Reporting/CoreServices/RetrieveAvailableReports.php b/Samples/Reporting/CoreServices/RetrieveAvailableReports.php index 8fd547f..f2949ea 100644 --- a/Samples/Reporting/CoreServices/RetrieveAvailableReports.php +++ b/Samples/Reporting/CoreServices/RetrieveAvailableReports.php @@ -12,20 +12,29 @@ function RetrieveAvailableReports() $endTime="2018-10-30T23:59:59.0Z"; $timeQueryType="executedTime"; - $api_response = list($response,$statusCode,$httpHeader)=null; + + $api_response = list($response,$statusCode,$httpHeader)=null; try { $api_response = $api_instance->searchReports($startTime, $endTime, $timeQueryType); - echo "";print_r($api_response); + echo "The API Request Header: \n". json_encode($config->getRequestHeaders(), JSON_UNESCAPED_SLASHES)."\n\n"; + echo "The Api Response Body: \n"; print_r($api_response[0]);echo "\n\n"; + echo "The Api Response StatusCode: ".json_encode($api_response[1])."\n\n"; + echo "The Api Response Header: \n".json_encode($api_response[2], JSON_UNESCAPED_SLASHES)."\n"; } catch (Cybersource\ApiException $e) { - print_r($e->getResponseBody()); - print_r($e->getMessage()); + echo "The API Request Header: \n". json_encode($config->getRequestHeaders(), JSON_UNESCAPED_SLASHES)."\n\n"; + echo "The Exception Response Body: \n"; + print_r($e->getResponseBody()); echo "\n\n"; + echo "The Exception Response Header: \n"; + print_r($e->getResponseHeaders()); echo "\n\n"; + echo "The Exception Response Header: \n"; + print_r($e->getMessage());echo "\n\n"; } } // Call Sample Code if(!defined('DO_NOT_RUN_SAMPLES')){ - echo "RetrieveAvailableReports Samplecode is Running.. \n"; + echo "[BEGIN] EXECUTION OF SAMPLE CODE: RetrieveAvailableReports \n\n"; RetrieveAvailableReports(); } diff --git a/Samples/SecureFileShare/CoreServices/DownloadFileWithFileIdentifier.php b/Samples/SecureFileShare/CoreServices/DownloadFileWithFileIdentifier.php index be3e187..0afffc0 100644 --- a/Samples/SecureFileShare/CoreServices/DownloadFileWithFileIdentifier.php +++ b/Samples/SecureFileShare/CoreServices/DownloadFileWithFileIdentifier.php @@ -9,25 +9,34 @@ function DownloadFileWithFileIdentifier() $apiclient = new CyberSource\ApiClient($config); $api_instance = new CyberSource\Api\SecureFileShareApi($apiclient); $fileId = "RGVtb19SZXBvcnQtNzg1NWQxM2YtOTM5Ny01MTEzLWUwNTMtYTI1ODhlMGE3MTkyLnhtbC0yMDE4LTEwLTIw"; - - $api_response = list($response,$statusCode,$httpHeader)=null; + + $api_response = list($response,$statusCode,$httpHeader)=null; try { $api_response = $api_instance->getFile($fileId, $organizationId = "testrest"); $downloadData = $api_response[0]; + echo "The API Request Header: \n". json_encode($config->getRequestHeaders(), JSON_UNESCAPED_SLASHES)."\n\n"; + echo "The Api Response Body: \n";print_r($downloadData);echo "\n\n"; + echo "The Api Response StatusCode: ".json_encode($api_response[1])."\n\n"; + echo "The Api Response Header: \n".json_encode($api_response[2], JSON_UNESCAPED_SLASHES)."\n"; $filePath = $commonElement->downloadReport($downloadData, "DownloadFileWithFileIdentifier.csv"); - print_r($api_response); + echo "File has been downloaded in the location: \n".$filePath."\n"; } catch (Cybersource\ApiException $e) { - print_r($e); - print_r($e->getMessage()); + echo "The API Request Header: \n". json_encode($config->getRequestHeaders(), JSON_UNESCAPED_SLASHES)."\n\n"; + echo "The Exception Response Body: \n"; + print_r($e->getResponseBody()); echo "\n\n"; + echo "The Exception Response Header: \n"; + print_r($e->getResponseHeaders()); echo "\n\n"; + echo "The Exception Response Header: \n"; + print_r($e->getMessage());echo "\n\n"; } } // Call Sample Code if(!defined('DO_NOT_RUN_SAMPLES')){ - echo "DownloadFileWithFileIdentifier Samplecode is Running.. \n"; + echo "[BEGIN] EXECUTION OF SAMPLE CODE: DownloadFileWithFileIdentifier \n\n"; DownloadFileWithFileIdentifier(); } diff --git a/Samples/SecureFileShare/CoreServices/GetListOfFiles.php b/Samples/SecureFileShare/CoreServices/GetListOfFiles.php index 6fae8ba..6dd43d8 100644 --- a/Samples/SecureFileShare/CoreServices/GetListOfFiles.php +++ b/Samples/SecureFileShare/CoreServices/GetListOfFiles.php @@ -10,22 +10,28 @@ function GetListOfFiles() $api_instance = new CyberSource\Api\SecureFileShareApi($apiclient); $startDate = "2018-10-20"; $endDate = "2018-10-30"; - - - $api_response = list($response,$statusCode,$httpHeader)=null; + $api_response = list($response,$statusCode,$httpHeader)=null; try { $api_response = $api_instance->getFileDetails($startDate, $endDate, $organizationId = "testrest"); - echo "";print_r($api_response); + echo "The API Request Header: \n". json_encode($config->getRequestHeaders(), JSON_UNESCAPED_SLASHES)."\n\n"; + echo "The Api Response Body: \n"; print_r($api_response[0]);echo "\n\n"; + echo "The Api Response StatusCode: ".json_encode($api_response[1])."\n\n"; + echo "The Api Response Header: \n".json_encode($api_response[2], JSON_UNESCAPED_SLASHES)."\n"; } catch (Cybersource\ApiException $e) { - print_r($e->getResponseBody()); - print_r($e->getMessage()); + echo "The API Request Header: \n". json_encode($config->getRequestHeaders(), JSON_UNESCAPED_SLASHES)."\n\n"; + echo "The Exception Response Body: \n"; + print_r($e->getResponseBody()); echo "\n\n"; + echo "The Exception Response Header: \n"; + print_r($e->getResponseHeaders()); echo "\n\n"; + echo "The Exception Response Header: \n"; + print_r($e->getMessage());echo "\n\n"; } } // Call Sample Code if(!defined('DO_NOT_RUN_SAMPLES')){ - echo "GetListOfFiles Samplecode is Running.. \n"; - GetListOfFiles(); + echo "[BEGIN] EXECUTION OF SAMPLE CODE: GetListOfFiles \n\n"; + GetListOfFiles(); } ?> \ No newline at end of file diff --git a/Samples/TMS/CoreServices/CreateInstrumentIdentifier.php b/Samples/TMS/CoreServices/CreateInstrumentIdentifier.php index 4c15ea8..6c26682 100644 --- a/Samples/TMS/CoreServices/CreateInstrumentIdentifier.php +++ b/Samples/TMS/CoreServices/CreateInstrumentIdentifier.php @@ -14,26 +14,26 @@ function CreateInstrumentIdentifier($flag) ]; $card = new CyberSource\Model\Tmsv1instrumentidentifiersCard($tmsCardInfo); $merchantInitiatedTransactionArr = [ - "previousTransactionId" => "123456789012345" + "previousTransactionId" => "123456789012345" ]; - $merchantInitiatedTransaction = new CyberSource\Model\Tmsv1InitiatorMerchantInitiatedTransaction($merchantInitiatedTransactionArr); + $merchantInitiatedTransaction = new CyberSource\Model\Tmsv1instrumentidentifiersMerchantInitiatedTransaction($merchantInitiatedTransactionArr); $initiatorInfoArr = [ - "merchantInitiatedTransaction" => $merchantInitiatedTransaction + "merchantInitiatedTransaction" => $merchantInitiatedTransaction ]; $initiatorInformation = new CyberSource\Model\Tmsv1instrumentidentifiersProcessingInformationAuthorizationOptionsInitiator($initiatorInfoArr); $authorizationOptionsArr = [ - 'initiator' => $initiatorInformation + 'initiator' => $initiatorInformation ]; $authorizationOptions = new CyberSource\Model\Tmsv1instrumentidentifiersProcessingInformationAuthorizationOptions( $authorizationOptionsArr); $processingInformationArr = [ - "authorizationOptions" => $authorizationOptions + "authorizationOptions" => $authorizationOptions ]; $processingInformation = new CyberSource\Model\Tmsv1instrumentidentifiersProcessingInformation($processingInformationArr); @@ -44,27 +44,41 @@ function CreateInstrumentIdentifier($flag) ]; $tmsRequest = new CyberSource\Model\Body($tmsRequestArr); + $requestArr = json_decode($tmsRequest); + $requestBody = $apiclient->dataMasking(json_encode($requestArr, JSON_UNESCAPED_SLASHES)); + echo "The Request Payload : \n".$requestBody."\n\n"; $profileId = '93B32398-AD51-4CC2-A682-EA3E93614EB1'; - $api_response = list($response,$statusCode,$httpHeader)=null; + + $api_response = list($response,$statusCode,$httpHeader)=null; try { $api_response = $api_instance->tmsV1InstrumentidentifiersPost($profileId, $tmsRequest); + if($flag == true){ //Returning the ID - echo "Fetching CreateInstrumentIdentifier ID: ".$api_response[0]['id']."\n"; + echo "Fetching CreateInstrumentIdentifier ID: ".$api_response[0]['id']."\n"; return $api_response[0]['id']; }else{ - print_r($api_response); + echo "The API Request Header: \n". json_encode($config->getRequestHeaders(), JSON_UNESCAPED_SLASHES)."\n\n"; + echo "The Api Response Body: \n"; print_r($api_response[0]);echo "\n\n"; + echo "The Api Response StatusCode: ".json_encode($api_response[1])."\n\n"; + echo "The Api Response Header: \n".json_encode($api_response[2], JSON_UNESCAPED_SLASHES)."\n"; } } catch (Cybersource\ApiException $e) { - print_r($e->getResponseBody()); - print_r($e->getMessage()); + + echo "The API Request Header: \n". json_encode($config->getRequestHeaders(), JSON_UNESCAPED_SLASHES)."\n\n"; + echo "The Exception Response Body: \n"; + print_r($e->getResponseBody()); echo "\n\n"; + echo "The Exception Response Header: \n"; + print_r($e->getResponseHeaders()); echo "\n\n"; + echo "The Exception Response Header: \n"; + print_r($e->getMessage());echo "\n\n"; } } // Call Sample Code if(!defined('DO_NOT_RUN_SAMPLES')){ - echo "CreateInstrumentIdentifier Samplecode is Running.. \n"; + echo "[BEGIN] EXECUTION OF SAMPLE CODE: CreateInstrumentIdentifier \n\n"; CreateInstrumentIdentifier(false); } diff --git a/Samples/TMS/CoreServices/CreatePaymentInstrument.php b/Samples/TMS/CoreServices/CreatePaymentInstrument.php index 0b33525..1ae380a 100644 --- a/Samples/TMS/CoreServices/CreatePaymentInstrument.php +++ b/Samples/TMS/CoreServices/CreatePaymentInstrument.php @@ -47,28 +47,41 @@ function CreatePaymentInstrument($flag) "instrumentIdentifier" => $instrumentidentifier ]; $tmsRequest = new CyberSource\Model\Body2($tmsRequestArr); + $requestArr = json_decode($tmsRequest); + $requestBody = $apiclient->dataMasking(json_encode($requestArr, JSON_UNESCAPED_SLASHES)); + echo "The Request Payload : \n".$requestBody."\n\n"; $profileId = '93B32398-AD51-4CC2-A682-EA3E93614EB1'; - $api_response = list($response,$statusCode,$httpHeader)=null; + + $api_response = list($response,$statusCode,$httpHeader)=null; try { + $api_response = $api_instance->tmsV1PaymentinstrumentsPost($profileId, $tmsRequest); if($flag == true){ //Returning the ID - - echo "Fetching CreatePaymentInstrument ID: ".$api_response[0]->id."\n"; - return $api_response[0]->id; + echo "Fetching CreatePaymentInstrument ID: ".$api_response[0]["id"]."\n"; + return $api_response[0]["id"]; }else{ - print_r($api_response); + echo "The API Request Header: \n". json_encode($config->getRequestHeaders(), JSON_UNESCAPED_SLASHES)."\n\n"; + echo "The Api Response Body: \n"; print_r($api_response[0]);echo "\n\n"; + echo "The Api Response StatusCode: ".json_encode($api_response[1])."\n\n"; + echo "The Api Response Header: \n".json_encode($api_response[2], JSON_UNESCAPED_SLASHES)."\n"; } } catch (Cybersource\ApiException $e) { - print_r($e->getResponseBody()); - print_r($e->getMessage()); + + echo "The API Request Header: \n". json_encode($config->getRequestHeaders(), JSON_UNESCAPED_SLASHES)."\n\n"; + echo "The Exception Response Body: \n"; + print_r($e->getResponseBody()); echo "\n\n"; + echo "The Exception Response Header: \n"; + print_r($e->getResponseHeaders()); echo "\n\n"; + echo "The Exception Response Header: \n"; + print_r($e->getMessage());echo "\n\n"; } } // Call Sample Code if(!defined('DO_NOT_RUN_SAMPLES')){ - echo "CreatePaymentInstrument Samplecode is Running.. \n"; + echo "[BEGIN] EXECUTION OF SAMPLE CODE: CreatePaymentInstrument \n\n"; CreatePaymentInstrument(false); } diff --git a/Samples/TMS/CoreServices/DeleteInstrumentIdentifier.php b/Samples/TMS/CoreServices/DeleteInstrumentIdentifier.php index ec3079f..9074314 100644 --- a/Samples/TMS/CoreServices/DeleteInstrumentIdentifier.php +++ b/Samples/TMS/CoreServices/DeleteInstrumentIdentifier.php @@ -11,19 +11,30 @@ function DeleteInstrumentIdentifier() $profileId = '93B32398-AD51-4CC2-A682-EA3E93614EB1'; require_once __DIR__. DIRECTORY_SEPARATOR .'RetrieveInstrumentIdentifier.php'; $tokenId = RetrieveInstrumentIdentifier(true); - $api_response = list($response,$statusCode,$httpHeader)=null; + + $api_response = list($response,$statusCode,$httpHeader)=null; try { $api_response = $api_instance->tmsV1InstrumentidentifiersTokenIdDelete($profileId, $tokenId); - echo "";print_r($api_response); + echo "The API Request Header: \n". json_encode($config->getRequestHeaders(), JSON_UNESCAPED_SLASHES)."\n\n"; + $resBodyArr= json_decode($api_response[0]); + echo "The Api Response Body: \n". json_encode($resBodyArr, JSON_UNESCAPED_SLASHES)."\n\n"; + echo "The Api Response StatusCode: ".json_encode($api_response[1])."\n\n"; + echo "The Api Response Header: \n".json_encode($api_response[2], JSON_UNESCAPED_SLASHES)."\n"; } catch (Cybersource\ApiException $e) { - print_r($e->getResponseBody()); - print_r($e->getMessage()); + + echo "The API Request Header: \n". json_encode($config->getRequestHeaders(), JSON_UNESCAPED_SLASHES)."\n\n"; + echo "The Exception Response Body: \n"; + print_r($e->getResponseBody()); echo "\n\n"; + echo "The Exception Response Header: \n"; + print_r($e->getResponseHeaders()); echo "\n\n"; + echo "The Exception Response Header: \n"; + print_r($e->getMessage());echo "\n\n"; } } // Call Sample Code if(!defined('DO_NOT_RUN_SAMPLES')){ - echo "DeleteInstrumentIdentifier Samplecode is Running.. \n"; + echo "[BEGIN] EXECUTION OF SAMPLE CODE: DeleteInstrumentIdentifier \n\n"; DeleteInstrumentIdentifier(); } diff --git a/Samples/TMS/CoreServices/DeletePaymentInstrument.php b/Samples/TMS/CoreServices/DeletePaymentInstrument.php index 4f55867..82094fc 100644 --- a/Samples/TMS/CoreServices/DeletePaymentInstrument.php +++ b/Samples/TMS/CoreServices/DeletePaymentInstrument.php @@ -11,20 +11,31 @@ function DeletePaymentsInstruments() require_once __DIR__. DIRECTORY_SEPARATOR .'RetrievePaymentInstrument.php'; $tokenId = RetrievePaymentInstrument(true); $profileId = '93B32398-AD51-4CC2-A682-EA3E93614EB1'; - $api_response = list($response,$statusCode,$httpHeader)=null; + + $api_response = list($response,$statusCode,$httpHeader)=null; try { $api_response = $api_instance->tmsV1PaymentinstrumentsTokenIdDelete($profileId, $tokenId); - echo "";print_r($api_response); + echo "The API Request Header: \n". json_encode($config->getRequestHeaders(), JSON_UNESCAPED_SLASHES)."\n\n"; + $resBodyArr= json_decode($api_response[0]); + echo "The Api Response Body: \n". json_encode($resBodyArr, JSON_UNESCAPED_SLASHES)."\n\n"; + echo "The Api Response StatusCode: ".json_encode($api_response[1])."\n\n"; + echo "The Api Response Header: \n".json_encode($api_response[2], JSON_UNESCAPED_SLASHES)."\n"; } catch (Cybersource\ApiException $e) { - print_r($e->getResponseBody()); - print_r($e->getMessage()); + + echo "The API Request Header: \n". json_encode($config->getRequestHeaders(), JSON_UNESCAPED_SLASHES)."\n\n"; + echo "The Exception Response Body: \n"; + print_r($e->getResponseBody()); echo "\n\n"; + echo "The Exception Response Header: \n"; + print_r($e->getResponseHeaders()); echo "\n\n"; + echo "The Exception Response Header: \n"; + print_r($e->getMessage());echo "\n\n"; } } // Call Sample Code if(!defined('DO_NOT_RUN_SAMPLES')){ - echo "DeletePaymentsInstruments Samplecode is Running.. \n"; + echo "[BEGIN] EXECUTION OF SAMPLE CODE: DeletePaymentsInstruments \n\n"; DeletePaymentsInstruments(); } diff --git a/Samples/TMS/CoreServices/RetrieveAllPaymentInstruments.php b/Samples/TMS/CoreServices/RetrieveAllPaymentInstruments.php index 9697cf4..ee472f7 100644 --- a/Samples/TMS/CoreServices/RetrieveAllPaymentInstruments.php +++ b/Samples/TMS/CoreServices/RetrieveAllPaymentInstruments.php @@ -10,20 +10,29 @@ function RetrieveAllPaymentInstruments() $api_instance = new CyberSource\Api\PaymentInstrumentsApi($apiclient); $profileId = '93B32398-AD51-4CC2-A682-EA3E93614EB1'; $tokenId = "7020000000000137654"; - $api_response = list($response,$statusCode,$httpHeader)=null; + + $api_response = list($response,$statusCode,$httpHeader)=null; try { $api_response = $api_instance->tmsV1InstrumentidentifiersTokenIdPaymentinstrumentsGet($profileId, $tokenId); - echo "";print_r($api_response); + echo "The API Request Header: \n". json_encode($config->getRequestHeaders(), JSON_UNESCAPED_SLASHES)."\n\n"; + echo "The Api Response Body: \n"; print_r($api_response[0]);echo "\n\n"; + echo "The Api Response StatusCode: ".json_encode($api_response[1])."\n\n"; + echo "The Api Response Header: \n".json_encode($api_response[2], JSON_UNESCAPED_SLASHES)."\n"; } catch (Cybersource\ApiException $e) { - print_r($e->getResponseBody()); - print_r($e->getMessage()); + echo "The API Request Header: \n". json_encode($config->getRequestHeaders(), JSON_UNESCAPED_SLASHES)."\n\n"; + echo "The Exception Response Body: \n"; + print_r($e->getResponseBody()); echo "\n\n"; + echo "The Exception Response Header: \n"; + print_r($e->getResponseHeaders()); echo "\n\n"; + echo "The Exception Response Header: \n"; + print_r($e->getMessage());echo "\n\n"; } } // Call Sample Code if(!defined('DO_NOT_RUN_SAMPLES')){ - echo "RetrieveAllPaymentInstruments Samplecode is Running.. \n"; + echo "[BEGIN] EXECUTION OF SAMPLE CODE: RetrieveAllPaymentInstruments \n\n"; RetrieveAllPaymentInstruments(); } diff --git a/Samples/TMS/CoreServices/RetrieveInstrumentIdentifier.php b/Samples/TMS/CoreServices/RetrieveInstrumentIdentifier.php index 396f7dc..b1f00cf 100644 --- a/Samples/TMS/CoreServices/RetrieveInstrumentIdentifier.php +++ b/Samples/TMS/CoreServices/RetrieveInstrumentIdentifier.php @@ -11,7 +11,8 @@ function RetrieveInstrumentIdentifier($flag) $profileId = '93B32398-AD51-4CC2-A682-EA3E93614EB1'; require_once __DIR__. DIRECTORY_SEPARATOR .'CreateInstrumentIdentifier.php'; $tokenId = CreateInstrumentIdentifier(true); - $api_response = list($response,$statusCode,$httpHeader)=null; + + $api_response = list($response,$statusCode,$httpHeader)=null; try { $api_response = $api_instance->tmsV1InstrumentidentifiersTokenIdGet($profileId, $tokenId); if($flag == true){ @@ -19,18 +20,26 @@ function RetrieveInstrumentIdentifier($flag) echo "Fetching RetrieveInstrumentIdentifier ID: ".$api_response[0]['id']."\n"; return $api_response[0]['id']; }else{ - print_r($api_response); + echo "The API Request Header: \n". json_encode($config->getRequestHeaders(), JSON_UNESCAPED_SLASHES)."\n\n"; + echo "The Api Response Body: \n"; print_r($api_response[0]);echo "\n\n"; + echo "The Api Response StatusCode: ".json_encode($api_response[1])."\n\n"; + echo "The Api Response Header: \n".json_encode($api_response[2], JSON_UNESCAPED_SLASHES)."\n"; } } catch (Cybersource\ApiException $e) { - print_r($e->getResponseBody()); - print_r($e->getMessage()); + echo "The API Request Header: \n". json_encode($config->getRequestHeaders(), JSON_UNESCAPED_SLASHES)."\n\n"; + echo "The Exception Response Body: \n"; + print_r($e->getResponseBody()); echo "\n\n"; + echo "The Exception Response Header: \n"; + print_r($e->getResponseHeaders()); echo "\n\n"; + echo "The Exception Response Header: \n"; + print_r($e->getMessage());echo "\n\n"; } } // Call Sample Code if(!defined('DO_NOT_RUN_SAMPLES')){ - echo "RetrieveInstrumentIdentifier Samplecode is Running.. \n"; + echo "[BEGIN] EXECUTION OF SAMPLE CODE: RetrieveInstrumentIdentifier \n\n"; RetrieveInstrumentIdentifier(false); } diff --git a/Samples/TMS/CoreServices/RetrievePaymentInstrument.php b/Samples/TMS/CoreServices/RetrievePaymentInstrument.php index af3a6ae..3021452 100644 --- a/Samples/TMS/CoreServices/RetrievePaymentInstrument.php +++ b/Samples/TMS/CoreServices/RetrievePaymentInstrument.php @@ -11,7 +11,8 @@ function RetrievePaymentInstrument($flag) require_once __DIR__. DIRECTORY_SEPARATOR .'CreatePaymentInstrument.php'; $tokenId = CreatePaymentInstrument(true); $profileId = '93B32398-AD51-4CC2-A682-EA3E93614EB1'; - $api_response = list($response,$statusCode,$httpHeader)=null; + + $api_response = list($response,$statusCode,$httpHeader)=null; try { $api_response = $api_instance->tmsV1PaymentinstrumentsTokenIdGet($profileId, $tokenId); if($flag == true){ @@ -19,18 +20,26 @@ function RetrievePaymentInstrument($flag) echo "Fetching RetrievePaymentInstrument ID: ".$api_response[0]->id."\n"; return $api_response[0]->id; }else{ - print_r($api_response); + echo "The API Request Header: \n". json_encode($config->getRequestHeaders(), JSON_UNESCAPED_SLASHES)."\n\n"; + echo "The Api Response Body: \n"; print_r($api_response[0]);echo "\n\n"; + echo "The Api Response StatusCode: ".json_encode($api_response[1])."\n\n"; + echo "The Api Response Header: \n".json_encode($api_response[2], JSON_UNESCAPED_SLASHES)."\n"; } } catch (Cybersource\ApiException $e) { - print_r($e->getResponseBody()); - print_r($e->getMessage()); + echo "The API Request Header: \n". json_encode($config->getRequestHeaders(), JSON_UNESCAPED_SLASHES)."\n\n"; + echo "The Exception Response Body: \n"; + print_r($e->getResponseBody()); echo "\n\n"; + echo "The Exception Response Header: \n"; + print_r($e->getResponseHeaders()); echo "\n\n"; + echo "The Exception Response Header: \n"; + print_r($e->getMessage());echo "\n\n"; } } // Call Sample Code if(!defined('DO_NOT_RUN_SAMPLES')){ - echo "RetrievePaymentInstrument Samplecode is Running.. \n"; + echo "[BEGIN] EXECUTION OF SAMPLE CODE: RetrievePaymentInstrument \n\n"; RetrievePaymentInstrument(false); } diff --git a/Samples/TMS/CoreServices/UpdateInstrumentIdentifier.php b/Samples/TMS/CoreServices/UpdateInstrumentIdentifier.php index 5568f28..dd95e88 100644 --- a/Samples/TMS/CoreServices/UpdateInstrumentIdentifier.php +++ b/Samples/TMS/CoreServices/UpdateInstrumentIdentifier.php @@ -43,23 +43,37 @@ function UpdateInstrumentIdentifier() ]; $tmsRequest = new CyberSource\Model\Body($tmsRequestArr); + $requestArr = json_decode($tmsRequest); + $requestBody = $apiclient->dataMasking(json_encode($requestArr, JSON_UNESCAPED_SLASHES)); + echo "The Request Payload : \n".$requestBody."\n\n"; require_once __DIR__. DIRECTORY_SEPARATOR .'RetrieveInstrumentIdentifier.php'; $tokenId = RetrieveInstrumentIdentifier(true); $profileId = '93B32398-AD51-4CC2-A682-EA3E93614EB1'; - $api_response = list($response,$statusCode,$httpHeader)=null; + + $api_response = list($response,$statusCode,$httpHeader)=null; try { + $api_response = $api_instance->tmsV1InstrumentidentifiersTokenIdPatch($profileId, $tokenId, $tmsRequest); - echo "";print_r($api_response); + echo "The API Request Header: \n". json_encode($config->getRequestHeaders(), JSON_UNESCAPED_SLASHES)."\n\n"; + echo "The Api Response Body: \n"; print_r($api_response[0]);echo "\n\n"; + echo "The Api Response StatusCode: ".json_encode($api_response[1])."\n\n"; + echo "The Api Response Header: \n".json_encode($api_response[2], JSON_UNESCAPED_SLASHES)."\n"; } catch (Cybersource\ApiException $e) { - print_r($e->getResponseBody()); - print_r($e->getMessage()); + + echo "The API Request Header: \n". json_encode($config->getRequestHeaders(), JSON_UNESCAPED_SLASHES)."\n\n"; + echo "The Exception Response Body: \n"; + print_r($e->getResponseBody()); echo "\n\n"; + echo "The Exception Response Header: \n"; + print_r($e->getResponseHeaders()); echo "\n\n"; + echo "The Exception Response Header: \n"; + print_r($e->getMessage());echo "\n\n"; } } // Call Sample Code if(!defined('DO NOT RUN SAMPLE')){ - echo "UpdateInstrumentIdentifier Samplecode is Running.. \n"; + echo "[BEGIN] EXECUTION OF SAMPLE CODE: UpdateInstrumentIdentifier \n\n"; UpdateInstrumentIdentifier(); } diff --git a/Samples/TMS/CoreServices/UpdatePaymentInstrument.php b/Samples/TMS/CoreServices/UpdatePaymentInstrument.php index f9cc268..396f839 100644 --- a/Samples/TMS/CoreServices/UpdatePaymentInstrument.php +++ b/Samples/TMS/CoreServices/UpdatePaymentInstrument.php @@ -45,24 +45,37 @@ function UpdatePaymentInstrument() "instrumentIdentifier" => $instrumentIdentifier ]; $tmsRequest = new CyberSource\Model\Body3($tmsRequestArr); - + $requestArr = json_decode($tmsRequest); + $requestBody = $apiclient->dataMasking(json_encode($requestArr, JSON_UNESCAPED_SLASHES)); + echo "The Request Payload : \n".$requestBody."\n\n"; $profileId = '93B32398-AD51-4CC2-A682-EA3E93614EB1'; require_once __DIR__. DIRECTORY_SEPARATOR .'RetrievePaymentInstrument.php'; $tokenId = RetrievePaymentInstrument(true); + $api_response = list($response,$statusCode,$httpHeader)=null; try { + $api_response = $api_instance->tmsV1PaymentinstrumentsTokenIdPatch($profileId, $tokenId, $tmsRequest); - echo "";print_r($api_response); + echo "The API Request Header: \n". json_encode($config->getRequestHeaders(), JSON_UNESCAPED_SLASHES)."\n\n"; + echo "The Api Response Body: \n"; print_r($api_response[0]);echo "\n\n"; + echo "The Api Response StatusCode: ".json_encode($api_response[1])."\n\n"; + echo "The Api Response Header: \n".json_encode($api_response[2], JSON_UNESCAPED_SLASHES)."\n"; }catch (Cybersource\ApiException $e) { - print_r($e->getResponseBody()); - print_r($e->getMessage()); + + echo "The API Request Header: \n". json_encode($config->getRequestHeaders(), JSON_UNESCAPED_SLASHES)."\n\n"; + echo "The Exception Response Body: \n"; + print_r($e->getResponseBody()); echo "\n\n"; + echo "The Exception Response Header: \n"; + print_r($e->getResponseHeaders()); echo "\n\n"; + echo "The Exception Response Header: \n"; + print_r($e->getMessage());echo "\n\n"; } } // Call Sample Code if(!defined('DO NOT RUN SAMPLE')){ - echo "UpdatePaymentInstrument Samplecode is Running.. \n"; + echo "[BEGIN] EXECUTION OF SAMPLE CODE: UpdatePaymentInstrument \n\n"; UpdatePaymentInstrument(); } diff --git a/Samples/TMS/PaymentsWithToken/AuthorizationwithToken.php b/Samples/TMS/PaymentsWithToken/AuthorizationwithToken.php index 31d3c18..a878bc3 100644 --- a/Samples/TMS/PaymentsWithToken/AuthorizationwithToken.php +++ b/Samples/TMS/PaymentsWithToken/AuthorizationwithToken.php @@ -50,7 +50,8 @@ function CreatePaymentsInstruments() ]; $tmsRequest = new CyberSource\Model\Body2($tmsRequestArr); $profileId = '93B32398-AD51-4CC2-A682-EA3E93614EB1'; - $api_response = list($response,$statusCode,$httpHeader)=null; + + $api_response = list($response,$statusCode,$httpHeader)=null; try { $api_response = $api_instance->tmsV1PaymentinstrumentsPost($profileId, $tmsRequest); echo "";print_r($api_response); diff --git a/Samples/TMS/PaymentsWithToken/PaymentsInstrumentsForAuthorization.php b/Samples/TMS/PaymentsWithToken/PaymentsInstrumentsForAuthorization.php index 0de324f..f4aabc7 100644 --- a/Samples/TMS/PaymentsWithToken/PaymentsInstrumentsForAuthorization.php +++ b/Samples/TMS/PaymentsWithToken/PaymentsInstrumentsForAuthorization.php @@ -48,7 +48,8 @@ function CreateInstrumentIdentifier() $tmsRequest = new CyberSource\Model\Body($tmsRequestArr); $profileId = '93B32398-AD51-4CC2-A682-EA3E93614EB1'; - $api_response = list($response,$statusCode,$httpHeader)=null; + + $api_response = list($response,$statusCode,$httpHeader)=null; try { $api_response = $api_instance->tmsV1InstrumentidentifiersPost($profileId, $tmsRequest); echo "";print_r($api_response); diff --git a/Samples/TransactionBatches/CoreServices/GetIndividualBatchFile.php b/Samples/TransactionBatches/CoreServices/GetIndividualBatchFile.php index 9aea3e7..5575292 100644 --- a/Samples/TransactionBatches/CoreServices/GetIndividualBatchFile.php +++ b/Samples/TransactionBatches/CoreServices/GetIndividualBatchFile.php @@ -8,22 +8,31 @@ function GetIndividualBatchFile() $config = $commonElement->ConnectionHost(); $apiclient = new CyberSource\ApiClient($config); $api_instance = new CyberSource\Api\TransactionBatchApi($apiclient); - $api_response = list($response,$statusCode,$httpHeader)=null; + + $api_response = list($response,$statusCode,$httpHeader)=null; $id="Owcyk6pl"; try { $api_response = $api_instance->ptsV1TransactionBatchesIdGet($id); - echo "";print_r($api_response); + echo "The API Request Header: \n". json_encode($config->getRequestHeaders(), JSON_UNESCAPED_SLASHES)."\n\n"; + echo "The Api Response Body: \n"; print_r($api_response[0]);echo "\n\n"; + echo "The Api Response StatusCode: ".json_encode($api_response[1])."\n\n"; + echo "The Api Response Header: \n".json_encode($api_response[2], JSON_UNESCAPED_SLASHES)."\n"; } catch (Cybersource\ApiException $e) { - print_r($e->getResponseBody()); - print_r($e->getMessage()); + echo "The API Request Header: \n". json_encode($config->getRequestHeaders(), JSON_UNESCAPED_SLASHES)."\n\n"; + echo "The Exception Response Body: \n"; + print_r($e->getResponseBody()); echo "\n\n"; + echo "The Exception Response Header: \n"; + print_r($e->getResponseHeaders()); echo "\n\n"; + echo "The Exception Response Header: \n"; + print_r($e->getMessage());echo "\n\n"; } } // Call Sample Code if(!defined('DO_NOT_RUN_SAMPLES')){ - echo "GetIndividualBatchFile Samplecode is Running.. \n"; + echo "[BEGIN] EXECUTION OF SAMPLE CODE: GetIndividualBatchFile \n\n"; GetIndividualBatchFile(); } diff --git a/Samples/TransactionBatches/CoreServices/GetListOfBatchFiles.php b/Samples/TransactionBatches/CoreServices/GetListOfBatchFiles.php index 7806dfe..16a6a9b 100644 --- a/Samples/TransactionBatches/CoreServices/GetListOfBatchFiles.php +++ b/Samples/TransactionBatches/CoreServices/GetListOfBatchFiles.php @@ -8,22 +8,32 @@ function GetListOfBatchFiles() $config = $commonElement->ConnectionHost(); $apiclient = new CyberSource\ApiClient($config); $api_instance = new CyberSource\Api\TransactionBatchesApi($apiclient); - $api_response = list($response,$statusCode,$httpHeader)=null; + + $api_response = list($response,$statusCode,$httpHeader)=null; $startTime='2018-10-01T00:00:00.00Z'; $endTime='2018-10-31T23:59:59.59Z'; try { $api_response = $api_instance->ptsV1TransactionBatchesGet($startTime, $endTime); - echo "";print_r($api_response); + echo "The API Request Header: \n". json_encode($config->getRequestHeaders(), JSON_UNESCAPED_SLASHES)."\n\n"; + $resBodyArr= json_decode($api_response[0]); + echo "The Api Response Body: \n". json_encode($resBodyArr, JSON_UNESCAPED_SLASHES)."\n\n"; + echo "The Api Response StatusCode: ".json_encode($api_response[1])."\n\n"; + echo "The Api Response Header: \n".json_encode($api_response[2], JSON_UNESCAPED_SLASHES)."\n"; } catch (Cybersource\ApiException $e) { - print_r($e->getResponseBody()); - print_r($e->getMessage()); - } + echo "The API Request Header: \n". json_encode($config->getRequestHeaders(), JSON_UNESCAPED_SLASHES)."\n\n"; + echo "The Exception Response Body: \n"; + print_r($e->getResponseBody()); echo "\n\n"; + echo "The Exception Response Header: \n"; + print_r($e->getResponseHeaders()); echo "\n\n"; + echo "The Exception Response Header: \n"; + print_r($e->getMessage());echo "\n\n"; + } } // Call Sample Code if(!defined('DO_NOT_RUN_SAMPLES')){ - echo "GetListOfBatchFiles Samplecode is Running.. \n"; + echo "[BEGIN] EXECUTION OF SAMPLE CODE: GetIndividualBatchFile \n\n"; GetListOfBatchFiles(); } diff --git a/Samples/TransactionDetails/CoreServices/RetrieveTransaction.php b/Samples/TransactionDetails/CoreServices/RetrieveTransaction.php index e1edab3..06f08e1 100644 --- a/Samples/TransactionDetails/CoreServices/RetrieveTransaction.php +++ b/Samples/TransactionDetails/CoreServices/RetrieveTransaction.php @@ -8,21 +8,29 @@ function RetrieveTransaction() $config = $commonElement->ConnectionHost(); $apiclient = new CyberSource\ApiClient($config); $api_instance = new CyberSource\Api\TransactionDetailsApi($apiclient); - $api_response = list($response,$statusCode,$httpHeader)=null; + + $api_response = list($response,$statusCode,$httpHeader)=null; $id="5408386919326811103004"; try { $api_response = $api_instance->getTransaction($id); - echo "";print_r($api_response); - + echo "The API Request Header: \n". json_encode($config->getRequestHeaders(), JSON_UNESCAPED_SLASHES)."\n\n"; + echo "The Api Response Body: \n"; print_r($api_response[0]);echo "\n\n"; + echo "The Api Response StatusCode: ".json_encode($api_response[1])."\n\n"; + echo "The Api Response Header: \n".json_encode($api_response[2], JSON_UNESCAPED_SLASHES)."\n"; } catch (Cybersource\ApiException $e) { - print_r($e->getResponseBody()); - print_r($e->getMessage()); + echo "The API Request Header: \n". json_encode($config->getRequestHeaders(), JSON_UNESCAPED_SLASHES)."\n\n"; + echo "The Exception Response Body: \n"; + print_r($e->getResponseBody()); echo "\n\n"; + echo "The Exception Response Header: \n"; + print_r($e->getResponseHeaders()); echo "\n\n"; + echo "The Exception Response Header: \n"; + print_r($e->getMessage());echo "\n\n"; } } // Call Sample Code if(!defined('DO_NOT_RUN_SAMPLES')){ - echo "RetrieveTransaction Samplecode is Running.. \n"; + echo "[BEGIN] EXECUTION OF SAMPLE CODE: GetIndividualBatchFile \n\n"; RetrieveTransaction(); } diff --git a/Samples/TransactionSearch/CoreServices/CreateSearchRequest.php b/Samples/TransactionSearch/CoreServices/CreateSearchRequest.php index 531a525..a4869b5 100644 --- a/Samples/TransactionSearch/CoreServices/CreateSearchRequest.php +++ b/Samples/TransactionSearch/CoreServices/CreateSearchRequest.php @@ -9,30 +9,42 @@ function CreateSearchRequest() $apiclient = new CyberSource\ApiClient($config); $api_instance = new CyberSource\Api\SearchTransactionsApi($apiclient); $createSearchRequestArr = [ - "save"=> "false", - "name"=> "TSS search", - "timezone"=> "America/Chicago", - "query"=> "clientReferenceInformation.code:12345", - "offset"=> 0, - "limit"=> 100, - "sort"=> "id:asc, submitTimeUtc:asc" + "save"=> "false", + "name"=> "TSS search", + "timezone"=> "America/Chicago", + "query"=> "clientReferenceInformation.code:12345", + "offset"=> 0, + "limit"=> 100, + "sort"=> "id:asc, submitTimeUtc:asc" ]; $createSearchRequest = new CyberSource\Model\TssV2TransactionsPostResponse($createSearchRequestArr); - - $api_response = list($response,$statusCode,$httpHeader)=null; + $requestArr = json_decode($createSearchRequest); + $requestBody = $apiclient->dataMasking(json_encode($requestArr, JSON_UNESCAPED_SLASHES)); + echo "The Request Payload : \n".$requestBody."\n\n"; + + $api_response = list($response,$statusCode,$httpHeader)=null; try { + $api_response = $api_instance->createSearch($createSearchRequest); - echo "";print_r($api_response); - + echo "The API Request Header: \n". json_encode($config->getRequestHeaders(), JSON_UNESCAPED_SLASHES)."\n\n"; + echo "The Api Response Body: \n"; print_r($api_response[0]);echo "\n\n"; + echo "The Api Response StatusCode: ".json_encode($api_response[1])."\n\n"; + echo "The Api Response Header: \n".json_encode($api_response[2], JSON_UNESCAPED_SLASHES)."\n"; } catch (Cybersource\ApiException $e) { - print_r($e->getResponseBody()); - print_r($e->getMessage()); + + echo "The API Request Header: \n". json_encode($config->getRequestHeaders(), JSON_UNESCAPED_SLASHES)."\n\n"; + echo "The Exception Response Body: \n"; + print_r($e->getResponseBody()); echo "\n\n"; + echo "The Exception Response Header: \n"; + print_r($e->getResponseHeaders()); echo "\n\n"; + echo "The Exception Response Header: \n"; + print_r($e->getMessage());echo "\n\n"; } } // Call Sample Code if(!defined('DO_NOT_RUN_SAMPLES')){ - echo "CreateSearchRequest Samplecode is Running.. \n"; + echo "[BEGIN] EXECUTION OF SAMPLE CODE: CreateSearchRequest \n\n"; CreateSearchRequest(); } diff --git a/Samples/TransactionSearch/CoreServices/GetSearchResults.php b/Samples/TransactionSearch/CoreServices/GetSearchResults.php index b943f63..adf54b9 100644 --- a/Samples/TransactionSearch/CoreServices/GetSearchResults.php +++ b/Samples/TransactionSearch/CoreServices/GetSearchResults.php @@ -10,20 +10,29 @@ function GetSearchResults() $api_instance = new CyberSource\Api\SearchTransactionsApi($apiclient); //$id="4862be87-e01d-427b-bc59-4783a3bcdb25"; $id="e80cc844-0d19-44d7-aa82-2fd618a89a2d"; - $api_response = list($response,$statusCode,$httpHeader)=null; + + $api_response = list($response,$statusCode,$httpHeader)=null; try { $api_response = $api_instance->getSearch($id); - echo "";print_r($api_response); + echo "The API Request Header: \n". json_encode($config->getRequestHeaders(), JSON_UNESCAPED_SLASHES)."\n\n"; + echo "The Api Response Body: \n"; print_r($api_response[0]);echo "\n\n"; + echo "The Api Response StatusCode: ".json_encode($api_response[1])."\n\n"; + echo "The Api Response Header: \n".json_encode($api_response[2], JSON_UNESCAPED_SLASHES)."\n"; } catch (Cybersource\ApiException $e) { - print_r($e->getResponseBody()); - print_r($e->getMessage()); + echo "The API Request Header: \n". json_encode($config->getRequestHeaders(), JSON_UNESCAPED_SLASHES)."\n\n"; + echo "The Exception Response Body: \n"; + print_r($e->getResponseBody()); echo "\n\n"; + echo "The Exception Response Header: \n"; + print_r($e->getResponseHeaders()); echo "\n\n"; + echo "The Exception Response Header: \n"; + print_r($e->getMessage());echo "\n\n"; } } // Call Sample Code if(!defined('DO_NOT_RUN_SAMPLES')){ - echo "GetSearchResults Samplecode is Running.. \n"; + echo "[BEGIN] EXECUTION OF SAMPLE CODE: GetSearchResults \n\n"; GetSearchResults(); } diff --git a/Samples/UserManagement/CoreServices/GetUserInformation.php b/Samples/UserManagement/CoreServices/GetUserInformation.php index 42a492b..9e735dc 100644 --- a/Samples/UserManagement/CoreServices/GetUserInformation.php +++ b/Samples/UserManagement/CoreServices/GetUserInformation.php @@ -8,21 +8,29 @@ function GetUserInformation() $config = $commonElement->ConnectionHost(); $apiclient = new CyberSource\ApiClient($config); $api_instance = new CyberSource\Api\UserManagementApi($apiclient); - $api_response = list($response,$statusCode,$httpHeader)=null; try { $api_response = $api_instance->getUsers($organizationId = 'testrest', $userName = null, $permissionId = null, $roleId = null); - echo "";print_r($api_response); + echo "The API Request Header: \n". json_encode($config->getRequestHeaders(), JSON_UNESCAPED_SLASHES)."\n\n"; + $resBodyArr= json_decode($api_response[0]); + echo "The Api Response Body: \n". json_encode($resBodyArr, JSON_UNESCAPED_SLASHES)."\n\n"; + echo "The Api Response StatusCode: ".json_encode($api_response[1])."\n\n"; + echo "The Api Response Header: \n".json_encode($api_response[2], JSON_UNESCAPED_SLASHES)."\n"; } catch (Cybersource\ApiException $e) { - print_r($e->getResponseBody()); - print_r($e->getMessage()); + echo "The API Request Header: \n". json_encode($config->getRequestHeaders(), JSON_UNESCAPED_SLASHES)."\n\n"; + echo "The Exception Response Body: \n"; + print_r($e->getResponseBody()); echo "\n\n"; + echo "The Exception Response Header: \n"; + print_r($e->getResponseHeaders()); echo "\n\n"; + echo "The Exception Response Header: \n"; + print_r($e->getMessage());echo "\n\n"; } } // Call Sample Code if(!defined('DO_NOT_RUN_SAMPLES')){ - echo "GetUserInformation Samplecode is Running.. \n"; + echo "[BEGIN] EXECUTION OF SAMPLE CODE: GetUserInformation \n\n"; GetUserInformation(); }