Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save umidjons/671cb7564486111ddf1803757334625a to your computer and use it in GitHub Desktop.
Save umidjons/671cb7564486111ddf1803757334625a to your computer and use it in GitHub Desktop.
Check, is there any other transaction for this order
<?php
// ...
// todo: Check, is there any other transaction for this order/service
$transaction = new Transaction();
$found = $transaction->find(['account' => $this->request->params['account']]);
if ($found) {
if (($found->state == Transaction::STATE_CREATED || $found->state == Transaction::STATE_COMPLETED)
&& $found->paycom_transaction_id !== $this->request->params['id']) {
$this->response->error(
PaycomException::ERROR_COULD_NOT_PERFORM,
'There is other active/completed transaction for this order.'
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment