-
Notifications
You must be signed in to change notification settings - Fork 201
Expand file tree
/
Copy pathget-account-updater-job-details.php
More file actions
153 lines (119 loc) · 5.88 KB
/
get-account-updater-job-details.php
File metadata and controls
153 lines (119 loc) · 5.88 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
<?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';
use net\authorize\api\contract\v1 as AnetAPI;
use net\authorize\api\controller as AnetController;
define("AUTHORIZENET_LOG_FILE", "phplog");
function getAccountUpdaterJobDetails()
{
/* 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 = '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";
} else {
$details = new AnetAPI\ListOfAUDetailsType;
$details = $response->getAuDetails();
if (($details->getAuUpdate() == null) && ($details->getAuDelete() == null)) {
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 : " . $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 "**** 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
{
echo "ERROR : Invalid response\n";
$errorMessages = $response->getMessages()->getMessage();
echo "Response : " . $errorMessages[0]->getCode() . " " .$errorMessages[0]->getText() . "\n";
}
return $response;
}
if (!defined('DONT_RUN_SAMPLES')) {
getAccountUpdaterJobDetails();
}