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

Bp 3355 fix error no recipient category found for billink #123

Merged
Changes from 2 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
20 changes: 12 additions & 8 deletions library/checkout/billinkcheckout.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,15 +75,9 @@ public function getBillingAddress()
}
$country = new Country($this->invoice_address->id_country);

$category = self::CUSTOMER_TYPE_B2C;
if ($this->customerType == self::CUSTOMER_TYPE_B2B
|| $this->companyExists($this->invoice_address->company)) {
$category = self::CUSTOMER_TYPE_B2B;
}

$payload = [
'recipient' => [
'category' => $category,
'category' => $this->getRecipientCategory(),
'careOf' => $this->invoice_address->firstname . ' ' . $this->invoice_address->lastname,
'firstName' => $this->invoice_address->firstname,
'lastName' => $this->invoice_address->lastname,
Expand Down Expand Up @@ -134,6 +128,16 @@ public function getArticles()
return $mergedProducts;
}

public function getRecipientCategory()
{
$category = self::CUSTOMER_TYPE_B2C;
if ($this->customerType == self::CUSTOMER_TYPE_B2B
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

think this is incorrect $this->customerType == self::CUSTOMER_TYPE_B2B should be $this->customerType == self::CUSTOMER_TYPE_BOTH

|| $this->companyExists($this->invoice_address->company)) {
$category = self::CUSTOMER_TYPE_B2B;
}
return $category;
}

protected function prepareProductArticles()
{
$articles = [];
Expand Down Expand Up @@ -252,7 +256,7 @@ public function getShippingAddress()

$payload = [
'recipient' => [
'category' => RecipientCategory::PERSON,
'category' => $this->getRecipientCategory(),
'careOf' => $this->shipping_address->firstname . ' ' . $this->shipping_address->lastname,
'firstName' => $this->shipping_address->firstname,
'lastName' => $this->shipping_address->lastname,
Expand Down