From 58c7b3c50674dc4429be59b36003584ef4143d2c Mon Sep 17 00:00:00 2001 From: Keith Brink Date: Sun, 3 May 2020 11:13:01 +0300 Subject: [PATCH] Add custom report option --- src/AmazonReportRequest.php | 11 +++++++++++ tests/classes/AmazonReportRequestTest.php | 16 ++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/src/AmazonReportRequest.php b/src/AmazonReportRequest.php index 79c9ead..6fdf43e 100755 --- a/src/AmazonReportRequest.php +++ b/src/AmazonReportRequest.php @@ -136,6 +136,17 @@ public function setReportType($s) */ } + /** + * Sets whether or not to use the custom report (Optional). + * + * @param bool $custom + * @return void + */ + public function setCustomReport(bool $custom) + { + $this->options['ReportOptions=custom'] = $custom; + } + /** * Sets the time frame options. (Optional). * diff --git a/tests/classes/AmazonReportRequestTest.php b/tests/classes/AmazonReportRequestTest.php index 391e3cf..2af3a8d 100644 --- a/tests/classes/AmazonReportRequestTest.php +++ b/tests/classes/AmazonReportRequestTest.php @@ -132,6 +132,22 @@ public function testSetMarketplaces() $this->assertArrayNotHasKey('MarketplaceIdList.Id.1', $o3); } + public function testSetCustomReport() + { + $o = $this->object->getOptions(); + $this->assertArrayNotHasKey('ReportOptions=custom', $o); + + $this->object->setCustomReport(true); + $o2 = $this->object->getOptions(); + $this->assertArrayHasKey('ReportOptions=custom', $o2); + $this->assertTrue($o2['ReportOptions=custom']); + + $this->object->setCustomReport(false); + $o3 = $this->object->getOptions(); + $this->assertArrayHasKey('ReportOptions=custom', $o3); + $this->assertFalse($o3['ReportOptions=custom']); + } + public function testRequestReport() { resetLog();