Skip to content

Commit 94dcd23

Browse files
authored
Update get-settled-batch-list.php to use settlement date range
First and last settlement dates are passed as parameters. Sample code shows two methods for creating DateTime objects for the same.
1 parent 03853b8 commit 94dcd23

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

TransactionReporting/get-settled-batch-list.php

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
define("AUTHORIZENET_LOG_FILE", "phplog");
77

8-
function getSettledBatchList()
8+
function getSettledBatchList($firstSettlementDate, $lastSettlementDate)
99
{
1010
/* Create a merchantAuthenticationType object with authentication details
1111
retrieved from the constants file */
@@ -21,15 +21,7 @@ function getSettledBatchList()
2121
$request->setIncludeStatistics(true);
2222

2323
// both the first and last dates must be in the same time zone
24-
$firstSettlementDate=new DateTime("2015-08-25T06:00:00Z");
25-
// a date constructed from an ISO8601 format date string
2624
$request->setFirstSettlementDate($firstSettlementDate);
27-
28-
// a date constructed manually
29-
$lastSettlementDate=new DateTime();
30-
$lastSettlementDate->setDate(2015,9,20);
31-
$lastSettlementDate->setTime(13,33,59);
32-
$lastSettlementDate->setTimezone(new DateTimeZone('UTC'));
3325
$request->setLastSettlementDate($lastSettlementDate);
3426

3527
$controller = new AnetController\GetSettledBatchListController ($request);
@@ -69,8 +61,17 @@ function getSettledBatchList()
6961

7062
return $response;
7163
}
72-
64+
65+
// both the first and last dates must be in the same time zone
66+
// a date constructed from an ISO8601 format date string
67+
$firstSettlementDate=new DateTime("2018-01-23T06:00:00Z");
68+
// a date constructed manually
69+
$lastSettlementDate=new DateTime();
70+
$lastSettlementDate->setDate(2018,2,19);
71+
$lastSettlementDate->setTime(13,33,59);
72+
$lastSettlementDate->setTimezone(new DateTimeZone('UTC'));
73+
7374
if(!defined('DONT_RUN_SAMPLES'))
74-
getSettledBatchList();
75+
getSettledBatchList($firstSettlementDate, $lastSettlementDate);
7576

7677
?>

0 commit comments

Comments
 (0)