You are here

public function DatabaseQueue::acquirePayment in Payment 8.2

Acquires a payment and removes if from the queue.

Parameters

integer $payment_id:

string $acquisition_code: The code that was received from self::claimPayment().

Return value

bool Whether the acquisition was successful.

Overrides QueueInterface::acquirePayment

File

src/DatabaseQueue.php, line 190

Class

DatabaseQueue
Provides a database-based payment queue.

Namespace

Drupal\payment

Code

public function acquirePayment($payment_id, $acquisition_code) {
  return (bool) $this->database
    ->delete('payment_queue', array(
    'return' => Database::RETURN_AFFECTED,
  ))
    ->condition('acquisition_code', $acquisition_code)
    ->condition('claimed', time() - $this
    ->getClaimExpirationPeriod(), '>=')
    ->condition('payment_id', $payment_id)
    ->condition('queue_id', $this->queueId)
    ->execute();
}