Skip to content

Commit e6dea5b

Browse files
committed
Added code to the PaymentTokenFactory class for backwards compatibility reasons.
1 parent bea1a3c commit e6dea5b

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

app/code/Magento/Vault/Model/PaymentTokenFactory.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,17 @@ public function __construct(ObjectManagerInterface $objectManager, $tokenTypes =
3939
*/
4040
public function create($type = null)
4141
{
42+
/**
43+
* This code added for Backward Compatibility reasons only, as previous implementation of Code Generated factory
44+
* accepted an array as any other code generated factory
45+
*/
46+
if(is_array($type)) {
47+
return $this->objectManager->create(
48+
PaymentTokenInterface::class,
49+
['data' => $type]
50+
);
51+
}
52+
4253
if ($type !== null && !in_array($type, $this->tokenTypes, true)) {
4354
throw new \LogicException('There is no such payment token type: ' . $type);
4455
}

0 commit comments

Comments
 (0)