Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added POC #11

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions Resources/ExternalConfiguration.php
Original file line number Diff line number Diff line change
@@ -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){
}
}

?>
?>
19 changes: 15 additions & 4 deletions Samples/Flex/CoreServices/GenerateKey.php
Original file line number Diff line number Diff line change
@@ -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();
}

23 changes: 17 additions & 6 deletions Samples/Flex/CoreServices/TokenizeCard.php
Original file line number Diff line number Diff line change
@@ -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]);
3 changes: 2 additions & 1 deletion Samples/Flex/KeyGenerationNoEnc.php
Original file line number Diff line number Diff line change
@@ -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'];
24 changes: 18 additions & 6 deletions Samples/Payments/CoreServices/CapturePayment.php
Original file line number Diff line number Diff line change
@@ -32,28 +32,40 @@ 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){
//Returning the ID
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);

}
25 changes: 20 additions & 5 deletions Samples/Payments/CoreServices/ProcessAuthorizationReversal.php
Original file line number Diff line number Diff line change
@@ -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);

}
24 changes: 19 additions & 5 deletions Samples/Payments/CoreServices/ProcessCredit.php
Original file line number Diff line number Diff line change
@@ -58,27 +58,41 @@ 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
echo "Fetching Credit 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 Credit Samplecode is Running.. \n";
echo "[BEGIN] EXECUTION OF SAMPLE CODE: ProcessCredit \n\n";
ProcessCredit(false);

}
23 changes: 17 additions & 6 deletions Samples/Payments/CoreServices/ProcessPayment.php
Original file line number Diff line number Diff line change
@@ -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");

}
22 changes: 17 additions & 5 deletions Samples/Payments/CoreServices/RefundCapture.php
Original file line number Diff line number Diff line change
@@ -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 "<pre>";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();

}
23 changes: 17 additions & 6 deletions Samples/Payments/CoreServices/RefundPayment.php
Original file line number Diff line number Diff line change
@@ -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);

}
22 changes: 17 additions & 5 deletions Samples/Payments/CoreServices/VoidCapture.php
Original file line number Diff line number Diff line change
@@ -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 "<pre>";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();

}
22 changes: 17 additions & 5 deletions Samples/Payments/CoreServices/VoidCredit.php
Original file line number Diff line number Diff line change
@@ -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 "<pre>";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();

}
24 changes: 18 additions & 6 deletions Samples/Payments/CoreServices/VoidPayment.php
Original file line number Diff line number Diff line change
@@ -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 "<pre>";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();

}
22 changes: 17 additions & 5 deletions Samples/Payments/CoreServices/VoidRefund.php
Original file line number Diff line number Diff line change
@@ -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 "<pre>";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();

}
27 changes: 20 additions & 7 deletions Samples/Payouts/CoreServices/ProcessPayout.php
Original file line number Diff line number Diff line change
@@ -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 "<pre>";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();

}
30 changes: 22 additions & 8 deletions Samples/Payouts/Payout.php
Original file line number Diff line number Diff line change
@@ -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 "<pre>";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();

}
24 changes: 19 additions & 5 deletions Samples/Reporting/CoreServices/CreateAdhocReport.php
Original file line number Diff line number Diff line change
@@ -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 "<pre>";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();

}
Original file line number Diff line number Diff line change
@@ -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 "<pre>";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();

}
Original file line number Diff line number Diff line change
@@ -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 "<pre>";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");

}
20 changes: 14 additions & 6 deletions Samples/Reporting/CoreServices/DownloadReport.php
Original file line number Diff line number Diff line change
@@ -7,29 +7,37 @@ 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";
}

}


// 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();

}
19 changes: 14 additions & 5 deletions Samples/Reporting/CoreServices/GetAllSubscriptions.php
Original file line number Diff line number Diff line change
@@ -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 "<pre>";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();

}
20 changes: 15 additions & 5 deletions Samples/Reporting/CoreServices/GetNotificationOfChanges.php
Original file line number Diff line number Diff line change
@@ -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 "<pre>";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();

}
20 changes: 15 additions & 5 deletions Samples/Reporting/CoreServices/GetPurchaseAndRefundDetails.php
Original file line number Diff line number Diff line change
@@ -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 "<pre>";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();

}
20 changes: 15 additions & 5 deletions Samples/Reporting/CoreServices/GetReportBasedOnReportid.php
Original file line number Diff line number Diff line change
@@ -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 "<pre>";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();

}
20 changes: 15 additions & 5 deletions Samples/Reporting/CoreServices/GetReportDefinition.php
Original file line number Diff line number Diff line change
@@ -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 "<pre>";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();

}
20 changes: 15 additions & 5 deletions Samples/Reporting/CoreServices/GetReportingResourceInformation.php
Original file line number Diff line number Diff line change
@@ -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 "<pre>";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();

}
20 changes: 15 additions & 5 deletions Samples/Reporting/CoreServices/GetSubscriptionForReportName.php
Original file line number Diff line number Diff line change
@@ -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 "<pre>";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();

}
19 changes: 14 additions & 5 deletions Samples/Reporting/CoreServices/RetrieveAvailableReports.php
Original file line number Diff line number Diff line change
@@ -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 "<pre>";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();

}
Original file line number Diff line number Diff line change
@@ -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();
}

22 changes: 14 additions & 8 deletions Samples/SecureFileShare/CoreServices/GetListOfFiles.php
Original file line number Diff line number Diff line change
@@ -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 "<pre>";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();
}

?>
36 changes: 25 additions & 11 deletions Samples/TMS/CoreServices/CreateInstrumentIdentifier.php
Original file line number Diff line number Diff line change
@@ -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);

}
29 changes: 21 additions & 8 deletions Samples/TMS/CoreServices/CreatePaymentInstrument.php
Original file line number Diff line number Diff line change
@@ -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);

}
21 changes: 16 additions & 5 deletions Samples/TMS/CoreServices/DeleteInstrumentIdentifier.php
Original file line number Diff line number Diff line change
@@ -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 "<pre>";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();

}
21 changes: 16 additions & 5 deletions Samples/TMS/CoreServices/DeletePaymentInstrument.php
Original file line number Diff line number Diff line change
@@ -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 "<pre>";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();

}
19 changes: 14 additions & 5 deletions Samples/TMS/CoreServices/RetrieveAllPaymentInstruments.php
Original file line number Diff line number Diff line change
@@ -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 "<pre>";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();

}
19 changes: 14 additions & 5 deletions Samples/TMS/CoreServices/RetrieveInstrumentIdentifier.php
Original file line number Diff line number Diff line change
@@ -11,26 +11,35 @@ 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){
//Returning the ID
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);

}
19 changes: 14 additions & 5 deletions Samples/TMS/CoreServices/RetrievePaymentInstrument.php
Original file line number Diff line number Diff line change
@@ -11,26 +11,35 @@ 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){
//Returning the ID
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);

}
24 changes: 19 additions & 5 deletions Samples/TMS/CoreServices/UpdateInstrumentIdentifier.php
Original file line number Diff line number Diff line change
@@ -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 "<pre>";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();

}
23 changes: 18 additions & 5 deletions Samples/TMS/CoreServices/UpdatePaymentInstrument.php
Original file line number Diff line number Diff line change
@@ -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 "<pre>";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();

}
3 changes: 2 additions & 1 deletion Samples/TMS/PaymentsWithToken/AuthorizationwithToken.php
Original file line number Diff line number Diff line change
@@ -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 "<pre>";print_r($api_response);
Original file line number Diff line number Diff line change
@@ -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 "<pre>";print_r($api_response);
19 changes: 14 additions & 5 deletions Samples/TransactionBatches/CoreServices/GetIndividualBatchFile.php
Original file line number Diff line number Diff line change
@@ -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 "<pre>";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();

}
22 changes: 16 additions & 6 deletions Samples/TransactionBatches/CoreServices/GetListOfBatchFiles.php
Original file line number Diff line number Diff line change
@@ -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 "<pre>";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();

}
20 changes: 14 additions & 6 deletions Samples/TransactionDetails/CoreServices/RetrieveTransaction.php
Original file line number Diff line number Diff line change
@@ -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 "<pre>";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();

}
40 changes: 26 additions & 14 deletions Samples/TransactionSearch/CoreServices/CreateSearchRequest.php
Original file line number Diff line number Diff line change
@@ -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 "<pre>";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();

}
19 changes: 14 additions & 5 deletions Samples/TransactionSearch/CoreServices/GetSearchResults.php
Original file line number Diff line number Diff line change
@@ -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 "<pre>";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();

}
18 changes: 13 additions & 5 deletions Samples/UserManagement/CoreServices/GetUserInformation.php
Original file line number Diff line number Diff line change
@@ -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 "<pre>";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();

}