Skip to content

Commit

Permalink
Merge pull request #13439 from jgillmanjr/paypal-standard-ipn-tz-fix
Browse files Browse the repository at this point in the history
Convert Paypal Standard IPN payment_date to system's time zone
  • Loading branch information
seamuslee001 authored Jan 16, 2019
2 parents 2b491b3 + 6800eef commit 1ce4df2
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions CRM/Core/Payment/PayPalIPN.php
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,12 @@ public function getInput(&$input, &$ids) {
$paymentDate = $this->retrieve('payment_date', 'String', FALSE);
if (!empty($paymentDate)) {
$receiveDateTime = new DateTime($paymentDate);
/**
* The `payment_date` that Paypal sends back is in their timezone. Example return: 08:23:05 Jan 11, 2019 PST
* Subsequently, we need to account for that, otherwise the recieve time will be incorrect for the local system
*/
$systemTimeZone = new DateTimeZone(CRM_Core_Config::singleton()->userSystem->getTimeZoneString());
$receiveDateTime->setTimezone($systemTimeZone);
$input['receive_date'] = $receiveDateTime->format('YmdHis');
}
}
Expand Down

0 comments on commit 1ce4df2

Please sign in to comment.