Magento Extensions Rating 2024
EXTENSIONS BY CATEGORY
B2B (Business-To-Business)
Blog
Customer
ERP (Enterprise Resource Planning)
Mega Menu
One Step Checkout
Order
POS (Point Of Sale)
Search
Shopping Cart
Sitemap
SEO
Social
Stock & Inventory Management
EXTENSIONS BY DEVELOPER
aheadWorks
Amasty
Boost My Shop
BSS Commerce
Magestore
MageWorx
Mirasvit
Templates Master
Wyomind
XTENTO
Magento 2 Documentation
Magento 2 Documentation
2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
vendor
magento
magento2-base
dev
tests
integration
testsuite
Magento
Vault
_files
payment_tokens.php
Go to the documentation of this file.
1
<?php
7
include
"customer.php"
;
8
9
use
Magento\Customer\Model\Customer
;
10
use
Magento\Vault\Model\PaymentToken
;
11
12
$objectManager
=
\Magento\TestFramework\Helper\Bootstrap::getObjectManager
();
13
$paymentTokens
= [
14
[
15
'customer_id'
=> 1,
16
'public_hash'
=>
'1234'
,
17
'payment_method_code'
=>
'first'
,
18
'type'
=>
'simple'
,
19
'expires_at'
=>
'2016-09-04 10:18:15'
,
20
'is_active'
=> 1
21
],
22
[
23
'customer_id'
=> 1,
24
'public_hash'
=>
'12345'
,
25
'payment_method_code'
=>
'second'
,
26
'type'
=>
'simple'
,
27
'expires_at'
=>
'2016-10-04 10:18:15'
,
28
'is_active'
=> 1
29
],
30
[
31
'customer_id'
=> 1,
32
'public_hash'
=>
'23456'
,
33
'payment_method_code'
=>
'third'
,
34
'type'
=>
'notsimple'
,
35
'expires_at'
=>
'2016-11-04 10:18:15'
,
36
'is_active'
=> 1
37
],
38
[
39
'customer_id'
=> 1,
40
'public_hash'
=>
'234567'
,
41
'payment_method_code'
=>
'fourth'
,
42
'type'
=>
'simple'
,
43
'expires_at'
=>
'2016-12-04 10:18:15'
,
44
'is_active'
=> 0
45
],
46
];
48
foreach
(
$paymentTokens
as $tokenData) {
50
$paymentToken
=
$objectManager
->create(PaymentToken::class);
51
$paymentToken
52
->setData($tokenData)
53
->save();
54
}
$objectManager
$objectManager
Definition:
payment_tokens.php:12
$paymentToken
$paymentToken
Definition:
paypal_vault_token.php:27
$paymentTokens
$paymentTokens
Definition:
payment_tokens.php:13
Magento\Customer\Model\Customer
Magento\Vault\Model\PaymentToken
Definition:
PaymentToken.php:16
Magento\TestFramework\Helper\Bootstrap\getObjectManager
static getObjectManager()
Definition:
Bootstrap.php:125