public function DatabaseQueue::claimPayment in Payment 8.2
Claims a payment available for referencing through a field instance.
After a payment has been claimed, it can be definitely acquired with self::acquirePayment().
Parameters
integer $payment_id:
Return value
string|false An acquisition code to acquire the payment with on success, or FALSE if the payment could not be claimed.
Overrides QueueInterface::claimPayment
File
- src/
DatabaseQueue.php, line 149
Class
- DatabaseQueue
- Provides a database-based payment queue.
Namespace
Drupal\paymentCode
public function claimPayment($payment_id) {
$acquisition_code = $this
->tryClaimPaymentOnce($payment_id);
// If a payment cannot be claimed at the first try, wait until the previous
// claim has expired and try to claim the payment one more time.
if ($acquisition_code === FALSE) {
sleep($this
->getClaimExpirationPeriod());
$acquisition_code = $this
->tryClaimPaymentOnce($payment_id);
}
return $acquisition_code;
}