Skip to content

Commit

Permalink
NTR: PISHPS-343: Fix customers with different saleschannels (#824)
Browse files Browse the repository at this point in the history
Co-authored-by: Vitalij Mik <[email protected]>
  • Loading branch information
BlackScorp and Vitalij Mik authored Sep 4, 2024
1 parent 3e856ed commit 894c1fc
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/Service/CustomerService.php
Original file line number Diff line number Diff line change
Expand Up @@ -584,7 +584,7 @@ public function createMollieCustomer(string $customerId, string $salesChannelId,
throw new CustomerCouldNotBeFoundException($customerId);
}

$mollieCustomer = $this->customerApiService->createCustomerAtMollie($customer);
$mollieCustomer = $this->customerApiService->createCustomerAtMollie($customer, $salesChannelId);

$this->setMollieCustomerId(
$customerId,
Expand Down
4 changes: 2 additions & 2 deletions src/Service/MollieApi/Customer.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,10 @@ public function getMollieCustomerById(string $customerId, string $salesChannelId
* @throws CouldNotCreateMollieCustomerException
* @return MollieCustomer
*/
public function createCustomerAtMollie(CustomerEntity $customer): MollieCustomer
public function createCustomerAtMollie(CustomerEntity $customer, string $salesChannelId): MollieCustomer
{
try {
$apiClient = $this->clientFactory->getClient($customer->getSalesChannelId());
$apiClient = $this->clientFactory->getClient($salesChannelId);

return $apiClient->customers->create([
'name' => $customer->getFirstName() . ' ' . $customer->getLastName(),
Expand Down
4 changes: 2 additions & 2 deletions tests/PHPUnit/Service/MollieApi/CustomerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public function testCreatingNewCustomerAtMollie()
'getSalesChannelId' => 'buzz',
]);

$actualInstance = $this->customerApiService->createCustomerAtMollie($customerMock);
$actualInstance = $this->customerApiService->createCustomerAtMollie($customerMock,'buzz');
$this->assertInstanceOf(Customer::class, $actualInstance);
}

Expand All @@ -91,7 +91,7 @@ public function testCreatingNewCustomerAtMollieWithExistingEmailAddress()
'getSalesChannelId' => 'buzz',
]);

$this->customerApiService->createCustomerAtMollie($customerMock);
$this->customerApiService->createCustomerAtMollie($customerMock,'buzz');
}

/**
Expand Down

0 comments on commit 894c1fc

Please sign in to comment.