From 7425a6b70645698b521a97f08aab8e6815b570e8 Mon Sep 17 00:00:00 2001 From: kapilkumar99 <36911550+kapilkumar99@users.noreply.github.com> Date: Mon, 12 Nov 2018 14:04:05 +0530 Subject: [PATCH 1/3] PR1992 modified files 1)get-account-updater-job-details.php --- .../get-account-updater-job-details.php | 111 ++++++++++++++---- 1 file changed, 90 insertions(+), 21 deletions(-) diff --git a/TransactionReporting/get-account-updater-job-details.php b/TransactionReporting/get-account-updater-job-details.php index 0d26eb5..ad584ea 100644 --- a/TransactionReporting/get-account-updater-job-details.php +++ b/TransactionReporting/get-account-updater-job-details.php @@ -1,6 +1,6 @@ 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(); @@ -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); + + 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 ; + } } @@ -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; } From ae47b73d85a36c227416003d16d750cfad371cc6 Mon Sep 17 00:00:00 2001 From: kapilkumar99 <36911550+kapilkumar99@users.noreply.github.com> Date: Tue, 13 Nov 2018 11:08:04 +0530 Subject: [PATCH 2/3] Removed extra code and extra space --- .../get-account-updater-job-details.php | 67 ++++--------------- 1 file changed, 14 insertions(+), 53 deletions(-) diff --git a/TransactionReporting/get-account-updater-job-details.php b/TransactionReporting/get-account-updater-job-details.php index ad584ea..ed99894 100644 --- a/TransactionReporting/get-account-updater-job-details.php +++ b/TransactionReporting/get-account-updater-job-details.php @@ -1,6 +1,6 @@ setName(\SampleCodeConstants::MERCHANT_LOGIN_ID); $merchantAuthentication->setTransactionKey(\SampleCodeConstants::MERCHANT_TRANSACTION_KEY); - - // Set the request's refId $refId = '123456'; - // Set a valid month (and other parameters) for the request $month = "2018-08"; $modifedTypeFilter = "all"; $paging = new AnetAPI\PagingType; $paging->setLimit("1000"); $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"; - + 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"; - + 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"; + 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"; - echo "\n"; - - echo "\n"; - - + if ($update->getNewCreditCard()->getCardNumber() != null) { echo "Fetching New Card Details"."\n"; @@ -79,48 +62,30 @@ function getAccountUpdaterJobDetails() 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"; + 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"; - echo "\n"; - - } if(!empty($update->getSubscriptionIdList())) { - echo "Subscription Id : ".implode("",$update->getSubscriptionIdList()). "\n"; - echo "\n"; + echo "Subscription Id : ".implode("",$update->getSubscriptionIdList()). "\n"; } - } echo "**** AU Update End ****"."\n"; - echo "\n"; - echo "\n"; - echo "\nDeletes:\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"; - echo "\n"; - - - + if($delete->getCreditCard()->getCardNumber() != null) { echo "Fetching Card Details"."\n"; @@ -129,22 +94,18 @@ function getAccountUpdaterJobDetails() 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 "Subscription Id :".implode("",$delete->getSubscriptionIdList())."\n"; } - echo "\n"; } } else { - echo "ERROR : Invalid response\n"; + echo "ERROR : Invalid response"."\n"; $errorMessages = $response->getMessages()->getMessage(); echo "Response : " . $errorMessages[0]->getCode() . " " .$errorMessages[0]->getText() . "\n"; } - return $response; } From 019100f24b0ac8a640b12b1d5a160e7927482d52 Mon Sep 17 00:00:00 2001 From: kapilkumar99 <36911550+kapilkumar99@users.noreply.github.com> Date: Tue, 13 Nov 2018 13:08:59 +0530 Subject: [PATCH 3/3] Modified test-runner.php file --- test-runner.php | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) 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; + } }