function uc_payment_enter in Ubercart 8.4
Same name and namespace in other branches
- 5 payment/uc_payment/uc_payment.module \uc_payment_enter()
- 6.2 payment/uc_payment/uc_payment.module \uc_payment_enter()
- 7.3 payment/uc_payment/uc_payment.module \uc_payment_enter()
Enters a payment for an order.
Parameters
int $order_id: The order ID to apply the payment to.
string $method: The payment method plugin ID.
float $amount: The amount of the payment.
int $uid: (optional) The user ID of the person logging the payment, or 0 if the payment was processed automatically.
array $data: (optional) Any data that should be serialized and stored with the payment.
string $comment: (optional) The comment to enter in the payment log.
int $received: (optional) The timestamp at which the payment was received.
Return value
string A unique ID identifying the PaymentReceipt entity.
14 calls to uc_payment_enter()
- CartCheckoutTest::testCheckoutComplete in uc_cart/
tests/ src/ Functional/ CartCheckoutTest.php - Tests checkout complete functioning.
- CreditCardPaymentMethodBase::processPayment in payment/
uc_credit/ src/ CreditCardPaymentMethodBase.php - Process a payment through the credit card gateway.
- FileCheckoutTest::testCheckoutFileDownload in uc_file/
tests/ src/ Functional/ FileCheckoutTest.php - Tests that purchased files may be downloaded after checkout.
- FileTest::testFilePurchaseCheckout in uc_file/
tests/ src/ Functional/ FileTest.php - Tests that purchased files may be downloaded after checkout.
- FreeOrder::orderSubmit in payment/
uc_payment/ src/ Plugin/ Ubercart/ PaymentMethod/ FreeOrder.php - Called when an order is being submitted with this payment method.
File
- payment/
uc_payment/ uc_payment.module, line 146 - Defines the payment API that lets payment modules interact with Ubercart.
Code
function uc_payment_enter($order_id, $method, $amount, $uid = 0, array $data = NULL, $comment = '', $received = NULL) {
if (is_null($received)) {
$received = \Drupal::time()
->getRequestTime();
}
$order = Order::load($order_id);
$receipt = PaymentReceipt::create([
'order_id' => $order_id,
'method' => $method,
'amount' => $amount,
'currency' => $order
->getCurrency(),
'uid' => $uid,
'data' => is_array($data) ? $data : serialize($data),
'comment' => $comment,
'received' => $received,
]);
$receipt
->save();
return $receipt
->id();
}