From 84c3187181a2d042b275bb2d1af442d0880379b1 Mon Sep 17 00:00:00 2001 From: maestro675 Date: Thu, 30 Jul 2020 10:46:47 +0300 Subject: [PATCH] Update Order.php Check DateTime constructor for empty createdDate/processingDate values --- src/Domain/Order.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Domain/Order.php b/src/Domain/Order.php index 81b461a..e7a9eab 100644 --- a/src/Domain/Order.php +++ b/src/Domain/Order.php @@ -76,11 +76,11 @@ public static function fromArray(array $data) return new self( $data['orderReference'], - new DateTime('@' . $data['createdDate']), + new DateTime(empty($data['createdDate']) ? null : '@' . $data['createdDate']), $data['amount'], $data['currency'], $data['transactionStatus'], - new DateTime('@' . $data['processingDate']), + new DateTime(empty($data['processingDate']) ? null : '@' . $data['processingDate']), $data['reasonCode'], $data['reason'], isset($data['cardPan']) ? $data['cardPan'] : null, @@ -142,4 +142,4 @@ public function __construct( $this->settlementAmount = $settlementAmount; $this->refundAmount = $refundAmount; } -} \ No newline at end of file +}