CyberSource / cybersource-rest-client-php

PHP client library for the CyberSource REST API
30 stars 66 forks source link

DateTime Not Supported For ReportDownloadsApi Rest Api #38

Open floorz opened 5 years ago

floorz commented 5 years ago

Issue

Passing a DateTime object as the $reportDate parameter into CyberSource\Api\ReportDownloadsApi::downloadReport($reportDate, $reportName, $organizationId = null) produces an error, despite it being a valid parameter type.

Seems to be due to the the CyberSource\ObjectSerializer formatting the date as \DateTime::ATOM which does not appear to be supported. Only date format that worked was a string value in the format of YYYY-MM-DD, which your examples do show.

Related Issue

I only bring this up because I'm converting a client to the Rest API to continue to receive their daily reports. The main issue I've been running into is that the transaction dates in at least the ConversionDetailReport_Daily_Classic report are coming back inconsistently when I pass the same date for US/CA/UK cybersource accounts. The UK report is returning transaction dates for two days ago instead of the previous day.

Example: If I passed 2019-10-25 for US/CA/UK accounts I get the following transaction start/end dates in the reports:

US: ReportStartDate="2019-10-24T07:00:00Z-08:00" ReportEndDate="2019-10-25T07:00:00Z-08:00"

CA: ReportStartDate="2019-10-24T00:00:00Z+00:00" ReportEndDate="2019-10-25T00:00:00Z+00:00"

UK: ReportStartDate="2019-10-23T23:00:00Z+00:00" ReportEndDate="2019-10-24T23:00:00Z+00:00"

Known Affected Reports

https://github.com/CyberSource/cybersource-rest-client-php/blob/4a9ed50c7d8fe3e8bc63a5fb2271c376d0140bd7/lib/ObjectSerializer.php#L176

snavinch commented 4 years ago

Hi, Thanks for bringing this to our notice, Can you please provide the exact request you used and the response you got. We noticed that the datetime format is incorrect. ISO-8601 indicates that appending ‘Z’ at the end of the datetime is equivalent of +00.00 (GMT) . The time 2019-10-24T07:00:00Z -08.00 is invalid. Can you please check? Also please provide the merchant id for which you got the above error.