public function PurchaseOrderGateway::receivePayment in Commerce Purchase Order 8
File
- src/
Plugin/ Commerce/ PaymentGateway/ PurchaseOrderGateway.php, line 164
Class
- PurchaseOrderGateway
- Provides the On-site payment gateway.
Namespace
Drupal\commerce_purchase_order\Plugin\Commerce\PaymentGatewayCode
public function receivePayment(PaymentInterface $payment, Price $amount = NULL) {
$this
->assertPaymentState($payment, [
'completed',
]);
// If not specified, use the entire amount.
$amount = $amount ?: $payment
->getAmount();
$payment->state = 'paid';
$payment
->setAmount($amount);
$payment
->save();
}