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

PR1992 modified files #135

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
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
111 changes: 90 additions & 21 deletions TransactionReporting/get-account-updater-job-details.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
require 'vendor/autoload.php';
require_once 'constants/SampleCodeConstants.php';
require 'C:/php/Anet/new/sdk-php-master/vendor/autoload.php';
require_once 'C:/php/Anet/new/sdk-php-master/sample-code-php/constants/SampleCodeConstants.php';
kapilkumar99 marked this conversation as resolved.
Show resolved Hide resolved
use net\authorize\api\contract\v1 as AnetAPI;
use net\authorize\api\controller as AnetController;

Expand All @@ -14,15 +14,16 @@ function getAccountUpdaterJobDetails()
$merchantAuthentication->setName(\SampleCodeConstants::MERCHANT_LOGIN_ID);
$merchantAuthentication->setTransactionKey(\SampleCodeConstants::MERCHANT_TRANSACTION_KEY);


// Set the request's refId
$refId = 'ref' . time();
$refId = '123456';

// Set a valid month (and other parameters) for the request
$month = "2017-07";
$month = "2018-08";
$modifedTypeFilter = "all";
$paging = new AnetAPI\PagingType;
$paging->setLimit("1000");
$paging->setOffset("1");
$paging->setOffset("2");

// Build tbe request object
$request = new AnetAPI\GetAUJobDetailsRequest();
Expand All @@ -32,21 +33,23 @@ function getAccountUpdaterJobDetails()
$request->setPaging($paging);

$controller = new AnetController\GetAUJobDetailsController($request);

// Retrieving details for the given month and parameters
$response = $controller->executeWithApiResponse(\net\authorize\api\constants\ANetEnvironment::SANDBOX);


kapilkumar99 marked this conversation as resolved.
Show resolved Hide resolved

if (($response != null) && ($response->getMessages()->getResultCode() == "Ok")) {
echo "SUCCESS: Get Account Updater Details for Month : " . $month . "\n\n";
if ($response->getAuDetails() == null) {
echo "No Account Updater Details for this month.\n";
return ;

} else {
$details = new AnetAPI\ListOfAUDetailsType;
$details = $response->getAuDetails();
if (($details->getAuUpdate() == null) && ($details->getAuDelete() == null)) {
echo "No Account Updater Details for this month.\n";
return ;

}
}

Expand All @@ -55,26 +58,92 @@ function getAccountUpdaterJobDetails()
$details = new AnetAPI\ListOfAUDetailsType;
$details = $response->getAuDetails();
echo "Updates:\n";
foreach ($details->getAuUpdate() as $update) {
echo " Profile ID / Payment Profile ID : " . $update->getCustomerProfileID() . " / " . $update->getCustomerPaymentProfileID() . "\n";
echo " Update Time (UTC) : " . $update->getUpdateTimeUTC() . "\n";
echo " Reason Code : " . $update->getAuReasonCode() . "\n";
echo " Reason Description : " . $update->getReasonDescription() . "\n";
foreach ($details->getAuUpdate() as $update)
{


echo "Profile ID : " . $update->getCustomerProfileID() . "\n";
echo "Payment Profile ID : " . $update->getCustomerPaymentProfileID() . "\n";
echo "Update Time (UTC) : " . $update->getUpdateTimeUTC() . "\n";
echo "Reason Code : " . $update->getAuReasonCode() . "\n";
echo "Reason Description : " . $update->getReasonDescription() . "\n";
echo "\n";

echo "\n";


if ($update->getNewCreditCard()->getCardNumber() != null)
{
echo "Fetching New Card Details"."\n";
// Fetching New Card Details
echo "Card Number: ". $update->getNewCreditCard()->getCardNumber()."\n";
echo "New Expiration Date: ". $update->getNewCreditCard()->getExpirationDate()."\n";
echo "New Card Type: ". $update->getNewCreditCard()->getCardType()."\n";


}

if ($update->getOldCreditCard()->getCardNumber() != null)
{
echo "\n";
echo "Fetching Old Card Details";
echo "\n";
// Fetching Old Card Details
echo "Old Card Number: ". $update->getOldCreditCard()->getCardNumber()."\n";
echo "Old Expiration Date: ".$update->getOldCreditCard()->getExpirationDate()."\n";
echo "Old Card Type: ". $update->getOldCreditCard()->getCardType()."\n";
echo "\n";


}
if(!empty($update->getSubscriptionIdList()))
{
echo "Subscription Id : ".implode("",$update->getSubscriptionIdList()). "\n";
echo "\n";
}

}
echo "\nDeletes:\n";
foreach ($details->getAuDelete() as $delete) {
echo " Profile ID / Payment Profile ID : " . $delete->getCustomerProfileID() . " / " . $delete->getCustomerPaymentProfileID() . "\n";
echo " Update Time (UTC) : " . $delete->getUpdateTimeUTC() . "\n";
echo " Reason Code : " . $delete->getAuReasonCode() . "\n";
echo " Reason Description : " . $delete->getReasonDescription() . "\n";
echo "**** AU Update End ****"."\n";
echo "\n";
echo "\n";
echo "\nDeletes:\n";
foreach ($details->getAuDelete() as $delete)
{


echo "Profile ID : " . $delete->getCustomerProfileID() . "\n";

echo "Payment Profile ID : " . $delete->getCustomerPaymentProfileID() . "\n";
echo "Update Time (UTC) : " . $delete->getUpdateTimeUTC() . "\n";
echo "Reason Code : " . $delete->getAuReasonCode() . "\n";
echo "Reason Description : " . $delete->getReasonDescription() . "\n";
echo "\n";



if($delete->getCreditCard()->getCardNumber() != null)
{
echo "Fetching Card Details"."\n";
// Fetching New Card Details
echo "Card Number: ". $delete->getCreditCard()->getCardNumber()."\n";
echo "Expiration Date: ". $delete->getCreditCard()->getExpirationDate()."\n";
echo "Card Type: ". $delete->getCreditCard()->getCardType()."\n";
}

if(!empty($delete->getSubscriptionIdList()))
{
echo "Subscription Id :".implode("",$delete->getSubscriptionIdList());
echo "\n";
}
echo "\n";
}
} else {
}
else
{
echo "ERROR : Invalid response\n";
$errorMessages = $response->getMessages()->getMessage();
echo "Response : " . $errorMessages[0]->getCode() . " " .$errorMessages[0]->getText() . "\n";
}
}

return $response;
}
Expand Down