Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PISHPS-343: Fix customers with different saleschannels #824

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading