Skip to content

Instantly share code, notes, and snippets.

@mrkhoa99
Created March 28, 2017 06:20
Show Gist options
  • Save mrkhoa99/a695d3329ef2ad69e03a8eb9d973f988 to your computer and use it in GitHub Desktop.
Save mrkhoa99/a695d3329ef2ad69e03a8eb9d973f988 to your computer and use it in GitHub Desktop.
#vendor/magento/module-vault/Model/PaymentTokenManagement.php::getListByCustomerId()
/**
* Lists payment tokens that match specified search criteria.
*
* @param int $customerId Customer ID.
* @return \Magento\Vault\Api\Data\PaymentTokenSearchResultsInterface[] Payment tokens search result interface.
*/
public function getListByCustomerId($customerId)
{
$filters[] = $this->filterBuilder
->setField(PaymentTokenInterface::CUSTOMER_ID)
->setValue($customerId)
->create();
$entities = $this->paymentTokenRepository->getList(
$this->searchCriteriaBuilder
->addFilters($filters)
->create()
)->getItems();
return $entities;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment