diff --git a/Components/Services/ExpressCheckout/CustomerService.php b/Components/Services/ExpressCheckout/CustomerService.php
index bd212726..00630941 100644
--- a/Components/Services/ExpressCheckout/CustomerService.php
+++ b/Components/Services/ExpressCheckout/CustomerService.php
@@ -139,7 +139,7 @@ public function upsertCustomer(Order $orderStruct)
}
$customerModel->setEmail($payer->getEmailAddress());
-
+ $customerModel->setPaymentId($this->paymentMethodProvider->getPaymentId(PaymentMethodProviderInterface::PAYPAL_UNIFIED_PAYMENT_METHOD_NAME));
$addressForm = $this->formFactory->create(AddressFormType::class, $address);
$addressForm->submit($customerData);
diff --git a/Tests/Functional/Components/Services/ExpressCheckout/CustomerServiceTest.php b/Tests/Functional/Components/Services/ExpressCheckout/CustomerServiceTest.php
index 40432634..6bf6d8a1 100644
--- a/Tests/Functional/Components/Services/ExpressCheckout/CustomerServiceTest.php
+++ b/Tests/Functional/Components/Services/ExpressCheckout/CustomerServiceTest.php
@@ -13,6 +13,7 @@
use PHPUnit\Framework\TestCase;
use Shopware\Models\Customer\Address;
use Shopware\Models\Customer\Customer;
+use SwagPaymentPayPalUnified\Components\PaymentMethodProviderInterface;
use SwagPaymentPayPalUnified\Components\Services\ExpressCheckout\CustomerService;
use SwagPaymentPayPalUnified\PayPalBundle\V2\Api\Order;
use SwagPaymentPayPalUnified\PayPalBundle\V2\Api\Order\Payer;
@@ -78,6 +79,8 @@ public function testUpsertCustomer()
static::assertSame(self::POSTAL_CODE, $createdCustomerShippingAddress->getZipcode());
static::assertSame(self::CITY, $createdCustomerShippingAddress->getCity());
+ $this->updatePaymentMethod((int) $createdCustomer->getId(), -1);
+
// update customer
$orderStruct = $this->createOrderStruct(true);
$orderStruct->getPayer()->setEmailAddress(self::CHANGED_CUSTOMER_EMAIL_ADDRESS);
@@ -104,6 +107,9 @@ public function testUpsertCustomer()
static::assertSame(self::STREET, $updatedCustomerShippingAddress->getStreet());
static::assertSame(self::POSTAL_CODE, $updatedCustomerShippingAddress->getZipcode());
static::assertSame(self::CITY, $updatedCustomerShippingAddress->getCity());
+
+ $payPalPaymentMethodId = $this->getContainer()->get('paypal_unified.payment_method_provider')->getPaymentId(PaymentMethodProviderInterface::PAYPAL_UNIFIED_PAYMENT_METHOD_NAME);
+ static::assertSame($payPalPaymentMethodId, $updatedCustomer->getPaymentId());
}
/**
@@ -302,4 +308,21 @@ private function createShipping()
return $shipping;
}
+
+ /**
+ * @param int $userId
+ * @param int $paymentMethodId
+ *
+ * @return void
+ */
+ private function updatePaymentMethod($userId, $paymentMethodId)
+ {
+ $this->getContainer()->get('dbal_connection')->createQueryBuilder()
+ ->update('s_user')
+ ->set('paymentID', ':paymentId')
+ ->where('id = :userId')
+ ->setParameter('paymentId', $paymentMethodId)
+ ->setParameter('userId', $userId)
+ ->execute();
+ }
}
diff --git a/plugin.xml b/plugin.xml
index b6f5e4e1..5adfbd48 100644
--- a/plugin.xml
+++ b/plugin.xml
@@ -12,6 +12,15 @@
shopware AG
+
+
+ PT-13099 - Bei wiederkehrendem Express-Checkout ist die PayPal Zahlungsart nun korrekt ausgewählt;
+
+
+ PT-13099 - For recurring express checkout, the PayPal payment method is now correctly selected;
+
+
+
PT-13098 - Gutscheinfeld wird im Warenkorb wieder korrekt angezeigt;