You are here

protected function PaymentGatewayBase::setRemoteCustomerId in Commerce Core 8.2

Sets the remote customer ID for the given user.

Parameters

\Drupal\user\UserInterface $account: The user account.

string $remote_id: The remote customer ID.

File

modules/payment/src/Plugin/Commerce/PaymentGateway/PaymentGatewayBase.php, line 516

Class

PaymentGatewayBase
Provides the base class for payment gateways.

Namespace

Drupal\commerce_payment\Plugin\Commerce\PaymentGateway

Code

protected function setRemoteCustomerId(UserInterface $account, $remote_id) {
  if ($account
    ->isAuthenticated()) {

    /** @var \Drupal\commerce\Plugin\Field\FieldType\RemoteIdFieldItemListInterface $remote_ids */
    $remote_ids = $account
      ->get('commerce_remote_id');
    $remote_ids
      ->setByProvider($this->parentEntity
      ->id() . '|' . $this
      ->getMode(), $remote_id);
  }
}