From 488ffd2b58d9b81345ff3756f39de174c993778d Mon Sep 17 00:00:00 2001 From: Javlon Juraev <12049982+juraevuz@users.noreply.github.com> Date: Tue, 5 Mar 2019 12:39:33 +0500 Subject: [PATCH] Update Application.php Sandbox accepts all these values in milliseconds and displays error if timestamp is sent. --- Paycom/Application.php | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/Paycom/Application.php b/Paycom/Application.php index 184c10e..d69706b 100644 --- a/Paycom/Application.php +++ b/Paycom/Application.php @@ -107,9 +107,9 @@ private function CheckTransaction() // todo: Prepare and send found transaction $this->response->send([ - 'create_time' => Format::datetime2timestamp($found->create_time), - 'perform_time' => Format::datetime2timestamp($found->perform_time), - 'cancel_time' => Format::datetime2timestamp($found->cancel_time), + 'create_time' => Format::timestamp2milliseconds(Format::datetime2timestamp($found->create_time)), + 'perform_time' => (Format::datetime2timestamp($found->perform_time) != null) ? Format::timestamp2milliseconds(Format::datetime2timestamp($found->perform_time)) : 0, + 'cancel_time' => (Format::datetime2timestamp($found->cancel_time) != null) ? Format::timestamp2milliseconds(Format::datetime2timestamp($found->cancel_time)) : 0, 'transaction' => $found->id, 'state' => $found->state, 'reason' => isset($found->reason) ? 1 * $found->reason : null @@ -177,7 +177,7 @@ private function CreateTransaction() // send response $this->response->send([ - 'create_time' => $create_time, + 'create_time' => Format::timestamp2milliseconds($create_time), 'transaction' => $transaction->id, 'state' => $transaction->state, 'receivers' => null @@ -219,7 +219,7 @@ private function PerformTransaction() $this->response->send([ 'transaction' => $found->id, - 'perform_time' => $perform_time, + 'perform_time' => Format::timestamp2milliseconds($perform_time), 'state' => $found->state ]); } @@ -229,7 +229,7 @@ private function PerformTransaction() // todo: If transaction completed, just return it $this->response->send([ 'transaction' => $found->id, - 'perform_time' => Format::datetime2timestamp($found->perform_time), + 'perform_time' => Format::timestamp2milliseconds(Format::datetime2timestamp($found->perform_time)), 'state' => $found->state ]); break; @@ -262,7 +262,7 @@ private function CancelTransaction() case Transaction::STATE_CANCELLED_AFTER_COMPLETE: $this->response->send([ 'transaction' => $found->id, - 'cancel_time' => Format::datetime2timestamp($found->cancel_time), + 'cancel_time' => Format::timestamp2milliseconds(Format::datetime2timestamp($found->cancel_time)), 'state' => $found->state ]); break; @@ -281,7 +281,7 @@ private function CancelTransaction() // send response $this->response->send([ 'transaction' => $found->id, - 'cancel_time' => Format::datetime2timestamp($found->cancel_time), + 'cancel_time' => Format::timestamp2milliseconds(Format::datetime2timestamp($found->cancel_time)), 'state' => $found->state ]); break; @@ -300,7 +300,7 @@ private function CancelTransaction() // send response $this->response->send([ 'transaction' => $found->id, - 'cancel_time' => Format::datetime2timestamp($found->cancel_time), + 'cancel_time' => Format::timestamp2milliseconds(Format::datetime2timestamp($found->cancel_time)), 'state' => $found->state ]); } else { @@ -361,4 +361,4 @@ private function GetStatement() // send results back $this->response->send(['transactions' => $transactions]); } -} \ No newline at end of file +}