diff --git a/TransactionReporting/get-account-updater-job-details.php b/TransactionReporting/get-account-updater-job-details.php index 0d26eb5..ed99894 100644 --- a/TransactionReporting/get-account-updater-job-details.php +++ b/TransactionReporting/get-account-updater-job-details.php @@ -8,74 +8,104 @@ function getAccountUpdaterJobDetails() { - /* Create a merchantAuthenticationType object with authentication details - retrieved from the constants file */ + /* Create a merchantAuthenticationType object with authentication details retrieved from the constants file */ $merchantAuthentication = new AnetAPI\MerchantAuthenticationType(); $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(); $request->setMerchantAuthentication($merchantAuthentication); $request->setMonth($month); $request->setModifiedTypeFilter($modifedTypeFilter); $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); - + 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 ; + echo "No Account Updater Details for this month"."\n"; } 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 ; + echo "No Account Updater Details for this month"."\n"; } } - // Displaying the details of each response in the list echo "Total Num in Result Set : " . $response->getTotalNumInResultSet() . "\n\n"; $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"; - echo "\n"; + echo "Updates:"."\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"; + + 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 "Fetching Old Card Details"."\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"; + } + if(!empty($update->getSubscriptionIdList())) + { + echo "Subscription Id : ".implode("",$update->getSubscriptionIdList()). "\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 "\n"; + echo "**** AU Update End ****"."\n"; + echo "*** AU Deletes:****"."\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"; + + 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())."\n"; + } } - } else { - echo "ERROR : Invalid response\n"; + } + else + { + echo "ERROR : Invalid response"."\n"; $errorMessages = $response->getMessages()->getMessage(); echo "Response : " . $errorMessages[0]->getCode() . " " .$errorMessages[0]->getText() . "\n"; - } - + } return $response; } diff --git a/test-runner.php b/test-runner.php index 61c981c..7409578 100644 --- a/test-runner.php +++ b/test-runner.php @@ -20,8 +20,7 @@ 'PaymentTransactions/', 'TransactionReporting/', 'MobileInappTransactions/', - 'VisaCheckout/', - 'AcceptSuite/' + 'VisaCheckout/' ); $errorlevel=error_reporting(); @@ -468,4 +467,9 @@ public static function runGetBatchStatistics() $response = getBatchStatistics(self::runGetSettledBatchList()->getBatchList()[0]->getBatchId()); return $response; } + public static function runGetAccountUpdaterJobDetails() + { + $response = getAccountUpdaterJobDetails(self::MERCHANT_LOGIN_ID,self::MERCHANT_TRANSACTION_KEY); + return $response; + } }