From eefb528022ccad3a5930e999ae05dcfd1f22ed39 Mon Sep 17 00:00:00 2001 From: tavi toporjinschi Date: Thu, 16 Mar 2017 13:04:49 +0000 Subject: [PATCH 1/8] Issue #2861181 by bojanz, vasike: Better handling of customer remote IDs for payments. --- .../payment/commerce_payment.post_update.php | 77 +++++++++++++++++++ modules/payment/src/Entity/PaymentMethod.php | 23 ++++++ .../src/Entity/PaymentMethodInterface.php | 17 ++++ .../src/Kernel/Entity/PaymentMethodTest.php | 3 + 4 files changed, 120 insertions(+) create mode 100644 modules/payment/commerce_payment.post_update.php diff --git a/modules/payment/commerce_payment.post_update.php b/modules/payment/commerce_payment.post_update.php new file mode 100644 index 0000000000..0e553d2dac --- /dev/null +++ b/modules/payment/commerce_payment.post_update.php @@ -0,0 +1,77 @@ +exists('commerce_remote_id')->execute(); + + // Use the sandbox to store the information needed to track progression. + if (!isset($sandbox['current'])) { + // The count of entities visited so far. + $sandbox['current'] = 0; + // Total entities that must be visited. + $sandbox['max'] = count($result); + // A place to store messages during the run. + } + + // Get the first payment gateway for every payment module. + $payment_gateways_by_module = []; + /** @var \Drupal\commerce_payment\PaymentGatewayStorageInterface $payment_gateway_storage */ + $payment_gateway_storage = \Drupal::entityTypeManager()->getStorage('commerce_payment_gateway'); + $payment_gateways = $payment_gateway_storage->loadMultiple(); + uasort($payment_gateways, [$payment_gateway_storage->getEntityType()->getClass(), 'sort']); + foreach ($payment_gateways as $payment_gateway) { + $payment_gateway_data = $payment_gateway->toArray(); + $module = reset($payment_gateway_data['dependencies']['module']); + if (!isset($payment_gateways_by_module[$module])) { + $payment_gateways_by_module[$module] = $payment_gateway; + } + } + + // Process entities by groups of 20. + $limit = 20; + $result = array_slice($result, $sandbox['current'], $limit); + $user_storage = \Drupal::entityTypeManager()->getStorage('user'); + + foreach ($result as $uid) { + $user = $user_storage->load($uid); + + $save = FALSE; + /** @var \Drupal\commerce\Plugin\Field\FieldType\RemoteIdFieldItemListInterface $remote_ids */ + $remote_ids = $user->commerce_remote_id; + /** @var \Drupal\commerce\Plugin\Field\FieldType\RemoteIdItem $item */ + foreach ($remote_ids as $index => $item) { + $current_provider = $item->getValue()['provider']; + if (in_array($current_provider, array_keys($payment_gateways_by_module))) { + $item->set('provider', $payment_gateways_by_module[$current_provider]->id()); + $save = TRUE; + } + elseif (!in_array($current_provider, array_keys($payment_gateways))) { + // Delete "orphaned" Remote Ids. + $remote_ids->removeItem($index); + $save = TRUE; + } + } + if ($save) { + $user->save(); + } + + // Update our progress information. + $sandbox['current']++; + } + + $sandbox['#finished'] = empty($sandbox['max']) ? 1 : ($sandbox['current'] / $sandbox['max']); + + if ($sandbox['#finished'] >= 1) { + return t('The user Remote ID field data for payments updated.'); + } + +} diff --git a/modules/payment/src/Entity/PaymentMethod.php b/modules/payment/src/Entity/PaymentMethod.php index 3036346204..5ea39f313b 100644 --- a/modules/payment/src/Entity/PaymentMethod.php +++ b/modules/payment/src/Entity/PaymentMethod.php @@ -221,6 +221,29 @@ public function setCreatedTime($timestamp) { return $this; } + /** + * {@inheritdoc} + */ + public function getOwnerRemoteId() { + $remote_id = NULL; + $owner = $this->getOwner(); + if ($owner) { + $remote_id = $owner->commerce_remote_id->getByProvider($this->getPaymentGatewayId()); + } + return $remote_id; + } + + /** + * {@inheritdoc} + */ + public function setOwnerRemoteId($remote_id) { + $owner = $this->getOwner(); + if ($owner) { + $owner->commerce_remote_id->setByProvider($this->getPaymentGatewayId(), $remote_id); + $owner->save(); + } + } + /** * {@inheritdoc} */ diff --git a/modules/payment/src/Entity/PaymentMethodInterface.php b/modules/payment/src/Entity/PaymentMethodInterface.php index b4ba953485..288e1b6915 100644 --- a/modules/payment/src/Entity/PaymentMethodInterface.php +++ b/modules/payment/src/Entity/PaymentMethodInterface.php @@ -136,4 +136,21 @@ public function getCreatedTime(); */ public function setCreatedTime($timestamp); + /** + * Gets the user remote ID for the payment method if any. + * + * @return string|null + * The user remote ID for the payment method or NULL. + */ + public function getOwnerRemoteId(); + + /** + * Sets the user remote ID for the payment method using the payment gateway id + * as provider. + * + * @param string $remote_id + * The remote ID. + */ + public function setOwnerRemoteId($remote_id); + } diff --git a/modules/payment/tests/src/Kernel/Entity/PaymentMethodTest.php b/modules/payment/tests/src/Kernel/Entity/PaymentMethodTest.php index 9b15cc8dcf..527ff827c3 100644 --- a/modules/payment/tests/src/Kernel/Entity/PaymentMethodTest.php +++ b/modules/payment/tests/src/Kernel/Entity/PaymentMethodTest.php @@ -138,6 +138,9 @@ public function testPaymentMethod() { $payment_method->setCreatedTime(635879700); $this->assertEquals(635879700, $payment_method->getCreatedTime()); + + $payment_method->setOwnerRemoteId('123456'); + $this->assertEquals('123456', $payment_method->getOwnerRemoteId()); } } From 9e3cbd5562123394f50fa75045b3de0a6c3ecf0f Mon Sep 17 00:00:00 2001 From: tavi toporjinschi Date: Thu, 16 Mar 2017 13:42:45 +0000 Subject: [PATCH 2/8] Travis error 1. --- modules/payment/commerce_payment.post_update.php | 1 + 1 file changed, 1 insertion(+) diff --git a/modules/payment/commerce_payment.post_update.php b/modules/payment/commerce_payment.post_update.php index 0e553d2dac..28d5fd11ae 100644 --- a/modules/payment/commerce_payment.post_update.php +++ b/modules/payment/commerce_payment.post_update.php @@ -7,6 +7,7 @@ /** * Update user Remote ID field data using payments gateways instead of module. + * * @see https://www.drupal.org/node/2861181 */ function commerce_payment_post_update_1(&$sandbox) { From 00e15a4949c00045455b3c344bb12eb7ba6c50df Mon Sep 17 00:00:00 2001 From: tavi toporjinschi Date: Thu, 16 Mar 2017 15:43:44 +0000 Subject: [PATCH 3/8] PR request 1 - First check is any user has the field set. --- modules/payment/commerce_payment.post_update.php | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/modules/payment/commerce_payment.post_update.php b/modules/payment/commerce_payment.post_update.php index 28d5fd11ae..b9bfd5708b 100644 --- a/modules/payment/commerce_payment.post_update.php +++ b/modules/payment/commerce_payment.post_update.php @@ -11,7 +11,11 @@ * @see https://www.drupal.org/node/2861181 */ function commerce_payment_post_update_1(&$sandbox) { - // Get the user ids that have 'commerce_remote_id' field not emtpy. + // Get the user ids that have 'commerce_remote_id' field not empty. + // First check is any user has this field set. + if (\Drupal::entityQuery('user')->exists('commerce_remote_id')->count()->execute() == 0) { + return t('No user Remote ID field data to update.'); + } $result = \Drupal::entityQuery('user')->exists('commerce_remote_id')->execute(); // Use the sandbox to store the information needed to track progression. From 4ea46ac551ffe521c396d92a98c89b39b420c4bd Mon Sep 17 00:00:00 2001 From: tavi toporjinschi Date: Fri, 17 Mar 2017 11:40:18 +0000 Subject: [PATCH 4/8] Improve update script - PR request. --- .../payment/commerce_payment.post_update.php | 66 ++++++++++--------- 1 file changed, 36 insertions(+), 30 deletions(-) diff --git a/modules/payment/commerce_payment.post_update.php b/modules/payment/commerce_payment.post_update.php index b9bfd5708b..b8092149b8 100644 --- a/modules/payment/commerce_payment.post_update.php +++ b/modules/payment/commerce_payment.post_update.php @@ -11,43 +11,48 @@ * @see https://www.drupal.org/node/2861181 */ function commerce_payment_post_update_1(&$sandbox) { - // Get the user ids that have 'commerce_remote_id' field not empty. - // First check is any user has this field set. - if (\Drupal::entityQuery('user')->exists('commerce_remote_id')->count()->execute() == 0) { - return t('No user Remote ID field data to update.'); - } - $result = \Drupal::entityQuery('user')->exists('commerce_remote_id')->execute(); - // Use the sandbox to store the information needed to track progression. if (!isset($sandbox['current'])) { - // The count of entities visited so far. - $sandbox['current'] = 0; - // Total entities that must be visited. - $sandbox['max'] = count($result); - // A place to store messages during the run. - } + // First check is any user has this field set. + if ($count = \Drupal::entityQuery('user')->exists('commerce_remote_id')->count()->execute()) { + // The count of entities visited so far. + $sandbox['current'] = 0; + // Total entities that must be visited. + $sandbox['max'] = $count; + // A place to store messages during the run. - // Get the first payment gateway for every payment module. - $payment_gateways_by_module = []; - /** @var \Drupal\commerce_payment\PaymentGatewayStorageInterface $payment_gateway_storage */ - $payment_gateway_storage = \Drupal::entityTypeManager()->getStorage('commerce_payment_gateway'); - $payment_gateways = $payment_gateway_storage->loadMultiple(); - uasort($payment_gateways, [$payment_gateway_storage->getEntityType()->getClass(), 'sort']); - foreach ($payment_gateways as $payment_gateway) { - $payment_gateway_data = $payment_gateway->toArray(); - $module = reset($payment_gateway_data['dependencies']['module']); - if (!isset($payment_gateways_by_module[$module])) { - $payment_gateways_by_module[$module] = $payment_gateway; + // Get the first payment gateway for every payment module. + $payment_gateways_by_module = []; + /** @var \Drupal\commerce_payment\PaymentGatewayStorageInterface $payment_gateway_storage */ + $payment_gateway_storage = \Drupal::entityTypeManager()->getStorage('commerce_payment_gateway'); + $payment_gateways = $payment_gateway_storage->loadMultiple(); + uasort($payment_gateways, [$payment_gateway_storage->getEntityType()->getClass(), 'sort']); + foreach ($payment_gateways as $payment_gateway) { + $payment_gateway_data = $payment_gateway->toArray(); + $module = reset($payment_gateway_data['dependencies']['module']); + if (!isset($payment_gateways_by_module[$module])) { + $payment_gateways_by_module[$module] = $payment_gateway; + } + } + $sandbox['payment_gateways'] = $payment_gateways; + $sandbox['payment_gateways_by_module'] = $payment_gateways_by_module; + $sandbox['user_storage'] = \Drupal::entityTypeManager()->getStorage('user'); + } + else { + return t('No user Remote ID field data to update.'); } } // Process entities by groups of 20. $limit = 20; - $result = array_slice($result, $sandbox['current'], $limit); - $user_storage = \Drupal::entityTypeManager()->getStorage('user'); + // Get the user ids that have 'commerce_remote_id' field not empty. + $result = \Drupal::entityQuery('user') + ->exists('commerce_remote_id') + ->range($sandbox['current'], $limit) + ->execute(); foreach ($result as $uid) { - $user = $user_storage->load($uid); + $user = $sandbox['user_storage']->load($uid); $save = FALSE; /** @var \Drupal\commerce\Plugin\Field\FieldType\RemoteIdFieldItemListInterface $remote_ids */ @@ -55,11 +60,12 @@ function commerce_payment_post_update_1(&$sandbox) { /** @var \Drupal\commerce\Plugin\Field\FieldType\RemoteIdItem $item */ foreach ($remote_ids as $index => $item) { $current_provider = $item->getValue()['provider']; - if (in_array($current_provider, array_keys($payment_gateways_by_module))) { - $item->set('provider', $payment_gateways_by_module[$current_provider]->id()); + if (in_array($current_provider, array_keys($sandbox['payment_gateways_by_module']))) { + $payment_gateway = $sandbox['payment_gateways_by_module'][$current_provider]; + $item->set('provider', $payment_gateway->id() . '-' . $payment_gateway->getPlugin()->getMode()); $save = TRUE; } - elseif (!in_array($current_provider, array_keys($payment_gateways))) { + elseif (!in_array($current_provider, array_keys($sandbox['payment_gateways']))) { // Delete "orphaned" Remote Ids. $remote_ids->removeItem($index); $save = TRUE; From cedb8c0cb513310815684c6a903d4bc59765c1cb Mon Sep 17 00:00:00 2001 From: tavi toporjinschi Date: Fri, 17 Mar 2017 11:40:57 +0000 Subject: [PATCH 5/8] Use payment gateway mode for the Remote id provider value. --- modules/payment/src/Entity/PaymentMethod.php | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/modules/payment/src/Entity/PaymentMethod.php b/modules/payment/src/Entity/PaymentMethod.php index 5ea39f313b..67423b8238 100644 --- a/modules/payment/src/Entity/PaymentMethod.php +++ b/modules/payment/src/Entity/PaymentMethod.php @@ -228,7 +228,8 @@ public function getOwnerRemoteId() { $remote_id = NULL; $owner = $this->getOwner(); if ($owner) { - $remote_id = $owner->commerce_remote_id->getByProvider($this->getPaymentGatewayId()); + $payment_gateway = $this->getPaymentGateway(); + $remote_id = $owner->commerce_remote_id->getByProvider($payment_gateway->id() . '-' . $payment_gateway->getPlugin()->getMode()); } return $remote_id; } @@ -239,7 +240,8 @@ public function getOwnerRemoteId() { public function setOwnerRemoteId($remote_id) { $owner = $this->getOwner(); if ($owner) { - $owner->commerce_remote_id->setByProvider($this->getPaymentGatewayId(), $remote_id); + $payment_gateway = $this->getPaymentGateway(); + $owner->commerce_remote_id->setByProvider($payment_gateway->id() . '-' . $payment_gateway->getPlugin()->getMode(), $remote_id); $owner->save(); } } From ceedc33305fb67404dd219235a8640b71d223e02 Mon Sep 17 00:00:00 2001 From: Matt Glaman Date: Fri, 17 Mar 2017 07:52:08 -0500 Subject: [PATCH 6/8] Update commerce_payment.post_update.php --- modules/payment/commerce_payment.post_update.php | 1 - 1 file changed, 1 deletion(-) diff --git a/modules/payment/commerce_payment.post_update.php b/modules/payment/commerce_payment.post_update.php index b8092149b8..a4d977e20a 100644 --- a/modules/payment/commerce_payment.post_update.php +++ b/modules/payment/commerce_payment.post_update.php @@ -19,7 +19,6 @@ function commerce_payment_post_update_1(&$sandbox) { $sandbox['current'] = 0; // Total entities that must be visited. $sandbox['max'] = $count; - // A place to store messages during the run. // Get the first payment gateway for every payment module. $payment_gateways_by_module = []; From 9462767b7810972ac6ce98665bcb0bfbd6cf2539 Mon Sep 17 00:00:00 2001 From: tavi toporjinschi Date: Mon, 3 Apr 2017 19:38:34 +0000 Subject: [PATCH 7/8] Move the helper methods to PaymentGatewayBase. --- modules/payment/src/Entity/PaymentMethod.php | 25 ------------------- .../src/Entity/PaymentMethodInterface.php | 17 ------------- .../PaymentGateway/PaymentGatewayBase.php | 22 ++++++++++++++++ .../PaymentGatewayInterface.php | 22 ++++++++++++++++ .../PaymentCheckoutTest.php | 15 +++++++++-- .../src/Kernel/Entity/PaymentMethodTest.php | 3 --- .../Plugin/Commerce/PaymentGateway/Onsite.php | 6 +++++ 7 files changed, 63 insertions(+), 47 deletions(-) diff --git a/modules/payment/src/Entity/PaymentMethod.php b/modules/payment/src/Entity/PaymentMethod.php index 67423b8238..3036346204 100644 --- a/modules/payment/src/Entity/PaymentMethod.php +++ b/modules/payment/src/Entity/PaymentMethod.php @@ -221,31 +221,6 @@ public function setCreatedTime($timestamp) { return $this; } - /** - * {@inheritdoc} - */ - public function getOwnerRemoteId() { - $remote_id = NULL; - $owner = $this->getOwner(); - if ($owner) { - $payment_gateway = $this->getPaymentGateway(); - $remote_id = $owner->commerce_remote_id->getByProvider($payment_gateway->id() . '-' . $payment_gateway->getPlugin()->getMode()); - } - return $remote_id; - } - - /** - * {@inheritdoc} - */ - public function setOwnerRemoteId($remote_id) { - $owner = $this->getOwner(); - if ($owner) { - $payment_gateway = $this->getPaymentGateway(); - $owner->commerce_remote_id->setByProvider($payment_gateway->id() . '-' . $payment_gateway->getPlugin()->getMode(), $remote_id); - $owner->save(); - } - } - /** * {@inheritdoc} */ diff --git a/modules/payment/src/Entity/PaymentMethodInterface.php b/modules/payment/src/Entity/PaymentMethodInterface.php index 288e1b6915..b4ba953485 100644 --- a/modules/payment/src/Entity/PaymentMethodInterface.php +++ b/modules/payment/src/Entity/PaymentMethodInterface.php @@ -136,21 +136,4 @@ public function getCreatedTime(); */ public function setCreatedTime($timestamp); - /** - * Gets the user remote ID for the payment method if any. - * - * @return string|null - * The user remote ID for the payment method or NULL. - */ - public function getOwnerRemoteId(); - - /** - * Sets the user remote ID for the payment method using the payment gateway id - * as provider. - * - * @param string $remote_id - * The remote ID. - */ - public function setOwnerRemoteId($remote_id); - } diff --git a/modules/payment/src/Plugin/Commerce/PaymentGateway/PaymentGatewayBase.php b/modules/payment/src/Plugin/Commerce/PaymentGateway/PaymentGatewayBase.php index e732b56115..c38543aec9 100644 --- a/modules/payment/src/Plugin/Commerce/PaymentGateway/PaymentGatewayBase.php +++ b/modules/payment/src/Plugin/Commerce/PaymentGateway/PaymentGatewayBase.php @@ -12,6 +12,7 @@ use Drupal\Core\Plugin\ContainerFactoryPluginInterface; use Drupal\Core\Plugin\PluginBase; use Drupal\Core\Plugin\PluginWithFormsTrait; +use Drupal\user\UserInterface; use Symfony\Component\DependencyInjection\ContainerInterface; /** @@ -319,4 +320,25 @@ public function buildPaymentOperations(PaymentInterface $payment) { return $operations; } + /** + * {@inheritdoc} + */ + public function getOwnerRemoteId(UserInterface $user) { + $remote_id = NULL; + if ($user->isAuthenticated()) { + $remote_id = $user->commerce_remote_id->getByProvider($this->entityId . '-' . $this->getMode()); + } + return $remote_id; + } + + /** + * {@inheritdoc} + */ + public function setOwnerRemoteId(UserInterface $user, $remote_id) { + if ($user->isAuthenticated()) { + $user->commerce_remote_id->setByProvider($this->entityId . '-' . $this->getMode(), $remote_id); + $user->save(); + } + } + } diff --git a/modules/payment/src/Plugin/Commerce/PaymentGateway/PaymentGatewayInterface.php b/modules/payment/src/Plugin/Commerce/PaymentGateway/PaymentGatewayInterface.php index 0d94eee8d8..0157713ab1 100644 --- a/modules/payment/src/Plugin/Commerce/PaymentGateway/PaymentGatewayInterface.php +++ b/modules/payment/src/Plugin/Commerce/PaymentGateway/PaymentGatewayInterface.php @@ -7,6 +7,7 @@ use Drupal\Component\Plugin\DerivativeInspectionInterface; use Drupal\Core\Plugin\PluginFormInterface; use Drupal\Core\Plugin\PluginWithFormsInterface; +use Drupal\user\UserInterface; /** * Defines the base interface for payment gateways. @@ -112,4 +113,25 @@ public function getCreditCardTypes(); */ public function buildPaymentOperations(PaymentInterface $payment); + /** + * Gets the user remote ID for the payment gateway if any. + * + * @param \Drupal\user\UserInterface + * The user. + * + * @return string|null + * The user remote ID for the payment method or NULL. + */ + public function getOwnerRemoteId(UserInterface $user); + + /** + * Sets the user remote ID for the payment gateways. + * + * @param \Drupal\user\UserInterface + * The user. + * @param string $remote_id + * The remote ID. + */ + public function setOwnerRemoteId(UserInterface $user, $remote_id); + } diff --git a/modules/payment/tests/src/FunctionalJavascript/PaymentCheckoutTest.php b/modules/payment/tests/src/FunctionalJavascript/PaymentCheckoutTest.php index bebd9b80c1..5d266eb6de 100644 --- a/modules/payment/tests/src/FunctionalJavascript/PaymentCheckoutTest.php +++ b/modules/payment/tests/src/FunctionalJavascript/PaymentCheckoutTest.php @@ -227,8 +227,14 @@ public function testCheckoutWithExistingPaymentMethod() { $this->assertSession()->pageTextContains('Your order number is 1. You can view your order on your account page when logged in.'); $order = Order::load(1); - $this->assertEquals('onsite', $order->get('payment_gateway')->target_id); - $this->assertEquals('1', $order->get('payment_method')->target_id); + /** @var \Drupal\commerce_payment\Entity\PaymentMethodInterface $payment_method */ + $payment_method = $order->get('payment_method')->entity; + $this->assertEquals('1', $payment_method->id()); + /** @var \Drupal\commerce_payment\Entity\PaymentGatewayInterface $payment_gateway */ + $payment_gateway = $order->get('payment_gateway')->entity; + $this->assertEquals('onsite', $payment_gateway->id()); + $payment_gateway_plugin = $payment_gateway->getPlugin(); + $this->assertNull($payment_gateway_plugin->getOwnerRemoteId($payment_method->getOwner())); // Verify that a payment was created. $payment = Payment::load(1); @@ -283,6 +289,11 @@ public function testCheckoutWithNewPaymentMethod() { $payment_method = $order->get('payment_method')->entity; $this->assertEquals('1881', $payment_method->get('card_number')->value); $this->assertEquals('123 New York Drive', $payment_method->getBillingProfile()->get('address')->address_line1); + /** @var \Drupal\commerce_payment\Entity\PaymentGatewayInterface $payment_gateway */ + $payment_gateway = $order->get('payment_gateway')->entity; + $payment_gateway_plugin = $payment_gateway->getPlugin(); + $owner = $payment_method->getOwner(); + $this->assertEquals($owner->id(), $payment_gateway_plugin->getOwnerRemoteId($owner)); // Verify that a payment was created. $payment = Payment::load(1); diff --git a/modules/payment/tests/src/Kernel/Entity/PaymentMethodTest.php b/modules/payment/tests/src/Kernel/Entity/PaymentMethodTest.php index 527ff827c3..9b15cc8dcf 100644 --- a/modules/payment/tests/src/Kernel/Entity/PaymentMethodTest.php +++ b/modules/payment/tests/src/Kernel/Entity/PaymentMethodTest.php @@ -138,9 +138,6 @@ public function testPaymentMethod() { $payment_method->setCreatedTime(635879700); $this->assertEquals(635879700, $payment_method->getCreatedTime()); - - $payment_method->setOwnerRemoteId('123456'); - $this->assertEquals('123456', $payment_method->getOwnerRemoteId()); } } diff --git a/modules/payment_example/src/Plugin/Commerce/PaymentGateway/Onsite.php b/modules/payment_example/src/Plugin/Commerce/PaymentGateway/Onsite.php index 9c22df1744..7c7ca7b062 100644 --- a/modules/payment_example/src/Plugin/Commerce/PaymentGateway/Onsite.php +++ b/modules/payment_example/src/Plugin/Commerce/PaymentGateway/Onsite.php @@ -209,6 +209,12 @@ public function createPaymentMethod(PaymentMethodInterface $payment_method, arra } } + // Payment method remote owner id. + $owner = $payment_method->getOwner(); + if (!$this->getOwnerRemoteId($owner)) { + $this->setOwnerRemoteId($owner, $owner->id()); + } + // Perform the create request here, throw an exception if it fails. // See \Drupal\commerce_payment\Exception for the available exceptions. // You might need to do different API requests based on whether the From f05acb2f808c5e46889ad624891fc59746509360 Mon Sep 17 00:00:00 2001 From: tavi toporjinschi Date: Mon, 3 Apr 2017 20:18:00 +0000 Subject: [PATCH 8/8] Fix for code standards. --- .../Commerce/PaymentGateway/PaymentGatewayInterface.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/modules/payment/src/Plugin/Commerce/PaymentGateway/PaymentGatewayInterface.php b/modules/payment/src/Plugin/Commerce/PaymentGateway/PaymentGatewayInterface.php index 0157713ab1..cbe373a0c1 100644 --- a/modules/payment/src/Plugin/Commerce/PaymentGateway/PaymentGatewayInterface.php +++ b/modules/payment/src/Plugin/Commerce/PaymentGateway/PaymentGatewayInterface.php @@ -116,18 +116,18 @@ public function buildPaymentOperations(PaymentInterface $payment); /** * Gets the user remote ID for the payment gateway if any. * - * @param \Drupal\user\UserInterface + * @param \Drupal\user\UserInterface $user * The user. * * @return string|null - * The user remote ID for the payment method or NULL. + * The user remote ID for the payment gateway or NULL. */ public function getOwnerRemoteId(UserInterface $user); /** - * Sets the user remote ID for the payment gateways. + * Sets the user remote ID for the payment gateway. * - * @param \Drupal\user\UserInterface + * @param \Drupal\user\UserInterface $user * The user. * @param string $remote_id * The remote ID.