Skip to content

Commit bc0611c

Browse files
committed
AC-2901:AC-2901:Vault/Stored Payment Methods are not saved per store
1 parent 664faaa commit bc0611c

File tree

3 files changed

+40
-0
lines changed

3 files changed

+40
-0
lines changed

app/code/Magento/Vault/Api/Data/PaymentTokenInterface.php

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,11 @@ interface PaymentTokenInterface
6161
*/
6262
const IS_VISIBLE = 'is_visible';
6363

64+
/*
65+
* Vault website id
66+
*/
67+
const WEBSITE_ID = 'website_id';
68+
6469
/**
6570
* Gets the entity ID.
6671
*
@@ -249,4 +254,20 @@ public function getIsVisible();
249254
* @since 100.1.0
250255
*/
251256
public function setIsVisible($isVisible);
257+
258+
/**
259+
* Gets vault payment website id.
260+
*
261+
* @return int website id.
262+
* @SuppressWarnings(PHPMD.BooleanGetMethodName)
263+
*/
264+
public function getWebsiteId();
265+
266+
/**
267+
* Sets vault payment website id.
268+
*
269+
* @param int $websiteId
270+
* @return $this
271+
*/
272+
public function setWebsiteId(int $websiteId);
252273
}

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

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,4 +214,22 @@ public function setIsVisible($isVisible)
214214
$this->setData(PaymentTokenInterface::IS_VISIBLE, (bool) $isVisible);
215215
return $this;
216216
}
217+
218+
/**
219+
* @inheritdoc
220+
*/
221+
public function getWebsiteId()
222+
{
223+
return $this->getData(PaymentTokenInterface::WEBSITE_ID);
224+
}
225+
226+
/**
227+
* @inheritdoc
228+
*/
229+
public function setWebsiteId(int $websiteId)
230+
{
231+
$this->setData(PaymentTokenInterface::WEBSITE_ID, $websiteId);
232+
233+
return $this;
234+
}
217235
}

app/code/Magento/Vault/Observer/AfterPaymentSaveObserver.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ public function execute(Observer $observer)
7575
$paymentToken->setCustomerId($order->getCustomerId());
7676
$paymentToken->setIsActive(true);
7777
$paymentToken->setPaymentMethodCode($payment->getMethod());
78+
$paymentToken->setWebsiteId($order->getStore()->getWebsiteId());
7879

7980
$additionalInformation = $payment->getAdditionalInformation();
8081
$paymentToken->setIsVisible(

0 commit comments

Comments
 (0)